You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by kk...@apache.org on 2011/11/06 22:09:17 UTC

svn commit: r1198557 - in /tomcat/tc7.0.x/trunk/test/org/apache/catalina: ha/session/ loader/ mbeans/ servlets/ session/ util/ valves/

Author: kkolinko
Date: Sun Nov  6 21:09:16 2011
New Revision: 1198557

URL: http://svn.apache.org/viewvc?rev=1198557&view=rev
Log:
Porting r1187806 - whitespace cleanup in /test

Modified:
    tomcat/tc7.0.x/trunk/test/org/apache/catalina/ha/session/TestSerializablePrincipal.java
    tomcat/tc7.0.x/trunk/test/org/apache/catalina/ha/session/TesterPrincipal.java
    tomcat/tc7.0.x/trunk/test/org/apache/catalina/loader/TestVirtualWebappLoader.java
    tomcat/tc7.0.x/trunk/test/org/apache/catalina/loader/TestWebappClassLoaderMemoryLeak.java
    tomcat/tc7.0.x/trunk/test/org/apache/catalina/mbeans/TestRegistration.java
    tomcat/tc7.0.x/trunk/test/org/apache/catalina/servlets/TestDefaultServlet.java
    tomcat/tc7.0.x/trunk/test/org/apache/catalina/servlets/TestWebdavServlet.java
    tomcat/tc7.0.x/trunk/test/org/apache/catalina/session/Benchmarks.java
    tomcat/tc7.0.x/trunk/test/org/apache/catalina/session/Threading.java
    tomcat/tc7.0.x/trunk/test/org/apache/catalina/util/TestContextName.java
    tomcat/tc7.0.x/trunk/test/org/apache/catalina/util/TestRequestUtil.java
    tomcat/tc7.0.x/trunk/test/org/apache/catalina/util/TestServerInfo.java
    tomcat/tc7.0.x/trunk/test/org/apache/catalina/valves/Benchmarks.java
    tomcat/tc7.0.x/trunk/test/org/apache/catalina/valves/TestRemoteIpValve.java

Modified: tomcat/tc7.0.x/trunk/test/org/apache/catalina/ha/session/TestSerializablePrincipal.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/test/org/apache/catalina/ha/session/TestSerializablePrincipal.java?rev=1198557&r1=1198556&r2=1198557&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/test/org/apache/catalina/ha/session/TestSerializablePrincipal.java (original)
+++ tomcat/tc7.0.x/trunk/test/org/apache/catalina/ha/session/TestSerializablePrincipal.java Sun Nov  6 21:09:16 2011
@@ -53,7 +53,7 @@ public class TestSerializablePrincipal  
             e.printStackTrace();
             fail("ioe creating temporary file");
         }
-        
+
         // Create the Principal to serialize
         List<String> roles = new ArrayList<String>();
         roles.add("RoleA");
@@ -61,7 +61,7 @@ public class TestSerializablePrincipal  
         TesterPrincipal tpOriginal = new TesterPrincipal("inner");
         GenericPrincipal gpOriginal =
             new GenericPrincipal("usr", "pwd", roles, tpOriginal);
-        
+
         // Do the serialization
         try {
             FileOutputStream fos = new FileOutputStream(file);
@@ -76,7 +76,7 @@ public class TestSerializablePrincipal  
             e.printStackTrace();
             fail("ioe serializing principal");
         }
-        
+
         // De-serialize the Principal
         GenericPrincipal gpNew = null;
         try {
@@ -93,7 +93,7 @@ public class TestSerializablePrincipal  
             e.printStackTrace();
             fail("cnfe de-serializing principal");
         }
-        
+
         // Now test how similar original and de-serialized versions are
         assertEquals("User names different", gpOriginal.getName(),
                 gpNew.getName());

Modified: tomcat/tc7.0.x/trunk/test/org/apache/catalina/ha/session/TesterPrincipal.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/test/org/apache/catalina/ha/session/TesterPrincipal.java?rev=1198557&r1=1198556&r2=1198557&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/test/org/apache/catalina/ha/session/TesterPrincipal.java (original)
+++ tomcat/tc7.0.x/trunk/test/org/apache/catalina/ha/session/TesterPrincipal.java Sun Nov  6 21:09:16 2011
@@ -21,7 +21,7 @@ import java.io.Serializable;
 import java.security.Principal;
 
 public class TesterPrincipal implements Principal, Serializable {
-    
+
     private static final long serialVersionUID = 1L;
 
     private String name;
@@ -29,10 +29,10 @@ public class TesterPrincipal implements 
     public TesterPrincipal(String theName) {
         name = theName;
     }
-    
+
     @Override
     public String getName() {
         return name;
     }
-    
+
 }
\ No newline at end of file

Modified: tomcat/tc7.0.x/trunk/test/org/apache/catalina/loader/TestVirtualWebappLoader.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/test/org/apache/catalina/loader/TestVirtualWebappLoader.java?rev=1198557&r1=1198556&r2=1198557&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/test/org/apache/catalina/loader/TestVirtualWebappLoader.java (original)
+++ tomcat/tc7.0.x/trunk/test/org/apache/catalina/loader/TestVirtualWebappLoader.java Sun Nov  6 21:09:16 2011
@@ -41,13 +41,13 @@ public class TestVirtualWebappLoader ext
     @Test
     public void testStartInternal() throws Exception {
         Tomcat tomcat = getTomcatInstance();
-        File appDir = new File("test/webapp-3.0");      
+        File appDir = new File("test/webapp-3.0");
         // Must have a real docBase - just use temp
-        StandardContext ctx = 
+        StandardContext ctx =
             (StandardContext)tomcat.addContext("",  appDir.getAbsolutePath());
 
         VirtualWebappLoader loader = new VirtualWebappLoader();
-         
+
         loader.setContainer(ctx);
         ctx.setLoader(loader);
         ctx.setResources(new FileDirContext());
@@ -61,12 +61,12 @@ public class TestVirtualWebappLoader ext
         // ToDo: Why doesn't remove repositories?
         repos = loader.getRepositories();
         assertEquals(2, repos.length);
-        
+
         // no leak
         loader.start();
         repos = loader.getRepositories();
         assertEquals(2,repos.length);
-        
+
         // clear loader
         ctx.setLoader(null);
         // see tearDown()!

Modified: tomcat/tc7.0.x/trunk/test/org/apache/catalina/loader/TestWebappClassLoaderMemoryLeak.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/test/org/apache/catalina/loader/TestWebappClassLoaderMemoryLeak.java?rev=1198557&r1=1198556&r2=1198557&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/test/org/apache/catalina/loader/TestWebappClassLoaderMemoryLeak.java (original)
+++ tomcat/tc7.0.x/trunk/test/org/apache/catalina/loader/TestWebappClassLoaderMemoryLeak.java Sun Nov  6 21:09:16 2011
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -39,26 +39,26 @@ public class TestWebappClassLoaderMemory
     @Test
     public void testTimerThreadLeak() throws Exception {
         Tomcat tomcat = getTomcatInstance();
-        
+
         // Must have a real docBase - just use temp
-        Context ctx = 
+        Context ctx =
             tomcat.addContext("", System.getProperty("java.io.tmpdir"));
 
         if (ctx instanceof StandardContext) {
             ((StandardContext) ctx).setClearReferencesStopTimerThreads(true);
         }
-        
+
         Tomcat.addServlet(ctx, "taskServlet", new TaskServlet());
         ctx.addServletMapping("/", "taskServlet");
-        
+
         tomcat.start();
 
         // This will trigger the timer & thread creation
         getUrl("http://localhost:" + getPort() + "/");
-        
+
         // Stop the context
         ctx.stop();
-        
+
         // If the thread still exists, we have a thread/memory leak
         try {
             Thread.sleep(10);
@@ -73,19 +73,19 @@ public class TestWebappClassLoaderMemory
             }
         }
     }
