cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From egl...@apache.org
Subject svn commit: r503686 - in /incubator/cxf/trunk/rt/transports: http/src/main/java/org/apache/cxf/transport/https/ http/src/test/java/org/apache/cxf/transport/https/ http2/src/test/java/org/apache/cxf/transport/https/
Date Mon, 05 Feb 2007 14:03:58 GMT
Author: eglynn
Date: Mon Feb  5 06:03:58 2007
New Revision: 503686

URL: http://svn.apache.org/viewvc?view=rev&rev=503686
Log:
Temporarily overriding "home.dir" property to avoid JettySslListenerFactoryTest
failure when there's a pre-existing unrelated ~/.keystore file, also removing
spurious stack trace output.

Modified:
    incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/https/JettySslListenerFactory.java
    incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/https/JettySslListenerFactoryTest.java
    incubator/cxf/trunk/rt/transports/http2/src/test/java/org/apache/cxf/transport/https/JettySslConnectorFactoryTest.java

Modified: incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/https/JettySslListenerFactory.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/https/JettySslListenerFactory.java?view=diff&rev=503686&r1=503685&r2=503686
==============================================================================
--- incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/https/JettySslListenerFactory.java
(original)
+++ incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/https/JettySslListenerFactory.java
Mon Feb  5 06:03:58 2007
@@ -124,7 +124,6 @@
                                          LOG));
         } catch (Exception e) {
             LogUtils.log(LOG, Level.SEVERE, "SSL_CONTEXT_INIT_FAILURE", e);
-            e.printStackTrace();
         }
 
         SSLUtils.logUnSupportedPolicies(sslPolicy,

Modified: incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/https/JettySslListenerFactoryTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/https/JettySslListenerFactoryTest.java?view=diff&rev=503686&r1=503685&r2=503686
==============================================================================
--- incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/https/JettySslListenerFactoryTest.java
(original)
+++ incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/https/JettySslListenerFactoryTest.java
Mon Feb  5 06:03:58 2007
@@ -19,6 +19,7 @@
 
 package org.apache.cxf.transport.https;
 
+import java.io.File;
 import java.net.URL;
 import java.util.Properties;
 
@@ -206,11 +207,17 @@
         
         sslServerPolicy.setTrustStore(null);
         TestLogHandler handler = new TestLogHandler();
-        JettySslListenerFactory factory = createFactory(sslServerPolicy, 
-                                                        "https://dummyurl",
-                                                        handler);
+        JettySslListenerFactory factory = null;
+        String oldHome = overrideHome();
+        try {            
+            factory = createFactory(sslServerPolicy, 
+                                    "https://dummyurl",
+                                    handler);
 
-        factory.decorate(sslListener);
+            factory.decorate(sslListener);
+        } finally {
+            restoreHome(oldHome);
+        }
         
         assertTrue("Keystore not set properly, sslListener.getKeystore() = " + sslListener.getKeystore(),

                    sslListener.getKeystore().contains(".keystore"));
@@ -443,6 +450,21 @@
         return factory;
     }
     
+    private static String overrideHome() {
+        String oldHome = System.getProperty("user.home");
+        String tmpHome = "" + System.getProperty("java.io.tmpdir")
+                         + File.separator
+                         + System.getProperty("user.name")
+                         + File.separator
+                         + System.currentTimeMillis();
+        System.setProperty("user.home", tmpHome);
+        return oldHome;
+    }
+   
+    private static void restoreHome(String oldHome) {
+        System.setProperty("user.home", oldHome);
+    }
+
     protected static String getPath(String fileName) {
         URL keystoreURL = JettySslListenerFactoryTest.class.getResource(".");
         String str = keystoreURL.getFile(); 

Modified: incubator/cxf/trunk/rt/transports/http2/src/test/java/org/apache/cxf/transport/https/JettySslConnectorFactoryTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http2/src/test/java/org/apache/cxf/transport/https/JettySslConnectorFactoryTest.java?view=diff&rev=503686&r1=503685&r2=503686
==============================================================================
--- incubator/cxf/trunk/rt/transports/http2/src/test/java/org/apache/cxf/transport/https/JettySslConnectorFactoryTest.java
(original)
+++ incubator/cxf/trunk/rt/transports/http2/src/test/java/org/apache/cxf/transport/https/JettySslConnectorFactoryTest.java
Mon Feb  5 06:03:58 2007
@@ -19,6 +19,7 @@
 
 package org.apache.cxf.transport.https;
 
+import java.io.File;
 import java.net.URL;
 import java.util.Properties;
 
@@ -141,11 +142,17 @@
         String trustStoreStr = getPath("resources/defaulttruststore");
         sslServerPolicy.setTrustStore(trustStoreStr);
         TestLogHandler handler = new TestLogHandler();
-        JettySslConnectorFactory factory = createFactory(sslServerPolicy, 
-                                                        "https://dummyurl",
-                                                        handler);
+        JettySslConnectorFactory factory = null;
+        String oldHome = overrideHome();
+        try {            
+            factory = createFactory(sslServerPolicy, 
+                                    "https://dummyurl",
+                                    handler);
 
-        factory.decorate(sslConnector);
+            factory.decorate(sslConnector);
+        } finally {
+            restoreHome(oldHome);
+        }
         
         assertTrue("Keystore not set properly", 
                    sslConnector.getKeystore().contains("resources/defaultkeystore"));
@@ -295,6 +302,21 @@
             new JettySslConnectorFactory(policy);
         factory.addLogHandler(handler);
         return factory;
+    }
+    
+    private static String overrideHome() {
+        String oldHome = System.getProperty("user.home");
+        String tmpHome = "" + System.getProperty("java.io.tmpdir")
+                         + File.separator
+                         + System.getProperty("user.name")
+                         + File.separator
+                         + System.currentTimeMillis();
+        System.setProperty("user.home", tmpHome);
+        return oldHome;
+    }
+   
+    private static void restoreHome(String oldHome) {
+        System.setProperty("user.home", oldHome);
     }
     
     protected static String getPath(String fileName) {



Mime
View raw message