diff options
author | Adam Domurad <[email protected]> | 2013-01-30 12:01:11 -0500 |
---|---|---|
committer | Adam Domurad <[email protected]> | 2013-01-30 12:01:11 -0500 |
commit | 8dd0f50c259ff8119cc9a801d87ed2fce44fbb09 (patch) | |
tree | 0997666dc73d835b7a91d727504e60b94e215dad /tests/netx | |
parent | e2959ae96078602cf8b964a62bf454b364129c08 (diff) |
Fix for PR1292: Javaws does not resolve versioned jar names with periods properly
Diffstat (limited to 'tests/netx')
-rw-r--r-- | tests/netx/unit/net/sourceforge/jnlp/cache/ResourceUrlCreatorTest.java | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/tests/netx/unit/net/sourceforge/jnlp/cache/ResourceUrlCreatorTest.java b/tests/netx/unit/net/sourceforge/jnlp/cache/ResourceUrlCreatorTest.java new file mode 100644 index 0000000..208180d --- /dev/null +++ b/tests/netx/unit/net/sourceforge/jnlp/cache/ResourceUrlCreatorTest.java @@ -0,0 +1,43 @@ +package net.sourceforge.jnlp.cache; + +import static org.junit.Assert.assertEquals; + +import java.net.MalformedURLException; +import java.net.URL; + +import net.sourceforge.jnlp.Version; + +import org.junit.Test; + +public class ResourceUrlCreatorTest { + + @Test + public void testVersionEncode() throws MalformedURLException { + Resource resource = Resource.getResource(new URL("http://test.jar"), new Version("1.1"), null); + URL result = ResourceUrlCreator.getUrl(resource, false /*don't use pack suffix*/, true /*use version suffix*/); + assertEquals("http://test__V1.1.jar", result.toString()); + } + + @Test + public void testVersionWithPeriods() throws MalformedURLException { + Resource resource = Resource.getResource(new URL("http://test.with.periods.jar"), new Version("1.1"), null); + URL result = ResourceUrlCreator.getUrl(resource, false /*don't use pack suffix*/, true /*use version suffix*/); + + // A previous bug had this as "test__V1.1.with.periods.jar" + assertEquals("http://test.with.periods__V1.1.jar", result.toString()); + } + + @Test + public void testPackEncode() throws MalformedURLException { + Resource resource = Resource.getResource(new URL("http://test.jar"), new Version("1.1"), null); + URL result = ResourceUrlCreator.getUrl(resource, true /*use pack suffix*/, false /*don't use version suffix*/); + assertEquals("http://test.jar.pack.gz", result.toString()); + } + + @Test + public void testVersionAndPackEncode() throws MalformedURLException { + Resource resource = Resource.getResource(new URL("http://test.jar"), new Version("1.1"), null); + URL result = ResourceUrlCreator.getUrl(resource, true /*use pack suffix*/, true/*use version suffix*/); + assertEquals("http://test__V1.1.jar.pack.gz", result.toString()); + } +} |