-    
+
     /*
      * Get the set of current threads as an array.
      * Copied from WebappClassLoader
      */
     private Thread[] getThreads() {
-        // Get the current thread group 
+        // Get the current thread group
         ThreadGroup tg = Thread.currentThread( ).getThreadGroup( );
         // Find the root thread group
         while (tg.getParent() != null) {
             tg = tg.getParent();
         }
-        
+
         int threadCountGuess = tg.activeCount() + 50;
         Thread[] threads = new Thread[threadCountGuess];
         int threadCountActual = tg.enumerate(threads);
@@ -94,10 +94,10 @@ public class TestWebappClassLoaderMemory
             threadCountGuess *=2;
             threads = new Thread[threadCountGuess];
             // Note tg.enumerate(Thread[]) silently ignores any threads that
-            // can't fit into the array 
+            // can't fit into the array
             threadCountActual = tg.enumerate(threads);
         }
-        
+
         return threads;
     }
 
@@ -112,7 +112,7 @@ public class TestWebappClassLoaderMemory
             Timer timer = new Timer(TIMER_THREAD_NAME);
             timer.schedule(new LocalTask(), 0, 10000);
         }
-        
+
     }
 
     private static final class LocalTask extends TimerTask {
@@ -121,6 +121,6 @@ public class TestWebappClassLoaderMemory
         public void run() {
             // Doesn't actually need to do anything.
         }
-        
+
     }
 }

Modified: tomcat/tc7.0.x/trunk/test/org/apache/catalina/mbeans/TestRegistration.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/test/org/apache/catalina/mbeans/TestRegistration.java?rev=1198557&r1=1198556&r2=1198557&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/test/org/apache/catalina/mbeans/TestRegistration.java (original)
+++ tomcat/tc7.0.x/trunk/test/org/apache/catalina/mbeans/TestRegistration.java Sun Nov  6 21:09:16 2011
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -122,7 +122,7 @@ public class TestRegistration extends To
         }
         tomcat.addContext(contextName, contextDir.getAbsolutePath());
         tomcat.start();
-        
+
         // Verify there are no Catalina MBeans
         onames = mbeanServer.queryNames(new ObjectName("Catalina:*"), null);
         assertEquals("Found: " + onames, 0, onames.size());
@@ -177,7 +177,7 @@ public class TestRegistration extends To
             fail("Failed to create: [" + contextDir2.toString() + "]");
         }
         tomcat.addContext(host, contextName + "2", contextDir2.getAbsolutePath());
-        
+
         tomcat.start();
         tomcat.stop();
         tomcat.destroy();
@@ -188,5 +188,5 @@ public class TestRegistration extends To
         onames = mbeanServer.queryNames(new ObjectName("Tomcat:*"), null);
         assertEquals("Remaining: " + onames, 0, onames.size());
     }
-    
+
 }

