Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDJ Houghton2008-11-17 21:17:18 +0000
committerDJ Houghton2008-11-17 21:17:18 +0000
commit2b31ee66387fd90aa3535dd3d737a19334adca6b (patch)
tree8bd5c0dcc091c3fddfb71420ec8cc32bae2d29d6 /bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core
parent008f0b6f1acdf53a6f2b64bc22276b09c4282876 (diff)
downloadrt.equinox.p2-2b31ee66387fd90aa3535dd3d737a19334adca6b.tar.gz
rt.equinox.p2-2b31ee66387fd90aa3535dd3d737a19334adca6b.tar.xz
rt.equinox.p2-2b31ee66387fd90aa3535dd3d737a19334adca6b.zip
Fixed failures in nightly builds.v20081117
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core')
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/URIUtilTest.java92
1 files changed, 68 insertions, 24 deletions
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/URIUtilTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/URIUtilTest.java
index 726bb5095..7fca1a387 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/URIUtilTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/URIUtilTest.java
@@ -161,7 +161,7 @@ public class URIUtilTest extends AbstractProvisioningTest {
}
}
- public void testRemoveFileExtensionFromFile() throws URISyntaxException {
+ public void testRemoveFileExtensionFromFile() {
String fileName = "/c:/some.dir/afile";
File testFileWithExtension = new File(fileName + ".extension");
File testFileWithOutExtension = new File(fileName);
@@ -174,26 +174,16 @@ public class URIUtilTest extends AbstractProvisioningTest {
public void testMakeAbsolute() throws URISyntaxException {
URI[][] data = new URI[][] {
// simple path
- /*
- new URI[] {new URI("b"), new URI("file:/c:/a/"), new URI("file:/c:/a/b")}, //
- new URI[] {new URI("b"), new URI("file:/c:/a"), new URI("file:/c:/a/b")},
- // common root
- new URI[] {new URI("plugins/foo.jar"), new URI("file:/c:/eclipse/"), new URI("file:/c:/eclipse/plugins/foo.jar")},
- // different drives
- new URI[] {new URI("file:/c:/a/b"), new URI("file:/d:/a/x"), new URI("file:/c:/a/b")}, //
- new URI[] {new URI("file:/c:/eclipse/plugins/foo.jar"), new URI("file:/d:/eclipse/"), new URI("file:/c:/eclipse/plugins/foo.jar")},
- // non-local
- new URI[] {new URI("http:/c:/a/b"), new URI("file:/c:/a/x"), new URI("http:/c:/a/b")}, //
- new URI[] {new URI("file:/c:/a/b"), new URI("http:/c:/a/x"), new URI("file:/c:/a/b")}, //
- //
- new URI[] {new URI("b"), new URI("file:/C:/a/"), new URI("file:/C:/a/b")}, //
- new URI[] {new URI("b"), new URI("file:/C:/a"), new URI("file:/C:/a/b")}, //
- new URI[] {new URI("file:/c:/"), new URI("file:/d:/"), new URI("file:/c:/")}, //
- new URI[] {new URI(""), new URI("file:/c:/"), new URI("file:/c:/")}, //
- //
- new URI[] {new URI("../plugins/foo.jar"), new URI("file:/c:/eclipse/configuration"), new URI("file:/c:/eclipse/plugins/foo.jar")}, //
- */
- new URI[] {new URI("file:../plugins/foo.jar"), new URI("file:/c:/eclipse/configuration"), new URI("file:/c:/eclipse/plugins/foo.jar")}, //
+ new URI[] {new URI("b"), new URI("file:/a/"), new URI("file:/a/b")}, //
+ new URI[] {new URI("b"), new URI("file:/a"), new URI("file:/a/b")},
+ // common root
+ new URI[] {new URI("plugins/foo.jar"), new URI("file:/eclipse/"), new URI("file:/eclipse/plugins/foo.jar")},
+ // non-local
+ new URI[] {new URI("http:/foo.com/a/b"), new URI("file:/a/x"), new URI("http:/foo.com/a/b")}, //
+ new URI[] {new URI("file:/a/b"), new URI("http:/foo.com/a/x"), new URI("file:/a/b")}, //
+ //
+ new URI[] {new URI("../plugins/foo.jar"), new URI("file:/eclipse/configuration"), new URI("file:/eclipse/plugins/foo.jar")}, //
+ new URI[] {new URI("file:../plugins/foo.jar"), new URI("file:/eclipse/configuration"), new URI("file:/eclipse/plugins/foo.jar")}, //
};
for (int i = 0; i < data.length; i++) {
@@ -201,13 +191,68 @@ public class URIUtilTest extends AbstractProvisioningTest {
URI root = data[i][1];
URI expected = data[i][2];
URI actual = URIUtil.makeAbsolute(location, root);
- assertEquals(Integer.toString(i), expected, actual);
+ assertEquals("1." + Integer.toString(i), expected, actual);
+ }
+
+ // run some Windows-specific tests with drive letters
+ if (!isWindows())
+ return;
+ data = new URI[][] {
+ // simple path
+ new URI[] {new URI("b"), new URI("file:/c:/a/"), new URI("file:/c:/a/b")}, //
+ new URI[] {new URI("b"), new URI("file:/c:/a"), new URI("file:/c:/a/b")},
+ // common root
+ new URI[] {new URI("plugins/foo.jar"), new URI("file:/c:/eclipse/"), new URI("file:/c:/eclipse/plugins/foo.jar")},
+ // different drives
+ new URI[] {new URI("file:/c:/a/b"), new URI("file:/d:/a/x"), new URI("file:/c:/a/b")}, //
+ new URI[] {new URI("file:/c:/eclipse/plugins/foo.jar"), new URI("file:/d:/eclipse/"), new URI("file:/c:/eclipse/plugins/foo.jar")},
+ // non-local
+ new URI[] {new URI("http:/c:/a/b"), new URI("file:/c:/a/x"), new URI("http:/c:/a/b")}, //
+ new URI[] {new URI("file:/c:/a/b"), new URI("http:/c:/a/x"), new URI("file:/c:/a/b")}, //
+ //
+ new URI[] {new URI("b"), new URI("file:/C:/a/"), new URI("file:/C:/a/b")}, //
+ new URI[] {new URI("b"), new URI("file:/C:/a"), new URI("file:/C:/a/b")}, //
+ new URI[] {new URI("file:/c:/"), new URI("file:/d:/"), new URI("file:/c:/")}, //
+ new URI[] {new URI(""), new URI("file:/c:/"), new URI("file:/c:/")}, //
+ //
+ new URI[] {new URI("../plugins/foo.jar"), new URI("file:/c:/eclipse/configuration"), new URI("file:/c:/eclipse/plugins/foo.jar")}, //
+ new URI[] {new URI("file:../plugins/foo.jar"), new URI("file:/c:/eclipse/configuration"), new URI("file:/c:/eclipse/plugins/foo.jar")}, //
+ };
+ for (int i = 0; i < data.length; i++) {
+ URI location = data[i][0];
+ URI root = data[i][1];
+ URI expected = data[i][2];
+ URI actual = URIUtil.makeAbsolute(location, root);
+ assertEquals("2." + Integer.toString(i), expected, actual);
}
}
public void testMakeRelative() throws URISyntaxException {
URI[][] data = new URI[][] {
// simple path
+ new URI[] {new URI("file:/a/b"), new URI("file:/a/x"), new URI("b")},
+ // common root
+ new URI[] {new URI("file:/eclipse/plugins/foo.jar"), new URI("file:/eclipse/"), new URI("plugins/foo.jar")},
+ // non-local
+ new URI[] {new URI("http:/foo.com/a/b"), new URI("file:/a/x"), new URI("http:/foo.com/a/b")}, //
+ new URI[] {new URI("file:/a/b"), new URI("http:/foo.com/a/x"), new URI("file:/a/b")}, //
+ //
+ new URI[] {new URI("file:/"), new URI("file:/"), new URI("")}, //
+ };
+
+ for (int i = 0; i < data.length; i++) {
+ URI location = data[i][0];
+ URI root = data[i][1];
+ URI expected = data[i][2];
+ URI actual = URIUtil.makeRelative(location, root);
+ assertEquals("1." + Integer.toString(i), expected, actual);
+ }
+
+ // test some Windows-specific paths with drive letters
+ if (!isWindows())
+ return;
+ data = new URI[][] {
+ // simple path
new URI[] {new URI("file:/c:/a/b"), new URI("file:/c:/a/x"), new URI("b")},
// common root
new URI[] {new URI("file:/c:/eclipse/plugins/foo.jar"), new URI("file:/c:/eclipse/"), new URI("plugins/foo.jar")},
@@ -222,13 +267,12 @@ public class URIUtilTest extends AbstractProvisioningTest {
new URI[] {new URI("file:/c:/"), new URI("file:/d:/"), new URI("file:/c:/")}, //
new URI[] {new URI("file:/c:/"), new URI("file:/c:/"), new URI("")}, //
};
-
for (int i = 0; i < data.length; i++) {
URI location = data[i][0];
URI root = data[i][1];
URI expected = data[i][2];
URI actual = URIUtil.makeRelative(location, root);
- assertEquals(Integer.toString(i), expected, actual);
+ assertEquals("2." + Integer.toString(i), expected, actual);
}
}
}

Back to the top