Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorspingel2010-03-31 18:46:46 +0000
committerspingel2010-03-31 18:46:46 +0000
commitb87b4ebbfa8073a207f4bb74ab3cdfc1c3c40432 (patch)
tree4b121b9c46aeb830db7b0acc83c1ee577b23a9a2 /org.eclipse.mylyn.discovery.tests
parent8913ed18b0def4ccc91836675f31ffb3b9adb3d9 (diff)
downloadorg.eclipse.mylyn.commons-b87b4ebbfa8073a207f4bb74ab3cdfc1c3c40432.tar.gz
org.eclipse.mylyn.commons-b87b4ebbfa8073a207f4bb74ab3cdfc1c3c40432.tar.xz
org.eclipse.mylyn.commons-b87b4ebbfa8073a207f4bb74ab3cdfc1c3c40432.zip
RESOLVED - bug 307452: [discovery] directories should support relative path names
https://bugs.eclipse.org/bugs/show_bug.cgi?id=307452
Diffstat (limited to 'org.eclipse.mylyn.discovery.tests')
-rw-r--r--org.eclipse.mylyn.discovery.tests/src/org/eclipse/mylyn/discovery/tests/core/DirectoryParserTest.java32
1 files changed, 32 insertions, 0 deletions
diff --git a/org.eclipse.mylyn.discovery.tests/src/org/eclipse/mylyn/discovery/tests/core/DirectoryParserTest.java b/org.eclipse.mylyn.discovery.tests/src/org/eclipse/mylyn/discovery/tests/core/DirectoryParserTest.java
index 84ad539e..c9edc0e5 100644
--- a/org.eclipse.mylyn.discovery.tests/src/org/eclipse/mylyn/discovery/tests/core/DirectoryParserTest.java
+++ b/org.eclipse.mylyn.discovery.tests/src/org/eclipse/mylyn/discovery/tests/core/DirectoryParserTest.java
@@ -13,6 +13,8 @@ package org.eclipse.mylyn.discovery.tests.core;
import java.io.IOException;
import java.io.StringReader;
+import java.net.URI;
+import java.net.URISyntaxException;
import junit.framework.TestCase;
@@ -115,4 +117,34 @@ public class DirectoryParserTest extends TestCase {
assertEquals(1, directory.getEntries().size());
assertEquals(false, directory.getEntries().get(0).isPermitCategories());
}
+
+ public void testParseBaseRelativeUrl() throws IOException, URISyntaxException {
+ parser.setBaseUri(new URI("http://base.uri/location/directory.xml"));
+ Directory directory = parser.parse(new StringReader(
+ "<directory xmlns=\"http://www.eclipse.org/mylyn/discovery/directory/\"><entry url=\"parent/baz.jar\"/><entry url=\"http://absolute/bar.jar\"/></directory>"));
+ assertNotNull(directory);
+ assertEquals(2, directory.getEntries().size());
+ assertEquals("http://base.uri/location/parent/baz.jar", directory.getEntries().get(0).getLocation());
+ assertEquals("http://absolute/bar.jar", directory.getEntries().get(1).getLocation());
+ }
+
+ public void testParseRootUrl() throws IOException, URISyntaxException {
+ parser.setBaseUri(new URI("http://base.uri/location/directory.xml"));
+ Directory directory = parser.parse(new StringReader(
+ "<directory xmlns=\"http://www.eclipse.org/mylyn/discovery/directory/\"><entry url=\"/baz.jar\"/></directory>"));
+ assertNotNull(directory);
+ assertEquals(1, directory.getEntries().size());
+ assertEquals("http://base.uri/baz.jar", directory.getEntries().get(0).getLocation());
+ }
+
+ public void testParseBaseInvalidRelativeUrl() throws IOException, URISyntaxException {
+ parser.setBaseUri(new URI("http://base.uri/location/directory.xml"));
+ Directory directory = parser.parse(new StringReader(
+ "<directory xmlns=\"http://www.eclipse.org/mylyn/discovery/directory/\"><entry url=\":/baz.jar\"/><entry url=\"http://absolute/bar.jar\"/></directory>"));
+ assertNotNull(directory);
+ assertEquals(2, directory.getEntries().size());
+ assertEquals(":/baz.jar", directory.getEntries().get(0).getLocation());
+ assertEquals("http://absolute/bar.jar", directory.getEntries().get(1).getLocation());
+ }
+
}

Back to the top