[jboss-cvs] JBossAS SVN: r60189 - trunk/testsuite/src/main/org/jboss/test/profileservice/test.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Feb 2 04:21:25 EST 2007
Author: scott.stark at jboss.org
Date: 2007-02-02 04:21:25 -0500 (Fri, 02 Feb 2007)
New Revision: 60189
Modified:
trunk/testsuite/src/main/org/jboss/test/profileservice/test/ProfileServiceUnitTestCase.java
Log:
Update the test api usage
Modified: trunk/testsuite/src/main/org/jboss/test/profileservice/test/ProfileServiceUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/profileservice/test/ProfileServiceUnitTestCase.java 2007-02-02 09:20:56 UTC (rev 60188)
+++ trunk/testsuite/src/main/org/jboss/test/profileservice/test/ProfileServiceUnitTestCase.java 2007-02-02 09:21:25 UTC (rev 60189)
@@ -99,7 +99,7 @@
* Test that one can query for deployments of type jca-ds to
* obtain data source deployments.
*/
- public void testDataSourceType()
+ public void testDataSourceDeploymentType()
throws Exception
{
ManagementView mgtView = getManagementView();
@@ -109,30 +109,36 @@
}
/**
- * test api usage only
+ * Query for the ComponentType("DataSource", "LocalTx") testAddDataSource-dsf.xml
+ * and validate the expected property names.
* @throws Exception
*/
- public void testListComponents() throws Exception
+ public void testListDataSourceComponents() throws Exception
{
ManagementView mgtView = getManagementView();
- // maybe needs a ctor which takes type,subtype ?
- ComponentType type = new ComponentType("DataSource", "LocalTx");
- Set<ManagedComponent> comps = mgtView.getComponentsForType(type);
- log.info("testListComponents, DataSources: "+comps);
- assertNotNull(comps);
- ManagedComponent testAddDataSource = null;
- for (ManagedComponent comp : comps)
- {
- String name = comp.getName();
- if( name.equals("testAddDataSource-dsf.xml") )
- {
- testAddDataSource = comp;
- }
- }
- assertNotNull("testAddDataSource", testAddDataSource);
+ ManagedComponent testAddDataSource = getTestDataSource(mgtView);
Map<String,ManagedProperty> props = testAddDataSource.getProperties();
log.info("testAddDataSource.props: "+props);
+ // Validate the property names
+ ManagedProperty p = props.get("datasource-type");
+ assertNotNull("datasource-type", p);
+ p = props.get("jndi-name");
+ assertNotNull("jndi-name", p);
+ p = props.get("driver-class");
+ assertNotNull("driver-class", p);
+ p = props.get("connection-url");
+ assertNotNull("connection-url", p);
+ p = props.get("user-name");
+ assertNotNull("user-name", p);
+ p = props.get("password");
+ assertNotNull("password", p);
+ p = props.get("min-pool-size");
+ assertNotNull("min-pool-size", p);
+ p = props.get("max-pool-size");
+ assertNotNull("max-pool-size", p);
+ p = props.get("security-domain");
+ assertNotNull("security-domain", p);
}
/**
@@ -197,12 +203,25 @@
throws Exception
{
ManagementView mgtView = getManagementView();
- ComponentType dsType = new ComponentType("DataSource", "LocalTx");
- Set<ManagedComponent> dsComps = mgtView.getComponentsForType(dsType);
- ManagedComponent dsComp = null;
- Map<String, ManagedProperty> dsProps = dsComp.getProperties();
- //dsComp.applyChanges();
+ ManagedComponent testAddDataSource = getTestDataSource(mgtView);
+ Map<String,ManagedProperty> props = testAddDataSource.getProperties();
+ log.info("testAddDataSource.props: "+props);
+ // Update properties
+ ManagedProperty jndiName = props.get("jndi-name");
+ jndiName.setValue("UpdatedTestDS");
+ ManagedProperty username = props.get("user-name");
+ username.setValue("jduke");
+ ManagedProperty password = props.get("password");
+ password.setValue("theduke");
+ ManagedProperty minSize = props.get("min-pool-size");
+ minSize.setValue(new Integer(13));
+ ManagedProperty maxSize = props.get("max-pool-size");
+ maxSize.setValue(new Integer(53));
+
+ mgtView.updateComponent(testAddDataSource);
mgtView.process();
+
+ //
}
public void testRemoveDataSource()
@@ -235,4 +254,22 @@
}
return activeView;
}
+
+ protected ManagedComponent getTestDataSource(ManagementView mgtView)
+ throws Exception
+ {
+ ComponentType dsType = new ComponentType("DataSource", "LocalTx");
+ Set<ManagedComponent> dsComps = mgtView.getComponentsForType(dsType);
+ ManagedComponent testAddDataSource = null;
+ for (ManagedComponent comp : dsComps)
+ {
+ String name = comp.getName();
+ if( name.equals("testAddDataSource-dsf.xml") )
+ {
+ testAddDataSource = comp;
+ }
+ }
+ assertNotNull("testAddDataSource", testAddDataSource);
+ return testAddDataSource;
+ }
}
More information about the jboss-cvs-commits
mailing list