Mark,

I just realized that you refactored my fix for the false positive unit test
[1] a while ago.  Unfortunately your refactoring still shows false
positives if the path of the command prompt has a lower-cased driver
letter, e.g.

expected:<jar:war:file:/[E]:/Workspace/Test/apa...> but
was:<jar:war:file:/[e]:/Workspace/Test/apa...>


I pushed a different fix earlier, prior to noticing your refactoring (TBH I
thought that I never pushed the fix in the first place), which does an
equalsIgnoreCase() [2]

The only unit tests where I experience this issue
are TestAbstractArchiveResource.java and TestFileResource.java and the
problem seems to be with the Driver Letter which appears in brackets, e.g.
[E] vs. [e].

If you think that a full case-insensitive comparison is not right then I
can  modify only the drive letter if the pattern "jar:war:file:/[X]" is
found.

Any thoughts?

Igal

[1]
https://github.com/apache/tomcat/commit/db71c925106915581f1b60b0fda9c352fcdd9138#diff-717001e0451788fe9f26d1176a4fff54

[2]
https://github.com/apache/tomcat/commit/985d0086329c012a994c842f0a88a9b33989827c#diff-717001e0451788fe9f26d1176a4fff54R43



On Thu, Apr 11, 2019 at 11:28 AM <isa...@apache.org> wrote:

> This is an automated email from the ASF dual-hosted git repository.
>
> isapir pushed a commit to branch master
> in repository https://gitbox.apache.org/repos/asf/tomcat.git
>
>
> The following commit(s) were added to refs/heads/master by this push:
>      new 985d008  Fixed false positives in unit tests on Windows
> 985d008 is described below
>
> commit 985d0086329c012a994c842f0a88a9b33989827c
> Author: Igal Sapir <isa...@apache.org>
> AuthorDate: Thu Apr 11 08:45:22 2019 -0700
>
>     Fixed false positives in unit tests on Windows
>
>     When the drive letter is lower cased in a Windows command prompt the
> test cases were failing with
>     expected:<jar:war:file:/[E]:/Workspace/Test/apa...> but
> was:<jar:war:file:/[e]:/Workspace/Test/apa...>
> ---
>  .../org/apache/catalina/webresources/TestAbstractArchiveResource.java | 4
> ++--
>  test/org/apache/catalina/webresources/TestFileResource.java           | 2
> +-
>  2 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git
> a/test/org/apache/catalina/webresources/TestAbstractArchiveResource.java
> b/test/org/apache/catalina/webresources/TestAbstractArchiveResource.java
> index 9c59fd8..e573d91 100644
> ---
> a/test/org/apache/catalina/webresources/TestAbstractArchiveResource.java
> +++
> b/test/org/apache/catalina/webresources/TestAbstractArchiveResource.java
> @@ -48,7 +48,7 @@ public class TestAbstractArchiveResource extends
> TomcatBaseTest {
>
>  expectedURL.append(docBase.getCanonicalFile().toURI().toURL().toString());
>
>  expectedURL.append("*/WEB-INF/lib/test.jar!/META-INF/resources/index.html");
>
> -        Assert.assertEquals(expectedURL.toString(),
> webResource.getURL().toString());
> +
> Assert.assertTrue(expectedURL.toString().equalsIgnoreCase(webResource.getURL().toString()));
>      }
>
>
> @@ -71,7 +71,7 @@ public class TestAbstractArchiveResource extends
> TomcatBaseTest {
>
>  expectedURL.append(docBase.getCanonicalFile().toURI().toURL().toString());
>
>  expectedURL.append("WEB-INF/lib/test-lib.jar!/META-INF/tags/echo.tag");
>
> -        Assert.assertEquals(expectedURL.toString(),
> webResource.getURL().toString());
> +
> Assert.assertTrue(expectedURL.toString().equalsIgnoreCase(webResource.getURL().toString()));
>      }
>
>  }
> diff --git a/test/org/apache/catalina/webresources/TestFileResource.java
> b/test/org/apache/catalina/webresources/TestFileResource.java
> index 315212a..2bd7ef3 100644
> --- a/test/org/apache/catalina/webresources/TestFileResource.java
> +++ b/test/org/apache/catalina/webresources/TestFileResource.java
> @@ -40,6 +40,6 @@ public class TestFileResource extends TomcatBaseTest {
>
>          // 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.getCanonicalFile().toURI().toURL().toString(),
> out.toString().trim());
> +
> Assert.assertTrue(f.getCanonicalFile().toURI().toURL().toString().equalsIgnoreCase(out.toString().trim()));
>      }
>  }
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: dev-h...@tomcat.apache.org
>

Reply via email to