Repository: qpid-jms
Updated Branches:
  refs/heads/master 96b21b85a -> 5e219b819


Move a few more tests to brokerless client tests. 

Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/5e219b81
Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/5e219b81
Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/5e219b81

Branch: refs/heads/master
Commit: 5e219b819e359e248859bff6b77a8461f2106028
Parents: 96b21b8
Author: Timothy Bish <[email protected]>
Authored: Thu Jan 29 18:45:20 2015 -0500
Committer: Timothy Bish <[email protected]>
Committed: Thu Jan 29 18:45:20 2015 -0500

----------------------------------------------------------------------
 .../qpid/jms/JmsConnectionTestSupport.java      | 23 +++++-
 .../jms/session/JmsQueueSessionClosedTest.java  | 86 ++++++++++++++++++++
 .../jms/session/JmsTopicSessionClosedTest.java  | 86 ++++++++++++++++++++
 .../jms/session/JmsQueueSessionClosedTest.java  | 85 -------------------
 .../jms/session/JmsTopicSessionClosedTest.java  | 85 -------------------
 5 files changed, 191 insertions(+), 174 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/5e219b81/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 0f93bc1..7f40329 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
@@ -27,6 +27,7 @@ import org.apache.qpid.jms.provider.ProviderListener;
 import org.apache.qpid.jms.test.QpidJmsTestCase;
 import org.apache.qpid.jms.util.IdGenerator;
 import org.junit.After;
+import org.junit.Before;
 import org.mockito.Mockito;
 import org.mockito.invocation.InvocationOnMock;
 import org.mockito.stubbing.Answer;
