[jboss-cvs] JBossAS SVN: r85238 - trunk/testsuite/src/main/org/jboss/test/profileservice/test.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Mar 4 11:20:31 EST 2009
Author: emuckenhuber
Date: 2009-03-04 11:20:31 -0500 (Wed, 04 Mar 2009)
New Revision: 85238
Modified:
trunk/testsuite/src/main/org/jboss/test/profileservice/test/AbstractProfileServiceTest.java
trunk/testsuite/src/main/org/jboss/test/profileservice/test/JmsDestinationUnitTestCase.java
Log:
port 85124, JBAS-6219, add test for template info property reuse
Modified: trunk/testsuite/src/main/org/jboss/test/profileservice/test/AbstractProfileServiceTest.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/profileservice/test/AbstractProfileServiceTest.java 2009-03-04 16:11:45 UTC (rev 85237)
+++ trunk/testsuite/src/main/org/jboss/test/profileservice/test/AbstractProfileServiceTest.java 2009-03-04 16:20:31 UTC (rev 85238)
@@ -97,47 +97,62 @@
}
protected void createComponentTest(String templateName,
+ Map<String, MetaValue> propValues,
+ String deploymentName,
+ ComponentType componentType, String componentName)
+ throws Exception
+ {
+ createComponentTest(templateName, propValues, deploymentName, componentType, componentName, true);
+ }
+
+ protected void createComponentTest(String templateName,
Map<String, MetaValue> propValues,
String deploymentName,
- ComponentType componentType, String componentName)
+ ComponentType componentType, String componentName,
+ boolean processChanges)
throws Exception
{
ManagementView mgtView = getManagementView();
DeploymentTemplateInfo info = mgtView.getTemplate(templateName);
assertNotNull("template " + templateName + " found", info);
Map<String, ManagedProperty> props = info.getProperties();
-
for(String propName : propValues.keySet())
{
ManagedProperty prop = props.get(propName);
+ log.debug("createComponentTest("+propName+") before: "+prop.getValue());
assertNotNull("property " + propName + " found in template " + templateName, prop);
prop.setValue(propValues.get(propName));
+ log.debug("createComponentTest("+propName+") after: "+prop.getValue());
}
mgtView.applyTemplate(deploymentName, info);
-
- // reload the view
- activeView = null;
- mgtView = getManagementView();
- ManagedComponent dsMC = getManagedComponent(mgtView, componentType, componentName);
- assertNotNull(dsMC);
-
- Set<String> mcPropNames = new HashSet<String>(dsMC.getPropertyNames());
- for(String propName : propValues.keySet())
+ if(processChanges)
{
- ManagedProperty prop = dsMC.getProperty(propName);
- assertNotNull(prop);
- Object propValue = prop.getValue();
- Object expectedValue = propValues.get(propName);
- assertEquals(prop.getName(), expectedValue, propValue);
-
- mcPropNames.remove(propName);
+ mgtView.process();
+
+ // reload the view
+ activeView = null;
+ mgtView = getManagementView();
+ ManagedComponent dsMC = getManagedComponent(mgtView, componentType, componentName);
+ assertNotNull(dsMC);
+
+ Set<String> mcPropNames = new HashSet<String>(dsMC.getPropertyNames());
+ for(String propName : propValues.keySet())
+ {
+ ManagedProperty prop = dsMC.getProperty(propName);
+ assertNotNull(prop);
+ Object propValue = prop.getValue();
+ Object expectedValue = propValues.get(propName);
+ assertEquals(prop.getName(), expectedValue, propValue);
+
+ mcPropNames.remove(propName);
+ }
+
+ if(!mcPropNames.isEmpty())
+ {
+ log.warn(getName() + "> untested properties: " + mcPropNames);
+ }
}
-
- if(!mcPropNames.isEmpty())
- {
- log.warn(getName() + "> untested properties: " + mcPropNames);
- }
}
/**
Modified: trunk/testsuite/src/main/org/jboss/test/profileservice/test/JmsDestinationUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/profileservice/test/JmsDestinationUnitTestCase.java 2009-03-04 16:11:45 UTC (rev 85237)
+++ trunk/testsuite/src/main/org/jboss/test/profileservice/test/JmsDestinationUnitTestCase.java 2009-03-04 16:20:31 UTC (rev 85238)
@@ -30,13 +30,16 @@
import org.jboss.deployers.spi.management.KnownComponentTypes;
import org.jboss.deployers.spi.management.ManagementView;
import org.jboss.managed.api.ComponentType;
+import org.jboss.managed.api.DeploymentTemplateInfo;
import org.jboss.managed.api.ManagedComponent;
+import org.jboss.managed.api.ManagedProperty;
import org.jboss.metatype.api.values.MetaValue;
import org.jboss.metatype.api.values.SimpleValueSupport;
/**
* @author <a href="mailto:alex at jboss.org">Alexey Loubyansky</a>
- * @version <tt>$Revision$</tt>
+ * @author Scott.Stark at jboss.org
+ * @version <tt>$Revision: $<
*/
public class JmsDestinationUnitTestCase extends AbstractProfileServiceTest
{
@@ -83,6 +86,66 @@
assertEquals("testCreateQueue", queue.getName());
}
+ public void testMultipleQueues() throws Exception
+ {
+ ManagementView managementView = getManagementView();
+
+ Map<String, MetaValue> propValues = new HashMap<String, MetaValue>();
+ // testCreateQueue1
+ String jndiName = "testCreateQueue1";
+ String templateName = "QueueTemplate";
+ MetaValue jndiName1MV = SimpleValueSupport.wrap(jndiName);
+ propValues.put("JNDIName", jndiName1MV);
+ ComponentType type = KnownComponentTypes.JMSDestination.Queue.getType();
+ DeploymentTemplateInfo queue1Info = managementView.getTemplate(templateName);
+ Map<String, ManagedProperty> testCreateQueue1Props = queue1Info.getProperties();
+ log.debug("QueueTemplate#1: "+testCreateQueue1Props);
+ for(String propName : testCreateQueue1Props.keySet())
+ {
+ ManagedProperty prop = testCreateQueue1Props.get(propName);
+ assertNotNull("property " + propName + " found in template " + templateName, prop);
+ log.debug("createComponentTest("+propName+") before: "+prop.getValue());
+ prop.setValue(propValues.get(propName));
+ log.debug("createComponentTest("+propName+") after: "+prop.getValue());
+ }
+ managementView.applyTemplate("testCreateQueue1", queue1Info);
+ managementView.process();
+
+ // testCreateQueue2
+ jndiName = "testCreateQueue2";
+ MetaValue jndiName2MV = SimpleValueSupport.wrap(jndiName);
+ propValues.put("JNDIName", jndiName2MV);
+ // Get a fresh template info view
+ DeploymentTemplateInfo queue2Info = managementView.getTemplate(templateName);
+ Map<String, ManagedProperty> testCreateQueue2Props = queue2Info.getProperties();
+ log.debug("QueueTemplate#2: "+testCreateQueue2Props);
+ // Validate the properties don't have the previous template values
+ ManagedProperty jndiNameCheck1 = testCreateQueue2Props.get("JNDIName");
+ assertFalse("Fresh temmplate properties does not have previous JNDIName",
+ jndiName1MV.equals(jndiNameCheck1.getValue()));
+ for(String propName : testCreateQueue2Props.keySet())
+ {
+ ManagedProperty prop = testCreateQueue2Props.get(propName);
+ assertNotNull("property " + propName + " found in template " + templateName, prop);
+ log.debug(propName+" before: "+prop.getValue());
+ prop.setValue(propValues.get(propName));
+ log.debug(propName+" after: "+prop.getValue());
+ }
+ managementView.applyTemplate("testCreateQueue2", queue2Info);
+ managementView.process();
+
+ // Validate the components
+ managementView.reload();
+ ManagedComponent queue1 = managementView.getComponent("testCreateQueue1", type);
+ assertNotNull(queue1);
+ assertEquals("testCreateQueue1", queue1.getName());
+
+ ManagedComponent queue2 = managementView.getComponent("testCreateQueue2", type);
+ assertNotNull(queue2);
+ assertEquals("testCreateQueue2", queue2.getName());
+
+ }
+
public void testRemoveQueue() throws Exception
{
removeDeployment("testCreateQueue-service.xml");
Property changes on: trunk/testsuite/src/main/org/jboss/test/profileservice/test/JmsDestinationUnitTestCase.java
___________________________________________________________________
Name: svn:keywords
- Author Date Id Revision
+ JBAS-6219, add test for template info property reuse
More information about the jboss-cvs-commits
mailing list