assertEquals(RunState.RUNNING, component.getRunState());
}
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);
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", QueueType);
assertNotNull(queue1);
assertEquals("testCreateQueue1", queue1.getName());
ManagedComponent queue2 = managementView.getComponent("testCreateQueue2", QueueType);
assertNotNull(queue2);
assertEquals("testCreateQueue2", queue2.getName());
}