[jboss-cvs] JBossAS SVN: r82014 - 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
Wed Dec 3 13:11:47 EST 2008


Author: scott.stark at jboss.org
Date: 2008-12-03 13:11:47 -0500 (Wed, 03 Dec 2008)
New Revision: 82014

Modified:
   trunk/profileservice/src/main/org/jboss/profileservice/management/ManagementViewImpl.java
   trunk/testsuite/src/main/org/jboss/test/profileservice/test/ServerManagedObjectsTestCase.java
Log:
JBAS-6270, make the bootstrap deployment names available

Modified: trunk/profileservice/src/main/org/jboss/profileservice/management/ManagementViewImpl.java
===================================================================
--- trunk/profileservice/src/main/org/jboss/profileservice/management/ManagementViewImpl.java	2008-12-03 18:11:11 UTC (rev 82013)
+++ trunk/profileservice/src/main/org/jboss/profileservice/management/ManagementViewImpl.java	2008-12-03 18:11:47 UTC (rev 82014)
@@ -535,9 +535,12 @@
     */
    public Set<String> getDeploymentNames()
    {
-      Set<String> names = activeProfile.getDeploymentNames();
-      if(names == null)
-         names = Collections.emptySet();
+      Set<String> names = new HashSet<String>();
+      Set<String> profileNames = activeProfile.getDeploymentNames();
+      if(profileNames != null)
+         names.addAll(profileNames);
+      if(bootstrapManagedDeployments != null)
+         names.addAll(bootstrapManagedDeployments.keySet());
       return names;
    }
 
@@ -634,8 +637,18 @@
    public ManagedDeployment getDeployment(String name, DeploymentPhase phase)
       throws NoSuchDeploymentException, Exception
    {
-      Deployment ctx = activeProfile.getDeployment(name, phase);
-      ManagedDeployment md = this.managedDeployments.get(ctx.getName());
+      NoSuchDeploymentException profileEX = null;
+      ManagedDeployment md = null;
+      try
+      {
+         Deployment ctx = activeProfile.getDeployment(name, phase);
+         md = this.managedDeployments.get(ctx.getName());
+      }
+      catch(NoSuchDeploymentException e)
+      {
+         profileEX = e;
+      }
+
       if(md == null)
       {
          // Check the bootstrap deployments
@@ -643,7 +656,11 @@
       }
       // Do not return null
       if(md == null)
-         throw new NoSuchDeploymentException("Managed deployment: "+ name + " not found.");
+      {
+         if(profileEX == null)
+            profileEX = new NoSuchDeploymentException("Managed deployment: "+ name + " not found.");
+         throw profileEX;
+      }
       
       return md;
    }

Modified: trunk/testsuite/src/main/org/jboss/test/profileservice/test/ServerManagedObjectsTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/profileservice/test/ServerManagedObjectsTestCase.java	2008-12-03 18:11:11 UTC (rev 82013)
+++ trunk/testsuite/src/main/org/jboss/test/profileservice/test/ServerManagedObjectsTestCase.java	2008-12-03 18:11:47 UTC (rev 82014)
@@ -30,6 +30,8 @@
 import org.jboss.deployers.spi.management.ManagementView;
 import org.jboss.managed.api.ComponentType;
 import org.jboss.managed.api.ManagedComponent;
+import org.jboss.managed.api.ManagedDeployment;
+import org.jboss.managed.api.ManagedDeployment.DeploymentPhase;
 import org.jboss.managed.api.ManagedProperty;
 import org.jboss.metatype.api.types.EnumMetaType;
 import org.jboss.metatype.api.values.EnumValue;
@@ -98,6 +100,10 @@
       assertEquals(installed, stateValue);
    }
 
+   /**
+    * Test the jboss.system:type=MCServer component from the bootstrap
+    * @throws Exception
+    */
    public void testMCServer()
       throws Exception
    {
@@ -105,8 +111,39 @@
       ComponentType type = KnownComponentTypes.MCBean.Any.getType();
       ManagedComponent mc = mgtView.getComponent("jboss.system:type=MCServer", type);
       assertNotNull(mc);
+
+      // Validate we can obtain the bootstrap deployment by name
+      ManagedDeployment md = mc.getDeployment();
+      assertNotNull(md);
+      getLog().info(md);
+      ManagedDeployment bootstrapMD = mgtView.getDeployment(md.getName(), DeploymentPhase.BOOTSTRAP);
+      assertNotNull(bootstrapMD);
+
+      // Validate properties, [buildOS, buildID, config, buildNumber, startDate, buildDate, versionName, buildJVM, versionNumber, version]
       Map<String, ManagedProperty> props = mc.getProperties();
-      getLog().info(props);
+      getLog().info(props.keySet());
+      ManagedProperty buildOS = mc.getProperty("buildOS");
+      assertNotNull(buildOS);
+      ManagedProperty buildID = mc.getProperty("buildID");
+      assertNotNull(buildID);
+      ManagedProperty buildNumber = mc.getProperty("buildNumber");
+      assertNotNull(buildNumber);
+      ManagedProperty buildDate = mc.getProperty("buildDate");
+      assertNotNull(buildDate);
+      ManagedProperty buildJVM = mc.getProperty("buildJVM");
+      assertNotNull(buildJVM);
+      ManagedProperty startDate = mc.getProperty("startDate");
+      assertNotNull(startDate);
+      ManagedProperty versionName = mc.getProperty("versionName");
+      assertNotNull(versionName);
+      ManagedProperty versionNumber = mc.getProperty("versionNumber");
+      assertNotNull(versionNumber);
+      ManagedProperty version = mc.getProperty("version");
+      assertNotNull(version);
+
+      // The config should be the ServerConfig ManagedObject
+      ManagedProperty config = mc.getProperty("config");
+      assertNotNull(config);
    }
 
    public void testServerConfig()




More information about the jboss-cvs-commits mailing list