This is an automated email from the ASF dual-hosted git repository.

tabish pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/qpid-jms.git


The following commit(s) were added to refs/heads/master by this push:
     new 0354695  NO-JIRA Add some additional tests for config of future 
factory types
0354695 is described below

commit 035469573753dd532171dad046f995c73d690873
Author: Timothy Bish <tabish...@gmail.com>
AuthorDate: Tue May 19 10:48:03 2020 -0400

    NO-JIRA Add some additional tests for config of future factory types
---
 .../ConnectionFactoryIntegrationTest.java          | 64 ++++++++++++++++++++++
 1 file changed, 64 insertions(+)

diff --git 
a/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/ConnectionFactoryIntegrationTest.java
 
b/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/ConnectionFactoryIntegrationTest.java
index d3331d2..82a5490 100644
--- 
a/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/ConnectionFactoryIntegrationTest.java
+++ 
b/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/ConnectionFactoryIntegrationTest.java
@@ -30,6 +30,7 @@ import java.net.URI;
 import java.util.UUID;
 
 import javax.jms.Connection;
+import javax.jms.JMSException;
 import javax.jms.QueueConnection;
 import javax.jms.TopicConnection;
 
@@ -478,6 +479,69 @@ public class ConnectionFactoryIntegrationTest extends 
QpidJmsTestCase {
         assertTrue(factory.getRedeliveryPolicy() instanceof 
JmsDefaultRedeliveryPolicy);
     }
 
+    @Test(timeout = 20_000)
+    public void testConfigureFutureFactoryFromURITypeOfProgressive() throws 
Exception {
+        doTestCreateConnectionWithConfiguredFutureFactory("progressive");
+    }
+
+    @Test(timeout = 20_000)
+    public void testConfigureFutureFactoryFromURITypeOfBalanced() throws 
Exception {
+        doTestCreateConnectionWithConfiguredFutureFactory("balanced");
+    }
+
+    @Test(timeout = 20_000)
+    public void testConfigureFutureFactoryFromURITypeOfConservative() throws 
Exception {
+        doTestCreateConnectionWithConfiguredFutureFactory("conservative");
+    }
+
+    private void doTestCreateConnectionWithConfiguredFutureFactory(String 
futureType) throws Exception {
+        try (TestAmqpPeer testPeer = new TestAmqpPeer();) {
+            // Ignore errors from peer close due to not sending any Open / 
Close frames
+            testPeer.setSuppressReadExceptionOnClose(true);
+
+            // DONT create a test fixture, we will drive everything directly.
+            testPeer.expectSaslAnonymous();
+
+            String uri = "amqp://127.0.0.1:" + testPeer.getServerPort() + 
"?provider.futureType=" + futureType;
+
+            JmsConnectionFactory factory = new JmsConnectionFactory(uri);
+
+            JmsConnection connection = (JmsConnection) 
factory.createConnection();
+            assertNotNull(connection);
+
+            testPeer.waitForAllHandlersToComplete(1000);
+
+            testPeer.expectOpen();
+            testPeer.expectClose();
+
+            connection.close();
+
+            testPeer.waitForAllHandlersToCompleteNoAssert(1000);
+        }
+    }
+
+    @Test(timeout = 20_000)
+    public void testConfigureFutureFactoryFromURITypeUnknown() throws 
Exception {
+        try (TestAmqpPeer testPeer = new TestAmqpPeer();) {
+            // Ignore errors from peer close due to not sending any Open / 
Close frames
+            testPeer.setSuppressReadExceptionOnClose(true);
+
+            String uri = "amqp://127.0.0.1:" + testPeer.getServerPort() + 
"?provider.futureType=unknown";
+
+            JmsConnectionFactory factory = new JmsConnectionFactory(uri);
+
+            try {
+                factory.createConnection();
+                fail("Should not allow a connection to proceed with a bad 
future factory type");
+            } catch (JMSException ex) {
+                String message = ex.getMessage();
+                assertTrue(message.contains("No ProviderFuture 
implementation"));
+            }
+
+            testPeer.waitForAllHandlersToCompleteNoAssert(1000);
+        }
+    }
+
     //----- Custom Policy Objects 
--------------------------------------------//
 
     private final class CustomJmsMessageIdBuilder implements 
JmsMessageIDBuilder {


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org
For additional commands, e-mail: commits-h...@qpid.apache.org

Reply via email to