[jboss-cvs] JBossAS SVN: r87347 - in branches/Branch_5_x/testsuite: src/main/org/jboss/test/deployers/test and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Apr 15 10:12:31 EDT 2009


Author: emuckenhuber
Date: 2009-04-15 10:12:30 -0400 (Wed, 15 Apr 2009)
New Revision: 87347

Modified:
   branches/Branch_5_x/testsuite/build.xml
   branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/test/DeploymentManagerUnitTestCase.java
Log:
copy the file within the UnitTest.

Modified: branches/Branch_5_x/testsuite/build.xml
===================================================================
--- branches/Branch_5_x/testsuite/build.xml	2009-04-15 13:47:26 UTC (rev 87346)
+++ branches/Branch_5_x/testsuite/build.xml	2009-04-15 14:12:30 UTC (rev 87347)
@@ -1072,10 +1072,6 @@
    <target name="tests-profileservice" description="Tests with the full featured profile service">
       <create-profileservice-config baseconf="default" conf="profileservice"/>
       <server:start name="profileservice"/>
-      <!-- copy a deployment which should get picked up by the hdScanner -->
-   	  <copy file="${build.lib}/hd-jboss-beans.xml"
-          todir="${jboss.dist}/server/profileservice/deploy" />
-   	
       <run-junit
          junit.patternset="profileservice.includes"
          junit.configuration="profileservice"

Modified: branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/test/DeploymentManagerUnitTestCase.java
===================================================================
--- branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/test/DeploymentManagerUnitTestCase.java	2009-04-15 13:47:26 UTC (rev 87346)
+++ branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/test/DeploymentManagerUnitTestCase.java	2009-04-15 14:12:30 UTC (rev 87347)
@@ -21,6 +21,9 @@
  */ 
 package org.jboss.test.deployers.test;
 
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.InputStream;
 import java.util.Collection;
 
 import javax.naming.InitialContext;
@@ -29,8 +32,11 @@
 import org.jboss.deployers.spi.management.deploy.DeploymentID;
 import org.jboss.deployers.spi.management.deploy.DeploymentManager;
 import org.jboss.deployers.spi.management.deploy.DeploymentProgress;
+import org.jboss.managed.api.ComponentType;
 import org.jboss.managed.api.DeploymentState;
+import org.jboss.managed.api.ManagedComponent;
 import org.jboss.managed.api.ManagedDeployment;
+import org.jboss.metatype.api.values.SimpleValue;
 import org.jboss.profileservice.spi.NoSuchDeploymentException;
 import org.jboss.profileservice.spi.ProfileKey;
 import org.jboss.profileservice.spi.ProfileService;
@@ -94,11 +100,13 @@
             // 
             DeploymentProgress start = distributeAndStart(NESTED_DEPLOYMENT, true, false);
             assertComplete(start);
+            
+            Thread.sleep(100);
+            
             // disable stopped check, as it was started before
             start = distributeAndStart(NESTED_DEPLOYMENT, true, false);
             assertComplete(start);
             
-            Thread.sleep(50);
          }
       }
       catch(Exception e)
@@ -220,6 +228,19 @@
    public void testHotDeploymentBeans() throws Exception
    {
       ManagementView mgtView = getManagementView();
+      ComponentType type = new ComponentType("MCBean", "ServerConfig");
+      ManagedComponent mc = mgtView.getComponent("jboss.system:type=ServerConfig", type);
+      assertNotNull(mc);
+      String homeDir = (String) ((SimpleValue) mc.getProperty("serverHomeDir").getValue()).getValue();
+      assertNotNull(homeDir);
+      
+      // Manually copy the deployment
+      copyFile(new File(homeDir, "deploy/"), HD_DEPLOYMENT);
+      // Wait for HDScanner
+      Thread.sleep(10000);
+      
+      // Reload mgtView
+      mgtView = getManagementView();
       ManagedDeployment md = mgtView.getDeployment(HD_DEPLOYMENT);
       assertNotNull("hd-beans not deployed", md);
       assertEquals("deployment started", DeploymentState.STARTED, md.getDeploymentState());
@@ -227,6 +248,34 @@
       stopAndRemove(new String[] { HD_DEPLOYMENT });
    }
 
+   private void copyFile(File dir, String filename) throws Exception
+   {
+      InputStream is = getDeployURL(filename).openStream();
+      try
+      {
+         File output = new File(dir, filename);
+         FileOutputStream fos = new FileOutputStream(output);
+         try
+         {
+            byte[] tmp = new byte[1024];
+            int read;
+            while((read = is.read(tmp)) > 0)
+            {
+               fos.write(tmp, 0, read);
+            }
+            fos.flush();
+         }
+         finally
+         {
+            fos.close();
+         }         
+      }
+      finally
+      {
+         is.close();
+      }
+   }
+   
    void deployFailed(boolean isCopyContent) throws Exception
    {
       DeploymentProgress start = distributeAndStart(FAILING_DEPLOYMENT, isCopyContent);
@@ -345,6 +394,7 @@
       ManagedDeployment md = mgtView.getDeployment(name);
       assertNotNull(name, md);
       assertEquals("deployment: " + name, state, md.getDeploymentState());
+      log.debug(md.getSimpleName() + " " + md.getTypes());
    }
    
    void assertComplete(DeploymentProgress progress) throws Exception




More information about the jboss-cvs-commits mailing list