Modified: tomcat/tc7.0.x/trunk/test/org/apache/catalina/servlets/TestDefaultServlet.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/test/org/apache/catalina/servlets/TestDefaultServlet.java?rev=1198557&r1=1198556&r2=1198557&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/test/org/apache/catalina/servlets/TestDefaultServlet.java (original)
+++ tomcat/tc7.0.x/trunk/test/org/apache/catalina/servlets/TestDefaultServlet.java Sun Nov  6 21:09:16 2011
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -48,42 +48,42 @@ public class TestDefaultServlet extends 
 
     /**
      * Test attempting to access special paths (WEB-INF/META-INF) using
-     * DefaultServlet. 
+     * DefaultServlet.
      */
     @Test
     public void testGetSpecials() throws Exception {
         Tomcat tomcat = getTomcatInstance();
-        
+
         String contextPath = "/examples";
-        
+
         File appDir = new File(getBuildDirectory(), "webapps" + contextPath);
         // app dir is relative to server home
         tomcat.addWebapp(null, "/examples", appDir.getAbsolutePath());
-        
+
         tomcat.start();
-        
+
         final ByteChunk res = new ByteChunk();
-        
+
         int rc =getUrl("http://localhost:" + getPort() + contextPath +
                 "/WEB-INF/web.xml", res, null);
         assertEquals(HttpServletResponse.SC_NOT_FOUND, rc);
-        
+
         rc =getUrl("http://localhost:" + getPort() + contextPath +
                 "/WEB-INF/doesntexistanywhere", res, null);
         assertEquals(HttpServletResponse.SC_NOT_FOUND, rc);
-         
+
         rc =getUrl("http://localhost:" + getPort() + contextPath +
                 "/WEB-INF/", res, null);
         assertEquals(HttpServletResponse.SC_NOT_FOUND, rc);
-         
+
         rc =getUrl("http://localhost:" + getPort() + contextPath +
                 "/META-INF/MANIFEST.MF", res, null);
         assertEquals(HttpServletResponse.SC_NOT_FOUND, rc);
-        
+
         rc =getUrl("http://localhost:" + getPort() + contextPath +
                 "/META-INF/doesntexistanywhere", res, null);
         assertEquals(HttpServletResponse.SC_NOT_FOUND, rc);
-        
+
     }
 
     /**
@@ -93,67 +93,67 @@ public class TestDefaultServlet extends 
     @Test
     public void testGetWithSubpathmount() throws Exception {
         Tomcat tomcat = getTomcatInstance();
-        
+
         String contextPath = "/examples";
-        
+
         File appDir = new File(getBuildDirectory(), "webapps" + contextPath);
         // app dir is relative to server home
         org.apache.catalina.Context ctx =
             tomcat.addWebapp(null, "/examples", appDir.getAbsolutePath());
-        
+
         // Override the default servlet with our own mappings
         Tomcat.addServlet(ctx, "default2", new DefaultServlet());
         ctx.addServletMapping("/", "default2");
         ctx.addServletMapping("/servlets/*", "default2");
         ctx.addServletMapping("/static/*", "default2");
-        
+
         tomcat.start();
-        
+
         final ByteChunk res = new ByteChunk();
-        
+
         // Make sure DefaultServlet isn't exposing special directories
         // by remounting the webapp under a sub-path
-        
+
         int rc =getUrl("http://localhost:" + getPort() + contextPath +
                 "/static/WEB-INF/web.xml", res, null);
-        
+
         assertEquals(HttpServletResponse.SC_NOT_FOUND, rc);
         rc =getUrl("http://localhost:" + getPort() + contextPath +
                 "/static/WEB-INF/doesntexistanywhere", res, null);
         assertEquals(HttpServletResponse.SC_NOT_FOUND, rc);
-         
+
         assertEquals(HttpServletResponse.SC_NOT_FOUND, rc);
         rc =getUrl("http://localhost:" + getPort() + contextPath +
                 "/static/WEB-INF/", res, null);
         assertEquals(HttpServletResponse.SC_NOT_FOUND, rc);
-         
+
         rc =getUrl("http://localhost:" + getPort() + contextPath +
                 "/static/META-INF/MANIFEST.MF", res, null);
         assertEquals(HttpServletResponse.SC_NOT_FOUND, rc);
-        
+
         rc =getUrl("http://localhost:" + getPort() + contextPath +
                 "/static/META-INF/doesntexistanywhere", res, null);
         assertEquals(HttpServletResponse.SC_NOT_FOUND, rc);
-        
-        // Make sure DefaultServlet is serving resources relative to the 
+
+        // Make sure DefaultServlet is serving resources relative to the
         // context root regardless of where the it is mapped
-        
+
         final ByteChunk rootResource = new ByteChunk();
         rc =getUrl("http://localhost:" + getPort() + contextPath +
                 "/index.html", rootResource, null);
         assertEquals(HttpServletResponse.SC_OK, rc);
-        
+
         final ByteChunk subpathResource = new ByteChunk();
         rc =getUrl("http://localhost:" + getPort() + contextPath +
                 "/servlets/index.html", subpathResource, null);
         assertEquals(HttpServletResponse.SC_OK, rc);
-        
+
         assertFalse(rootResource.toString().equals(subpathResource.toString()));
-        
+
         rc =getUrl("http://localhost:" + getPort() + contextPath +
                 "/static/index.html", res, null);
         assertEquals(HttpServletResponse.SC_NOT_FOUND, rc);
-        
+
     }
 
     /**

Modified: tomcat/tc7.0.x/trunk/test/org/apache/catalina/servlets/TestWebdavServlet.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/test/org/apache/catalina/servlets/TestWebdavServlet.java?rev=1198557&r1=1198556&r2=1198557&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/test/org/apache/catalina/servlets/TestWebdavServlet.java (original)
+++ tomcat/tc7.0.x/trunk/test/org/apache/catalina/servlets/TestWebdavServlet.java Sun Nov  6 21:09:16 2011
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -34,46 +34,46 @@ import org.apache.tomcat.util.buf.ByteCh
 public class TestWebdavServlet extends TomcatBaseTest {
 
     /**
-     * Test attempting to access special paths (WEB-INF/META-INF) using WebdavServlet 
+     * Test attempting to access special paths (WEB-INF/META-INF) using WebdavServlet
      */
     @Test
     public void testGetSpecials() throws Exception {
         Tomcat tomcat = getTomcatInstance();
-        
+
         String contextPath = "/examples";
-        
+
         File appDir = new File(getBuildDirectory(), "webapps" + contextPath);
         // app dir is relative to server home
         org.apache.catalina.Context ctx =
             tomcat.addWebapp(null, "/examples", appDir.getAbsolutePath());
-        
+
         Tomcat.addServlet(ctx, "webdav", new WebdavServlet());
         ctx.addServletMapping("/*", "webdav");
-        
+
         tomcat.start();
-        
+
         final ByteChunk res = new ByteChunk();
-        
+
         int rc =getUrl("http://localhost:" + getPort() + contextPath +
                 "/WEB-INF/web.xml", res, null);
         assertEquals(HttpServletResponse.SC_NOT_FOUND, rc);
-        
+
         rc =getUrl("http://localhost:" + getPort() + contextPath +
                 "/WEB-INF/doesntexistanywhere", res, null);
         assertEquals(HttpServletResponse.SC_NOT_FOUND, rc);
-         
+
         rc =getUrl("http://localhost:" + getPort() + contextPath +
                 "/WEB-INF/", res, null);
         assertEquals(HttpServletResponse.SC_NOT_FOUND, rc);
-         
+
         rc =getUrl("http://localhost:" + getPort() + contextPath +
                 "/META-INF/MANIFEST.MF", res, null);
         assertEquals(HttpServletResponse.SC_NOT_FOUND, rc);
-        
+
         rc =getUrl("http://localhost:" + getPort() + contextPath +
                 "/META-INF/doesntexistanywhere", res, null);
         assertEquals(HttpServletResponse.SC_NOT_FOUND, rc);
-        
+
     }
 
     /**
@@ -83,63 +83,63 @@ public class TestWebdavServlet extends T
     @Test
     public void testGetWithSubpathmount() throws Exception {
         Tomcat tomcat = getTomcatInstance();
-        
+
         String contextPath = "/examples";
-        
+
         File appDir = new File(getBuildDirectory(), "webapps" + contextPath);
         // app dir is relative to server home
         org.apache.catalina.Context ctx =
             tomcat.addWebapp(null, "/examples", appDir.getAbsolutePath());
-        
+
         Tomcat.addServlet(ctx, "webdav", new WebdavServlet());
         ctx.addServletMapping("/webdav/*", "webdav");
-        
+
         tomcat.start();
-        
+
         final ByteChunk res = new ByteChunk();
-        
+
         // Make sure WebdavServlet isn't exposing special directories
         // by remounting the webapp under a sub-path
-        
+
         int rc =getUrl("http://localhost:" + getPort() + contextPath +
                 "/webdav/WEB-INF/web.xml", res, null);
-        
+
         assertEquals(HttpServletResponse.SC_NOT_FOUND, rc);
         rc =getUrl("http://localhost:" + getPort() + contextPath +
                 "/webdav/WEB-INF/doesntexistanywhere", res, null);
         assertEquals(HttpServletResponse.SC_NOT_FOUND, rc);
-         
+
         assertEquals(HttpServletResponse.SC_NOT_FOUND, rc);
         rc =getUrl("http://localhost:" + getPort() + contextPath +
                 "/webdav/WEB-INF/", res, null);
         assertEquals(HttpServletResponse.SC_NOT_FOUND, rc);
-         
+
         rc =getUrl("http://localhost:" + getPort() + contextPath +
                 "/webdav/META-INF/MANIFEST.MF", res, null);
         assertEquals(HttpServletResponse.SC_NOT_FOUND, rc);
-        
+
         rc =getUrl("http://localhost:" + getPort() + contextPath +
                 "/webdav/META-INF/doesntexistanywhere", res, null);
         assertEquals(HttpServletResponse.SC_NOT_FOUND, rc);
-        
-        // Make sure WebdavServlet is serving resources         
+
+        // Make sure WebdavServlet is serving resources
         // relative to the map/mount point
         final ByteChunk rootResource = new ByteChunk();
         rc =getUrl("http://localhost:" + getPort() + contextPath +
                 "/index.html", rootResource, null);
         assertEquals(HttpServletResponse.SC_OK, rc);
-        
+
         final ByteChunk subpathResource = new ByteChunk();
         rc =getUrl("http://localhost:" + getPort() + contextPath +
                 "/webdav/index.html", subpathResource, null);
         assertEquals(HttpServletResponse.SC_OK, rc);
-        
+
         assertEquals(rootResource.toString(), subpathResource.toString());
-        
+
         rc =getUrl("http://localhost:" + getPort() + contextPath +
                 "/webdav/static/index.html", res, null);
         assertEquals(HttpServletResponse.SC_NOT_FOUND, rc);
-        
+
     }
 
     public static int getUrl(String path, ByteChunk out,

Modified: tomcat/tc7.0.x/trunk/test/org/apache/catalina/session/Benchmarks.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/test/org/apache/catalina/session/Benchmarks.java?rev=1198557&r1=1198556&r2=1198557&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/test/org/apache/catalina/session/Benchmarks.java (original)
+++ tomcat/tc7.0.x/trunk/test/org/apache/catalina/session/Benchmarks.java Sun Nov  6 21:09:16 2011
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -42,7 +42,7 @@ public class Benchmarks {
      *  2 threads -  ~2,100ms
      *  4 threads -  ~3,100ms
      * 16 threads - ~14,700ms
-     * 
+     *
      * Results on markt's 2-core OSX dev box
      *  1 thread  -   ~1,400ms
      *  2 threads -   ~1,700ms
@@ -65,8 +65,8 @@ public class Benchmarks {
         doTestManagerBaseGenerateSessionId(100, 100000);
         doTestManagerBaseGenerateSessionId(400, 10000);
     }
-    
-    
+
+
     private void doTestManagerBaseGenerateSessionId(int threadCount,
             int iterCount) throws Exception {
 
@@ -87,16 +87,16 @@ public class Benchmarks {
             mgr.sessionExpirationTiming.add(null);
         }
 
-        
+
         Thread[] threads = new Thread[threadCount];
-        
+
         for (int i = 0; i < threadCount; i++) {
             threads[i] = new Thread(
                     new TestThreadGenerateSessionId(mgr, iterCount));
         }
-        
+
         long start = System.currentTimeMillis();
-        
+
         for (int i = 0; i < threadCount; i++) {
             threads[i].start();
         }
@@ -109,7 +109,7 @@ public class Benchmarks {
             }
         }
         long end = System.currentTimeMillis();
-        
+
         StringBuilder result = new StringBuilder();
         result.append("Threads: ");
         result.append(threadCount);
@@ -117,13 +117,13 @@ public class Benchmarks {
         result.append(end-start);
         System.out.println(result.toString());
     }
-    
-    
+
+
     private static final class TestThreadGenerateSessionId implements Runnable {
 
         private ManagerBase mgr;
         private int count;
-        
+
         public TestThreadGenerateSessionId(ManagerBase mgr, int count) {
             this.mgr = mgr;
             this.count = count;
@@ -137,14 +137,14 @@ public class Benchmarks {
         }
     }
 
-    
+
     /*
      * Results on markt's 4-core Windows dev box
      *  1 thread  -  ~3,800ms
      *  2 threads -  ~6,700ms
      *  4 threads - ~11,000ms
      * 16 threads - ~43,500ms
-     * 
+     *
      * Results on markt's 2-core OSX dev box
      *  1 thread  -  ~4,100ms
      *  2 threads -  ~5,700ms
@@ -161,8 +161,8 @@ public class Benchmarks {
         doTestManagerBaseCreateSession(100, 100000);
         doTestManagerBaseCreateSession(400, 10000);
     }
-    
-    
+
+
     private void doTestManagerBaseCreateSession(int threadCount,
             int iterCount) {
 
@@ -185,14 +185,14 @@ public class Benchmarks {
         }
 
         Thread[] threads = new Thread[threadCount];
-        
+
         for (int i = 0; i < threadCount; i++) {
             threads[i] = new Thread(
                     new TestThreadCreateSession(mgr, iterCount));
         }
-        
+
         long start = System.currentTimeMillis();
-        
+
         for (int i = 0; i < threadCount; i++) {
             threads[i].start();
         }
@@ -205,7 +205,7 @@ public class Benchmarks {
             }
         }
         long end = System.currentTimeMillis();
-        
+
         StringBuilder result = new StringBuilder();
         result.append("Threads: ");
         result.append(threadCount);
@@ -213,12 +213,12 @@ public class Benchmarks {
         result.append(end-start);
         System.out.println(result.toString());
     }
-    
+
     private static final class TestThreadCreateSession implements Runnable {
 
         private ManagerBase mgr;
         private int count;
-        
+
         public TestThreadCreateSession(ManagerBase mgr, int count) {
             this.mgr = mgr;
             this.count = count;
@@ -232,18 +232,18 @@ public class Benchmarks {
             }
         }
     }
-    
-    
+
+
     /*
      * SecureRandom vs. reading /dev/urandom. Very different performance noted
      * on some platforms.
-     * 
+     *
      * Results on markt's 4-core Windows dev box
      *              SecureRandom  /dev/urandom
      *  1 thread  -    ~766ms        N/A
      *  2 threads -    ~843ms        N/A
      *  4 threads -    ~766ms        N/A
-     *  
+     *
      * Results on markt's 2-core OSX dev box
      *              SecureRandom  /dev/urandom
      *  1 thread  -     ~759ms      ~3,500ms
@@ -267,7 +267,7 @@ public class Benchmarks {
             int iterCount, boolean useSecureRandom) throws Exception {
 
         Thread[] threads = new Thread[threadCount];
-        
+
         for (int i = 0; i < threadCount; i++) {
             if (useSecureRandom) {
                 threads[i] = new Thread(new TestThreadSecureRandom(iterCount));
@@ -275,9 +275,9 @@ public class Benchmarks {
                 threads[i] = new Thread(new TestThreadDevUrandom(iterCount));
             }
         }
-        
+
         long start = System.currentTimeMillis();
-        
+
         for (int i = 0; i < threadCount; i++) {
             threads[i].start();
         }
@@ -290,7 +290,7 @@ public class Benchmarks {
             }
         }
         long end = System.currentTimeMillis();
-        
+
         StringBuilder result = new StringBuilder();
         if (useSecureRandom) {
             result.append("SecureRandom ");
@@ -305,11 +305,11 @@ public class Benchmarks {
     }
 
     private static final class TestThreadSecureRandom implements Runnable {
-        
+
         private SecureRandom secureRandom;
         private byte[] bytes = new byte[16];
         private int count;
-        
+
         TestThreadSecureRandom(int iterCount) throws Exception {
             this.count = iterCount;
             this.secureRandom = SecureRandom.getInstance("SHA1PRNG");
@@ -321,15 +321,15 @@ public class Benchmarks {
                 secureRandom.nextBytes(bytes);
             }
         }
-        
+
     }
-    
+
     private static final class TestThreadDevUrandom implements Runnable {
-        
+
         private InputStream is;
         private byte[] bytes = new byte[16];
         private int count;
-        
+
         TestThreadDevUrandom(int iterCount) {
             try {
                 is = new FileInputStream("/dev/urandom");

Modified: tomcat/tc7.0.x/trunk/test/org/apache/catalina/session/Threading.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/test/org/apache/catalina/session/Threading.java?rev=1198557&r1=1198556&r2=1198557&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/test/org/apache/catalina/session/Threading.java (original)
+++ tomcat/tc7.0.x/trunk/test/org/apache/catalina/session/Threading.java Sun Nov  6 21:09:16 2011
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -29,7 +29,7 @@ import org.junit.Test;
  * a number of classes. In some cases the Javadoc is unclear on the
  * thread-safety of a class. These tests were written to test the thread-safety
  * of key classes.
- * 
+ *
  * Named Threading so it is not automatically executed as part of the unit
  * tests.
  */
