[jboss-cvs] JBossAS SVN: r99037 - in projects/reloaded/trunk/vdf-bootstrap-minimal: src/test/java and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Jan 5 13:06:15 EST 2010


Author: ALRubinger
Date: 2010-01-05 13:06:14 -0500 (Tue, 05 Jan 2010)
New Revision: 99037

Removed:
   projects/reloaded/trunk/vdf-bootstrap-minimal/src/test/java/DeployersOrderingStressTestStandaloneHarness.java
   projects/reloaded/trunk/vdf-bootstrap-minimal/src/test/java/DeployersOrderingStressUnitTest.java
Modified:
   projects/reloaded/trunk/vdf-bootstrap-minimal/pom.xml
   projects/reloaded/trunk/vdf-bootstrap-minimal/src/test/java/MainDeployerTestBase.java
Log:
[RELOADED-10][JBDEPLOY-230] Remove deployers stress tests (as covered in JBDEPLOY now) and update VDF-minimal dependencies

Modified: projects/reloaded/trunk/vdf-bootstrap-minimal/pom.xml
===================================================================
--- projects/reloaded/trunk/vdf-bootstrap-minimal/pom.xml	2010-01-05 17:55:09 UTC (rev 99036)
+++ projects/reloaded/trunk/vdf-bootstrap-minimal/pom.xml	2010-01-05 18:06:14 UTC (rev 99037)
@@ -20,7 +20,7 @@
 
   <properties>
     <!-- Versioning -->
-    <version.org.jboss.bootstrap_jboss.bootstrap.impl.mc>2.0.0-alpha-3</version.org.jboss.bootstrap_jboss.bootstrap.impl.mc>
+    <version.org.jboss.bootstrap>2.1.0-SNAPSHOT</version.org.jboss.bootstrap>
   </properties>
 
   <build>
@@ -122,7 +122,7 @@
     <dependency>
       <groupId>org.jboss.bootstrap</groupId>
       <artifactId>jboss-bootstrap-impl-mc</artifactId>
-      <version>${version.org.jboss.bootstrap_jboss.bootstrap.impl.mc}</version>
+      <version>${version.org.jboss.bootstrap}</version>
     </dependency>
     <dependency>
       <groupId>org.jboss.deployers</groupId>
@@ -190,7 +190,7 @@
     <dependency>
       <groupId>org.jboss.shrinkwrap</groupId>
       <artifactId>shrinkwrap-impl-base</artifactId>
-      <version>1.0.0-alpha-2</version>
+      <version>1.0.0-alpha-3</version>
       <scope>test</scope>
     </dependency>
 

Deleted: projects/reloaded/trunk/vdf-bootstrap-minimal/src/test/java/DeployersOrderingStressTestStandaloneHarness.java
===================================================================
--- projects/reloaded/trunk/vdf-bootstrap-minimal/src/test/java/DeployersOrderingStressTestStandaloneHarness.java	2010-01-05 17:55:09 UTC (rev 99036)
+++ projects/reloaded/trunk/vdf-bootstrap-minimal/src/test/java/DeployersOrderingStressTestStandaloneHarness.java	2010-01-05 18:06:14 UTC (rev 99037)
@@ -1,71 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * Standalone client which may act as an entry hook for Profilers.
- * The Maven build will install all library dependencies under 
- * target/dependency for easy addition to the profiling ClassPath.
- * This test targets {@link DeployersOrderingStressUnitTest}
- * 
- * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
- * @version $Revision: $
- */
-public class DeployersOrderingStressTestStandaloneHarness
-{
-
-   //-------------------------------------------------------------------------------------||
-   // Class Members ----------------------------------------------------------------------||
-   //-------------------------------------------------------------------------------------||
-
-   //-------------------------------------------------------------------------------------||
-   // Main -------------------------------------------------------------------------------||
-   //-------------------------------------------------------------------------------------||
-
-   /**
-    * Entry
-    */
-   public static void main(final String... args)
-   {
-
-      try
-      {
-         new DeployersOrderingStressTestStandaloneHarness();
-      }
-      catch (final Throwable t)
-      {
-         throw new RuntimeException("Could not start test", t);
-      }
-   }
-
-   //-------------------------------------------------------------------------------------||
-   // Constructor ------------------------------------------------------------------------||
-   //-------------------------------------------------------------------------------------||
-
-   /**
-    * Creates a new instance and runs a test
-    */
-   public DeployersOrderingStressTestStandaloneHarness() throws Throwable
-   {
-      final DeployersOrderingStressUnitTest test = new DeployersOrderingStressUnitTest();
-      DeployersOrderingStressUnitTest.setupJBossXb();
-      DeployersOrderingStressUnitTest.createAndConfigureServer();
-      test.startServer();
-      test.addOneHundredDeployers();
-      test.stopServer();
-   }
-
-}

