You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-commits@axis.apache.org by ve...@apache.org on 2017/01/14 17:49:48 UTC

svn commit: r1778812 - in /axis/axis2/java/rampart/branches/RAMPART-433: ./ modules/rampart-integration/src/main/java/org/apache/axis2/integration/ modules/rampart-integration/src/test/java/org/apache/rampart/

Author: veithen
Date: Sat Jan 14 17:49:47 2017
New Revision: 1778812

URL: http://svn.apache.org/viewvc?rev=1778812&view=rev
Log:
Merge latest changes from trunk.

Modified:
    axis/axis2/java/rampart/branches/RAMPART-433/   (props changed)
    axis/axis2/java/rampart/branches/RAMPART-433/modules/rampart-integration/src/main/java/org/apache/axis2/integration/JettyServer.java
    axis/axis2/java/rampart/branches/RAMPART-433/modules/rampart-integration/src/test/java/org/apache/rampart/AbstractRampartTest.java
    axis/axis2/java/rampart/branches/RAMPART-433/modules/rampart-integration/src/test/java/org/apache/rampart/RampartTest.java

Propchange: axis/axis2/java/rampart/branches/RAMPART-433/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Jan 14 17:49:47 2017
@@ -1 +1 @@
-/axis/axis2/java/rampart/trunk:1778760-1778793
+/axis/axis2/java/rampart/trunk:1778760-1778807

Modified: axis/axis2/java/rampart/branches/RAMPART-433/modules/rampart-integration/src/main/java/org/apache/axis2/integration/JettyServer.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/rampart/branches/RAMPART-433/modules/rampart-integration/src/main/java/org/apache/axis2/integration/JettyServer.java?rev=1778812&r1=1778811&r2=1778812&view=diff
==============================================================================
--- axis/axis2/java/rampart/branches/RAMPART-433/modules/rampart-integration/src/main/java/org/apache/axis2/integration/JettyServer.java (original)
+++ axis/axis2/java/rampart/branches/RAMPART-433/modules/rampart-integration/src/main/java/org/apache/axis2/integration/JettyServer.java Sat Jan 14 17:49:47 2017
@@ -38,37 +38,37 @@ public class JettyServer extends Externa
     /**
      * Keystore to configure for Jetty's ssl context factory: {@value}
      */
-    public static final String KEYSTORE = "target/test-resources/jetty/server.jks";
+    private static final String KEYSTORE = "target/test-resources/jetty/server.jks";
     
     /**
      * Keymanager password to configure for Jetty's ssl context factory: {@value
      */
-    public static final String KEYMAN_PASSWORD = "password";
+    private static final String KEYMAN_PASSWORD = "password";
     
     /**
      * Keystore password to configure for Jetty's ssl context factory: {@value} 
      */
-    public static final String KEYSTORE_PASSWORD = "password";
+    private static final String KEYSTORE_PASSWORD = "password";
     
     /**
      * The alias of the certificate to configure for Jetty's ssl context factory: {@value}
      */
-    public static final String CERT_ALIAS = "server";
+    private static final String CERT_ALIAS = "server";
     
     /**
      * Client keystore containing Jetty's server certificate as trusted certificate entry: : {@value}
      */
-    public static final String CLIENT_KEYSTORE = "target/test-resources/jetty/client.jks";
+    private static final String CLIENT_KEYSTORE = "target/test-resources/jetty/client.jks";
                     
     /**
      * Axis2 configuration file to use: {@value}
      */
-    public static final String AXIS2_XML = "src/test/resources/conf/axis2.xml";
+    private static final String AXIS2_XML = "src/test/resources/conf/axis2.xml";
     
     /**
      * Webapp resource base directory to use: {@value}
      */
-    public static final String WEBAPP_DIR = "target" + File.separator + "webapp";
+    private static final String WEBAPP_DIR = "target" + File.separator + "webapp";
     
     private static final Logger logger = LoggerFactory.getLogger(JettyServer.class);
     
@@ -76,6 +76,10 @@ public class JettyServer extends Externa
     private final int httpPort;
     private final int httpsPort;
     private Server server;
