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/15 23:56:35 UTC
[5/5] qpid-jms git commit: Refactor some tests such that a hang on
connection open still allows the tests to timeout.
Refactor some tests such that a hang on connection open still allows the
tests to timeout.
Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/44eda7db
Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/44eda7db
Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/44eda7db
Branch: refs/heads/master
Commit: 44eda7db270a1eb785ac9b64fb11e4393f7db472
Parents: 8ba0199
Author: Timothy Bish <ta...@gmail.com>
Authored: Thu Jan 15 17:56:24 2015 -0500
Committer: Timothy Bish <ta...@gmail.com>
Committed: Thu Jan 15 17:56:24 2015 -0500
----------------------------------------------------------------------
.../qpid/jms/JmsConnectionClosedTest.java | 36 +++++++++++---------
.../apache/qpid/jms/JmsSessionClosedTest.java | 9 -----
.../qpid/jms/session/JmsSessionClosedTest.java | 13 +++----
3 files changed, 25 insertions(+), 33 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/44eda7db/qpid-jms-interop-tests/qpid-jms-activemq-tests/src/test/java/org/apache/qpid/jms/JmsConnectionClosedTest.java
----------------------------------------------------------------------
diff --git a/qpid-jms-interop-tests/qpid-jms-activemq-tests/src/test/java/org/apache/qpid/jms/JmsConnectionClosedTest.java b/qpid-jms-interop-tests/qpid-jms-activemq-tests/src/test/java/org/apache/qpid/jms/JmsConnectionClosedTest.java
index 773deeb..f5d2892 100644
--- a/qpid-jms-interop-tests/qpid-jms-activemq-tests/src/test/java/org/apache/qpid/jms/JmsConnectionClosedTest.java
+++ b/qpid-jms-interop-tests/qpid-jms-activemq-tests/src/test/java/org/apache/qpid/jms/JmsConnectionClosedTest.java
@@ -41,34 +41,33 @@ public class JmsConnectionClosedTest extends AmqpTestSupport {
return connection;
}
- @Override
- public void setUp() throws Exception {
- super.setUp();
- createConnection();
- }
-
@Test(timeout=30000, expected=JMSException.class)
- public void testGetClientIdFails() throws JMSException {
+ public void testGetClientIdFails() throws Exception {
+ createConnection();
connection.getClientID();
}
@Test(timeout=30000, expected=JMSException.class)
- public void testSetClientIdFails() throws JMSException {
+ public void testSetClientIdFails() throws Exception {
+ createConnection();
connection.setClientID("test");
}
@Test(timeout=30000, expected=JMSException.class)
- public void testGetMetaData() throws JMSException {
+ public void testGetMetaData() throws Exception {
+ createConnection();
connection.getMetaData();
}
@Test(timeout=30000, expected=JMSException.class)
- public void testGetExceptionListener() throws JMSException {
+ public void testGetExceptionListener() throws Exception {
+ createConnection();
connection.getExceptionListener();
}
@Test(timeout=30000, expected=JMSException.class)
- public void testSetExceptionListener() throws JMSException {
+ public void testSetExceptionListener() throws Exception {
+ createConnection();
connection.setExceptionListener(new ExceptionListener() {
@Override
public void onException(JMSException exception) {
@@ -77,27 +76,32 @@ public class JmsConnectionClosedTest extends AmqpTestSupport {
}
@Test(timeout=30000, expected=JMSException.class)
- public void testStartFails() throws JMSException {
+ public void testStartFails() throws Exception {
+ createConnection();
connection.start();
}
@Test(timeout=30000, expected=JMSException.class)
- public void testStopFails() throws JMSException {
+ public void testStopFails() throws Exception {
+ createConnection();
connection.stop();
}
@Test(timeout=30000)
- public void testClose() throws JMSException {
+ public void testClose() throws Exception {
+ createConnection();
connection.close();
}
@Test(timeout=30000, expected=JMSException.class)
- public void testCreateConnectionConsumerFails() throws JMSException {
+ public void testCreateConnectionConsumerFails() throws Exception {
+ createConnection();
connection.createConnectionConsumer(destination, "", null, 1);
}
@Test(timeout=30000, expected=JMSException.class)
- public void testCreateDurableConnectionConsumerFails() throws JMSException {
+ public void testCreateDurableConnectionConsumerFails() throws Exception {
+ createConnection();
connection.createDurableConnectionConsumer((Topic) destination, "id", "", null, 1);
}
}
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/44eda7db/qpid-jms-interop-tests/qpid-jms-activemq-tests/src/test/java/org/apache/qpid/jms/JmsSessionClosedTest.java
----------------------------------------------------------------------
diff --git a/qpid-jms-interop-tests/qpid-jms-activemq-tests/src/test/java/org/apache/qpid/jms/JmsSessionClosedTest.java b/qpid-jms-interop-tests/qpid-jms-activemq-tests/src/test/java/org/apache/qpid/jms/JmsSessionClosedTest.java
index efb3df3..b1237a1 100644
--- a/qpid-jms-interop-tests/qpid-jms-activemq-tests/src/test/java/org/apache/qpid/jms/JmsSessionClosedTest.java
+++ b/qpid-jms-interop-tests/qpid-jms-activemq-tests/src/test/java/org/apache/qpid/jms/JmsSessionClosedTest.java
@@ -16,7 +16,6 @@
*/
package org.apache.qpid.jms;
-import javax.jms.Connection;
import javax.jms.Destination;
import javax.jms.JMSException;
import javax.jms.Message;
@@ -33,8 +32,6 @@ import org.junit.Test;
*/
public class JmsSessionClosedTest extends AmqpTestSupport {
- protected Connection connection;
-
protected Session createSession() throws Exception {
connection = createAmqpConnection();
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
@@ -42,12 +39,6 @@ public class JmsSessionClosedTest extends AmqpTestSupport {
return session;
}
- @Override
- public void tearDown() throws Exception {
- connection.close();
- super.tearDown();
- }
-
@Test(timeout=30000, expected=JMSException.class)
public void testCreateMessageFails() throws Exception {
Session session = createSession();
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/44eda7db/qpid-jms-interop-tests/qpid-jms-activemq-tests/src/test/java/org/apache/qpid/jms/session/JmsSessionClosedTest.java
----------------------------------------------------------------------
diff --git a/qpid-jms-interop-tests/qpid-jms-activemq-tests/src/test/java/org/apache/qpid/jms/session/JmsSessionClosedTest.java b/qpid-jms-interop-tests/qpid-jms-activemq-tests/src/test/java/org/apache/qpid/jms/session/JmsSessionClosedTest.java
index 1d40e41..7d3527f 100644
--- a/qpid-jms-interop-tests/qpid-jms-activemq-tests/src/test/java/org/apache/qpid/jms/session/JmsSessionClosedTest.java
+++ b/qpid-jms-interop-tests/qpid-jms-activemq-tests/src/test/java/org/apache/qpid/jms/session/JmsSessionClosedTest.java
@@ -23,7 +23,6 @@ import javax.jms.Session;
import org.apache.qpid.jms.JmsConnectionFactory;
import org.apache.qpid.jms.support.AmqpTestSupport;
-import org.junit.Before;
import org.junit.Test;
/**
@@ -49,38 +48,36 @@ public class JmsSessionClosedTest extends AmqpTestSupport {
session.close();
}
- @Before
- @Override
- public void setUp() throws Exception {
- super.setUp();
- createAndCloseSession();
- }
-
@Test(timeout=30000)
public void testSessionCloseAgain() throws Exception {
+ createAndCloseSession();
// Close it again
session.close();
}
@Test(timeout=30000)
public void testConsumerCloseAgain() throws Exception {
+ createAndCloseSession();
// Close it again (closing the session should have closed it already).
receiver.close();
}
@Test(timeout=30000)
public void testProducerCloseAgain() throws Exception {
+ createAndCloseSession();
// Close it again (closing the session should have closed it already).
sender.close();
}
@Test(timeout=30000, expected=javax.jms.IllegalStateException.class)
public void testConsumerGetMessageListenerFails() throws Exception {
+ createAndCloseSession();
receiver.getMessageListener();
}
@Test(timeout=30000, expected=javax.jms.IllegalStateException.class)
public void testProducerGetDestinationFails() throws Exception {
+ createAndCloseSession();
sender.getDestination();
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org