You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ac...@apache.org on 2015/06/03 19:25:59 UTC

[36/50] [abbrv] qpid-proton git commit: NO-JIRA: Fix SSL tests to correctly create server transports.

NO-JIRA: Fix SSL tests to correctly create server transports.


Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/3bd4aba5
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/3bd4aba5
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/3bd4aba5

Branch: refs/heads/cjansen-cpp-client
Commit: 3bd4aba5f71ae30fafeaa02e1a28dd8d3714a520
Parents: e349a02
Author: Andrew Stitcher <as...@apache.org>
Authored: Fri May 22 18:43:54 2015 -0400
Committer: Andrew Stitcher <as...@apache.org>
Committed: Fri May 22 18:45:34 2015 -0400

----------------------------------------------------------------------
 tests/python/proton_tests/ssl.py | 62 +++++++++++++++++------------------
 1 file changed, 31 insertions(+), 31 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/3bd4aba5/tests/python/proton_tests/ssl.py
----------------------------------------------------------------------
diff --git a/tests/python/proton_tests/ssl.py b/tests/python/proton_tests/ssl.py
index f5fae3f..d502e23 100644
--- a/tests/python/proton_tests/ssl.py
+++ b/tests/python/proton_tests/ssl.py
@@ -51,13 +51,13 @@ class SslTest(common.Test):
     class SslTestConnection(object):
         """ Represents a single SSL connection.
         """
-        def __init__(self, domain=None, session_details=None):
+        def __init__(self, domain=None, mode=Transport.CLIENT, session_details=None):
             if not common.isSSLPresent():
                 raise Skipped("No SSL libraries found.")
 
             self.ssl = None
             self.domain = domain
-            self.transport = Transport()
+            self.transport = Transport(mode)
             self.connection = Connection()
             self.transport.bind(self.connection)
             if domain:
@@ -84,7 +84,7 @@ class SslTest(common.Test):
         """ By default, both the server and the client support anonymous
         ciphers - they should connect without need for a certificate.
         """
-        server = SslTest.SslTestConnection( self.server_domain )
+        server = SslTest.SslTestConnection( self.server_domain, mode=Transport.SERVER )
         client = SslTest.SslTestConnection( self.client_domain )
 
         # check that no SSL connection exists
@@ -113,7 +113,7 @@ class SslTest(common.Test):
         self.client_domain.set_trusted_ca_db(self._testpath("ca-certificate.pem"))
         self.client_domain.set_peer_authentication( SSLDomain.VERIFY_PEER )
 
-        server = SslTest.SslTestConnection( self.server_domain )
+        server = SslTest.SslTestConnection( self.server_domain, mode=Transport.SERVER )
         client = SslTest.SslTestConnection( self.client_domain )
 
         client.connection.open()
@@ -135,7 +135,7 @@ class SslTest(common.Test):
         self.server_domain.set_credentials(self._testpath("server-certificate.pem"),
                                            self._testpath("server-private-key.pem"),
                                            "server-password")
-        server = SslTest.SslTestConnection( self.server_domain )
+        server = SslTest.SslTestConnection( self.server_domain, mode=Transport.SERVER )
         client = SslTest.SslTestConnection( self.client_domain )
 
         client.connection.open()
@@ -156,7 +156,7 @@ class SslTest(common.Test):
         self.client_domain.set_trusted_ca_db(self._testpath("ca-certificate.pem"))
         self.client_domain.set_peer_authentication( SSLDomain.VERIFY_PEER )
 
-        server = SslTest.SslTestConnection( self.server_domain )
+        server = SslTest.SslTestConnection( self.server_domain, mode=Transport.SERVER )
         client = SslTest.SslTestConnection( self.client_domain )
 
         client.connection.open()
@@ -178,7 +178,7 @@ class SslTest(common.Test):
         self.server_domain.set_trusted_ca_db(self._testpath("ca-certificate.pem"))
         self.server_domain.set_peer_authentication( SSLDomain.VERIFY_PEER,
                                                     self._testpath("ca-certificate.pem") )
