geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xuhaih...@apache.org
Subject svn commit: r1128139 - in /geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/test/java/org/apache/geronimo/jetty8: AbstractWebModuleTest.java ApplicationTest.java ContainerTest.java SecurityTest.java
Date Fri, 27 May 2011 02:14:44 GMT
Author: xuhaihong
Date: Fri May 27 02:14:44 2011
New Revision: 1128139

URL: http://svn.apache.org/viewvc?rev=1128139&view=rev
Log:
Use another port to avoid the binding issue on the Apache build environment

Modified:
    geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/test/java/org/apache/geronimo/jetty8/AbstractWebModuleTest.java
    geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/test/java/org/apache/geronimo/jetty8/ApplicationTest.java
    geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/test/java/org/apache/geronimo/jetty8/ContainerTest.java
    geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/test/java/org/apache/geronimo/jetty8/SecurityTest.java

Modified: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/test/java/org/apache/geronimo/jetty8/AbstractWebModuleTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/test/java/org/apache/geronimo/jetty8/AbstractWebModuleTest.java?rev=1128139&r1=1128138&r2=1128139&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/test/java/org/apache/geronimo/jetty8/AbstractWebModuleTest.java
(original)
+++ geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/test/java/org/apache/geronimo/jetty8/AbstractWebModuleTest.java
Fri May 27 02:14:44 2011
@@ -95,6 +95,8 @@ public class AbstractWebModuleTest exten
     protected SessionHandlerFactory sessionHandlerFactory = null;
     private Bundle bundle;
     protected String appPath;
+    protected int connectorPort = 1234;
+    protected String hostURL = "http://localhost:" + connectorPort;
 
     protected void setUpStaticContentServlet(WebAppInfo webAppInfo) throws Exception {
         ServletInfo servletInfo = new ServletInfo();
@@ -261,7 +263,7 @@ public class AbstractWebModuleTest exten
             null, new File(BASEDIR, "target/var/jetty").toString(), serverInfo);
         container.doStart();
         connector = new HTTPSocketConnector(container, null);
-        connector.setPort(5678);
+        connector.setPort(connectorPort);
         connector.setHost("localhost");
         connector.setMaxThreads(2);
         connector.doStart();

Modified: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/test/java/org/apache/geronimo/jetty8/ApplicationTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/test/java/org/apache/geronimo/jetty8/ApplicationTest.java?rev=1128139&r1=1128138&r2=1128139&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/test/java/org/apache/geronimo/jetty8/ApplicationTest.java
(original)
+++ geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/test/java/org/apache/geronimo/jetty8/ApplicationTest.java
Fri May 27 02:14:44 2011
@@ -51,7 +51,7 @@ public class ApplicationTest extends Abs
         setUpAppContext(null, null, "policyContextID", null, "war1/", webAppInfo);
 
 
-        HttpURLConnection connection = (HttpURLConnection) new URL("http://localhost:5678/test/hello.txt").openConnection();
+        HttpURLConnection connection = (HttpURLConnection) new URL(hostURL + "/test/hello.txt").openConnection();
         BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
         assertEquals(HttpURLConnection.HTTP_OK, connection.getResponseCode());
         assertEquals("Hello World", reader.readLine());
@@ -66,7 +66,7 @@ public class ApplicationTest extends Abs
 
         setUpAppContext(null, null, "policyContextID", null, "war1/", webAppInfo);
 
-        HttpURLConnection connection = (HttpURLConnection) new URL("http://localhost:5678/test/hello.txt").openConnection();
+        HttpURLConnection connection = (HttpURLConnection) new URL(hostURL + "/test/hello.txt").openConnection();
         BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
         assertEquals(HttpURLConnection.HTTP_OK, connection.getResponseCode());
         assertEquals("Hello World", reader.readLine());

