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/02/03 18:05:47 UTC

[1/3] qpid-jms git commit: Ensure whe throw the right exceptions for different error cases.

Repository: qpid-jms
Updated Branches:
  refs/heads/master 79b6cce18 -> 0874817f4


Ensure whe throw the right exceptions for different error cases.

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

Branch: refs/heads/master
Commit: 1ee2e5b1571c4ed567c0c5e711762e44d865006a
Parents: 79b6cce
Author: Timothy Bish <ta...@gmail.com>
Authored: Tue Feb 3 10:53:09 2015 -0500
Committer: Timothy Bish <ta...@gmail.com>
Committed: Tue Feb 3 10:53:09 2015 -0500

----------------------------------------------------------------------
 .../netty/NettyTcpTransportFactoryTest.java     | 25 ++++++++++++++++----
 1 file changed, 21 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/1ee2e5b1/qpid-jms-client/src/test/java/org/apache/qpid/jms/transports/netty/NettyTcpTransportFactoryTest.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/transports/netty/NettyTcpTransportFactoryTest.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/transports/netty/NettyTcpTransportFactoryTest.java
index 99bafc6..ab24217 100644
--- a/qpid-jms-client/src/test/java/org/apache/qpid/jms/transports/netty/NettyTcpTransportFactoryTest.java
+++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/transports/netty/NettyTcpTransportFactoryTest.java
@@ -21,6 +21,7 @@ import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 
+import java.io.IOException;
 import java.net.URI;
 
 import org.apache.qpid.jms.transports.Transport;
