You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2013/08/16 16:39:30 UTC

svn commit: r1514735 - in /tomcat/tc7.0.x/trunk/modules/websocket/test/org/apache/tomcat/websocket: TestWebSocketFrameClient.java TestWsWebSocketContainer.java

Author: markt
Date: Fri Aug 16 14:39:29 2013
New Revision: 1514735

URL: http://svn.apache.org/r1514735
Log:
Back-porting JSR-356
Obtain absolute paths for SSL keystores etc. via the class loader rather than relying on using the current working directory.

Modified:
    tomcat/tc7.0.x/trunk/modules/websocket/test/org/apache/tomcat/websocket/TestWebSocketFrameClient.java
    tomcat/tc7.0.x/trunk/modules/websocket/test/org/apache/tomcat/websocket/TestWsWebSocketContainer.java

Modified: tomcat/tc7.0.x/trunk/modules/websocket/test/org/apache/tomcat/websocket/TestWebSocketFrameClient.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/modules/websocket/test/org/apache/tomcat/websocket/TestWebSocketFrameClient.java?rev=1514735&r1=1514734&r2=1514735&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/modules/websocket/test/org/apache/tomcat/websocket/TestWebSocketFrameClient.java (original)
+++ tomcat/tc7.0.x/trunk/modules/websocket/test/org/apache/tomcat/websocket/TestWebSocketFrameClient.java Fri Aug 16 14:39:29 2013
@@ -16,7 +16,9 @@
  */
 package org.apache.tomcat.websocket;
 
+import java.io.File;
 import java.net.URI;
+import java.net.URL;
 import java.util.List;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
@@ -52,6 +54,7 @@ public class TestWebSocketFrameClient ex
         Tomcat.addServlet(ctx, "default", new DefaultServlet());
         ctx.addServletMapping("/", "default");
 
+
         TesterSupport.initSsl(tomcat);
 
         tomcat.start();
@@ -60,9 +63,12 @@ public class TestWebSocketFrameClient ex
                 ContainerProvider.getWebSocketContainer();
         ClientEndpointConfig clientEndpointConfig =
                 ClientEndpointConfig.Builder.create().build();
+        URL truststoreUrl = this.getClass().getClassLoader().getResource(
+                "org/apache/tomcat/util/net/ca.jks");
+        File truststoreFile = new File(truststoreUrl.toURI());
         clientEndpointConfig.getUserProperties().put(
                 WsWebSocketContainer.SSL_TRUSTSTORE_PROPERTY,
-                "test/org/apache/tomcat/util/net/ca.jks");
+                truststoreFile.getAbsolutePath());
         Session wsSession = wsContainer.connectToServer(
                 TesterProgrammaticEndpoint.class,
                 clientEndpointConfig,

Modified: tomcat/tc7.0.x/trunk/modules/websocket/test/org/apache/tomcat/websocket/TestWsWebSocketContainer.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/modules/websocket/test/org/apache/tomcat/websocket/TestWsWebSocketContainer.java?rev=1514735&r1=1514734&r2=1514735&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/modules/websocket/test/org/apache/tomcat/websocket/TestWsWebSocketContainer.java (original)
+++ tomcat/tc7.0.x/trunk/modules/websocket/test/org/apache/tomcat/websocket/TestWsWebSocketContainer.java Fri Aug 16 14:39:29 2013
@@ -16,8 +16,10 @@
  */
 package org.apache.tomcat.websocket;
 
+import java.io.File;
 import java.net.SocketTimeoutException;
 import java.net.URI;
+import java.net.URL;
 import java.nio.ByteBuffer;
 import java.util.List;
 import java.util.Set;
@@ -790,9 +792,12 @@ public class TestWsWebSocketContainer ex
                 ContainerProvider.getWebSocketContainer();
         ClientEndpointConfig clientEndpointConfig =
                 ClientEndpointConfig.Builder.create().build();
+        URL truststoreUrl = this.getClass().getClassLoader().getResource(
+                "org/apache/tomcat/util/net/ca.jks");
+        File truststoreFile = new File(truststoreUrl.toURI());
         clientEndpointConfig.getUserProperties().put(
                 WsWebSocketContainer.SSL_TRUSTSTORE_PROPERTY,
-                "test/org/apache/tomcat/util/net/ca.jks");
+                truststoreFile.getAbsolutePath());
         Session wsSession = wsContainer.connectToServer(
                 TesterProgrammaticEndpoint.class,
                 clientEndpointConfig,



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org