tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Thomas <ma...@apache.org>
Subject Re: svn commit: r1842657 - in /tomcat/trunk/test/org/apache: catalina/startup/TomcatBaseTest.java catalina/webresources/TestAbstractArchiveResource.java catalina/webresources/TestFileResource.java coyote/http2/Http2TestBase.java
Date Wed, 03 Oct 2018 10:17:35 GMT
On 02/10/18 22:39, isapir@apache.org wrote:
> Author: isapir
> Date: Tue Oct  2 21:39:57 2018
> New Revision: 1842657
> 
> URL: http://svn.apache.org/viewvc?rev=1842657&view=rev
> Log:
> Fixed test cases that errored due to path case sentsitivity on Windows

This looks to be addressing the symptom rather than the root cause.

URLs should be case sensitive so converting them to lower case before
comparing them may hide future regressions.

I suspect an issue with getAbsolutePath() vs getCanonicalPath() but that
is only a guess as to what the root cause might be.

I'm looking to see if I can recreate the original problem.

Mark


> 
> e.g. Testcase: testNestedJarGetURL took 2.628 sec
>  FAILED
> expected:<jar:war:file:/[e]:/Workspace/git/tomc...> but was:<jar:war:file:/[E]:/Workspace/git/tomc...>
> junit.framework.AssertionFailedError: expected:<jar:war:file:/[e]:/Workspace/git/tomc...>
but was:<jar:war:file:/[E]:/Workspace/git/tomc...>
>  at org.apache.catalina.webresources.TestAbstractArchiveResource.testNestedJarGetURL(TestAbstractArchiveResource.java:51)
> 
> Modified:
>     tomcat/trunk/test/org/apache/catalina/startup/TomcatBaseTest.java
>     tomcat/trunk/test/org/apache/catalina/webresources/TestAbstractArchiveResource.java
>     tomcat/trunk/test/org/apache/catalina/webresources/TestFileResource.java
>     tomcat/trunk/test/org/apache/coyote/http2/Http2TestBase.java
> 
> Modified: tomcat/trunk/test/org/apache/catalina/startup/TomcatBaseTest.java
> URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/startup/TomcatBaseTest.java?rev=1842657&r1=1842656&r2=1842657&view=diff
> ==============================================================================
> --- tomcat/trunk/test/org/apache/catalina/startup/TomcatBaseTest.java (original)
> +++ tomcat/trunk/test/org/apache/catalina/startup/TomcatBaseTest.java Tue Oct  2 21:39:57
2018
> @@ -88,6 +88,7 @@ public abstract class TomcatBaseTest ext
>      protected static final int DEFAULT_CLIENT_TIMEOUT_MS = 300_000;
>  
>      public static final String TEMP_DIR = System.getProperty("java.io.tmpdir");
> +    public static final String OS_NAME = System.getProperty("os.name");
>  
>      /**
>       * Make the Tomcat instance available to sub-classes.
> @@ -148,6 +149,13 @@ public abstract class TomcatBaseTest ext
>          return accessLogEnabled;
>      }
>  
> +    /*
> +     * Sub-classes may need to test differently on Windows, e.g. case-insensitive file
paths
> +     */
> +    public boolean isWindows() {
> +        return OS_NAME.startsWith("Windows");
> +    }
> +
>      @Before
>      @Override
>      public void setUp() throws Exception {
> 
> Modified: tomcat/trunk/test/org/apache/catalina/webresources/TestAbstractArchiveResource.java
> URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/webresources/TestAbstractArchiveResource.java?rev=1842657&r1=1842656&r2=1842657&view=diff
> ==============================================================================
> --- tomcat/trunk/test/org/apache/catalina/webresources/TestAbstractArchiveResource.java
(original)
> +++ tomcat/trunk/test/org/apache/catalina/webresources/TestAbstractArchiveResource.java
Tue Oct  2 21:39:57 2018
> @@ -48,7 +48,15 @@ public class TestAbstractArchiveResource
>          expectedURL.append(docBase.getAbsoluteFile().toURI().toURL().toString());
>          expectedURL.append("*/WEB-INF/lib/test.jar!/META-INF/resources/index.html");
>  
> -        Assert.assertEquals(expectedURL.toString(), webResource.getURL().toString());
> +        String expected = expectedURL.toString();
> +        String actual = webResource.getURL().toString();
> +
> +        if (isWindows()){
> +            expected = expected.toLowerCase();
> +            actual = actual.toLowerCase();
> +        }
> +
> +        Assert.assertEquals(expected, actual);
>      }
>  
>  
> @@ -71,7 +79,15 @@ public class TestAbstractArchiveResource
>          expectedURL.append(docBase.getAbsoluteFile().toURI().toURL().toString());
>          expectedURL.append("WEB-INF/lib/test-lib.jar!/META-INF/tags/echo.tag");
>  
> -        Assert.assertEquals(expectedURL.toString(), webResource.getURL().toString());
> +        String expected = expectedURL.toString();
> +        String actual = webResource.getURL().toString();
> +
> +        if (isWindows()){
> +            expected = expected.toLowerCase();
> +            actual = actual.toLowerCase();
> +        }
> +
> +        Assert.assertEquals(expected, actual);
>      }
>  
>  }
> 
> Modified: tomcat/trunk/test/org/apache/catalina/webresources/TestFileResource.java
> URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/webresources/TestFileResource.java?rev=1842657&r1=1842656&r2=1842657&view=diff
> ==============================================================================
> --- tomcat/trunk/test/org/apache/catalina/webresources/TestFileResource.java (original)
> +++ tomcat/trunk/test/org/apache/catalina/webresources/TestFileResource.java Tue Oct
 2 21:39:57 2018
> @@ -40,6 +40,15 @@ public class TestFileResource extends To
>  
>          // Build the expected location the same way the webapp base dir is built
>          File f = new File("test/webapp/WEB-INF/classes");
> -        Assert.assertEquals(f.toURI().toURL().toString(), out.toString().trim());
> +
> +        String expected = f.toURI().toURL().toString();
> +        String actual = out.toString().trim();
> +
> +        if (isWindows()){
> +            expected = expected.toLowerCase();
> +            actual = actual.toLowerCase();
> +        }
> +
> +        Assert.assertEquals(expected, actual);
>      }
>  }
> 
> Modified: tomcat/trunk/test/org/apache/coyote/http2/Http2TestBase.java
> URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/coyote/http2/Http2TestBase.java?rev=1842657&r1=1842656&r2=1842657&view=diff
> ==============================================================================
> --- tomcat/trunk/test/org/apache/coyote/http2/Http2TestBase.java (original)
> +++ tomcat/trunk/test/org/apache/coyote/http2/Http2TestBase.java Tue Oct  2 21:39:57
2018
> @@ -838,7 +838,7 @@ public abstract class Http2TestBase exte
>                      connector.getProtocolHandlerClassName().contains("Nio2"));
>  
>              Assume.assumeTrue("This test is only expected to trigger an exception on
Windo9ws",
> -                    System.getProperty("os.name").startsWith("Windows"));
> +                    isWindows());
>          }
>      }
>  
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: dev-help@tomcat.apache.org
> 


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


Mime
View raw message