Modified: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/test/java/org/apache/geronimo/jetty8/ContainerTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/test/java/org/apache/geronimo/jetty8/ContainerTest.java?rev=1128139&r1=1128138&r2=1128139&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/test/java/org/apache/geronimo/jetty8/ContainerTest.java
(original)
+++ geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/test/java/org/apache/geronimo/jetty8/ContainerTest.java
Fri May 27 02:14:44 2011
@@ -31,7 +31,7 @@ public class ContainerTest extends Abstr
 
     public void testHTTPConnector() throws Exception {
 
-        HttpURLConnection connection = (HttpURLConnection) new URL("http://localhost:5678").openConnection();
+        HttpURLConnection connection = (HttpURLConnection) new URL(hostURL).openConnection();
         try {
             connection.getInputStream();
             fail();
@@ -48,7 +48,7 @@ public class ContainerTest extends Abstr
         MockWebServiceContainer webServiceInvoker = new MockWebServiceContainer();
         container.addWebService(contextPath, null, webServiceInvoker, null, null, null, null,
null, cl);
 
-        HttpURLConnection connection = (HttpURLConnection) new URL("http://localhost:5678"
+ contextPath).openConnection();
+        HttpURLConnection connection = (HttpURLConnection) new URL(hostURL + contextPath).openConnection();
         try {
             BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
             assertEquals(HttpURLConnection.HTTP_OK, connection.getResponseCode());
@@ -57,7 +57,7 @@ public class ContainerTest extends Abstr
             connection.disconnect();
         }
         container.removeWebService(contextPath);
-        connection = (HttpURLConnection) new URL("http://localhost:5678" + contextPath).openConnection();
+        connection = (HttpURLConnection) new URL(hostURL + contextPath).openConnection();
         try {
             connection.getInputStream();
             fail();
@@ -77,7 +77,7 @@ public class ContainerTest extends Abstr
         MockWebServiceContainer webServiceInvoker2 = new MockWebServiceContainer();
         container.addWebService(contextPath2, null, webServiceInvoker2, null, null, null,
null, null, cl);
 
-        HttpURLConnection connection = (HttpURLConnection) new URL("http://localhost:5678"
+ contextPath).openConnection();
+        HttpURLConnection connection = (HttpURLConnection) new URL(hostURL + contextPath).openConnection();
         try {
             BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
             assertEquals(HttpURLConnection.HTTP_OK, connection.getResponseCode());
@@ -86,7 +86,7 @@ public class ContainerTest extends Abstr
             connection.disconnect();
         }
         container.removeWebService(contextPath);
-        connection = (HttpURLConnection) new URL("http://localhost:5678" + contextPath).openConnection();
+        connection = (HttpURLConnection) new URL(hostURL + contextPath).openConnection();
         try {
             connection.getInputStream();
             fail();

Modified: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/test/java/org/apache/geronimo/jetty8/SecurityTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/test/java/org/apache/geronimo/jetty8/SecurityTest.java?rev=1128139&r1=1128138&r2=1128139&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/test/java/org/apache/geronimo/jetty8/SecurityTest.java
(original)
+++ geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/test/java/org/apache/geronimo/jetty8/SecurityTest.java
Fri May 27 02:14:44 2011
@@ -84,7 +84,7 @@ public class SecurityTest extends Abstra
 
         startWebApp(roleDesignates, principalRoleMap, componentPermissions, defaultSubjectInfo,
permissions, securityRoles);
 
-        HttpURLConnection connection = (HttpURLConnection) new URL("http://localhost:5678/test/protected/hello.txt").openConnection();
+        HttpURLConnection connection = (HttpURLConnection) new URL(hostURL + "/test/protected/hello.txt").openConnection();
         connection.setInstanceFollowRedirects(false);
 //        assertEquals(HttpURLConnection.HTTP_MOVED_TEMP, connection.getResponseCode());
 
@@ -96,7 +96,7 @@ public class SecurityTest extends Abstra
 //        connection.setInstanceFollowRedirects(false);
 //        assertEquals(HttpURLConnection.HTTP_OK, connection.getResponseCode());
 
-        String location = "http://localhost:5678/test/protected/j_security_check?j_username=alan&j_password=starcraft";
+        String location = hostURL + "/test/protected/j_security_check?j_username=alan&j_password=starcraft";
 
         connection = (HttpURLConnection) new URL(location).openConnection();
         connection.setRequestMethod("POST");
@@ -104,7 +104,7 @@ public class SecurityTest extends Abstra
         connection.setInstanceFollowRedirects(false);
         assertEquals(HttpURLConnection.HTTP_MOVED_TEMP, connection.getResponseCode());
 
-        connection = (HttpURLConnection) new URL("http://localhost:5678/test/protected/hello.txt").openConnection();
+        connection = (HttpURLConnection) new URL(hostURL + "/test/protected/hello.txt").openConnection();
         connection.setRequestProperty("Cookie", cookie);
         connection.setInstanceFollowRedirects(false);
         BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
@@ -114,7 +114,7 @@ public class SecurityTest extends Abstra
         connection.disconnect();
 
         //make sure that leaving out the session id makes us try to login again.
-        connection = (HttpURLConnection) new URL("http://localhost:5678/test/protected/hello.txt").openConnection();
+        connection = (HttpURLConnection) new URL(hostURL + "/test/protected/hello.txt").openConnection();
         connection.setInstanceFollowRedirects(false);
 //        connection.setRequestProperty("Cookie", cookie);
 //        assertEquals(HttpURLConnection.HTTP_MOVED_TEMP, connection.getResponseCode());
@@ -128,7 +128,7 @@ public class SecurityTest extends Abstra
 //        connection.setInstanceFollowRedirects(false);
 //        assertEquals(HttpURLConnection.HTTP_OK, connection.getResponseCode());
 
-        location = "http://localhost:5678/test/protected/j_security_check?j_username=izumi&j_password=violin";
+        location = hostURL + "/test/protected/j_security_check?j_username=izumi&j_password=violin";
 
         connection = (HttpURLConnection) new URL(location).openConnection();
         connection.setRequestMethod("POST");
@@ -138,7 +138,7 @@ public class SecurityTest extends Abstra
 
         try {
             //izumi is not authorized for /protected/*
-            connection = (HttpURLConnection) new URL("http://localhost:5678/test/protected/hello.txt").openConnection();
+            connection = (HttpURLConnection) new URL(hostURL + "/test/protected/hello.txt").openConnection();
             connection.setRequestProperty("Cookie", cookie);
             connection.setInstanceFollowRedirects(false);
             reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));



Mime
View raw message