You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ta...@apache.org on 2015/01/31 00:35:55 UTC
[1/4] qpid-jms git commit: Add some extra logging to help with
intermittent test failures.
Repository: qpid-jms
Updated Branches:
refs/heads/master 95264884e -> c136cb6fe
Add some extra logging to help with intermittent test failures.
Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/86b00e65
Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/86b00e65
Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/86b00e65
Branch: refs/heads/master
Commit: 86b00e659531e3a500cc6ef0e4a3af6cbeb05c3e
Parents: 9526488
Author: Timothy Bish <ta...@gmail.com>
Authored: Fri Jan 30 16:16:23 2015 -0500
Committer: Timothy Bish <ta...@gmail.com>
Committed: Fri Jan 30 16:16:23 2015 -0500
----------------------------------------------------------------------
.../qpid/jms/transports/netty/NettySslTransportTest.java | 4 ++++
.../qpid/jms/transports/netty/NettyTcpTransportTest.java | 10 +++++++++-
2 files changed, 13 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/86b00e65/qpid-jms-client/src/test/java/org/apache/qpid/jms/transports/netty/NettySslTransportTest.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/transports/netty/NettySslTransportTest.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/transports/netty/NettySslTransportTest.java
index a0f1ec0..d7f3db0 100644
--- a/qpid-jms-client/src/test/java/org/apache/qpid/jms/transports/netty/NettySslTransportTest.java
+++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/transports/netty/NettySslTransportTest.java
@@ -73,6 +73,7 @@ public class NettySslTransportTest extends NettyTcpTransportTest {
transport.close();
}
+ logTransportErrors();
assertTrue(exceptions.isEmpty());
}
@@ -97,6 +98,7 @@ public class NettySslTransportTest extends NettyTcpTransportTest {
transport.close();
}
+ logTransportErrors();
assertTrue(exceptions.isEmpty());
}
@@ -124,6 +126,7 @@ public class NettySslTransportTest extends NettyTcpTransportTest {
transport.close();
}
+ logTransportErrors();
assertTrue(exceptions.isEmpty());
}
@@ -151,6 +154,7 @@ public class NettySslTransportTest extends NettyTcpTransportTest {
transport.close();
}
+ logTransportErrors();
assertTrue(exceptions.isEmpty());
}
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/86b00e65/qpid-jms-client/src/test/java/org/apache/qpid/jms/transports/netty/NettyTcpTransportTest.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/transports/netty/NettyTcpTransportTest.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/transports/netty/NettyTcpTransportTest.java
index 8ea18bb..1bd57cc 100644
--- a/qpid-jms-client/src/test/java/org/apache/qpid/jms/transports/netty/NettyTcpTransportTest.java
+++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/transports/netty/NettyTcpTransportTest.java
@@ -474,6 +474,14 @@ public class NettyTcpTransportTest extends QpidJmsTestCase {
return TransportOptions.INSTANCE.clone();
}
+ protected void logTransportErrors() {
+ if (!exceptions.isEmpty()) {
+ for(Throwable ex : exceptions) {
+ LOG.info("Transport sent exception: {}", ex, ex);
+ }
+ }
+ }
+
private class NettyTransportListener implements TransportListener {
@Override
@@ -491,7 +499,7 @@ public class NettyTcpTransportTest extends QpidJmsTestCase {
@Override
public void onTransportError(Throwable cause) {
- LOG.debug("Transport error caught: {}", cause.getMessage(), cause);
+ LOG.info("Transport error caught: {}", cause.getMessage(), cause);
exceptions.add(cause);
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org
[2/4] qpid-jms git commit: Start of a test for FactoryFinder
Posted by ta...@apache.org.
Start of a test for FactoryFinder
Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/f36f04f7
Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/f36f04f7
Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/f36f04f7
Branch: refs/heads/master
Commit: f36f04f77f50c0228c600bf35807bc0338bfa60e
Parents: 86b00e6
Author: Timothy Bish <ta...@gmail.com>
Authored: Fri Jan 30 16:43:09 2015 -0500
Committer: Timothy Bish <ta...@gmail.com>
Committed: Fri Jan 30 16:43:09 2015 -0500
----------------------------------------------------------------------
.../apache/qpid/jms/util/FactoryFinderTest.java | 107 +++++++++++++++++++
1 file changed, 107 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/f36f04f7/qpid-jms-client/src/test/java/org/apache/qpid/jms/util/FactoryFinderTest.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/util/FactoryFinderTest.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/util/FactoryFinderTest.java
new file mode 100644
index 0000000..9dbbd3c
--- /dev/null
+++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/util/FactoryFinderTest.java
@@ -0,0 +1,107 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.qpid.jms.util;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNotSame;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Test basic functionality of class FactoryFinder
+ */
+public class FactoryFinderTest {
+
+ private static final Logger LOG = LoggerFactory.getLogger(FactoryFinderTest.class);
+
+ public static final String BASE_PATH = "/src/test/resources/factory/";
+
+ private String TEST_LOCATOR_PATH;
+
+ public interface TestFactory {
+ String create();
+ }
+
+ public class TestFactoryReturnsFOO implements TestFactory {
+
+ @Override
+ public String create() {
+ return "FOO";
+ }
+ }
+
+ public class TestFactoryReturnsBAR implements TestFactory {
+
+ @Override
+ public String create() {
+ return "BAR";
+ }
+ }
+
+ public class TestObjectFactory implements FactoryFinder.ObjectFactory {
+
+ @Override
+ public Object create(String path) throws IllegalAccessException, InstantiationException, IOException, ClassNotFoundException {
+ return null;
+ }
+ }
+
+ @Before
+ public void setUp() throws Exception {
+ TEST_LOCATOR_PATH = new File(".").getCanonicalPath() + BASE_PATH;
+ LOG.info("Test path is: {}", TEST_LOCATOR_PATH);
+ }
+
+ @Test
+ public void testFactoryFinderCreate() {
+ new FactoryFinder<TestFactory>(TestFactory.class, TEST_LOCATOR_PATH);
+ }
+
+ @Test
+ public void testGetObjectFactory() {
+ assertNotNull(FactoryFinder.getObjectFactory());
+ }
+
+ @Test
+ public void testSetObjectFactory() {
+ TestObjectFactory testFactory = new TestObjectFactory();
+ assertNotNull(FactoryFinder.getObjectFactory());
+ assertNotSame(testFactory, FactoryFinder.getObjectFactory());
+ FactoryFinder.ObjectFactory oldObjectFactory = FactoryFinder.getObjectFactory();
+ FactoryFinder.setObjectFactory(testFactory);
+ assertSame(testFactory, FactoryFinder.getObjectFactory());
+ FactoryFinder.setObjectFactory(oldObjectFactory);
+ }
+
+ @Test
+ public void testRegisterProviderFactory() throws Exception {
+ FactoryFinder<TestFactory> factory = new FactoryFinder<TestFactory>(TestFactory.class, TEST_LOCATOR_PATH);
+ factory.registerProviderFactory("bar", new TestFactoryReturnsBAR());
+
+ TestFactory barFactory = factory.newInstance("bar");
+ assertNotNull(barFactory);
+ assertTrue(barFactory instanceof TestFactoryReturnsBAR);
+ }
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org
[4/4] qpid-jms git commit: Reorg the tests a bit and cover all the
contract check for the various types,
fix issue with the createConsumer methods that take noLocal for Topic and
Queue session overrides.
Posted by ta...@apache.org.
Reorg the tests a bit and cover all the contract check for the various
types, fix issue with the createConsumer methods that take noLocal for
Topic and Queue session overrides.
Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/c136cb6f
Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/c136cb6f
Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/c136cb6f
Branch: refs/heads/master
Commit: c136cb6fe34121e92fa089c2aedabe914a9bf189
Parents: 1f2e6de
Author: Timothy Bish <ta...@gmail.com>
Authored: Fri Jan 30 18:31:08 2015 -0500
Committer: Timothy Bish <ta...@gmail.com>
Committed: Fri Jan 30 18:31:08 2015 -0500
----------------------------------------------------------------------
.../org/apache/qpid/jms/JmsQueueSession.java | 9 +-
.../org/apache/qpid/jms/JmsTopicSession.java | 17 +++
.../qpid/jms/JmsConnectionTestSupport.java | 8 ++
.../apache/qpid/jms/JmsQueueConnectionTest.java | 109 ++---------------
.../apache/qpid/jms/JmsTopicConnectionTest.java | 93 ++-------------
.../qpid/jms/session/JmsQueueSessionTest.java | 118 +++++++++++++++++++
.../qpid/jms/session/JmsTopicSessionTest.java | 111 +++++++++++++++++
7 files changed, 282 insertions(+), 183 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/c136cb6f/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsQueueSession.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsQueueSession.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsQueueSession.java
index 274c0a7..31c7553 100644
--- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsQueueSession.java
+++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsQueueSession.java
@@ -64,15 +64,18 @@ public class JmsQueueSession extends JmsSession {
/**
* @param destination
* @param messageSelector
- * @param NoLocal
+ * @param noLocal
* @return
* @throws JMSException
* @see javax.jms.Session#createConsumer(javax.jms.Destination,
* java.lang.String, boolean)
*/
@Override
- public MessageConsumer createConsumer(Destination destination, String messageSelector, boolean NoLocal) throws JMSException {
- throw new IllegalStateException("Operation not supported by a QueueSession");
+ public MessageConsumer createConsumer(Destination destination, String messageSelector, boolean noLocal) throws JMSException {
+ if (destination instanceof Topic) {
+ throw new IllegalStateException("Operation not supported by a QueueSession");
+ }
+ return super.createConsumer(destination, messageSelector, noLocal);
}
/**
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/c136cb6f/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsTopicSession.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsTopicSession.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsTopicSession.java
index ff834aa..2486822 100644
--- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsTopicSession.java
+++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsTopicSession.java
@@ -93,6 +93,23 @@ public class JmsTopicSession extends JmsSession {
/**
* @param destination
+ * @param messageSelector
+ * @param noLocal
+ * @return
+ * @throws JMSException
+ * @see javax.jms.Session#createConsumer(javax.jms.Destination,
+ * java.lang.String)
+ */
+ @Override
+ public MessageConsumer createConsumer(Destination destination, String messageSelector, boolean noLocal) throws JMSException {
+ if (destination instanceof Queue) {
+ throw new IllegalStateException("Operation not supported by a TopicSession");
+ }
+ return super.createConsumer(destination, messageSelector, noLocal);
+ }
+
+ /**
+ * @param destination
* @return
* @throws JMSException
* @see javax.jms.Session#createProducer(javax.jms.Destination)
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/c136cb6f/qpid-jms-client/src/test/java/org/apache/qpid/jms/JmsConnectionTestSupport.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/JmsConnectionTestSupport.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/JmsConnectionTestSupport.java
index 05e5d4f..1605067 100644
--- a/qpid-jms-client/src/test/java/org/apache/qpid/jms/JmsConnectionTestSupport.java
+++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/JmsConnectionTestSupport.java
@@ -47,6 +47,8 @@ public class JmsConnectionTestSupport extends QpidJmsTestCase {
private final IdGenerator clientIdGenerator = new IdGenerator();
protected JmsConnection connection;
+ protected JmsTopicConnection topicConnection;
+ protected JmsQueueConnection queueConnection;
protected ProviderListener providerListener;
private void createMockProvider() throws Exception {
@@ -153,5 +155,11 @@ public class JmsConnectionTestSupport extends QpidJmsTestCase {
if (connection != null) {
connection.close();
}
+ if (topicConnection != null) {
+ topicConnection.close();
+ }
+ if (queueConnection != null) {
+ queueConnection.close();
+ }
}
}
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/c136cb6f/qpid-jms-client/src/test/java/org/apache/qpid/jms/JmsQueueConnectionTest.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/JmsQueueConnectionTest.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/JmsQueueConnectionTest.java
index 71bc1be..64a2b08 100644
--- a/qpid-jms-client/src/test/java/org/apache/qpid/jms/JmsQueueConnectionTest.java
+++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/JmsQueueConnectionTest.java
@@ -18,135 +18,52 @@ package org.apache.qpid.jms;
import javax.jms.IllegalStateException;
import javax.jms.JMSException;
-import javax.jms.QueueSession;
import javax.jms.ServerSessionPool;
import javax.jms.Session;
-import org.apache.qpid.jms.meta.JmsResource;
-import org.apache.qpid.jms.provider.Provider;
-import org.apache.qpid.jms.provider.ProviderFuture;
-import org.apache.qpid.jms.util.IdGenerator;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
-import org.mockito.Mockito;
-import org.mockito.invocation.InvocationOnMock;
-import org.mockito.stubbing.Answer;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
/**
* Test various contract aspects of the QueueConnection implementation
*/
-public class JmsQueueConnectionTest {
-
- private static final Logger LOG = LoggerFactory.getLogger(JmsQueueConnectionTest.class);
-
- private final Provider provider = Mockito.mock(Provider.class);
- private final IdGenerator clientIdGenerator = new IdGenerator();
-
- private JmsQueueConnection queueConnection;
- private QueueSession queueSession;
- private final JmsTopic topic = new JmsTopic();
+public class JmsQueueConnectionTest extends JmsConnectionTestSupport {
+ @Override
@Before
public void setUp() throws Exception {
-
- Mockito.doAnswer(new Answer<Object>() {
- @Override
- public Object answer(InvocationOnMock invocation) throws Throwable {
- Object[] args = invocation.getArguments();
- LOG.trace("Handling provider create call for resource: {}", args[0]);
- ProviderFuture request = (ProviderFuture) args[1];
- request.onSuccess();
- return null;
- }
- }).when(provider).create(Mockito.any(JmsResource.class), Mockito.any(ProviderFuture.class));
-
- Mockito.doAnswer(new Answer<Object>() {
- @Override
- public Object answer(InvocationOnMock invocation) throws Throwable {
- Object[] args = invocation.getArguments();
- LOG.trace("Handling provider destroy call");
- ProviderFuture request = (ProviderFuture) args[1];
- request.onSuccess();
- return null;
- }
- }).when(provider).destroy(Mockito.any(JmsResource.class), Mockito.any(ProviderFuture.class));
-
- queueConnection = new JmsQueueConnection("ID:TEST:1", provider, clientIdGenerator);
+ super.setUp();
+ queueConnection = createQueueConnectionToMockProvider();
queueConnection.start();
-
- queueSession = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
}
+ @Override
@After
public void tearDown() throws Exception {
queueConnection.close();
}
- /**
- * Test that a call to <code>createDurableConnectionConsumer()</code> method
- * on a <code>QueueConnection</code> throws a
- * <code>javax.jms.IllegalStateException</code>.
- * (see JMS 1.1 specs, table 4-1).
- *
- * @since JMS 1.1
- */
@Test(timeout = 30000, expected=IllegalStateException.class)
- public void testCreateDurableConnectionConsumerOnQueueConnection() throws JMSException{
- queueConnection.createDurableConnectionConsumer(topic, "subscriptionName", "", (ServerSessionPool)null, 1);
+ public void testCreateConnectionConsumerOnQueueConnection() throws JMSException{
+ queueConnection.createConnectionConsumer(new JmsTopic(), "subscriptionName", (ServerSessionPool)null, 1);
}
- /**
- * Test that a call to <code>createDurableSubscriber()</code> method
- * on a <code>QueueSession</code> throws a
- * <code>javax.jms.IllegalStateException</code>.
- * (see JMS 1.1 specs, table 4-1).
- *
- * @since JMS 1.1
- */
@Test(timeout = 30000, expected=IllegalStateException.class)
- public void testCreateDurableSubscriberOnQueueSession() throws JMSException {
- queueSession.createDurableSubscriber(topic, "subscriptionName");
+ public void testCreateTopicSessionOnTopicConnection() throws JMSException{
+ queueConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
}
/**
- * Test that a call to <code>createTemporaryTopic()</code> method
- * on a <code>QueueSession</code> throws a
- * <code>javax.jms.IllegalStateException</code>.
- * (see JMS 1.1 specs, table 4-1).
- *
- * @since JMS 1.1
- */
- @Test(timeout = 30000, expected=IllegalStateException.class)
- public void testCreateTemporaryTopicOnQueueSession() throws JMSException {
- queueSession.createTemporaryTopic();
- }
-
- /**
- * Test that a call to <code>createTopic()</code> method
- * on a <code>QueueSession</code> throws a
- * <code>javax.jms.IllegalStateException</code>.
- * (see JMS 1.1 specs, table 4-1).
- *
- * @since JMS 1.1
- */
- @Test(timeout = 30000, expected=IllegalStateException.class)
- public void testCreateTopicOnQueueSession() throws JMSException {
- queueSession.createTopic("test-topic");
- }
-
- /**
- * Test that a call to <code>unsubscribe()</code> method
- * on a <code>QueueSession</code> throws a
+ * Test that a call to <code>createDurableConnectionConsumer()</code> method
+ * on a <code>QueueConnection</code> throws a
* <code>javax.jms.IllegalStateException</code>.
* (see JMS 1.1 specs, table 4-1).
*
* @since JMS 1.1
*/
@Test(timeout = 30000, expected=IllegalStateException.class)
- public void testUnsubscribeOnQueueSession() throws JMSException {
- queueSession.unsubscribe("subscriptionName");
+ public void testCreateDurableConnectionConsumerOnQueueConnection() throws JMSException{
+ queueConnection.createDurableConnectionConsumer(new JmsTopic(), "subscriptionName", "", (ServerSessionPool)null, 1);
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/c136cb6f/qpid-jms-client/src/test/java/org/apache/qpid/jms/JmsTopicConnectionTest.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/JmsTopicConnectionTest.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/JmsTopicConnectionTest.java
index 7eabde5..1184733 100644
--- a/qpid-jms-client/src/test/java/org/apache/qpid/jms/JmsTopicConnectionTest.java
+++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/JmsTopicConnectionTest.java
@@ -18,108 +18,33 @@ package org.apache.qpid.jms;
import javax.jms.IllegalStateException;
import javax.jms.JMSException;
+import javax.jms.ServerSessionPool;
import javax.jms.Session;
-import javax.jms.TopicSession;
-import org.apache.qpid.jms.meta.JmsResource;
-import org.apache.qpid.jms.provider.Provider;
-import org.apache.qpid.jms.provider.ProviderFuture;
-import org.apache.qpid.jms.util.IdGenerator;
-import org.junit.After;
import org.junit.Before;
import org.junit.Test;
-import org.mockito.Mockito;
-import org.mockito.invocation.InvocationOnMock;
-import org.mockito.stubbing.Answer;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
/**
* Test various contract aspects of the TopicConnection implementation
*/
-public class JmsTopicConnectionTest {
-
- private static final Logger LOG = LoggerFactory.getLogger(JmsTopicConnectionTest.class);
-
- private final Provider provider = Mockito.mock(Provider.class);
- private final IdGenerator clientIdGenerator = new IdGenerator();
-
- private JmsTopicConnection topicConnection;
- private TopicSession topicSession;
- private final JmsQueue queue = new JmsQueue();
+public class JmsTopicConnectionTest extends JmsConnectionTestSupport {
+ @Override
@Before
public void setUp() throws Exception {
+ super.setUp();
- Mockito.doAnswer(new Answer<Object>() {
- @Override
- public Object answer(InvocationOnMock invocation) throws Throwable {
- Object[] args = invocation.getArguments();
- LOG.trace("Handling provider create call for resource: {}", args[0]);
- ProviderFuture request = (ProviderFuture) args[1];
- request.onSuccess();
- return null;
- }
- }).when(provider).create(Mockito.any(JmsResource.class), Mockito.any(ProviderFuture.class));
-
- Mockito.doAnswer(new Answer<Object>() {
- @Override
- public Object answer(InvocationOnMock invocation) throws Throwable {
- Object[] args = invocation.getArguments();
- LOG.trace("Handling provider destroy call");
- ProviderFuture request = (ProviderFuture) args[1];
- request.onSuccess();
- return null;
- }
- }).when(provider).destroy(Mockito.any(JmsResource.class), Mockito.any(ProviderFuture.class));
-
- topicConnection = new JmsTopicConnection("ID:TEST:1", provider, clientIdGenerator);
+ topicConnection = createTopicConnectionToMockProvider();
topicConnection.start();
-
- topicSession = topicConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
- }
-
- @After
- public void tearDown() throws Exception {
- topicConnection.close();
- }
-
- /**
- * Test that a call to <code>createBrowser()</code> method
- * on a <code>TopicSession</code> throws a
- * <code>javax.jms.IllegalStateException</code>.
- * (see JMS 1.1 specs, table 4-1).
- *
- * @since JMS 1.1
- */
- @Test(timeout = 30000, expected=IllegalStateException.class)
- public void testCreateBrowserOnTopicSession() throws JMSException {
- topicSession.createBrowser(queue);
}
- /**
- * Test that a call to <code>createQueue()</code> method
- * on a <code>TopicSession</code> throws a
- * <code>javax.jms.IllegalStateException</code>.
- * (see JMS 1.1 specs, table 4-1).
- *
- * @since JMS 1.1
- */
@Test(timeout = 30000, expected=IllegalStateException.class)
- public void testCreateQueueOnTopicSession() throws JMSException {
- topicSession.createQueue("test-queue");
+ public void testCreateConnectionConsumerOnTopicConnection() throws JMSException{
+ topicConnection.createConnectionConsumer(new JmsQueue(), "subscriptionName", (ServerSessionPool)null, 1);
}
- /**
- * Test that a call to <code>createTemporaryQueue()</code> method
- * on a <code>TopicSession</code> throws a
- * <code>javax.jms.IllegalStateException</code>.
- * (see JMS 1.1 specs, table 4-1).
- *
- * @since JMS 1.1
- */
@Test(timeout = 30000, expected=IllegalStateException.class)
- public void testCreateTemporaryQueueOnTopicSession() throws JMSException {
- topicSession.createTemporaryQueue();
+ public void testCreateQueueSessionOnTopicConnection() throws JMSException{
+ topicConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/c136cb6f/qpid-jms-client/src/test/java/org/apache/qpid/jms/session/JmsQueueSessionTest.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/session/JmsQueueSessionTest.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/session/JmsQueueSessionTest.java
new file mode 100644
index 0000000..f71b475
--- /dev/null
+++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/session/JmsQueueSessionTest.java
@@ -0,0 +1,118 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.qpid.jms.session;
+
+import javax.jms.IllegalStateException;
+import javax.jms.JMSException;
+import javax.jms.QueueSession;
+import javax.jms.Session;
+
+import org.apache.qpid.jms.JmsConnectionTestSupport;
+import org.apache.qpid.jms.JmsTopic;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Test the contract of JmsQueueSession against JMS Spec requirements.
+ */
+public class JmsQueueSessionTest extends JmsConnectionTestSupport {
+
+ private QueueSession queueSession;
+ private final JmsTopic topic = new JmsTopic();
+
+ @Override
+ @Before
+ public void setUp() throws Exception {
+ super.setUp();
+ queueConnection = createQueueConnectionToMockProvider();
+ queueConnection.start();
+
+ queueSession = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
+ }
+
+ @Test(timeout = 30000, expected=IllegalStateException.class)
+ public void testCreateConsumerTopicSession() throws JMSException {
+ queueSession.createConsumer(topic);
+ }
+
+ @Test(timeout = 30000, expected=IllegalStateException.class)
+ public void testCreateConsumerWithSelectorTopicSession() throws JMSException {
+ queueSession.createConsumer(topic, "color = red");
+ }
+
+ @Test(timeout = 30000, expected=IllegalStateException.class)
+ public void testCreateConsumerWithSelectorNoLocalTopicSession() throws JMSException {
+ queueSession.createConsumer(topic, "color = red", false);
+ }
+
+ @Test(timeout = 30000, expected=IllegalStateException.class)
+ public void testCreateProducerTopicSession() throws JMSException {
+ queueSession.createProducer(topic);
+ }
+
+ /**
+ * Test that a call to <code>createDurableSubscriber()</code> method
+ * on a <code>QueueSession</code> throws a
+ * <code>javax.jms.IllegalStateException</code>.
+ * (see JMS 1.1 specs, table 4-1).
+ *
+ * @since JMS 1.1
+ */
+ @Test(timeout = 30000, expected=IllegalStateException.class)
+ public void testCreateDurableSubscriberOnQueueSession() throws JMSException {
+ queueSession.createDurableSubscriber(topic, "subscriptionName");
+ }
+
+ /**
+ * Test that a call to <code>createTemporaryTopic()</code> method
+ * on a <code>QueueSession</code> throws a
+ * <code>javax.jms.IllegalStateException</code>.
+ * (see JMS 1.1 specs, table 4-1).
+ *
+ * @since JMS 1.1
+ */
+ @Test(timeout = 30000, expected=IllegalStateException.class)
+ public void testCreateTemporaryTopicOnQueueSession() throws JMSException {
+ queueSession.createTemporaryTopic();
+ }
+
+ /**
+ * Test that a call to <code>createTopic()</code> method
+ * on a <code>QueueSession</code> throws a
+ * <code>javax.jms.IllegalStateException</code>.
+ * (see JMS 1.1 specs, table 4-1).
+ *
+ * @since JMS 1.1
+ */
+ @Test(timeout = 30000, expected=IllegalStateException.class)
+ public void testCreateTopicOnQueueSession() throws JMSException {
+ queueSession.createTopic("test-topic");
+ }
+
+ /**
+ * Test that a call to <code>unsubscribe()</code> method
+ * on a <code>QueueSession</code> throws a
+ * <code>javax.jms.IllegalStateException</code>.
+ * (see JMS 1.1 specs, table 4-1).
+ *
+ * @since JMS 1.1
+ */
+ @Test(timeout = 30000, expected=IllegalStateException.class)
+ public void testUnsubscribeOnQueueSession() throws JMSException {
+ queueSession.unsubscribe("subscriptionName");
+ }
+}
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/c136cb6f/qpid-jms-client/src/test/java/org/apache/qpid/jms/session/JmsTopicSessionTest.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/session/JmsTopicSessionTest.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/session/JmsTopicSessionTest.java
new file mode 100644
index 0000000..2937718
--- /dev/null
+++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/session/JmsTopicSessionTest.java
@@ -0,0 +1,111 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.qpid.jms.session;
+
+import javax.jms.IllegalStateException;
+import javax.jms.JMSException;
+import javax.jms.Session;
+import javax.jms.TopicSession;
+
+import org.apache.qpid.jms.JmsConnectionTestSupport;
+import org.apache.qpid.jms.JmsQueue;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Test the contract of JmsTopicSession against JMS Spec requirements.
+ */
+public class JmsTopicSessionTest extends JmsConnectionTestSupport {
+
+ private TopicSession topicSession;
+ private final JmsQueue queue = new JmsQueue();
+
+ @Override
+ @Before
+ public void setUp() throws Exception {
+ super.setUp();
+
+ topicConnection = createTopicConnectionToMockProvider();
+ topicConnection.start();
+
+ topicSession = topicConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
+ }
+
+ /**
+ * Test that a call to <code>createBrowser()</code> method
+ * on a <code>TopicSession</code> throws a
+ * <code>javax.jms.IllegalStateException</code>.
+ * (see JMS 1.1 specs, table 4-1).
+ *
+ * @since JMS 1.1
+ */
+ @Test(timeout = 30000, expected=IllegalStateException.class)
+ public void testCreateBrowserOnTopicSession() throws JMSException {
+ topicSession.createBrowser(queue);
+ }
+
+ @Test(timeout = 30000, expected=IllegalStateException.class)
+ public void testCreateBrowserWithSelectorOnTopicSession() throws JMSException {
+ topicSession.createBrowser(queue, "color = red");
+ }
+
+ @Test(timeout = 30000, expected=IllegalStateException.class)
+ public void testCreateConsumerTopicSession() throws JMSException {
+ topicSession.createConsumer(queue);
+ }
+
+ @Test(timeout = 30000, expected=IllegalStateException.class)
+ public void testCreateConsumerWithSelectorTopicSession() throws JMSException {
+ topicSession.createConsumer(queue, "color = red");
+ }
+
+ @Test(timeout = 30000, expected=IllegalStateException.class)
+ public void testCreateConsumerWithSelectorNoLocalTopicSession() throws JMSException {
+ topicSession.createConsumer(queue, "color = red", false);
+ }
+
+ @Test(timeout = 30000, expected=IllegalStateException.class)
+ public void testCreateProducerTopicSession() throws JMSException {
+ topicSession.createProducer(queue);
+ }
+
+ /**
+ * Test that a call to <code>createQueue()</code> method
+ * on a <code>TopicSession</code> throws a
+ * <code>javax.jms.IllegalStateException</code>.
+ * (see JMS 1.1 specs, table 4-1).
+ *
+ * @since JMS 1.1
+ */
+ @Test(timeout = 30000, expected=IllegalStateException.class)
+ public void testCreateQueueOnTopicSession() throws JMSException {
+ topicSession.createQueue("test-queue");
+ }
+
+ /**
+ * Test that a call to <code>createTemporaryQueue()</code> method
+ * on a <code>TopicSession</code> throws a
+ * <code>javax.jms.IllegalStateException</code>.
+ * (see JMS 1.1 specs, table 4-1).
+ *
+ * @since JMS 1.1
+ */
+ @Test(timeout = 30000, expected=IllegalStateException.class)
+ public void testCreateTemporaryQueueOnTopicSession() throws JMSException {
+ topicSession.createTemporaryQueue();
+ }
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org
[3/4] qpid-jms git commit: Add some more contract validation tests
for JMS spec.
Posted by ta...@apache.org.
Add some more contract validation tests for JMS spec.
Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/1f2e6de8
Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/1f2e6de8
Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/1f2e6de8
Branch: refs/heads/master
Commit: 1f2e6de8da0f5606013d6ad6d9a69704266c2aa4
Parents: f36f04f
Author: Timothy Bish <ta...@gmail.com>
Authored: Fri Jan 30 17:48:05 2015 -0500
Committer: Timothy Bish <ta...@gmail.com>
Committed: Fri Jan 30 17:48:05 2015 -0500
----------------------------------------------------------------------
.../qpid/jms/JmsConnectionTestSupport.java | 23 ++++
.../qpid/jms/session/JmsSessionClosedTest.java | 2 +-
.../apache/qpid/jms/session/JmsSessionTest.java | 112 +++++++++++++++++++
.../jms/session/JmsTopicSessionClosedTest.java | 29 ++++-
4 files changed, 163 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/1f2e6de8/qpid-jms-client/src/test/java/org/apache/qpid/jms/JmsConnectionTestSupport.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/JmsConnectionTestSupport.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/JmsConnectionTestSupport.java
index 7f40329..05e5d4f 100644
--- a/qpid-jms-client/src/test/java/org/apache/qpid/jms/JmsConnectionTestSupport.java
+++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/JmsConnectionTestSupport.java
@@ -21,6 +21,7 @@ import java.net.URI;
import org.apache.qpid.jms.message.facade.defaults.JmsDefaultMessageFactory;
import org.apache.qpid.jms.meta.JmsConnectionInfo;
import org.apache.qpid.jms.meta.JmsResource;
+import org.apache.qpid.jms.meta.JmsSessionId;
import org.apache.qpid.jms.provider.Provider;
import org.apache.qpid.jms.provider.ProviderFuture;
import org.apache.qpid.jms.provider.ProviderListener;
@@ -80,6 +81,28 @@ public class JmsConnectionTestSupport extends QpidJmsTestCase {
@Override
public Object answer(InvocationOnMock invocation) throws Throwable {
Object[] args = invocation.getArguments();
+ LOG.trace("Handling provider recover: {}", args[0]);
+ ProviderFuture request = (ProviderFuture) args[1];
+ request.onSuccess();
+ return null;
+ }
+ }).when(provider).recover(Mockito.any(JmsSessionId.class), Mockito.any(ProviderFuture.class));
+
+ Mockito.doAnswer(new Answer<Object>() {
+ @Override
+ public Object answer(InvocationOnMock invocation) throws Throwable {
+ Object[] args = invocation.getArguments();
+ LOG.trace("Handling provider session acknowledge: {}", args[0]);
+ ProviderFuture request = (ProviderFuture) args[1];
+ request.onSuccess();
+ return null;
+ }
+ }).when(provider).acknowledge(Mockito.any(JmsSessionId.class), Mockito.any(ProviderFuture.class));
+
+ Mockito.doAnswer(new Answer<Object>() {
+ @Override
+ public Object answer(InvocationOnMock invocation) throws Throwable {
+ Object[] args = invocation.getArguments();
if (args[0] instanceof JmsResource) {
LOG.trace("Handling provider destroy resource: {}", args[0]);
ProviderFuture request = (ProviderFuture) args[1];
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/1f2e6de8/qpid-jms-client/src/test/java/org/apache/qpid/jms/session/JmsSessionClosedTest.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/session/JmsSessionClosedTest.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/session/JmsSessionClosedTest.java
index ec1d962..6834179 100644
--- a/qpid-jms-client/src/test/java/org/apache/qpid/jms/session/JmsSessionClosedTest.java
+++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/session/JmsSessionClosedTest.java
@@ -31,7 +31,7 @@ import org.junit.Before;
import org.junit.Test;
/**
- * Tests behaviour after a Session is closed.
+ * Tests behavior after a Session is closed.
*/
public class JmsSessionClosedTest extends JmsConnectionTestSupport {
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/1f2e6de8/qpid-jms-client/src/test/java/org/apache/qpid/jms/session/JmsSessionTest.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/session/JmsSessionTest.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/session/JmsSessionTest.java
new file mode 100644
index 0000000..7867474
--- /dev/null
+++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/session/JmsSessionTest.java
@@ -0,0 +1,112 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.qpid.jms.session;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import javax.jms.IllegalStateException;
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.MessageListener;
+import javax.jms.Session;
+
+import org.apache.qpid.jms.JmsConnectionTestSupport;
+import org.apache.qpid.jms.JmsSession;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Test basic contracts of the JmsSession class using a mocked connection.
+ */
+public class JmsSessionTest extends JmsConnectionTestSupport {
+
+ @Override
+ @Before
+ public void setUp() throws Exception {
+ super.setUp();
+ connection = createConnectionToMockProvider();
+ }
+
+ @Test(timeout = 10000)
+ public void testGetMessageListener() throws JMSException {
+ JmsSession session = (JmsSession) connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ assertNull(session.getMessageListener());
+ session.setMessageListener(new MessageListener() {
+
+ @Override
+ public void onMessage(Message message) {
+ }
+ });
+ assertNotNull(session.getMessageListener());
+ }
+
+ @Test(timeout = 10000)
+ public void testGetAcknowledgementMode() throws JMSException {
+ JmsSession session = (JmsSession) connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ assertEquals(Session.AUTO_ACKNOWLEDGE, session.getAcknowledgeMode());
+ session = (JmsSession) connection.createSession(false, Session.CLIENT_ACKNOWLEDGE);
+ assertEquals(Session.CLIENT_ACKNOWLEDGE, session.getAcknowledgeMode());
+ session = (JmsSession) connection.createSession(false, Session.DUPS_OK_ACKNOWLEDGE);
+ assertEquals(Session.DUPS_OK_ACKNOWLEDGE, session.getAcknowledgeMode());
+ session = (JmsSession) connection.createSession(true, Session.SESSION_TRANSACTED);
+ assertEquals(Session.SESSION_TRANSACTED, session.getAcknowledgeMode());
+ }
+
+ @Test(timeout = 10000)
+ public void testIsAutoAcknowledge() throws JMSException {
+ JmsSession session = (JmsSession) connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ assertTrue(session.isAutoAcknowledge());
+ assertFalse(session.isDupsOkAcknowledge());
+ }
+
+ @Test(timeout = 10000)
+ public void testIsDupsOkAcknowledge() throws JMSException {
+ JmsSession session = (JmsSession) connection.createSession(false, Session.DUPS_OK_ACKNOWLEDGE);
+ assertFalse(session.isAutoAcknowledge());
+ assertTrue(session.isDupsOkAcknowledge());
+ }
+
+ @Test(timeout = 10000)
+ public void testIsTransacted() throws JMSException {
+ JmsSession session = (JmsSession) connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ assertFalse(session.isTransacted());
+ session = (JmsSession) connection.createSession(true, Session.SESSION_TRANSACTED);
+ assertTrue(session.isTransacted());
+ }
+
+ @Test(timeout = 10000, expected=IllegalStateException.class)
+ public void testRecoverThrowsForTxSession() throws JMSException {
+ JmsSession session = (JmsSession) connection.createSession(true, Session.SESSION_TRANSACTED);
+ session.recover();
+ }
+
+ @Test(timeout = 10000, expected=JMSException.class)
+ public void testRollbackThrowsOnNonTxSession() throws JMSException {
+ JmsSession session = (JmsSession) connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ session.rollback();
+ }
+
+ @Test(timeout = 10000, expected=JMSException.class)
+ public void testCommitThrowsOnNonTxSession() throws JMSException {
+ JmsSession session = (JmsSession) connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ session.commit();
+ }
+}
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/1f2e6de8/qpid-jms-client/src/test/java/org/apache/qpid/jms/session/JmsTopicSessionClosedTest.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/session/JmsTopicSessionClosedTest.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/session/JmsTopicSessionClosedTest.java
index e47b532..58a3da3 100644
--- a/qpid-jms-client/src/test/java/org/apache/qpid/jms/session/JmsTopicSessionClosedTest.java
+++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/session/JmsTopicSessionClosedTest.java
@@ -35,12 +35,13 @@ public class JmsTopicSessionClosedTest extends JmsConnectionTestSupport {
private TopicSession session;
private TopicPublisher publisher;
private TopicSubscriber subscriber;
+ private Topic destination;
protected void createTestResources() throws Exception {
connection = createTopicConnectionToMockProvider();
session = ((TopicConnection) connection).createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
- Topic destination = session.createTopic(_testName.getMethodName());
+ destination = session.createTopic(_testName.getMethodName());
publisher = session.createPublisher(destination);
subscriber = session.createSubscriber(destination);
@@ -58,10 +59,34 @@ public class JmsTopicSessionClosedTest extends JmsConnectionTestSupport {
@Test(timeout=30000)
public void testSessionCloseAgain() throws Exception {
- // Close it again
session.close();
}
+ @Test(timeout=30000, expected=javax.jms.IllegalStateException.class)
+ public void testCreatePublisher() throws Exception {
+ session.createPublisher(destination);
+ }
+
+ @Test(timeout=30000, expected=javax.jms.IllegalStateException.class)
+ public void testCreateSubscriber() throws Exception {
+ session.createSubscriber(destination);
+ }
+
+ @Test(timeout=30000, expected=javax.jms.IllegalStateException.class)
+ public void testCreateSubscriberWithSelector() throws Exception {
+ session.createSubscriber(destination, "color = blue", false);
+ }
+
+ @Test(timeout=30000, expected=javax.jms.IllegalStateException.class)
+ public void testCreateDurableSubscriber() throws Exception {
+ session.createDurableSubscriber(destination, "foo");
+ }
+
+ @Test(timeout=30000, expected=javax.jms.IllegalStateException.class)
+ public void testCreateDurableSubscriberWithSelector() throws Exception {
+ session.createDurableSubscriber(destination, "foo", "color = blue", false);
+ }
+
@Test(timeout=30000)
public void testSubscriberCloseAgain() throws Exception {
// Close it again (closing the session should have closed it already).
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org