tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rainer Jung <rainer.j...@kippdata.de>
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 Tue, 02 Oct 2018 21:54:34 GMT
Hi Igal,

Am 02.10.2018 um 23:39 schrieb isapir@apache.org:
> 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

...

> 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 {

I looked at our compat classes an hour ago for totally different 
reasons, but I noticed something you might want to use:

import org.apache.tomcat.util.compat.JrePlatform;

         if (JrePlatform.IS_WINDOWS) ...

Regards,

Rainer

> 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


Mime
View raw message