-        server = SslTest.SslTestConnection( self.server_domain )
+        server = SslTest.SslTestConnection( self.server_domain, mode=Transport.SERVER )
 
         # give the client a certificate, but let's not require server authentication
         self.client_domain.set_credentials(self._testpath("client-certificate.pem"),
@@ -206,7 +206,7 @@ class SslTest(common.Test):
         self.server_domain.set_trusted_ca_db(self._testpath("ca-certificate.pem"))
         self.server_domain.set_peer_authentication( SSLDomain.VERIFY_PEER,
                                                     self._testpath("ca-certificate.pem") )
-        server = SslTest.SslTestConnection( self.server_domain )
+        server = SslTest.SslTestConnection( self.server_domain, mode=Transport.SERVER )
 
         self.client_domain.set_credentials(self._testpath("bad-server-certificate.pem"),
                                            self._testpath("bad-server-private-key.pem"),
@@ -234,7 +234,7 @@ class SslTest(common.Test):
         self.server_domain.set_trusted_ca_db(self._testpath("ca-certificate.pem"))
         self.server_domain.set_peer_authentication( SSLDomain.VERIFY_PEER,
                                                     self._testpath("ca-certificate.pem") )
-        server = SslTest.SslTestConnection( self.server_domain )
+        server = SslTest.SslTestConnection( self.server_domain, mode=Transport.SERVER )
 
         self.client_domain.set_peer_authentication( SSLDomain.ANONYMOUS_PEER )
         client = SslTest.SslTestConnection( self.client_domain )
@@ -263,7 +263,7 @@ class SslTest(common.Test):
         self.client_domain.set_trusted_ca_db(self._testpath("ca-certificate.pem"))
         self.client_domain.set_peer_authentication( SSLDomain.VERIFY_PEER )
 
-        server = SslTest.SslTestConnection( self.server_domain )
+        server = SslTest.SslTestConnection( self.server_domain, mode=Transport.SERVER )
         client = SslTest.SslTestConnection( self.client_domain )
 
         client.connection.open()
@@ -288,7 +288,7 @@ class SslTest(common.Test):
         self.client_domain.set_trusted_ca_db(self._testpath("ca-certificate.pem"))
         self.client_domain.set_peer_authentication( SSLDomain.VERIFY_PEER )
 
-        server = SslTest.SslTestConnection( self.server_domain )
+        server = SslTest.SslTestConnection( self.server_domain, mode=Transport.SERVER )
         client = SslTest.SslTestConnection( self.client_domain )
 
         client.connection.open()
@@ -311,7 +311,7 @@ class SslTest(common.Test):
         self.client_domain.set_trusted_ca_db(self._testpath("ca-certificate.pem"))
         self.client_domain.set_peer_authentication( SSLDomain.VERIFY_PEER )
 
-        server = SslTest.SslTestConnection( self.server_domain )
+        server = SslTest.SslTestConnection( self.server_domain, mode=Transport.SERVER )
         client = SslTest.SslTestConnection( self.client_domain )
 
         client.connection.open()
@@ -329,7 +329,7 @@ class SslTest(common.Test):
         self.client_domain.set_peer_authentication( SSLDomain.ANONYMOUS_PEER )
 
         client = SslTest.SslTestConnection( self.client_domain )
-        server = SslTest.SslTestConnection( self.server_domain )
+        server = SslTest.SslTestConnection( self.server_domain, mode=Transport.SERVER )
 
         client.connection.open()
         server.connection.open()
@@ -350,7 +350,7 @@ class SslTest(common.Test):
                                                     self._testpath("ca-certificate.pem") )
         # allow unsecured clients on this connection
         self.server_domain.allow_unsecured_client()
-        server = SslTest.SslTestConnection( self.server_domain )
+        server = SslTest.SslTestConnection( self.server_domain, mode=Transport.SERVER )
 
         # non-ssl connection
         client = SslTest.SslTestConnection()
@@ -385,7 +385,7 @@ class SslTest(common.Test):
 
         # client uses ssl. Server should detect this.
         client = SslTest.SslTestConnection( self.client_domain )
-        server = SslTest.SslTestConnection( self.server_domain )
+        server = SslTest.SslTestConnection( self.server_domain, mode=Transport.SERVER )
 
         client.connection.open()
         server.connection.open()
@@ -404,7 +404,7 @@ class SslTest(common.Test):
                                            "server-password")
         self.server_domain.set_trusted_ca_db(self._testpath("ca-certificate.pem"))
         self.server_domain.set_peer_authentication( SSLDomain.ANONYMOUS_PEER )
