Repository: ignite
Updated Branches:
  refs/heads/master 8cb691743 -> af2b74215


IGNITE-8129: MTCGA: setup default SSL context in JdbcthinConnectionSSLTest 
(because sometimes default SSL context may be setup by build system). This 
closes #3795.


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/af2b7421
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/af2b7421
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/af2b7421

Branch: refs/heads/master
Commit: af2b74215e8b0fc119537c6ba0a35977e0579b24
Parents: 8cb6917
Author: tledkov-gridgain <tled...@gridgain.com>
Authored: Mon Apr 16 11:28:39 2018 +0300
Committer: devozerov <voze...@gridgain.com>
Committed: Mon Apr 16 11:28:39 2018 +0300

----------------------------------------------------------------------
 .../jdbc/thin/JdbcThinConnectionSSLTest.java    | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/af2b7421/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinConnectionSSLTest.java
----------------------------------------------------------------------
diff --git 
a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinConnectionSSLTest.java
 
b/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinConnectionSSLTest.java
index cc71f51..355a198 100644
--- 
a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinConnectionSSLTest.java
+++ 
b/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinConnectionSSLTest.java
@@ -164,7 +164,14 @@ public class JdbcThinConnectionSSLTest extends 
JdbcThinAbstractSelfTest {
      * @throws Exception If failed.
      */
     public void testDefaultContext() throws Exception {
+        // Store exists default SSL context to restore after test.
+        final SSLContext dfltSslCtx = SSLContext.getDefault();
+
+        // Setup default context
+        SSLContext.setDefault(getTestSslContextFactory().create());
+
         setSslCtxFactoryToCli = true;
+
         // Factory return default SSL context
         sslCtxFactory = new Factory<SSLContext>() {
             @Override public SSLContext create() {
@@ -177,23 +184,16 @@ public class JdbcThinConnectionSSLTest extends 
JdbcThinAbstractSelfTest {
             }
         };
 
-        System.setProperty("javax.net.ssl.keyStore", CLI_KEY_STORE_PATH);
-        System.setProperty("javax.net.ssl.keyStorePassword", "123456");
-        System.setProperty("javax.net.ssl.trustStore", TRUST_KEY_STORE_PATH);
-        System.setProperty("javax.net.ssl.trustStorePassword", "123456");
-
         startGrids(1);
 
         try (Connection conn = 
DriverManager.getConnection("jdbc:ignite:thin://127.0.0.1/?sslMode=require")) {
             checkConnection(conn);
         }
         finally {
-            System.getProperties().remove("javax.net.ssl.keyStore");
-            System.getProperties().remove("javax.net.ssl.keyStorePassword");
-            System.getProperties().remove("javax.net.ssl.trustStore");
-            System.getProperties().remove("javax.net.ssl.trustStorePassword");
-
             stopAllGrids();
+
+            // Restore SSL context.
+            SSLContext.setDefault(dfltSslCtx);
         }
     }
 

Reply via email to