qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kgiu...@apache.org
Subject svn commit: r1542435 - in /qpid/proton/trunk: proton-c/bindings/java/src/main/java/org/apache/qpid/proton/engine/jni/ tests/python/proton_tests/
Date Sat, 16 Nov 2013 00:52:22 GMT
Author: kgiusti
Date: Sat Nov 16 00:52:22 2013
New Revision: 1542435

URL: http://svn.apache.org/r1542435
Log:
PROTON-449: skip SSL tests if no SSL libraries available.

Modified:
    qpid/proton/trunk/proton-c/bindings/java/src/main/java/org/apache/qpid/proton/engine/jni/JNISslDomain.java
    qpid/proton/trunk/tests/python/proton_tests/common.py
    qpid/proton/trunk/tests/python/proton_tests/messenger.py
    qpid/proton/trunk/tests/python/proton_tests/soak.py
    qpid/proton/trunk/tests/python/proton_tests/ssl.py

Modified: qpid/proton/trunk/proton-c/bindings/java/src/main/java/org/apache/qpid/proton/engine/jni/JNISslDomain.java
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-c/bindings/java/src/main/java/org/apache/qpid/proton/engine/jni/JNISslDomain.java?rev=1542435&r1=1542434&r2=1542435&view=diff
==============================================================================
--- qpid/proton/trunk/proton-c/bindings/java/src/main/java/org/apache/qpid/proton/engine/jni/JNISslDomain.java
(original)
+++ qpid/proton/trunk/proton-c/bindings/java/src/main/java/org/apache/qpid/proton/engine/jni/JNISslDomain.java
Sat Nov 16 00:52:22 2013
@@ -22,6 +22,7 @@ package org.apache.qpid.proton.engine.jn
 import static org.apache.qpid.proton.jni.ExceptionHelper.checkProtonCReturnValue;
 
 import org.apache.qpid.proton.ProtonCEquivalent;
+import org.apache.qpid.proton.ProtonUnsupportedOperationException;
 import org.apache.qpid.proton.engine.SslDomain;
 import org.apache.qpid.proton.jni.Proton;
 import org.apache.qpid.proton.jni.SWIGTYPE_p_pn_ssl_domain_t;
@@ -44,6 +45,8 @@ public class JNISslDomain implements Ssl
     public void init(Mode mode)
     {
         _impl = Proton.pn_ssl_domain(convertMode(mode));
+        if (_impl == null)
+            throw new ProtonUnsupportedOperationException("No SSL libraries available.");
     }
 
     private pn_ssl_mode_t convertMode(Mode mode)

Modified: qpid/proton/trunk/tests/python/proton_tests/common.py
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/tests/python/proton_tests/common.py?rev=1542435&r1=1542434&r2=1542435&view=diff
==============================================================================
--- qpid/proton/trunk/tests/python/proton_tests/common.py (original)
+++ qpid/proton/trunk/tests/python/proton_tests/common.py Sat Nov 16 00:52:22 2013
@@ -22,7 +22,8 @@ from threading import Thread
 from socket import socket, AF_INET, SOCK_STREAM
 from subprocess import Popen,PIPE,STDOUT
 import sys, os
-from proton import Driver, Connection, Transport, SASL, Endpoint, Delivery
+from proton import Driver, Connection, Transport, SASL, Endpoint, Delivery, \
+    SSLDomain, SSLUnavailable
 
 
 def free_tcp_ports(count=1):
