[jboss-cvs] JBossAS SVN: r85124 - branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/test.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Mar 2 16:15:41 EST 2009
Author: scott.stark at jboss.org
Date: 2009-03-02 16:15:41 -0500 (Mon, 02 Mar 2009)
New Revision: 85124
Modified:
branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/test/AbstractProfileServiceTest.java
branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/test/JmsDestinationUnitTestCase.java
Log:
JBAS-6219, add test for template info property reuse
Modified: branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/test/AbstractProfileServiceTest.java
===================================================================
--- branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/test/AbstractProfileServiceTest.java 2009-03-02 21:03:17 UTC (rev 85123)
+++ branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/test/AbstractProfileServiceTest.java 2009-03-02 21:15:41 UTC (rev 85124)
@@ -74,48 +74,61 @@
}
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);
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());
}
mgtView.applyTemplate(ManagedDeployment.DeploymentPhase.APPLICATION, deploymentName, info);
- 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())
+ 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: branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/test/JmsDestinationUnitTestCase.java
===================================================================
--- branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/test/JmsDestinationUnitTestCase.java 2009-03-02 21:03:17 UTC (rev 85123)
+++ branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/test/JmsDestinationUnitTestCase.java 2009-03-02 21:15:41 UTC (rev 85124)
@@ -23,11 +23,14 @@
import java.util.Map;
import java.util.HashMap;
-import java.io.Serializable;
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.ManagedDeployment;
+import org.jboss.managed.api.ManagedDeployment.DeploymentPhase;
+import org.jboss.managed.api.ManagedProperty;
import org.jboss.metatype.api.values.MetaValue;
import org.jboss.metatype.api.values.SimpleValueSupport;
@@ -36,6 +39,7 @@
/**
* @author <a href="mailto:alex at jboss.org">Alexey Loubyansky</a>
+ * @author Scott.Stark at jboss.org
* @version <tt>$Revision: $</tt>
*/
public class JmsDestinationUnitTestCase extends AbstractProfileServiceTest
@@ -83,6 +87,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(ManagedDeployment.DeploymentPhase.APPLICATION, "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(ManagedDeployment.DeploymentPhase.APPLICATION, "testCreateQueue2", queue2Info);
+ managementView.process();
+
+ // Validate the components
+ managementView.reloadProfile();
+ 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: branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/test/JmsDestinationUnitTestCase.java
___________________________________________________________________
Name: svn:keywords
+ JBAS-6219, add test for template info property reuse
More information about the jboss-cvs-commits
mailing list