@@ -47,8 +48,7 @@ public class JmsConnectionTestSupport extends QpidJmsTestCase 
{
     protected JmsConnection connection;
     protected ProviderListener providerListener;
 
-    protected JmsConnection createConnectionToMockProvider() throws Exception {
-
+    private void createMockProvider() throws Exception {
         Mockito.doAnswer(new Answer<Object>() {
             @Override
             public Object answer(InvocationOnMock invocation) throws Throwable 
{
@@ -102,10 +102,25 @@ public class JmsConnectionTestSupport extends 
QpidJmsTestCase {
 
         
Mockito.when(provider.getProviderListener()).thenReturn(providerListener);
         Mockito.when(provider.getMessageFactory()).thenReturn(new 
JmsDefaultMessageFactory());
+    }
+
+    protected JmsConnection createConnectionToMockProvider() throws Exception {
+        return new JmsConnection("ID:TEST:1", provider, clientIdGenerator);
+    }
 
-        JmsConnection connection = new JmsConnection("ID:TEST:1", provider, 
clientIdGenerator);
+    protected JmsQueueConnection createQueueConnectionToMockProvider() throws 
Exception {
+        return new JmsQueueConnection("ID:TEST:1", provider, 
clientIdGenerator);
+    }
 
-        return connection;
+    protected JmsTopicConnection createTopicConnectionToMockProvider() throws 
Exception {
+        return new JmsTopicConnection("ID:TEST:1", provider, 
clientIdGenerator);
+    }
+
+    @Override
+    @Before
+    public void setUp() throws Exception {
+        super.setUp();
+        createMockProvider();
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/5e219b81/qpid-jms-client/src/test/java/org/apache/qpid/jms/session/JmsQueueSessionClosedTest.java
----------------------------------------------------------------------
diff --git 
a/qpid-jms-client/src/test/java/org/apache/qpid/jms/session/JmsQueueSessionClosedTest.java
 
b/qpid-jms-client/src/test/java/org/apache/qpid/jms/session/JmsQueueSessionClosedTest.java
new file mode 100644
index 0000000..93ca154
--- /dev/null
+++ 
b/qpid-jms-client/src/test/java/org/apache/qpid/jms/session/JmsQueueSessionClosedTest.java
@@ -0,0 +1,86 @@
+/**
+ * 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.Queue;
+import javax.jms.QueueConnection;
+import javax.jms.QueueReceiver;
+import javax.jms.QueueSender;
+import javax.jms.QueueSession;
+import javax.jms.Session;
+
+import org.apache.qpid.jms.JmsConnectionTestSupport;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Tests behaviour after a QueueSession is closed.
+ */
+public class JmsQueueSessionClosedTest extends JmsConnectionTestSupport {
+
+    private QueueSession session;
+    private QueueSender sender;
+    private QueueReceiver receiver;
+
+    protected void createTestResources() throws Exception {
+        connection = createQueueConnectionToMockProvider();
+
+        session = ((QueueConnection) connection).createQueueSession(false, 
Session.AUTO_ACKNOWLEDGE);
+        Queue destination = session.createQueue(_testName.getMethodName());
+
+        sender = session.createSender(destination);
+        receiver = session.createReceiver(destination);
+
+        // Close the session explicitly, without closing the above.
+        session.close();
+    }
+
+    @Override
+    @Before
+    public void setUp() throws Exception {
+        super.setUp();
+        createTestResources();
+    }
+
+    @Test(timeout=30000)
+    public void testSessionCloseAgain() throws Exception {
+        // Close it again
+        session.close();
+    }
+
+    @Test(timeout=30000)
+    public void testReceiverCloseAgain() throws Exception {
+        // Close it again (closing the session should have closed it already).
+        receiver.close();
+    }
+
+    @Test(timeout=30000)
+    public void testSenderCloseAgain() throws Exception {
+        // Close it again (closing the session should have closed it already).
+        sender.close();
+    }
+
+    @Test(timeout=30000, expected=javax.jms.IllegalStateException.class)
+    public void testReceiverGetQueueFails() throws Exception {
+        receiver.getQueue();
+    }
+
+    @Test(timeout=30000, expected=javax.jms.IllegalStateException.class)
+    public void testSenderGetQueueFails() throws Exception {
+        sender.getQueue();
+    }
+}

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/5e219b81/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
new file mode 100644
index 0000000..e47b532
--- /dev/null
+++ 
b/qpid-jms-client/src/test/java/org/apache/qpid/jms/session/JmsTopicSessionClosedTest.java
@@ -0,0 +1,86 @@
+/**
+ * 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.Session;
+import javax.jms.Topic;
+import javax.jms.TopicConnection;
+import javax.jms.TopicPublisher;
+import javax.jms.TopicSession;
+import javax.jms.TopicSubscriber;
+
+import org.apache.qpid.jms.JmsConnectionTestSupport;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Tests behaviour after a TopicSession is closed.
+ */
+public class JmsTopicSessionClosedTest extends JmsConnectionTestSupport {
+
+    private TopicSession session;
+    private TopicPublisher publisher;
+    private TopicSubscriber subscriber;
+
+    protected void createTestResources() throws Exception {
+        connection = createTopicConnectionToMockProvider();
+
+        session = ((TopicConnection) connection).createTopicSession(false, 
Session.AUTO_ACKNOWLEDGE);
+        Topic destination = session.createTopic(_testName.getMethodName());
+
+        publisher = session.createPublisher(destination);
+        subscriber = session.createSubscriber(destination);
+
+        // Close the session explicitly, without closing the above.
+        session.close();
+    }
+
+    @Override
+    @Before
+    public void setUp() throws Exception {
+        super.setUp();
+        createTestResources();
+    }
+
+    @Test(timeout=30000)
+    public void testSessionCloseAgain() throws Exception {
+        // Close it again
+        session.close();
+    }
+
+    @Test(timeout=30000)
+    public void testSubscriberCloseAgain() throws Exception {
+        // Close it again (closing the session should have closed it already).
+        subscriber.close();
+    }
+
+    @Test(timeout=30000)
+    public void testPublisherCloseAgain() throws Exception {
+        // Close it again (closing the session should have closed it already).
+        publisher.close();
+    }
+
+    @Test(timeout=30000, expected=javax.jms.IllegalStateException.class)
+    public void testSubscriberGetTopicFails() throws Exception {
+        subscriber.getTopic();
+    }
+
+    @Test(timeout=30000, expected=javax.jms.IllegalStateException.class)
+    public void testPublisherGetTopicFails() throws Exception {
+        publisher.getTopic();
+    }
+}

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/5e219b81/qpid-jms-interop-tests/qpid-jms-activemq-tests/src/test/java/org/apache/qpid/jms/session/JmsQueueSessionClosedTest.java
----------------------------------------------------------------------
diff --git 
a/qpid-jms-interop-tests/qpid-jms-activemq-tests/src/test/java/org/apache/qpid/jms/session/JmsQueueSessionClosedTest.java
 
b/qpid-jms-interop-tests/qpid-jms-activemq-tests/src/test/java/org/apache/qpid/jms/session/JmsQueueSessionClosedTest.java
deleted file mode 100644
index a48edce..0000000
--- 
a/qpid-jms-interop-tests/qpid-jms-activemq-tests/src/test/java/org/apache/qpid/jms/session/JmsQueueSessionClosedTest.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/**
- * 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.Queue;
-import javax.jms.QueueConnection;
-import javax.jms.QueueReceiver;
-import javax.jms.QueueSender;
-import javax.jms.QueueSession;
-import javax.jms.Session;
-
-import org.apache.qpid.jms.JmsConnectionFactory;
-import org.apache.qpid.jms.support.AmqpTestSupport;
-import org.junit.Test;
-
-/**
- * Tests behaviour after a QueueSession is closed.
- */
-public class JmsQueueSessionClosedTest extends AmqpTestSupport {
-
-    private QueueSession session;
-    private QueueSender sender;
-    private QueueReceiver receiver;
-
-    protected void createAndCloseSession() throws Exception {
-        JmsConnectionFactory factory = new 
JmsConnectionFactory(getBrokerAmqpConnectionURI());
-        connection = factory.createQueueConnection();
-
-        session = ((QueueConnection) connection).createQueueSession(false, 
Session.AUTO_ACKNOWLEDGE);
-        Queue destination = session.createQueue(name.getMethodName());
-
-        sender = session.createSender(destination);
-        receiver = session.createReceiver(destination);
-
-        // Close the session explicitly, without closing the above.
-        session.close();
-    }
-
-    @Test(timeout=30000)
-    public void testSessionCloseAgain() throws Exception {
-        createAndCloseSession();
-        // Close it again
-        session.close();
-    }
-
-    @Test(timeout=30000)
-    public void testReceiverCloseAgain() throws Exception {
-        createAndCloseSession();
-        // Close it again (closing the session should have closed it already).
-        receiver.close();
-    }
-
-    @Test(timeout=30000)
-    public void testSenderCloseAgain() 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 testReceiverGetQueueFails() throws Exception {
-        createAndCloseSession();
-        receiver.getQueue();
-    }
-
-    @Test(timeout=30000, expected=javax.jms.IllegalStateException.class)
-    public void testSenderGetQueueFails() throws Exception {
-        createAndCloseSession();
-        sender.getQueue();
-    }
-}

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/5e219b81/qpid-jms-interop-tests/qpid-jms-activemq-tests/src/test/java/org/apache/qpid/jms/session/JmsTopicSessionClosedTest.java
----------------------------------------------------------------------
diff --git 
a/qpid-jms-interop-tests/qpid-jms-activemq-tests/src/test/java/org/apache/qpid/jms/session/JmsTopicSessionClosedTest.java
 
b/qpid-jms-interop-tests/qpid-jms-activemq-tests/src/test/java/org/apache/qpid/jms/session/JmsTopicSessionClosedTest.java
deleted file mode 100644
index 3f9f40c..0000000
--- 
a/qpid-jms-interop-tests/qpid-jms-activemq-tests/src/test/java/org/apache/qpid/jms/session/JmsTopicSessionClosedTest.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/**
- * 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.Session;
-import javax.jms.Topic;
-import javax.jms.TopicConnection;
-import javax.jms.TopicPublisher;
-import javax.jms.TopicSession;
-import javax.jms.TopicSubscriber;
-
-import org.apache.qpid.jms.JmsConnectionFactory;
-import org.apache.qpid.jms.support.AmqpTestSupport;
-import org.junit.Test;
-
-/**
- * Tests behaviour after a TopicSession is closed.
- */
-public class JmsTopicSessionClosedTest extends AmqpTestSupport {
-
-    private TopicSession session;
-    private TopicPublisher publisher;
-    private TopicSubscriber subscriber;
-
-    protected void createAndCloseSession() throws Exception {
-        JmsConnectionFactory factory = new 
JmsConnectionFactory(getBrokerAmqpConnectionURI());
-        connection = factory.createTopicConnection();
-
-        session = ((TopicConnection) connection).createTopicSession(false, 
Session.AUTO_ACKNOWLEDGE);
-        Topic destination = session.createTopic(name.getMethodName());
-
-        publisher = session.createPublisher(destination);
-        subscriber = session.createSubscriber(destination);
-
-        // Close the session explicitly, without closing the above.
-        session.close();
-    }
-
-    @Test(timeout=30000)
-    public void testSessionCloseAgain() throws Exception {
-        createAndCloseSession();
-        // Close it again
-        session.close();
-    }
-
-    @Test(timeout=30000)
-    public void testSubscriberCloseAgain() throws Exception {
-        createAndCloseSession();
-        // Close it again (closing the session should have closed it already).
-        subscriber.close();
-    }
-
-    @Test(timeout=30000)
-    public void testPublisherCloseAgain() throws Exception {
-        createAndCloseSession();
-        // Close it again (closing the session should have closed it already).
-        publisher.close();
-    }
-
-    @Test(timeout=30000, expected=javax.jms.IllegalStateException.class)
-    public void testSubscriberGetTopicFails() throws Exception {
-        createAndCloseSession();
-        subscriber.getTopic();
-    }
-
-    @Test(timeout=30000, expected=javax.jms.IllegalStateException.class)
-    public void testPublisherGetTopicFails() throws Exception {
-        createAndCloseSession();
-        publisher.getTopic();
-    }
-}


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to