[jboss-cvs] JBossAS SVN: r89435 - in trunk/testsuite/src/main/org/jboss/test/profileservice: test and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue May 26 08:46:09 EDT 2009


Author: emuckenhuber
Date: 2009-05-26 08:46:09 -0400 (Tue, 26 May 2009)
New Revision: 89435

Modified:
   trunk/testsuite/src/main/org/jboss/test/profileservice/override/test/JmsDestinationOverrideTestCase.java
   trunk/testsuite/src/main/org/jboss/test/profileservice/override/test/LocalDSRemoveTestCase.java
   trunk/testsuite/src/main/org/jboss/test/profileservice/test/ManagementViewUnitTestCase.java
   trunk/testsuite/src/main/org/jboss/test/profileservice/test/ProfileServiceUnitTestCase.java
   trunk/testsuite/src/main/org/jboss/test/profileservice/test/SecurityManagedObjectsTestCase.java
   trunk/testsuite/src/main/org/jboss/test/profileservice/test/ServerManagedObjectsTestCase.java
Log:
sync PS testcases with branch 5_x

Modified: trunk/testsuite/src/main/org/jboss/test/profileservice/override/test/JmsDestinationOverrideTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/profileservice/override/test/JmsDestinationOverrideTestCase.java	2009-05-26 12:27:22 UTC (rev 89434)
+++ trunk/testsuite/src/main/org/jboss/test/profileservice/override/test/JmsDestinationOverrideTestCase.java	2009-05-26 12:46:09 UTC (rev 89435)
@@ -26,6 +26,7 @@
 
 import org.jboss.deployers.spi.management.KnownComponentTypes;
 import org.jboss.deployers.spi.management.ManagementView;
+import org.jboss.deployers.spi.management.deploy.DeploymentProgress;
 import org.jboss.managed.api.ComponentType;
 import org.jboss.managed.api.DeploymentTemplateInfo;
 import org.jboss.managed.api.ManagedComponent;
@@ -49,6 +50,11 @@
 public class JmsDestinationOverrideTestCase extends AbstractProfileServiceTest
 {
    
+   /** The queue type. */
+   public static final ComponentType QueueType = KnownComponentTypes.JMSDestination.Queue.getType();
+   /** The topic type. */
+   public static final ComponentType TopicType = KnownComponentTypes.JMSDestination.Topic.getType();
+   
    /** The meta type. */
    protected static final MapCompositeMetaType securityConfType;
    
@@ -82,6 +88,7 @@
          ManagedDeployment md = mgtView.getDeployment(deploymentName);
          assertNotNull(md);
 
+         // Modify 
          ManagedComponent component = md.getComponent("testQueue");
          assertNotNull(component);
          
@@ -93,6 +100,27 @@
          
          mgtView.updateComponent(component);
 
+         // Remove
+         component = md.getComponent("testRemoveQueue");
+         assertNotNull(component);
+         
+         //
+         mgtView.removeComponent(component);
+         redeploy(component.getDeployment().getName());
+         
+         // Check removed
+         mgtView = getManagementView();
+         component = mgtView.getComponent("testRemoveQueue", QueueType);
+         assertNull("component removed", component);
+         
+         // Check updated 
+         component = md.getComponent("testQueue");
+         assertNotNull(component);
+         
+         property = component.getProperty("downCacheSize");
+         assertNotNull(property);
+         assertEquals(property.getValue(), SimpleValueSupport.wrap(3000));
+         
       }
       catch(Throwable e)
       {
@@ -177,6 +205,7 @@
          ManagedDeployment md = mgtView.getDeployment(deploymentName);
          assertNotNull(md);
 
+         // Update
          ManagedComponent component = md.getComponent("testTopic");
          assertNotNull(component);
 
@@ -188,6 +217,17 @@
          
          mgtView.updateComponent(component);
          
+         // Remove
+         component = md.getComponent("testRemoveTopic");
+         assertNotNull(component);
+         
+         //
+         mgtView.removeComponent(component);
+         redeploy(component.getDeployment().getName());
+         
+         mgtView = getManagementView();
+         component = mgtView.getComponent("testRemoveTopic", TopicType);
+         assertNull("topic removed", component);
       }
       catch(Throwable e)
       {
@@ -207,5 +247,15 @@
       return new CompositeValueSupport(composite, map);
    }
 
