diff --git a/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/AllTests.java b/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/AllTests.java
index e55f05ca736..37e2d319955 100644
--- a/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/AllTests.java
+++ b/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/AllTests.java
@@ -23,14 +23,8 @@
import org.junit.runners.Suite.SuiteClasses;
@RunWith(Suite.class)
-@SuiteClasses({
- StringMatcherTests.class,
- RuntimeTests.class,
- AdaptableTests.class,
- RegistryTests.class,
- SimpleRegistryTests.class,
- FileLocatorTest.class
-})
+@SuiteClasses({ StringMatcherTests.class, RuntimeTests.class, AdaptableTests.class, RegistryTests.class,
+ SimpleRegistryTests.class, FileLocatorTest.class })
public class AllTests {
// intentionally left blank
}
diff --git a/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/CoreExceptionTest.java b/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/CoreExceptionTest.java
index 9ea83d1581b..3b9822373bd 100644
--- a/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/CoreExceptionTest.java
+++ b/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/CoreExceptionTest.java
@@ -21,9 +21,8 @@
*/
public class CoreExceptionTest extends CoreTest {
/**
- * Need a zero argument constructor to satisfy the test harness.
- * This constructor should not do any real work nor should it be
- * called by user code.
+ * Need a zero argument constructor to satisfy the test harness. This
+ * constructor should not do any real work nor should it be called by user code.
*/
public CoreExceptionTest() {
super(null);
@@ -35,7 +34,8 @@ public CoreExceptionTest(String name) {
public void testCoreException() {
final String MESSAGE_STRING = "An exception has occurred";
- IStatus status = new Status(IStatus.ERROR, "org.eclipse.core.tests.runtime", 31415, MESSAGE_STRING, new NumberFormatException());
+ IStatus status = new Status(IStatus.ERROR, "org.eclipse.core.tests.runtime", 31415, MESSAGE_STRING,
+ new NumberFormatException());
CoreException e = new CoreException(status);
diff --git a/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/OperationCanceledExceptionTest.java b/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/OperationCanceledExceptionTest.java
index bcd677cd2e6..d0492d355ec 100644
--- a/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/OperationCanceledExceptionTest.java
+++ b/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/OperationCanceledExceptionTest.java
@@ -21,9 +21,8 @@
*/
public class OperationCanceledExceptionTest extends CoreTest {
/**
- * Need a zero argument constructor to satisfy the test harness.
- * This constructor should not do any real work nor should it be
- * called by user code.
+ * Need a zero argument constructor to satisfy the test harness. This
+ * constructor should not do any real work nor should it be called by user code.
*/
public OperationCanceledExceptionTest() {
super(null);
diff --git a/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/PathTest.java b/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/PathTest.java
index 1ceb63785f6..0956d243b15 100644
--- a/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/PathTest.java
+++ b/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/PathTest.java
@@ -29,9 +29,8 @@
*/
public class PathTest extends CoreTest {
/**
- * Need a zero argument constructor to satisfy the test harness.
- * This constructor should not do any real work nor should it be
- * called by user code.
+ * Need a zero argument constructor to satisfy the test harness. This
+ * constructor should not do any real work nor should it be called by user code.
*/
public PathTest() {
super(null);
@@ -102,13 +101,13 @@ public void testAppend() {
assertTrue("2.4", !IPath.ROOT.append(fore).append(aftString).hasTrailingSeparator());
assertTrue("2.5", !fore.removeTrailingSeparator().append(aftString).hasTrailingSeparator());
- //ensure append preserves correct trailing separator
+ // ensure append preserves correct trailing separator
assertTrue("3.0", !fore.append("aft").hasTrailingSeparator());
assertTrue("3.1", fore.append("aft/").hasTrailingSeparator());
assertTrue("3.2", !fore.append("/aft").hasTrailingSeparator());
assertTrue("3.3", fore.append("/aft/").hasTrailingSeparator());
assertTrue("3.4", !fore.append("\\aft").hasTrailingSeparator());
- //backslash is a trailing separator on windows only
+ // backslash is a trailing separator on windows only
assertTrue("3.5.win", win.append("aft\\").hasTrailingSeparator());
assertFalse("3.6.posix", posix.append("aft\\").hasTrailingSeparator());
assertTrue("3.7", !fore.append("fourth/fifth").hasTrailingSeparator());
@@ -118,7 +117,7 @@ public void testAppend() {
assertTrue("3.11", !fore.append(new Path("fourth/fifth")).hasTrailingSeparator());
assertTrue("3.12", fore.append(new Path("fourth/fifth/")).hasTrailingSeparator());
- //make sure append converts backslashes appropriately
+ // make sure append converts backslashes appropriately
aftString = "fourth\\fifth";
assertEquals("4.0.win", combo, win.append(aftString));
assertEquals("4.1.win", combo, win.removeTrailingSeparator().append(aftString));
@@ -134,8 +133,8 @@ public void testAppend() {
IPath.forWindows("/").append("x").append("y").append("..\\..").append("x\\y"));
assertEquals("4.22.win", combo,
IPath.forWindows("/").append(win).append("..\\..").append("second\\third").append(aftString));
- assertEquals("4.23.win", combo,
- IPath.forWindows("/").append(win).append("..\\..\\..").append("first\\second\\third").append(aftString));
+ assertEquals("4.23.win", combo, IPath.forWindows("/").append(win).append("..\\..\\..")
+ .append("first\\second\\third").append(aftString));
assertEquals("4.24.win", combo,
IPath.forWindows("/").append(win).append("..\\..\\..").append(win).append(aftString));
assertEquals("4.25.win", combo,
@@ -150,7 +149,7 @@ public void testAppend() {
assertEquals("5.2", new Path("c:/foo/xyz"), new Path("c:/foo/bar").append("../xyz"));
assertEquals("5.3", new Path("c:/foo/bar/xyz"), new Path("c:/foo/bar").append("./xyz"));
- //append preserves device and leading separator of receiver
+ // append preserves device and leading separator of receiver
assertEquals("6.1.win", IPath.forWindows("c:foo/bar"), IPath.forWindows("c:").append("/foo/bar"));
assertEquals("6.2.win", IPath.forWindows("c:foo/bar"), IPath.forWindows("c:").append("foo/bar"));
assertEquals("6.3.win", IPath.forWindows("c:/foo/bar"), IPath.forWindows("c:/").append("/foo/bar"));
@@ -175,13 +174,13 @@ public void testAppend() {
assertEquals("6.20", new Path("/foo/bar/"), new Path("/foo/").append(new Path("/bar/")));
assertEquals("6.21", new Path("/foo/bar/"), new Path("/foo/").append(new Path("bar/")));
- //append preserves isUNC of receiver
+ // append preserves isUNC of receiver
assertEquals("7.0", new Path("/foo/bar"), new Path("/foo").append("//bar"));
assertEquals("7.1", new Path("/foo/bar/test"), new Path("/foo").append("bar//test"));
assertEquals("7.2", new Path("//foo/bar"), new Path("//foo").append("bar"));
assertEquals("7.3", new Path("/bar"), IPath.ROOT.append("//bar"));
- //append empty path does nothing
+ // append empty path does nothing
assertEquals("8.0", fore, fore.append(IPath.ROOT));
assertEquals("8.1", fore, fore.append(IPath.EMPTY));
assertEquals("8.2", fore, fore.append(new Path("//")));
@@ -302,7 +301,8 @@ public void testConstructors() {
assertEquals("1.3", "/a", new Path("/a").toString());
assertEquals("1.4", "//", new Path("//").toString());
assertEquals("1.5", "/a/", new Path("/a/").toString());
- assertEquals("1.6", "/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z", new Path("/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z").toString());
+ assertEquals("1.6", "/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z",
+ new Path("/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z").toString());
assertEquals("1.7", "...", new Path("...").toString());
assertEquals("1.8", "/a/b/.../c", new Path("/a/b/.../c").toString());
@@ -312,7 +312,7 @@ public void testConstructors() {
assertEquals("2.1", IPath.ROOT, new Path("/"));
assertEquals("2.2", anyPath, anyPath);
- //should handle slash before the device (see bug 84697)
+ // should handle slash before the device (see bug 84697)
// fullPath = new java.io.File("D:\\foo\\abc.txt").toURL().getPath()
assertEquals("3.0.win", "D:/foo/abc.txt", IPath.forWindows("/D:/foo/abc.txt").toString());
// fullPath = new java.io.File("D:/").toURL().getPath()
@@ -466,7 +466,7 @@ public void testHasTrailingSeparator() {
assertTrue("2.4", !new Path("c:/first/second/third").hasTrailingSeparator());
assertTrue("2.5", !new Path("c:first/second/third").hasTrailingSeparator());
- //paths of length 0 never have a trailing separator
+ // paths of length 0 never have a trailing separator
assertTrue("3.0", !new Path("/first/").removeLastSegments(1).hasTrailingSeparator());
assertTrue("3.1", !new Path("/first/").removeFirstSegments(1).hasTrailingSeparator());
assertTrue("3.2", !new Path("/").hasTrailingSeparator());
@@ -681,9 +681,9 @@ public void testMakeRelative() {
* Tests for {@link Path#makeRelativeTo(IPath)}.
*/
public void testMakeRelativeTo() {
- //valid cases
- IPath[] bases = new IPath[] {new Path("/a/"), new Path("/a/b")};
- IPath[] children = new IPath[] {new Path("/a/"), new Path("/a/b"), new Path("/a/b/c")};
+ // valid cases
+ IPath[] bases = new IPath[] { new Path("/a/"), new Path("/a/b") };
+ IPath[] children = new IPath[] { new Path("/a/"), new Path("/a/b"), new Path("/a/b/c") };
for (int i = 0; i < bases.length; i++) {
for (int j = 0; j < children.length; j++) {
final IPath base = bases[i];
@@ -694,15 +694,15 @@ public void testMakeRelativeTo() {
}
}
- //for equal/identical paths, the relative path should be empty
+ // for equal/identical paths, the relative path should be empty
IPath equalBase = new Path("/a/b");
assertEquals("3.1", "", new Path("/a/b").makeRelativeTo(equalBase).toString());
assertEquals("3.2", "", new Path("/a/b/").makeRelativeTo(equalBase).toString());
assertEquals("3.3", "", equalBase.makeRelativeTo(equalBase).toString());
- //invalid cases (no common prefix)
- bases = new IPath[] {new Path("/"), new Path("/b"), new Path("/b/c")};
- children = new IPath[] {new Path("/a/"), new Path("/a/b"), new Path("/a/b/c")};
+ // invalid cases (no common prefix)
+ bases = new IPath[] { new Path("/"), new Path("/b"), new Path("/b/c") };
+ children = new IPath[] { new Path("/a/"), new Path("/a/b"), new Path("/a/b/c") };
for (int i = 0; i < bases.length; i++) {
for (int j = 0; j < children.length; j++) {
final IPath base = bases[i];
@@ -836,18 +836,20 @@ public void testRemoveFirstSegments() {
assertEquals("1.8", IPath.EMPTY, new Path("/first/second/").removeFirstSegments(3));
assertEquals("1.9", new Path("third/fourth"), new Path("/first/second/third/fourth").removeFirstSegments(2));
- assertEquals("2.0.win", IPath.forWindows("c:second"), IPath.forWindows("c:/first/second").removeFirstSegments(1));
- assertEquals("2.1.win", IPath.forWindows("c:second/third/"), IPath.forWindows("c:/first/second/third/")
- .removeFirstSegments(1));
+ assertEquals("2.0.win", IPath.forWindows("c:second"),
+ IPath.forWindows("c:/first/second").removeFirstSegments(1));
+ assertEquals("2.1.win", IPath.forWindows("c:second/third/"),
+ IPath.forWindows("c:/first/second/third/").removeFirstSegments(1));
assertEquals("2.2.win", IPath.forWindows("c:"), IPath.forWindows("c:first").removeFirstSegments(1));
assertEquals("2.3.win", IPath.forWindows("c:"), IPath.forWindows("c:/first/").removeFirstSegments(1));
- assertEquals("2.4.win", IPath.forWindows("c:second"), IPath.forWindows("c:first/second").removeFirstSegments(1));
+ assertEquals("2.4.win", IPath.forWindows("c:second"),
+ IPath.forWindows("c:first/second").removeFirstSegments(1));
assertEquals("2.5.win", IPath.forWindows("c:"), IPath.forWindows("c:").removeFirstSegments(1));
assertEquals("2.6.win", IPath.forWindows("c:"), IPath.forWindows("c:/").removeFirstSegments(1));
assertEquals("2.7.win", IPath.forWindows("c:"), IPath.forWindows("c:/first/second/").removeFirstSegments(2));
assertEquals("2.8.win", IPath.forWindows("c:"), IPath.forWindows("c:/first/second/").removeFirstSegments(3));
- assertEquals("2.9.win", IPath.forWindows("c:third/fourth"), IPath.forWindows("c:/first/second/third/fourth")
- .removeFirstSegments(2));
+ assertEquals("2.9.win", IPath.forWindows("c:third/fourth"),
+ IPath.forWindows("c:/first/second/third/fourth").removeFirstSegments(2));
assertEquals("3.0", new Path("second"), new Path("//first/second").removeFirstSegments(1));
assertEquals("3.1", new Path("second/third/"), new Path("//first/second/third/").removeFirstSegments(1));
@@ -1031,7 +1033,7 @@ public void testEquals() {
public void testUptoSegment() {
- //Case 1, absolute path with no trailing separator
+ // Case 1, absolute path with no trailing separator
IPath anyPath = new Path("/first/second/third");
assertEquals("1.0", IPath.ROOT, anyPath.uptoSegment(0));
@@ -1040,7 +1042,7 @@ public void testUptoSegment() {
assertEquals("1.3", new Path("/first/second/third"), anyPath.uptoSegment(3));
assertEquals("1.4", new Path("/first/second/third"), anyPath.uptoSegment(4));
- //Case 2, absolute path with trailing separator
+ // Case 2, absolute path with trailing separator
anyPath = new Path("/first/second/third/");
assertEquals("2.0", IPath.ROOT, anyPath.uptoSegment(0));
@@ -1049,7 +1051,7 @@ public void testUptoSegment() {
assertEquals("2.3", new Path("/first/second/third/"), anyPath.uptoSegment(3));
assertEquals("2.4", new Path("/first/second/third/"), anyPath.uptoSegment(4));
- //Case 3, relative path with no trailing separator
+ // Case 3, relative path with no trailing separator
anyPath = new Path("first/second/third");
assertEquals("3.0", IPath.EMPTY, anyPath.uptoSegment(0));
@@ -1058,7 +1060,7 @@ public void testUptoSegment() {
assertEquals("3.3", new Path("first/second/third"), anyPath.uptoSegment(3));
assertEquals("3.4", new Path("first/second/third"), anyPath.uptoSegment(4));
- //Case 4, relative path with trailing separator
+ // Case 4, relative path with trailing separator
anyPath = new Path("first/second/third/");
assertEquals("4.0", IPath.EMPTY, anyPath.uptoSegment(0));
@@ -1082,7 +1084,7 @@ public void testUptoSegment() {
public void testToPath() {
- //Case 1, absolute path with no trailing separator
+ // Case 1, absolute path with no trailing separator
IPath anyPath = new Path("/first/second/third");
assertNotNull(anyPath.toPath());
diff --git a/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/PlatformLogWriterTest.java b/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/PlatformLogWriterTest.java
index f2d4b4f158f..4842e6b4e36 100644
--- a/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/PlatformLogWriterTest.java
+++ b/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/PlatformLogWriterTest.java
@@ -35,6 +35,7 @@ public class PlatformLogWriterTest extends CoreTest {
public static class TestILogListener implements ILogListener {
final AtomicReference expected = new AtomicReference<>();
final List statuses = new CopyOnWriteArrayList<>();
+
@Override
public void logging(IStatus status, String plugin) {
CountDownLatch current = expected.get();
@@ -43,6 +44,7 @@ public void logging(IStatus status, String plugin) {
}
statuses.add(status);
}
+
List getAllExpectedStatus() throws InterruptedException {
CountDownLatch current = expected.get();
if (current != null) {
@@ -67,7 +69,6 @@ public PlatformLogWriterTest(String name) {
LogService logService;
final TestILogListener listener = new TestILogListener();
-
@Override
protected void setUp() {
@@ -100,7 +101,6 @@ public void testLogServiceLevels() throws InterruptedException {
assertStatus(allStatus.get(4), "debug", IStatus.OK);
assertStatus(allStatus.get(5), "trace", IStatus.OK);
-
}
private void assertStatus(IStatus status, String message, int severity) {
diff --git a/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/PluginVersionIdentifierTest.java b/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/PluginVersionIdentifierTest.java
index 9ca3a12adb7..0d2220b31a6 100644
--- a/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/PluginVersionIdentifierTest.java
+++ b/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/PluginVersionIdentifierTest.java
@@ -51,7 +51,8 @@ public void testConstructor() {
// should test the hashcode() method that is currently missing.
public void testEqual() {
- assertTrue("1.0", new PluginVersionIdentifier(123, 456, 789).equals(new PluginVersionIdentifier("123.456.789")));
+ assertTrue("1.0",
+ new PluginVersionIdentifier(123, 456, 789).equals(new PluginVersionIdentifier("123.456.789")));
assertTrue("1.1", !new PluginVersionIdentifier(123, 456, 789).equals(new PluginVersionIdentifier("123.456")));
}
diff --git a/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/ProgressMonitorWrapperTest.java b/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/ProgressMonitorWrapperTest.java
index dd7cc11e5d5..65b5924987d 100644
--- a/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/ProgressMonitorWrapperTest.java
+++ b/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/ProgressMonitorWrapperTest.java
@@ -21,9 +21,8 @@
*/
public class ProgressMonitorWrapperTest extends CoreTest {
/**
- * Need a zero argument constructor to satisfy the test harness.
- * This constructor should not do any real work nor should it be
- * called by user code.
+ * Need a zero argument constructor to satisfy the test harness. This
+ * constructor should not do any real work nor should it be called by user code.
*/
public ProgressMonitorWrapperTest() {
super(null);
@@ -40,7 +39,8 @@ public ProgressMonitorWrapperTest(String name) {
public void testProgressMonitorWrapper() {
NullProgressMonitor nullMonitor = new NullProgressMonitor();
SubProgressMonitor wrapped = new SubProgressMonitor(nullMonitor, 10);
- ProgressMonitorWrapper wrapper = new ProgressMonitorWrapper(wrapped) {};
+ ProgressMonitorWrapper wrapper = new ProgressMonitorWrapper(wrapped) {
+ };
assertSame("1.0", nullMonitor, wrapped.getWrappedProgressMonitor());
assertSame("1.1", wrapped, wrapper.getWrappedProgressMonitor());
diff --git a/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/QualifiedNameTest.java b/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/QualifiedNameTest.java
index 850a13329dc..6807cb2788d 100644
--- a/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/QualifiedNameTest.java
+++ b/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/QualifiedNameTest.java
@@ -25,9 +25,8 @@
public class QualifiedNameTest extends CoreTest {
/**
- * Need a zero argument constructor to satisfy the test harness.
- * This constructor should not do any real work nor should it be
- * called by user code.
+ * Need a zero argument constructor to satisfy the test harness. This
+ * constructor should not do any real work nor should it be called by user code.
*/
public QualifiedNameTest() {
super(null);
diff --git a/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/RuntimeTests.java b/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/RuntimeTests.java
index 3f358c41304..da1efb40063 100644
--- a/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/RuntimeTests.java
+++ b/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/RuntimeTests.java
@@ -19,23 +19,10 @@
@SuppressWarnings("deprecation")
@RunWith(Suite.class)
-@SuiteClasses({
- CoreExceptionTest.class,
- ServiceCallerTest.class,
- OperationCanceledExceptionTest.class,
- PathTest.class,
- PluginVersionIdentifierTest.class,
- ProgressMonitorWrapperTest.class,
- QualifiedNameTest.class,
- SafeRunnerTest.class,
- StatusTest.class,
- SubMonitorSmallTicksTest.class,
- SubMonitorTest.class,
- SubProgressTest.class,
- URIUtilTest.class,
- URLTest.class,
- PlatformLogWriterTest.class
-})
+@SuiteClasses({ CoreExceptionTest.class, ServiceCallerTest.class, OperationCanceledExceptionTest.class, PathTest.class,
+ PluginVersionIdentifierTest.class, ProgressMonitorWrapperTest.class, QualifiedNameTest.class,
+ SafeRunnerTest.class, StatusTest.class, SubMonitorSmallTicksTest.class, SubMonitorTest.class,
+ SubProgressTest.class, URIUtilTest.class, URLTest.class, PlatformLogWriterTest.class })
public class RuntimeTests {
// intentionally left blank
}
diff --git a/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/ServiceCallerTest.java b/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/ServiceCallerTest.java
index 68f7ed3b904..4d32780edfc 100644
--- a/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/ServiceCallerTest.java
+++ b/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/ServiceCallerTest.java
@@ -59,6 +59,7 @@ int getCreateCount(Bundle b) {
return result == null ? 0 : result.get();
}
}
+
/**
* Need a zero argument constructor to satisfy the test harness. This
* constructor should not do any real work nor should it be called by user code.
diff --git a/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/SliceProgressMonitorTest.java b/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/SliceProgressMonitorTest.java
index 60f5760ee16..510196d7c9b 100644
--- a/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/SliceProgressMonitorTest.java
+++ b/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/SliceProgressMonitorTest.java
@@ -21,7 +21,6 @@
import org.eclipse.core.runtime.IProgressMonitor;
import org.junit.Test;
-
public class SliceProgressMonitorTest {
@Test
diff --git a/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/StatusTest.java b/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/StatusTest.java
index ac215232f39..a1017b1b633 100644
--- a/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/StatusTest.java
+++ b/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/StatusTest.java
@@ -75,7 +75,8 @@ protected void setUp() {
status1 = new Status(status1Severity, status1PluginId, status1Code, status1Message, status1Exception);
status2 = new Status(status2Severity, status2PluginId, status2Code, status2Message, status2Exception);
- multistatus1 = new MultiStatus(multistatus1PluginId, multistatus1Code, multistatus1Children, multistatus1Message, multistatus1Exception);
+ multistatus1 = new MultiStatus(multistatus1PluginId, multistatus1Code, multistatus1Children,
+ multistatus1Message, multistatus1Exception);
multistatus2 = new MultiStatus(" ", 45, new Status[0], "", null);
multistatus2.add(status1);
multistatus2.add(status1);
diff --git a/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/SubMonitorSmallTicksTest.java b/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/SubMonitorSmallTicksTest.java
index 05a834b35e9..952d89b2fee 100644
--- a/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/SubMonitorSmallTicksTest.java
+++ b/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/SubMonitorSmallTicksTest.java
@@ -19,8 +19,8 @@
import org.junit.Test;
/**
- * Ensures that creating a SubMonitor with a small number of
- * ticks will not prevent it from reporting accurate progress.
+ * Ensures that creating a SubMonitor with a small number of ticks will not
+ * prevent it from reporting accurate progress.
*/
public class SubMonitorSmallTicksTest {
diff --git a/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/SubProgressTest.java b/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/SubProgressTest.java
index 64f905cac82..f7856517dde 100644
--- a/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/SubProgressTest.java
+++ b/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/SubProgressTest.java
@@ -34,22 +34,32 @@
public class SubProgressTest {
/**
- * Depth of the chain chain of progress monitors. In all of the tests, we create
+ *
+ * Depth of the chain chain of progress monitors. In all of the tests, we create
* a nested chain of progress monitors rathar than a single monitor, to test its
* scalability under recursion. We pick a number representing a moderately deep
- * recursion, but is still small enough that it could correspond to a real call stack
- * without causing overflow.
+ * recursion, but is still small enough that it could correspond to a real call
+ * stack without causing overflow.
+ *
*
- * Note: changing this constant will invalidate comparisons with old performance data.
+ *
+ * Note: changing this constant will invalidate comparisons with old performance
+ * data.
+ *
*/
public static final int CHAIN_DEPTH = 100;
/**
- * Number of calls to worked() within each test. This was chosen to be significantly larger
- * than 1000 to test how well the monitor can optimize unnecessary resolution
- * in reported progress, but small enough that the test completes in a reasonable
- * amount of time.
+ *
+ * Number of calls to worked() within each test. This was chosen to be
+ * significantly larger than 1000 to test how well the monitor can optimize
+ * unnecessary resolution in reported progress, but small enough that the test
+ * completes in a reasonable amount of time.
+ *
*
- * Note: changing this constant will invalidate comparisons with old performance data.
+ *
+ * Note: changing this constant will invalidate comparisons with old performance
+ * data.
+ *
*/
public static final int PROGRESS_SIZE = 100000;
@@ -58,35 +68,41 @@ public class SubProgressTest {
/**
* Tests the style bits in SubProgressMonitor
+ *
* @deprecated to suppress deprecation warnings
*/
@Deprecated
@Test
public void testStyles() {
- int[] styles = new int[] {0, SubProgressMonitor.PREPEND_MAIN_LABEL_TO_SUBTASK, SubProgressMonitor.SUPPRESS_SUBTASK_LABEL, SubProgressMonitor.PREPEND_MAIN_LABEL_TO_SUBTASK | SubProgressMonitor.SUPPRESS_SUBTASK_LABEL};
+ int[] styles = new int[] { 0, SubProgressMonitor.PREPEND_MAIN_LABEL_TO_SUBTASK,
+ SubProgressMonitor.SUPPRESS_SUBTASK_LABEL,
+ SubProgressMonitor.PREPEND_MAIN_LABEL_TO_SUBTASK | SubProgressMonitor.SUPPRESS_SUBTASK_LABEL };
HashMap expected = new HashMap<>();
- expected.put("style 0 below style 2", new String[] {"setTaskName0", "", "setTaskName1"});
- expected.put("style 2 below style 0", new String[] {"setTaskName1", "beginTask1 ", "setTaskName1"});
- expected.put("style 6 below style 0", new String[] {"setTaskName1", "beginTask1 ", "setTaskName1"});
- expected.put("style 2 below style 4", new String[] {"setTaskName1", "beginTask0 beginTask1 ", "setTaskName1"});
- expected.put("style 0 below style 0", new String[] {"setTaskName0", "subTask1", "setTaskName1"});
- expected.put("style 6 as top-level monitor", new String[] {"", "", "setTaskName0"});
- expected.put("style 6 below style 2", new String[] {"setTaskName1", "", "setTaskName1"});
- expected.put("style 6 below style 6", new String[] {"setTaskName1", "", "setTaskName1"});
- expected.put("style 0 below style 6", new String[] {"setTaskName0", "", "setTaskName1"});
- expected.put("style 4 below style 2", new String[] {"setTaskName1", "", "setTaskName1"});
- expected.put("style 0 as top-level monitor", new String[] {"", "subTask0", "setTaskName0"});
- expected.put("style 0 below style 4", new String[] {"setTaskName0", "beginTask0 subTask1", "setTaskName1"});
- expected.put("style 4 below style 0", new String[] {"setTaskName1", "beginTask1 subTask1", "setTaskName1"});
- expected.put("style 4 as top-level monitor", new String[] {"", "beginTask0 subTask0", "setTaskName0"});
- expected.put("style 2 below style 6", new String[] {"setTaskName1", "", "setTaskName1"});
- expected.put("style 4 below style 6", new String[] {"setTaskName1", "", "setTaskName1"});
- expected.put("style 2 below style 2", new String[] {"setTaskName1", "", "setTaskName1"});
- expected.put("style 2 as top-level monitor", new String[] {"", "", "setTaskName0"});
- expected.put("style 6 below style 4", new String[] {"setTaskName1", "beginTask0 beginTask1 ", "setTaskName1"});
- expected.put("style 4 below style 4", new String[] {"setTaskName1", "beginTask0 beginTask1 subTask1", "setTaskName1"});
+ expected.put("style 0 below style 2", new String[] { "setTaskName0", "", "setTaskName1" });
+ expected.put("style 2 below style 0", new String[] { "setTaskName1", "beginTask1 ", "setTaskName1" });
+ expected.put("style 6 below style 0", new String[] { "setTaskName1", "beginTask1 ", "setTaskName1" });
+ expected.put("style 2 below style 4",
+ new String[] { "setTaskName1", "beginTask0 beginTask1 ", "setTaskName1" });
+ expected.put("style 0 below style 0", new String[] { "setTaskName0", "subTask1", "setTaskName1" });
+ expected.put("style 6 as top-level monitor", new String[] { "", "", "setTaskName0" });
+ expected.put("style 6 below style 2", new String[] { "setTaskName1", "", "setTaskName1" });
+ expected.put("style 6 below style 6", new String[] { "setTaskName1", "", "setTaskName1" });
+ expected.put("style 0 below style 6", new String[] { "setTaskName0", "", "setTaskName1" });
+ expected.put("style 4 below style 2", new String[] { "setTaskName1", "", "setTaskName1" });
+ expected.put("style 0 as top-level monitor", new String[] { "", "subTask0", "setTaskName0" });
+ expected.put("style 0 below style 4", new String[] { "setTaskName0", "beginTask0 subTask1", "setTaskName1" });
+ expected.put("style 4 below style 0", new String[] { "setTaskName1", "beginTask1 subTask1", "setTaskName1" });
+ expected.put("style 4 as top-level monitor", new String[] { "", "beginTask0 subTask0", "setTaskName0" });
+ expected.put("style 2 below style 6", new String[] { "setTaskName1", "", "setTaskName1" });
+ expected.put("style 4 below style 6", new String[] { "setTaskName1", "", "setTaskName1" });
+ expected.put("style 2 below style 2", new String[] { "setTaskName1", "", "setTaskName1" });
+ expected.put("style 2 as top-level monitor", new String[] { "", "", "setTaskName0" });
+ expected.put("style 6 below style 4",
+ new String[] { "setTaskName1", "beginTask0 beginTask1 ", "setTaskName1" });
+ expected.put("style 4 below style 4",
+ new String[] { "setTaskName1", "beginTask0 beginTask1 subTask1", "setTaskName1" });
HashMap results = new HashMap<>();
for (int style : styles) {
@@ -106,7 +122,8 @@ public void testStyles() {
child.done();
}
- // Output the code for the observed results, in case one of them has changed intentionally
+ // Output the code for the observed results, in case one of them has changed
+ // intentionally
for (Map.Entry entry : results.entrySet()) {
String[] expectedResult = expected.get(entry.getKey());
String[] value = entry.getValue();
@@ -129,6 +146,7 @@ private String[] runChildTest(int depth, TestProgressMonitor root, IProgressMoni
/**
* Tests SubProgressMonitor nesting when using the default constructor. (Tests
* parents in floating point mode)
+ *
* @deprecated to suppress deprecation warnings
*/
@Deprecated
@@ -177,8 +195,9 @@ public void testConstructorNestingFP() {
}
/**
- * Tests SubProgressMonitor nesting when using the default constructor. Tests constructors
- * in int mode.
+ * Tests SubProgressMonitor nesting when using the default constructor. Tests
+ * constructors in int mode.
+ *
* @deprecated to suppress deprecation warnings
*/
@Deprecated
@@ -226,7 +245,9 @@ public void testConstructorNestingInt() {
}
/**
- * Tests the automatic cleanup when progress monitors are created via their constructor
+ * Tests the automatic cleanup when progress monitors are created via their
+ * constructor
+ *
* @deprecated to suppress deprecation warnings
*/
@Deprecated
@@ -253,7 +274,8 @@ public void testParallelChildren() {
monitor2.worked(500);
assertEquals(300.0, top.getTotalWork(), 0.01d);
- // Create a monitor that will leak - monitors won't be auto-completed until their done methods are
+ // Create a monitor that will leak - monitors won't be auto-completed until
+ // their done methods are
// called
SubProgressMonitor monitor3 = new SubProgressMonitor(mon, 300);
assertEquals("Monitor2 should not have been cleaned up yet", 300.0, top.getTotalWork(), 0.01d);
@@ -315,8 +337,10 @@ public void testCreateChildrenUnderCustomParent() {
TestProgressMonitor monitor = new TestProgressMonitor();
createChildrenUnderParent(monitor, SubProgressTest.PROGRESS_SIZE);
- // We don't actually expect the progress to be optimal in this case since the progress monitor wouldn't
- // know what it was rooted under and would have had to report more progress than necessary... but we
+ // We don't actually expect the progress to be optimal in this case since the
+ // progress monitor wouldn't
+ // know what it was rooted under and would have had to report more progress than
+ // necessary... but we
// should be able to check that there was no redundancy.
assertEquals(0, monitor.getRedundantWorkCalls());
@@ -324,10 +348,11 @@ public void testCreateChildrenUnderCustomParent() {
}
/**
- * Creates and destroys the given number of child progress monitors under the given parent.
+ * Creates and destroys the given number of child progress monitors under the
+ * given parent.
*
- * @param monitor monitor to create children under. The caller must call done on this monitor
- * if necessary.
+ * @param monitor monitor to create children under. The caller must call
+ * done on this monitor if necessary.
* @param progressSize total number of children to create.
*
* @deprecated to suppress deprecation warnings
diff --git a/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/TestProgressMonitor.java b/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/TestProgressMonitor.java
index bafd6a5a5aa..966ee00b229 100644
--- a/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/TestProgressMonitor.java
+++ b/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/TestProgressMonitor.java
@@ -25,8 +25,8 @@ public class TestProgressMonitor implements IProgressMonitor {
private double totalWork;
/**
- * Records the number of times worked or internalWorked was called with
- * an argument of 0.
+ * Records the number of times worked or internalWorked was called with an
+ * argument of 0.
*/
private int redundantWorkCalls;
@@ -37,8 +37,8 @@ public class TestProgressMonitor implements IProgressMonitor {
private int redundantSetTaskCalls;
/**
- * Records the number of times subTask was called without changing the
- * existing task name
+ * Records the number of times subTask was called without changing the existing
+ * task name
*/
private int redundantSubTaskCalls;
@@ -99,8 +99,8 @@ private static boolean equals(Object o1, Object o2) {
}
/**
- * Returns the number of times beginTask() was called. For a correctly written job,
- * this should equal 1 on completion.
+ * Returns the number of times beginTask() was called. For a correctly written
+ * job, this should equal 1 on completion.
*
* @return the number of calls to beginTask
*/
@@ -119,21 +119,19 @@ public int getDoneCalls() {
}
/**
- * Returns the number of times worked was called as a no-op.
- * That is, it counts the number of times worked() or internalWorked() had
- * ever been called with a value of 0. This should return 0 for an
- * optimally-written job.
+ * Returns the number of times worked was called as a no-op. That is, it counts
+ * the number of times worked() or internalWorked() had ever been called with a
+ * value of 0. This should return 0 for an optimally-written job.
*
- * @return true iff redundant calls were ever made to *worked() on this
- * monitor.
+ * @return true iff redundant calls were ever made to *worked() on this monitor.
*/
public int getRedundantWorkCalls() {
return redundantWorkCalls;
}
/**
- * Returns the number of calls to isCancelled(). Optimally-written
- * jobs may call this an unbounded number of times.
+ * Returns the number of calls to isCancelled(). Optimally-written jobs may call
+ * this an unbounded number of times.
*
* @return the number of calls to isCancelled().
*/
@@ -159,9 +157,9 @@ public int getTaskNameCalls() {
* Returns the number of calls to work() and internalWorked(). For the top-level
* progress monitor in an optimally-written job, this should be at least 100 and
* no more than 1000. A job that reports work less often than this will seem to
- * have jumpy progress, and a job that reports work more often than this is reporting
- * progress that won't be visible to the user and is wasting time in progress monitoring
- * code.
+ * have jumpy progress, and a job that reports work more often than this is
+ * reporting progress that won't be visible to the user and is wasting time in
+ * progress monitoring code.
*
* @return the number of calls to worked(int) or internalWorked(double)
*/
@@ -171,8 +169,8 @@ public int getWorkCalls() {
/**
* Returns the number of calls to internalWorked. For an optimally-written job,
- * this should be 0, since integer work is faster and has no chance
- * of floating-point rounding errors.
+ * this should be 0, since integer work is faster and has no chance of
+ * floating-point rounding errors.
*
* @return the number of calls to internalWorked
*/
@@ -200,8 +198,8 @@ public int getRedundantSubTaskCalls() {
}
/**
- * Returns the total work reported on this monitor. For an optimally-written job,
- * this should be +/- a small epsilon to account for floating point error.
+ * Returns the total work reported on this monitor. For an optimally-written
+ * job, this should be +/- a small epsilon to account for floating point error.
*
* @return the total work reported on this job
*/
@@ -271,25 +269,31 @@ public int getExpectedWork() {
}
/**
- * Asserts that the progress reported on this monitor was optimal. That is,
+ *
+ * Asserts that the progress reported on this monitor was optimal. That is,
* there were no redundant method calls, and progress was reported in between
- * 100 and 1000 increments.
+ * 100 and 1000 increments.
+ *
*/
public void assertOptimal() {
Assert.assertEquals("The progress monitor did not reach 100%", expectedWork, getTotalWork(), 0.01d);
Assert.assertTrue("This monitor reported progress with less than 1% accuracy", getWorkCalls() >= 100);
- Assert.assertTrue("This monitor reported progress with more than 0.1% accuracy (the job spent too much time reporting redundant progress)", getWorkCalls() <= 1000);
+ Assert.assertTrue(
+ "This monitor reported progress with more than 0.1% accuracy (the job spent too much time reporting redundant progress)",
+ getWorkCalls() <= 1000);
Assert.assertEquals("Null work was reported on this monitor", 0, getRedundantWorkCalls());
if (expectedWork >= 1000) {
- // Only check for internalWorked usage if there were enough ticks allocated on this progress
+ // Only check for internalWorked usage if there were enough ticks allocated on
+ // this progress
// monitor that worked(int) could have been used
Assert.assertEquals("internalWorked was being used instead of worked()", 0, getDoubleWorkedCalls());
}
Assert.assertEquals("Redundant calls were made to setTaskName", 0, getRedundantSetTaskCalls());
Assert.assertEquals("Redundant calls were made to subTask", 0, getRedundantSubTaskCalls());
- Assert.assertEquals("The number of calls to done should match the number of calls to beginTask", getBeginTaskCalls(), getDoneCalls());
+ Assert.assertEquals("The number of calls to done should match the number of calls to beginTask",
+ getBeginTaskCalls(), getDoneCalls());
Assert.assertEquals("beginTask should be called exactly once", getBeginTaskCalls(), 1);
}
diff --git a/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/URIUtilTest.java b/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/URIUtilTest.java
index 3d0d6ad8abc..79ea7795962 100644
--- a/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/URIUtilTest.java
+++ b/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/URIUtilTest.java
@@ -36,7 +36,7 @@ public class URIUtilTest extends CoreTest {
/** Constant value indicating if the current platform is Windows */
private static final boolean WINDOWS = java.io.File.separatorChar == '\\';
- private static final String[] testPaths = new String[] {"abc", "with spaces", "with%percent"};
+ private static final String[] testPaths = new String[] { "abc", "with spaces", "with%percent" };
// re-enable once bug 331314 is fixed
public void testBug331314() {
@@ -68,7 +68,7 @@ public void testToJARURI() {
InputStream is = jar.toURL().openStream();
is.close();
- //null entry path
+ // null entry path
URI jar2 = URIUtil.toJarURI(location, null);
assertEquals("2.0", jar.toString(), jar2.toString() + suffix);
@@ -83,6 +83,7 @@ public void testToJARURI() {
/**
* Tests for {@link URIUtil#toFile(URI)}.
+ *
* @throws URISyntaxException
*/
public void testToFile() throws URISyntaxException {
@@ -97,13 +98,14 @@ public void testToFile() throws URISyntaxException {
/**
* Tests for {@link URIUtil#toFile(URI)} involving UNC paths.
+ *
* @throws URISyntaxException
*/
public void testToFileUNC() throws URISyntaxException {
if (!WINDOWS) {
return;
}
- //UNC paths
+ // UNC paths
URI path = new URI("file://HOST/some/path");
File result = URIUtil.toFile(path);
if (File.pathSeparatorChar == '/') {
@@ -123,7 +125,7 @@ public void testToUnencodedString() throws URISyntaxException {
assertEquals("1.2", "foo.bar#fragment", URIUtil.toUnencodedString(new URI("foo.bar#fragment")));
assertEquals("1.3", "#fragment", URIUtil.toUnencodedString(new URI("#fragment")));
- //spaces
+ // spaces
assertEquals("2.1", "http://foo.bar/a b", URIUtil.toUnencodedString(new URI("http://foo.bar/a%20b")));
assertEquals("2.2", "http://foo.bar/a#b c", URIUtil.toUnencodedString(new URI("http://foo.bar/a#b%20c")));
assertEquals("2.3", "foo.bar/a b", URIUtil.toUnencodedString(new URI("foo.bar/a%20b")));
@@ -134,37 +136,39 @@ public void testToUnencodedString() throws URISyntaxException {
* Tests for {@link URIUtil#fromString(String)}.
*/
public void testFromString() throws URISyntaxException {
- //spaces
+ // spaces
assertEquals("1.1", new URI("http://foo.bar/a%20b"), URIUtil.fromString("http://foo.bar/a b"));
assertEquals("1.2", new URI("http://foo.bar/a#b%20c"), URIUtil.fromString("http://foo.bar/a#b c"));
assertEquals("1.3", new URI("foo.bar/a%20b"), URIUtil.fromString("foo.bar/a b"));
assertEquals("1.4", new URI("#a%20b"), URIUtil.fromString("#a b"));
assertEquals("1.5", new URI("file:/C:/foo.bar/a%20b"), URIUtil.fromString("file:/C:/foo.bar/a b"));
- //percent character
+ // percent character
assertEquals("2.1", new URI("http://foo.bar/a%2520b"), URIUtil.fromString("http://foo.bar/a%20b"));
assertEquals("2.2", new URI("http://foo.bar/a#b%2520c"), URIUtil.fromString("http://foo.bar/a#b%20c"));
assertEquals("2.3", new URI("foo.bar/a%2520b"), URIUtil.fromString("foo.bar/a%20b"));
assertEquals("2.4", new URI("#a%2520b"), URIUtil.fromString("#a%20b"));
assertEquals("2.5", new URI("file:/C:/foo.bar/a%2520b"), URIUtil.fromString("file:/C:/foo.bar/a%20b"));
- //relative URI
+ // relative URI
assertEquals("3.1", new URI("a/b"), URIUtil.fromString("file:a/b"));
assertEquals("3.2", new URI("a/b"), URIUtil.fromString("a/b"));
if (WINDOWS) {
assertEquals("3.3", new URI("file:/c:/a/b"), URIUtil.fromString("file:c:/a/b"));
assertEquals("3.4", new URI("file:/c:/a/b"), URIUtil.fromString("file:c:\\a\\b"));
assertEquals("3.5", new URI("file:/c:/a/b"), URIUtil.fromString("file:/c:\\a\\b"));
- assertEquals("3.6", new URI("file:/a/b/c"), URIUtil.fromString("file:/a/b/c"));//bug 264101
- //backslash
- assertEquals("3.7", new URI("file:/a/b/c"), URIUtil.fromString("file:\\a\\b\\c"));//bug 264101
+ assertEquals("3.6", new URI("file:/a/b/c"), URIUtil.fromString("file:/a/b/c"));// bug 264101
+ // backslash
+ assertEquals("3.7", new URI("file:/a/b/c"), URIUtil.fromString("file:\\a\\b\\c"));// bug 264101
}
- //encoded legal character
- assertEquals("4.1", new URI("http://foo.bar/a%2Cb").getSchemeSpecificPart(), URIUtil.fromString("http://foo.bar/a,b").getSchemeSpecificPart());
- assertEquals("4.2", new URI("file:/foo.bar/a%2Cb").getSchemeSpecificPart(), URIUtil.fromString("file:/foo.bar/a,b").getSchemeSpecificPart());
+ // encoded legal character
+ assertEquals("4.1", new URI("http://foo.bar/a%2Cb").getSchemeSpecificPart(),
+ URIUtil.fromString("http://foo.bar/a,b").getSchemeSpecificPart());
+ assertEquals("4.2", new URI("file:/foo.bar/a%2Cb").getSchemeSpecificPart(),
+ URIUtil.fromString("file:/foo.bar/a,b").getSchemeSpecificPart());
- //backslash
+ // backslash
URI uri = URIUtil.fromString("a\\b");
System.out.println(uri);
}
@@ -173,14 +177,14 @@ public void testFromString() throws URISyntaxException {
* Tests for {@link URIUtil#toURI(java.net.URL)}.
*/
public void testURLtoURI() throws MalformedURLException, URISyntaxException {
- //spaces
+ // spaces
assertEquals("1.1", new URI("http://foo.bar/a%20b"), URIUtil.toURI(new URL("http://foo.bar/a b")));
assertEquals("1.2", new URI("http://foo.bar/a#b%20c"), URIUtil.toURI(new URL("http://foo.bar/a#b c")));
- //% characters
+ // % characters
assertEquals("2.1", new URI("http://foo.bar/a%25b"), URIUtil.toURI(new URL("http://foo.bar/a%b")));
- //UNC paths
+ // UNC paths
assertEquals("3.1", new URI("file:////SERVER/some/path"), URIUtil.toURI(new URL("file://SERVER/some/path")));
assertEquals("3.2", new URI("file:////SERVER/some/path"), URIUtil.toURI(new URL("file:////SERVER/some/path")));
}
@@ -189,21 +193,21 @@ public void testURLtoURI() throws MalformedURLException, URISyntaxException {
* Tests for {@link URIUtil#toURL(java.net.URI)}.
*/
public void testURItoURL() throws MalformedURLException, URISyntaxException {
- //spaces
+ // spaces
assertEquals("1.1", new URL("http://foo.bar/a%20b"), URIUtil.toURL(new URI("http://foo.bar/a%20b")));
assertEquals("1.2", new URL("http://foo.bar/a#b%20c"), URIUtil.toURL(new URI("http://foo.bar/a#b%20c")));
- //% characters
+ // % characters
assertEquals("2.1", new URL("http://foo.bar/a%25b"), URIUtil.toURL(new URI("http://foo.bar/a%25b")));
- //UNC paths
+ // UNC paths
assertEquals("3.1", new URL("file:////SERVER/some/path"), URIUtil.toURL(new URI("file:////SERVER/some/path")));
assertEquals("3.2", new URL("file://SERVER/some/path"), URIUtil.toURL(new URI("file://SERVER/some/path")));
}
/**
- * Tests handling of Absolute file system paths on Windows incorrectly encoded as
- * relative URIs (file:c:/tmp).
+ * Tests handling of Absolute file system paths on Windows incorrectly encoded
+ * as relative URIs (file:c:/tmp).
*/
public void testWindowsPathsFromURI() throws MalformedURLException, URISyntaxException {
if (!WINDOWS) {
@@ -214,8 +218,8 @@ public void testWindowsPathsFromURI() throws MalformedURLException, URISyntaxExc
}
/**
- * Tests handling of Absolute file system paths on Windows incorrectly encoded as
- * relative URIs (file:c:/tmp).
+ * Tests handling of Absolute file system paths on Windows incorrectly encoded
+ * as relative URIs (file:c:/tmp).
*/
public void testWindowsPathsFromString() throws URISyntaxException {
if (!WINDOWS) {
@@ -226,7 +230,8 @@ public void testWindowsPathsFromString() throws URISyntaxException {
}
/**
- * Tests handling of conversion from a File with spaces to URL and File to URI and equivalence of the resulting URI
+ * Tests handling of conversion from a File with spaces to URL and File to URI
+ * and equivalence of the resulting URI
*/
public void testFileWithSpaces() throws MalformedURLException, URISyntaxException {
File fileWithSpaces = new File("/c:/with spaces/goo");
@@ -251,7 +256,8 @@ public void testFileWithSpaces() throws MalformedURLException, URISyntaxExceptio
}
/**
- * Tests handling of conversion from a File with spaces to URL and File to URI and equivalence of the resulting URI
+ * Tests handling of conversion from a File with spaces to URL and File to URI
+ * and equivalence of the resulting URI
*/
public void testFileWithBrackets() throws MalformedURLException, URISyntaxException {
File fileWithSpaces = new File("/c:/with[brackets]/goo");
@@ -277,6 +283,7 @@ public void testFileWithBrackets() throws MalformedURLException, URISyntaxExcept
/**
* Tests for {@link URIUtil#append(URI, String)}.
+ *
* @throws URISyntaxException
*/
public void testAppend() throws URISyntaxException {
@@ -296,7 +303,7 @@ public void testAppend() throws URISyntaxException {
* Tests for {@link URIUtil#append(URI, String)} when dealing with UNC paths.
*/
public void testAppendUNC() throws URISyntaxException {
- //UNC paths
+ // UNC paths
URI base = new URI("file:////SERVER/some/path/");
URI relative = new URI("plugins/javax.servlet_2.4.0.v200806031604.jar");
URI expectedResolved = new URI("file:////SERVER/some/path/plugins/javax.servlet_2.4.0.v200806031604.jar");
@@ -305,42 +312,46 @@ public void testAppendUNC() throws URISyntaxException {
}
/**
- * Tests for {@link URIUtil#append(URI, String)} when dealing with paths containing brackets.
+ * Tests for {@link URIUtil#append(URI, String)} when dealing with paths
+ * containing brackets.
+ *
* @throws URISyntaxException
*/
public void testAppendWithBrackets() throws URISyntaxException {
- //append a simple string
+ // append a simple string
URI base = new URI("http://example.com/base/");
URI result = URIUtil.append(base, "file[with brackets].txt");
assertEquals("1.0", "http://example.com/base/file%5Bwith%20brackets%5D.txt", result.toString());
assertEquals("1.1", "/base/file[with brackets].txt", result.getPath());
- //append a relative path
+ // append a relative path
result = URIUtil.append(base, "some/path/file[with brackets].txt");
assertEquals("2.0", "http://example.com/base/some/path/file%5Bwith%20brackets%5D.txt", result.toString());
assertEquals("2.1", "/base/some/path/file[with brackets].txt", result.getPath());
- //simple string where base has no trailing separator
+ // simple string where base has no trailing separator
base = new URI("http://example.com/base");
result = URIUtil.append(base, "file[with brackets].txt");
assertEquals("3.0", "http://example.com/base/file%5Bwith%20brackets%5D.txt", result.toString());
assertEquals("3.1", "/base/file[with brackets].txt", result.getPath());
- //append a path where base has no trailing separator
+ // append a path where base has no trailing separator
result = URIUtil.append(base, "some/path/file[with brackets].txt");
assertEquals("4.0", "http://example.com/base/some/path/file%5Bwith%20brackets%5D.txt", result.toString());
assertEquals("4.1", "/base/some/path/file[with brackets].txt", result.getPath());
- //TODO opaque URI
- // URI opaque = new URI("opaque:something/opaque/");
- // result = URIUtil.append(opaque, "some/path/file[with brackets].txt");
- // assertEquals("5.0", "opaque:something/opaque/some/path/file%5Bwith%20brackets%5D.txt", result.toString());
- // assertEquals("5.1", null, result.getPath());
+ // TODO opaque URI
+ // URI opaque = new URI("opaque:something/opaque/");
+ // result = URIUtil.append(opaque, "some/path/file[with brackets].txt");
+ // assertEquals("5.0",
+ // "opaque:something/opaque/some/path/file%5Bwith%20brackets%5D.txt",
+ // result.toString());
+ // assertEquals("5.1", null, result.getPath());
}
public void testBug286339() throws URISyntaxException {
- //single letter server path
+ // single letter server path
URI base = new URI("file:////S/some/path/");
URI relative = new URI("plugins/javax.servlet_2.4.0.v200806031604.jar");
URI expectedResolved = new URI("file:////S/some/path/plugins/javax.servlet_2.4.0.v200806031604.jar");
@@ -360,12 +371,16 @@ public void testAppendWindows() throws URISyntaxException {
base = new URI("file:/C:/Documents%20and%20Settings/aniefer/junit-workspace/pde.build/265726/buildRepo/");
result = URIUtil.append(base, "content.jar");
- assertEquals("2.0", "file:/C:/Documents%20and%20Settings/aniefer/junit-workspace/pde.build/265726/buildRepo/content.jar", result.toString());
- assertEquals("2.1", "/C:/Documents and Settings/aniefer/junit-workspace/pde.build/265726/buildRepo/content.jar", result.getSchemeSpecificPart());
+ assertEquals("2.0",
+ "file:/C:/Documents%20and%20Settings/aniefer/junit-workspace/pde.build/265726/buildRepo/content.jar",
+ result.toString());
+ assertEquals("2.1", "/C:/Documents and Settings/aniefer/junit-workspace/pde.build/265726/buildRepo/content.jar",
+ result.getSchemeSpecificPart());
}
/**
- * Tests handling of conversion from a File with %20 to URL and File to URI and equivalence of the resulting URI
+ * Tests handling of conversion from a File with %20 to URL and File to URI and
+ * equivalence of the resulting URI
*/
public void testFileWithPercent20() throws MalformedURLException, URISyntaxException {
File fileWithPercent20 = new File("/c:/with%20spaces/goo");
@@ -375,7 +390,8 @@ public void testFileWithPercent20() throws MalformedURLException, URISyntaxExcep
assertNotSame("1.1", correctURI, fileURL.toURI());
assertEquals("1.2", correctURI, URIUtil.toURI(fileURL));
assertNotSame("1.3", correctURI, new URI(fileURL.toString()));
- // we expect these to not be the same because fromString assumes a decoded URL String
+ // we expect these to not be the same because fromString assumes a decoded URL
+ // String
assertNotSame("1.4", correctURI, URIUtil.fromString(fileURL.toString()));
}
@@ -390,8 +406,11 @@ public void testRemoveExtension() {
URI uri3 = new URI("file:/foo/bar.zoo/foo");
assertEquals(new URI("file:/foo/bar.zoo/foo"), URIUtil.removeFileExtension(uri3));
- URI uri4 = new URI("file:/C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/testRepo/plugins/org.junit_3.8.2.v200706111738.jar");
- assertEquals(new URI("file:/C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/testRepo/plugins/org.junit_3.8.2.v200706111738"), URIUtil.removeFileExtension(uri4));
+ URI uri4 = new URI(
+ "file:/C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/testRepo/plugins/org.junit_3.8.2.v200706111738.jar");
+ assertEquals(
+ new URI("file:/C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/testRepo/plugins/org.junit_3.8.2.v200706111738"),
+ URIUtil.removeFileExtension(uri4));
} catch (URISyntaxException e) {
fail("URI syntax exception", e);
}
@@ -411,7 +430,7 @@ public void testSameURI() throws URISyntaxException {
assertFalse("1.0", URIUtil.sameURI(new File("a").toURI(), URIUtil.fromString("file:a")));
assertFalse("1.1", URIUtil.sameURI(new URI("file:/a"), URIUtil.fromString("file:a")));
- //encoded characters
+ // encoded characters
assertTrue("2.0", URIUtil.sameURI(new URI("foo:/a%2Cb"), new URI("foo:/a,b")));
assertTrue("2.1", URIUtil.sameURI(new URI("file:/a%2Cb"), new URI("file:/a,b")));
}
@@ -420,38 +439,44 @@ public void testSameURIWindows() throws URISyntaxException {
if (!WINDOWS) {
return;
}
- //device and case variants
+ // device and case variants
assertTrue("1.0", URIUtil.sameURI(new URI("file:C:/a"), new URI("file:c:/a")));
assertTrue("1.1", URIUtil.sameURI(new URI("file:/C:/a"), new URI("file:/c:/a")));
assertTrue("1.2", URIUtil.sameURI(new URI("file:/A"), new URI("file:/a")));
assertTrue("1.3", URIUtil.sameURI(new URI("file:A"), new URI("file:a")));
assertTrue("1.4", URIUtil.sameURI(new URI("file:/A/"), new URI("file:/a/")));
- //negative cases
+ // negative cases
assertFalse("2.0", URIUtil.sameURI(new URI("file:/a/b"), new URI("file:/c:/a/b")));
}
public void testMakeAbsolute() throws URISyntaxException {
URI[][] data = new URI[][] {
// simple path
- 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")},
+ 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")},
+ 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("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")}, //
- //cases that can't be made absolute
- //different scheme
- new URI[] {new URI("file:../plugins/foo.jar"), new URI("http:/eclipse/configuration"), new URI("file:../plugins/foo.jar")}, //
- //already absolute
- new URI[] {new URI("file:../plugins/foo.jar"), new URI("file:/eclipse/configuration"), new URI("file:../plugins/foo.jar")}, //
- new URI[] {new URI("file:/foo.jar"), new URI("file:/eclipse/configuration"), new URI("file:/foo.jar")}, //
- //encoded characters
- new URI[] {new URI("plugins%5Cfoo.jar"), new URI("file:/eclipse/"), new URI("file:/eclipse/plugins%5Cfoo.jar")},//
- new URI[] {new URI("a%20b"), new URI("file:/eclipse/"), new URI("file:/eclipse/a%20b")},//
+ new URI[] { new URI("../plugins/foo.jar"), new URI("file:/eclipse/configuration"),
+ new URI("file:/eclipse/plugins/foo.jar") }, //
+ // cases that can't be made absolute
+ // different scheme
+ new URI[] { new URI("file:../plugins/foo.jar"), new URI("http:/eclipse/configuration"),
+ new URI("file:../plugins/foo.jar") }, //
+ // already absolute
+ new URI[] { new URI("file:../plugins/foo.jar"), new URI("file:/eclipse/configuration"),
+ new URI("file:../plugins/foo.jar") }, //
+ new URI[] { new URI("file:/foo.jar"), new URI("file:/eclipse/configuration"),
+ new URI("file:/foo.jar") }, //
+ // encoded characters
+ new URI[] { new URI("plugins%5Cfoo.jar"), new URI("file:/eclipse/"),
+ new URI("file:/eclipse/plugins%5Cfoo.jar") }, //
+ new URI[] { new URI("a%20b"), new URI("file:/eclipse/"), new URI("file:/eclipse/a%20b") },//
};
for (int i = 0; i < data.length; i++) {
@@ -468,26 +493,30 @@ public void testMakeAbsolute() throws URISyntaxException {
}
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")},
+ 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")},
+ 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")},
+ 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("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("/c:/a/b/c"), new URI("file:/d:/a/b/"), new URI("file:/c:/a/b/c")}, //
- new URI[] {new URI(""), new URI("file:/c:/"), new URI("file:/c:/")}, //
+ 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("/c:/a/b/c"), new URI("file:/d:/a/b/"), new URI("file:/c:/a/b/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")}, //
- //already absolute
- new URI[] {new URI("file:../plugins/foo.jar"), new URI("file:/c:/eclipse/configuration"), new URI("file:../plugins/foo.jar")}, //
+ new URI[] { new URI("../plugins/foo.jar"), new URI("file:/c:/eclipse/configuration"),
+ new URI("file:/c:/eclipse/plugins/foo.jar") }, //
+ // already absolute
+ new URI[] { new URI("file:../plugins/foo.jar"), new URI("file:/c:/eclipse/configuration"),
+ new URI("file:../plugins/foo.jar") }, //
};
for (int i = 0; i < data.length; i++) {
URI location = data[i][0];
@@ -507,7 +536,7 @@ public void testMakeAbsoluteUNC() throws URISyntaxException {
URI result = URIUtil.makeAbsolute(relative, base);
assertEquals("1.0", new URI("file:////SERVER/some/path/plugins/javax.servlet_2.4.0.v200806031604.jar"), result);
- //an absolute URI should not be resolved
+ // an absolute URI should not be resolved
URI absolute = new URI("file:////ANOTHERSERVER/another/path");
URI resolved = URIUtil.makeAbsolute(absolute, base);
assertEquals("1.1", absolute, resolved);
@@ -517,14 +546,15 @@ public void testMakeAbsoluteUNC() throws URISyntaxException {
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")},
+ 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")},
+ 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("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("")}, //
+ new URI[] { new URI("file:/"), new URI("file:/"), new URI("") }, //
};
for (int i = 0; i < data.length; i++) {
@@ -541,19 +571,21 @@ public void testMakeRelative() throws URISyntaxException {
}
data = new URI[][] {
// simple path
- new URI[] {new URI("file:/c:/a/b"), new URI("file:/c:/a/x"), new URI("../b")},
+ 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")},
+ new URI[] { new URI("file:/c:/eclipse/plugins/foo.jar"), new URI("file:/c:/eclipse/"),
+ new URI("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")},
+ 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("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("file:/c:/a/b"), new URI("file:/C:/a/x"), new URI("../b")}, //
- 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("")}, //
+ new URI[] { new URI("file:/c:/a/b"), new URI("file:/C:/a/x"), new URI("../b") }, //
+ 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];
@@ -580,7 +612,6 @@ public void testDollar() throws URISyntaxException {
// @formatter:on
};
-
// Test that appending a segment without trailing slash works as expected
final URI expectedResolved1 = new URI("file:////WSL$/Ubuntu/SomePath");
for (String uri : uris) {
@@ -622,8 +653,7 @@ public void testDollar() throws URISyntaxException {
assertEquals(
"Crating an URI using URIUtil from URI using Scheme, SchemeSpecificPart and Fragment failed for "
+ uri,
- test,
- URIUtil.toURI(test.getScheme(), test.getSchemeSpecificPart(), test.getFragment()));
+ test, URIUtil.toURI(test.getScheme(), test.getSchemeSpecificPart(), test.getFragment()));
}
@@ -645,37 +675,36 @@ public void testDollar() throws URISyntaxException {
final URI test = new URI(uris[i]);
final URI ref = new URI(expected3[i]);
if (i < 2) {
- assertThrows(
- "Crating an URI from URI using Scheme, UserInfo, Host, Port, Path, Query and Fragment should fail for "
- + uris[i],
- URISyntaxException.class, () -> {
- new URI(test.getScheme(), test.getUserInfo(), test.getHost(), test.getPort(), test.getPath(),
- test.getQuery(), test.getFragment());
+ assertThrows(
+ "Crating an URI from URI using Scheme, UserInfo, Host, Port, Path, Query and Fragment should fail for "
+ + uris[i],
+ URISyntaxException.class, () -> {
+ new URI(test.getScheme(), test.getUserInfo(), test.getHost(), test.getPort(),
+ test.getPath(), test.getQuery(), test.getFragment());
});
}
- assertEquals("Crating an URI using URIUtil from URI using Scheme, UserInfo, Host, Port, Path, Query and Fragment failed for "
- + uris[i], ref,
- URIUtil.toURI(test.getScheme(), test.getUserInfo(), test.getHost(), test.getPort(), test.getPath(),
- test.getQuery(), test.getFragment()));
+ assertEquals(
+ "Crating an URI using URIUtil from URI using Scheme, UserInfo, Host, Port, Path, Query and Fragment failed for "
+ + uris[i],
+ ref, URIUtil.toURI(test.getScheme(), test.getUserInfo(), test.getHost(), test.getPort(),
+ test.getPath(), test.getQuery(), test.getFragment()));
}
for (int i = 0; i < uris.length; i++) {
final URI test = new URI(uris[i]);
final URI ref = new URI(expected3[i]);
if (i < 2) {
- assertThrows("Crating an URI from URI using Scheme, Host, Path, and Fragment should fail for " + uris[i],
- URISyntaxException.class, () -> {
- new URI(test.getScheme(), test.getHost(), test.getPath(), test.getFragment());
- });
+ assertThrows(
+ "Crating an URI from URI using Scheme, Host, Path, and Fragment should fail for " + uris[i],
+ URISyntaxException.class, () -> {
+ new URI(test.getScheme(), test.getHost(), test.getPath(), test.getFragment());
+ });
}
assertEquals(
"Crating an URI using URIUtil from URI using Scheme, Host, Path, and Fragment failed for "
+ uris[i],
- ref,
- URIUtil.toURI(test.getScheme(), test.getHost(), test.getPath(), test.getFragment()));
+ ref, URIUtil.toURI(test.getScheme(), test.getHost(), test.getPath(), test.getFragment()));
}
-
-
}
}
diff --git a/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/adaptable/AdaptableTests.java b/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/adaptable/AdaptableTests.java
index 28dc0966cfa..874f2e20037 100644
--- a/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/adaptable/AdaptableTests.java
+++ b/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/adaptable/AdaptableTests.java
@@ -18,12 +18,8 @@
import org.junit.runners.Suite.SuiteClasses;
@RunWith(Suite.class)
-@SuiteClasses({
- AdapterManagerDynamicTest.class,
- IAdapterManagerServiceTest.class,
- IAdapterManagerTest.class,
- AdaptersTest.class
-})
+@SuiteClasses({ AdapterManagerDynamicTest.class, IAdapterManagerServiceTest.class, IAdapterManagerTest.class,
+ AdaptersTest.class })
public class AdaptableTests {
// intentionally left blank
}
diff --git a/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/adaptable/AdapterManagerDynamicTest.java b/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/adaptable/AdapterManagerDynamicTest.java
index b34a59f445c..208ca62b526 100644
--- a/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/adaptable/AdapterManagerDynamicTest.java
+++ b/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/adaptable/AdapterManagerDynamicTest.java
@@ -32,8 +32,8 @@
import org.osgi.framework.FrameworkUtil;
/**
- * Tests reaction of AdapterManager on addition and removal of adapters from
- * the extension registry.
+ * Tests reaction of AdapterManager on addition and removal of adapters from the
+ * extension registry.
*/
public class AdapterManagerDynamicTest {
@@ -83,7 +83,7 @@ public void testDynamicBundles() throws IOException, BundleException {
BundleContext bundleContext = FrameworkUtil.getBundle(getClass()).getBundleContext();
bundle01 = BundleTestingHelper.installBundle("0.1", bundleContext, "Plugin_Testing/adapters/dynamic/A");
bundle02 = BundleTestingHelper.installBundle("0.2", bundleContext, "Plugin_Testing/adapters/dynamic/B");
- BundleTestingHelper.refreshPackages(bundleContext, new Bundle[] {bundle01, bundle02});
+ BundleTestingHelper.refreshPackages(bundleContext, new Bundle[] { bundle01, bundle02 });
// synchronization: listener should receive 2 groups of events
assertEquals(2, listener.waitFor(2, 2 * MAX_TIME_PER_BUNDLE));
diff --git a/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/adaptable/IAdapterManagerServiceTest.java b/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/adaptable/IAdapterManagerServiceTest.java
index 49edf54270d..2d47c473b1d 100644
--- a/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/adaptable/IAdapterManagerServiceTest.java
+++ b/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/adaptable/IAdapterManagerServiceTest.java
@@ -107,8 +107,7 @@ public void testAdaptersOSGiLazyExt() {
new ServiceFactory() {
@Override
- public IAdapterFactory getService(Bundle bundle,
- ServiceRegistration r) {
+ public IAdapterFactory getService(Bundle bundle, ServiceRegistration r) {
created.set(true);
return new TestAdapterFactory2(TestAdapter2::new);
}
diff --git a/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/adaptable/IAdapterManagerTest.java b/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/adaptable/IAdapterManagerTest.java
index 5fe45ae762e..dbf33ecf0b7 100644
--- a/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/adaptable/IAdapterManagerTest.java
+++ b/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/adaptable/IAdapterManagerTest.java
@@ -279,8 +279,7 @@ public Class>[] getAdapterList() {
};
try {
manager.registerAdapters(fac, Private.class);
- AssertionFailedException e = assertThrows(
- AssertionFailedException.class,
+ AssertionFailedException e = assertThrows(AssertionFailedException.class,
() -> manager.getAdapter(new Private(), Private.class));
assertTrue(e.getMessage().contains(fac.getClass().getName()));
assertTrue(e.getMessage().contains(Boolean.class.getName()));
diff --git a/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/adaptable/TestAdapterFactory.java b/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/adaptable/TestAdapterFactory.java
index 8c32f97c518..95023beb399 100644
--- a/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/adaptable/TestAdapterFactory.java
+++ b/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/adaptable/TestAdapterFactory.java
@@ -27,6 +27,6 @@ public T getAdapter(Object adaptableObject, Class adapterType) {
@Override
public Class>[] getAdapterList() {
- return new Class[] {TestAdapter.class};
+ return new Class[] { TestAdapter.class };
}
}
diff --git a/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/adaptable/TestAdapterFactoryLoader.java b/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/adaptable/TestAdapterFactoryLoader.java
index ffe78ce6c72..632f0a9be3a 100644
--- a/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/adaptable/TestAdapterFactoryLoader.java
+++ b/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/adaptable/TestAdapterFactoryLoader.java
@@ -22,9 +22,9 @@
* The adaptor factory to test scenario described in the bug 200068: adapting to
* a class not reachable be the default class loader.
*
- * This is a test code so almost all sanity checks are omitted (it is working on a known
- * hard-coded set of extensions and extension points). Also, for simplicity no trackers
- * or caching is done.
+ * This is a test code so almost all sanity checks are omitted (it is working on
+ * a known hard-coded set of extensions and extension points). Also, for
+ * simplicity no trackers or caching is done.
*/
public class TestAdapterFactoryLoader extends Assert implements IAdapterFactory {
@@ -55,7 +55,7 @@ public Class>[] getAdapterList() {
IContributor contributor = extension.getContributor();
Bundle extensionBundle = ContributorFactoryOSGi.resolve(contributor);
try {
- return new Class[] {extensionBundle.loadClass(className)};
+ return new Class[] { extensionBundle.loadClass(className) };
} catch (ClassNotFoundException e) {
e.printStackTrace();
fail("Unable to load class " + className);
diff --git a/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/registry/ExtensionRegistryDynamicTest.java b/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/registry/ExtensionRegistryDynamicTest.java
index 6a21e91c864..3e6a8887ae1 100644
--- a/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/registry/ExtensionRegistryDynamicTest.java
+++ b/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/registry/ExtensionRegistryDynamicTest.java
@@ -38,9 +38,11 @@ public void testAddition() throws IOException, BundleException {
listener.register();
try {
BundleContext bundleContext = FrameworkUtil.getBundle(getClass()).getBundleContext();
- bundle01 = BundleTestingHelper.installBundle("0.1", bundleContext, "Plugin_Testing/registryEvents/bundle01");
- bundle02 = BundleTestingHelper.installBundle("0.2", bundleContext, "Plugin_Testing/registryEvents/bundle02");
- BundleTestingHelper.refreshPackages(bundleContext, new Bundle[] {bundle01, bundle02});
+ bundle01 = BundleTestingHelper.installBundle("0.1", bundleContext,
+ "Plugin_Testing/registryEvents/bundle01");
+ bundle02 = BundleTestingHelper.installBundle("0.2", bundleContext,
+ "Plugin_Testing/registryEvents/bundle02");
+ BundleTestingHelper.refreshPackages(bundleContext, new Bundle[] { bundle01, bundle02 });
IExtensionRegistry registry = RegistryFactory.getRegistry();
IExtensionPoint extPoint = registry.getExtensionPoint("bundle01.xp1");
IExtension[] extensions = extPoint.getExtensions();
@@ -69,11 +71,13 @@ public void testReresolving() throws IOException, BundleException {
listener.register();
try {
BundleContext bundleContext = FrameworkUtil.getBundle(getClass()).getBundleContext();
- bundle01 = BundleTestingHelper.installBundle("0.1", bundleContext, "Plugin_Testing/registryEvents/bundle01");
- bundle02 = BundleTestingHelper.installBundle("0.2", bundleContext, "Plugin_Testing/registryEvents/bundle02");
- BundleTestingHelper.refreshPackages(bundleContext, new Bundle[] {bundle01, bundle02});
+ bundle01 = BundleTestingHelper.installBundle("0.1", bundleContext,
+ "Plugin_Testing/registryEvents/bundle01");
+ bundle02 = BundleTestingHelper.installBundle("0.2", bundleContext,
+ "Plugin_Testing/registryEvents/bundle02");
+ BundleTestingHelper.refreshPackages(bundleContext, new Bundle[] { bundle01, bundle02 });
assertEquals("0.5", IExtensionDelta.ADDED, listener.eventTypeReceived(20000));
- BundleTestingHelper.refreshPackages(bundleContext, new Bundle[] {bundle02});
+ BundleTestingHelper.refreshPackages(bundleContext, new Bundle[] { bundle02 });
assertEquals("1.2", IExtensionDelta.REMOVED, listener.eventTypeReceived(10000));
assertEquals("2.2", IExtensionDelta.ADDED, listener.eventTypeReceived(10000));
} finally {
@@ -102,9 +106,11 @@ public void testEventTracker() throws IOException, BundleException {
TestRegistryChangeListener lastListener = null;
try {
BundleContext bundleContext = FrameworkUtil.getBundle(getClass()).getBundleContext();
- bundle01 = BundleTestingHelper.installBundle("0.1", bundleContext, "Plugin_Testing/registryEvents/bundle01");
- bundle02 = BundleTestingHelper.installBundle("0.2", bundleContext, "Plugin_Testing/registryEvents/bundle02");
- BundleTestingHelper.refreshPackages(bundleContext, new Bundle[] {bundle01, bundle02});
+ bundle01 = BundleTestingHelper.installBundle("0.1", bundleContext,
+ "Plugin_Testing/registryEvents/bundle01");
+ bundle02 = BundleTestingHelper.installBundle("0.2", bundleContext,
+ "Plugin_Testing/registryEvents/bundle02");
+ BundleTestingHelper.refreshPackages(bundleContext, new Bundle[] { bundle01, bundle02 });
assertEquals("0.5", IExtensionDelta.ADDED, listener.eventTypeReceived(20000));
ExtensionTracker tracker = new ExtensionTracker();
@@ -129,7 +135,8 @@ public void removeExtension(IExtension extension, Object[] objects) {
}, ExtensionTracker.createExtensionPointFilter(extPoint));
lastListener = new TestRegistryChangeListener("bundle01", "xp1", "bundle02", "ext1");
- // this relies on implementation details: listeners are called in the order they are registered
+ // this relies on implementation details: listeners are called in the order they
+ // are registered
lastListener.register();
bundle02.uninstall();
diff --git a/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/registry/ExtensionRegistryStaticTest.java b/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/registry/ExtensionRegistryStaticTest.java
index e89fbecbeb7..31008003850 100644
--- a/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/registry/ExtensionRegistryStaticTest.java
+++ b/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/registry/ExtensionRegistryStaticTest.java
@@ -44,234 +44,283 @@ public static void setUp() throws Exception {
@Test
public void testA() throws IOException, BundleException {
- //test the addition of an extension point
+ // test the addition of an extension point
String name = "A";
Bundle bundle01 = BundleTestingHelper.installBundle("", fBundleContext, "Plugin_Testing/registry/test" + name);
- BundleTestingHelper.refreshPackages(fBundleContext, new Bundle[] {bundle01});
+ BundleTestingHelper.refreshPackages(fBundleContext, new Bundle[] { bundle01 });
testExtensionPoint(name);
}
+
@Test
public void testAFromCache() {
- //Check that it has been persisted
+ // Check that it has been persisted
testExtensionPoint("A");
}
-
+
private void testExtensionPoint(String name) {
assertNotNull(RegistryFactory.getRegistry().getExtensionPoint("test" + name + ".xpt" + name));
- assertEquals(RegistryFactory.getRegistry().getExtensionPoint("test" + name + ".xpt" + name).getLabel(), "Label xpt" + name);
- assertEquals(RegistryFactory.getRegistry().getExtensionPoint("test" + name + ".xpt" + name).getNamespace(), "test" + name);
- assertEquals(RegistryFactory.getRegistry().getExtensionPoint("test" + name + ".xpt" + name).getNamespaceIdentifier(), "test" + name);
- assertEquals(RegistryFactory.getRegistry().getExtensionPoint("test" + name + ".xpt" + name).getContributor().getName(), "test" + name);
- assertEquals(RegistryFactory.getRegistry().getExtensionPoint("test" + name + ".xpt" + name).getSchemaReference(), "schema/xpt" + name + ".exsd");
+ assertEquals(RegistryFactory.getRegistry().getExtensionPoint("test" + name + ".xpt" + name).getLabel(),
+ "Label xpt" + name);
+ assertEquals(RegistryFactory.getRegistry().getExtensionPoint("test" + name + ".xpt" + name).getNamespace(),
+ "test" + name);
+ assertEquals(
+ RegistryFactory.getRegistry().getExtensionPoint("test" + name + ".xpt" + name).getNamespaceIdentifier(),
+ "test" + name);
+ assertEquals(RegistryFactory.getRegistry().getExtensionPoint("test" + name + ".xpt" + name).getContributor()
+ .getName(), "test" + name);
+ assertEquals(
+ RegistryFactory.getRegistry().getExtensionPoint("test" + name + ".xpt" + name).getSchemaReference(),
+ "schema/xpt" + name + ".exsd");
}
+
@Test
public void testB() throws IOException, BundleException {
- //test the addition of an extension without extension point
+ // test the addition of an extension without extension point
Bundle bundle01 = BundleTestingHelper.installBundle("", fBundleContext, "Plugin_Testing/registry/testB/1");
- BundleTestingHelper.refreshPackages(fBundleContext, new Bundle[] {bundle01});
+ BundleTestingHelper.refreshPackages(fBundleContext, new Bundle[] { bundle01 });
assertNull(RegistryFactory.getRegistry().getExtension("testB2", "xptB2", "ext1"));
}
+
@Test
public void testBFromCache() throws IOException, BundleException {
// Test the addition of an extension point when orphans extension exists
assertNull(RegistryFactory.getRegistry().getExtension("testB2", "xptB2", "ext1"));
Bundle bundle02 = BundleTestingHelper.installBundle("", fBundleContext, "Plugin_Testing/registry/testB/2");
- BundleTestingHelper.refreshPackages(fBundleContext, new Bundle[] {bundle02});
+ BundleTestingHelper.refreshPackages(fBundleContext, new Bundle[] { bundle02 });
testExtensionPoint("B2");
- // Test the configuration elements
- assertEquals(RegistryFactory.getRegistry().getExtension("testB2", "xptB2", "testB1.ext1").getConfigurationElements().length, 0);
+ // Test the configuration elements
+ assertEquals(RegistryFactory.getRegistry().getExtension("testB2", "xptB2", "testB1.ext1")
+ .getConfigurationElements().length, 0);
assertEquals(RegistryFactory.getRegistry().getConfigurationElementsFor("testB2.xptB2").length, 0);
- //Test the number of extension in the namespace
+ // Test the number of extension in the namespace
assertEquals(RegistryFactory.getRegistry().getExtensions("testB1").length, 1);
- //Test the extension
+ // Test the extension
assertNotNull(RegistryFactory.getRegistry().getExtension("testB1.ext1"));
assertNotNull(RegistryFactory.getRegistry().getExtension("testB2", "xptB2", "testB1.ext1"));
assertNotNull(RegistryFactory.getRegistry().getExtension("testB2.xptB2", "testB1.ext1"));
assertNotNull(RegistryFactory.getRegistry().getExtensionPoint("testB2.xptB2").getExtension("testB1.ext1"));
- assertEquals(RegistryFactory.getRegistry().getExtensionPoint("testB2.xptB2").getExtensions()[0].getUniqueIdentifier(), "testB1.ext1");
+ assertEquals(RegistryFactory.getRegistry().getExtensionPoint("testB2.xptB2").getExtensions()[0]
+ .getUniqueIdentifier(), "testB1.ext1");
- //uninstall the bundle contributing the extension point
+ // uninstall the bundle contributing the extension point
bundle02.uninstall();
- BundleTestingHelper.refreshPackages(fBundleContext, new Bundle[] {bundle02});
+ BundleTestingHelper.refreshPackages(fBundleContext, new Bundle[] { bundle02 });
assertNull(RegistryFactory.getRegistry().getExtension("testB1.ext1"));
assertEquals(RegistryFactory.getRegistry().getExtensions("testB1").length, 0);
assertEquals(RegistryFactory.getRegistry().getExtensionPoints("testB2").length, 0);
assertNull(RegistryFactory.getRegistry().getExtensionPoint("testB2.xptB2"));
}
+
@Test
public void testBRemoved() {
- //Test if testB has been removed.
+ // Test if testB has been removed.
assertNull(RegistryFactory.getRegistry().getExtension("testB1.ext1"));
assertEquals(RegistryFactory.getRegistry().getExtensions("testB1").length, 0);
assertEquals(RegistryFactory.getRegistry().getExtensionPoints("testB2").length, 0);
assertNull(RegistryFactory.getRegistry().getExtensionPoint("testB2.xptB2"));
}
+
@Test
public void testC() throws IOException, BundleException {
- //test the addition of an extension point then the addition of an extension
+ // test the addition of an extension point then the addition of an extension
Bundle bundle01 = BundleTestingHelper.installBundle("", fBundleContext, "Plugin_Testing/registry/testC/1");
- BundleTestingHelper.refreshPackages(fBundleContext, new Bundle[] {bundle01});
+ BundleTestingHelper.refreshPackages(fBundleContext, new Bundle[] { bundle01 });
testExtensionPoint("C1");
Bundle bundle02 = BundleTestingHelper.installBundle("", fBundleContext, "Plugin_Testing/registry/testC/2");
- BundleTestingHelper.refreshPackages(fBundleContext, new Bundle[] {bundle02});
+ BundleTestingHelper.refreshPackages(fBundleContext, new Bundle[] { bundle02 });
- //Test the configurataion elements
- assertEquals(RegistryFactory.getRegistry().getExtension("testC1", "xptC1", "testC2.ext1").getConfigurationElements().length, 0);
+ // Test the configurataion elements
+ assertEquals(RegistryFactory.getRegistry().getExtension("testC1", "xptC1", "testC2.ext1")
+ .getConfigurationElements().length, 0);
assertEquals(RegistryFactory.getRegistry().getConfigurationElementsFor("testC1.xptC1").length, 0);
- //Test the number of extension in the namespace
+ // Test the number of extension in the namespace
assertEquals(RegistryFactory.getRegistry().getExtensions("testC2").length, 1);
- //Test the extension
+ // Test the extension
assertNotNull(RegistryFactory.getRegistry().getExtension("testC2.ext1"));
assertNotNull(RegistryFactory.getRegistry().getExtension("testC1", "xptC1", "testC2.ext1"));
assertNotNull(RegistryFactory.getRegistry().getExtension("testC1.xptC1", "testC2.ext1"));
assertNotNull(RegistryFactory.getRegistry().getExtensionPoint("testC1.xptC1").getExtension("testC2.ext1"));
- assertEquals(RegistryFactory.getRegistry().getExtensionPoint("testC1.xptC1").getExtensions()[0].getUniqueIdentifier(), "testC2.ext1");
+ assertEquals(RegistryFactory.getRegistry().getExtensionPoint("testC1.xptC1").getExtensions()[0]
+ .getUniqueIdentifier(), "testC2.ext1");
}
+
@Test
public void testD() throws IOException, BundleException {
- //test the addition of an extension then the addition of an extension point
+ // test the addition of an extension then the addition of an extension point
Bundle bundle02 = BundleTestingHelper.installBundle("", fBundleContext, "Plugin_Testing/registry/testD/2");
- BundleTestingHelper.refreshPackages(fBundleContext, new Bundle[] {bundle02});
+ BundleTestingHelper.refreshPackages(fBundleContext, new Bundle[] { bundle02 });
Bundle bundle01 = BundleTestingHelper.installBundle("", fBundleContext, "Plugin_Testing/registry/testD/1");
- BundleTestingHelper.refreshPackages(fBundleContext, new Bundle[] {bundle01});
+ BundleTestingHelper.refreshPackages(fBundleContext, new Bundle[] { bundle01 });
testExtensionPoint("D1");
- //Test the configurataion elements
- assertEquals(RegistryFactory.getRegistry().getExtension("testD1", "xptD1", "testD2.ext1").getConfigurationElements().length, 0);
+ // Test the configurataion elements
+ assertEquals(RegistryFactory.getRegistry().getExtension("testD1", "xptD1", "testD2.ext1")
+ .getConfigurationElements().length, 0);
assertEquals(RegistryFactory.getRegistry().getConfigurationElementsFor("testD1.xptD1").length, 0);
- //Test the number of extension in the namespace
+ // Test the number of extension in the namespace
assertEquals(RegistryFactory.getRegistry().getExtensions("testD2").length, 1);
- //Test the extension
+ // Test the extension
assertNotNull(RegistryFactory.getRegistry().getExtension("testD2.ext1"));
assertNotNull(RegistryFactory.getRegistry().getExtension("testD1", "xptD1", "testD2.ext1"));
assertNotNull(RegistryFactory.getRegistry().getExtension("testD1.xptD1", "testD2.ext1"));
assertNotNull(RegistryFactory.getRegistry().getExtensionPoint("testD1.xptD1").getExtension("testD2.ext1"));
- assertEquals(RegistryFactory.getRegistry().getExtensionPoint("testD1.xptD1").getExtensions()[0].getUniqueIdentifier(), "testD2.ext1");
+ assertEquals(RegistryFactory.getRegistry().getExtensionPoint("testD1.xptD1").getExtensions()[0]
+ .getUniqueIdentifier(), "testD2.ext1");
}
+
@Test
public void testE() throws IOException, BundleException {
- //test the addition of an extension point and then add the extension through a fragment
+ // test the addition of an extension point and then add the extension through a
+ // fragment
Bundle bundle01 = BundleTestingHelper.installBundle("", fBundleContext, "Plugin_Testing/registry/testE/1");
- BundleTestingHelper.refreshPackages(fBundleContext, new Bundle[] {bundle01});
+ BundleTestingHelper.refreshPackages(fBundleContext, new Bundle[] { bundle01 });
Bundle bundle02 = BundleTestingHelper.installBundle("", fBundleContext, "Plugin_Testing/registry/testE/2");
- BundleTestingHelper.refreshPackages(fBundleContext, new Bundle[] {bundle02});
+ BundleTestingHelper.refreshPackages(fBundleContext, new Bundle[] { bundle02 });
testExtensionPoint("E1");
- //Test the configurataion elements
- assertEquals(RegistryFactory.getRegistry().getExtension("testE1", "xptE1", "testE1.ext1").getConfigurationElements().length, 0);
+ // Test the configurataion elements
+ assertEquals(RegistryFactory.getRegistry().getExtension("testE1", "xptE1", "testE1.ext1")
+ .getConfigurationElements().length, 0);
assertEquals(RegistryFactory.getRegistry().getConfigurationElementsFor("testE1.xptE1").length, 0);
- //Test the number of extension in the namespace
+ // Test the number of extension in the namespace
assertEquals(RegistryFactory.getRegistry().getExtensions("testE1").length, 1);
- //Test the extension
+ // Test the extension
assertNotNull(RegistryFactory.getRegistry().getExtension("testE1", "xptE1", "testE1.ext1"));
assertNotNull(RegistryFactory.getRegistry().getExtension("testE1.xptE1", "testE1.ext1"));
- assertNotNull(RegistryFactory.getRegistry().getExtension("testE1.ext1")); //This test exhibits a bug in the 3.0 implementation
+ assertNotNull(RegistryFactory.getRegistry().getExtension("testE1.ext1")); // This test exhibits a bug in the 3.0
+ // implementation
assertNotNull(RegistryFactory.getRegistry().getExtensionPoint("testE1.xptE1").getExtension("testE1.ext1"));
- assertEquals(RegistryFactory.getRegistry().getExtensionPoint("testE1.xptE1").getExtensions()[0].getUniqueIdentifier(), "testE1.ext1");
+ assertEquals(RegistryFactory.getRegistry().getExtensionPoint("testE1.xptE1").getExtensions()[0]
+ .getUniqueIdentifier(), "testE1.ext1");
}
+
@Test
public void testF() throws IOException, BundleException {
- //test the addition of the extension through a fragment then the addition of an extension point
+ // test the addition of the extension through a fragment then the addition of an
+ // extension point
Bundle bundle02 = BundleTestingHelper.installBundle("", fBundleContext, "Plugin_Testing/registry/testF/2");
- BundleTestingHelper.refreshPackages(fBundleContext, new Bundle[] {bundle02});
+ BundleTestingHelper.refreshPackages(fBundleContext, new Bundle[] { bundle02 });
Bundle bundle01 = BundleTestingHelper.installBundle("", fBundleContext, "Plugin_Testing/registry/testF/1");
- BundleTestingHelper.refreshPackages(fBundleContext, new Bundle[] {bundle01});
+ BundleTestingHelper.refreshPackages(fBundleContext, new Bundle[] { bundle01 });
testExtensionPoint("F1");
- //Test the configurataion elements
- assertEquals(RegistryFactory.getRegistry().getExtension("testF1", "xptF1", "testF1.ext1").getConfigurationElements().length, 0);
+ // Test the configurataion elements
+ assertEquals(RegistryFactory.getRegistry().getExtension("testF1", "xptF1", "testF1.ext1")
+ .getConfigurationElements().length, 0);
assertEquals(RegistryFactory.getRegistry().getConfigurationElementsFor("testF1.xptE1").length, 0);
- //Test the number of extension in the namespace
+ // Test the number of extension in the namespace
assertEquals(RegistryFactory.getRegistry().getExtensions("testF1").length, 1);
- //Test the extension
+ // Test the extension
assertNotNull(RegistryFactory.getRegistry().getExtension("testF1", "xptF1", "testF1.ext1"));
assertNotNull(RegistryFactory.getRegistry().getExtension("testF1.xptF1", "testF1.ext1"));
- assertNotNull(RegistryFactory.getRegistry().getExtension("testF1.ext1")); //This test exhibits a bug in the 3.0 implementation
+ assertNotNull(RegistryFactory.getRegistry().getExtension("testF1.ext1")); // This test exhibits a bug in the 3.0
+ // implementation
assertNotNull(RegistryFactory.getRegistry().getExtensionPoint("testF1.xptF1").getExtension("testF1.ext1"));
- assertEquals(RegistryFactory.getRegistry().getExtensionPoint("testF1.xptF1").getExtensions()[0].getUniqueIdentifier(), "testF1.ext1");
+ assertEquals(RegistryFactory.getRegistry().getExtensionPoint("testF1.xptF1").getExtensions()[0]
+ .getUniqueIdentifier(), "testF1.ext1");
- //Test the namespace
+ // Test the namespace
assertEquals(Arrays.asList(RegistryFactory.getRegistry().getNamespaces()).contains("testF1"), true);
assertEquals(Arrays.asList(RegistryFactory.getRegistry().getNamespaces()).contains("testF2"), false);
}
+
@Test
public void testG() throws IOException, BundleException {
- //fragment contributing an extension point to a plugin that do not have extension or extension point
+ // fragment contributing an extension point to a plugin that do not have
+ // extension or extension point
Bundle bundle01 = BundleTestingHelper.installBundle("", fBundleContext, "Plugin_Testing/registry/testG/1");
- BundleTestingHelper.refreshPackages(fBundleContext, new Bundle[] {bundle01});
+ BundleTestingHelper.refreshPackages(fBundleContext, new Bundle[] { bundle01 });
Bundle bundle02 = BundleTestingHelper.installBundle("", fBundleContext, "Plugin_Testing/registry/testG/2");
- BundleTestingHelper.refreshPackages(fBundleContext, new Bundle[] {bundle02});
+ BundleTestingHelper.refreshPackages(fBundleContext, new Bundle[] { bundle02 });
assertNotNull(RegistryFactory.getRegistry().getExtensionPoint("testG1.xptG2"));
assertEquals(RegistryFactory.getRegistry().getExtensionPoint("testG1.xptG2").getLabel(), "Label xptG2");
assertEquals(RegistryFactory.getRegistry().getExtensionPoint("testG1.xptG2").getNamespace(), "testG1");
- assertEquals(RegistryFactory.getRegistry().getExtensionPoint("testG1.xptG2").getNamespaceIdentifier(), "testG1");
- assertEquals(RegistryFactory.getRegistry().getExtensionPoint("testG1.xptG2").getContributor().getName(), "testG1");
- assertEquals(RegistryFactory.getRegistry().getExtensionPoint("testG1.xptG2").getSchemaReference(), "schema/xptG2.exsd");
-
- //Test the namespace
+ assertEquals(RegistryFactory.getRegistry().getExtensionPoint("testG1.xptG2").getNamespaceIdentifier(),
+ "testG1");
+ assertEquals(RegistryFactory.getRegistry().getExtensionPoint("testG1.xptG2").getContributor().getName(),
+ "testG1");
+ assertEquals(RegistryFactory.getRegistry().getExtensionPoint("testG1.xptG2").getSchemaReference(),
+ "schema/xptG2.exsd");
+
+ // Test the namespace
assertEquals(Arrays.asList(RegistryFactory.getRegistry().getNamespaces()).contains("testG1"), true);
assertEquals(Arrays.asList(RegistryFactory.getRegistry().getNamespaces()).contains("testG2"), false);
}
+
@Test
public void testH() throws IOException, BundleException {
- // fragment contributing an extension to a plugin that does not have extension or extension point
+ // fragment contributing an extension to a plugin that does not have extension
+ // or extension point
Bundle bundle01 = BundleTestingHelper.installBundle("", fBundleContext, "Plugin_Testing/registry/testH/1");
- BundleTestingHelper.refreshPackages(fBundleContext, new Bundle[] {bundle01});
+ BundleTestingHelper.refreshPackages(fBundleContext, new Bundle[] { bundle01 });
Bundle bundle02 = BundleTestingHelper.installBundle("", fBundleContext, "Plugin_Testing/registry/testH/2");
- BundleTestingHelper.refreshPackages(fBundleContext, new Bundle[] {bundle02});
+ BundleTestingHelper.refreshPackages(fBundleContext, new Bundle[] { bundle02 });
Bundle bundle03 = BundleTestingHelper.installBundle("", fBundleContext, "Plugin_Testing/registry/testH/3");
- BundleTestingHelper.refreshPackages(fBundleContext, new Bundle[] {bundle03});
+ BundleTestingHelper.refreshPackages(fBundleContext, new Bundle[] { bundle03 });
testExtensionPoint("H1");
- //Test the configurataion elements
- assertEquals(RegistryFactory.getRegistry().getExtension("testH1", "xptH1", "testH3.ext1").getConfigurationElements().length, 0);
+ // Test the configurataion elements
+ assertEquals(RegistryFactory.getRegistry().getExtension("testH1", "xptH1", "testH3.ext1")
+ .getConfigurationElements().length, 0);
assertEquals(RegistryFactory.getRegistry().getConfigurationElementsFor("testH1.xptH1").length, 0);
- //Test the number of extension in the namespace
+ // Test the number of extension in the namespace
assertEquals(RegistryFactory.getRegistry().getExtensions("testH3").length, 1);
- //Test the extension
+ // Test the extension
assertNotNull(RegistryFactory.getRegistry().getExtension("testH1", "xptH1", "testH3.ext1"));
assertNotNull(RegistryFactory.getRegistry().getExtension("testH1.xptH1", "testH3.ext1"));
- assertNotNull(RegistryFactory.getRegistry().getExtension("testH3.ext1")); //This test exhibits a bug in the 3.0 implementation
+ assertNotNull(RegistryFactory.getRegistry().getExtension("testH3.ext1")); // This test exhibits a bug in the 3.0
+ // implementation
assertNotNull(RegistryFactory.getRegistry().getExtensionPoint("testH1.xptH1").getExtension("testH3.ext1"));
- assertEquals(RegistryFactory.getRegistry().getExtensionPoint("testH1.xptH1").getExtensions()[0].getUniqueIdentifier(), "testH3.ext1");
+ assertEquals(RegistryFactory.getRegistry().getExtensionPoint("testH1.xptH1").getExtensions()[0]
+ .getUniqueIdentifier(), "testH3.ext1");
- //Test the namespace
+ // Test the namespace
assertEquals(Arrays.asList(RegistryFactory.getRegistry().getNamespaces()).contains("testH1"), true);
assertEquals(Arrays.asList(RegistryFactory.getRegistry().getNamespaces()).contains("testH3"), true);
- assertEquals(Arrays.asList(RegistryFactory.getRegistry().getNamespaces()).contains("testH2"), false); //fragments do not come with their namespace
+ assertEquals(Arrays.asList(RegistryFactory.getRegistry().getNamespaces()).contains("testH2"), false); // fragments
+ // do
+ // not
+ // come
+ // with
+ // their
+ // namespace
}
+
@Test
public void testH71826() throws MalformedURLException, BundleException, IOException {
- Bundle bundle01 = BundleTestingHelper.installBundle("", fBundleContext, "Plugin_Testing/registry/71826/fragmentF");
- BundleTestingHelper.refreshPackages(fBundleContext, new Bundle[] {bundle01});
+ Bundle bundle01 = BundleTestingHelper.installBundle("", fBundleContext,
+ "Plugin_Testing/registry/71826/fragmentF");
+ BundleTestingHelper.refreshPackages(fBundleContext, new Bundle[] { bundle01 });
- Bundle bundle02 = BundleTestingHelper.installBundle("", fBundleContext, "Plugin_Testing/registry/71826/pluginB");
- BundleTestingHelper.refreshPackages(fBundleContext, new Bundle[] {bundle02});
+ Bundle bundle02 = BundleTestingHelper.installBundle("", fBundleContext,
+ "Plugin_Testing/registry/71826/pluginB");
+ BundleTestingHelper.refreshPackages(fBundleContext, new Bundle[] { bundle02 });
- Bundle bundle03 = BundleTestingHelper.installBundle("", fBundleContext, "Plugin_Testing/registry/71826/pluginA");
- BundleTestingHelper.refreshPackages(fBundleContext, new Bundle[] {bundle03});
+ Bundle bundle03 = BundleTestingHelper.installBundle("", fBundleContext,
+ "Plugin_Testing/registry/71826/pluginA");
+ BundleTestingHelper.refreshPackages(fBundleContext, new Bundle[] { bundle03 });
IExtensionPoint xp = RegistryFactory.getRegistry().getExtensionPoint("71826A.xptE");
assertNotNull("1.0", xp);
@@ -280,11 +329,12 @@ public void testH71826() throws MalformedURLException, BundleException, IOExcept
assertNotNull("1.2", xp.getExtension("71826A.F1"));
assertNotNull("1.3", xp.getExtension("71826B.B1"));
}
+
@Test
public void testJ() throws MalformedURLException, BundleException, IOException {
- //Test the third level configuration elements
+ // Test the third level configuration elements
Bundle bundle01 = BundleTestingHelper.installBundle("", fBundleContext, "Plugin_Testing/registry/testI");
- BundleTestingHelper.refreshPackages(fBundleContext, new Bundle[] {bundle01});
+ BundleTestingHelper.refreshPackages(fBundleContext, new Bundle[] { bundle01 });
IExtension ext = RegistryFactory.getRegistry().getExtension("testI.ext1");
IConfigurationElement ce = ext.getConfigurationElements()[0];
@@ -299,9 +349,10 @@ public void testJ() throws MalformedURLException, BundleException, IOException {
assertEquals(ce.getChildren()[0].getChildren()[0].getChildren()[0].getName(), "ce4");
assertNotNull(ce.getChildren()[0].getChildren()[0].getChildren()[0].getValue());
}
+
@Test
public void testJbis() {
- //Test the third level configuration elements from cache
+ // Test the third level configuration elements from cache
IExtension ext = RegistryFactory.getRegistry().getExtension("testI.ext1");
IConfigurationElement ce = ext.getConfigurationElements()[0];
assertEquals(ce.getName(), "ce");
@@ -315,26 +366,34 @@ public void testJbis() {
assertEquals(ce.getChildren()[0].getChildren()[0].getChildren()[0].getName(), "ce4");
assertNotNull(ce.getChildren()[0].getChildren()[0].getChildren()[0].getValue());
}
+
@Test
public void testKNonSingletonBundle() throws MalformedURLException, BundleException, IOException {
- //Non singleton bundles are not supposed to be added
- Bundle nonSingletonBundle = BundleTestingHelper.installBundle("", fBundleContext, "Plugin_Testing/registry/nonSingleton");
- BundleTestingHelper.refreshPackages(fBundleContext, new Bundle[] {nonSingletonBundle});
+ // Non singleton bundles are not supposed to be added
+ Bundle nonSingletonBundle = BundleTestingHelper.installBundle("", fBundleContext,
+ "Plugin_Testing/registry/nonSingleton");
+ BundleTestingHelper.refreshPackages(fBundleContext, new Bundle[] { nonSingletonBundle });
assertNull(RegistryFactory.getRegistry().getExtensionPoint("NonSingleton.ExtensionPoint"));
}
+
@Test
public void testLSingletonFragment() throws MalformedURLException, BundleException, IOException {
- //Fragments to non singleton host can not contribute extension or extension points
- Bundle fragmentToNonSingleton = BundleTestingHelper.installBundle("", fBundleContext, "Plugin_Testing/registry/fragmentToNonSingleton");
- BundleTestingHelper.refreshPackages(fBundleContext, new Bundle[] {fragmentToNonSingleton});
+ // Fragments to non singleton host can not contribute extension or extension
+ // points
+ Bundle fragmentToNonSingleton = BundleTestingHelper.installBundle("", fBundleContext,
+ "Plugin_Testing/registry/fragmentToNonSingleton");
+ BundleTestingHelper.refreshPackages(fBundleContext, new Bundle[] { fragmentToNonSingleton });
assertNull(RegistryFactory.getRegistry().getExtensionPoint("NonSingleton.Bar"));
}
+
@Test
public void testMNonSingletonFragment() throws MalformedURLException, BundleException, IOException {
- //Non singleton bundles are not supposed to be added
- Bundle regular = BundleTestingHelper.installBundle("", fBundleContext, "Plugin_Testing/registry/nonSingletonFragment/plugin");
- Bundle nonSingletonFragment = BundleTestingHelper.installBundle("", fBundleContext, "Plugin_Testing/registry/nonSingletonFragment/fragment");
- BundleTestingHelper.refreshPackages(fBundleContext, new Bundle[] {regular, nonSingletonFragment});
+ // Non singleton bundles are not supposed to be added
+ Bundle regular = BundleTestingHelper.installBundle("", fBundleContext,
+ "Plugin_Testing/registry/nonSingletonFragment/plugin");
+ Bundle nonSingletonFragment = BundleTestingHelper.installBundle("", fBundleContext,
+ "Plugin_Testing/registry/nonSingletonFragment/fragment");
+ BundleTestingHelper.refreshPackages(fBundleContext, new Bundle[] { regular, nonSingletonFragment });
assertNull(RegistryFactory.getRegistry().getExtensionPoint("Regular.Bar"));
}
}
diff --git a/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/registry/InputErrorTest.java b/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/registry/InputErrorTest.java
index 47efa407ffb..dfe2db62fd2 100644
--- a/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/registry/InputErrorTest.java
+++ b/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/registry/InputErrorTest.java
@@ -40,6 +40,7 @@
/**
* Test proper clean-up in case registry gets invalid XML contribution.
+ *
* @since 3.4
*/
public class InputErrorTest {
@@ -47,8 +48,8 @@ public class InputErrorTest {
static private final String DATA_LOCATION = "Plugin_Testing/registry/errorHandling/";
/**
- * Use customized registry strategy to both check error processing
- * and to remove expected error messages from test log.
+ * Use customized registry strategy to both check error processing and to remove
+ * expected error messages from test log.
*/
private class RegistryStrategyLog extends RegistryStrategyOSGI {
@@ -77,7 +78,8 @@ private InputStream getStream(String location) {
@Test
public void testErrorCleanupPoints() {
- RegistryStrategyLog strategy = new RegistryStrategyLog(null, null, null); // RegistryFactory.createOSGiStrategy(null, null, null);
+ RegistryStrategyLog strategy = new RegistryStrategyLog(null, null, null); // RegistryFactory.createOSGiStrategy(null,
+ // null, null);
IExtensionRegistry localRegistry = RegistryFactory.createRegistry(strategy, null, null);
IContributor contributor = ContributorFactorySimple.createContributor("testErrorHandling");
@@ -110,7 +112,8 @@ public void testErrorCleanupPoints() {
@Test
public void testErrorCleanupExtensions() {
- RegistryStrategyLog strategy = new RegistryStrategyLog(null, null, null); // RegistryFactory.createOSGiStrategy(null, null, null);
+ RegistryStrategyLog strategy = new RegistryStrategyLog(null, null, null); // RegistryFactory.createOSGiStrategy(null,
+ // null, null);
IExtensionRegistry localRegistry = RegistryFactory.createRegistry(strategy, null, null);
IContributor contributor = ContributorFactorySimple.createContributor("testErrorHandling");
diff --git a/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/registry/MultiLanguageTest.java b/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/registry/MultiLanguageTest.java
index 9725df37595..caf554054c1 100644
--- a/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/registry/MultiLanguageTest.java
+++ b/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/registry/MultiLanguageTest.java
@@ -78,9 +78,11 @@ public Locale getLocale() {
@Before
public void setUp() throws Exception {
testBundleContext = FrameworkUtil.getBundle(getClass()).getBundleContext();
- bundle = BundleTestingHelper.installBundle("0.1", testBundleContext, "Plugin_Testing/registry/multiLang/bundleA");
- bundleFragment = BundleTestingHelper.installBundle("0.2", testBundleContext, "Plugin_Testing/registry/multiLang/fragmentA");
- getBundleAdmin().resolveBundles(new Bundle[] {bundle});
+ bundle = BundleTestingHelper.installBundle("0.1", testBundleContext,
+ "Plugin_Testing/registry/multiLang/bundleA");
+ bundleFragment = BundleTestingHelper.installBundle("0.2", testBundleContext,
+ "Plugin_Testing/registry/multiLang/fragmentA");
+ getBundleAdmin().resolveBundles(new Bundle[] { bundle });
// find a place for the extension registry cache
tmpPath = FileSystemHelper.getRandomLocation(FileSystemHelper.getTempDir());
@@ -100,7 +102,7 @@ public void tearDown() throws Exception {
// remove test bundles
bundleFragment.uninstall();
bundle.uninstall();
- refreshPackages(new Bundle[] {bundle});
+ refreshPackages(new Bundle[] { bundle });
// restore system environment
if (oldMultiLangValue == null) {
@@ -116,7 +118,7 @@ public void tearDown() throws Exception {
}
private void refreshPackages(Bundle[] refresh) {
- final boolean[] flag = new boolean[] {false};
+ final boolean[] flag = new boolean[] { false };
FrameworkListener listener = event -> {
if (event.getType() == FrameworkEvent.PACKAGES_REFRESHED) {
synchronized (flag) {
@@ -150,8 +152,8 @@ private void refreshPackages(Bundle[] refresh) {
public void testMultiLocale() {
Object masterToken = new Object();
// Create a multi-language extension registry
- File[] registryLocations = new File[] {registryLocation};
- boolean[] readOnly = new boolean[] {false};
+ File[] registryLocations = new File[] { registryLocation };
+ boolean[] readOnly = new boolean[] { false };
RegistryStrategy strategy = RegistryFactory.createOSGiStrategy(registryLocations, readOnly, masterToken);
IExtensionRegistry localRegistry = RegistryFactory.createRegistry(strategy, masterToken, null);
assertTrue(localRegistry.isMultiLanguage());
@@ -175,8 +177,8 @@ public void testMultiLocale() {
public void testMultiLocaleService() {
Object masterToken = new Object();
// Create a multi-language extension registry
- File[] registryLocations = new File[] {registryLocation};
- boolean[] readOnly = new boolean[] {false};
+ File[] registryLocations = new File[] { registryLocation };
+ boolean[] readOnly = new boolean[] { false };
RegistryStrategy strategy = RegistryFactory.createOSGiStrategy(registryLocations, readOnly, masterToken);
IExtensionRegistry localRegistry = RegistryFactory.createRegistry(strategy, masterToken, null);
assertTrue(localRegistry.isMultiLanguage());
@@ -199,7 +201,8 @@ private void checkTranslationsService(IExtensionRegistry registry, boolean exten
assertNotNull(extPoint);
IExtension extension = registry.getExtension("org.eclipse.test.registryMulti.ExtA");
assertNotNull(extension);
- IConfigurationElement[] elements = registry.getConfigurationElementsFor("org.eclipse.test.registryMulti", "PointA", "org.eclipse.test.registryMulti.ExtA");
+ IConfigurationElement[] elements = registry.getConfigurationElementsFor("org.eclipse.test.registryMulti",
+ "PointA", "org.eclipse.test.registryMulti.ExtA");
assertNotNull(elements);
assertEquals(1, elements.length);
IConfigurationElement element = elements[0];
@@ -210,7 +213,8 @@ private void checkTranslationsService(IExtensionRegistry registry, boolean exten
IConfigurationElement[] subdivisionElements = sectionElements[0].getChildren("subdivision");
assertNotNull(subdivisionElements);
assertEquals(1, subdivisionElements.length);
- IConfigurationElement[] elementsValue = registry.getConfigurationElementsFor("org.eclipse.test.registryMulti", "PointValue", "org.eclipse.test.registryMulti.ExtValue");
+ IConfigurationElement[] elementsValue = registry.getConfigurationElementsFor(
+ "org.eclipse.test.registryMulti", "PointValue", "org.eclipse.test.registryMulti.ExtValue");
assertNotNull(elementsValue);
assertEquals(1, elementsValue.length);
IConfigurationElement elementValue = elementsValue[0];
@@ -270,7 +274,8 @@ private void checkTranslations(IExtensionRegistry registry, boolean extended) {
assertNotNull(extPoint);
IExtension extension = registry.getExtension("org.eclipse.test.registryMulti.ExtA");
assertNotNull(extension);
- IConfigurationElement[] elements = registry.getConfigurationElementsFor("org.eclipse.test.registryMulti", "PointA", "org.eclipse.test.registryMulti.ExtA");
+ IConfigurationElement[] elements = registry.getConfigurationElementsFor("org.eclipse.test.registryMulti",
+ "PointA", "org.eclipse.test.registryMulti.ExtA");
assertNotNull(elements);
assertEquals(1, elements.length);
IConfigurationElement element = elements[0];
@@ -281,12 +286,14 @@ private void checkTranslations(IExtensionRegistry registry, boolean extended) {
IConfigurationElement[] subdivisionElements = sectionElements[0].getChildren("subdivision");
assertNotNull(subdivisionElements);
assertEquals(1, subdivisionElements.length);
- IConfigurationElement[] elementsValue = registry.getConfigurationElementsFor("org.eclipse.test.registryMulti", "PointValue", "org.eclipse.test.registryMulti.ExtValue");
+ IConfigurationElement[] elementsValue = registry.getConfigurationElementsFor("org.eclipse.test.registryMulti",
+ "PointValue", "org.eclipse.test.registryMulti.ExtValue");
assertNotNull(elementsValue);
assertEquals(1, elementsValue.length);
IConfigurationElement elementValue = elementsValue[0];
assertNotNull(elementValue);
- IConfigurationElement[] elementsFrag = registry.getConfigurationElementsFor("org.eclipse.test.registryMulti", "FragmentPointA", "org.eclipse.test.registryMulti.FragmentExtA");
+ IConfigurationElement[] elementsFrag = registry.getConfigurationElementsFor("org.eclipse.test.registryMulti",
+ "FragmentPointA", "org.eclipse.test.registryMulti.FragmentExtA");
assertNotNull(elementsFrag);
assertEquals(1, elementsFrag.length);
IConfigurationElement elementFrag = elementsFrag[0];
diff --git a/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/registry/NamespaceTest.java b/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/registry/NamespaceTest.java
index 78ab0c4ec79..53d0ac690ff 100644
--- a/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/registry/NamespaceTest.java
+++ b/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/registry/NamespaceTest.java
@@ -37,10 +37,11 @@ public class NamespaceTest {
@Test
public void testNamespaceBasic() throws IOException, BundleException {
- //test the addition of an extension point
+ // test the addition of an extension point
BundleContext bundleContext = FrameworkUtil.getBundle(getClass()).getBundleContext();
- Bundle bundle01 = BundleTestingHelper.installBundle("Plugin", bundleContext, "Plugin_Testing/registry/testNamespace/1");
- BundleTestingHelper.refreshPackages(bundleContext, new Bundle[] {bundle01});
+ Bundle bundle01 = BundleTestingHelper.installBundle("Plugin", bundleContext,
+ "Plugin_Testing/registry/testNamespace/1");
+ BundleTestingHelper.refreshPackages(bundleContext, new Bundle[] { bundle01 });
// Extension point and extension should be present
IExtensionPoint extpt = RegistryFactory.getRegistry().getExtensionPoint("org.abc.xptNS1");
@@ -79,7 +80,7 @@ public void testNamespaceBasic() throws IOException, BundleException {
// remove the first bundle
bundle01.uninstall();
- BundleTestingHelper.refreshPackages(bundleContext, new Bundle[] {bundle01});
+ BundleTestingHelper.refreshPackages(bundleContext, new Bundle[] { bundle01 });
}
@Test
@@ -87,8 +88,9 @@ public void testNamespaceDynamic() throws BundleException, IOException {
// add another bundle
BundleContext bundleContext = FrameworkUtil.getBundle(getClass()).getBundleContext();
- Bundle anotherNamespaceBundle = BundleTestingHelper.installBundle("Plugin", bundleContext, "Plugin_Testing/registry/testNamespace/2");
- BundleTestingHelper.refreshPackages(bundleContext, new Bundle[] {anotherNamespaceBundle});
+ Bundle anotherNamespaceBundle = BundleTestingHelper.installBundle("Plugin", bundleContext,
+ "Plugin_Testing/registry/testNamespace/2");
+ BundleTestingHelper.refreshPackages(bundleContext, new Bundle[] { anotherNamespaceBundle });
// all elements from the first bundle should be gone
IExtensionPoint extpt_removed = RegistryFactory.getRegistry().getExtensionPoint("org.abc.xptNS1");
@@ -112,7 +114,7 @@ public void testNamespaceDynamic() throws BundleException, IOException {
// remove the second bundle
anotherNamespaceBundle.uninstall();
- BundleTestingHelper.refreshPackages(bundleContext, new Bundle[] {anotherNamespaceBundle});
+ BundleTestingHelper.refreshPackages(bundleContext, new Bundle[] { anotherNamespaceBundle });
}
}
diff --git a/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/registry/RegistryListenerTest.java b/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/registry/RegistryListenerTest.java
index ab532a5c037..ca1f25e0e81 100644
--- a/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/registry/RegistryListenerTest.java
+++ b/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/registry/RegistryListenerTest.java
@@ -32,6 +32,7 @@
/**
* Tests "new" registry event listener.
+ *
* @since 3.4
*/
public class RegistryListenerTest {
@@ -55,10 +56,12 @@ public void testRegularOrder() throws IOException, BundleException {
WaitingRegistryListener listener = new WaitingRegistryListener();
listener.register("bundle01.xp1");
try {
- bundle01 = BundleTestingHelper.installBundle("0.1", fBundleContext, "Plugin_Testing/registryListener/bundle01");
- bundle02 = BundleTestingHelper.installBundle("0.2", fBundleContext, "Plugin_Testing/registryListener/bundle02");
+ bundle01 = BundleTestingHelper.installBundle("0.1", fBundleContext,
+ "Plugin_Testing/registryListener/bundle01");
+ bundle02 = BundleTestingHelper.installBundle("0.2", fBundleContext,
+ "Plugin_Testing/registryListener/bundle02");
- Bundle[] testBundles = new Bundle[] {bundle01, bundle02};
+ Bundle[] testBundles = new Bundle[] { bundle01, bundle02 };
BundleTestingHelper.refreshPackages(fBundleContext, testBundles);
String[] extPointIDs = listener.extPointsReceived(2 * MAX_TIME_PER_BUNDLE);
@@ -114,10 +117,12 @@ public void testInverseOrder() throws IOException, BundleException {
WaitingRegistryListener listener = new WaitingRegistryListener();
listener.register("bundle01.xp1");
try {
- bundle02 = BundleTestingHelper.installBundle("0.2", fBundleContext, "Plugin_Testing/registryEvents/bundle02");
- bundle01 = BundleTestingHelper.installBundle("0.1", fBundleContext, "Plugin_Testing/registryEvents/bundle01");
+ bundle02 = BundleTestingHelper.installBundle("0.2", fBundleContext,
+ "Plugin_Testing/registryEvents/bundle02");
+ bundle01 = BundleTestingHelper.installBundle("0.1", fBundleContext,
+ "Plugin_Testing/registryEvents/bundle01");
- Bundle[] testBundles = new Bundle[] {bundle01, bundle02};
+ Bundle[] testBundles = new Bundle[] { bundle01, bundle02 };
BundleTestingHelper.refreshPackages(fBundleContext, testBundles);
String[] extPointIDs = listener.extPointsReceived(2 * MAX_TIME_PER_BUNDLE);
@@ -164,8 +169,8 @@ public void testInverseOrder() throws IOException, BundleException {
}
/**
- * Tests modifications to multiple extensions and extension points
- * Three listeners are tested: global; on xp1 (two extensions); on xp2 (no extensions)
+ * Tests modifications to multiple extensions and extension points Three
+ * listeners are tested: global; on xp1 (two extensions); on xp2 (no extensions)
*/
@Test
public void testMultiplePoints() throws IOException, BundleException {
@@ -177,9 +182,10 @@ public void testMultiplePoints() throws IOException, BundleException {
WaitingRegistryListener listener2 = new WaitingRegistryListener();
listener2.register("bundleMultiple.xp2");
try {
- bundle = BundleTestingHelper.installBundle("0.1", fBundleContext, "Plugin_Testing/registryListener/bundleMultiple");
+ bundle = BundleTestingHelper.installBundle("0.1", fBundleContext,
+ "Plugin_Testing/registryListener/bundleMultiple");
- Bundle[] testBundles = new Bundle[] {bundle};
+ Bundle[] testBundles = new Bundle[] { bundle };
BundleTestingHelper.refreshPackages(fBundleContext, testBundles);
// test additions on global listener
@@ -252,13 +258,14 @@ public void testMultipleRegistrations() throws IOException, BundleException {
RegistryFactory.getRegistry().addListener(listener, "bundleMultiple.xp1");
RegistryFactory.getRegistry().addListener(listener, "bundleMultiple.xp1");
try {
- bundle = BundleTestingHelper.installBundle("0.1", fBundleContext, "Plugin_Testing/registryListener/bundleMultiple");
+ bundle = BundleTestingHelper.installBundle("0.1", fBundleContext,
+ "Plugin_Testing/registryListener/bundleMultiple");
- Bundle[] testBundles = new Bundle[] {bundle};
+ Bundle[] testBundles = new Bundle[] { bundle };
BundleTestingHelper.refreshPackages(fBundleContext, testBundles);
- // 1st registration: extension point; extension => 2 callbacks
- // 2nd registration should be ignored: extension => 0 callbacks
+ // 1st registration: extension point; extension => 2 callbacks
+ // 2nd registration should be ignored: extension => 0 callbacks
// total: 2 callbacks
assertEquals(2, listener.waitFor(2, MAX_TIME_PER_BUNDLE));
diff --git a/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/registry/RegistryTests.java b/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/registry/RegistryTests.java
index 8a4b162f07a..3decf08e3ad 100644
--- a/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/registry/RegistryTests.java
+++ b/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/registry/RegistryTests.java
@@ -18,15 +18,8 @@
import org.junit.runners.Suite.SuiteClasses;
@RunWith(Suite.class)
-@SuiteClasses({
- ContributorsTest.class,
- ExtensionRegistryDynamicTest.class,
- ExtensionRegistryStaticTest.class,
- InputErrorTest.class,
- MultiLanguageTest.class,
- NamespaceTest.class,
- RegistryListenerTest.class
-})
+@SuiteClasses({ ContributorsTest.class, ExtensionRegistryDynamicTest.class, ExtensionRegistryStaticTest.class,
+ InputErrorTest.class, MultiLanguageTest.class, NamespaceTest.class, RegistryListenerTest.class })
public class RegistryTests {
// intentionally left blank
}
diff --git a/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/registry/WaitingRegistryListener.java b/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/registry/WaitingRegistryListener.java
index b3d8f3d5847..68e9df65f78 100644
--- a/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/registry/WaitingRegistryListener.java
+++ b/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/registry/WaitingRegistryListener.java
@@ -20,8 +20,9 @@
import org.junit.Assert;
/**
- * Allows test cases to wait for the extension registry notifications.
- * This listener checks navigability to related elements from extensions.
+ * Allows test cases to wait for the extension registry notifications. This
+ * listener checks navigability to related elements from extensions.
+ *
* @since 3.4
*/
public class WaitingRegistryListener extends Assert implements IRegistryEventListener {
@@ -106,8 +107,7 @@ public synchronized int waitFor(int events, long maxTimeout) {
while (callbacks < events) {
long currentTime = System.currentTimeMillis();
long alreadyWaited = currentTime - startTime;
- if (alreadyWaited < 0)
- {
+ if (alreadyWaited < 0) {
alreadyWaited = 0; // just in case if system timer is not very precise
}
long timeToWait = maxTimeout - alreadyWaited;
@@ -123,8 +123,11 @@ public synchronized int waitFor(int events, long maxTimeout) {
return callbacks;
}
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.IRegistryEventListener#added(org.eclipse.core.runtime.IExtension[])
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.core.runtime.IRegistryEventListener#added(org.eclipse.core.
+ * runtime.IExtension[])
*/
@Override
synchronized public void added(IExtension[] extensions) {
diff --git a/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/registry/simple/BaseExtensionRegistryRun.java b/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/registry/simple/BaseExtensionRegistryRun.java
index 47c63314ec5..40a13a6cf14 100644
--- a/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/registry/simple/BaseExtensionRegistryRun.java
+++ b/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/registry/simple/BaseExtensionRegistryRun.java
@@ -76,8 +76,8 @@ protected IExtensionRegistry startRegistry(String subDir) {
IPath userDataPath = getStateLocation();
userDataPath = userDataPath.append(subDir);
- File[] registryLocations = new File[] {new File(userDataPath.toOSString())};
- boolean[] readOnly = new boolean[] {false};
+ File[] registryLocations = new File[] { new File(userDataPath.toOSString()) };
+ boolean[] readOnly = new boolean[] { false };
RegistryStrategy registryStrategy = new RegistryStrategy(registryLocations, readOnly);
return RegistryFactory.createRegistry(registryStrategy, masterToken, userToken);
}
@@ -96,8 +96,9 @@ protected void processXMLContribution(IContributor nonBundleContributor, URL url
protected void processXMLContribution(IContributor nonBundleContributor, URL url, boolean persist)
throws IOException {
- InputStream is = url.openStream();
- simpleRegistry.addContribution(is, nonBundleContributor, persist, url.getFile(), null, persist ? masterToken : userToken);
+ InputStream is = url.openStream();
+ simpleRegistry.addContribution(is, nonBundleContributor, persist, url.getFile(), null,
+ persist ? masterToken : userToken);
}
protected String qualifiedName(String namespace, String simpleName) {
diff --git a/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/registry/simple/DirectExtensionCreateTest.java b/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/registry/simple/DirectExtensionCreateTest.java
index 0523ddfb5da..b671258d571 100644
--- a/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/registry/simple/DirectExtensionCreateTest.java
+++ b/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/registry/simple/DirectExtensionCreateTest.java
@@ -31,8 +31,8 @@
* Tests programmatic creation of extension and extension point by using direct
* methods on the ExtensionRegistry.
*
- * Note that in present those methods are internal, but might be exposed as
- * APIs in the future.
+ * Note that in present those methods are internal, but might be exposed as APIs
+ * in the future.
*
* @since 3.2
*/
@@ -48,13 +48,13 @@ public void testExtensionPointAddition() {
/**********************************************************************************************
* Add extension point:
*
- *
+ *
*
*********************************************************************************************/
- ((ExtensionRegistry) simpleRegistry).addExtensionPoint(extensionPointId, contributor, false, extensionPointLabel, extensionPointSchemaRef, userToken);
+ ((ExtensionRegistry) simpleRegistry).addExtensionPoint(extensionPointId, contributor, false,
+ extensionPointLabel, extensionPointSchemaRef, userToken);
String namespace = contributor.getName();
IExtensionPoint extensionPoint = simpleRegistry.getExtensionPoint(qualifiedName(namespace, extensionPointId));
@@ -65,21 +65,21 @@ public void testExtensionPointAddition() {
// add second contribution in the same namespace
String extensionPointAltId = "DirectExtPointAlt"; //$NON-NLS-1$
String extensionPointAltLabel = "Second direct extension point"; //$NON-NLS-1$
- assertTrue(((ExtensionRegistry) simpleRegistry).addExtensionPoint(extensionPointAltId, contributor, false, extensionPointAltLabel, extensionPointSchemaRef, userToken));
+ assertTrue(((ExtensionRegistry) simpleRegistry).addExtensionPoint(extensionPointAltId, contributor, false,
+ extensionPointAltLabel, extensionPointSchemaRef, userToken));
- IExtensionPoint extensionPointAlt = simpleRegistry.getExtensionPoint(qualifiedName(namespace, extensionPointAltId));
+ IExtensionPoint extensionPointAlt = simpleRegistry
+ .getExtensionPoint(qualifiedName(namespace, extensionPointAltId));
assertNotNull(extensionPointAlt);
assertTrue(extensionPointSchemaRef.equals(extensionPointAlt.getSchemaReference()));
assertTrue(extensionPointAltLabel.equals(extensionPointAlt.getLabel()));
/**********************************************************************************************
* Add extension:
- *
- *
- *
- *
- *
- *
+ *
+ *
+ *
*********************************************************************************************/
String extensionId = "DirectExtensionID"; //$NON-NLS-1$
String extensionLabel = "Direct Extension"; //$NON-NLS-1$
@@ -89,24 +89,33 @@ public void testExtensionPointAddition() {
String propValueChildDesc1 = "SkyLab"; //$NON-NLS-1$
String propValueChildDesc2 = "OceanFloor"; //$NON-NLS-1$
- ConfigurationElementAttribute propChildDesc1 = new ConfigurationElementAttribute(propNameChildDesc, propValueChildDesc1);
- ConfigurationElementDescription childDesc1 = new ConfigurationElementDescription(nameChildDesc, propChildDesc1, null, null);
+ ConfigurationElementAttribute propChildDesc1 = new ConfigurationElementAttribute(propNameChildDesc,
+ propValueChildDesc1);
+ ConfigurationElementDescription childDesc1 = new ConfigurationElementDescription(nameChildDesc, propChildDesc1,
+ null, null);
- ConfigurationElementAttribute propChildDesc2 = new ConfigurationElementAttribute(propNameChildDesc, propValueChildDesc2);
- ConfigurationElementDescription childDesc2 = new ConfigurationElementDescription(nameChildDesc, propChildDesc2, null, null);
+ ConfigurationElementAttribute propChildDesc2 = new ConfigurationElementAttribute(propNameChildDesc,
+ propValueChildDesc2);
+ ConfigurationElementDescription childDesc2 = new ConfigurationElementDescription(nameChildDesc, propChildDesc2,
+ null, null);
String extensionName = "StorageDevice"; //$NON-NLS-1$
String extensionProrName1 = "deviceURL"; //$NON-NLS-1$
String extensionPropValue1 = "theShienneMountain"; //$NON-NLS-1$
String extensionProrName2 = "primary"; //$NON-NLS-1$
String extensionPropValue2 = "true"; //$NON-NLS-1$
- ConfigurationElementAttribute prop1 = new ConfigurationElementAttribute(extensionProrName1, extensionPropValue1);
- ConfigurationElementAttribute prop2 = new ConfigurationElementAttribute(extensionProrName2, extensionPropValue2);
+ ConfigurationElementAttribute prop1 = new ConfigurationElementAttribute(extensionProrName1,
+ extensionPropValue1);
+ ConfigurationElementAttribute prop2 = new ConfigurationElementAttribute(extensionProrName2,
+ extensionPropValue2);
String extensionValue = "SomeValue"; //$NON-NLS-1$
- ConfigurationElementDescription description = new ConfigurationElementDescription(extensionName, new ConfigurationElementAttribute[] {prop1, prop2}, extensionValue, new ConfigurationElementDescription[] {childDesc1, childDesc2});
+ ConfigurationElementDescription description = new ConfigurationElementDescription(extensionName,
+ new ConfigurationElementAttribute[] { prop1, prop2 }, extensionValue,
+ new ConfigurationElementDescription[] { childDesc1, childDesc2 });
- assertTrue(((ExtensionRegistry) simpleRegistry).addExtension(extensionId, contributor, false, extensionLabel, extensionPointId, description, userToken));
+ assertTrue(((ExtensionRegistry) simpleRegistry).addExtension(extensionId, contributor, false, extensionLabel,
+ extensionPointId, description, userToken));
IExtension[] namespaceExtensions = simpleRegistry.getExtensions(namespace);
assertNotNull(namespaceExtensions);
diff --git a/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/registry/simple/DirectExtensionCreateTwoRegistriesTest.java b/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/registry/simple/DirectExtensionCreateTwoRegistriesTest.java
index 342cad8b16e..0e435a4e6ae 100644
--- a/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/registry/simple/DirectExtensionCreateTwoRegistriesTest.java
+++ b/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/registry/simple/DirectExtensionCreateTwoRegistriesTest.java
@@ -28,6 +28,7 @@
/**
* Test simultaneous work of two extension registries.
+ *
* @since 3.2
*/
public class DirectExtensionCreateTwoRegistriesTest extends BaseExtensionRegistryRun {
@@ -39,7 +40,6 @@ public class DirectExtensionCreateTwoRegistriesTest extends BaseExtensionRegistr
private IExtensionRegistry theDeviceRegistryA;
private IExtensionRegistry theDeviceRegistryB;
-
@Override
@Before
public void setUp() throws Exception {
@@ -82,21 +82,27 @@ public void testExtensionPointAddition() {
private void checkEmptyRegistries(String namespace) {
// see what's in the registry A:
- IExtensionPoint extensionPoint = theDeviceRegistryA.getExtensionPoint(qualifiedName(namespace, extensionPointId));
- IExtensionPoint extensionPointAlt = theDeviceRegistryA.getExtensionPoint(qualifiedName(namespace, extensionPointAltId));
+ IExtensionPoint extensionPoint = theDeviceRegistryA
+ .getExtensionPoint(qualifiedName(namespace, extensionPointId));
+ IExtensionPoint extensionPointAlt = theDeviceRegistryA
+ .getExtensionPoint(qualifiedName(namespace, extensionPointAltId));
assertNull(extensionPoint);
assertNull(extensionPointAlt);
}
private void fillRegistries(IContributor contributor) {
- assertTrue(((ExtensionRegistry) theDeviceRegistryA).addExtensionPoint(extensionPointId, contributor, false, "LabelA", extensionPointSchemaRef, userToken)); //$NON-NLS-1$
- assertTrue(((ExtensionRegistry) theDeviceRegistryB).addExtensionPoint(extensionPointAltId, contributor, false, "LabelB", extensionPointSchemaRef, userToken)); //$NON-NLS-1$
+ assertTrue(((ExtensionRegistry) theDeviceRegistryA).addExtensionPoint(extensionPointId, contributor, false,
+ "LabelA", extensionPointSchemaRef, userToken)); //$NON-NLS-1$
+ assertTrue(((ExtensionRegistry) theDeviceRegistryB).addExtensionPoint(extensionPointAltId, contributor, false,
+ "LabelB", extensionPointSchemaRef, userToken)); //$NON-NLS-1$
}
private void checkRegistries(String namespace) {
// see what's in the registry A:
- IExtensionPoint extensionPoint = theDeviceRegistryA.getExtensionPoint(qualifiedName(namespace, extensionPointId));
- IExtensionPoint extensionPointAlt = theDeviceRegistryA.getExtensionPoint(qualifiedName(namespace, extensionPointAltId));
+ IExtensionPoint extensionPoint = theDeviceRegistryA
+ .getExtensionPoint(qualifiedName(namespace, extensionPointId));
+ IExtensionPoint extensionPointAlt = theDeviceRegistryA
+ .getExtensionPoint(qualifiedName(namespace, extensionPointAltId));
assertNotNull(extensionPoint);
assertNull(extensionPointAlt);
diff --git a/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/registry/simple/DirectExtensionRemoveTest.java b/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/registry/simple/DirectExtensionRemoveTest.java
index 4321dcf4895..1c665a63246 100644
--- a/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/registry/simple/DirectExtensionRemoveTest.java
+++ b/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/registry/simple/DirectExtensionRemoveTest.java
@@ -35,6 +35,7 @@
/**
* Tests removal APIs using a simple registry.
+ *
* @since 3.2
*/
public class DirectExtensionRemoveTest extends BaseExtensionRegistryRun {
@@ -45,7 +46,6 @@ public class DirectExtensionRemoveTest extends BaseExtensionRegistryRun {
private final static String extensionA1 = "TestExtensionA1"; //$NON-NLS-1$
private final static String extensionA2 = "TestExtensionA2"; //$NON-NLS-1$
-
// Fill the registry; remove half; check listener; check what's left
@Test
public void testExtensionPointAddition() throws IOException {
@@ -135,7 +135,7 @@ public void testAssociatedConfigElements() throws IOException {
}
};
- //SimpleRegistryListener listener = new SimpleRegistryListener() {};
+ // SimpleRegistryListener listener = new SimpleRegistryListener() {};
simpleRegistry.addRegistryChangeListener(listener);
try {
simpleRegistry.removeExtension(ext1, userToken);
diff --git a/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/registry/simple/DuplicatePointsTest.java b/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/registry/simple/DuplicatePointsTest.java
index 43bb3b2941d..1b480fe2655 100644
--- a/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/registry/simple/DuplicatePointsTest.java
+++ b/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/registry/simple/DuplicatePointsTest.java
@@ -32,28 +32,30 @@
import org.junit.Test;
/**
- * Tests addition of extensions and extension points with duplicate IDs.
- * The duplicate extension points should be ignored.
- * The duplicate extensions should be added.
- * The rest of the XML contribution should not be affected.
+ * Tests addition of extensions and extension points with duplicate IDs. The
+ * duplicate extension points should be ignored. The duplicate extensions should
+ * be added. The rest of the XML contribution should not be affected.
*
* @since 3.2
*/
public class DuplicatePointsTest extends BaseExtensionRegistryRun {
- private final static String errMsg1 = "Error: Ignored duplicate extension point \"testDuplicates.duplicateExtensionPoint\" supplied by \"2\"." + "Warning: Extensions supplied by \"2\" and \"1\" have the same Id: \"testDuplicates.duplicateExtension\".";
- private final static String errMsg2 = "Error: Ignored duplicate extension point \"testSame.duplicateExtensionPointSame\" supplied by \"3\"." + "Warning: Extensions supplied by \"3\" and \"3\" have the same Id: \"testSame.duplicateExtensionSame\".";
+ private final static String errMsg1 = "Error: Ignored duplicate extension point \"testDuplicates.duplicateExtensionPoint\" supplied by \"2\"."
+ + "Warning: Extensions supplied by \"2\" and \"1\" have the same Id: \"testDuplicates.duplicateExtension\".";
+ private final static String errMsg2 = "Error: Ignored duplicate extension point \"testSame.duplicateExtensionPointSame\" supplied by \"3\"."
+ + "Warning: Extensions supplied by \"3\" and \"3\" have the same Id: \"testSame.duplicateExtensionSame\".";
/**
* Use registry strategy with modified logging
+ *
* @return - open extension registry
*/
@Override
protected IExtensionRegistry startRegistry() {
// use plugin's metadata directory to save cache data
IPath userDataPath = getStateLocation();
- File[] registryLocations = new File[] {new File(userDataPath.toOSString())};
- boolean[] readOnly = new boolean[] {false};
+ File[] registryLocations = new File[] { new File(userDataPath.toOSString()) };
+ boolean[] readOnly = new boolean[] { false };
RegistryStrategy registryStrategy = new HiddenLogRegistryStrategy(registryLocations, readOnly);
return RegistryFactory.createRegistry(registryStrategy, masterToken, userToken);
}
diff --git a/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/registry/simple/SimpleRegistryTests.java b/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/registry/simple/SimpleRegistryTests.java
index 9d9219340ca..dddaaf3ee86 100644
--- a/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/registry/simple/SimpleRegistryTests.java
+++ b/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/registry/simple/SimpleRegistryTests.java
@@ -18,17 +18,9 @@
import org.junit.runners.Suite.SuiteClasses;
@RunWith(Suite.class)
-@SuiteClasses({
- XMLExtensionCreateTest.class,
- DirectExtensionCreateTest.class,
- XMLExecutableExtensionTest.class,
- DirectExtensionCreateTwoRegistriesTest.class,
- TokenAccessTest.class,
- XMLExtensionCreateEclipseTest.class,
- DirectExtensionRemoveTest.class,
- MergeContributionTest.class,
- DuplicatePointsTest.class
-})
+@SuiteClasses({ XMLExtensionCreateTest.class, DirectExtensionCreateTest.class, XMLExecutableExtensionTest.class,
+ DirectExtensionCreateTwoRegistriesTest.class, TokenAccessTest.class, XMLExtensionCreateEclipseTest.class,
+ DirectExtensionRemoveTest.class, MergeContributionTest.class, DuplicatePointsTest.class })
public class SimpleRegistryTests {
// intentionally left blank
}
diff --git a/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/registry/simple/TokenAccessTest.java b/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/registry/simple/TokenAccessTest.java
index 297bbbbfcee..b7148db99c8 100644
--- a/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/registry/simple/TokenAccessTest.java
+++ b/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/registry/simple/TokenAccessTest.java
@@ -53,7 +53,6 @@ public void testControlledAccess() {
// and stopped with a good token - should be no exception
registry.stop(tokenGood);
-
// and stopped with a bad token - should be an exception
assertThrows(IllegalArgumentException.class, () -> {// registry created with a good token
IExtensionRegistry registry1 = RegistryFactory.createRegistry(null, tokenGood, null);
diff --git a/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/registry/simple/XMLExtensionCreateEclipseTest.java b/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/registry/simple/XMLExtensionCreateEclipseTest.java
index 659e04da2c9..9244a17e8e2 100644
--- a/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/registry/simple/XMLExtensionCreateEclipseTest.java
+++ b/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/registry/simple/XMLExtensionCreateEclipseTest.java
@@ -33,6 +33,7 @@
/**
* Check dynamic contribution into the Eclipse registry itself.
+ *
* @since 3.2
*/
public class XMLExtensionCreateEclipseTest extends BaseExtensionRegistryRun {
@@ -46,9 +47,10 @@ public void testDynamicContribution() throws IllegalArgumentException, IOExcepti
}
private void fillRegistry(IContributor contributor) throws IllegalArgumentException, IOException {
- Object userKey = ((ExtensionRegistry) RegistryFactory.getRegistry()).getTemporaryUserToken();
- URL xmlURL = getXML("DynamicExtension.xml"); //$NON-NLS-1$
- RegistryFactory.getRegistry().addContribution(xmlURL.openStream(), contributor, false, xmlURL.getFile(), null, userKey);
+ Object userKey = ((ExtensionRegistry) RegistryFactory.getRegistry()).getTemporaryUserToken();
+ URL xmlURL = getXML("DynamicExtension.xml"); //$NON-NLS-1$
+ RegistryFactory.getRegistry().addContribution(xmlURL.openStream(), contributor, false, xmlURL.getFile(), null,
+ userKey);
}
private void checkRegistry(String namespace) {
@@ -59,7 +61,8 @@ private void checkRegistry(String namespace) {
IConfigurationElement[] elements = eclipseRegistry.getConfigurationElementsFor(uniqueId);
assertEquals(1, elements.length);
for (IConfigurationElement element : elements) {
- assertTrue("org.eclipse.equinox.common.tests.registry.simple.utils.ExecutableRegistryObject".equals(element.getAttribute("class")));
+ assertTrue("org.eclipse.equinox.common.tests.registry.simple.utils.ExecutableRegistryObject"
+ .equals(element.getAttribute("class")));
}
}
}
diff --git a/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/registry/simple/XMLExtensionCreateTest.java b/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/registry/simple/XMLExtensionCreateTest.java
index 81d14e1a04a..a40fb4a0ddc 100644
--- a/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/registry/simple/XMLExtensionCreateTest.java
+++ b/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/registry/simple/XMLExtensionCreateTest.java
@@ -30,9 +30,9 @@
import org.junit.Test;
/**
- * Tests addition of extension point and the extension to the registry via
- * XML contribution. Makes sure that items are actually added; checks
- * listener notification; reloads registry from cache and re-checks the data.
+ * Tests addition of extension point and the extension to the registry via XML
+ * contribution. Makes sure that items are actually added; checks listener
+ * notification; reloads registry from cache and re-checks the data.
*
* @since 3.2
*/
@@ -67,7 +67,8 @@ private void fillRegistry(IContributor contributor) throws IOException {
}
private void checkRegistry(String namespace) {
- IExtensionPoint extensionPoint = simpleRegistry.getExtensionPoint(qualifiedName(namespace, "XMLDirectExtPoint")); //$NON-NLS-1$
+ IExtensionPoint extensionPoint = simpleRegistry
+ .getExtensionPoint(qualifiedName(namespace, "XMLDirectExtPoint")); //$NON-NLS-1$
assertNotNull(extensionPoint);
IExtension[] namespaceExtensions = simpleRegistry.getExtensions(namespace);
assertNotNull(namespaceExtensions);
diff --git a/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/registry/simple/utils/ExeExtensionStrategy.java b/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/registry/simple/utils/ExeExtensionStrategy.java
index 5884237fd6a..33023588c32 100644
--- a/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/registry/simple/utils/ExeExtensionStrategy.java
+++ b/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/registry/simple/utils/ExeExtensionStrategy.java
@@ -19,8 +19,9 @@
import org.eclipse.core.runtime.spi.RegistryStrategy;
/**
- * Registry strategy that uses class loader from this bundle to process executable
- * extensions.
+ * Registry strategy that uses class loader from this bundle to process
+ * executable extensions.
+ *
* @since 3.2
*/
public class ExeExtensionStrategy extends RegistryStrategy {
@@ -30,7 +31,8 @@ public ExeExtensionStrategy(File[] theStorageDir, boolean[] cacheReadOnly) {
}
@Override
- public Object createExecutableExtension(RegistryContributor defaultContributor, String className, String requestedContributorName) {
+ public Object createExecutableExtension(RegistryContributor defaultContributor, String className,
+ String requestedContributorName) {
Class> classInstance = null;
try {
classInstance = Class.forName(className);
diff --git a/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/registry/simple/utils/ExecutableRegistryObject.java b/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/registry/simple/utils/ExecutableRegistryObject.java
index a93939278be..f16cbbd5002 100644
--- a/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/registry/simple/utils/ExecutableRegistryObject.java
+++ b/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/registry/simple/utils/ExecutableRegistryObject.java
@@ -17,6 +17,7 @@
/**
* Test class for the executable extensions.
+ *
* @since 3.2
*/
public class ExecutableRegistryObject implements IExecutableExtensionFactory {
@@ -30,7 +31,8 @@ public ExecutableRegistryObject() {
@Override
public Object create() throws CoreException {
if (createCalled) {
- Status status = new Status(IStatus.ERROR, "org.eclipse.core.tests.runtime", 0, "Duplicate executable extension call.", null); //$NON-NLS-1$ //$NON-NLS-2$
+ Status status = new Status(IStatus.ERROR, "org.eclipse.core.tests.runtime", 0, //$NON-NLS-1$
+ "Duplicate executable extension call.", null); //$NON-NLS-1$
throw new CoreException(status);
}
createCalled = true;
diff --git a/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/registry/simple/utils/HiddenLogRegistryStrategy.java b/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/registry/simple/utils/HiddenLogRegistryStrategy.java
index 513e7792be0..b27b0522e0d 100644
--- a/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/registry/simple/utils/HiddenLogRegistryStrategy.java
+++ b/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/registry/simple/utils/HiddenLogRegistryStrategy.java
@@ -20,6 +20,7 @@
/**
* Registry strategy that keeps log output in an accessible string.
+ *
* @since 3.2
*/
public class HiddenLogRegistryStrategy extends RegistryStrategy {
@@ -47,15 +48,15 @@ public void log(IStatus status, String prefix) {
String statusMsg;
switch (severity) {
- case IStatus.ERROR :
- statusMsg = RegistryMessages.log_error;
- break;
- case IStatus.WARNING :
- statusMsg = RegistryMessages.log_warning;
- break;
- default :
- statusMsg = RegistryMessages.log_log;
- break;
+ case IStatus.ERROR:
+ statusMsg = RegistryMessages.log_error;
+ break;
+ case IStatus.WARNING:
+ statusMsg = RegistryMessages.log_warning;
+ break;
+ default:
+ statusMsg = RegistryMessages.log_log;
+ break;
}
statusMsg += message;
diff --git a/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/registry/simple/utils/SimpleRegistryListener.java b/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/registry/simple/utils/SimpleRegistryListener.java
index f801dc46650..250ea529921 100644
--- a/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/registry/simple/utils/SimpleRegistryListener.java
+++ b/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/registry/simple/utils/SimpleRegistryListener.java
@@ -19,8 +19,10 @@
import org.eclipse.core.runtime.*;
/**
- * Allows test cases to wait for event notification so they can make assertions on the event.
- * Similar to org.eclipse.core.tests.harness.TestRegistryChangeListener.
+ * Allows test cases to wait for event notification so they can make assertions
+ * on the event. Similar to
+ * org.eclipse.core.tests.harness.TestRegistryChangeListener.
+ *
* @since 3.2
*/
public class SimpleRegistryListener implements IRegistryChangeListener {
@@ -34,11 +36,12 @@ public synchronized void registryChanged(IRegistryChangeEvent newEvent) {
}
/**
- * Returns the first event that is received, blocking for at most timeout
milliseconds.
- * Returns null
if a event was not received for the time allowed.
+ * Returns the first event that is received, blocking for at most
+ * timeout
milliseconds. Returns null
if a event was
+ * not received for the time allowed.
*
- * @param timeout the maximum time to wait in milliseconds. If zero, this method will
- * block until an event is received
+ * @param timeout the maximum time to wait in milliseconds. If zero, this method
+ * will block until an event is received
* @return the first event received, or null
if none was received
*/
public synchronized IRegistryChangeEvent getEvent(long timeout) {
diff --git a/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/text/AbstractStringMatcherTestBase.java b/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/text/AbstractStringMatcherTestBase.java
index 437e1c391ca..25eedd8e7d2 100644
--- a/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/text/AbstractStringMatcherTestBase.java
+++ b/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/text/AbstractStringMatcherTestBase.java
@@ -54,9 +54,8 @@ public String toString() {
public static TestData[] getTestData(String fileName) throws IOException {
List data = new ArrayList<>();
BundleContext context = FrameworkUtil.getBundle(AbstractStringMatcherTestBase.class).getBundleContext();
- URL url = context.getBundle().getEntry(
- "resources/" + AbstractStringMatcherTestBase.class.getPackage().getName().replace('.', '/') + '/'
- + fileName);
+ URL url = context.getBundle().getEntry("resources/"
+ + AbstractStringMatcherTestBase.class.getPackage().getName().replace('.', '/') + '/' + fileName);
url = FileLocator.toFileURL(url);
try (BufferedReader reader = new BufferedReader(
new InputStreamReader(url.openStream(), StandardCharsets.UTF_8))) {
diff --git a/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/text/StringMatcherTests.java b/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/text/StringMatcherTests.java
index 7e9f54690d3..503936a998d 100644
--- a/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/text/StringMatcherTests.java
+++ b/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/text/StringMatcherTests.java
@@ -15,13 +15,8 @@
import org.junit.runners.Suite.SuiteClasses;
@RunWith(Suite.class)
-@SuiteClasses({
- StringMatcherFindTest.class,
- StringMatcherPlainTest.class,
- StringMatcherWildcardTest.class,
- StringMatcherPrefixTest.class,
- StringMatcherOtherTest.class
-})
+@SuiteClasses({ StringMatcherFindTest.class, StringMatcherPlainTest.class, StringMatcherWildcardTest.class,
+ StringMatcherPrefixTest.class, StringMatcherOtherTest.class })
public class StringMatcherTests {
// empty
}