[jboss-cvs] JBoss Messaging SVN: r6555 - in trunk/tests: src/org/jboss/messaging/tests/integration/jms/server and 2 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Apr 24 06:48:46 EDT 2009
Author: jmesnil
Date: 2009-04-24 06:48:45 -0400 (Fri, 24 Apr 2009)
New Revision: 6555
Modified:
trunk/tests/config/jbm-jms-for-JMSServerDeployerTest.xml
trunk/tests/src/org/jboss/messaging/tests/integration/jms/server/JMSServerDeployerTest.java
trunk/tests/src/org/jboss/messaging/tests/integration/management/ManagementTestBase.java
trunk/tests/src/org/jboss/messaging/tests/util/UnitTestCase.java
Log:
JMS Server deployer
* used unique JNDI bindings to ensure the resources are properly put in JNDI
* added checkNoBinding/checkBinding before/after deploying the configuration
Modified: trunk/tests/config/jbm-jms-for-JMSServerDeployerTest.xml
===================================================================
--- trunk/tests/config/jbm-jms-for-JMSServerDeployerTest.xml 2009-04-24 10:13:43 UTC (rev 6554)
+++ trunk/tests/config/jbm-jms-for-JMSServerDeployerTest.xml 2009-04-24 10:48:45 UTC (rev 6555)
@@ -2,12 +2,12 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:jboss:messaging ../../src/schemas/jbm-jms.xsd ">
- <connection-factory name="testConnectionFactory">
+ <connection-factory name="fullConfigurationConnectionFactory">
<entries>
- <entry name="/testConnectionFactory"/>
- <entry name="/acme/testConnectionFactory"/>
- <entry name="java:/xyz/testConnectionFactory"/>
- <entry name="java:/connectionfactories/acme/testConnectionFactory"/>
+ <entry name="/fullConfigurationConnectionFactory"/>
+ <entry name="/acme/fullConfigurationConnectionFactory"/>
+ <entry name="java:/xyz/tfullConfigurationConnectionFactory"/>
+ <entry name="java:/connectionfactories/acme/fullConfigurationConnectionFactory"/>
</entries>
<connector-ref connector-name="netty"/>
<ping-period>1234</ping-period>
@@ -35,14 +35,14 @@
<retry-interval-multiplier>6.0</retry-interval-multiplier>
</connection-factory>
- <queue name="testQueue">
- <entry name="/testQueue"/>
- <entry name="/queue/testQueue"/>
+ <queue name="fullConfigurationQueue">
+ <entry name="/fullConfigurationQueue"/>
+ <entry name="/queue/fullConfigurationQueue"/>
</queue>
- <topic name="testTopic">
- <entry name="/testTopic"/>
- <entry name="/topic/testTopic"/>
+ <topic name="fullConfigurationTopic">
+ <entry name="/fullConfigurationTopic"/>
+ <entry name="/topic/fullConfigurationTopic"/>
</topic>
</deployment>
\ No newline at end of file
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/jms/server/JMSServerDeployerTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/jms/server/JMSServerDeployerTest.java 2009-04-24 10:13:43 UTC (rev 6554)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/jms/server/JMSServerDeployerTest.java 2009-04-24 10:48:45 UTC (rev 6555)
@@ -64,18 +64,16 @@
private JMSServerManager jmsServer;
private Context context;
-
+
private DeploymentManager deploymentManager;
-
+
private Configuration config;
// Public --------------------------------------------------------
public void testValidateEmptyConfiguration() throws Exception
{
- JMSServerDeployer deployer = new JMSServerDeployer(jmsServer,
- deploymentManager,
- config);
+ JMSServerDeployer deployer = new JMSServerDeployer(jmsServer, deploymentManager, config);
String xml = "<deployment xmlns='urn:jboss:messaging'> " + "</deployment>";
@@ -85,54 +83,86 @@
public void testDeployFullConfiguration() throws Exception
{
- JMSServerDeployer deployer = new JMSServerDeployer(jmsServer,
- deploymentManager,
- config);
+ JMSServerDeployer deployer = new JMSServerDeployer(jmsServer, deploymentManager, config);
String conf = "jbm-jms-for-JMSServerDeployerTest.xml";
URL confURL = Thread.currentThread().getContextClassLoader().getResource(conf);
+ String[] connectionFactoryBindings = new String[] { "/fullConfigurationConnectionFactory",
+ "/acme/fullConfigurationConnectionFactory",
+ "java:/xyz/tfullConfigurationConnectionFactory",
+ "java:/connectionfactories/acme/fullConfigurationConnectionFactory" };
+ String[] queueBindings = new String[] { "/fullConfigurationQueue", "/queue/fullConfigurationQueue" };
+ String[] topicBindings = new String[] { "/fullConfigurationTopic", "/topic/fullConfigurationTopic" };
+
+ for (String binding : connectionFactoryBindings)
+ {
+ checkNoBinding(context, binding);
+ }
+ for (String binding : queueBindings)
+ {
+ checkNoBinding(context, binding);
+ }
+ for (String binding : topicBindings)
+ {
+ checkNoBinding(context, binding);
+ }
+
deployer.deploy(confURL);
- JBossConnectionFactory cf = (JBossConnectionFactory)context.lookup("/testConnectionFactory");
- assertNotNull(cf);
- assertEquals(1234, cf.getPingPeriod());
- assertEquals(5678, cf.getCallTimeout());
- assertEquals(12345, cf.getConsumerWindowSize());
- assertEquals(6789, cf.getConsumerMaxRate());
- assertEquals(123456, cf.getProducerWindowSize());
- assertEquals(789, cf.getProducerMaxRate());
- assertEquals(12, cf.getMinLargeMessageSize());
- assertEquals("TestClientID", cf.getClientID());
- assertEquals(3456, cf.getDupsOKBatchSize());
- assertEquals(4567, cf.getTransactionBatchSize());
- assertEquals(true, cf.isBlockOnAcknowledge());
- assertEquals(false, cf.isBlockOnNonPersistentSend());
- assertEquals(true, cf.isBlockOnPersistentSend());
- assertEquals(false, cf.isAutoGroup());
- assertEquals(true, cf.isPreAcknowledge());
- assertEquals(2345, cf.getConnectionTTL());
- assertEquals(false, cf.isFailoverOnServerShutdown());
- assertEquals(12, cf.getMaxConnections());
- assertEquals(34, cf.getReconnectAttempts());
- assertEquals(5, cf.getRetryInterval());
- assertEquals(6.0, cf.getRetryIntervalMultiplier());
-
- Queue queue = (Queue)context.lookup("/testQueue");
- assertNotNull(queue);
- assertEquals("testQueue", queue.getQueueName());
+ for (String binding : connectionFactoryBindings)
+ {
+ checkBinding(context, binding);
+ }
+ for (String binding : queueBindings)
+ {
+ checkBinding(context, binding);
+ }
+ for (String binding : topicBindings)
+ {
+ checkBinding(context, binding);
+ }
- Queue queue2 = (Queue)context.lookup("/queue/testQueue");
- assertNotNull(queue2);
- assertEquals("testQueue", queue2.getQueueName());
+ for (String binding : connectionFactoryBindings)
+ {
+ JBossConnectionFactory cf = (JBossConnectionFactory)context.lookup(binding);
+ assertNotNull(cf);
+ assertEquals(1234, cf.getPingPeriod());
+ assertEquals(5678, cf.getCallTimeout());
+ assertEquals(12345, cf.getConsumerWindowSize());
+ assertEquals(6789, cf.getConsumerMaxRate());
+ assertEquals(123456, cf.getProducerWindowSize());
+ assertEquals(789, cf.getProducerMaxRate());
+ assertEquals(12, cf.getMinLargeMessageSize());
+ assertEquals("TestClientID", cf.getClientID());
+ assertEquals(3456, cf.getDupsOKBatchSize());
+ assertEquals(4567, cf.getTransactionBatchSize());
+ assertEquals(true, cf.isBlockOnAcknowledge());
+ assertEquals(false, cf.isBlockOnNonPersistentSend());
+ assertEquals(true, cf.isBlockOnPersistentSend());
+ assertEquals(false, cf.isAutoGroup());
+ assertEquals(true, cf.isPreAcknowledge());
+ assertEquals(2345, cf.getConnectionTTL());
+ assertEquals(false, cf.isFailoverOnServerShutdown());
+ assertEquals(12, cf.getMaxConnections());
+ assertEquals(34, cf.getReconnectAttempts());
+ assertEquals(5, cf.getRetryInterval());
+ assertEquals(6.0, cf.getRetryIntervalMultiplier());
+ }
- Topic topic = (Topic)context.lookup("/testTopic");
- assertNotNull(topic);
- assertEquals("testTopic", topic.getTopicName());
+ for (String binding : queueBindings)
+ {
+ Queue queue = (Queue)context.lookup(binding);
+ assertNotNull(queue);
+ assertEquals("fullConfigurationQueue", queue.getQueueName());
+ }
- Topic topic2 = (Topic)context.lookup("/topic/testTopic");
- assertNotNull(topic2);
- assertEquals("testTopic", topic2.getTopicName());
+ for (String binding : topicBindings)
+ {
+ Topic topic = (Topic)context.lookup(binding);
+ assertNotNull(topic);
+ assertEquals("fullConfigurationTopic", topic.getTopicName());
+ }
}
// Package protected ---------------------------------------------
@@ -145,16 +175,17 @@
super.setUp();
config = new ConfigurationImpl();
- config.getConnectorConfigurations().put("netty", new TransportConfiguration(NettyConnectorFactory.class.getName()));
+ config.getConnectorConfigurations().put("netty",
+ new TransportConfiguration(NettyConnectorFactory.class.getName()));
MessagingServer server = createServer(false, config);
deploymentManager = new FileDeploymentManager(config.getFileDeployerScanPeriod());
jmsServer = new JMSServerManagerImpl(server);
+ context = new InVMContext();
+ jmsServer.setContext(context);
jmsServer.start();
- context = new InVMContext();
- jmsServer.setContext(context);
}
@Override
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/management/ManagementTestBase.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/management/ManagementTestBase.java 2009-04-24 10:13:43 UTC (rev 6554)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/management/ManagementTestBase.java 2009-04-24 10:48:45 UTC (rev 6555)
@@ -25,7 +25,6 @@
import javax.management.MBeanServer;
import javax.management.MBeanServerFactory;
import javax.management.ObjectName;
-import javax.naming.Context;
import org.jboss.messaging.core.client.ClientConsumer;
import org.jboss.messaging.core.client.ClientMessage;
@@ -109,27 +108,8 @@
{
assertTrue("no resource for " + on, mbeanServer.isRegistered(on));
}
-
- protected static void checkNoBinding(Context context, String binding)
- {
- try
- {
- context.lookup(binding);
- fail("there must be no resource to look up for " + binding);
- }
- catch (Exception e)
- {
- }
- }
- protected static Object checkBinding(Context context, String binding) throws Exception
- {
- Object o = context.lookup(binding);
- assertNotNull(o);
- return o;
- }
-
// Private -------------------------------------------------------
// Inner classes -------------------------------------------------
Modified: trunk/tests/src/org/jboss/messaging/tests/util/UnitTestCase.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/util/UnitTestCase.java 2009-04-24 10:13:43 UTC (rev 6554)
+++ trunk/tests/src/org/jboss/messaging/tests/util/UnitTestCase.java 2009-04-24 10:48:45 UTC (rev 6555)
@@ -22,9 +22,28 @@
package org.jboss.messaging.tests.util;
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.nio.ByteBuffer;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+
+import javax.naming.Context;
+import javax.transaction.xa.XAException;
+import javax.transaction.xa.Xid;
+
import junit.framework.TestCase;
-import org.jboss.messaging.core.asyncio.impl.AsynchronousFileImpl;
import org.jboss.messaging.core.buffers.ChannelBuffers;
import org.jboss.messaging.core.client.ClientMessage;
import org.jboss.messaging.core.client.ClientSession;
@@ -40,24 +59,6 @@
import org.jboss.messaging.utils.SimpleString;
import org.jboss.messaging.utils.UUIDGenerator;
-import javax.transaction.xa.XAException;
-import javax.transaction.xa.Xid;
-import java.io.BufferedInputStream;
-import java.io.BufferedOutputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.nio.ByteBuffer;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
-
/**
*
* Helper base class for our unit tests
@@ -199,6 +200,25 @@
}
}
+ protected static void checkNoBinding(Context context, String binding)
+ {
+ try
+ {
+ context.lookup(binding);
+ fail("there must be no resource to look up for " + binding);
+ }
+ catch (Exception e)
+ {
+ }
+ }
+
+ protected static Object checkBinding(Context context, String binding) throws Exception
+ {
+ Object o = context.lookup(binding);
+ assertNotNull(o);
+ return o;
+ }
+
// Constructors --------------------------------------------------
// Protected -----------------------------------------------------
More information about the jboss-cvs-commits
mailing list