}
public void testManagedPropertiesByType()
{
ManagementView mgtView = getCurrentProfileView();
try
{
DeploymentTemplateInfo noTXinfo = mgtView.getTemplate("NoTxDataSourceTemplate");
DeploymentTemplateInfo xaInfo = mgtView.getTemplate("XADataSourceTemplate");
//Set<String> templateNames = mgtView.getTemplateNames();
//Set<String> deploymentNames = mgtView.getDeploymentNames();
ComponentType localType = new ComponentType("DataSource", "Local Transaction");
Set<ManagedComponent> localDS = mgtView.getComponentsForType(localType);
if (localDS != null)
{
for (ManagedComponent component : localDS)
{
LOG.info("***********************************************");
LOG.info("******Dumping a LocalTX component values******");
LOG.info("***********************************************");
Map<String, ManagedProperty> properties = component.getProperties();
LOG.info("\t******Properties******");
for (ManagedProperty managedProperty : properties.values())
{
String name = managedProperty.getName();
MetaType propType = managedProperty.getMetaType();
LOG.info("\t\tProperty Name: " + name);
LOG.info("\t\tProperty Type: " + propType.getTypeName());
if (!propType.isGeneric() && !propType.isSimple())
{
if (propType.isCollection())
{
CollectionMetaType collMetaType = (CollectionMetaType) propType;
LOG.info("\t\t\tCollection Sub Type: " + collMetaType.getTypeName());
}
if (propType.isComposite())
{
CompositeMetaType compositeType = (CompositeMetaType) propType;
Set<String> items = compositeType.itemSet();
for (String itemName : items)
{
LOG.info("\t\t\tComposite Sub Type: " + compositeType.getType(itemName).getTypeName());
}
}
}
}
LOG.info("***********************************************");
LOG.info("\t******Operations******");
Set<ManagedOperation> operations = component.getOperations();
for (ManagedOperation operation : operations)
{
String name = operation.getName();
MetaType returnType = operation.getReturnType();
LOG.info("\t\tOperation Name: " + name);
LOG.info("\t\tReturn Type: " + returnType.getTypeName());
ManagedParameter[] parameters = operation.getParameters();
LOG.info("\t\tParameters:");
for (ManagedParameter parameter : parameters)
{
String paramName = parameter.getName();
MetaType paramType = parameter.getMetaType();
LOG.info("\t\t\tParameter Name: " + paramName + " Type: " + paramType);
}
}
}
}
LOG.info("queues: " + localDS);
//assertNotNull("Null Local DS", localDS);
//assertTrue("queues.size", localDS.size() > 0);
ComponentType noType = new ComponentType("DataSource", "No Transaction");
Set<ManagedComponent> noDS = mgtView.getComponentsForType(noType);
if (noDS != null)
{
for (ManagedComponent component : noDS)
{
Set<ManagedOperation> operations = component.getOperations();
for (ManagedOperation operation : operations)
{
String name = operation.getName();
ManagedParameter[] parameters = operation.getParameters();
for (ManagedParameter parameter : parameters)
{
String paramName = parameter.getName();
}
}
}
}
LOG.info("queues: " + noDS);
//assertNotNull("Null NO TX DS", noDS);
//assertTrue("queues.size", noDS.size() == 0);
ComponentType xaType = new ComponentType("DataSource", "XA Transaction");
Set<ManagedComponent> xaDS = mgtView.getComponentsForType(xaType);
if (xaDS != null)
{
for (ManagedComponent component : xaDS)
{
Set<ManagedOperation> operations = component.getOperations();
for (ManagedOperation operation : operations)
{
String name = operation.getName();
ManagedParameter[] parameters = operation.getParameters();
for (ManagedParameter parameter : parameters)
{
String paramName = parameter.getName();
}
}
}
}
LOG.info("queues: " + xaDS);
//assertNotNull("Null XA DS", xaDS);
//assertTrue("queues.size", xaDS.size() == 0);
ComponentType queueType = new ComponentType("JMSDestination", "Queue");
Set<ManagedComponent> queues = mgtView.getComponentsForType(queueType);
LOG.info("queues: " + queues);
//assertNotNull("Null JMS queues", queues);
//assertTrue("queues.size", queues.size() > 0);
ComponentType topicType = new ComponentType("JMSDestination", "Topic");
Set<ManagedComponent> topics = mgtView.getComponentsForType(topicType);
LOG.info("topics: " + topics);
//assertNotNull(topics);
//assertTrue("topics.size", topics.size() > 0);
}