[jboss-cvs] JBossAS SVN: r60028 - trunk/testsuite/src/main/org/jboss/test/profileservice/test.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Jan 26 13:43:50 EST 2007


Author: charles.crouch at jboss.com
Date: 2007-01-26 13:43:50 -0500 (Fri, 26 Jan 2007)
New Revision: 60028

Modified:
   trunk/testsuite/src/main/org/jboss/test/profileservice/test/ProfileServiceUnitTestCase.java
Log:
add a couple of methods to try out the ManagedComponent API

Modified: trunk/testsuite/src/main/org/jboss/test/profileservice/test/ProfileServiceUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/profileservice/test/ProfileServiceUnitTestCase.java	2007-01-26 17:31:09 UTC (rev 60027)
+++ trunk/testsuite/src/main/org/jboss/test/profileservice/test/ProfileServiceUnitTestCase.java	2007-01-26 18:43:50 UTC (rev 60028)
@@ -27,7 +27,9 @@
 
 import javax.naming.InitialContext;
 
+import org.jboss.deployers.spi.management.ComponentType;
 import org.jboss.deployers.spi.management.DeploymentTemplateInfo;
+import org.jboss.deployers.spi.management.ManagedComponent;
 import org.jboss.deployers.spi.management.ManagedDeployment;
 import org.jboss.deployers.spi.management.ManagementView;
 import org.jboss.managed.api.ManagedProperty;
@@ -107,6 +109,60 @@
    }
 
    /**
+    * test api usage only
+    * @throws Exception
+    */
+   public void testListComponents () throws Exception
+   {
+	   ManagementView mgtView = getManagementView();
+	   
+	   // maybe needs a ctor which takes type,subtype ?
+	   ComponentType type = new ComponentType();
+	   type.setType("DataSource");
+	   type.setType("LocalTX");
+	   Set<ManagedComponent> comps = mgtView.getComponentsForType(type);
+	   
+	   if (comps != null) 
+	   {
+		   for (ManagedComponent comp : comps)
+		   {
+			  String name = comp.getName();
+			  Map<String,ManagedProperty> props = comp.getProperties();
+		   }
+	   }
+   }
+
+   /**
+    * test api usage only
+    * @throws Exception
+    */   
+   public void testRemoveComponent () throws Exception
+   {
+	   String componentName = "defaultDS";
+	   ManagementView mgtView = getManagementView();
+	   
+	   ComponentType type = new ComponentType();
+	   type.setType("DataSource");
+	   type.setType("LocalTX");
+	   Set<ManagedComponent> comps = mgtView.getComponentsForType(type);
+	   
+	   // maybe a mgtView.getComponentByNameAndType(type, componentName) would be helpful
+	   // i'm assuming componentName and type will be unique in a given profile.
+	   
+	   if (comps != null) 
+	   {
+		   for (ManagedComponent comp : comps)
+		   {
+			  if (componentName.equals(comp.getName()))
+			  {
+				  ManagedDeployment deployment = comp.getDeployment();
+				  deployment.removeComponent(comp); 
+				  break;
+			  }		 
+		   }
+	   }
+   }
+   /**
     * Test adding a new hsql DataSource deployment
     * @throws Exception
     */




More information about the jboss-cvs-commits mailing list