From 9aea1658dfed39444998c0aeb3c133f6c60fa34f Mon Sep 17 00:00:00 2001 From: Joakim Erdfelt Date: Thu, 10 Feb 2011 16:13:10 +0000 Subject: [PATCH] Updating reference to keystore to use MavenTestingUtils techniques instead. git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@2775 7e9141cc-0065-0410-87d8-b60c137991c4 --- .../ExternalKeyStoreAsyncSslHttpExchangeTest.java | 8 +++----- .../eclipse/jetty/client/ProxyTunnellingTest.java | 5 ++--- .../jetty/client/SslSecurityListenerTest.java | 3 +-- .../handler/ConnectHandlerConnectSSLTest.java | 14 ++++++-------- .../eclipse/jetty/server/ssl/SSLEngineTest.java | 8 ++------ .../jetty/server/ssl/SslRenegotiateTest.java | 6 +++--- 6 files changed, 17 insertions(+), 27 deletions(-) diff --git a/jetty-client/src/test/java/org/eclipse/jetty/client/ExternalKeyStoreAsyncSslHttpExchangeTest.java b/jetty-client/src/test/java/org/eclipse/jetty/client/ExternalKeyStoreAsyncSslHttpExchangeTest.java index a4a4f9e00c3..878b141646f 100644 --- a/jetty-client/src/test/java/org/eclipse/jetty/client/ExternalKeyStoreAsyncSslHttpExchangeTest.java +++ b/jetty-client/src/test/java/org/eclipse/jetty/client/ExternalKeyStoreAsyncSslHttpExchangeTest.java @@ -16,6 +16,8 @@ package org.eclipse.jetty.client; import java.io.File; import java.io.FileInputStream; +import org.eclipse.jetty.toolchain.test.MavenTestingUtils; + public class ExternalKeyStoreAsyncSslHttpExchangeTest extends SslHttpExchangeTest { @Override @@ -27,11 +29,7 @@ public class ExternalKeyStoreAsyncSslHttpExchangeTest extends SslHttpExchangeTes _httpClient.setConnectorType(HttpClient.CONNECTOR_SELECT_CHANNEL); _httpClient.setMaxConnectionsPerAddress(2); - String keystore = System.getProperty("user.dir") + File.separator + - "src" + File.separator + - "test" + File.separator + - "resources" + File.separator - + "keystore"; + String keystore = MavenTestingUtils.getTestResourceFile("keystore").getAbsolutePath(); _httpClient.setKeyStoreInputStream(new FileInputStream(keystore)); _httpClient.setKeyStorePassword("storepwd"); diff --git a/jetty-client/src/test/java/org/eclipse/jetty/client/ProxyTunnellingTest.java b/jetty-client/src/test/java/org/eclipse/jetty/client/ProxyTunnellingTest.java index ee79ab50ad6..6557f535f4c 100644 --- a/jetty-client/src/test/java/org/eclipse/jetty/client/ProxyTunnellingTest.java +++ b/jetty-client/src/test/java/org/eclipse/jetty/client/ProxyTunnellingTest.java @@ -22,6 +22,7 @@ import org.eclipse.jetty.server.handler.AbstractHandler; import org.eclipse.jetty.server.handler.ConnectHandler; import org.eclipse.jetty.server.nio.SelectChannelConnector; import org.eclipse.jetty.server.ssl.SslSelectChannelConnector; +import org.eclipse.jetty.toolchain.test.MavenTestingUtils; import org.junit.After; import org.junit.Test; @@ -39,9 +40,7 @@ public class ProxyTunnellingTest private void startSSLServer(Handler handler) throws Exception { SslSelectChannelConnector connector = new SslSelectChannelConnector(); - String keyStorePath = System.getProperty("basedir"); - assertNotNull(keyStorePath); - keyStorePath += File.separator + "src" + File.separator + "test" + File.separator + "resources" + File.separator + "keystore"; + String keyStorePath = MavenTestingUtils.getTestResourceFile("keystore").getAbsolutePath(); connector.setKeystore(keyStorePath); connector.setPassword("storepwd"); connector.setKeyPassword("keypwd"); diff --git a/jetty-client/src/test/java/org/eclipse/jetty/client/SslSecurityListenerTest.java b/jetty-client/src/test/java/org/eclipse/jetty/client/SslSecurityListenerTest.java index 230da1764a4..1bd6bd196c7 100644 --- a/jetty-client/src/test/java/org/eclipse/jetty/client/SslSecurityListenerTest.java +++ b/jetty-client/src/test/java/org/eclipse/jetty/client/SslSecurityListenerTest.java @@ -143,8 +143,7 @@ public class SslSecurityListenerTest extends TestCase //SslSelectChannelConnector connector = new SslSelectChannelConnector(); SslSocketConnector connector = new SslSocketConnector(); - String keystore = System.getProperty("user.dir") + File.separator + "src" + File.separator + "test" + File.separator + "resources" + File.separator - + "keystore"; + String keystore = MavenTestingUtils.getTestResourceFile("keystore").getAbsolutePath(); connector.setPort(0); connector.setKeystore(keystore); diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/handler/ConnectHandlerConnectSSLTest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/handler/ConnectHandlerConnectSSLTest.java index 27beaa328f5..4fc43b8633c 100644 --- a/jetty-server/src/test/java/org/eclipse/jetty/server/handler/ConnectHandlerConnectSSLTest.java +++ b/jetty-server/src/test/java/org/eclipse/jetty/server/handler/ConnectHandlerConnectSSLTest.java @@ -1,8 +1,10 @@ package org.eclipse.jetty.server.handler; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; + import java.io.BufferedReader; import java.io.ByteArrayOutputStream; -import java.io.File; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; @@ -11,6 +13,7 @@ import java.net.Socket; import java.security.SecureRandom; import java.security.cert.CertificateException; import java.security.cert.X509Certificate; + import javax.net.ssl.SSLContext; import javax.net.ssl.SSLSocket; import javax.net.ssl.SSLSocketFactory; @@ -23,12 +26,10 @@ import javax.servlet.http.HttpServletResponse; import org.eclipse.jetty.server.Request; import org.eclipse.jetty.server.ssl.SslSelectChannelConnector; +import org.eclipse.jetty.toolchain.test.MavenTestingUtils; import org.junit.BeforeClass; import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; - /** * @version $Revision$ $Date$ */ @@ -39,10 +40,7 @@ public class ConnectHandlerConnectSSLTest extends AbstractProxyHandlerTest { SslSelectChannelConnector connector = new SslSelectChannelConnector(); - String keyStorePath = System.getProperty("basedir"); - if (keyStorePath==null) - keyStorePath="."; - keyStorePath += File.separator + "src" + File.separator + "test" + File.separator + "resources" + File.separator + "keystore"; + String keyStorePath = MavenTestingUtils.getTestResourceFile("keystore").getAbsolutePath(); connector.setKeystore(keyStorePath); connector.setPassword("storepwd"); connector.setKeyPassword("keypwd"); diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/ssl/SSLEngineTest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/ssl/SSLEngineTest.java index b732fd10209..3bd6dd33c65 100644 --- a/jetty-server/src/test/java/org/eclipse/jetty/server/ssl/SSLEngineTest.java +++ b/jetty-server/src/test/java/org/eclipse/jetty/server/ssl/SSLEngineTest.java @@ -23,7 +23,6 @@ import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; import java.io.BufferedReader; -import java.io.File; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; @@ -49,6 +48,7 @@ import org.eclipse.jetty.server.Connector; import org.eclipse.jetty.server.Request; import org.eclipse.jetty.server.Server; import org.eclipse.jetty.server.handler.AbstractHandler; +import org.eclipse.jetty.toolchain.test.MavenTestingUtils; import org.eclipse.jetty.util.IO; import org.junit.AfterClass; import org.junit.BeforeClass; @@ -107,11 +107,7 @@ public class SSLEngineTest { server=new Server(); connector=new SslSelectChannelConnector(); - String keystore = System.getProperty("user.dir") + File.separator + - "src" + File.separator + - "test" + File.separator + - "resources" + File.separator + - "keystore"; + String keystore = MavenTestingUtils.getTestResourceFile("keystore").getAbsolutePath(); connector.setPort(0); connector.setKeystore(keystore); diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/ssl/SslRenegotiateTest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/ssl/SslRenegotiateTest.java index 3dbd10a13c3..b00ec51ccdc 100644 --- a/jetty-server/src/test/java/org/eclipse/jetty/server/ssl/SslRenegotiateTest.java +++ b/jetty-server/src/test/java/org/eclipse/jetty/server/ssl/SslRenegotiateTest.java @@ -3,7 +3,6 @@ package org.eclipse.jetty.server.ssl; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; -import java.io.File; import java.io.IOException; import java.net.InetSocketAddress; import java.net.SocketAddress; @@ -13,11 +12,11 @@ import java.nio.channels.SocketChannel; import javax.net.ssl.SSLContext; import javax.net.ssl.SSLEngine; import javax.net.ssl.SSLEngineResult; -import javax.net.ssl.SSLEngineResult.HandshakeStatus; import javax.net.ssl.SSLProtocolException; import javax.net.ssl.SSLSession; import javax.net.ssl.TrustManager; import javax.net.ssl.X509TrustManager; +import javax.net.ssl.SSLEngineResult.HandshakeStatus; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -27,6 +26,7 @@ import org.eclipse.jetty.server.Connector; import org.eclipse.jetty.server.Request; import org.eclipse.jetty.server.Server; import org.eclipse.jetty.server.handler.AbstractHandler; +import org.eclipse.jetty.toolchain.test.MavenTestingUtils; import org.eclipse.jetty.util.StringUtil; import org.eclipse.jetty.util.log.Log; import org.junit.Test; @@ -88,7 +88,7 @@ public class SslRenegotiateTest Server server=new Server(); try { - String keystore = System.getProperty("user.dir")+File.separator+"src"+File.separator+"test"+File.separator+"resources"+File.separator+"keystore"; + String keystore = MavenTestingUtils.getTestResourceFile("keystore").getAbsolutePath(); connector.setPort(0); connector.setKeystore(keystore); connector.setPassword("storepwd");