@@ -41,7 +42,7 @@ public class NettyTcpTransportFactoryTest {
     public static final int CUSTOM_SO_TIMEOUT = 10;
     public static final int CUSTOM_CONNECT_TIMEOUT = 90000;
 
-    @Test
+    @Test(timeout = 30000)
     public void testCreateWithDefaultOptions() throws Exception {
         URI BASE_URI = new URI("tcp://localhost:5672");
 
@@ -67,20 +68,36 @@ public class NettyTcpTransportFactoryTest {
     }
 
     @Test(expected = IllegalArgumentException.class)
-    public void testCreateWithUnknownOption() throws Exception {
+    public void testCreateTransportWithUnknownOption() throws Exception {
         URI BASE_URI = new URI("tcp://localhost:5672?transport.someOption=true");
         NettyTcpTransportFactory factory = new NettyTcpTransportFactory();
         factory.createTransport(BASE_URI);
     }
 
     @Test(expected = IllegalArgumentException.class)
-    public void testCreateWithBadOption() throws Exception {
+    public void testCreateTransportWithBadOption() throws Exception {
         URI BASE_URI = new URI("tcp://localhost:5672?transport.trafficClass=4096");
         NettyTcpTransportFactory factory = new NettyTcpTransportFactory();
         factory.createTransport(BASE_URI);
     }
 
-    @Test
+    @Test(expected = IOException.class)
+    public void testCreateWithBadKey() throws Exception {
+        URI BASE_URI = new URI("tcp://localhost:5672?transport.trafficClass=4096");
+        NettyTcpTransportFactory.create("foo", BASE_URI);
+    }
+
+    @Test(expected = IOException.class)
+    public void testFindFactoryFailsWithNullKey() throws Exception {
+        NettyTcpTransportFactory.findTransportFactory(null);
+    }
+
+    @Test(expected = IOException.class)
+    public void testFindFactoryFailsWithInvalidKey() throws Exception {
+        NettyTcpTransportFactory.findTransportFactory("ssh");
+    }
+
+    @Test(timeout = 30000)
     public void testCreateWithCustomOptions() throws Exception {
         URI BASE_URI = new URI("tcp://localhost:5672");
 


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


[2/3] qpid-jms git commit: Test that we add the verification alogorithm when verify host is enabled.

Posted by ta...@apache.org.
Test that we add the verification alogorithm when verify host is
enabled.

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

Branch: refs/heads/master
Commit: 70b63d0ba29756ad2ee7d5b01904fcc361dabf13
Parents: 1ee2e5b
Author: Timothy Bish <ta...@gmail.com>
Authored: Tue Feb 3 10:59:46 2015 -0500
Committer: Timothy Bish <ta...@gmail.com>
Committed: Tue Feb 3 10:59:46 2015 -0500

----------------------------------------------------------------------
 .../jms/transports/TransportSupportTest.java    | 39 ++++++++++++++++++++
 1 file changed, 39 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/70b63d0b/qpid-jms-client/src/test/java/org/apache/qpid/jms/transports/TransportSupportTest.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/transports/TransportSupportTest.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/transports/TransportSupportTest.java
index 4baff64..09314ba 100644
--- a/qpid-jms-client/src/test/java/org/apache/qpid/jms/transports/TransportSupportTest.java
+++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/transports/TransportSupportTest.java
@@ -19,6 +19,7 @@ package org.apache.qpid.jms.transports;
 import static org.hamcrest.collection.IsIterableContainingInAnyOrder.containsInAnyOrder;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertThat;
 
 import java.io.IOException;
@@ -126,6 +127,44 @@ public class TransportSupportTest extends QpidJmsTestCase {
         assertThat(engineProtocols, containsInAnyOrder(defaultProtocols.toArray()));
     }
 
+    @Test
+    public void testCreateSslEngineWithVerifyHost() throws Exception {
+        TransportSslOptions options = createJksSslOptions();
+        options.setVerifyHost(true);
+
+        SSLContext context = TransportSupport.createSslContext(options);
+        assertNotNull(context);
+
+        SSLEngine engine = TransportSupport.createSslEngine(context, options);
+        assertNotNull(engine);
+
+        assertEquals("HTTPS", engine.getSSLParameters().getEndpointIdentificationAlgorithm());
+
+        List<String> engineProtocols = Arrays.asList(engine.getEnabledProtocols());
+        List<String> defaultProtocols = Arrays.asList(TransportSslOptions.DEFAULT_ENABLED_PROTOCOLS);
+
+        assertThat(engineProtocols, containsInAnyOrder(defaultProtocols.toArray()));
+    }
+
+    @Test
+    public void testCreateSslEngineWithoutVerifyHost() throws Exception {
+        TransportSslOptions options = createJksSslOptions();
+        options.setVerifyHost(false);
+
+        SSLContext context = TransportSupport.createSslContext(options);
+        assertNotNull(context);
+
+        SSLEngine engine = TransportSupport.createSslEngine(context, options);
+        assertNotNull(engine);
+
+        assertNull(engine.getSSLParameters().getEndpointIdentificationAlgorithm());
+
+        List<String> engineProtocols = Arrays.asList(engine.getEnabledProtocols());
+        List<String> defaultProtocols = Arrays.asList(TransportSslOptions.DEFAULT_ENABLED_PROTOCOLS);
+
+        assertThat(engineProtocols, containsInAnyOrder(defaultProtocols.toArray()));
+    }
+
     private TransportSslOptions createJksSslOptions() {
         TransportSslOptions options = new TransportSslOptions();
 


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


[3/3] qpid-jms git commit: Adds some tests for bad password or no password.

Posted by ta...@apache.org.
Adds some tests for bad password or no password.  

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

Branch: refs/heads/master
Commit: 0874817f4498a4bc906b5c3da9a71338fd1f5df1
Parents: 70b63d0
Author: Timothy Bish <ta...@gmail.com>
Authored: Tue Feb 3 11:15:42 2015 -0500
Committer: Timothy Bish <ta...@gmail.com>
Committed: Tue Feb 3 11:15:42 2015 -0500

----------------------------------------------------------------------
 .../qpid/jms/transports/TransportSupportTest.java    | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/0874817f/qpid-jms-client/src/test/java/org/apache/qpid/jms/transports/TransportSupportTest.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/transports/TransportSupportTest.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/transports/TransportSupportTest.java
index 09314ba..515ad8d 100644
--- a/qpid-jms-client/src/test/java/org/apache/qpid/jms/transports/TransportSupportTest.java
+++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/transports/TransportSupportTest.java
@@ -23,6 +23,7 @@ import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertThat;
 
 import java.io.IOException;
+import java.security.UnrecoverableKeyException;
 import java.util.Arrays;
 import java.util.List;
 
@@ -68,6 +69,20 @@ public class TransportSupportTest extends QpidJmsTestCase {
         assertEquals("TLS", context.getProtocol());
     }
 
+    @Test(expected = UnrecoverableKeyException.class)
+    public void testCreateSslContextNoKeyStorePassword() throws Exception {
+        TransportSslOptions options = createJksSslOptions();
+        options.setKeyStorePassword(null);
+        TransportSupport.createSslContext(options);
+    }
+
+    @Test(expected = IOException.class)
+    public void testCreateSslContextWrongKeyStorePassword() throws Exception {
+        TransportSslOptions options = createJksSslOptions();
+        options.setKeyStorePassword("wrong");
+        TransportSupport.createSslContext(options);
+    }
+
     @Test
     public void testCreateSslContextJceksStore() throws Exception {
         TransportSslOptions options = createJceksSslOptions();


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