[jboss-cvs] JBossAS SVN: r86710 - in branches/Branch_5_x: profileservice/src/main/org/jboss/profileservice/management/templates and 1 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Apr 2 19:41:18 EDT 2009
Author: scott.stark at jboss.org
Date: 2009-04-02 19:41:18 -0400 (Thu, 02 Apr 2009)
New Revision: 86710
Modified:
branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/RemovedPropertyMap.java
branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/templates/JmsDestinationTemplate.java
branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/templates/JmsDestinationTemplateInfo.java
branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/test/JmsDestinationUnitTestCase.java
Log:
JBAS-6672, Update jms destination template to work with generic template info
Modified: branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/RemovedPropertyMap.java
===================================================================
--- branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/RemovedPropertyMap.java 2009-04-02 22:14:53 UTC (rev 86709)
+++ branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/RemovedPropertyMap.java 2009-04-02 23:41:18 UTC (rev 86710)
@@ -50,7 +50,7 @@
for(String key : delegate.keySet())
{
ManagedProperty mp = delegate.get(key);
- if(mp.isRemoved() == false)
+ if(mp != null && mp.isRemoved() == false)
keySet.add(key);
}
}
@@ -85,7 +85,7 @@
public ManagedProperty get(Object key)
{
ManagedProperty mp = delegate.get(key);
- if(mp.isRemoved())
+ if(mp != null && mp.isRemoved())
mp = null;
return mp;
}
Modified: branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/templates/JmsDestinationTemplate.java
===================================================================
--- branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/templates/JmsDestinationTemplate.java 2009-04-02 22:14:53 UTC (rev 86709)
+++ branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/templates/JmsDestinationTemplate.java 2009-04-02 23:41:18 UTC (rev 86710)
@@ -127,8 +127,19 @@
if(info.getProperties() == null)
throw new IllegalArgumentException("Null template info.");
- JmsDestinationTemplateInfo destinationInfo = (JmsDestinationTemplateInfo)info;
- String destinationType = destinationInfo.getDestinationType();
+ // Look for the destination type using the destinationType ManagedProperty
+ ManagedProperty destTypeMP = info.getProperties().get("destinationType");
+ String destinationType = null;
+ if(destTypeMP == null)
+ {
+ // Try casting this to a DsDataSourceTemplateInfo
+ destinationType = ((JmsDestinationTemplateInfo)info).getDestinationType();
+ }
+ else
+ {
+ SimpleValue dsTypeSV = (SimpleValue) destTypeMP.getValue();
+ destinationType = dsTypeSV.getValue().toString();
+ }
JmsDestinationMetaData destination = new JmsDestinationMetaData();
@@ -169,6 +180,9 @@
MetaValue v = p.getValue();
if(v == null)
continue;
+ // Skip the destinationType
+ if(p == destTypeMP)
+ continue;
String name = p.getName();
char c = name.charAt(0);
Modified: branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/templates/JmsDestinationTemplateInfo.java
===================================================================
--- branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/templates/JmsDestinationTemplateInfo.java 2009-04-02 22:14:53 UTC (rev 86709)
+++ branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/templates/JmsDestinationTemplateInfo.java 2009-04-02 23:41:18 UTC (rev 86710)
@@ -26,7 +26,10 @@
import org.jboss.managed.api.Fields;
import org.jboss.managed.api.ManagedProperty;
import org.jboss.managed.plugins.BasicDeploymentTemplateInfo;
+import org.jboss.managed.plugins.DefaultFieldsImpl;
import org.jboss.managed.plugins.ManagedPropertyImpl;
+import org.jboss.metatype.api.types.SimpleMetaType;
+import org.jboss.metatype.api.values.SimpleValueSupport;
/**
* @author <a href="mailto:alex at jboss.org">Alexey Loubyansky</a>
@@ -78,6 +81,15 @@
private void populate()
{
+ // Add the destination type as a ManagedProperty
+ DefaultFieldsImpl fields = new DefaultFieldsImpl("destinationType");
+ fields.setDescription("The destination type");
+ fields.setMetaType(SimpleMetaType.STRING);
+ fields.setValue(SimpleValueSupport.wrap(destinationType));
+ fields.setField(Fields.READ_ONLY, Boolean.TRUE);
+ ManagedPropertyImpl destTypeMP = new ManagedPropertyImpl(fields);
+ addProperty(destTypeMP);
+
// FIXME
if(getProperties() == null) return;
for(ManagedProperty property : getProperties().values())
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-04-02 22:14:53 UTC (rev 86709)
+++ branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/test/JmsDestinationUnitTestCase.java 2009-04-02 23:41:18 UTC (rev 86710)
@@ -81,6 +81,10 @@
"pageSize", "redeliveryDelay");
properties.keySet().containsAll(items);
+ // Validate the ObjectName property types
+ ManagedProperty serverPeer = info.getProperties().get("serverPeer");
+ assertNotNull(serverPeer);
+ assertEquals(SimpleMetaType.STRING, serverPeer.getMetaType());
}
public void testTopicTemplate() throws Exception
@@ -126,8 +130,27 @@
ManagedComponent queue = activeView.getComponent("testCreateQueue", type);
assertNotNull(queue);
assertEquals("testCreateQueue", queue.getName());
+ log.info(queue.getProperties().keySet());
}
+ public void testCreateQueueAndUpdate() throws Exception
+ {
+ Map<String, MetaValue> propValues = new HashMap<String, MetaValue>();
+ String jndiName = getName();
+ propValues.put("JNDIName", SimpleValueSupport.wrap(jndiName));
+ ComponentType type = KnownComponentTypes.JMSDestination.Queue.getType();
+ createComponentTest("QueueTemplate", propValues, getName(), type, jndiName);
+ ManagedComponent queue = activeView.getComponent("testCreateQueueAndUpdate", type);
+ assertNotNull(queue);
+ assertEquals("testCreateQueueAndUpdate", queue.getName());
+ log.info(queue.getProperties());
+ // downCacheSize, createdProgrammatically, scheduledMessageCount, maxSize, messageStatistics, securityConfig, JNDIName, consumerCount, messageCounterHistoryDayLimit, messageCount, redeliveryDelay, maxDeliveryAttempts, fullSize, messageCounter, pageSize, deliveringCount, expiryQueue, DLQ, name, clustered, serverPeer
+ ManagedProperty pageSize = queue.getProperty("pageSize");
+ log.info("pageSize: "+pageSize);
+ pageSize.setValue(null);
+ activeView.updateComponent(queue);
+ }
+
public void testMultipleQueues() throws Exception
{
ManagementView managementView = getManagementView();
More information about the jboss-cvs-commits
mailing list