[jboss-cvs] JBossAS SVN: r78491 - in trunk: testsuite/src/main/org/jboss/test/profileservice/test and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Sep 12 12:52:33 EDT 2008
Author: scott.stark at jboss.org
Date: 2008-09-12 12:52:33 -0400 (Fri, 12 Sep 2008)
New Revision: 78491
Modified:
trunk/profileservice/src/main/org/jboss/profileservice/management/templates/JmsDestinationTemplate.java
trunk/testsuite/src/main/org/jboss/test/profileservice/test/AbstractProfileServiceTest.java
trunk/testsuite/src/main/org/jboss/test/profileservice/test/JmsDestinationUnitTestCase.java
Log:
JBAS-5625, missed updating jms destination test usage of only MetaValues
Modified: trunk/profileservice/src/main/org/jboss/profileservice/management/templates/JmsDestinationTemplate.java
===================================================================
--- trunk/profileservice/src/main/org/jboss/profileservice/management/templates/JmsDestinationTemplate.java 2008-09-12 15:14:03 UTC (rev 78490)
+++ trunk/profileservice/src/main/org/jboss/profileservice/management/templates/JmsDestinationTemplate.java 2008-09-12 16:52:33 UTC (rev 78491)
@@ -36,12 +36,15 @@
import javax.xml.bind.annotation.XmlValue;
import org.jboss.deployers.spi.management.DeploymentTemplate;
import org.jboss.deployers.vfs.spi.client.VFSDeployment;
-import org.jboss.logging.Logger;
import org.jboss.managed.api.DeploymentTemplateInfo;
import org.jboss.managed.api.ManagedProperty;
+import org.jboss.metatype.api.values.MetaValue;
+import org.jboss.metatype.api.values.SimpleValue;
import org.jboss.virtual.VirtualFile;
/**
+ * A template for creating jms destinations
+ *
* @author <a href="mailto:alex at jboss.org">Alexey Loubyansky</a>
* @version <tt>$Revision: $</tt>
*/
@@ -143,6 +146,12 @@
}
}
+ /**
+ * Extract the value from the property MetaValue
+ * @param info - template info
+ * @param propName - the name of the property to return a value for
+ * @return the unwrapped property value
+ */
private Object getProperty(DeploymentTemplateInfo info, String propName)
{
Map<String, ManagedProperty> propsInfo = info.getProperties();
@@ -151,7 +160,20 @@
{
throw new IllegalStateException("Property " + propName + " not found.");
}
- return prop.getValue();
+ Object value = prop.getValue();
+ if(value instanceof MetaValue)
+ {
+ if (prop.getMetaType().isComposite())
+ {
+ throw new IllegalArgumentException("Unable to handle composite: "+prop);
+ }
+ else if(prop.getMetaType().isSimple())
+ {
+ SimpleValue sv = SimpleValue.class.cast(value);
+ value = sv.getValue();
+ }
+ }
+ return value;
}
// the classes below should go away and ServiceDeployment and MetaData
Modified: trunk/testsuite/src/main/org/jboss/test/profileservice/test/AbstractProfileServiceTest.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/profileservice/test/AbstractProfileServiceTest.java 2008-09-12 15:14:03 UTC (rev 78490)
+++ trunk/testsuite/src/main/org/jboss/test/profileservice/test/AbstractProfileServiceTest.java 2008-09-12 16:52:33 UTC (rev 78491)
@@ -107,20 +107,7 @@
assertNotNull(prop);
Object propValue = prop.getValue();
Object expectedValue = propValues.get(propName);
- if(propValue instanceof MetaValue)
- {
- if(prop.getMetaType().isSimple())
- assertEquals(prop.getName(), expectedValue, ((SimpleValue)propValue).getValue());
- else
- {
- Type valueType = expectedValue.getClass();
- propValue = getMetaValueFactory().unwrap((MetaValue)propValue, valueType);
- expectedValue = getMetaValueFactory().unwrap((MetaValue)expectedValue, valueType);
- assertEquals(prop.getName(), expectedValue, propValue);
- }
- }
- else
- assertEquals(prop.getName(), expectedValue, propValue);
+ assertEquals(prop.getName(), expectedValue, propValue);
mcPropNames.remove(propName);
}
Modified: trunk/testsuite/src/main/org/jboss/test/profileservice/test/JmsDestinationUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/profileservice/test/JmsDestinationUnitTestCase.java 2008-09-12 15:14:03 UTC (rev 78490)
+++ trunk/testsuite/src/main/org/jboss/test/profileservice/test/JmsDestinationUnitTestCase.java 2008-09-12 16:52:33 UTC (rev 78491)
@@ -28,6 +28,7 @@
import org.jboss.deployers.spi.management.ManagementView;
import org.jboss.managed.api.ComponentType;
import org.jboss.managed.api.ManagedComponent;
+import org.jboss.metatype.api.values.SimpleValueSupport;
import junit.framework.Test;
import junit.framework.TestSuite;
@@ -73,7 +74,7 @@
{
Map<String, Serializable> propValues = new HashMap<String, Serializable>();
String jndiName = getName();
- propValues.put("JNDIName", jndiName);
+ propValues.put("JNDIName", SimpleValueSupport.wrap(jndiName));
ComponentType type = KnownComponentTypes.JMSDestination.Queue.getType();
createComponentTest("QueueTemplate", propValues, getName(), type, jndiName);
ManagedComponent queue = activeView.getComponent("testCreateQueue", type);
@@ -93,7 +94,7 @@
{
Map<String, Serializable> propValues = new HashMap<String, Serializable>();
String jndiName = getName();
- propValues.put("JNDIName", jndiName);
+ propValues.put("JNDIName", SimpleValueSupport.wrap(jndiName));
ComponentType type = KnownComponentTypes.JMSDestination.Topic.getType();
createComponentTest("TopicTemplate", propValues, getName(), type, jndiName);
ManagedComponent topic = activeView.getComponent("testCreateTopic", type);
More information about the jboss-cvs-commits
mailing list