@@ -38,12 +38,12 @@ public class Threading {
     /**
      * {@link FileInputStream#read(byte[])} and related methods are all native
      * methods so it isn't immediately obvious if they are thread-safe or not.
-     * 
+     *
      * <pre>
      * Windows JDK 1.6.0_22_x64 - Thread safe
      * OSX     JDK 1.6.0_22_x64 - Not thread safe
      * </pre>
-     * 
+     *
      * Therefore, have to assume that {@link FileInputStream#read(byte[])} is
      * not thread safe.
      */
@@ -56,24 +56,24 @@ public class Threading {
     }
 
     public void doTestFileInputStream(int threadCount) throws Exception {
-        
+
         // Assumes "ant release" has been run
         // Will need to be updated as new releases are made
         File file = new File(
                 "./output/release/v7.0.20-dev/bin/apache-tomcat-7.0.20-dev.zip");
-        
+
         FileInputStream fis = new FileInputStream(file);
-        
+
         Thread[] threads = new Thread[threadCount];
         FisReaderThread[] runnables = new FisReaderThread[threadCount];
-        
+
         for (int i = 0; i < threadCount; i++) {
             runnables[i] = new FisReaderThread(fis);
             threads[i] = new Thread(runnables[i]);
         }
-        
+
         long start = System.currentTimeMillis();
-        
+
         for (int i = 0; i < threadCount; i++) {
             threads[i].start();
         }
@@ -89,7 +89,7 @@ public class Threading {
             }
         }
         long end = System.currentTimeMillis();
-        
+
         long byteCount = 0;
         for (int i = 0; i < threadCount; i++) {
             byteCount += runnables[i].getByteCount();
@@ -135,11 +135,11 @@ public class Threading {
                 }
             }
         }
-        
+
         public long getByteCount() {
             return byteCount;
         }
-        
+
         public boolean isfailed() {
             return fail;
         }

