Author: fjuma
Date: 2009-03-31 14:34:17 -0400 (Tue, 31 Mar 2009)
New Revision: 266
Modified:
trunk/jsfunit/pom.xml
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/JMSTest.java
Log:
Added a couple of creation tests for topics and queues that attempt to specify values for
ObjectName ManagedProperties (see JOPR-121).
Updated jsfunit/pom.xml to use org.jboss.integration 5.1.0.CR2.
Made some minor modifications to the tests for topics and queues.
Modified: trunk/jsfunit/pom.xml
===================================================================
--- trunk/jsfunit/pom.xml 2009-03-31 17:52:31 UTC (rev 265)
+++ trunk/jsfunit/pom.xml 2009-03-31 18:34:17 UTC (rev 266)
@@ -112,7 +112,7 @@
<dependency>
<groupId>org.jboss.integration</groupId>
<artifactId>jboss-profileservice-spi</artifactId>
- <version>5.1.0.CR1</version>
+ <version>5.1.0.CR2</version>
<scope>provided</scope>
</dependency>
<dependency>
Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/JMSTest.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/JMSTest.java 2009-03-31
17:52:31 UTC (rev 265)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/JMSTest.java 2009-03-31
18:34:17 UTC (rev 266)
@@ -127,6 +127,10 @@
private TopicConnection topicConnection = null;
private QueueConnection queueConnection = null;
+ private static final String DLQ =
"jboss.messaging.destination:service=Queue,name=DLQ";
+ private static final String EXPIRY_QUEUE =
"jboss.messaging.destination:service=Queue,name=ExpiryQueue";
+ private static final String SERVER_PEER =
"jboss.messaging:service=ServerPeer";
+
/**
* Create a new topic or queue using the given destination type and properties.
*/
@@ -156,6 +160,7 @@
protected Map<String, MetaValue> createQueue(String queueName) throws
IOException, EmbJoprTestException {
Map<String, MetaValue> propertiesMap = new LinkedHashMap<String,
MetaValue>();
+ propertiesMap.put("name", SimpleValueSupport.wrap(queueName));
propertiesMap.put("JNDIName", SimpleValueSupport.wrap(queueName));
propertiesMap.put("clustered",
SimpleValueSupport.wrap(Boolean.FALSE));
propertiesMap.put("downCacheSize", SimpleValueSupport.wrap(new
Integer(1500)));
@@ -176,11 +181,13 @@
*/
protected Map<String, MetaValue> createTopic(String topicName) throws
IOException, EmbJoprTestException {
Map<String, MetaValue> propertiesMap = new LinkedHashMap<String,
MetaValue>();
+ propertiesMap.put("name", SimpleValueSupport.wrap(topicName));
propertiesMap.put("JNDIName", SimpleValueSupport.wrap(topicName));
propertiesMap.put("clustered", SimpleValueSupport.wrap(Boolean.TRUE));
propertiesMap.put("fullSize", SimpleValueSupport.wrap(new
Integer(70000)));
propertiesMap.put("maxSize", SimpleValueSupport.wrap(new
Integer(70000)));
propertiesMap.put("redeliveryDelay", SimpleValueSupport.wrap(new
Long(60000)));
+ propertiesMap.put("downCacheSize", SimpleValueSupport.wrap(new
Integer(2000)));
createDestination(DestinationType.TOPIC, TOPIC_DEFAULT_TEMPLATE, propertiesMap);
client.click("resourceConfigurationForm:saveButton");
@@ -200,11 +207,11 @@
*/
protected Map<String, MetaValue> getSpecificComponentProperties(String
componentName,
ComponentType type)
throws Exception {
- String[] specificProperties = new String[] {"JNDIName",
"clustered",
+ String[] specificProperties = new String[] {"name",
"JNDIName", "clustered",
"downCacheSize",
"fullSize",
"maxDeliveryAttempts",
"maxSize",
"messageCounterHistoryDayLimit", "pageSize",
- "redeliveryDelay"};
+ "redeliveryDelay",
"DLQ", "expiryQueue", "serverPeer"};
return super.getSpecificComponentProperties(componentName, type,
specificProperties);
}
@@ -449,6 +456,7 @@
// The properties we want to configure
Map<String, MetaValue> propertiesMap = new LinkedHashMap<String,
MetaValue>();
+ propertiesMap.put("name", SimpleValueSupport.wrap(jndiName));
propertiesMap.put("JNDIName", SimpleValueSupport.wrap(jndiName));
propertiesMap.put("clustered", SimpleValueSupport.wrap(Boolean.TRUE));
propertiesMap.put("downCacheSize", SimpleValueSupport.wrap(new
Integer(2500)));
@@ -475,6 +483,70 @@
deleteDestination(destinationType, jndiName);
}
+ /**
+ * Test Name: testCreateQueueSetObjectNameManagedProperties
+ * Assertion: Verify the ability to specify ObjectName ManagedProperties
+ * (eg. DLQ, expiryQueue, serverPeer) when creating a new queue.
+ * (See JOPR-121)
+ */
+ public void testCreateQueueSetObjectNameManagedProperties() throws Exception {
+ String jndiName = "ObjectNameManagedPropertiesQueue";
+ String expectedMessage = ADD_MESSAGE + DestinationType.QUEUE.getName();
+
+ createDestinationWithObjectNameManagedProperties(DestinationType.QUEUE,
QUEUE_DEFAULT_TEMPLATE,
+ jndiName, expectedMessage,
QUEUE_COMPONENT_TYPE);
+ }
+
+ /**
+ * Test Name: testCreateTopicSetObjectNameManagedProperties
+ * Assertion: Verify the ability to specify ObjectName ManagedProperties
+ * (eg. DLQ, expiryQueue, serverPeer) when creating a new topic.
+ * (See JOPR-121)
+ */
+ public void testCreateTopicSetObjectNameManagedProperties() throws Exception {
+
+ String jndiName = "ObjectNameManagedPropertiesTopic";
+ String expectedMessage = ADD_MESSAGE + DestinationType.TOPIC.getName();
+
+ createDestinationWithObjectNameManagedProperties(DestinationType.QUEUE,
QUEUE_DEFAULT_TEMPLATE,
+ jndiName, expectedMessage,
QUEUE_COMPONENT_TYPE);
+ }
+
+ /**
+ * Common code for the testCreateQueueSetObjectNameManagedProperties() and
+ * testCreateTopicSetObjectNameManagedProperties() tests.
+ */
+ private void createDestinationWithObjectNameManagedProperties(DestinationType
destinationType,
+ String
destinationTemplate,
+ String jndiName,
+ String
expectedMessage,
+ ComponentType
componentType) throws Exception {
+
+ // The properties we want to configure
+ Map<String, MetaValue> propertiesMap = new LinkedHashMap<String,
MetaValue>();
+ propertiesMap.put("name", SimpleValueSupport.wrap(jndiName));
+ propertiesMap.put("JNDIName", SimpleValueSupport.wrap(jndiName));
+ propertiesMap.put("downCacheSize", SimpleValueSupport.wrap(new
Integer(2500)));
+ propertiesMap.put("DLQ", SimpleValueSupport.wrap(DLQ));
+ propertiesMap.put("expiryQueue",
SimpleValueSupport.wrap(EXPIRY_QUEUE));
+ propertiesMap.put("serverPeer", SimpleValueSupport.wrap(SERVER_PEER));
+
+ createDestination(destinationType, destinationTemplate, propertiesMap);
+ client.click("resourceConfigurationForm:saveButton");
+
+ // Check for the appropriate success messages
+ checkClientAndServerMessages(expectedMessage, expectedMessage, false);
+
+ // Make sure the ManagedComponent was created and that the properties are
+ // set correctly
+ assertTrue("The destination is not deployed ",
+ isDeployed(jndiName + "-service.xml"));
+ checkComponentProperties(propertiesMap, jndiName, componentType);
+
+ // Clean up
+ deleteDestination(destinationType, jndiName);
+ }
+
/**
* Test Name: testCreateQueueMissingRequiredValue
* Assertion: Verify the ability to handle a missing required value when
@@ -544,6 +616,7 @@
String jndiName) throws IOException,
EmbJoprTestException {
// The properties we want to configure
Map<String, MetaValue> propertiesMap = new LinkedHashMap<String,
MetaValue>();
+ propertiesMap.put("name", SimpleValueSupport.wrap(jndiName));
propertiesMap.put("JNDIName", SimpleValueSupport.wrap(jndiName));
propertiesMap.put("clustered", SimpleValueSupport.wrap(Boolean.TRUE));
propertiesMap.put("downCacheSize", SimpleValueSupport.wrap(new
Integer(2500)));
@@ -592,10 +665,12 @@
String jndiName) throws
IOException, EmbJoprTestException {
// The properties we want to configure
Map<String, MetaValue> propertiesMap = new LinkedHashMap<String,
MetaValue>();
+ propertiesMap.put("name", SimpleValueSupport.wrap(jndiName));
propertiesMap.put("JNDIName", SimpleValueSupport.wrap(jndiName));
propertiesMap.put("clustered",
SimpleValueSupport.wrap(Boolean.TRUE));
propertiesMap.put("messageCounterHistoryDayLimit",
SimpleValueSupport.wrap(new Integer(0)));
propertiesMap.put("redeliveryDelay", SimpleValueSupport.wrap(new
Long(50000)));
+ propertiesMap.put("downCacheSize", SimpleValueSupport.wrap(new
Integer(1500)));
// This property value is supposed to be an integer
propertiesMap.put("maxDeliveryAttempts",
SimpleValueSupport.wrap("fifteen"));
@@ -615,8 +690,11 @@
* occurs.
*/
public void testCreateQueueDuplicateJNDIName() throws IOException,
EmbJoprTestException {
- createDestinationDuplicateJNDIName(DestinationType.QUEUE,
QUEUE_DEFAULT_TEMPLATE,
- "TestQueue");
+ String jndiName = "TestQueue";
+ createQueue(jndiName);
+
+ checkDestinationDuplicateJNDIName(DestinationType.QUEUE, jndiName);
+
}
/**
@@ -626,28 +704,23 @@
* occurs.
*/
public void testCreateTopicDuplicateJNDIName() throws IOException,
EmbJoprTestException {
- createDestinationDuplicateJNDIName(DestinationType.TOPIC,
TOPIC_DEFAULT_TEMPLATE,
- "TestTopic");
+ String jndiName = "TestTopic";
+ createTopic(jndiName);
+
+ checkDestinationDuplicateJNDIName(DestinationType.TOPIC, jndiName);
}
/**
* Common code for the testCreate*DuplicateJNDIName() tests.
*/
- public void createDestinationDuplicateJNDIName(DestinationType destinationType,
- String destinationTemplate,
- String jndiName) throws IOException,
EmbJoprTestException {
- // The properties we want to configure
- Map<String, MetaValue> propertiesMap = new LinkedHashMap<String,
MetaValue>();
- propertiesMap.put("JNDIName", SimpleValueSupport.wrap(jndiName));
-
- createDestination(destinationType, destinationTemplate, propertiesMap);
- client.click("resourceConfigurationForm:saveButton");
-
+ public void checkDestinationDuplicateJNDIName(DestinationType destinationType,
+ String jndiName) throws IOException,
EmbJoprTestException {
+
// Check for the appropriate error messages
String expectedMessage = "A " + destinationType.getName() + "
named '" + jndiName + "' already exists";
checkClientAndServerMessages(expectedMessage, expectedMessage, true);
}
-
+
/*
* DELETION TESTS
*/