add basic Session integration test

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

Branch: refs/heads/master
Commit: 735c21969a8e50e25a7dd07a3f3a182a282d7972
Parents: e53b49f
Author: Robert Gemmell <[email protected]>
Authored: Fri Oct 3 10:11:24 2014 +0100
Committer: Robert Gemmell <[email protected]>
Committed: Fri Oct 3 10:11:24 2014 +0100

----------------------------------------------------------------------
 .../jms/integration/SessionIntegrationTest.java | 80 ++++++++++++++++++++
 1 file changed, 80 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/735c2196/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/SessionIntegrationTest.java
----------------------------------------------------------------------
diff --git 
a/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/SessionIntegrationTest.java
 
b/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/SessionIntegrationTest.java
new file mode 100644
index 0000000..b1888ee
--- /dev/null
+++ 
b/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/SessionIntegrationTest.java
@@ -0,0 +1,80 @@
+/*
+ * 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.integration;
+
+import static org.junit.Assert.assertNotNull;
+
+import javax.jms.Connection;
+import javax.jms.Queue;
+import javax.jms.Session;
+
+import org.apache.qpid.jms.test.QpidJmsTestCase;
+import org.apache.qpid.jms.test.testpeer.TestAmqpPeer;
+import org.junit.Test;
+
+public class SessionIntegrationTest extends QpidJmsTestCase {
+    private final IntegrationTestFixture testFixture = new 
IntegrationTestFixture();
+
+    @Test(timeout = 5000)
+    public void testCloseSession() throws Exception {
+        try (TestAmqpPeer testPeer = new 
TestAmqpPeer(IntegrationTestFixture.PORT);) {
+            Connection connection = testFixture.establishConnecton(testPeer);
+            testPeer.expectBegin(true);
+            Session session = connection.createSession(false, 
Session.AUTO_ACKNOWLEDGE);
+            assertNotNull("Session should not be null", session);
+            testPeer.expectEnd();
+            session.close();
+        }
+    }
+
+    @Test(timeout = 5000)
+    public void testCreateProducer() throws Exception {
+        try (TestAmqpPeer testPeer = new 
TestAmqpPeer(IntegrationTestFixture.PORT);) {
+            Connection connection = testFixture.establishConnecton(testPeer);
+            testPeer.expectBegin(true);
+
+            Session session = connection.createSession(false, 
Session.AUTO_ACKNOWLEDGE);
+
+            testPeer.expectSenderAttach();
+
+            Queue queue = session.createQueue("myQueue");
+            session.createProducer(queue);
+        }
+    }
+
+    @Test(timeout = 5000)
+    public void testCreateConsumer() throws Exception {
+        try (TestAmqpPeer testPeer = new 
TestAmqpPeer(IntegrationTestFixture.PORT);) {
+            Connection connection = testFixture.establishConnecton(testPeer);
+            connection.start();
+
+            testPeer.expectBegin(true);
+
+            Session session = connection.createSession(false, 
Session.AUTO_ACKNOWLEDGE);
+
+            testPeer.expectReceiverAttach();
+            testPeer.expectLinkFlow();
+
+            Queue queue = session.createQueue("myQueue");
+            session.createConsumer(queue);
+
+            testPeer.waitForAllHandlersToComplete(3000);
+        }
+    }
+}


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

Reply via email to