+    private boolean systemPropertiesSet;
+    private String savedTrustStore;
+    private String savedTrustStorePassword;
+    private String savedTrustStoreType;
     
     /**
      * Constructor.
@@ -142,6 +146,14 @@ public class JettyServer extends Externa
             if (connector != null) {
                 connector.setConfidentialPort(httpsPort);
             }
+            
+            savedTrustStore = System.getProperty("javax.net.ssl.trustStore");
+            System.setProperty("javax.net.ssl.trustStore", CLIENT_KEYSTORE);
+            savedTrustStorePassword = System.getProperty("javax.net.ssl.trustStorePassword");
+            System.setProperty("javax.net.ssl.trustStorePassword", KEYSTORE_PASSWORD);
+            savedTrustStoreType = System.getProperty("javax.net.ssl.trustStoreType");
+            System.setProperty("javax.net.ssl.trustStoreType", "JKS");
+            systemPropertiesSet = true;
         }
         
         WebAppContext context = new WebAppContext();
@@ -192,6 +204,27 @@ public class JettyServer extends Externa
             }
             server = null;
         }
+        if (systemPropertiesSet) {
+            if (savedTrustStore != null) {
+                System.setProperty("javax.net.ssl.trustStore", savedTrustStore);
+            } else {
+                System.clearProperty("javax.net.ssl.trustStore");
+            }
+            if (savedTrustStorePassword != null) {
+                System.setProperty("javax.net.ssl.trustStorePassword", savedTrustStorePassword);    
+            } else {
+                System.clearProperty("javax.net.ssl.trustStorePassword");
+            }
+            if (savedTrustStoreType != null) {
+                System.setProperty("javax.net.ssl.trustStoreType", savedTrustStoreType);
+            } else {
+                System.clearProperty("javax.net.ssl.trustStoreType");
+            }
+            savedTrustStore = null;
+            savedTrustStorePassword = null;
+            savedTrustStoreType = null;
+            systemPropertiesSet = false;
+        }
     }
 
     /**

Modified: axis/axis2/java/rampart/branches/RAMPART-433/modules/rampart-integration/src/test/java/org/apache/rampart/AbstractRampartTest.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/rampart/branches/RAMPART-433/modules/rampart-integration/src/test/java/org/apache/rampart/AbstractRampartTest.java?rev=1778812&r1=1778811&r2=1778812&view=diff
==============================================================================
--- axis/axis2/java/rampart/branches/RAMPART-433/modules/rampart-integration/src/test/java/org/apache/rampart/AbstractRampartTest.java (original)
+++ axis/axis2/java/rampart/branches/RAMPART-433/modules/rampart-integration/src/test/java/org/apache/rampart/AbstractRampartTest.java Sat Jan 14 17:49:47 2017
@@ -16,9 +16,6 @@
 
 package org.apache.rampart;
 
-import static org.apache.axis2.integration.JettyServer.CLIENT_KEYSTORE;
-import static org.apache.axis2.integration.JettyServer.KEYSTORE_PASSWORD;
-
 import java.net.URL;
 import java.util.MissingResourceException;
 import java.util.ResourceBundle;
@@ -35,8 +32,6 @@ import org.apache.axis2.integration.Jett
 import org.apache.axis2.transport.http.HTTPConstants;
 import org.apache.neethi.Policy;
 import org.apache.neethi.PolicyEngine;
-import org.junit.After;
-import org.junit.Before;
 import org.junit.Rule;
 
 /**
@@ -60,10 +55,6 @@ public abstract class AbstractRampartTes
     public final JettyServer server = new JettyServer(
             RAMPART_SERVICE_REPO_PATH, isEnableHttp() ? 0 : -1, isEnableHttps() ? 0 : -1);
     
-    protected String trustStore;
-    protected String trustStorePassword;
-    protected String trustStoreType;
-    
     static {
         try {
             resources = ResourceBundle.getBundle("org.apache.rampart.errors");
@@ -72,43 +63,6 @@ public abstract class AbstractRampartTes
         }
     }
 
-    @Before
-    public void setUp() throws Exception {
-        trustStore = System.getProperty("javax.net.ssl.trustStore");
-        System.setProperty("javax.net.ssl.trustStore", CLIENT_KEYSTORE);
-        
-        trustStorePassword = System.getProperty("javax.net.ssl.trustStorePassword");
-        System.setProperty("javax.net.ssl.trustStorePassword", KEYSTORE_PASSWORD);
-        
-        trustStoreType = System.getProperty("javax.net.ssl.trustStoreType");
-        System.setProperty("javax.net.ssl.trustStoreType", "JKS");
-    }
-    
-
-    @After
-    public void tearDown() throws Exception {
-        if (trustStore != null) {
-            System.setProperty("javax.net.ssl.trustStore", trustStore);
-        }
-        else {
-            System.clearProperty("javax.net.ssl.trustStore");
-        }
-        
-        if (trustStorePassword != null) {
-            System.setProperty("javax.net.ssl.trustStorePassword", trustStorePassword);    
-        }
-        else {
-            System.clearProperty("javax.net.ssl.trustStorePassword");
-        }
-        
-        if (trustStoreType != null) {
-            System.setProperty("javax.net.ssl.trustStoreType", trustStoreType);
-        }
-        else {
-            System.clearProperty("javax.net.ssl.trustStoreType");
-        }
-    }
-    
     protected ServiceClient getServiceClientInstance() throws AxisFault {
         return getServiceClientInstance(null);
     }

Modified: axis/axis2/java/rampart/branches/RAMPART-433/modules/rampart-integration/src/test/java/org/apache/rampart/RampartTest.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/rampart/branches/RAMPART-433/modules/rampart-integration/src/test/java/org/apache/rampart/RampartTest.java?rev=1778812&r1=1778811&r2=1778812&view=diff
==============================================================================
--- axis/axis2/java/rampart/branches/RAMPART-433/modules/rampart-integration/src/test/java/org/apache/rampart/RampartTest.java (original)
+++ axis/axis2/java/rampart/branches/RAMPART-433/modules/rampart-integration/src/test/java/org/apache/rampart/RampartTest.java Sat Jan 14 17:49:47 2017
@@ -16,8 +16,6 @@
 
 package org.apache.rampart;
 
-import static org.apache.axis2.integration.JettyServer.CLIENT_KEYSTORE;
-import static org.apache.axis2.integration.JettyServer.KEYSTORE_PASSWORD;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.fail;
 
@@ -38,15 +36,12 @@ import org.apache.axis2.context.ServiceC
 import org.apache.axis2.integration.JettyServer;
 import org.apache.neethi.Policy;
 import org.apache.neethi.PolicyEngine;
-import org.junit.After;
-import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
 
 import java.util.MissingResourceException;
 import java.util.ResourceBundle;
 
-
 public class RampartTest {
 
     private static ResourceBundle resources;
@@ -54,9 +49,6 @@ public class RampartTest {
     @Rule
     public final JettyServer server = new JettyServer(Constants.TESTING_PATH + "rampart_service_repo", 0, 0);
     
-    private String trustStore;
-    private String trustStorePassword;
-    private String trustStoreType;
     
     static {
         try {
@@ -66,43 +58,6 @@ public class RampartTest {
         }
     }
 
-    @Before
-    public void setUp() throws Exception {
-        trustStore = System.getProperty("javax.net.ssl.trustStore");
-        System.setProperty("javax.net.ssl.trustStore", CLIENT_KEYSTORE);
-        
-        trustStorePassword = System.getProperty("javax.net.ssl.trustStorePassword");
-        System.setProperty("javax.net.ssl.trustStorePassword", KEYSTORE_PASSWORD);
-        
-        trustStoreType = System.getProperty("javax.net.ssl.trustStoreType");
-        System.setProperty("javax.net.ssl.trustStoreType", "JKS");
-    }
-    
-
-    @After
-    public void tearDown() throws Exception {
-        if (trustStore != null) {
-            System.setProperty("javax.net.ssl.trustStore", trustStore);
-        }
-        else {
-            System.clearProperty("javax.net.ssl.trustStore");
-        }
-        
-        if (trustStorePassword != null) {
-            System.setProperty("javax.net.ssl.trustStorePassword", trustStorePassword);    
-        }
-        else {
-            System.clearProperty("javax.net.ssl.trustStorePassword");
-        }
-        
-        if (trustStoreType != null) {
-            System.setProperty("javax.net.ssl.trustStoreType", trustStoreType);
-        }
-        else {
-            System.clearProperty("javax.net.ssl.trustStoreType");
-        }
-    }
-
     private ServiceClient getServiceClientInstance() throws AxisFault {
 
         String repository = Constants.TESTING_PATH + "rampart_client_repo";