Deleted: projects/reloaded/trunk/vdf-bootstrap-minimal/src/test/java/DeployersOrderingStressUnitTest.java
===================================================================
--- projects/reloaded/trunk/vdf-bootstrap-minimal/src/test/java/DeployersOrderingStressUnitTest.java	2010-01-05 17:55:09 UTC (rev 99036)
+++ projects/reloaded/trunk/vdf-bootstrap-minimal/src/test/java/DeployersOrderingStressUnitTest.java	2010-01-05 18:06:14 UTC (rev 99037)
@@ -1,263 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
-  *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-import java.net.URL;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-
-import junit.framework.TestCase;
-
-import org.jboss.beans.metadata.spi.builder.BeanMetaDataBuilder;
-import org.jboss.bootstrap.api.lifecycle.LifecycleState;
-import org.jboss.bootstrap.api.mc.server.MCServer;
-import org.jboss.bootstrap.api.mc.server.MCServerFactory;
-import org.jboss.deployers.client.spi.main.MainDeployer;
-import org.jboss.deployers.spi.DeploymentException;
-import org.jboss.deployers.spi.deployer.Deployer;
-import org.jboss.deployers.spi.deployer.helpers.AbstractDeployer;
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.kernel.Kernel;
-import org.jboss.logging.Logger;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-/**
- * Stress test to show geometric degradation when adding 
- * increasingly incrementing {@link Deployer} instances into
- * MC 
- * 
- * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
- * @version $Revision: $
- */
-public class DeployersOrderingStressUnitTest
-{
-   //-------------------------------------------------------------------------------------||
-   // Class Members ----------------------------------------------------------------------||
-   //-------------------------------------------------------------------------------------||
-
-   /**
-    * Logger
-    */
-   private static final Logger log = Logger.getLogger(MainDeployerViaBootstrapUnitTest.class);
-
-   /**
-    * The Server
-    */
-   private static MCServer server;
-
-   /**
-    * Name of the system property signaling JBossXB to ignore order
-    */
-   private static final String NAME_SYSPROP_JBOSSXB_IGNORE_ORDER = "xb.builder.useUnorderedSequence";
-
-   /**
-    * Value to set for JBossXB ordering
-    */
-   private static final String VALUE_SYSPROP_JBOSSXB_IGNORE_ORDER = "true";
-
-   //-------------------------------------------------------------------------------------||
-   // Lifecycle --------------------------------------------------------------------------||
-   //-------------------------------------------------------------------------------------||
-
-   /**
-    * Setup JBossXB
-    * TODO @see comments below so that this step is not necessary
-    */
-   @BeforeClass
-   public static void setupJBossXb()
-   {
-      AccessController.doPrivileged(new PrivilegedAction<Void>()
-      {
-         public Void run()
-         {
-            // Must use unordered sequence else JBossXB will explode
-            //TODO Define a proper vfs.xml which is properly ordered
-            System.setProperty(NAME_SYSPROP_JBOSSXB_IGNORE_ORDER, VALUE_SYSPROP_JBOSSXB_IGNORE_ORDER);
-            return null;
-         }
-      });
-   }
-
-   /**
-    * Creates the server
-    */
-   @BeforeClass
-   public static void createAndConfigureServer()
-   {
-      // Create a server
-      final MCServer mcServer = MCServerFactory.createServer();
-      // Set the bootstrap home
-      final URL bootstrapHome = getBootstrapHome();
-      log.info("Using bootstrap home: " + bootstrapHome.toExternalForm());
-      mcServer.getConfiguration().bootstrapHome(bootstrapHome);
-      // Set
-      server = mcServer;
-   }
-
-   /**
-    * Starts the server before each test
-    * @throws Exception
-    */
-   @Before
-   public void startServer() throws Exception
-   {
-      long before = System.currentTimeMillis();
-      server.start();
-      long after = System.currentTimeMillis();
-      long total = after - before;
-      log.info("Boot took: " + total + "ms");
-   }
-
-   /**
-    * Stops the server after each test
-    * @throws Exception
-    */
-   @After
-   public void stopServer() throws Exception
-   {
-      if (server != null && server.getState().equals(LifecycleState.STARTED))
-      {
-         server.stop();
-      }
-   }
-
-   //-------------------------------------------------------------------------------------||
-   // Tests ------------------------------------------------------------------------------||
-   //-------------------------------------------------------------------------------------||
-
-   @Test
-   public void addOneDeployer() throws Throwable
-   {
-      this.stressAddingDeployers(1);
-   }
-
-   @Test
-   public void addTenDeployers() throws Throwable
-   {
-      this.stressAddingDeployers(10);
-   }
-
-   @Test
-   public void addTwentyDeployers() throws Throwable
-   {
-      this.stressAddingDeployers(20);
-   }
-
-   @Test
-   public void addThirtyDeployers() throws Throwable
-   {
-      this.stressAddingDeployers(30);
-   }
-
-   @Test
-   public void addFortyDeployers() throws Throwable
-   {
-      this.stressAddingDeployers(40);
-   }
-
-   @Test
-   public void addFiftyDeployers() throws Throwable
-   {
-      this.stressAddingDeployers(50);
-   }
-
-   @Test
-   public void addSixtyDeployers() throws Throwable
-   {
-      this.stressAddingDeployers(60);
-   }
-
-   @Test
-   public void addSeventyDeployers() throws Throwable
-   {
-      this.stressAddingDeployers(70);
-   }
-
-   @Test
-   public void addEightyDeployers() throws Throwable
-   {
-      this.stressAddingDeployers(80);
-   }
-
-   @Test
-   public void addNinetyDeployers() throws Throwable
-   {
-      this.stressAddingDeployers(90);
-   }
-
-   @Test
-   public void addOneHundredDeployers() throws Throwable
-   {
-      this.stressAddingDeployers(100);
-   }
-
-   //-------------------------------------------------------------------------------------||
-   // Internal Helper Methods ------------------------------------------------------------||
-   //-------------------------------------------------------------------------------------||
-
-   /**
-    * Stress test to add the specified number of deployers to MC, and 
-    * note the amount of time taken
-    */
-   void stressAddingDeployers(final int numDeployers) throws Throwable
-   {
-      // Get the MainDeployer
-      final Kernel kernel = server.getKernel();
-      MainDeployer mainDeployer = (MainDeployer) kernel.getController().getInstalledContext("MainDeployer").getTarget();
-      TestCase.assertNotNull(MainDeployer.class.getName() + " instance was not installed into MC", mainDeployer);
-
-      // Add Deployers
-      final long start = System.currentTimeMillis();
-      for (int i = 0; i < numDeployers; i++)
-      {
-         // Install a deployer
-         final Deployer deployer = new AbstractDeployer()
-         {
-
-            @Override
-            public void deploy(final DeploymentUnit unit) throws DeploymentException
-            {
-               //NOOP            
-            }
-         };
-         final String deployerName = deployer.getClass().getSimpleName() + numDeployers + "-" + i;
-         final BeanMetaDataBuilder bmdb = BeanMetaDataBuilder
-               .createBuilder(deployerName, deployer.getClass().getName());
-         kernel.getController().install(bmdb.getBeanMetaData(), deployer);
-
-      }
-      final long total = System.currentTimeMillis() - start;
-      log.info("Adding " + numDeployers + " deployer(s) took " + total + "ms");
-
-   }
-
-   /**
-    * Obtains the location of the bootstrap home
-    */
-   private static URL getBootstrapHome()
-   {
-      return DeployersOrderingStressUnitTest.class.getProtectionDomain().getCodeSource().getLocation();
-   }
-
-}