+   protected void redeploy(String name) throws Exception
+   {
+      DeploymentProgress progress = getDeploymentManager().redeploy(name);
+      progress.run();
+      if(progress.getDeploymentStatus().isFailed())
+      {
+         throw new IllegalStateException("Redeployment failed ", progress.getDeploymentStatus().getFailure());
+      }
+   }
+   
 }
 

Modified: trunk/testsuite/src/main/org/jboss/test/profileservice/override/test/LocalDSRemoveTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/profileservice/override/test/LocalDSRemoveTestCase.java	2009-05-26 12:27:22 UTC (rev 89434)
+++ trunk/testsuite/src/main/org/jboss/test/profileservice/override/test/LocalDSRemoveTestCase.java	2009-05-26 12:46:09 UTC (rev 89435)
@@ -22,6 +22,7 @@
 package org.jboss.test.profileservice.override.test;
 
 import org.jboss.deployers.spi.management.ManagementView;
+import org.jboss.deployers.spi.management.deploy.DeploymentProgress;
 import org.jboss.managed.api.ComponentType;
 import org.jboss.managed.api.ManagedComponent;
 
@@ -59,6 +60,13 @@
       mgtView.removeComponent(remove);
       mgtView.process();
       
+      // Redeploy
+      DeploymentProgress progress = getDeploymentManager().redeploy(test1.getDeployment().getName());
+      progress.run();
+      
+      mgtView = getManagementView();
+      remove = mgtView.getComponent("ProfileServiceTestRemoveDataSource", locaDSType);
+      assertNull(remove);      
    }
    
    

Modified: trunk/testsuite/src/main/org/jboss/test/profileservice/test/ManagementViewUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/profileservice/test/ManagementViewUnitTestCase.java	2009-05-26 12:27:22 UTC (rev 89434)
+++ trunk/testsuite/src/main/org/jboss/test/profileservice/test/ManagementViewUnitTestCase.java	2009-05-26 12:46:09 UTC (rev 89435)
@@ -25,6 +25,7 @@
 
 import org.jboss.deployers.spi.management.KnownDeploymentTypes;
 import org.jboss.deployers.spi.management.ManagementView;
+import org.jboss.managed.api.ManagedDeployment;
 
 /**
  * Test ManagementView operations.
@@ -51,13 +52,15 @@
       
       for(KnownDeploymentTypes type : KnownDeploymentTypes.values())
       {
+         log.debug("----- deployment type: " + type);
+         
          Set<String> deploymentNames = mgtView.getDeploymentNamesForType(type.getType());
-         
          if(deploymentNames != null)
          {
             for(String deploymentName : deploymentNames)
             {
-               mgtView.getDeployment(deploymentName);
+               ManagedDeployment deployment = mgtView.getDeployment(deploymentName);
+               log.debug(deployment.getSimpleName());
             }
          }
       }

Modified: trunk/testsuite/src/main/org/jboss/test/profileservice/test/ProfileServiceUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/profileservice/test/ProfileServiceUnitTestCase.java	2009-05-26 12:27:22 UTC (rev 89434)
+++ trunk/testsuite/src/main/org/jboss/test/profileservice/test/ProfileServiceUnitTestCase.java	2009-05-26 12:46:09 UTC (rev 89435)
@@ -76,16 +76,6 @@
    /** The profileservice server name. */
    public static final String PROFILESERVICE_SERVER_NAME = "profileservice";
    