@@ -82,6 +83,16 @@ def pump(transport1, transport2, buffer_
     if not out1 and not out2: break
     i = i + 1
 
+def isSSLPresent():
+    """ True if a suitable SSL library is available.
+    """
+    try:
+        xxx = SSLDomain(SSLDomain.MODE_CLIENT)
+        return True
+    except SSLUnavailable, e:
+        # SSL libraries not installed
+        return False
+
 class Test:
 
   def __init__(self, name):

Modified: qpid/proton/trunk/tests/python/proton_tests/messenger.py
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/tests/python/proton_tests/messenger.py?rev=1542435&r1=1542434&r2=1542435&view=diff
==============================================================================
--- qpid/proton/trunk/tests/python/proton_tests/messenger.py (original)
+++ qpid/proton/trunk/tests/python/proton_tests/messenger.py Sat Nov 16 00:52:22 2013
@@ -414,10 +414,14 @@ class MessengerTest(Test):
     self.client.start()
 
   def testRoute(self):
-    self.server.subscribe("amqps://~0.0.0.0:12346")
+    if not common.isSSLPresent():
+        domain = "amqp"
+    else:
+        domain = "amqps"
+    self.server.subscribe(domain + "://~0.0.0.0:12346")
     self.start()
     self.client.route("route1", "amqp://0.0.0.0:12345")
-    self.client.route("route2", "amqps://0.0.0.0:12346")
+    self.client.route("route2", domain + "://0.0.0.0:12346")
 
     msg = Message()
     msg.address = "route1"

Modified: qpid/proton/trunk/tests/python/proton_tests/soak.py
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/tests/python/proton_tests/soak.py?rev=1542435&r1=1542434&r2=1542435&view=diff
==============================================================================
--- qpid/proton/trunk/tests/python/proton_tests/soak.py (original)
+++ qpid/proton/trunk/tests/python/proton_tests/soak.py Sat Nov 16 00:52:22 2013
@@ -21,7 +21,8 @@ import sys
 from common import Test, Skipped, free_tcp_ports, \
     MessengerReceiverC, MessengerSenderC, \
     MessengerReceiverValgrind, MessengerSenderValgrind, \
-    MessengerReceiverPython, MessengerSenderPython
+    MessengerReceiverPython, MessengerSenderPython, \
+    isSSLPresent
 from proton import *
 
 #
@@ -109,6 +110,10 @@ class MessengerTests(AppTests):
 
     _timeout = 60
 
+    def _ssl_check(self):
+        if not isSSLPresent():
+            raise Skipped("No SSL libraries found.")
+
     def __init__(self, *args):
         AppTests.__init__(self, *args)
 
@@ -269,6 +274,7 @@ class MessengerTests(AppTests):
         self._do_oneway_test(MessengerReceiverC(), MessengerSenderC())
 
     def test_oneway_C_SSL(self):
+        self._ssl_check()
         self._do_oneway_test(MessengerReceiverC(), MessengerSenderC(), "amqps")
 
     def test_oneway_valgrind(self):
@@ -288,6 +294,7 @@ class MessengerTests(AppTests):
         self._do_echo_test(MessengerReceiverC(), MessengerSenderC())
 
     def test_echo_C_SSL(self):
+        self._ssl_check()
         self._do_echo_test(MessengerReceiverC(), MessengerSenderC(), "amqps")
 
     def test_echo_valgrind(self):
@@ -307,6 +314,7 @@ class MessengerTests(AppTests):
         self._do_relay_test(MessengerReceiverC(), MessengerReceiverC(), MessengerSenderC())
 
     def test_relay_C_SSL(self):
+        self._ssl_check()
         self._do_relay_test(MessengerReceiverC(), MessengerReceiverC(), MessengerSenderC(),
"amqps")
 
     def test_relay_valgrind(self):
@@ -323,6 +331,7 @@ class MessengerTests(AppTests):
         self._do_star_topology_test( MessengerReceiverC, MessengerSenderC )
 
     def test_star_topology_C_SSL(self):
+        self._ssl_check()
         self._do_star_topology_test( MessengerReceiverC, MessengerSenderC, "amqps" )
 
     def test_star_topology_valgrind(self):

Modified: qpid/proton/trunk/tests/python/proton_tests/ssl.py
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/tests/python/proton_tests/ssl.py?rev=1542435&r1=1542434&r2=1542435&view=diff
==============================================================================
--- qpid/proton/trunk/tests/python/proton_tests/ssl.py (original)
+++ qpid/proton/trunk/tests/python/proton_tests/ssl.py Sat Nov 16 00:52:22 2013
@@ -36,11 +36,10 @@ class SslTest(common.Test):
         self._testpath = _testpath
 
     def setup(self):
-        try:
-            self.server_domain = SSLDomain(SSLDomain.MODE_SERVER)
-            self.client_domain = SSLDomain(SSLDomain.MODE_CLIENT)
-        except SSLUnavailable, e:
-            raise Skipped(e)
+        if not common.isSSLPresent():
+            raise Skipped("No SSL libraries found.")
+        self.server_domain = SSLDomain(SSLDomain.MODE_SERVER)
+        self.client_domain = SSLDomain(SSLDomain.MODE_CLIENT)
 
     def teardown(self):
         self.server_domain = None
@@ -50,16 +49,16 @@ class SslTest(common.Test):
         """ Represents a single SSL connection.
         """
         def __init__(self, domain=None, session_details=None):
-            try:
-                self.ssl = None
-                self.domain = domain
-                self.transport = Transport()
-                self.connection = Connection()
-                self.transport.bind(self.connection)
-                if domain:
-                    self.ssl = SSL( self.transport, self.domain, session_details )
-            except SSLUnavailable, e:
-                raise Skipped(e)
+            if not common.isSSLPresent():
+                raise Skipped("No SSL libraries found.")
+
+            self.ssl = None
+            self.domain = domain
+            self.transport = Transport()
+            self.connection = Connection()
+            self.transport.bind(self.connection)
+            if domain:
+                self.ssl = SSL( self.transport, self.domain, session_details )
 
     def _pump(self, ssl_client, ssl_server, buffer_size=1024):
         pump(ssl_client.transport, ssl_server.transport, buffer_size)
@@ -775,6 +774,8 @@ class SslTest(common.Test):
 class MessengerSSLTests(common.Test):
 
     def setup(self):
+        if not common.isSSLPresent():
+            raise Skipped("No SSL libraries found.")
         self.server = Messenger()
         self.client = Messenger()
         self.server.blocking = False



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


Mime
View raw message