-        server = SslTest.SslTestConnection( self.server_domain )
+        server = SslTest.SslTestConnection( self.server_domain, mode=Transport.SERVER )
 
         # non-ssl connection
         client = SslTest.SslTestConnection()
@@ -431,8 +431,8 @@ class SslTest(common.Test):
         # details will be used in initial and subsequent connections to allow session to be resumed
         initial_session_details = SSLSessionDetails("my-session-id")
 
-        server = SslTest.SslTestConnection( self.server_domain )
-        client = SslTest.SslTestConnection( self.client_domain, initial_session_details )
+        server = SslTest.SslTestConnection( self.server_domain, mode=Transport.SERVER )
+        client = SslTest.SslTestConnection( self.client_domain, session_details=initial_session_details )
 
         # bring up the connection and store its state
         client.connection.open()
@@ -450,9 +450,9 @@ class SslTest(common.Test):
         del server
 
         # now create a new set of connections, use last session id
-        server = SslTest.SslTestConnection( self.server_domain )
+        server = SslTest.SslTestConnection( self.server_domain, mode=Transport.SERVER )
         # provide the details of the last session, allowing it to be resumed
-        client = SslTest.SslTestConnection( self.client_domain, initial_session_details )
+        client = SslTest.SslTestConnection( self.client_domain, session_details=initial_session_details )
 
         #client.transport.trace(Transport.TRACE_DRV)
         #server.transport.trace(Transport.TRACE_DRV)
@@ -477,8 +477,8 @@ class SslTest(common.Test):
         del client
         del server
 
-        server = SslTest.SslTestConnection( self.server_domain )
-        client = SslTest.SslTestConnection( self.client_domain, SSLSessionDetails("some-other-session-id") )
+        server = SslTest.SslTestConnection( self.server_domain, mode=Transport.SERVER )
+        client = SslTest.SslTestConnection( self.client_domain, session_details=SSLSessionDetails("some-other-session-id") )
 
         client.connection.open()
         server.connection.open()
@@ -509,7 +509,7 @@ class SslTest(common.Test):
         self.client_domain.set_peer_authentication( SSLDomain.VERIFY_PEER )
 
         max_count = 100
