[jboss-cvs] JBossAS SVN: r59987 - trunk/testsuite/src/main/org/jboss/test/profileservice/test.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Jan 25 03:20:16 EST 2007
Author: scott.stark at jboss.org
Date: 2007-01-25 03:20:15 -0500 (Thu, 25 Jan 2007)
New Revision: 59987
Modified:
trunk/testsuite/src/main/org/jboss/test/profileservice/test/ProfileServiceUnitTestCase.java
Log:
Update the profile service for the ManagedDeployment/ManagedComponent changes
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-25 08:19:37 UTC (rev 59986)
+++ trunk/testsuite/src/main/org/jboss/test/profileservice/test/ProfileServiceUnitTestCase.java 2007-01-25 08:20:15 UTC (rev 59987)
@@ -28,15 +28,14 @@
import javax.naming.InitialContext;
import org.jboss.deployers.spi.management.DeploymentTemplateInfo;
+import org.jboss.deployers.spi.management.ManagedDeployment;
import org.jboss.deployers.spi.management.ManagementView;
-import org.jboss.managed.api.ManagedObject;
import org.jboss.managed.api.ManagedProperty;
import org.jboss.profileservice.spi.NoSuchProfileException;
import org.jboss.profileservice.spi.ProfileKey;
import org.jboss.profileservice.spi.ProfileService;
import org.jboss.profileservice.spi.Profile.DeploymentPhase;
import org.jboss.test.JBossTestCase;
-import org.jboss.util.graph.Graph;
/** Test of using ProfileService
@@ -45,6 +44,8 @@
*/
public class ProfileServiceUnitTestCase extends JBossTestCase
{
+ ManagementView activeView;
+
public ProfileServiceUnitTestCase(String name)
{
super(name);
@@ -64,6 +65,14 @@
assertTrue("keys contains default", keys.contains(defaultKey));
}
+ public void testDeploymentNames()
+ throws Exception
+ {
+ ManagementView mgtView = getManagementView();
+ Set<String> names = mgtView.getDeploymentNames();
+ log.info("getDeploymentNames, "+names);
+ }
+
/**
* Basic test to validate NoSuchProfileException is thrown for
* a ProfileKey that does not map to a profile.
@@ -76,7 +85,7 @@
ProfileKey badKey = new ProfileKey("no-such-profile");
try
{
- mgtView.getDeploymentNames(badKey);
+ mgtView.loadProfile(badKey);
}
catch(NoSuchProfileException e)
{
@@ -92,8 +101,7 @@
throws Exception
{
ManagementView mgtView = getManagementView();
- ProfileKey key = new ProfileKey("default");
- Set<String> names = mgtView.getDeploymentNamesForType(key, "jca-ds");
+ Set<String> names = mgtView.getDeploymentNamesForType("jca-ds");
log.info("jca-ds names: "+names);
assertTrue("names.size > 0 ", names.size() > 0);
}
@@ -105,7 +113,6 @@
public void testAddDataSource() throws Exception
{
ManagementView mgtView = getManagementView();
- ProfileKey defaultKey = new ProfileKey("default");
log.info("Templates: "+mgtView.getTemplateNames());
DeploymentTemplateInfo dsInfo = mgtView.getTemplate("DsXmlDataSourceTemplate");
Map<String, ManagedProperty> props = dsInfo.getProperties();
@@ -122,17 +129,17 @@
ManagedProperty password = props.get("password");
password.setValue("");
- mgtView.applyTemplate(defaultKey, DeploymentPhase.APPLICATION,
+ mgtView.applyTemplate(DeploymentPhase.APPLICATION,
"testAddDataSource", dsInfo);
+ mgtView.process();
}
public void testUpdateDataSource()
throws Exception
{
ManagementView mgtView = getManagementView();
- ProfileKey defaultKey = new ProfileKey("default");
- Graph<Map<String, ManagedObject>> view = mgtView.getView(defaultKey, "testAddDataSource-dsf.xml", DeploymentPhase.APPLICATION);
- log.info("MO View: "+view);
+ ManagedDeployment ds = mgtView.getDeployment("testAddDataSource-dsf.xml", null);
+ log.info("ManagedDeployment: "+ds);
}
@@ -140,11 +147,10 @@
throws Exception
{
ManagementView mgtView = getManagementView();
- ProfileKey defaultKey = new ProfileKey("default");
- Set<String> names = mgtView.getMatchingDeploymentName(defaultKey, "testAddDataSource-dsf.xml");
+ Set<String> names = mgtView.getMatchingDeploymentName("testAddDataSource-dsf.xml");
assertEquals("1 matching name", 1, names.size());
String deploymentName = names.iterator().next();
- mgtView.removeDeployment(defaultKey, deploymentName,
+ mgtView.removeDeployment(deploymentName,
DeploymentPhase.APPLICATION);
}
@@ -156,9 +162,15 @@
protected ManagementView getManagementView()
throws Exception
{
- InitialContext ctx = super.getInitialContext();
- ProfileService ps = (ProfileService) ctx.lookup("ProfileService");
- ManagementView mgtView = ps.getViewManager();
- return mgtView;
+ if( activeView == null )
+ {
+ InitialContext ctx = super.getInitialContext();
+ ProfileService ps = (ProfileService) ctx.lookup("ProfileService");
+ activeView = ps.getViewManager();
+ ProfileKey defaultKey = new ProfileKey("default");
+ activeView.loadProfile(defaultKey);
+ log.info("Loaded profile: "+defaultKey);
+ }
+ return activeView;
}
}
More information about the jboss-cvs-commits
mailing list