-   private static final List<String> platformBeans = new ArrayList<String>(); 
-   
-   static
-   {
-      platformBeans.add("JDK PlatformMBeans");
-      platformBeans.add("GarbageCollectorMXBeans");
-      platformBeans.add("MemoryManagerMXBeans");
-      platformBeans.add("MemoryPoolMXBeans");
-   }
-   
    /**
     * We need to define the order in which tests runs
     * @return
@@ -98,7 +88,6 @@
       suite.addTest(new ProfileServiceUnitTestCase("testProfileKeys"));
       suite.addTest(new ProfileServiceUnitTestCase("testDeploymentNames"));
       suite.addTest(new ProfileServiceUnitTestCase("testIgnoredDeploymentNames"));
-      suite.addTest(new ProfileServiceUnitTestCase("testUnifiedDeploymentNames"));
       
       suite.addTest(new ProfileServiceUnitTestCase("testTemplateNames"));
       suite.addTest(new ProfileServiceUnitTestCase("testNoSuchProfileException"));
@@ -251,27 +240,6 @@
             fail("deployment should be ignored: " + name);
       }
    }
-   
-   /**
-    * The deployment names should be a fully qualified URL/URI
-    * 
-    * @throws Exception
-    */
-   public void testUnifiedDeploymentNames() throws Exception
-   {
-      ManagementView mgtView = getManagementView();
-      Set<String> names = mgtView.getDeploymentNames();
-      for(String name : names)
-      {
-         if(platformBeans.contains(name))
-            continue;
-         
-         URL url = new URL(name);
-         URI uri = new URI(name);
-         VFS.getRoot(uri);
-         VFS.getRoot(url);
-      }
-   }
 
    /** 
     * Test the expected template names

Modified: trunk/testsuite/src/main/org/jboss/test/profileservice/test/SecurityManagedObjectsTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/profileservice/test/SecurityManagedObjectsTestCase.java	2009-05-26 12:27:22 UTC (rev 89434)
+++ trunk/testsuite/src/main/org/jboss/test/profileservice/test/SecurityManagedObjectsTestCase.java	2009-05-26 12:46:09 UTC (rev 89435)
@@ -320,13 +320,14 @@
       // verify that the component has the expected managed properties.
       Map<String, ManagedProperty> properties = component.getProperties();
       assertNotNull(properties);
-      assertEquals("Unexpected number of properties", 13, properties.size());
+      assertEquals("Unexpected number of properties", 14, properties.size());
       assertTrue("Missing expected property: securityDomain", properties.containsKey("securityDomain"));
       assertTrue("Missing expected property: state", properties.containsKey("state"));
       // keystore and truststore configuration properties.
       assertTrue("Missing expected property: keyStoreType", properties.containsKey("keyStoreType"));
       assertTrue("Missing expected property: keyStoreURL", properties.containsKey("keyStoreURL"));
       assertTrue("Missing expected property: keyStorePass", properties.containsKey("keyStorePass"));
+      assertTrue("Missing expected property: keyStoreAlias", properties.containsKey("keyStoreAlias"));
       assertTrue("Missing expected property: trustStoreType", properties.containsKey("trustStoreType"));
       assertTrue("Missing expected property: trustStoreURL", properties.containsKey("trustStoreURL"));
       assertTrue("Missing expected property: trustStorePass", properties.containsKey("trustStorePass"));

Modified: trunk/testsuite/src/main/org/jboss/test/profileservice/test/ServerManagedObjectsTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/profileservice/test/ServerManagedObjectsTestCase.java	2009-05-26 12:27:22 UTC (rev 89434)
+++ trunk/testsuite/src/main/org/jboss/test/profileservice/test/ServerManagedObjectsTestCase.java	2009-05-26 12:46:09 UTC (rev 89435)
@@ -23,6 +23,7 @@
 
 import java.net.InetAddress;
 import java.net.URL;
+import java.util.Collection;
 import java.util.Map;
 import java.util.Set;
 
@@ -255,84 +256,13 @@
       getLog().info(props);
    }
 
-   public void testWebConnector()
-      throws Exception
+   public void testMBeanFactory() throws Exception
    {
-      // Make a request
-      InetAddress address = InetAddress.getByName(getServerHost());
-      URL root = new URL("http://"+address.getHostAddress()+":8080/");
-      // Load the 
       ManagementView mgtView = getManagementView();
-      ComponentType type = new ComponentType("MBean", "Web");
-      String name = "jboss.web:name=http-"+address.getHostAddress()+"-8080,type=GlobalRequestProcessor";
-      ManagedComponent mc = mgtView.getComponent(name, type);
-      assertNotNull(name, mc);
-      Map<String, ManagedProperty> props = mc.getProperties();
-      for(ManagedProperty mp : props.values())
-         log.info(mp.getName()+", "+mp.getValue());
-      root.openConnection().setUseCaches(false);
-      log.info(root+" content: "+root.openConnection().getContentLength());
+      Collection<ManagedComponent> components = mgtView.getComponentsForType(new ComponentType("MBean", "WebApplicationManager"));
+      assertNotNull(components);
       
-      // {errorCount, bytesReceived, bytesSent, state, requestProcessors, processingTime, requestCount, maxTime}
-      ManagedProperty bytesSent = mc.getProperty("bytesSent");
-      assertNotNull(bytesSent);
-      MetaValue bytesSentMV = bytesSent.getValue();
-      SimpleValue bytesSentSV = (SimpleValue) bytesSentMV;
-      log.debug("bytesSentSV#1: "+bytesSentSV);
-      assertTrue("bytesSent > 0", bytesSentSV.compareTo(SimpleValueSupport.wrap(0)) > 0);
-      
-      // Make the request again to ensure the count increases
-      log.info(root+" content: "+root.openConnection().getContentLength());
-      MetaValue bytesSentMV2 = bytesSent.getValue();
-      SimpleValue bytesSentSV2 = (SimpleValue) bytesSentMV2;
-      log.debug("bytesSentSV#2: "+bytesSentSV2);
-      assertTrue("bytesSentSV2 > bytesSentSV", bytesSentSV2.compareTo(bytesSentSV) > 0);
    }
-
-   public void testWebConnectorPool()
-      throws Exception
-   {
-      // Make a request
-      InetAddress address = InetAddress.getByName(getServerHost());
-      URL root = new URL("http://"+address.getHostAddress()+":8080/");
-      // Load the 
-      ManagementView mgtView = getManagementView();
-      ComponentType type = new ComponentType("MBean", "Web");
-      String name = "jboss.web:name=http-"+address.getHostAddress()+"-8080,type=ThreadPool";
-      ManagedComponent mc = mgtView.getComponent(name, type);
-      assertNotNull(name, mc);
-      Map<String, ManagedProperty> props = mc.getProperties();
-      for(ManagedProperty mp : props.values())
-         log.info(mp.getName()+", "+mp.getValue());
-      log.info(root+" content: "+root.openConnection().getContentLength());
-      
-      ManagedProperty threadPriority = mc.getProperty("threadPriority");
-      assertNotNull(threadPriority);
-      MetaValue threadPriorityMV = threadPriority.getValue();
-      SimpleValue threadPrioritySV = (SimpleValue) threadPriorityMV;
-      assertTrue("threadPriority > 0", threadPrioritySV.compareTo(SimpleValueSupport.wrap(0)) > 0);
-      assertEquals(mc.getRunState(), RunState.RUNNING);
-   }
-
-   public void testWebHost()
-      throws Exception
-   {
-      // Make a request
-      InetAddress address = InetAddress.getByName(getServerHost());
-      // Load the 
-      ManagementView mgtView = getManagementView();
-      ComponentType type = new ComponentType("MBean", "Web:Host");
-      String name = "jboss.web:host=localhost,type=Host";
-      ManagedComponent mc = mgtView.getComponent(name, type);
-      assertNotNull(name, mc);
-      Map<String, ManagedProperty> props = mc.getProperties();
-      for(ManagedProperty mp : props.values())
-         log.info(mp.getName()+", "+mp.getValue());
-      
-      ManagedProperty aliases = mc.getProperty("aliases");
-      assertNotNull(aliases);
-      assertEquals(RunState.RUNNING, mc.getRunState());
-   }
    
    /**
     * Obtain the ProfileService.ManagementView
@@ -361,4 +291,3 @@
       return value.longValue();
    }
 }
-




More information about the jboss-cvs-commits mailing list