diff options
Diffstat (limited to 'src/junit/com/jogamp/common/net/URLCompositionTest.java')
-rw-r--r-- | src/junit/com/jogamp/common/net/URLCompositionTest.java | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/src/junit/com/jogamp/common/net/URLCompositionTest.java b/src/junit/com/jogamp/common/net/URLCompositionTest.java index fb6d298..36b38ab 100644 --- a/src/junit/com/jogamp/common/net/URLCompositionTest.java +++ b/src/junit/com/jogamp/common/net/URLCompositionTest.java @@ -33,11 +33,19 @@ public class URLCompositionTest extends JunitTracer { testURLCompositioning(new URL("jar:file:/web1/file1.jar!/rootDir/file1.txt")); testURLCompositioning(new URL("asset:gluegen-test/info.txt")); testURLCompositioning(new URL("asset:/gluegen-test/info.txt")); - testURLCompositioning(new URL("asset:jar:file:/web1/file1.jar!/rootDir/file1.txt")); testURLCompositioning(new URL("http://domain.com:1234/web1/index.html?lala=23&lili=24#anchor")); + + final URL file1URL = new URL("asset:jar:file:/web1/file1.jar!/rootDir/file1.txt"); + testURLCompositioning(file1URL); + testURLCompositioning(file1URL, new URL("asset:jar:file:/web1/file1.jar!/rootDir/./file1.txt")); + testURLCompositioning(file1URL, new URL("asset:jar:file:/web1/file1.jar!/rootDir/dummyParent/../file1.txt")); + } + + static void testURLCompositioning(URL u) throws MalformedURLException { + testURLCompositioning(u, u); } - static void testURLCompositioning(URL u) throws MalformedURLException { + static void testURLCompositioning(URL refURL, URL u) throws MalformedURLException { final String scheme = u.getProtocol(); final String auth = u.getAuthority(); String path = u.getPath(); @@ -47,12 +55,13 @@ public class URLCompositionTest extends JunitTracer { System.err.println("scheme <"+scheme+">, auth <"+auth+">, path <"+path+">, query <"+query+">, fragment <"+fragment+">"); URL u2 = IOUtil.compose(scheme, auth, path, null, query, fragment); - System.err.println("URL-equals: "+u.equals(u2)); - System.err.println("URL-same : "+u.sameFile(u2)); + System.err.println("URL-equals: "+refURL.equals(u2)); + System.err.println("URL-same : "+refURL.sameFile(u2)); + System.err.println("URL-ref : <"+refURL+">"); System.err.println("URL-orig : <"+u+">"); System.err.println("URL-comp : <"+u2+">"); - Assert.assertEquals(u, u2); - Assert.assertTrue(u.sameFile(u2)); + Assert.assertEquals(refURL, u2); + Assert.assertTrue(refURL.sameFile(u2)); } public static void main(String args[]) throws IOException { |