[jboss-cvs] JBossAS SVN: r60954 - trunk/testsuite/src/main/org/jboss/test/profileservice/test.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Feb 27 13:21:05 EST 2007
Author: scott.stark at jboss.org
Date: 2007-02-27 13:21:05 -0500 (Tue, 27 Feb 2007)
New Revision: 60954
Modified:
trunk/testsuite/src/main/org/jboss/test/profileservice/test/ProfileServiceUnitTestCase.java
Log:
Update the fake vs real datasource tests
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-27 18:18:41 UTC (rev 60953)
+++ trunk/testsuite/src/main/org/jboss/test/profileservice/test/ProfileServiceUnitTestCase.java 2007-02-27 18:21:05 UTC (rev 60954)
@@ -145,10 +145,11 @@
public void testListDataSourceComponents() throws Exception
{
ManagementView mgtView = getManagementView();
-
- ManagedComponent ds = getDataSource(mgtView);
+ ComponentType type = new ComponentType("DataSource", "LocalTx");
+ ManagedComponent ds = getManagedComponent(mgtView, type, "hsqldb-ds.xml");
+ assertNotNull("hsqldb-ds.xml ManagedComponent", ds);
Map<String,ManagedProperty> props = ds.getProperties();
- log.info("testAddDataSource.props: "+props);
+ log.info("hsqldb-ds.props: "+props);
// Validate the property names
ManagedProperty p = props.get("datasource-type");
assertNotNull("datasource-type", p);
@@ -170,7 +171,47 @@
assertNotNull("security-domain", p);
}
+ public void testJmsDestinationComponents()
+ throws Exception
+ {
+ ManagementView mgtView = getManagementView();
+ ComponentType queueType = new ComponentType("JMSDestination", "Queue");
+ Set<ManagedComponent> queues = mgtView.getComponentsForType(queueType);
+ log.info("queues: "+queues);
+ assertTrue("queues.size", queues.size() > 0);
+
+ ComponentType topicType = new ComponentType("JMSDestination", "Topic");
+ Set<ManagedComponent> topics = mgtView.getComponentsForType(topicType);
+ log.info("topics: "+topics);
+ assertTrue("topics.size", topics.size() > 0);
+ }
+
/**
+ * Test an update of the
+ * @throws Exception
+ */
+ public void testUpdateDefaultDS()
+ throws Exception
+ {
+ ManagementView mgtView = getManagementView();
+ ComponentType type = new ComponentType("DataSource", "LocalTx");
+ ManagedComponent hsqldb = getManagedComponent(mgtView, type, "hsqldb-ds.xml");
+ Map<String,ManagedProperty> props = hsqldb.getProperties();
+ log.info("hsqldb.props: "+props);
+ // Update properties
+ 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(hsqldb);
+ mgtView.process();
+
+ // Query the mbeans
+
+ }
+
+ /**
* Test adding a new hsql DataSource deployment
* @throws Exception
*/
@@ -183,7 +224,7 @@
log.info("ManagedPropertys: "+props);
ManagedProperty jndiName = props.get("jndi-name");
- jndiName.setValue("TestDS");
+ jndiName.setValue("TestHqldbDS");
ManagedProperty connURL = props.get("connection-url");
connURL.setValue("jdbc:hsqldb:.");
ManagedProperty driverClass = props.get("driver-class");
@@ -194,7 +235,7 @@
password.setValue("");
mgtView.applyTemplate(DeploymentPhase.APPLICATION,
- "testAddDataSource", dsInfo);
+ "testHqldbDS", dsInfo);
mgtView.process();
}
@@ -206,7 +247,7 @@
{
ManagementView mgtView = getManagementView();
log.info("Templates: "+mgtView.getTemplateNames());
- DeploymentTemplateInfo dsInfo = mgtView.getTemplate("DsXmlDataSourceTemplate");
+ DeploymentTemplateInfo dsInfo = mgtView.getTemplate("FakeDsXmlDataSourceTemplate");
Map<String, ManagedProperty> props = dsInfo.getProperties();
log.info("ManagedPropertys: "+props);
@@ -230,7 +271,8 @@
throws Exception
{
ManagementView mgtView = getManagementView();
- ManagedComponent testAddDataSource = getTestFakeDataSource(mgtView);
+ ComponentType type = new ComponentType("DataSource", "LocalTx");
+ ManagedComponent testAddDataSource = getManagedComponent(mgtView, type, "testAddDataSource-dsf.xml");
Map<String,ManagedProperty> props = testAddDataSource.getProperties();
log.info("testAddDataSource.props: "+props);
// Update properties
@@ -260,8 +302,10 @@
{
ManagementView mgtView = getManagementView();
- ManagedComponent testAddDataSource = getTestFakeDataSource(mgtView);
- Map<String,ManagedProperty> props = testAddDataSource.getProperties();
+ ComponentType type = new ComponentType("DataSource", "LocalTx");
+ ManagedComponent ds = getManagedComponent(mgtView, type, "testAddDataSource-dsf.xml");
+ assertNotNull("testAddDataSource-dsf.xml ManagedComponent", ds);
+ Map<String,ManagedProperty> props = ds.getProperties();
log.info("testAddDataSource.props: "+props);
// Validate the property names
ManagedProperty p = props.get("datasource-type");
@@ -316,44 +360,26 @@
}
/**
+ * Locate the given ComponentType with the given component name.
*
- * @param mgtView
- * @return
+ * @param mgtView -
+ * @return the matching ManagedComponent if found, null otherwise
* @throws Exception
*/
- protected ManagedComponent getTestFakeDataSource(ManagementView mgtView)
+ protected ManagedComponent getManagedComponent(ManagementView mgtView,
+ ComponentType type, String name)
throws Exception
{
- ComponentType dsType = new ComponentType("FakeDataSource", "LocalTx");
- Set<ManagedComponent> dsComps = mgtView.getComponentsForType(dsType);
- ManagedComponent testAddDataSource = null;
- for (ManagedComponent comp : dsComps)
+ Set<ManagedComponent> comps = mgtView.getComponentsForType(type);
+ ManagedComponent mc = null;
+ for (ManagedComponent comp : comps)
{
- String name = comp.getName();
- if( name.equals("testAddDataSource-dsf.xml") )
+ String cname = comp.getName();
+ if( cname.equals(name) )
{
- testAddDataSource = comp;
+ mc = comp;
}
}
- assertNotNull("testAddDataSource", testAddDataSource);
- return testAddDataSource;
+ return mc;
}
-
- protected ManagedComponent getDataSource(ManagementView mgtView)
- throws Exception
- {
- ComponentType dsType = new ComponentType("DataSource", "LocalTx");
- Set<ManagedComponent> dsComps = mgtView.getComponentsForType(dsType);
- ManagedComponent hsqldb = null;
- for (ManagedComponent comp : dsComps)
- {
- String name = comp.getName();
- if( name.equals("hsqldb-ds.xml") )
- {
- hsqldb = comp;
- }
- }
- assertNotNull("hsqldb", hsqldb);
- return hsqldb;
- }
}
More information about the jboss-cvs-commits
mailing list