-        sessions = [(SslTest.SslTestConnection( self.server_domain ),
+        sessions = [(SslTest.SslTestConnection( self.server_domain, mode=Transport.SERVER ),
                      SslTest.SslTestConnection( self.client_domain )) for x in
                     range(max_count)]
         for s in sessions:
@@ -543,7 +543,7 @@ class SslTest(common.Test):
         self.client_domain.set_trusted_ca_db(self._testpath("ca-certificate.pem"))
         self.client_domain.set_peer_authentication( SSLDomain.VERIFY_PEER_NAME )
 
-        server = SslTest.SslTestConnection( self.server_domain )
+        server = SslTest.SslTestConnection( self.server_domain, mode=Transport.SERVER )
         client = SslTest.SslTestConnection( self.client_domain )
 
         client.ssl.peer_hostname = "a1.good.server.domain.com"
@@ -561,7 +561,7 @@ class SslTest(common.Test):
         self.client_domain.set_trusted_ca_db(self._testpath("ca-certificate.pem"))
         self.client_domain.set_peer_authentication( SSLDomain.VERIFY_PEER_NAME )
 
-        server = SslTest.SslTestConnection( self.server_domain )
+        server = SslTest.SslTestConnection( self.server_domain, mode=Transport.SERVER )
         client = SslTest.SslTestConnection( self.client_domain )
 
         client.ssl.peer_hostname = "A1.Good.Server.domain.comX"
@@ -589,7 +589,7 @@ class SslTest(common.Test):
         self.client_domain.set_trusted_ca_db(self._testpath("ca-certificate.pem"))
         self.client_domain.set_peer_authentication( SSLDomain.VERIFY_PEER_NAME )
 
-        server = SslTest.SslTestConnection( self.server_domain )
+        server = SslTest.SslTestConnection( self.server_domain, mode=Transport.SERVER )
         client = SslTest.SslTestConnection( self.client_domain )
 
         client.ssl.peer_hostname = "alternate.Name.one.com"
@@ -606,7 +606,7 @@ class SslTest(common.Test):
         self.client_domain.set_trusted_ca_db(self._testpath("ca-certificate.pem"))
         self.client_domain.set_peer_authentication( SSLDomain.VERIFY_PEER_NAME )
 
-        server = SslTest.SslTestConnection( self.server_domain )
+        server = SslTest.SslTestConnection( self.server_domain, mode=Transport.SERVER )
         client = SslTest.SslTestConnection( self.client_domain )
 
         client.ssl.peer_hostname = "ANOTHER.NAME.COM"
@@ -623,7 +623,7 @@ class SslTest(common.Test):
         self.client_domain.set_trusted_ca_db(self._testpath("ca-certificate.pem"))
         self.client_domain.set_peer_authentication( SSLDomain.VERIFY_PEER_NAME )
 
-        server = SslTest.SslTestConnection( self.server_domain )
+        server = SslTest.SslTestConnection( self.server_domain, mode=Transport.SERVER )
         client = SslTest.SslTestConnection( self.client_domain )
 
         client.ssl.peer_hostname = "SOME.PREfix.domain.COM"
@@ -640,7 +640,7 @@ class SslTest(common.Test):
         self.client_domain.set_trusted_ca_db(self._testpath("ca-certificate.pem"))
         self.client_domain.set_peer_authentication( SSLDomain.VERIFY_PEER_NAME )
 
-        server = SslTest.SslTestConnection( self.server_domain )
+        server = SslTest.SslTestConnection( self.server_domain, mode=Transport.SERVER )
         client = SslTest.SslTestConnection( self.client_domain )
 
         client.ssl.peer_hostname = "FOO.PREfixZZZ.domain.com"
@@ -657,7 +657,7 @@ class SslTest(common.Test):
         self.client_domain.set_trusted_ca_db(self._testpath("ca-certificate.pem"))
         self.client_domain.set_peer_authentication( SSLDomain.VERIFY_PEER_NAME )
 
-        server = SslTest.SslTestConnection( self.server_domain )
+        server = SslTest.SslTestConnection( self.server_domain, mode=Transport.SERVER )
         client = SslTest.SslTestConnection( self.client_domain )
 
         client.ssl.peer_hostname = "FOO.PREfi.domain.com"
@@ -678,7 +678,7 @@ class SslTest(common.Test):
         self.client_domain.set_trusted_ca_db(self._testpath("ca-certificate.pem"))
         self.client_domain.set_peer_authentication( SSLDomain.VERIFY_PEER_NAME )
 
-        server = SslTest.SslTestConnection( self.server_domain )
+        server = SslTest.SslTestConnection( self.server_domain, mode=Transport.SERVER )
         client = SslTest.SslTestConnection( self.client_domain )
 
         client.ssl.peer_hostname = "PREfix.domain.COM"


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