Modified: tomcat/tc7.0.x/trunk/test/org/apache/catalina/util/TestContextName.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/test/org/apache/catalina/util/TestContextName.java?rev=1198557&r1=1198556&r2=1198557&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/test/org/apache/catalina/util/TestContextName.java (original)
+++ tomcat/tc7.0.x/trunk/test/org/apache/catalina/util/TestContextName.java Sun Nov  6 21:09:16 2011
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -40,7 +40,7 @@ public class TestContextName {
     private ContextName cn14;
     private ContextName cn15;
     private ContextName cn16;
-    
+
     @Before
     public void setUp() throws Exception {
         cn1 = new ContextName(null, null);
@@ -186,7 +186,7 @@ public class TestContextName {
         doCompare(src, new ContextName(src.getDisplayName()));
         doCompare(src, new ContextName(src.getName()));
     }
-    
+
     private void doCompare(ContextName cn1, ContextName cn2) {
         assertEquals(cn1.getBaseName(), cn2.getBaseName());
         assertEquals(cn1.getDisplayName(), cn2.getDisplayName());

Modified: tomcat/tc7.0.x/trunk/test/org/apache/catalina/util/TestRequestUtil.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/test/org/apache/catalina/util/TestRequestUtil.java?rev=1198557&r1=1198556&r2=1198557&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/test/org/apache/catalina/util/TestRequestUtil.java (original)
+++ tomcat/tc7.0.x/trunk/test/org/apache/catalina/util/TestRequestUtil.java Sun Nov  6 21:09:16 2011
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -52,7 +52,7 @@ public class TestRequestUtil {
         }
         assertTrue(exception instanceof IllegalArgumentException);
     }
-    
+
     @Test
     public void testURLDecodeStringValidIso88591Start() {
 

Modified: tomcat/tc7.0.x/trunk/test/org/apache/catalina/util/TestServerInfo.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/test/org/apache/catalina/util/TestServerInfo.java?rev=1198557&r1=1198556&r2=1198557&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/test/org/apache/catalina/util/TestServerInfo.java (original)
+++ tomcat/tc7.0.x/trunk/test/org/apache/catalina/util/TestServerInfo.java Sun Nov  6 21:09:16 2011
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -22,7 +22,7 @@ import org.junit.Test;
 public class TestServerInfo {
 
     /**
-     * Test that prints the server version info. 
+     * Test that prints the server version info.
      */
     @Test
     public void testServerInfo() {

Modified: tomcat/tc7.0.x/trunk/test/org/apache/catalina/valves/Benchmarks.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/test/org/apache/catalina/valves/Benchmarks.java?rev=1198557&r1=1198556&r2=1198557&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/test/org/apache/catalina/valves/Benchmarks.java (original)
+++ tomcat/tc7.0.x/trunk/test/org/apache/catalina/valves/Benchmarks.java Sun Nov  6 21:09:16 2011
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

Modified: tomcat/tc7.0.x/trunk/test/org/apache/catalina/valves/TestRemoteIpValve.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/test/org/apache/catalina/valves/TestRemoteIpValve.java?rev=1198557&r1=1198556&r2=1198557&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/test/org/apache/catalina/valves/TestRemoteIpValve.java (original)
+++ tomcat/tc7.0.x/trunk/test/org/apache/catalina/valves/TestRemoteIpValve.java Sun Nov  6 21:09:16 2011
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -39,22 +39,22 @@ import org.apache.catalina.connector.Res
  * {@link RemoteIpValve} Tests
  */
 public class TestRemoteIpValve {
-    
+
     static class RemoteAddrAndHostTrackerValve extends ValveBase {
         private String remoteAddr;
         private String remoteHost;
         private String scheme;
         private boolean secure;
         private int serverPort;
-        
+
         public String getRemoteAddr() {
             return remoteAddr;
         }
-        
+
         public String getRemoteHost() {
             return remoteHost;
         }
-        
+
         public String getScheme() {
             return scheme;
         }
@@ -66,7 +66,7 @@ public class TestRemoteIpValve {
         public boolean isSecure() {
             return secure;
         }
-        
+
         @Override
         public void invoke(Request request, Response response) throws IOException, ServletException {
             this.remoteHost = request.getRemoteHost();
@@ -90,20 +90,20 @@ public class TestRemoteIpValve {
         String actual = RemoteIpValve.listToCommaDelimitedString(elements);
         assertEquals("element1, element2, element3", actual);
     }
-    
+
     @Test
     public void testListToCommaDelimitedStringEmptyList() {
         List<String> elements = new ArrayList<String>();
         String actual = RemoteIpValve.listToCommaDelimitedString(elements);
         assertEquals("", actual);
     }
-    
+
     @Test
     public void testCommaDelimitedListToStringArrayNullList() {
         String actual = RemoteIpValve.listToCommaDelimitedString(null);
         assertEquals("", actual);
     }
-    
+
     @Test
     public void testInvokeAllowedRemoteAddrWithNullRemoteIpHeader() throws Exception {
         // PREPARE
@@ -114,39 +114,39 @@ public class TestRemoteIpValve {
         remoteIpValve.setProxiesHeader("x-forwarded-by");
         RemoteAddrAndHostTrackerValve remoteAddrAndHostTrackerValve = new RemoteAddrAndHostTrackerValve();
         remoteIpValve.setNext(remoteAddrAndHostTrackerValve);
-        
+
         Request request = new MockRequest();
         request.setCoyoteRequest(new org.apache.coyote.Request());
         request.setRemoteAddr("192.168.0.10");
         request.setRemoteHost("remote-host-original-value");
-        
+
         // TEST
         remoteIpValve.invoke(request, null);
-        
+
         // VERIFY
         String actualXForwardedFor = request.getHeader("x-forwarded-for");
         assertNull("x-forwarded-for must be null", actualXForwardedFor);
-        
+
         String actualXForwardedBy = request.getHeader("x-forwarded-by");
         assertNull("x-forwarded-by must be null", actualXForwardedBy);
-        
+
         String actualRemoteAddr = remoteAddrAndHostTrackerValve.getRemoteAddr();
         assertEquals("remoteAddr", "192.168.0.10", actualRemoteAddr);
-        
+
         String actualRemoteHost = remoteAddrAndHostTrackerValve.getRemoteHost();
         assertEquals("remoteHost", "remote-host-original-value", actualRemoteHost);
-        
+
         String actualPostInvokeRemoteAddr = request.getRemoteAddr();
         assertEquals("postInvoke remoteAddr", "192.168.0.10", actualPostInvokeRemoteAddr);
-        
+
         String actualPostInvokeRemoteHost = request.getRemoteHost();
         assertEquals("postInvoke remoteAddr", "remote-host-original-value", actualPostInvokeRemoteHost);
-        
+
     }
-    
+
     @Test
     public void testInvokeAllProxiesAreTrusted() throws Exception {
-        
+
         // PREPARE
         RemoteIpValve remoteIpValve = new RemoteIpValve();
         remoteIpValve.setInternalProxies("192\\.168\\.0\\.10|192\\.168\\.0\\.11");
@@ -155,39 +155,39 @@ public class TestRemoteIpValve {
         remoteIpValve.setProxiesHeader("x-forwarded-by");
         RemoteAddrAndHostTrackerValve remoteAddrAndHostTrackerValve = new RemoteAddrAndHostTrackerValve();
         remoteIpValve.setNext(remoteAddrAndHostTrackerValve);
-        
+
         Request request = new MockRequest();
         request.setCoyoteRequest(new org.apache.coyote.Request());
         request.setRemoteAddr("192.168.0.10");
         request.setRemoteHost("remote-host-original-value");
         request.getCoyoteRequest().getMimeHeaders().addValue("x-forwarded-for").setString("140.211.11.130, proxy1, proxy2");
-        
+
         // TEST
         remoteIpValve.invoke(request, null);
-        
+
         // VERIFY
         String actualXForwardedFor = request.getHeader("x-forwarded-for");
         assertNull("all proxies are trusted, x-forwarded-for must be null", actualXForwardedFor);
-        
+
         String actualXForwardedBy = request.getHeader("x-forwarded-by");
         assertEquals("all proxies are trusted, they must appear in x-forwarded-by", "proxy1, proxy2", actualXForwardedBy);
-        
+
         String actualRemoteAddr = remoteAddrAndHostTrackerValve.getRemoteAddr();
         assertEquals("remoteAddr", "140.211.11.130", actualRemoteAddr);
-        
+
         String actualRemoteHost = remoteAddrAndHostTrackerValve.getRemoteHost();
         assertEquals("remoteHost", "140.211.11.130", actualRemoteHost);
-        
+
         String actualPostInvokeRemoteAddr = request.getRemoteAddr();
         assertEquals("postInvoke remoteAddr", "192.168.0.10", actualPostInvokeRemoteAddr);
-        
+
         String actualPostInvokeRemoteHost = request.getRemoteHost();
         assertEquals("postInvoke remoteAddr", "remote-host-original-value", actualPostInvokeRemoteHost);
     }
-    
+
     @Test
     public void testInvokeAllProxiesAreTrustedOrInternal() throws Exception {
-        
+
         // PREPARE
         RemoteIpValve remoteIpValve = new RemoteIpValve();
         remoteIpValve.setInternalProxies("192\\.168\\.0\\.10|192\\.168\\.0\\.11");
@@ -196,40 +196,40 @@ public class TestRemoteIpValve {
         remoteIpValve.setProxiesHeader("x-forwarded-by");
         RemoteAddrAndHostTrackerValve remoteAddrAndHostTrackerValve = new RemoteAddrAndHostTrackerValve();
         remoteIpValve.setNext(remoteAddrAndHostTrackerValve);
-        
+
         Request request = new MockRequest();
         request.setCoyoteRequest(new org.apache.coyote.Request());
         request.setRemoteAddr("192.168.0.10");
         request.setRemoteHost("remote-host-original-value");
         request.getCoyoteRequest().getMimeHeaders().addValue("x-forwarded-for")
             .setString("140.211.11.130, proxy1, proxy2, 192.168.0.10, 192.168.0.11");
-        
+
         // TEST
         remoteIpValve.invoke(request, null);
-        
+
         // VERIFY
         String actualXForwardedFor = request.getHeader("x-forwarded-for");
         assertNull("all proxies are trusted, x-forwarded-for must be null", actualXForwardedFor);
-        
+
         String actualXForwardedBy = request.getHeader("x-forwarded-by");
         assertEquals("all proxies are trusted, they must appear in x-forwarded-by", "proxy1, proxy2", actualXForwardedBy);
-        
+
         String actualRemoteAddr = remoteAddrAndHostTrackerValve.getRemoteAddr();
         assertEquals("remoteAddr", "140.211.11.130", actualRemoteAddr);
-        
+
         String actualRemoteHost = remoteAddrAndHostTrackerValve.getRemoteHost();
         assertEquals("remoteHost", "140.211.11.130", actualRemoteHost);
-        
+
         String actualPostInvokeRemoteAddr = request.getRemoteAddr();
         assertEquals("postInvoke remoteAddr", "192.168.0.10", actualPostInvokeRemoteAddr);
-        
+
         String actualPostInvokeRemoteHost = request.getRemoteHost();
         assertEquals("postInvoke remoteAddr", "remote-host-original-value", actualPostInvokeRemoteHost);
     }
-    
+
     @Test
     public void testInvokeAllProxiesAreInternal() throws Exception {
-        
+
         // PREPARE
         RemoteIpValve remoteIpValve = new RemoteIpValve();
         remoteIpValve.setInternalProxies("192\\.168\\.0\\.10|192\\.168\\.0\\.11");
@@ -238,39 +238,39 @@ public class TestRemoteIpValve {
         remoteIpValve.setProxiesHeader("x-forwarded-by");
         RemoteAddrAndHostTrackerValve remoteAddrAndHostTrackerValve = new RemoteAddrAndHostTrackerValve();
         remoteIpValve.setNext(remoteAddrAndHostTrackerValve);
-        
+
         Request request = new MockRequest();
         request.setCoyoteRequest(new org.apache.coyote.Request());
         request.setRemoteAddr("192.168.0.10");
         request.setRemoteHost("remote-host-original-value");
         request.getCoyoteRequest().getMimeHeaders().addValue("x-forwarded-for").setString("140.211.11.130, 192.168.0.10, 192.168.0.11");
-        
+
         // TEST
         remoteIpValve.invoke(request, null);
-        
+
         // VERIFY
         String actualXForwardedFor = request.getHeader("x-forwarded-for");
         assertNull("all proxies are internal, x-forwarded-for must be null", actualXForwardedFor);
-        
+
         String actualXForwardedBy = request.getHeader("x-forwarded-by");
         assertNull("all proxies are internal, x-forwarded-by must be null", actualXForwardedBy);
-        
+
         String actualRemoteAddr = remoteAddrAndHostTrackerValve.getRemoteAddr();
         assertEquals("remoteAddr", "140.211.11.130", actualRemoteAddr);
-        
+
         String actualRemoteHost = remoteAddrAndHostTrackerValve.getRemoteHost();
         assertEquals("remoteHost", "140.211.11.130", actualRemoteHost);
-        
+
         String actualPostInvokeRemoteAddr = request.getRemoteAddr();
         assertEquals("postInvoke remoteAddr", "192.168.0.10", actualPostInvokeRemoteAddr);
-        
+
         String actualPostInvokeRemoteHost = request.getRemoteHost();
         assertEquals("postInvoke remoteAddr", "remote-host-original-value", actualPostInvokeRemoteHost);
     }
-    
+
     @Test
     public void testInvokeAllProxiesAreTrustedAndRemoteAddrMatchRegexp() throws Exception {
-        
+
         // PREPARE
         RemoteIpValve remoteIpValve = new RemoteIpValve();
         remoteIpValve.setInternalProxies("127\\.0\\.0\\.1|192\\.168\\..*|another-internal-proxy");
@@ -279,7 +279,7 @@ public class TestRemoteIpValve {
         remoteIpValve.setProxiesHeader("x-forwarded-by");
         RemoteAddrAndHostTrackerValve remoteAddrAndHostTrackerValve = new RemoteAddrAndHostTrackerValve();
         remoteIpValve.setNext(remoteAddrAndHostTrackerValve);
-        
+
         Request request = new MockRequest();
         request.setCoyoteRequest(new org.apache.coyote.Request());
         request.setRemoteAddr("192.168.0.10");
@@ -287,40 +287,40 @@ public class TestRemoteIpValve {
         request.getCoyoteRequest().getMimeHeaders().addValue("x-forwarded-for").setString("140.211.11.130");
         request.getCoyoteRequest().getMimeHeaders().addValue("x-forwarded-for").setString("proxy1");
         request.getCoyoteRequest().getMimeHeaders().addValue("x-forwarded-for").setString("proxy2");
-        
+
         // TEST
         remoteIpValve.invoke(request, null);
-        
+
         // VERIFY
         String actualXForwardedFor = request.getHeader("x-forwarded-for");
         assertNull("all proxies are trusted, x-forwarded-for must be null", actualXForwardedFor);
-        
+
         String actualXForwardedBy = request.getHeader("x-forwarded-by");
         assertEquals("all proxies are trusted, they must appear in x-forwarded-by", "proxy1, proxy2", actualXForwardedBy);
-        
+
         String actualRemoteAddr = remoteAddrAndHostTrackerValve.getRemoteAddr();
         assertEquals("remoteAddr", "140.211.11.130", actualRemoteAddr);
-        
+
         String actualRemoteHost = remoteAddrAndHostTrackerValve.getRemoteHost();
         assertEquals("remoteHost", "140.211.11.130", actualRemoteHost);
-        
+
         String actualPostInvokeRemoteAddr = request.getRemoteAddr();
         assertEquals("postInvoke remoteAddr", "192.168.0.10", actualPostInvokeRemoteAddr);
-        
+
         String actualPostInvokeRemoteHost = request.getRemoteHost();
         assertEquals("postInvoke remoteAddr", "remote-host-original-value", actualPostInvokeRemoteHost);
     }
-    
+
     @Test
     public void testInvokeXforwardedProtoSaysHttpsForIncomingHttpRequest() throws Exception {
-        
+
         // PREPARE
         RemoteIpValve remoteIpValve = new RemoteIpValve();
         remoteIpValve.setRemoteIpHeader("x-forwarded-for");
         remoteIpValve.setProtocolHeader("x-forwarded-proto");
         RemoteAddrAndHostTrackerValve remoteAddrAndHostTrackerValve = new RemoteAddrAndHostTrackerValve();
         remoteIpValve.setNext(remoteAddrAndHostTrackerValve);
-        
+
         Request request = new MockRequest();
         request.setCoyoteRequest(new org.apache.coyote.Request());
         // client ip
@@ -332,37 +332,37 @@ public class TestRemoteIpValve {
         request.setSecure(false);
         request.setServerPort(8080);
         request.getCoyoteRequest().scheme().setString("http");
-        
+
         // TEST
         remoteIpValve.invoke(request, null);
-        
+
         // VERIFY
         // client ip
         String actualXForwardedFor = request.getHeader("x-forwarded-for");
         assertNull("no intermediate non-trusted proxy, x-forwarded-for must be null", actualXForwardedFor);
-        
+
         String actualXForwardedBy = request.getHeader("x-forwarded-by");
         assertNull("no intermediate trusted proxy", actualXForwardedBy);
-        
+
         String actualRemoteAddr = remoteAddrAndHostTrackerValve.getRemoteAddr();
         assertEquals("remoteAddr", "140.211.11.130", actualRemoteAddr);
-        
+
         String actualRemoteHost = remoteAddrAndHostTrackerValve.getRemoteHost();
         assertEquals("remoteHost", "140.211.11.130", actualRemoteHost);
-        
+
         String actualPostInvokeRemoteAddr = request.getRemoteAddr();
         assertEquals("postInvoke remoteAddr", "192.168.0.10", actualPostInvokeRemoteAddr);
-        
+
         String actualPostInvokeRemoteHost = request.getRemoteHost();
         assertEquals("postInvoke remoteAddr", "192.168.0.10", actualPostInvokeRemoteHost);
-        
+
         // protocol
         String actualScheme = remoteAddrAndHostTrackerValve.getScheme();
         assertEquals("x-forwarded-proto says https", "https", actualScheme);
-        
+
         int actualServerPort = remoteAddrAndHostTrackerValve.getServerPort();
         assertEquals("x-forwarded-proto says https", 443, actualServerPort);
-        
+
         boolean actualSecure = remoteAddrAndHostTrackerValve.isSecure();
         assertTrue("x-forwarded-proto says https", actualSecure);
 
@@ -375,17 +375,17 @@ public class TestRemoteIpValve {
         String actualPostInvokeScheme = request.getScheme();
         assertEquals("postInvoke scheme", "http", actualPostInvokeScheme);
     }
-    
+
     @Test
     public void testInvokeXforwardedProtoIsNullForIncomingHttpRequest() throws Exception {
-        
+
         // PREPARE
         RemoteIpValve remoteIpValve = new RemoteIpValve();
         remoteIpValve.setRemoteIpHeader("x-forwarded-for");
         remoteIpValve.setProtocolHeader("x-forwarded-proto");
         RemoteAddrAndHostTrackerValve remoteAddrAndHostTrackerValve = new RemoteAddrAndHostTrackerValve();
         remoteIpValve.setNext(remoteAddrAndHostTrackerValve);
-        
+
         Request request = new MockRequest();
         request.setCoyoteRequest(new org.apache.coyote.Request());
         // client ip
@@ -397,37 +397,37 @@ public class TestRemoteIpValve {
         request.setSecure(false);
         request.setServerPort(8080);
         request.getCoyoteRequest().scheme().setString("http");
-        
+
         // TEST
         remoteIpValve.invoke(request, null);
-        
+
         // VERIFY
         // client ip
         String actualXForwardedFor = request.getHeader("x-forwarded-for");
         assertNull("no intermediate non-trusted proxy, x-forwarded-for must be null", actualXForwardedFor);
-        
+
         String actualXForwardedBy = request.getHeader("x-forwarded-by");
         assertNull("no intermediate trusted proxy", actualXForwardedBy);
-        
+
         String actualRemoteAddr = remoteAddrAndHostTrackerValve.getRemoteAddr();
         assertEquals("remoteAddr", "140.211.11.130", actualRemoteAddr);
-        
+
         String actualRemoteHost = remoteAddrAndHostTrackerValve.getRemoteHost();
         assertEquals("remoteHost", "140.211.11.130", actualRemoteHost);
-        
+
         String actualPostInvokeRemoteAddr = request.getRemoteAddr();
         assertEquals("postInvoke remoteAddr", "192.168.0.10", actualPostInvokeRemoteAddr);
-        
+
         String actualPostInvokeRemoteHost = request.getRemoteHost();
         assertEquals("postInvoke remoteAddr", "192.168.0.10", actualPostInvokeRemoteHost);
-        
+
         // protocol
         String actualScheme = remoteAddrAndHostTrackerValve.getScheme();
         assertEquals("x-forwarded-proto is null", "http", actualScheme);
-        
+
         int actualServerPort = remoteAddrAndHostTrackerValve.getServerPort();
         assertEquals("x-forwarded-proto is null", 8080, actualServerPort);
-        
+
         boolean actualSecure = remoteAddrAndHostTrackerValve.isSecure();
         assertFalse("x-forwarded-proto is null", actualSecure);
 
@@ -440,17 +440,17 @@ public class TestRemoteIpValve {
         String actualPostInvokeScheme = request.getScheme();
         assertEquals("postInvoke scheme", "http", actualPostInvokeScheme);
     }
-    
+
     @Test
     public void testInvokeXforwardedProtoSaysHttpForIncomingHttpsRequest() throws Exception {
-        
+
         // PREPARE
         RemoteIpValve remoteIpValve = new RemoteIpValve();
         remoteIpValve.setRemoteIpHeader("x-forwarded-for");
         remoteIpValve.setProtocolHeader("x-forwarded-proto");
         RemoteAddrAndHostTrackerValve remoteAddrAndHostTrackerValve = new RemoteAddrAndHostTrackerValve();
         remoteIpValve.setNext(remoteAddrAndHostTrackerValve);
-        
+
         Request request = new MockRequest();
         request.setCoyoteRequest(new org.apache.coyote.Request());
         // client ip
@@ -462,37 +462,37 @@ public class TestRemoteIpValve {
         request.setSecure(true);
         request.setServerPort(8443);
         request.getCoyoteRequest().scheme().setString("https");
-        
+
         // TEST
         remoteIpValve.invoke(request, null);
-        
+
         // VERIFY
         // client ip
         String actualXForwardedFor = request.getHeader("x-forwarded-for");
         assertNull("no intermediate non-trusted proxy, x-forwarded-for must be null", actualXForwardedFor);
-        
+
         String actualXForwardedBy = request.getHeader("x-forwarded-by");
         assertNull("no intermediate trusted proxy", actualXForwardedBy);
-        
+
         String actualRemoteAddr = remoteAddrAndHostTrackerValve.getRemoteAddr();
         assertEquals("remoteAddr", "140.211.11.130", actualRemoteAddr);
-        
+
         String actualRemoteHost = remoteAddrAndHostTrackerValve.getRemoteHost();
         assertEquals("remoteHost", "140.211.11.130", actualRemoteHost);
-        
+
         String actualPostInvokeRemoteAddr = request.getRemoteAddr();
         assertEquals("postInvoke remoteAddr", "192.168.0.10", actualPostInvokeRemoteAddr);
-        
+
         String actualPostInvokeRemoteHost = request.getRemoteHost();
         assertEquals("postInvoke remoteAddr", "192.168.0.10", actualPostInvokeRemoteHost);
-        
+
         // protocol
         String actualScheme = remoteAddrAndHostTrackerValve.getScheme();
         assertEquals("x-forwarded-proto says http", "http", actualScheme);
-        
+
         int actualServerPort = remoteAddrAndHostTrackerValve.getServerPort();
         assertEquals("x-forwarded-proto says http", 80, actualServerPort);
-        
+
         boolean actualSecure = remoteAddrAndHostTrackerValve.isSecure();
         assertFalse("x-forwarded-proto says http", actualSecure);
 
@@ -505,17 +505,17 @@ public class TestRemoteIpValve {
         String actualPostInvokeScheme = request.getScheme();
         assertEquals("postInvoke scheme", "https", actualPostInvokeScheme);
     }
-    
+
     @Test
     public void testInvokeXforwardedProtoIsNullForIncomingHttpsRequest() throws Exception {
-        
+
         // PREPARE
         RemoteIpValve remoteIpValve = new RemoteIpValve();
         remoteIpValve.setRemoteIpHeader("x-forwarded-for");
         remoteIpValve.setProtocolHeader("x-forwarded-proto");
         RemoteAddrAndHostTrackerValve remoteAddrAndHostTrackerValve = new RemoteAddrAndHostTrackerValve();
         remoteIpValve.setNext(remoteAddrAndHostTrackerValve);
-        
+
         Request request = new MockRequest();
         request.setCoyoteRequest(new org.apache.coyote.Request());
         // client ip
@@ -527,37 +527,37 @@ public class TestRemoteIpValve {
         request.setSecure(true);
         request.setServerPort(8443);
         request.getCoyoteRequest().scheme().setString("https");
-        
+
         // TEST
         remoteIpValve.invoke(request, null);
-        
+
         // VERIFY
         // client ip
         String actualXForwardedFor = request.getHeader("x-forwarded-for");
         assertNull("no intermediate non-trusted proxy, x-forwarded-for must be null", actualXForwardedFor);
-        
+
         String actualXForwardedBy = request.getHeader("x-forwarded-by");
         assertNull("no intermediate trusted proxy", actualXForwardedBy);
-        
+
         String actualRemoteAddr = remoteAddrAndHostTrackerValve.getRemoteAddr();
         assertEquals("remoteAddr", "140.211.11.130", actualRemoteAddr);
-        
+
         String actualRemoteHost = remoteAddrAndHostTrackerValve.getRemoteHost();
         assertEquals("remoteHost", "140.211.11.130", actualRemoteHost);
-        
+
         String actualPostInvokeRemoteAddr = request.getRemoteAddr();
         assertEquals("postInvoke remoteAddr", "192.168.0.10", actualPostInvokeRemoteAddr);
-        
+
         String actualPostInvokeRemoteHost = request.getRemoteHost();
         assertEquals("postInvoke remoteAddr", "192.168.0.10", actualPostInvokeRemoteHost);
-        
+
         // protocol
         String actualScheme = remoteAddrAndHostTrackerValve.getScheme();
         assertEquals("x-forwarded-proto is null", "https", actualScheme);
-        
+
         int actualServerPort = remoteAddrAndHostTrackerValve.getServerPort();
         assertEquals("x-forwarded-proto is null", 8443, actualServerPort);
-        
+
         boolean actualSecure = remoteAddrAndHostTrackerValve.isSecure();
         assertTrue("x-forwarded-proto is null", actualSecure);
 
@@ -570,7 +570,7 @@ public class TestRemoteIpValve {
         String actualPostInvokeScheme = request.getScheme();
         assertEquals("postInvoke scheme", "https", actualPostInvokeScheme);
     }
-    
+
     @Test
     public void testInvokeNotAllowedRemoteAddr() throws Exception {
         // PREPARE
@@ -581,36 +581,36 @@ public class TestRemoteIpValve {
         remoteIpValve.setProxiesHeader("x-forwarded-by");
         RemoteAddrAndHostTrackerValve remoteAddrAndHostTrackerValve = new RemoteAddrAndHostTrackerValve();
         remoteIpValve.setNext(remoteAddrAndHostTrackerValve);
-        
+
         Request request = new MockRequest();
         request.setCoyoteRequest(new org.apache.coyote.Request());
         request.setRemoteAddr("not-allowed-internal-proxy");
         request.setRemoteHost("not-allowed-internal-proxy-host");
         request.getCoyoteRequest().getMimeHeaders().addValue("x-forwarded-for").setString("140.211.11.130, proxy1, proxy2");
-        
+
         // TEST
         remoteIpValve.invoke(request, null);
-        
+
         // VERIFY
         String actualXForwardedFor = request.getHeader("x-forwarded-for");
         assertEquals("x-forwarded-for must be unchanged", "140.211.11.130, proxy1, proxy2", actualXForwardedFor);
-        
+
         String actualXForwardedBy = request.getHeader("x-forwarded-by");
         assertNull("x-forwarded-by must be null", actualXForwardedBy);
-        
+
         String actualRemoteAddr = remoteAddrAndHostTrackerValve.getRemoteAddr();
         assertEquals("remoteAddr", "not-allowed-internal-proxy", actualRemoteAddr);
-        
+
         String actualRemoteHost = remoteAddrAndHostTrackerValve.getRemoteHost();
         assertEquals("remoteHost", "not-allowed-internal-proxy-host", actualRemoteHost);
-        
+
         String actualPostInvokeRemoteAddr = request.getRemoteAddr();
         assertEquals("postInvoke remoteAddr", "not-allowed-internal-proxy", actualPostInvokeRemoteAddr);
-        
+
         String actualPostInvokeRemoteHost = request.getRemoteHost();
         assertEquals("postInvoke remoteAddr", "not-allowed-internal-proxy-host", actualPostInvokeRemoteHost);
     }
-    
+
     @Test
     public void testInvokeUntrustedProxyInTheChain() throws Exception {
         // PREPARE
@@ -621,37 +621,37 @@ public class TestRemoteIpValve {
         remoteIpValve.setProxiesHeader("x-forwarded-by");
         RemoteAddrAndHostTrackerValve remoteAddrAndHostTrackerValve = new RemoteAddrAndHostTrackerValve();
         remoteIpValve.setNext(remoteAddrAndHostTrackerValve);
-        
+
         Request request = new MockRequest();
         request.setCoyoteRequest(new org.apache.coyote.Request());
         request.setRemoteAddr("192.168.0.10");
         request.setRemoteHost("remote-host-original-value");
         request.getCoyoteRequest().getMimeHeaders().addValue("x-forwarded-for")
             .setString("140.211.11.130, proxy1, untrusted-proxy, proxy2");
-        
+
         // TEST
         remoteIpValve.invoke(request, null);
-        
+
         // VERIFY
         String actualXForwardedFor = request.getHeader("x-forwarded-for");
         assertEquals("ip/host before untrusted-proxy must appear in x-forwarded-for", "140.211.11.130, proxy1", actualXForwardedFor);
-        
+
         String actualXForwardedBy = request.getHeader("x-forwarded-by");
         assertEquals("ip/host after untrusted-proxy must appear in  x-forwarded-by", "proxy2", actualXForwardedBy);
-        
+
         String actualRemoteAddr = remoteAddrAndHostTrackerValve.getRemoteAddr();
         assertEquals("remoteAddr", "untrusted-proxy", actualRemoteAddr);
-        
+
         String actualRemoteHost = remoteAddrAndHostTrackerValve.getRemoteHost();
         assertEquals("remoteHost", "untrusted-proxy", actualRemoteHost);
-        
+
         String actualPostInvokeRemoteAddr = request.getRemoteAddr();
         assertEquals("postInvoke remoteAddr", "192.168.0.10", actualPostInvokeRemoteAddr);
-        
+
         String actualPostInvokeRemoteHost = request.getRemoteHost();
         assertEquals("postInvoke remoteAddr", "remote-host-original-value", actualPostInvokeRemoteHost);
     }
-    
+
     @Test
     public void testCommaDelimitedListToStringArray() {
         String[] actual = RemoteIpValve.commaDelimitedListToStringArray("element1, element2, element3");
@@ -660,7 +660,7 @@ public class TestRemoteIpValve {
         };
         assertArrayEquals(expected, actual);
     }
-    
+
     @Test
     public void testCommaDelimitedListToStringArrayMixedSpaceChars() {
         String[] actual = RemoteIpValve.commaDelimitedListToStringArray("element1  , element2,\t element3");
@@ -669,7 +669,7 @@ public class TestRemoteIpValve {
         };
         assertArrayEquals(expected, actual);
     }
-    
+
     private void assertArrayEquals(String[] expected, String[] actual) {
         if (expected == null) {
             assertNull(actual);
@@ -681,7 +681,7 @@ public class TestRemoteIpValve {
         e.addAll(Arrays.asList(expected));
         List<String> a = new ArrayList<String>();
         a.addAll(Arrays.asList(actual));
-        
+
         for (String entry : e) {
             assertTrue(a.remove(entry));
         }



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