Modified: projects/reloaded/trunk/vdf-bootstrap-minimal/src/test/java/MainDeployerTestBase.java
===================================================================
--- projects/reloaded/trunk/vdf-bootstrap-minimal/src/test/java/MainDeployerTestBase.java	2010-01-05 17:55:09 UTC (rev 99036)
+++ projects/reloaded/trunk/vdf-bootstrap-minimal/src/test/java/MainDeployerTestBase.java	2010-01-05 18:06:14 UTC (rev 99037)
@@ -16,10 +16,6 @@
  */
 
 import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
 
 import junit.framework.TestCase;
 
@@ -37,7 +33,6 @@
 import org.jboss.shrinkwrap.api.Archives;
 import org.jboss.shrinkwrap.api.exporter.ZipExporter;
 import org.jboss.shrinkwrap.api.spec.JavaArchive;
-import org.jboss.shrinkwrap.impl.base.io.IOUtil;
 import org.jboss.virtual.VFS;
 import org.jboss.virtual.VirtualFile;
 import org.junit.Test;
@@ -106,36 +101,10 @@
       final JavaArchive cachingDeployerJar = Archives.create(NAME_ARCHIVE, JavaArchive.class);
 
       // Flush out to a real File
-      //TODO Remove this bit when SHRINKWRAP-87 is completed, and use the built-in util
       final File tmpFile = File.createTempFile(cachingDeployerJar.getName(), EXTENSION_TMP);
+      cachingDeployerJar.as(ZipExporter.class).exportZip(tmpFile,true);
       tmpFile.deleteOnExit();
-      final OutputStream out = new FileOutputStream(tmpFile);
-      final InputStream in = cachingDeployerJar.as(ZipExporter.class).exportZip();
-      try
-      {
-         IOUtil.copy(in, out);
-      }
-      finally
-      {
-         // Close the streams and ignore any problems doing so
-         try
-         {
-            in.close();
-         }
-         catch (IOException ignore)
-         {
-
-         }
-         try
-         {
-            out.close();
-         }
-         catch (IOException ignore)
-         {
-
-         }
-      }
-
+      
       // Deploy the test JAR
       final VirtualFile vFile = VFS.createNewRoot(tmpFile.toURI());
       final VFSDeployment deployment = VFSDeploymentFactory.getInstance().createVFSDeployment(vFile);




More information about the jboss-cvs-commits mailing list