diff --git a/bundles/org.eclipse.osgi.tests/bundles_src/chain.test.a/chain/test/a/AChain.java b/bundles/org.eclipse.osgi.tests/bundles_src/chain.test.a/chain/test/a/AChain.java index 89d62560f9e..1a5233a6c99 100644 --- a/bundles/org.eclipse.osgi.tests/bundles_src/chain.test.a/chain/test/a/AChain.java +++ b/bundles/org.eclipse.osgi.tests/bundles_src/chain.test.a/chain/test/a/AChain.java @@ -15,6 +15,6 @@ import chain.test.b.BChain; -public class AChain extends BChain{ +public class AChain extends BChain { } diff --git a/bundles/org.eclipse.osgi.tests/bundles_src/chain.test.a/chain/test/a/AMultiChain2.java b/bundles/org.eclipse.osgi.tests/bundles_src/chain.test.a/chain/test/a/AMultiChain2.java index e87e137d770..ac099bd1def 100644 --- a/bundles/org.eclipse.osgi.tests/bundles_src/chain.test.a/chain/test/a/AMultiChain2.java +++ b/bundles/org.eclipse.osgi.tests/bundles_src/chain.test.a/chain/test/a/AMultiChain2.java @@ -13,7 +13,6 @@ *******************************************************************************/ package chain.test.a; - public interface AMultiChain2 { // } diff --git a/bundles/org.eclipse.osgi.tests/bundles_src/chain.test.b/chain/test/b/BMultiChain1.java b/bundles/org.eclipse.osgi.tests/bundles_src/chain.test.b/chain/test/b/BMultiChain1.java index 1009b14244a..68cc01583dc 100644 --- a/bundles/org.eclipse.osgi.tests/bundles_src/chain.test.b/chain/test/b/BMultiChain1.java +++ b/bundles/org.eclipse.osgi.tests/bundles_src/chain.test.b/chain/test/b/BMultiChain1.java @@ -13,7 +13,6 @@ *******************************************************************************/ package chain.test.b; - public interface BMultiChain1 { // } diff --git a/bundles/org.eclipse.osgi.tests/bundles_src/chain.test.b/chain/test/b/BMultiChain2.java b/bundles/org.eclipse.osgi.tests/bundles_src/chain.test.b/chain/test/b/BMultiChain2.java index 5910832e729..8708939d006 100644 --- a/bundles/org.eclipse.osgi.tests/bundles_src/chain.test.b/chain/test/b/BMultiChain2.java +++ b/bundles/org.eclipse.osgi.tests/bundles_src/chain.test.b/chain/test/b/BMultiChain2.java @@ -16,6 +16,6 @@ import chain.test.c.CMultipleChain2; import chain.test.d.DMultipleChain1; -public interface BMultiChain2 extends CMultipleChain2, DMultipleChain1{ +public interface BMultiChain2 extends CMultipleChain2, DMultipleChain1 { // } diff --git a/bundles/org.eclipse.osgi.tests/bundles_src/classloader.hooks.a/org/eclipse/osgi/tests/classloader/hooks/a/TestHookConfigurator.java b/bundles/org.eclipse.osgi.tests/bundles_src/classloader.hooks.a/org/eclipse/osgi/tests/classloader/hooks/a/TestHookConfigurator.java index 2a499db21e6..734a280e70f 100644 --- a/bundles/org.eclipse.osgi.tests/bundles_src/classloader.hooks.a/org/eclipse/osgi/tests/classloader/hooks/a/TestHookConfigurator.java +++ b/bundles/org.eclipse.osgi.tests/bundles_src/classloader.hooks.a/org/eclipse/osgi/tests/classloader/hooks/a/TestHookConfigurator.java @@ -42,14 +42,16 @@ public void addHooks(HookRegistry hookRegistry) { hookRegistry.addClassLoaderHook(new ClassLoaderHook() { @Override - public boolean rejectTransformation(String name, byte[] transformedBytes, ClasspathEntry classpathEntry, BundleEntry entry, ClasspathManager manager) { + public boolean rejectTransformation(String name, byte[] transformedBytes, ClasspathEntry classpathEntry, + BundleEntry entry, ClasspathManager manager) { return Boolean.getBoolean(REJECT_PROP); } @Override - public byte[] processClass(String name, byte[] classbytes, ClasspathEntry classpathEntry, BundleEntry entry, ClasspathManager manager) { + public byte[] processClass(String name, byte[] classbytes, ClasspathEntry classpathEntry, BundleEntry entry, + ClasspathManager manager) { if (Boolean.getBoolean(BAD_TRANSFORM_PROP)) { - return new byte[] {'b', 'a', 'd', 'b', 'y', 't', 'e', 's'}; + return new byte[] { 'b', 'a', 'd', 'b', 'y', 't', 'e', 's' }; } if (Boolean.getBoolean(RECURSION_LOAD)) { if (isProcessClassRecursionSupported() && doingRecursionLoad.get()) { diff --git a/bundles/org.eclipse.osgi.tests/bundles_src/exporter.importer3/exporter/importer/Activator.java b/bundles/org.eclipse.osgi.tests/bundles_src/exporter.importer3/exporter/importer/Activator.java index 184c509ad80..f3a196517bf 100644 --- a/bundles/org.eclipse.osgi.tests/bundles_src/exporter.importer3/exporter/importer/Activator.java +++ b/bundles/org.eclipse.osgi.tests/bundles_src/exporter.importer3/exporter/importer/Activator.java @@ -12,6 +12,7 @@ * IBM Corporation - initial API and implementation *******************************************************************************/ package exporter.importer; + import exporter.importer.test.Test3; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; diff --git a/bundles/org.eclipse.osgi.tests/bundles_src/ext.extclasspath.a.importer/ext/extclasspath/a/importer/Activator.java b/bundles/org.eclipse.osgi.tests/bundles_src/ext.extclasspath.a.importer/ext/extclasspath/a/importer/Activator.java index 23a3219c228..b5416493570 100644 --- a/bundles/org.eclipse.osgi.tests/bundles_src/ext.extclasspath.a.importer/ext/extclasspath/a/importer/Activator.java +++ b/bundles/org.eclipse.osgi.tests/bundles_src/ext.extclasspath.a.importer/ext/extclasspath/a/importer/Activator.java @@ -24,7 +24,8 @@ public class Activator implements BundleActivator { public void start(BundleContext context) throws Exception { AbstractBundleTests.simpleResults.addEvent(new ExtClasspathExtTest().toString()); - AbstractBundleTests.simpleResults.addEvent(getURLContent(this.getClass().getResource("/ext/extclasspath/a/extresource.txt"))); //$NON-NLS-1$ + AbstractBundleTests.simpleResults + .addEvent(getURLContent(this.getClass().getResource("/ext/extclasspath/a/extresource.txt"))); //$NON-NLS-1$ } private String getURLContent(URL resource) throws IOException { diff --git a/bundles/org.eclipse.osgi.tests/bundles_src/ext.framework.a.importer/ext/framework/a/importer/Activator.java b/bundles/org.eclipse.osgi.tests/bundles_src/ext.framework.a.importer/ext/framework/a/importer/Activator.java index cae4e467af9..87a38784fb7 100644 --- a/bundles/org.eclipse.osgi.tests/bundles_src/ext.framework.a.importer/ext/framework/a/importer/Activator.java +++ b/bundles/org.eclipse.osgi.tests/bundles_src/ext.framework.a.importer/ext/framework/a/importer/Activator.java @@ -27,7 +27,8 @@ public class Activator implements BundleActivator { public void start(BundleContext context) throws Exception { AbstractBundleTests.simpleResults.addEvent(new FrameworkExtTest().testIt("success")); //$NON-NLS-1$ - AbstractBundleTests.simpleResults.addEvent(getURLContent(this.getClass().getResource("/ext/framework/a/fwkresource.txt"))); //$NON-NLS-1$ + AbstractBundleTests.simpleResults + .addEvent(getURLContent(this.getClass().getResource("/ext/framework/a/fwkresource.txt"))); //$NON-NLS-1$ ExtensionBundleTests.events.add(context.getBundle().getSymbolicName() + " STARTED"); } diff --git a/bundles/org.eclipse.osgi.tests/bundles_src/ext.framework.a.requires/ext/framework/a/requires/Activator.java b/bundles/org.eclipse.osgi.tests/bundles_src/ext.framework.a.requires/ext/framework/a/requires/Activator.java index f695b4cd426..7f89ea3f1ca 100644 --- a/bundles/org.eclipse.osgi.tests/bundles_src/ext.framework.a.requires/ext/framework/a/requires/Activator.java +++ b/bundles/org.eclipse.osgi.tests/bundles_src/ext.framework.a.requires/ext/framework/a/requires/Activator.java @@ -27,7 +27,8 @@ public class Activator implements BundleActivator { public void start(BundleContext context) throws Exception { AbstractBundleTests.simpleResults.addEvent(new FrameworkExtTest().testIt("success")); //$NON-NLS-1$ - AbstractBundleTests.simpleResults.addEvent(getURLContent(this.getClass().getResource("/ext/framework/a/fwkresource.txt"))); //$NON-NLS-1$ + AbstractBundleTests.simpleResults + .addEvent(getURLContent(this.getClass().getResource("/ext/framework/a/fwkresource.txt"))); //$NON-NLS-1$ ExtensionBundleTests.events.add(context.getBundle().getSymbolicName() + " STARTED"); } diff --git a/bundles/org.eclipse.osgi.tests/bundles_src/ext.framework.b/ext/framework/b/TestCondition.java b/bundles/org.eclipse.osgi.tests/bundles_src/ext.framework.b/ext/framework/b/TestCondition.java index e7d35625419..4f9218ca76b 100644 --- a/bundles/org.eclipse.osgi.tests/bundles_src/ext.framework.b/ext/framework/b/TestCondition.java +++ b/bundles/org.eclipse.osgi.tests/bundles_src/ext.framework.b/ext/framework/b/TestCondition.java @@ -42,7 +42,8 @@ private TestCondition(String id, boolean mutable, boolean postponed, boolean sat static public Condition getCondition(final Bundle bundle, ConditionInfo info) { if (!TestCondition.class.getName().equals(info.getType())) - throw new IllegalArgumentException("ConditionInfo must be of type \"" + TestCondition.class.getName() + "\""); //$NON-NLS-1$ //$NON-NLS-2$ + throw new IllegalArgumentException( + "ConditionInfo must be of type \"" + TestCondition.class.getName() + "\""); //$NON-NLS-1$ //$NON-NLS-2$ String[] args = info.getArgs(); if (args.length != 4) throw new IllegalArgumentException("Illegal number of args: " + args.length); //$NON-NLS-1$ @@ -109,7 +110,9 @@ public boolean equals(Object o) { if (!(o instanceof TestCondition)) return false; TestCondition otherCondition = (TestCondition) o; - return id.equals(otherCondition.id) && postponed == otherCondition.postponed && satisfied == otherCondition.satisfied && mutable == otherCondition.mutable && bundle == otherCondition.bundle; + return id.equals(otherCondition.id) && postponed == otherCondition.postponed + && satisfied == otherCondition.satisfied && mutable == otherCondition.mutable + && bundle == otherCondition.bundle; } public void setMutable(boolean mutable) { diff --git a/bundles/org.eclipse.osgi.tests/bundles_src/fragment.test.attach.frag.a/fragment/test/attach/host/a/internal/test/TestPackageAccess.java b/bundles/org.eclipse.osgi.tests/bundles_src/fragment.test.attach.frag.a/fragment/test/attach/host/a/internal/test/TestPackageAccess.java index e86e38d895c..5eb855c5c76 100644 --- a/bundles/org.eclipse.osgi.tests/bundles_src/fragment.test.attach.frag.a/fragment/test/attach/host/a/internal/test/TestPackageAccess.java +++ b/bundles/org.eclipse.osgi.tests/bundles_src/fragment.test.attach.frag.a/fragment/test/attach/host/a/internal/test/TestPackageAccess.java @@ -15,7 +15,7 @@ import org.eclipse.osgi.tests.bundles.ITestRunner; -public class TestPackageAccess implements ITestRunner{ +public class TestPackageAccess implements ITestRunner { @Override public Object testIt() throws Exception { diff --git a/bundles/org.eclipse.osgi.tests/bundles_src/fragment.test.attach.frag.b/fragment/test/attach/frag/b/Test.java b/bundles/org.eclipse.osgi.tests/bundles_src/fragment.test.attach.frag.b/fragment/test/attach/frag/b/Test.java index 76fc4cfe641..a4c168c25d5 100644 --- a/bundles/org.eclipse.osgi.tests/bundles_src/fragment.test.attach.frag.b/fragment/test/attach/frag/b/Test.java +++ b/bundles/org.eclipse.osgi.tests/bundles_src/fragment.test.attach.frag.b/fragment/test/attach/frag/b/Test.java @@ -13,7 +13,6 @@ *******************************************************************************/ package fragment.test.attach.frag.b; - public class Test { } diff --git a/bundles/org.eclipse.osgi.tests/bundles_src/geturl/geturl/Activator.java b/bundles/org.eclipse.osgi.tests/bundles_src/geturl/geturl/Activator.java index 54423852422..05de1a5909d 100644 --- a/bundles/org.eclipse.osgi.tests/bundles_src/geturl/geturl/Activator.java +++ b/bundles/org.eclipse.osgi.tests/bundles_src/geturl/geturl/Activator.java @@ -37,7 +37,8 @@ public void start(BundleContext context) throws Exception { try { new URL(url.getProtocol(), url.getHost(), url.getFile()); } catch (MalformedURLException e2) { - // unexpected; the handler does not get involved and we have a multiplexor cached + // unexpected; the handler does not get involved and we have a multiplexor + // cached throw new RuntimeException("Could not create URL from parts: " + url); } url.toExternalForm(); diff --git a/bundles/org.eclipse.osgi.tests/bundles_src/legacy.lazystart/legacy/lazystart/FalseExceptionLegacy2.java b/bundles/org.eclipse.osgi.tests/bundles_src/legacy.lazystart/legacy/lazystart/FalseExceptionLegacy2.java index 8ecc38fc5e6..893504c08de 100644 --- a/bundles/org.eclipse.osgi.tests/bundles_src/legacy.lazystart/legacy/lazystart/FalseExceptionLegacy2.java +++ b/bundles/org.eclipse.osgi.tests/bundles_src/legacy.lazystart/legacy/lazystart/FalseExceptionLegacy2.java @@ -15,6 +15,7 @@ import org.eclipse.osgi.tests.bundles.ITestRunner; import legacy.lazystart.c.CTest; + public class FalseExceptionLegacy2 implements ITestRunner { @Override diff --git a/bundles/org.eclipse.osgi.tests/bundles_src/legacy.lazystart/legacy/lazystart/TrueExceptionLegacy1.java b/bundles/org.eclipse.osgi.tests/bundles_src/legacy.lazystart/legacy/lazystart/TrueExceptionLegacy1.java index b58be2f6375..17cb26a7c80 100644 --- a/bundles/org.eclipse.osgi.tests/bundles_src/legacy.lazystart/legacy/lazystart/TrueExceptionLegacy1.java +++ b/bundles/org.eclipse.osgi.tests/bundles_src/legacy.lazystart/legacy/lazystart/TrueExceptionLegacy1.java @@ -16,6 +16,7 @@ import org.eclipse.osgi.tests.bundles.ITestRunner; import legacy.lazystart.b.excluded.a.BAExcluded; import legacy.lazystart.b.excluded.b.BBExcluded; + public class TrueExceptionLegacy1 implements ITestRunner { @Override diff --git a/bundles/org.eclipse.osgi.tests/bundles_src/nativetest.a1/nativetest/a1/Activator.java b/bundles/org.eclipse.osgi.tests/bundles_src/nativetest.a1/nativetest/a1/Activator.java index 0a106adb70c..b16020df856 100644 --- a/bundles/org.eclipse.osgi.tests/bundles_src/nativetest.a1/nativetest/a1/Activator.java +++ b/bundles/org.eclipse.osgi.tests/bundles_src/nativetest.a1/nativetest/a1/Activator.java @@ -34,7 +34,8 @@ public void start(BundleContext context) throws Exception { Method findLibrary = findDeclaredMethod(this.getClass().getClassLoader().getClass(), "findLibrary", String.class); findLibrary.setAccessible(true); - AbstractBundleTests.simpleResults.addEvent(findLibrary.invoke(this.getClass().getClassLoader(), new Object[] {"nativefile1.txt"})); + AbstractBundleTests.simpleResults + .addEvent(findLibrary.invoke(this.getClass().getClassLoader(), new Object[] { "nativefile1.txt" })); } public void stop(BundleContext context) throws Exception { diff --git a/bundles/org.eclipse.osgi.tests/bundles_src/nativetest.a2/nativetest/a2/Activator.java b/bundles/org.eclipse.osgi.tests/bundles_src/nativetest.a2/nativetest/a2/Activator.java index 1d4b96778d0..cda1db562ff 100644 --- a/bundles/org.eclipse.osgi.tests/bundles_src/nativetest.a2/nativetest/a2/Activator.java +++ b/bundles/org.eclipse.osgi.tests/bundles_src/nativetest.a2/nativetest/a2/Activator.java @@ -35,7 +35,8 @@ public void start(BundleContext context) throws Exception { Method findLibrary = findDeclaredMethod(this.getClass().getClassLoader().getClass(), "findLibrary", String.class); findLibrary.setAccessible(true); - AbstractBundleTests.simpleResults.addEvent(findLibrary.invoke(this.getClass().getClassLoader(), new Object[] {"nativefile2.txt"})); + AbstractBundleTests.simpleResults + .addEvent(findLibrary.invoke(this.getClass().getClassLoader(), new Object[] { "nativefile2.txt" })); } public void stop(BundleContext context) throws Exception { diff --git a/bundles/org.eclipse.osgi.tests/bundles_src/nativetest.b1/nativetest/b1/Activator.java b/bundles/org.eclipse.osgi.tests/bundles_src/nativetest.b1/nativetest/b1/Activator.java index 38e7c528926..eced9d80b80 100644 --- a/bundles/org.eclipse.osgi.tests/bundles_src/nativetest.b1/nativetest/b1/Activator.java +++ b/bundles/org.eclipse.osgi.tests/bundles_src/nativetest.b1/nativetest/b1/Activator.java @@ -35,7 +35,8 @@ public void start(BundleContext context) throws Exception { Method findLibrary = findDeclaredMethod(this.getClass().getClassLoader().getClass(), "findLibrary", String.class); findLibrary.setAccessible(true); - AbstractBundleTests.simpleResults.addEvent(findLibrary.invoke(this.getClass().getClassLoader(), new Object[] {"nativefile.txt"})); + AbstractBundleTests.simpleResults + .addEvent(findLibrary.invoke(this.getClass().getClassLoader(), new Object[] { "nativefile.txt" })); } public void stop(BundleContext context) throws Exception { diff --git a/bundles/org.eclipse.osgi.tests/bundles_src/nativetest.b2/nativetest/b2/Activator.java b/bundles/org.eclipse.osgi.tests/bundles_src/nativetest.b2/nativetest/b2/Activator.java index e5dd5303c4d..6fb37439c23 100644 --- a/bundles/org.eclipse.osgi.tests/bundles_src/nativetest.b2/nativetest/b2/Activator.java +++ b/bundles/org.eclipse.osgi.tests/bundles_src/nativetest.b2/nativetest/b2/Activator.java @@ -35,7 +35,8 @@ public void start(BundleContext context) throws Exception { Method findLibrary = findDeclaredMethod(this.getClass().getClassLoader().getClass(), "findLibrary", String.class); findLibrary.setAccessible(true); - AbstractBundleTests.simpleResults.addEvent(findLibrary.invoke(this.getClass().getClassLoader(), new Object[] {"nativefile.txt"})); + AbstractBundleTests.simpleResults + .addEvent(findLibrary.invoke(this.getClass().getClassLoader(), new Object[] { "nativefile.txt" })); } public void stop(BundleContext context) throws Exception { diff --git a/bundles/org.eclipse.osgi.tests/bundles_src/nativetest.c/nativetest/c/Activator.java b/bundles/org.eclipse.osgi.tests/bundles_src/nativetest.c/nativetest/c/Activator.java index 37219d1f40e..ce283314442 100644 --- a/bundles/org.eclipse.osgi.tests/bundles_src/nativetest.c/nativetest/c/Activator.java +++ b/bundles/org.eclipse.osgi.tests/bundles_src/nativetest.c/nativetest/c/Activator.java @@ -35,7 +35,8 @@ public void start(BundleContext context) throws Exception { Method findLibrary = findDeclaredMethod(this.getClass().getClassLoader().getClass(), "findLibrary", String.class); findLibrary.setAccessible(true); - AbstractBundleTests.simpleResults.addEvent(findLibrary.invoke(this.getClass().getClassLoader(), new Object[] {"nativecode.txt"})); + AbstractBundleTests.simpleResults + .addEvent(findLibrary.invoke(this.getClass().getClassLoader(), new Object[] { "nativecode.txt" })); } public void stop(BundleContext context) throws Exception { diff --git a/bundles/org.eclipse.osgi.tests/bundles_src/nativetest.d/nativetest/d/Activator.java b/bundles/org.eclipse.osgi.tests/bundles_src/nativetest.d/nativetest/d/Activator.java index 855c0c1ed4d..cfc25205f13 100644 --- a/bundles/org.eclipse.osgi.tests/bundles_src/nativetest.d/nativetest/d/Activator.java +++ b/bundles/org.eclipse.osgi.tests/bundles_src/nativetest.d/nativetest/d/Activator.java @@ -35,7 +35,8 @@ public void start(BundleContext context) throws Exception { Method findLibrary = findDeclaredMethod(this.getClass().getClassLoader().getClass(), "findLibrary", String.class); findLibrary.setAccessible(true); - AbstractBundleTests.simpleResults.addEvent(findLibrary.invoke(this.getClass().getClassLoader(), new Object[] {"nativecode.txt"})); + AbstractBundleTests.simpleResults + .addEvent(findLibrary.invoke(this.getClass().getClassLoader(), new Object[] { "nativecode.txt" })); } public void stop(BundleContext context) throws Exception { diff --git a/bundles/org.eclipse.osgi.tests/bundles_src/nativetest.e/nativetest/e/Activator.java b/bundles/org.eclipse.osgi.tests/bundles_src/nativetest.e/nativetest/e/Activator.java index 2c1e5cb777d..9623d1dc928 100644 --- a/bundles/org.eclipse.osgi.tests/bundles_src/nativetest.e/nativetest/e/Activator.java +++ b/bundles/org.eclipse.osgi.tests/bundles_src/nativetest.e/nativetest/e/Activator.java @@ -35,7 +35,8 @@ public void start(BundleContext context) throws Exception { Method findLibrary = findDeclaredMethod(this.getClass().getClassLoader().getClass(), "findLibrary", String.class); findLibrary.setAccessible(true); - AbstractBundleTests.simpleResults.addEvent(findLibrary.invoke(this.getClass().getClassLoader(), new Object[] {"nativecode.txt"})); + AbstractBundleTests.simpleResults + .addEvent(findLibrary.invoke(this.getClass().getClassLoader(), new Object[] { "nativecode.txt" })); } public void stop(BundleContext context) throws Exception { diff --git a/bundles/org.eclipse.osgi.tests/bundles_src/osgi.lazystart/osgi/lazystart/LazyExclude1.java b/bundles/org.eclipse.osgi.tests/bundles_src/osgi.lazystart/osgi/lazystart/LazyExclude1.java index cce9027dfb7..95a3d75ab27 100644 --- a/bundles/org.eclipse.osgi.tests/bundles_src/osgi.lazystart/osgi/lazystart/LazyExclude1.java +++ b/bundles/org.eclipse.osgi.tests/bundles_src/osgi.lazystart/osgi/lazystart/LazyExclude1.java @@ -16,6 +16,7 @@ import org.eclipse.osgi.tests.bundles.ITestRunner; import osgi.lazystart.b.excluded.a.BAExcluded; import osgi.lazystart.b.excluded.b.BBExcluded; + public class LazyExclude1 implements ITestRunner { @Override diff --git a/bundles/org.eclipse.osgi.tests/bundles_src/osgi.lazystart/osgi/lazystart/LazyInclude2.java b/bundles/org.eclipse.osgi.tests/bundles_src/osgi.lazystart/osgi/lazystart/LazyInclude2.java index 663920fcdca..f2ecd1d6d08 100644 --- a/bundles/org.eclipse.osgi.tests/bundles_src/osgi.lazystart/osgi/lazystart/LazyInclude2.java +++ b/bundles/org.eclipse.osgi.tests/bundles_src/osgi.lazystart/osgi/lazystart/LazyInclude2.java @@ -15,6 +15,7 @@ import org.eclipse.osgi.tests.bundles.ITestRunner; import osgi.lazystart.c.CTest; + public class LazyInclude2 implements ITestRunner { @Override diff --git a/bundles/org.eclipse.osgi.tests/bundles_src/security.a/security/a/Activator.java b/bundles/org.eclipse.osgi.tests/bundles_src/security.a/security/a/Activator.java index dad105c17f9..96232ffab9c 100644 --- a/bundles/org.eclipse.osgi.tests/bundles_src/security.a/security/a/Activator.java +++ b/bundles/org.eclipse.osgi.tests/bundles_src/security.a/security/a/Activator.java @@ -32,7 +32,7 @@ public void start(BundleContext context) throws Exception { } public void stop(BundleContext context) throws Exception { - //nothing + // nothing } } diff --git a/bundles/org.eclipse.osgi.tests/bundles_src/security.b/security/b/Activator.java b/bundles/org.eclipse.osgi.tests/bundles_src/security.b/security/b/Activator.java index 2e96b7cfe61..2dafc6a5a3c 100644 --- a/bundles/org.eclipse.osgi.tests/bundles_src/security.b/security/b/Activator.java +++ b/bundles/org.eclipse.osgi.tests/bundles_src/security.b/security/b/Activator.java @@ -24,7 +24,9 @@ public class Activator implements BundleActivator { /* * (non-Javadoc) - * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext) + * + * @see + * org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext) */ public void start(BundleContext context) throws Exception { this.bc = context; @@ -33,7 +35,9 @@ public void start(BundleContext context) throws Exception { /* * (non-Javadoc) - * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext) + * + * @see + * org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext) */ public void stop(BundleContext context) throws Exception { } diff --git a/bundles/org.eclipse.osgi.tests/bundles_src/storage.hooks.a/org/eclipse/osgi/tests/hooks/framework/storage/a/TestHookConfigurator.java b/bundles/org.eclipse.osgi.tests/bundles_src/storage.hooks.a/org/eclipse/osgi/tests/hooks/framework/storage/a/TestHookConfigurator.java index 3a53f172664..3208c7e75c4 100644 --- a/bundles/org.eclipse.osgi.tests/bundles_src/storage.hooks.a/org/eclipse/osgi/tests/hooks/framework/storage/a/TestHookConfigurator.java +++ b/bundles/org.eclipse.osgi.tests/bundles_src/storage.hooks.a/org/eclipse/osgi/tests/hooks/framework/storage/a/TestHookConfigurator.java @@ -44,7 +44,8 @@ import org.osgi.framework.namespace.IdentityNamespace; public class TestHookConfigurator implements HookConfigurator { - private static class TestStorageHookFactory extends StorageHookFactory { + private static class TestStorageHookFactory + extends StorageHookFactory { private static class TestStorageHook extends StorageHookFactory.StorageHook { private static AtomicInteger adaptCount = new AtomicInteger(1); @@ -83,7 +84,8 @@ public void deletingGeneration() { } @Override - public ModuleRevisionBuilder adaptModuleRevisionBuilder(ModuleEvent operation, Module origin, ModuleRevisionBuilder builder) { + public ModuleRevisionBuilder adaptModuleRevisionBuilder(ModuleEvent operation, Module origin, + ModuleRevisionBuilder builder) { if (TestHookConfigurator.replaceModuleBuilder) { ModuleRevisionBuilder replace = new ModuleRevisionBuilder(); // try setting the ID to something which is checked during the test @@ -91,8 +93,10 @@ public ModuleRevisionBuilder adaptModuleRevisionBuilder(ModuleEvent operation, M replace.setSymbolicName("replace"); replace.setVersion(Version.parseVersion("1.1.1")); replace.addCapability("replace", Collections.emptyMap(), Collections.emptyMap()); - replace.addCapability(IdentityNamespace.IDENTITY_NAMESPACE, Collections.emptyMap(), Collections.singletonMap(IdentityNamespace.IDENTITY_NAMESPACE, "replace")); - replace.addCapability(BundleNamespace.BUNDLE_NAMESPACE, Collections.emptyMap(), Collections.singletonMap(BundleNamespace.BUNDLE_NAMESPACE, "replace")); + replace.addCapability(IdentityNamespace.IDENTITY_NAMESPACE, Collections.emptyMap(), + Collections.singletonMap(IdentityNamespace.IDENTITY_NAMESPACE, "replace")); + replace.addCapability(BundleNamespace.BUNDLE_NAMESPACE, Collections.emptyMap(), + Collections.singletonMap(BundleNamespace.BUNDLE_NAMESPACE, "replace")); return replace; } if (TestHookConfigurator.adaptManifest) { @@ -100,7 +104,8 @@ public ModuleRevisionBuilder adaptModuleRevisionBuilder(ModuleEvent operation, M builder.setId(5678); Map dirs = Collections.emptyMap(); Map attrs = new HashMap<>(); - attrs.put("test.file.path", getGeneration().getContent().getPath() + " - " + adaptCount.getAndIncrement()); + attrs.put("test.file.path", + getGeneration().getContent().getPath() + " - " + adaptCount.getAndIncrement()); attrs.put("test.operation", operation.toString()); attrs.put("test.origin", origin.getLocation()); builder.addCapability("test.file.path", dirs, attrs); @@ -136,7 +141,8 @@ protected TestStorageHook createStorageHook(Generation generation) { } @Override - public URLConnection handleContentConnection(Module module, String location, InputStream in) throws IOException { + public URLConnection handleContentConnection(Module module, String location, InputStream in) + throws IOException { if (handleContentConnection) { final ByteArrayOutputStream baos = new ByteArrayOutputStream(); Manifest manifest = new Manifest(); diff --git a/bundles/org.eclipse.osgi.tests/bundles_src/test.bug235958.x/test/bug235958/x/internal/Activator.java b/bundles/org.eclipse.osgi.tests/bundles_src/test.bug235958.x/test/bug235958/x/internal/Activator.java index ad502dd378d..46bb5b8e005 100644 --- a/bundles/org.eclipse.osgi.tests/bundles_src/test.bug235958.x/test/bug235958/x/internal/Activator.java +++ b/bundles/org.eclipse.osgi.tests/bundles_src/test.bug235958.x/test/bug235958/x/internal/Activator.java @@ -21,7 +21,9 @@ public class Activator implements BundleActivator { /* * (non-Javadoc) - * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext) + * + * @see + * org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext) */ public void start(BundleContext context) throws Exception { new X1(); @@ -29,7 +31,9 @@ public void start(BundleContext context) throws Exception { /* * (non-Javadoc) - * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext) + * + * @see + * org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext) */ public void stop(BundleContext context) throws Exception { } diff --git a/bundles/org.eclipse.osgi.tests/bundles_src/test.bug235958.y/test/bug235958/y/internal/Activator.java b/bundles/org.eclipse.osgi.tests/bundles_src/test.bug235958.y/test/bug235958/y/internal/Activator.java index 4a2a64c18a5..4815a50793e 100644 --- a/bundles/org.eclipse.osgi.tests/bundles_src/test.bug235958.y/test/bug235958/y/internal/Activator.java +++ b/bundles/org.eclipse.osgi.tests/bundles_src/test.bug235958.y/test/bug235958/y/internal/Activator.java @@ -20,14 +20,18 @@ public class Activator implements BundleActivator { /* * (non-Javadoc) - * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext) + * + * @see + * org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext) */ public void start(BundleContext context) throws Exception { } /* * (non-Javadoc) - * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext) + * + * @see + * org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext) */ public void stop(BundleContext context) throws Exception { } diff --git a/bundles/org.eclipse.osgi.tests/bundles_src/test.bug259903.c/test/bug259903/c/Activator.java b/bundles/org.eclipse.osgi.tests/bundles_src/test.bug259903.c/test/bug259903/c/Activator.java index 568875af4be..de695cb33f2 100644 --- a/bundles/org.eclipse.osgi.tests/bundles_src/test.bug259903.c/test/bug259903/c/Activator.java +++ b/bundles/org.eclipse.osgi.tests/bundles_src/test.bug259903.c/test/bug259903/c/Activator.java @@ -25,7 +25,8 @@ public void start(BundleContext context) throws Exception { public void stop(BundleContext context) throws Exception { - new Service3() {/* nothing*/}; + new Service3() { + /* nothing */}; AbstractBundleTests.simpleResults.addEvent(new BundleEvent(BundleEvent.STOPPED, context.getBundle())); } diff --git a/bundles/org.eclipse.osgi.tests/bundles_src/test.dynamic.privateimport/test/dynamic/privateimport/Activator.java b/bundles/org.eclipse.osgi.tests/bundles_src/test.dynamic.privateimport/test/dynamic/privateimport/Activator.java index 5d4317528cb..de5db46255e 100644 --- a/bundles/org.eclipse.osgi.tests/bundles_src/test.dynamic.privateimport/test/dynamic/privateimport/Activator.java +++ b/bundles/org.eclipse.osgi.tests/bundles_src/test.dynamic.privateimport/test/dynamic/privateimport/Activator.java @@ -23,7 +23,7 @@ public void start(BundleContext context) throws Exception { } public void stop(BundleContext context) throws Exception { - //nothing + // nothing } } diff --git a/bundles/org.eclipse.osgi.tests/bundles_src/test.dynamicimport/test/dynamicimport/Activator.java b/bundles/org.eclipse.osgi.tests/bundles_src/test.dynamicimport/test/dynamicimport/Activator.java index 67fc9393030..c72c851ef04 100644 --- a/bundles/org.eclipse.osgi.tests/bundles_src/test.dynamicimport/test/dynamicimport/Activator.java +++ b/bundles/org.eclipse.osgi.tests/bundles_src/test.dynamicimport/test/dynamicimport/Activator.java @@ -28,7 +28,7 @@ public void start(BundleContext context) throws Exception { } public void stop(BundleContext context) throws Exception { - //nothing + // nothing } } diff --git a/bundles/org.eclipse.osgi.tests/bundles_src/test.filter.a/test/filter/a/Activator.java b/bundles/org.eclipse.osgi.tests/bundles_src/test.filter.a/test/filter/a/Activator.java index c32bb26d369..87d5d2b8241 100644 --- a/bundles/org.eclipse.osgi.tests/bundles_src/test.filter.a/test/filter/a/Activator.java +++ b/bundles/org.eclipse.osgi.tests/bundles_src/test.filter.a/test/filter/a/Activator.java @@ -21,26 +21,28 @@ public class Activator implements BundleActivator { public void start(BundleContext context) throws Exception { - final boolean[] serviceChanged = {false}; + final boolean[] serviceChanged = { false }; ServiceListener listener = event -> serviceChanged[0] = true; context.addServiceListener(listener, "(&(objectClass=java.lang.String)(test=*))"); - final boolean[] modifiedService = {false}; - ServiceTracker tracker = new ServiceTracker(context, FrameworkUtil.createFilter("(&(objectClass=java.lang.String)(test=*))"), new ServiceTrackerCustomizer() { + final boolean[] modifiedService = { false }; + ServiceTracker tracker = new ServiceTracker(context, + FrameworkUtil.createFilter("(&(objectClass=java.lang.String)(test=*))"), + new ServiceTrackerCustomizer() { - public Object addingService(ServiceReference reference) { - return reference; - } + public Object addingService(ServiceReference reference) { + return reference; + } - public void modifiedService(ServiceReference reference, Object service) { - modifiedService[0] = true; - } + public void modifiedService(ServiceReference reference, Object service) { + modifiedService[0] = true; + } - public void removedService(ServiceReference reference, Object service) { - // TODO Auto-generated method stub + public void removedService(ServiceReference reference, Object service) { + // TODO Auto-generated method stub - } + } - }); + }); tracker.open(); Hashtable props = new Hashtable(); props.put("test", "value1"); @@ -54,7 +56,7 @@ public void removedService(ServiceReference reference, Object service) { } public void stop(BundleContext context) throws Exception { - //nothing; framework will clean up our listeners + // nothing; framework will clean up our listeners } } diff --git a/bundles/org.eclipse.osgi.tests/bundles_src/test.manifestpackage/test/manifestpackage/Activator.java b/bundles/org.eclipse.osgi.tests/bundles_src/test.manifestpackage/test/manifestpackage/Activator.java index d2387910d70..4758c4c0b7b 100644 --- a/bundles/org.eclipse.osgi.tests/bundles_src/test.manifestpackage/test/manifestpackage/Activator.java +++ b/bundles/org.eclipse.osgi.tests/bundles_src/test.manifestpackage/test/manifestpackage/Activator.java @@ -54,7 +54,8 @@ public void start(BundleContext context) throws Exception { checkPackage(fPkg, "main", "1.0", "equinox.f", "MAIN", "10.0", "equinox.f"); } - private void checkPackage(Package pkg, String specTitle, String specVersion, String specVendor, String implTitle, String implVersion, String implVendor) { + private void checkPackage(Package pkg, String specTitle, String specVersion, String specVendor, String implTitle, + String implVersion, String implVendor) { assertEquals(specTitle, pkg.getSpecificationTitle()); assertEquals(specVersion, pkg.getSpecificationVersion()); assertEquals(specVendor, pkg.getSpecificationVendor()); diff --git a/bundles/org.eclipse.osgi.tests/bundles_src/test.tccl/test/tccl/Activator.java b/bundles/org.eclipse.osgi.tests/bundles_src/test.tccl/test/tccl/Activator.java index 5f0a9995813..bed0473ac1b 100644 --- a/bundles/org.eclipse.osgi.tests/bundles_src/test.tccl/test/tccl/Activator.java +++ b/bundles/org.eclipse.osgi.tests/bundles_src/test.tccl/test/tccl/Activator.java @@ -20,7 +20,8 @@ public class Activator implements BundleActivator { public void start(BundleContext context) throws Exception { System.out.println("test.tccl: start"); ClassLoader tccl = Thread.currentThread().getContextClassLoader(); - ClassLoader serviceTCCL = (ClassLoader) context.getService(context.getServiceReferences(ClassLoader.class.getName(), "(equinox.classloader.type=contextClassLoader)")[0]); //$NON-NLS-1$ + ClassLoader serviceTCCL = (ClassLoader) context.getService(context + .getServiceReferences(ClassLoader.class.getName(), "(equinox.classloader.type=contextClassLoader)")[0]); //$NON-NLS-1$ if (tccl != serviceTCCL) { BundleException e = new BundleException("Wrong thread context class loader found"); //$NON-NLS-1$ e.printStackTrace(); @@ -31,7 +32,8 @@ public void start(BundleContext context) throws Exception { public void stop(BundleContext context) throws Exception { System.out.println("test.tccl: stop"); ClassLoader tccl = Thread.currentThread().getContextClassLoader(); - ClassLoader serviceTCCL = (ClassLoader) context.getService(context.getServiceReferences(ClassLoader.class.getName(), "(equinox.classloader.type=contextClassLoader)")[0]); //$NON-NLS-1$ + ClassLoader serviceTCCL = (ClassLoader) context.getService(context + .getServiceReferences(ClassLoader.class.getName(), "(equinox.classloader.type=contextClassLoader)")[0]); //$NON-NLS-1$ if (tccl != serviceTCCL) { BundleException e = new BundleException("Wrong thread context class loader found"); //$NON-NLS-1$ e.printStackTrace(); diff --git a/bundles/org.eclipse.osgi.tests/bundles_src/wrapper.hooks.a/org/eclipse/osgi/tests/wrapper/hooks/a/TestHookConfigurator.java b/bundles/org.eclipse.osgi.tests/bundles_src/wrapper.hooks.a/org/eclipse/osgi/tests/wrapper/hooks/a/TestHookConfigurator.java index 731832b7ae5..3c135114cbd 100644 --- a/bundles/org.eclipse.osgi.tests/bundles_src/wrapper.hooks.a/org/eclipse/osgi/tests/wrapper/hooks/a/TestHookConfigurator.java +++ b/bundles/org.eclipse.osgi.tests/bundles_src/wrapper.hooks.a/org/eclipse/osgi/tests/wrapper/hooks/a/TestHookConfigurator.java @@ -22,53 +22,54 @@ public class TestHookConfigurator implements HookConfigurator { public void addHooks(HookRegistry hookRegistry) { - BundleFileWrapperFactoryHook modifyContent = (bundleFile, generation, base) -> new BundleFileWrapper(bundleFile) { - - @Override - public BundleEntry getEntry(String path) { - final BundleEntry original = super.getEntry(path); - final byte[] content = "CUSTOM_CONTENT".getBytes(); - if ("data/resource1".equals(path)) { - return new BundleEntry() { - - @Override - public long getTime() { - return original.getTime(); + BundleFileWrapperFactoryHook modifyContent = (bundleFile, generation, + base) -> new BundleFileWrapper(bundleFile) { + + @Override + public BundleEntry getEntry(String path) { + final BundleEntry original = super.getEntry(path); + final byte[] content = "CUSTOM_CONTENT".getBytes(); + if ("data/resource1".equals(path)) { + return new BundleEntry() { + + @Override + public long getTime() { + return original.getTime(); + } + + @Override + public long getSize() { + return content.length; + } + + @Override + public String getName() { + return original.getName(); + } + + @Override + public URL getLocalURL() { + return original.getLocalURL(); + } + + /** + * @throws IOException + */ + @Override + public InputStream getInputStream() throws IOException { + return new ByteArrayInputStream(content); + } + + @Override + public URL getFileURL() { + return original.getFileURL(); + } + }; } + return original; + } - @Override - public long getSize() { - return content.length; - } - - @Override - public String getName() { - return original.getName(); - } - - @Override - public URL getLocalURL() { - return original.getLocalURL(); - } - - /** - * @throws IOException - */ - @Override - public InputStream getInputStream() throws IOException { - return new ByteArrayInputStream(content); - } - - @Override - public URL getFileURL() { - return original.getFileURL(); - } - }; - } - return original; - } - - }; + }; BundleFileWrapperFactoryHook noop = (bundleFile, generation, base) -> new BundleFileWrapper(bundleFile) { // Do nothing to test multiple wrappers }; @@ -78,34 +79,36 @@ public URL getFileURL() { // add a hook that modifies content hookRegistry.addBundleFileWrapperFactoryHook(modifyContent); - hookRegistry.addBundleFileWrapperFactoryHook((bundleFile, generation, base) -> new BundleFileWrapper(bundleFile) { - @Override - public URL getResourceURL(String path, Module hostModule, int index) { - // just making sure the wrapper getResourceURL is never called - throw new RuntimeException("Should not be called"); - } - - @Override - protected URL createResourceURL(BundleEntry bundleEntry, Module hostModule, int index, String path) { - final URL url = super.createResourceURL(bundleEntry, hostModule, index, path); - if (url == null) { - return null; - } - try { - return new URL("custom", "custom", 0, path, new URLStreamHandler() { - - @Override - protected URLConnection openConnection(URL u) throws IOException { - // TODO Auto-generated method stub - return url.openConnection(); + hookRegistry + .addBundleFileWrapperFactoryHook((bundleFile, generation, base) -> new BundleFileWrapper(bundleFile) { + @Override + public URL getResourceURL(String path, Module hostModule, int index) { + // just making sure the wrapper getResourceURL is never called + throw new RuntimeException("Should not be called"); + } + + @Override + protected URL createResourceURL(BundleEntry bundleEntry, Module hostModule, int index, + String path) { + final URL url = super.createResourceURL(bundleEntry, hostModule, index, path); + if (url == null) { + return null; + } + try { + return new URL("custom", "custom", 0, path, new URLStreamHandler() { + + @Override + protected URLConnection openConnection(URL u) throws IOException { + // TODO Auto-generated method stub + return url.openConnection(); + } + }); + } catch (MalformedURLException e) { + throw new RuntimeException(e); } - }); - } catch (MalformedURLException e) { - throw new RuntimeException(e); - } - } + } - }); + }); // And add no-op after hookRegistry.addBundleFileWrapperFactoryHook(noop); diff --git a/bundles/org.eclipse.osgi.tests/bundles_src/xfriends.test2/xfriends/test2/Activator.java b/bundles/org.eclipse.osgi.tests/bundles_src/xfriends.test2/xfriends/test2/Activator.java index adb15db666b..04e02a1331a 100644 --- a/bundles/org.eclipse.osgi.tests/bundles_src/xfriends.test2/xfriends/test2/Activator.java +++ b/bundles/org.eclipse.osgi.tests/bundles_src/xfriends.test2/xfriends/test2/Activator.java @@ -21,7 +21,8 @@ public class Activator implements BundleActivator { public void start(BundleContext context) throws Exception { try { - AbstractBundleTests.simpleResults.addEvent(Class.forName("xfriends.test1.onlyforfriends.TestFriends").getName()); //$NON-NLS-1$ + AbstractBundleTests.simpleResults + .addEvent(Class.forName("xfriends.test1.onlyforfriends.TestFriends").getName()); //$NON-NLS-1$ } catch (Throwable t) { AbstractBundleTests.simpleResults.addEvent(t); } diff --git a/bundles/org.eclipse.osgi.tests/bundles_src/xfriends.test3/xfriends/test3/Activator.java b/bundles/org.eclipse.osgi.tests/bundles_src/xfriends.test3/xfriends/test3/Activator.java index d86c50173d3..95633499a5f 100644 --- a/bundles/org.eclipse.osgi.tests/bundles_src/xfriends.test3/xfriends/test3/Activator.java +++ b/bundles/org.eclipse.osgi.tests/bundles_src/xfriends.test3/xfriends/test3/Activator.java @@ -21,7 +21,8 @@ public class Activator implements BundleActivator { public void start(BundleContext context) throws Exception { try { - AbstractBundleTests.simpleResults.addEvent(Class.forName("xfriends.test1.onlyforfriends.TestFriends").getName()); //$NON-NLS-1$ + AbstractBundleTests.simpleResults + .addEvent(Class.forName("xfriends.test1.onlyforfriends.TestFriends").getName()); //$NON-NLS-1$ } catch (Throwable t) { AbstractBundleTests.simpleResults.addEvent("success"); //$NON-NLS-1$ } diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/equinox/log/test/AllLogServiceTests.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/equinox/log/test/AllLogServiceTests.java index 966563ea28b..7afcd617d34 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/equinox/log/test/AllLogServiceTests.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/equinox/log/test/AllLogServiceTests.java @@ -15,9 +15,9 @@ @RunWith(Suite.class) @Suite.SuiteClasses({ // - LogServiceTest.class, // - LogReaderServiceTest.class, // - LogPermissionCollectionTest.class // - }) + LogServiceTest.class, // + LogReaderServiceTest.class, // + LogPermissionCollectionTest.class // +}) public class AllLogServiceTests { } diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/equinox/log/test/LogReaderServiceTest.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/equinox/log/test/LogReaderServiceTest.java index 8d6b98200b1..a99ebd9d6ad 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/equinox/log/test/LogReaderServiceTest.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/equinox/log/test/LogReaderServiceTest.java @@ -191,7 +191,8 @@ public void testLogServiceEventInfo() throws Exception { @Test public void testLogServiceEventDebug() throws Exception { - ServiceRegistration registration = OSGiTestsActivator.getContext().registerService(Object.class.getName(), new Object(), null); + ServiceRegistration registration = OSGiTestsActivator.getContext().registerService(Object.class.getName(), + new Object(), null); TestListener listener = new TestListener(); reader.addLogListener(listener); @@ -214,7 +215,7 @@ public void testLogFrameworkEvent() throws Exception { } }; reader.addLogListener(listener); - installer.refreshPackages(new Bundle[] {testBundle}); + installer.refreshPackages(new Bundle[] { testBundle }); countDown.await(5, TimeUnit.SECONDS); @@ -224,7 +225,8 @@ public void testLogFrameworkEvent() throws Exception { assertEquals("Wrong level.", LogLevel.INFO, entry.getLogLevel()); assertTrue("Wrong context: " + entry.getContext(), entry.getContext() instanceof FrameworkEvent); assertEquals("Wrong bundle.", getContext().getBundle(Constants.SYSTEM_BUNDLE_LOCATION), entry.getBundle()); - assertEquals("Wrong logger name.", "Events.Framework." + entry.getBundle().getSymbolicName(), entry.getLoggerName()); + assertEquals("Wrong logger name.", "Events.Framework." + entry.getBundle().getSymbolicName(), + entry.getLoggerName()); } @Test @@ -240,12 +242,15 @@ public void testLogFrameworkEventType() throws Exception { }; reader.addLogListener(listener); - //publishing an event with ERROR - b.adapt(Module.class).getContainer().getAdaptor().publishContainerEvent(ContainerEvent.ERROR, b.adapt(Module.class), new Exception()); - //publishing an event with WARNING - b.adapt(Module.class).getContainer().getAdaptor().publishContainerEvent(ContainerEvent.WARNING, b.adapt(Module.class), new Exception()); - //publishing an event with INFO - b.adapt(Module.class).getContainer().getAdaptor().publishContainerEvent(ContainerEvent.INFO, b.adapt(Module.class), new Exception()); + // publishing an event with ERROR + b.adapt(Module.class).getContainer().getAdaptor().publishContainerEvent(ContainerEvent.ERROR, + b.adapt(Module.class), new Exception()); + // publishing an event with WARNING + b.adapt(Module.class).getContainer().getAdaptor().publishContainerEvent(ContainerEvent.WARNING, + b.adapt(Module.class), new Exception()); + // publishing an event with INFO + b.adapt(Module.class).getContainer().getAdaptor().publishContainerEvent(ContainerEvent.INFO, + b.adapt(Module.class), new Exception()); countDown.await(2, TimeUnit.SECONDS); assertEquals("Wrong number of events", 3, events.size()); @@ -265,8 +270,10 @@ public void testLogHistory1() throws BundleException { equinox.start(); try { - LogService testLog = equinox.getBundleContext().getService(equinox.getBundleContext().getServiceReference(LogService.class)); - LogReaderService testReader = equinox.getBundleContext().getService(equinox.getBundleContext().getServiceReference(LogReaderService.class)); + LogService testLog = equinox.getBundleContext() + .getService(equinox.getBundleContext().getServiceReference(LogService.class)); + LogReaderService testReader = equinox.getBundleContext() + .getService(equinox.getBundleContext().getServiceReference(LogReaderService.class)); assertEquals("Expecting no logs.", 0, countLogEntries(testReader.getLog(), 0)); // log 9 things for (int i = 0; i < 9; i++) { @@ -299,8 +306,10 @@ public void testLogHistory2() throws BundleException { equinox.start(); try { - LogService testLog = equinox.getBundleContext().getService(equinox.getBundleContext().getServiceReference(LogService.class)); - LogReaderService testReader = equinox.getBundleContext().getService(equinox.getBundleContext().getServiceReference(LogReaderService.class)); + LogService testLog = equinox.getBundleContext() + .getService(equinox.getBundleContext().getServiceReference(LogService.class)); + LogReaderService testReader = equinox.getBundleContext() + .getService(equinox.getBundleContext().getServiceReference(LogReaderService.class)); assertEquals("Expecting no logs.", 0, countLogEntries(testReader.getLog(), 0)); // log 9 things for (int i = 0; i < 9; i++) { @@ -336,7 +345,8 @@ public void testLoggerContextSetLogLevelsWithBundleInstalledAndLogger() throws E bundle.start(); Logger logger = log.getLogger(bundle, loggerName, Logger.class); assertNotNull("Logger cannot be null", logger); - //Bundle is installed and a logger is associated with that bundle before setting the log level + // Bundle is installed and a logger is associated with that bundle before + // setting the log level setAndAssertLogLevel(bundle.getSymbolicName(), loggerName); TestListener listener = new TestListener(bundle.getLocation()); @@ -360,7 +370,8 @@ public void testLoggerContextSetLogLevelsWithBundleInstalledAndNoLogger() throws try { bundle = installer.installBundle("test.logging.a"); bundle.start(); - //Bundle is installed but a logger is not associated with the bundle before setting the log level + // Bundle is installed but a logger is not associated with the bundle before + // setting the log level setAndAssertLogLevel(bundle.getSymbolicName(), loggerName); Logger logger = log.getLogger(bundle, loggerName, Logger.class); assertNotNull("Logger cannot be null", logger); @@ -382,7 +393,8 @@ public void testLoggerContextSetLogLevelsWithBundleInstalledAndNoLogger() throws public void testLoggerContextSetLogLevelsWithoutBundleAndLogger() throws Exception { Bundle bundle = null; String loggerName = "test.logger"; - //Bundle is not installed and also the logger is not associated with the bundle before setting the log level + // Bundle is not installed and also the logger is not associated with the bundle + // before setting the log level setAndAssertLogLevel("test.logging.a", loggerName); try { bundle = installer.installBundle("test.logging.a"); @@ -412,7 +424,8 @@ private void setAndAssertLogLevel(String loggerContextName, String loggerName) { assertEquals("Wrong effective level", LogLevel.TRACE, loggerContext.getEffectiveLogLevel(loggerName)); } - private void doLogging(Bundle bundle, Logger logger, TestListener listener, LogLevel logLevel, String message) throws Exception { + private void doLogging(Bundle bundle, Logger logger, TestListener listener, LogLevel logLevel, String message) + throws Exception { logToLogger(logger, message, logLevel); ExtendedLogEntry logEntry = listener.getEntryX(); assertEquals("Wrong message logged", message, logEntry.getMessage()); @@ -423,26 +436,26 @@ private void doLogging(Bundle bundle, Logger logger, TestListener listener, LogL private void logToLogger(Logger logger, String message, LogLevel logLevel) { switch (logLevel) { - case AUDIT : - logger.audit(message); - break; - case ERROR : - logger.error(message); - break; - case WARN : - logger.warn(message); - break; - case INFO : - logger.info(message); - break; - case DEBUG : - logger.debug(message); - break; - case TRACE : - logger.trace(message); - break; - default : - fail("Unknown Log level"); + case AUDIT: + logger.audit(message); + break; + case ERROR: + logger.error(message); + break; + case WARN: + logger.warn(message); + break; + case INFO: + logger.info(message); + break; + case DEBUG: + logger.debug(message); + break; + case TRACE: + logger.trace(message); + break; + default: + fail("Unknown Log level"); } } @@ -478,7 +491,8 @@ public void testBundleEventsLogged() throws Exception { } - private void assertBundleEventLog(String message, Bundle bundle, TestListener listener) throws InterruptedException { + private void assertBundleEventLog(String message, Bundle bundle, TestListener listener) + throws InterruptedException { LogEntry logEntry = listener.getEntryX(); assertEquals("Wrong message.", message, logEntry.getMessage()); assertEquals("Wrong bundle.", bundle, logEntry.getBundle()); diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/AutomatedTests.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/AutomatedTests.java index 6d9ecf87fbe..181d6e689b7 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/AutomatedTests.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/AutomatedTests.java @@ -17,8 +17,7 @@ import org.junit.runners.Suite; @RunWith(Suite.class) -@Suite.SuiteClasses({ - org.eclipse.osgi.tests.container.AllTests.class, // +@Suite.SuiteClasses({ org.eclipse.osgi.tests.container.AllTests.class, // org.eclipse.osgi.tests.hooks.framework.AllFrameworkHookTests.class, // org.eclipse.osgi.tests.internal.plugins.InstallTests.class, // org.eclipse.osgi.tests.eclipseadaptor.AllTests.class, // @@ -39,7 +38,6 @@ org.eclipse.osgi.tests.permissions.AllTests.class, // org.eclipse.osgi.tests.securityadmin.AllSecurityAdminTests.class, // org.eclipse.osgi.tests.resource.AllTests.class, // - org.eclipse.osgi.tests.url.AllTests.class - }) + org.eclipse.osgi.tests.url.AllTests.class }) public class AutomatedTests { } diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/appadmin/ApplicationAdminTest.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/appadmin/ApplicationAdminTest.java index 20255da3411..9e4d3f02710 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/appadmin/ApplicationAdminTest.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/appadmin/ApplicationAdminTest.java @@ -45,12 +45,21 @@ public class ApplicationAdminTest extends OSGiTest { public static final String MODIFIED = "modified"; //$NON-NLS-1$ public static final String REMOVED = "removed"; //$NON-NLS-1$ public static final String simpleResults = "test.simpleResults"; //$NON-NLS-1$ - public static final String[] tests = new String[] {"testSimpleApp", "testInvalidArgs", "testAsyncValue01", "testAsyncValue02", "testAsyncValue03", "testAsyncValue04", "testAsyncValue05", "testAsyncValue06", "testExitValue01", "testExitValue02", "testExitValue03", "testExitValue04", "testExitValue05", "testExitValue06", "testExitValue07", "testExitValue08", "testExitValue09", "testExitValue10", "testGlobalSingleton", "testCardinality01", "testCardinality02", "testMainThreaded01", "testMainThreaded02", "testHandleEvents01", "testDescriptorEvents01", "testPersistentLock01", "testPersistentLock02", "testPersistentLock03", "testPersistentSchedule01", "testPersistentSchedule02", "testPersistentSchedule03", "testPersistentSchedule04", "testPersistentSchedule05", "testPersistentSchedule06", //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$//$NON-NLS-5$//$NON-NLS-6$//$NON-NLS-7$//$NON-NLS-8$//$NON-NLS-9$//$NON-NLS-10$//$NON-NLS-11$//$NON-NLS-12$//$NON-NLS-13$//$NON-NLS-14$//$NON-NLS-15$//$NON-NLS-16$//$NON-NLS-17$//$NON-NLS-18$//$NON-NLS-19$//$NON-NLS-20$//$NON-NLS-21$//$NON-NLS-22$//$NON-NLS-23$//$NON-NLS-24$//$NON-NLS-25$//$NON-NLS-26$//$NON-NLS-27$//$NON-NLS-28$//$NON-NLS-29$ - "testPersistentSchedule07", "testPersistentSchedule08", "testFailedApplication01", "testDestroyBeforeStart01", "testDestroyBeforeStart02"}; + public static final String[] tests = new String[] { "testSimpleApp", "testInvalidArgs", "testAsyncValue01", //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$ + "testAsyncValue02", "testAsyncValue03", "testAsyncValue04", "testAsyncValue05", "testAsyncValue06", //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$//$NON-NLS-5$ + "testExitValue01", "testExitValue02", "testExitValue03", "testExitValue04", "testExitValue05", //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$//$NON-NLS-5$ + "testExitValue06", "testExitValue07", "testExitValue08", "testExitValue09", "testExitValue10", //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$//$NON-NLS-5$ + "testGlobalSingleton", "testCardinality01", "testCardinality02", "testMainThreaded01", "testMainThreaded02", //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$//$NON-NLS-5$ + "testHandleEvents01", "testDescriptorEvents01", "testPersistentLock01", "testPersistentLock02", //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$ + "testPersistentLock03", "testPersistentSchedule01", "testPersistentSchedule02", "testPersistentSchedule03", //$NON-NLS-1$//$NON-NLS-2$ + "testPersistentSchedule04", "testPersistentSchedule05", "testPersistentSchedule06", "testPersistentSchedule07", "testPersistentSchedule08", "testFailedApplication01", + "testDestroyBeforeStart01", "testDestroyBeforeStart02" }; + public static Test suite() { TestSuite suite = new TestSuite(ApplicationAdminTest.class.getName()); - ConfigurationSessionTestSuite appAdminSessionTest = new ConfigurationSessionTestSuite(PI_OSGI_TESTS, ApplicationAdminTest.class.getName()); + ConfigurationSessionTestSuite appAdminSessionTest = new ConfigurationSessionTestSuite(PI_OSGI_TESTS, + ApplicationAdminTest.class.getName()); addRequiredOSGiTestsBundles(appAdminSessionTest); appAdminSessionTest.setApplicationId(testRunnerApp); @@ -77,7 +86,8 @@ private ApplicationDescriptor getApplication(String appName) { assertNotNull("BundleContext is null!!", context); //$NON-NLS-1$ Class appDescClass = ApplicationDescriptor.class; assertNotNull("ApplicationDescriptor.class is null!!", appDescClass); //$NON-NLS-1$ - ServiceReference[] refs = context.getServiceReferences(appDescClass.getName(), "(" + ApplicationDescriptor.APPLICATION_PID + "=" + appName + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + ServiceReference[] refs = context.getServiceReferences(appDescClass.getName(), + "(" + ApplicationDescriptor.APPLICATION_PID + "=" + appName + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ if (refs == null || refs.length == 0) { refs = getContext().getServiceReferences(ApplicationDescriptor.class.getName(), null); String availableApps = ""; //$NON-NLS-1$ @@ -122,7 +132,8 @@ public void testSimpleApp() { assertEquals("Check application result", SUCCESS, result); //$NON-NLS-1$ } - private void doInvalidScheduleArgs(ApplicationDescriptor app, String id, Map invalidArgs, String topic, String eventFilter, boolean recurring, boolean invalidKeys, boolean invalidValues) { + private void doInvalidScheduleArgs(ApplicationDescriptor app, String id, Map invalidArgs, String topic, + String eventFilter, boolean recurring, boolean invalidKeys, boolean invalidValues) { ScheduledApplication sched = null; try { sched = app.schedule(id, invalidArgs, topic, eventFilter, recurring); @@ -152,18 +163,22 @@ public void testInvalidArgs() { args.put("test.arg1", Boolean.TRUE); //$NON-NLS-1$ args.put("test.arg2", Integer.valueOf(34)); //$NON-NLS-1$ args.put("test.arg3", Long.valueOf(34)); //$NON-NLS-1$ - doInvalidScheduleArgs(app, "schedule.testargs", args, "org/osgi/application/timer", "(minute=*)", true, false, false); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + doInvalidScheduleArgs(app, "schedule.testargs", args, "org/osgi/application/timer", "(minute=*)", true, false, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + false); args.put("test.arg4", this); //$NON-NLS-1$ - doInvalidScheduleArgs(app, "schedule.testargs", args, "org/osgi/application/timer", "(minute=*)", true, false, true); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + doInvalidScheduleArgs(app, "schedule.testargs", args, "org/osgi/application/timer", "(minute=*)", true, false, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + true); Collection list = new ArrayList(); args.put("test.arg4", list); //$NON-NLS-1$ - doInvalidScheduleArgs(app, "schedule.testargs", args, "org/osgi/application/timer", "(minute=*)", true, false, false); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + doInvalidScheduleArgs(app, "schedule.testargs", args, "org/osgi/application/timer", "(minute=*)", true, false, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + false); list.add(this); args.put("test.arg4", list); //$NON-NLS-1$ - doInvalidScheduleArgs(app, "schedule.testargs", args, "org/osgi/application/timer", "(minute=*)", true, false, true); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + doInvalidScheduleArgs(app, "schedule.testargs", args, "org/osgi/application/timer", "(minute=*)", true, false, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + true); list.clear(); list.add("test"); //$NON-NLS-1$ @@ -175,7 +190,8 @@ public void testInvalidArgs() { list.add(Short.valueOf((short) 1)); list.add(Character.valueOf((char) 0)); list.add(Boolean.TRUE); - doInvalidScheduleArgs(app, "schedule.testargs", args, "org/osgi/application/timer", "(minute=*)", true, false, false); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + doInvalidScheduleArgs(app, "schedule.testargs", args, "org/osgi/application/timer", "(minute=*)", true, false, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + false); args.put("test.arg5", new String[0]); //$NON-NLS-1$ args.put("test.arg6", new int[0]); //$NON-NLS-1$ @@ -186,7 +202,8 @@ public void testInvalidArgs() { args.put("test.arg11", new short[0]); //$NON-NLS-1$ args.put("test.arg12", new char[0]); //$NON-NLS-1$ args.put("test.arg12", new boolean[0]); //$NON-NLS-1$ - doInvalidScheduleArgs(app, "schedule.testargs", args, "org/osgi/application/timer", "(minute=*)", true, false, false); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + doInvalidScheduleArgs(app, "schedule.testargs", args, "org/osgi/application/timer", "(minute=*)", true, false, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + false); args.put("test.arg13", "test"); //$NON-NLS-1$ //$NON-NLS-2$ args.put("test.arg14", Integer.valueOf(0)); //$NON-NLS-1$ @@ -197,15 +214,18 @@ public void testInvalidArgs() { args.put("test.arg19", Short.valueOf((short) 1)); //$NON-NLS-1$ args.put("test.arg20", Character.valueOf((char) 0)); //$NON-NLS-1$ args.put("test.arg21", Boolean.TRUE); //$NON-NLS-1$ - doInvalidScheduleArgs(app, "schedule.testargs", args, "org/osgi/application/timer", "(minute=*)", true, false, false); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + doInvalidScheduleArgs(app, "schedule.testargs", args, "org/osgi/application/timer", "(minute=*)", true, false, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + false); Map testMap = new HashMap(); args.put("test.arg22", testMap); //$NON-NLS-1$ - doInvalidScheduleArgs(app, "schedule.testargs", args, "org/osgi/application/timer", "(minute=*)", true, false, true); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + doInvalidScheduleArgs(app, "schedule.testargs", args, "org/osgi/application/timer", "(minute=*)", true, false, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + true); args.clear(); args.put(Long.valueOf(0), "test"); //$NON-NLS-1$ - doInvalidScheduleArgs(app, "schedule.testargs", args, "org/osgi/application/timer", "(minute=*)", true, true, false); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + doInvalidScheduleArgs(app, "schedule.testargs", args, "org/osgi/application/timer", "(minute=*)", true, true, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + false); } public void testExitValue01() { @@ -229,7 +249,8 @@ public void testExitValue01() { } public void testExitValue02() { - // getExitValue test when called from a service listener during service unregistration + // getExitValue test when called from a service listener during service + // unregistration ApplicationDescriptor app = getApplication(PI_OSGI_TESTS + ".exitValueApp"); //$NON-NLS-1$ final Object[] result = new Object[1]; ServiceTrackerCustomizer trackerCustomizer = new ServiceTrackerCustomizer() { @@ -251,7 +272,10 @@ public void removedService(ServiceReference reference, Object service) { }; ServiceTracker tracker = null; try { - tracker = new ServiceTracker(getContext(), FrameworkUtil.createFilter("(&(objectClass=" + ApplicationHandle.class.getName() + ")(" + ApplicationHandle.APPLICATION_DESCRIPTOR + "=" + app.getApplicationId() + "))"), trackerCustomizer); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ + tracker = new ServiceTracker(getContext(), + FrameworkUtil.createFilter("(&(objectClass=" + ApplicationHandle.class.getName() + ")(" //$NON-NLS-1$ //$NON-NLS-2$ + + ApplicationHandle.APPLICATION_DESCRIPTOR + "=" + app.getApplicationId() + "))"), //$NON-NLS-1$ //$NON-NLS-2$ + trackerCustomizer); } catch (InvalidSyntaxException e) { fail("unexpected syntax exception for tracker", e); //$NON-NLS-1$ } @@ -275,7 +299,8 @@ public void removedService(ServiceReference reference, Object service) { } public void testExitValue03() { - // getExitValue test when called from a service listener during service property modified (STOPPING) + // getExitValue test when called from a service listener during service property + // modified (STOPPING) ApplicationDescriptor app = getApplication(PI_OSGI_TESTS + ".exitValueApp"); //$NON-NLS-1$ final Object[] result = new Object[1]; ServiceTrackerCustomizer trackerCustomizer = new ServiceTrackerCustomizer() { @@ -284,7 +309,8 @@ public Object addingService(ServiceReference reference) { } public void modifiedService(ServiceReference reference, Object service) { - if (!"org.eclipse.equinox.app.stopped".equals(reference.getProperty(ApplicationHandle.APPLICATION_STATE))) //$NON-NLS-1$ + if (!"org.eclipse.equinox.app.stopped" //$NON-NLS-1$ + .equals(reference.getProperty(ApplicationHandle.APPLICATION_STATE))) return; try { result[0] = ((ApplicationHandle) service).getExitValue(10000); @@ -299,7 +325,10 @@ public void removedService(ServiceReference reference, Object service) { }; ServiceTracker tracker = null; try { - tracker = new ServiceTracker(getContext(), FrameworkUtil.createFilter("(&(objectClass=" + ApplicationHandle.class.getName() + ")(" + ApplicationHandle.APPLICATION_DESCRIPTOR + "=" + app.getApplicationId() + "))"), trackerCustomizer); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ + tracker = new ServiceTracker(getContext(), + FrameworkUtil.createFilter("(&(objectClass=" + ApplicationHandle.class.getName() + ")(" //$NON-NLS-1$ //$NON-NLS-2$ + + ApplicationHandle.APPLICATION_DESCRIPTOR + "=" + app.getApplicationId() + "))"), //$NON-NLS-1$ //$NON-NLS-2$ + trackerCustomizer); } catch (InvalidSyntaxException e) { fail("unexpected syntax exception for tracker", e); //$NON-NLS-1$ } @@ -374,7 +403,8 @@ public void testExitValue05() { } public void testExitValue06() { - // getExitValue test; expecting an ApplicationException because the exit value is not available + // getExitValue test; expecting an ApplicationException because the exit value + // is not available ApplicationDescriptor app = getApplication(PI_OSGI_TESTS + ".exitValueApp"); //$NON-NLS-1$ ApplicationHandle handle = null; try { @@ -387,14 +417,15 @@ public void testExitValue06() { handle.getExitValue(100); fail("Expected an ApplicationException for exit value not available"); //$NON-NLS-1$ } catch (ApplicationException e) { - assertEquals("Unexpected error type", ApplicationException.APPLICATION_EXITVALUE_NOT_AVAILABLE, e.getErrorCode()); //$NON-NLS-1$ + assertEquals("Unexpected error type", ApplicationException.APPLICATION_EXITVALUE_NOT_AVAILABLE, //$NON-NLS-1$ + e.getErrorCode()); } catch (InterruptedException e) { fail("Unexpected interrupted exception waiting for exit value", e); //$NON-NLS-1$ } } public void testExitValue07() { - //getExitValue test; called with timeout 0 + // getExitValue test; called with timeout 0 ApplicationDescriptor app = getApplication(PI_OSGI_TESTS + ".exitValueApp"); //$NON-NLS-1$ ApplicationHandle handle = null; try { @@ -417,7 +448,7 @@ public void testExitValue07() { } public void testExitValue08() { - //getExitValue test; called with timeout -1 + // getExitValue test; called with timeout -1 ApplicationDescriptor app = getApplication(PI_OSGI_TESTS + ".exitValueApp"); //$NON-NLS-1$ ApplicationHandle handle = null; try { @@ -432,14 +463,15 @@ public void testExitValue08() { handle.getExitValue(-1); fail("Expected an ApplicationException for exit value not available"); //$NON-NLS-1$ } catch (ApplicationException e) { - assertEquals("Unexpected error type", ApplicationException.APPLICATION_EXITVALUE_NOT_AVAILABLE, e.getErrorCode()); //$NON-NLS-1$ + assertEquals("Unexpected error type", ApplicationException.APPLICATION_EXITVALUE_NOT_AVAILABLE, //$NON-NLS-1$ + e.getErrorCode()); } catch (InterruptedException e) { fail("Unexpected interrupted exception waiting for exit value", e); //$NON-NLS-1$ } } public void testExitValue09() { - //getExitValue test; application returns null + // getExitValue test; application returns null ApplicationDescriptor app = getApplication(PI_OSGI_TESTS + ".exitValueApp"); //$NON-NLS-1$ ApplicationHandle handle = null; @@ -462,7 +494,7 @@ public void testExitValue09() { } public void testExitValue10() { - //getExitValue test; called with timeout 0 after the result is available + // getExitValue test; called with timeout 0 after the result is available ApplicationDescriptor app = getApplication(PI_OSGI_TESTS + ".exitValueApp"); //$NON-NLS-1$ ApplicationHandle handle = null; try { @@ -484,7 +516,8 @@ public void testExitValue10() { assertEquals("exit value is incorrect", ExitValueApp.exitValue, value); //$NON-NLS-1$ try { - // app exited now get the result with -1 timeout; we know the value is ready from above + // app exited now get the result with -1 timeout; we know the value is ready + // from above value = (String) handle.getExitValue(-1); } catch (Exception e) { fail("unexpected exception waiting for exit value", e); //$NON-NLS-1$ @@ -494,7 +527,7 @@ public void testExitValue10() { } public void testAsyncValue01() { - //setValue test; called with timeout 0 after the result is available + // setValue test; called with timeout 0 after the result is available ApplicationDescriptor app = getApplication(PI_OSGI_TESTS + ".exitValueApp"); //$NON-NLS-1$ Map args = new HashMap(); args.put(ExitValueApp.returnAsyncResult, Boolean.TRUE); @@ -518,7 +551,8 @@ public void testAsyncValue01() { assertEquals("exit value is incorrect", ExitValueApp.exitValue, value); //$NON-NLS-1$ try { - // app exited now get the result with -1 timeout; we know the value is ready from above + // app exited now get the result with -1 timeout; we know the value is ready + // from above value = (String) handle.getExitValue(-1); } catch (Exception e) { fail("unexpected exception waiting for exit value", e); //$NON-NLS-1$ @@ -528,7 +562,7 @@ public void testAsyncValue01() { } public void testAsyncValue02() { - //setValue test; called with timeout -1 + // setValue test; called with timeout -1 ApplicationDescriptor app = getApplication(PI_OSGI_TESTS + ".exitValueApp"); //$NON-NLS-1$ ApplicationHandle handle = null; Map args = new HashMap(); @@ -545,14 +579,15 @@ public void testAsyncValue02() { handle.getExitValue(-1); fail("Expected an ApplicationException for exit value not available"); //$NON-NLS-1$ } catch (ApplicationException e) { - assertEquals("Unexpected error type", ApplicationException.APPLICATION_EXITVALUE_NOT_AVAILABLE, e.getErrorCode()); //$NON-NLS-1$ + assertEquals("Unexpected error type", ApplicationException.APPLICATION_EXITVALUE_NOT_AVAILABLE, //$NON-NLS-1$ + e.getErrorCode()); } catch (InterruptedException e) { fail("Unexpected interrupted exception waiting for exit value", e); //$NON-NLS-1$ } } public void testAsyncValue03() { - //setValue test; application returns null + // setValue test; application returns null ApplicationDescriptor app = getApplication(PI_OSGI_TESTS + ".exitValueApp"); //$NON-NLS-1$ ApplicationHandle handle = null; @@ -686,7 +721,8 @@ private void doTestCardinality01(String appID, int cardinality, boolean hasMax) ((ApplicationHandle) element).destroy(); } } - assertEquals("Did not launch the correct # of concurrent instances", instances.size(), cardinality + (hasMax ? 0 : 1)); //$NON-NLS-1$ + assertEquals("Did not launch the correct # of concurrent instances", instances.size(), //$NON-NLS-1$ + cardinality + (hasMax ? 0 : 1)); } public void testCardinality01() { @@ -726,7 +762,10 @@ public void testMainThreaded02() { public void testHandleEvents01() throws InvalidSyntaxException { ApplicationDescriptor app = getApplication(PI_OSGI_TESTS + ".simpleApp"); //$NON-NLS-1$ ApplicationHandleTracker handleTracker = new ApplicationHandleTracker(getContext()); - ServiceTracker tracker = new ServiceTracker(getContext(), FrameworkUtil.createFilter("(&(objectClass=" + ApplicationHandle.class.getName() + ")(" + ApplicationHandle.APPLICATION_DESCRIPTOR + "=" + app.getApplicationId() + "))"), handleTracker); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ + ServiceTracker tracker = new ServiceTracker(getContext(), + FrameworkUtil.createFilter("(&(objectClass=" + ApplicationHandle.class.getName() + ")(" //$NON-NLS-1$ //$NON-NLS-2$ + + ApplicationHandle.APPLICATION_DESCRIPTOR + "=" + app.getApplicationId() + "))"), //$NON-NLS-1$ //$NON-NLS-2$ + handleTracker); tracker.open(); try { ApplicationHandle handle = app.launch(null); @@ -734,7 +773,12 @@ public void testHandleEvents01() throws InvalidSyntaxException { handle.destroy(); handleTracker.waitForEvent(handle.getInstanceId(), REMOVED); String[][] events = handleTracker.getEvents(); - String[][] expected = new String[][] {new String[] {handle.getInstanceId(), "org.eclipse.equinox.app.starting"}, new String[] {handle.getInstanceId(), ApplicationHandle.RUNNING}, new String[] {handle.getInstanceId(), ApplicationHandle.STOPPING}, new String[] {handle.getInstanceId(), "org.eclipse.equinox.app.stopped"}, new String[] {handle.getInstanceId(), "removed"}}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + String[][] expected = new String[][] { + new String[] { handle.getInstanceId(), "org.eclipse.equinox.app.starting" }, //$NON-NLS-1$ + new String[] { handle.getInstanceId(), ApplicationHandle.RUNNING }, + new String[] { handle.getInstanceId(), ApplicationHandle.STOPPING }, + new String[] { handle.getInstanceId(), "org.eclipse.equinox.app.stopped" }, //$NON-NLS-1$ + new String[] { handle.getInstanceId(), "removed" } }; //$NON-NLS-1$ assertEquals("Check expected # events", expected.length, events.length); //$NON-NLS-1$ for (int i = 0; i < events.length; i++) { assertEquals("Check expected event id for #" + i, expected[i][0], events[i][0]); //$NON-NLS-1$ @@ -750,17 +794,22 @@ public void testHandleEvents01() throws InvalidSyntaxException { public void testDescriptorEvents01() throws InvalidSyntaxException, BundleException { BundleInstaller bundleInstaller = null; try { - bundleInstaller = new BundleInstaller(OSGiTestsActivator.TEST_FILES_ROOT + "internal/plugins/appAdminTests", getContext()); //$NON-NLS-1$ + bundleInstaller = new BundleInstaller(OSGiTestsActivator.TEST_FILES_ROOT + "internal/plugins/appAdminTests", //$NON-NLS-1$ + getContext()); } catch (InvalidSyntaxException e) { fail("Failed to create bundle installer", e); //$NON-NLS-1$ } String testAppPID = "appadmin.test01.simpleApp"; //$NON-NLS-1$ ApplicationDescriptorTracker descriptionTracker = new ApplicationDescriptorTracker(getContext()); - ServiceTracker tracker = new ServiceTracker(getContext(), FrameworkUtil.createFilter("(&(objectClass=" + ApplicationDescriptor.class.getName() + ")(" + ApplicationDescriptor.APPLICATION_PID + "=" + testAppPID + "))"), descriptionTracker); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ + ServiceTracker tracker = new ServiceTracker(getContext(), + FrameworkUtil.createFilter("(&(objectClass=" + ApplicationDescriptor.class.getName() + ")(" //$NON-NLS-1$ //$NON-NLS-2$ + + ApplicationDescriptor.APPLICATION_PID + "=" + testAppPID + "))"), //$NON-NLS-1$ //$NON-NLS-2$ + descriptionTracker); tracker.open(); try { Bundle test01 = bundleInstaller.installBundle("appadmin.test01"); //$NON-NLS-1$ - assertTrue("Check if test bundle is resolved: " + test01.getSymbolicName(), bundleInstaller.resolveBundles(new Bundle[] {test01})); //$NON-NLS-1$ + assertTrue("Check if test bundle is resolved: " + test01.getSymbolicName(), //$NON-NLS-1$ + bundleInstaller.resolveBundles(new Bundle[] { test01 })); descriptionTracker.waitForEvent(testAppPID, ADDED, Boolean.FALSE, Boolean.TRUE); ApplicationDescriptor app = getApplication(testAppPID); app.lock(); @@ -835,7 +884,11 @@ public void testPersistentSchedule01() { public void testPersistentSchedule02() throws InvalidSyntaxException { ScheduledApplication scheduledApp = getScheduleApplication("schedule.1", true); //$NON-NLS-1$ ApplicationHandleTracker handleTracker = new ApplicationHandleTracker(getContext()); - ServiceTracker tracker = new ServiceTracker(getContext(), FrameworkUtil.createFilter("(&(objectClass=" + ApplicationHandle.class.getName() + ")(" + ApplicationHandle.APPLICATION_DESCRIPTOR + "=" + scheduledApp.getApplicationDescriptor().getApplicationId() + "))"), handleTracker); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ + ServiceTracker tracker = new ServiceTracker(getContext(), + FrameworkUtil.createFilter("(&(objectClass=" + ApplicationHandle.class.getName() + ")(" //$NON-NLS-1$ //$NON-NLS-2$ + + ApplicationHandle.APPLICATION_DESCRIPTOR + "=" //$NON-NLS-1$ + + scheduledApp.getApplicationDescriptor().getApplicationId() + "))"), //$NON-NLS-1$ + handleTracker); tracker.open(); try { ApplicationHandle handle = (ApplicationHandle) tracker.waitForService(61000); @@ -893,7 +946,11 @@ public void testPersistentSchedule04() { public void testPersistentSchedule05() throws InvalidSyntaxException { ScheduledApplication scheduledApp = getScheduleApplication("schedule.2", true); //$NON-NLS-1$ ApplicationHandleTracker handleTracker = new ApplicationHandleTracker(getContext()); - ServiceTracker tracker = new ServiceTracker(getContext(), FrameworkUtil.createFilter("(&(objectClass=" + ApplicationHandle.class.getName() + ")(" + ApplicationHandle.APPLICATION_DESCRIPTOR + "=" + scheduledApp.getApplicationDescriptor().getApplicationId() + "))"), handleTracker); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ + ServiceTracker tracker = new ServiceTracker(getContext(), + FrameworkUtil.createFilter("(&(objectClass=" + ApplicationHandle.class.getName() + ")(" //$NON-NLS-1$ //$NON-NLS-2$ + + ApplicationHandle.APPLICATION_DESCRIPTOR + "=" //$NON-NLS-1$ + + scheduledApp.getApplicationDescriptor().getApplicationId() + "))"), //$NON-NLS-1$ + handleTracker); tracker.open(); ApplicationHandle badHandle = null; try { @@ -922,11 +979,13 @@ public void testPersistentSchedule05() throws InvalidSyntaxException { assertEquals("key: " + entry.getKey(), entry.getValue(), results.get(entry.getKey())); //$NON-NLS-1$ } // should not find the scheduled app anymore - // sleeping here to allow for the scheduled app to disappear; could use service events instead + // sleeping here to allow for the scheduled app to disappear; could use service + // events instead Thread.sleep(1000); scheduledApp = getScheduleApplication("schedule.2", false); //$NON-NLS-1$ if (scheduledApp != null) { - // TODO disabling the failure here. Just print the error message for now (bug 372848) + // TODO disabling the failure here. Just print the error message for now (bug + // 372848) System.out.println("Scheduled application should not be found: " + scheduledApp.getScheduleId()); //$NON-NLS-1$ // try sleeping some more to see if it helps Thread.sleep(5000); @@ -974,7 +1033,8 @@ public void testPersistentSchedule07() { public void testPersistentSchedule08() { ScheduledApplication scheduledApp = getScheduleApplication("schedule.duplicate1", true); //$NON-NLS-1$ try { - scheduledApp.getApplicationDescriptor().schedule("schedule.duplicate1", null, "org/osgi/application/timer", "(minute=*)", true); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + scheduledApp.getApplicationDescriptor().schedule("schedule.duplicate1", null, "org/osgi/application/timer", //$NON-NLS-1$ //$NON-NLS-2$ + "(minute=*)", true); //$NON-NLS-1$ fail("should not be able to create a duplicate scheduled application id"); //$NON-NLS-1$ } catch (InvalidSyntaxException e) { fail("Failed to schedule an application", e); //$NON-NLS-1$ @@ -988,13 +1048,20 @@ public void testPersistentSchedule08() { public void testFailedApplication01() throws InvalidSyntaxException { ApplicationDescriptor app = getApplication(PI_OSGI_TESTS + ".failedApp"); //$NON-NLS-1$ ApplicationHandleTracker handleTracker = new ApplicationHandleTracker(getContext()); - ServiceTracker tracker = new ServiceTracker(getContext(), FrameworkUtil.createFilter("(&(objectClass=" + ApplicationHandle.class.getName() + ")(" + ApplicationHandle.APPLICATION_DESCRIPTOR + "=" + app.getApplicationId() + "))"), handleTracker); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ + ServiceTracker tracker = new ServiceTracker(getContext(), + FrameworkUtil.createFilter("(&(objectClass=" + ApplicationHandle.class.getName() + ")(" //$NON-NLS-1$ //$NON-NLS-2$ + + ApplicationHandle.APPLICATION_DESCRIPTOR + "=" + app.getApplicationId() + "))"), //$NON-NLS-1$ //$NON-NLS-2$ + handleTracker); tracker.open(); try { ApplicationHandle handle = app.launch(null); handleTracker.waitForEvent(handle.getInstanceId(), REMOVED); String[][] events = handleTracker.getEvents(); - String[][] expected = new String[][] {new String[] {handle.getInstanceId(), "org.eclipse.equinox.app.starting"}, new String[] {handle.getInstanceId(), ApplicationHandle.STOPPING}, new String[] {handle.getInstanceId(), "org.eclipse.equinox.app.stopped"}, new String[] {handle.getInstanceId(), "removed"}}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + String[][] expected = new String[][] { + new String[] { handle.getInstanceId(), "org.eclipse.equinox.app.starting" }, //$NON-NLS-1$ + new String[] { handle.getInstanceId(), ApplicationHandle.STOPPING }, + new String[] { handle.getInstanceId(), "org.eclipse.equinox.app.stopped" }, //$NON-NLS-1$ + new String[] { handle.getInstanceId(), "removed" } }; //$NON-NLS-1$ assertEquals("Check expected # events", expected.length, events.length); //$NON-NLS-1$ for (int i = 0; i < events.length; i++) { assertEquals("Check expected event id for #" + i, expected[i][0], events[i][0]); //$NON-NLS-1$ @@ -1026,7 +1093,10 @@ public void removedService(ServiceReference reference, Object service) { // nothing } }; - ServiceTracker tracker = new ServiceTracker(getContext(), FrameworkUtil.createFilter("(&(objectClass=" + ApplicationHandle.class.getName() + ")(" + ApplicationHandle.APPLICATION_DESCRIPTOR + "=" + app.getApplicationId() + "))"), trackerCustomizer); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ + ServiceTracker tracker = new ServiceTracker(getContext(), + FrameworkUtil.createFilter("(&(objectClass=" + ApplicationHandle.class.getName() + ")(" //$NON-NLS-1$ //$NON-NLS-2$ + + ApplicationHandle.APPLICATION_DESCRIPTOR + "=" + app.getApplicationId() + "))"), //$NON-NLS-1$ //$NON-NLS-2$ + trackerCustomizer); tracker.open(); try { ApplicationHandle handle = app.launch(args); @@ -1059,7 +1129,10 @@ public void removedService(ServiceReference reference, Object service) { // nothing } }; - ServiceTracker tracker = new ServiceTracker(getContext(), FrameworkUtil.createFilter("(&(objectClass=" + ApplicationHandle.class.getName() + ")(" + ApplicationHandle.APPLICATION_DESCRIPTOR + "=" + app.getApplicationId() + "))"), trackerCustomizer); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ + ServiceTracker tracker = new ServiceTracker(getContext(), + FrameworkUtil.createFilter("(&(objectClass=" + ApplicationHandle.class.getName() + ")(" //$NON-NLS-1$ //$NON-NLS-2$ + + ApplicationHandle.APPLICATION_DESCRIPTOR + "=" + app.getApplicationId() + "))"), //$NON-NLS-1$ //$NON-NLS-2$ + trackerCustomizer); tracker.open(); try { ApplicationHandle handle = app.launch(args); @@ -1079,7 +1152,8 @@ private ScheduledApplication getScheduleApplication(String scheduleID, boolean f assertNotNull("BundleContext is null!!", context); //$NON-NLS-1$ Class schedAppClass = ScheduledApplication.class; assertNotNull("ScheduledApplication.class is null!!", schedAppClass); //$NON-NLS-1$ - ServiceReference[] refs = getContext().getServiceReferences(schedAppClass.getName(), "(" + ScheduledApplication.SCHEDULE_ID + "=" + scheduleID + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + ServiceReference[] refs = getContext().getServiceReferences(schedAppClass.getName(), + "(" + ScheduledApplication.SCHEDULE_ID + "=" + scheduleID + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ if (refs == null || refs.length == 0) { if (!failOnMissing) return null; @@ -1117,7 +1191,7 @@ public ApplicationHandleTracker(BundleContext bc) { public synchronized Object addingService(ServiceReference reference) { String instance = (String) reference.getProperty(ApplicationHandle.APPLICATION_PID); String state = (String) reference.getProperty(ApplicationHandle.APPLICATION_STATE); - events.add(new String[] {instance, state}); + events.add(new String[] { instance, state }); Object result = bc.getService(reference); notifyAll(); return result; @@ -1126,17 +1200,18 @@ public synchronized Object addingService(ServiceReference reference) { public synchronized void modifiedService(ServiceReference reference, Object service) { String instance = (String) reference.getProperty(ApplicationHandle.APPLICATION_PID); String state = (String) reference.getProperty(ApplicationHandle.APPLICATION_STATE); - events.add(new String[] {instance, state}); + events.add(new String[] { instance, state }); notifyAll(); } public synchronized void removedService(ServiceReference reference, Object service) { String instance = (String) reference.getProperty(ApplicationHandle.APPLICATION_PID); - events.add(new String[] {instance, REMOVED}); + events.add(new String[] { instance, REMOVED }); notifyAll(); } - // Note that this method assumes you call it before the event actually gets posted. + // Note that this method assumes you call it before the event actually gets + // posted. // It only looks at the last event that was saved. public synchronized void waitForEvent(String instance, String state) { long delay = 5000; @@ -1158,7 +1233,8 @@ public synchronized void waitForEvent(String instance, String state) { StringBuilder eventsBuffer = new StringBuilder(); eventsBuffer.append("\nFound the following events: \n"); //$NON-NLS-1$ for (Object[] foundEvent : foundEvents) { - eventsBuffer.append(" handle event: ").append(foundEvent[0]).append(" ").append(foundEvent[1]).append("\n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + eventsBuffer.append(" handle event: ").append(foundEvent[0]).append(" ").append(foundEvent[1]) //$NON-NLS-1$ //$NON-NLS-2$ + .append("\n"); //$NON-NLS-1$ } foundEventsMsg = eventsBuffer.toString(); } else { @@ -1194,7 +1270,7 @@ public synchronized Object addingService(ServiceReference reference) { String pid = (String) reference.getProperty(ApplicationDescriptor.APPLICATION_PID); Boolean locked = (Boolean) reference.getProperty(ApplicationDescriptor.APPLICATION_LOCKED); Boolean launchable = (Boolean) reference.getProperty(ApplicationDescriptor.APPLICATION_LAUNCHABLE); - events.add(new Object[] {pid, ADDED, locked, launchable}); + events.add(new Object[] { pid, ADDED, locked, launchable }); Object result = bc.getService(reference); notifyAll(); return result; @@ -1204,7 +1280,7 @@ public synchronized void modifiedService(ServiceReference reference, Object serv String pid = (String) reference.getProperty(ApplicationDescriptor.APPLICATION_PID); Boolean locked = (Boolean) reference.getProperty(ApplicationDescriptor.APPLICATION_LOCKED); Boolean launchable = (Boolean) reference.getProperty(ApplicationDescriptor.APPLICATION_LAUNCHABLE); - events.add(new Object[] {pid, MODIFIED, locked, launchable}); + events.add(new Object[] { pid, MODIFIED, locked, launchable }); notifyAll(); } @@ -1212,11 +1288,12 @@ public synchronized void removedService(ServiceReference reference, Object servi String pid = (String) reference.getProperty(ApplicationDescriptor.APPLICATION_PID); Boolean locked = (Boolean) reference.getProperty(ApplicationDescriptor.APPLICATION_LOCKED); Boolean launchable = (Boolean) reference.getProperty(ApplicationDescriptor.APPLICATION_LAUNCHABLE); - events.add(new Object[] {pid, REMOVED, locked, launchable}); + events.add(new Object[] { pid, REMOVED, locked, launchable }); notifyAll(); } - // Note that this method assumes you call it before the event actually gets posted. + // Note that this method assumes you call it before the event actually gets + // posted. // It only looks at the last event that was saved. public synchronized void waitForEvent(String pid, String type, Boolean locked, Boolean launchable) { long delay = 5000; @@ -1238,13 +1315,16 @@ public synchronized void waitForEvent(String pid, String type, Boolean locked, B StringBuilder eventsBuffer = new StringBuilder(); eventsBuffer.append("\nFound the following events: \n"); //$NON-NLS-1$ for (Object[] foundEvent : foundEvents) { - eventsBuffer.append(" descriptor event: ").append(foundEvent[0]).append(" ").append(foundEvent[1]).append(" ").append(foundEvent[2]).append(" ").append(foundEvent[3]).append("\n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ + eventsBuffer.append(" descriptor event: ").append(foundEvent[0]).append(" ") //$NON-NLS-1$ //$NON-NLS-2$ + .append(foundEvent[1]).append(" ").append(foundEvent[2]).append(" ") //$NON-NLS-1$ //$NON-NLS-2$ + .append(foundEvent[3]).append("\n"); //$NON-NLS-1$ } foundEventsMsg = eventsBuffer.toString(); } else { foundEventsMsg = "\nNo events recorded"; //$NON-NLS-1$ } - fail("failed waiting for descriptor event: " + pid + " " + type + " " + locked + " " + launchable + foundEventsMsg); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ + fail("failed waiting for descriptor event: " + pid + " " + type + " " + locked + " " + launchable //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ + + foundEventsMsg); } } diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/appadmin/ApplicationRelaunchTest.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/appadmin/ApplicationRelaunchTest.java index 22438996d32..c7788c48471 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/appadmin/ApplicationRelaunchTest.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/appadmin/ApplicationRelaunchTest.java @@ -36,7 +36,8 @@ public class ApplicationRelaunchTest extends OSGiTest { public static Test suite() { TestSuite suite = new TestSuite(ApplicationRelaunchTest.class.getName()); - ConfigurationSessionTestSuite appAdminSessionTest = new ConfigurationSessionTestSuite(PI_OSGI_TESTS, ApplicationRelaunchTest.class.getName()); + ConfigurationSessionTestSuite appAdminSessionTest = new ConfigurationSessionTestSuite(PI_OSGI_TESTS, + ApplicationRelaunchTest.class.getName()); addRequiredOSGiTestsBundles(appAdminSessionTest); appAdminSessionTest.setApplicationId(testRunnerRelauncherApp); @@ -63,7 +64,8 @@ private ApplicationDescriptor getApplication(String appName) { assertNotNull("BundleContext is null!!", context); //$NON-NLS-1$ Class appDescClass = ApplicationDescriptor.class; assertNotNull("ApplicationDescriptor.class is null!!", appDescClass); //$NON-NLS-1$ - ServiceReference[] refs = context.getServiceReferences(appDescClass.getName(), "(" + ApplicationDescriptor.APPLICATION_PID + "=" + appName + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + ServiceReference[] refs = context.getServiceReferences(appDescClass.getName(), + "(" + ApplicationDescriptor.APPLICATION_PID + "=" + appName + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ if (refs == null || refs.length == 0) { refs = getContext().getServiceReferences(ApplicationDescriptor.class.getName(), null); String availableApps = ""; //$NON-NLS-1$ diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/AbstractBundleTests.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/AbstractBundleTests.java index 05648f03bb3..4f3ed7cd3b8 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/AbstractBundleTests.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/AbstractBundleTests.java @@ -124,7 +124,8 @@ public BundleContext getContext() { } static public void compareResults(Object[] expectedEvents, Object[] actualEvents) { - String expectedActual = " -- EXPECTED:" + toStringEventArray(expectedEvents) + " ACTUAL:" + toStringEventArray(actualEvents); + String expectedActual = " -- EXPECTED:" + toStringEventArray(expectedEvents) + " ACTUAL:" + + toStringEventArray(actualEvents); assertEquals("compareResults length" + expectedActual, expectedEvents.length, actualEvents.length); for (int i = 0; i < expectedEvents.length; i++) { String assertMsg = "compareResults: " + i + expectedActual; @@ -174,26 +175,26 @@ else if (object instanceof FrameworkEvent) private static String toString(FrameworkEvent event) { StringBuilder result = new StringBuilder("FrameworkEvent ["); switch (event.getType()) { - case FrameworkEvent.ERROR : - result.append("ERROR"); - break; - case FrameworkEvent.INFO : - result.append("INFO"); - break; - case FrameworkEvent.PACKAGES_REFRESHED : - result.append("PACKAGES_REFRESHED"); - break; - case FrameworkEvent.STARTED : - result.append("STARTED"); - break; - case FrameworkEvent.STARTLEVEL_CHANGED : - result.append("STARTLEVEL_CHANGED"); - break; - case FrameworkEvent.WARNING : - result.append("WARNING"); - break; - default : - break; + case FrameworkEvent.ERROR: + result.append("ERROR"); + break; + case FrameworkEvent.INFO: + result.append("INFO"); + break; + case FrameworkEvent.PACKAGES_REFRESHED: + result.append("PACKAGES_REFRESHED"); + break; + case FrameworkEvent.STARTED: + result.append("STARTED"); + break; + case FrameworkEvent.STARTLEVEL_CHANGED: + result.append("STARTLEVEL_CHANGED"); + break; + case FrameworkEvent.WARNING: + result.append("WARNING"); + break; + default: + break; } result.append("] ").append(event.getSource()); return result.toString(); @@ -202,38 +203,38 @@ private static String toString(FrameworkEvent event) { private static String toString(BundleEvent event) { StringBuilder result = new StringBuilder("BundleEvent ["); switch (event.getType()) { - case BundleEvent.INSTALLED : - result.append("INSTALLED"); - break; - case BundleEvent.LAZY_ACTIVATION : - result.append("LAZY_ACTIVATION"); - break; - case BundleEvent.RESOLVED : - result.append("RESOLVED"); - break; - case BundleEvent.STARTED : - result.append("STARTED"); - break; - case BundleEvent.STARTING : - result.append("STARTING"); - break; - case BundleEvent.STOPPED : - result.append("STOPPED"); - break; - case BundleEvent.STOPPING : - result.append("STOPPING"); - break; - case BundleEvent.UNINSTALLED : - result.append("UNINSTALLED"); - break; - case BundleEvent.UNRESOLVED : - result.append("UNRESOLVED"); - break; - case BundleEvent.UPDATED : - result.append("UPDATED"); - break; - default : - break; + case BundleEvent.INSTALLED: + result.append("INSTALLED"); + break; + case BundleEvent.LAZY_ACTIVATION: + result.append("LAZY_ACTIVATION"); + break; + case BundleEvent.RESOLVED: + result.append("RESOLVED"); + break; + case BundleEvent.STARTED: + result.append("STARTED"); + break; + case BundleEvent.STARTING: + result.append("STARTING"); + break; + case BundleEvent.STOPPED: + result.append("STOPPED"); + break; + case BundleEvent.STOPPING: + result.append("STOPPING"); + break; + case BundleEvent.UNINSTALLED: + result.append("UNINSTALLED"); + break; + case BundleEvent.UNRESOLVED: + result.append("UNRESOLVED"); + break; + case BundleEvent.UPDATED: + result.append("UPDATED"); + break; + default: + break; } result.append("] ").append(event.getSource()); return result.toString(); @@ -292,7 +293,8 @@ static public FrameworkEvent stopQuietly(Framework equinox) { protected static FrameworkEvent update(final Framework equinox) throws BundleException, InterruptedException { final FrameworkEvent[] success = new FrameworkEvent[] { null }; final String uuid = getUUID(equinox); - Thread waitForUpdate = new Thread(() -> success[0] = waitForStop(equinox, uuid, false, 10000), "test waitForStop thread"); //$NON-NLS-1$ + Thread waitForUpdate = new Thread(() -> success[0] = waitForStop(equinox, uuid, false, 10000), + "test waitForStop thread"); //$NON-NLS-1$ waitForUpdate.start(); // delay hack to allow waitForUpdate thread to block on waitForStop before we diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/BundleInstallUpdateTests.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/BundleInstallUpdateTests.java index bb5981b46f8..ab0b8dae0b9 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/BundleInstallUpdateTests.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/BundleInstallUpdateTests.java @@ -333,7 +333,8 @@ public void testEscapeZipRoot() throws Exception { findLibrary.setAccessible(true); assertNull("Found library.", findLibrary.invoke(cl, "nativeCode")); - URLConverter bundleURLConverter = getContext().getService(getContext().getServiceReferences(URLConverter.class, "(protocol=bundleentry)").iterator().next()); + URLConverter bundleURLConverter = getContext().getService( + getContext().getServiceReferences(URLConverter.class, "(protocol=bundleentry)").iterator().next()); URL dir1 = bundleURLConverter.toFileURL(testBundle.getEntry("dir1/")); File dir1File = new File(dir1.toExternalForm().substring(5)); diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/BundleInstaller.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/BundleInstaller.java index 3d6b12faacb..49cad28d3b5 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/BundleInstaller.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/BundleInstaller.java @@ -55,7 +55,9 @@ public class BundleInstaller { public BundleInstaller(String bundlesRoot, BundleContext context) throws InvalidSyntaxException { this.context = context; rootLocation = bundlesRoot; - converter = new ServiceTracker<>(context, context.createFilter("(&(objectClass=" + URLConverter.class.getName() + ")(protocol=bundleentry))"), null); + converter = new ServiceTracker<>(context, + context.createFilter("(&(objectClass=" + URLConverter.class.getName() + ")(protocol=bundleentry))"), + null); converter.open(); startlevel = new ServiceTracker<>(context, StartLevel.class.getName(), null); startlevel.open(); diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/BundleNativeCodeTests.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/BundleNativeCodeTests.java index 0ca4abd0bff..5fd5d353d4d 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/BundleNativeCodeTests.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/BundleNativeCodeTests.java @@ -229,8 +229,7 @@ public void testSingleBundleNativeHostWithFragmentsMultipleMatch() throws Except } private void doTestNativeCode(File config, String libraryMatchValue, String nativeCodeName, File hostBundleFile, - File... fragmentBundleFiles) - throws Exception { + File... fragmentBundleFiles) throws Exception { Map fwkConfig = new HashMap<>(); fwkConfig.put(FRAMEWORK_STORAGE, config.getAbsolutePath()); fwkConfig.put(FRAMEWORK_STORAGE_CLEAN, FRAMEWORK_STORAGE_CLEAN_ONFIRSTINIT); diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/BundleResourceTests.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/BundleResourceTests.java index 1ced085f1c7..e96050529a6 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/BundleResourceTests.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/BundleResourceTests.java @@ -28,7 +28,8 @@ public class BundleResourceTests extends CoreTest { protected void setUp() throws Exception { try { - installer = new BundleInstaller(OSGiTestsActivator.TEST_FILES_ROOT + "resourcetests/bundles", OSGiTestsActivator.getContext()); //$NON-NLS-1$ + installer = new BundleInstaller(OSGiTestsActivator.TEST_FILES_ROOT + "resourcetests/bundles", //$NON-NLS-1$ + OSGiTestsActivator.getContext()); } catch (InvalidSyntaxException e) { fail("Failed to create bundle installer", e); //$NON-NLS-1$ } @@ -73,7 +74,8 @@ public void testBreakOutDirBundle() throws Exception { } public void testBug395274() throws Exception { - ServiceReference infoRef = OSGiTestsActivator.getContext().getServiceReference(EnvironmentInfo.class); + ServiceReference infoRef = OSGiTestsActivator.getContext() + .getServiceReference(EnvironmentInfo.class); EnvironmentInfo info = OSGiTestsActivator.getContext().getService(infoRef); String original = info.setProperty("osgi.strictBundleEntryPath", "true"); try { @@ -98,7 +100,8 @@ public void testBug395274() throws Exception { public void testBug328795() throws BundleException { Bundle bundle = installer.installBundle("test"); //$NON-NLS-1$ - checkEntries(bundle, "notFound\\", 0); // this results in invalid syntax exception which is logged because of trailing escape + checkEntries(bundle, "notFound\\", 0); // this results in invalid syntax exception which is logged because of + // trailing escape checkEntries(bundle, "notFound\\\\", 0); // test escaped escape "notFound\" checkEntries(bundle, "notFound(", 0); // test unescaped trailing ( checkEntries(bundle, "notFound\\(", 0); // test escaped trailing ( @@ -108,10 +111,12 @@ public void testBug328795() throws BundleException { checkEntries(bundle, "notFound\\*", 0); // test trailing escaped * checkEntries(bundle, "paren(.txt", 1); // test unescaped ( -> should find one checkEntries(bundle, "paren\\(.txt", 1); // test escaped ( -> should find one - checkEntries(bundle, "paren\\\\(.txt", 0); // test escaped escape before unescaped ( -> should find none; looks for paren\(.txt file + checkEntries(bundle, "paren\\\\(.txt", 0); // test escaped escape before unescaped ( -> should find none; looks + // for paren\(.txt file checkEntries(bundle, "paren).txt", 1); // test unescaped ) -> should find one checkEntries(bundle, "paren\\).txt", 1); // test escaped ) -> should find one - checkEntries(bundle, "paren\\\\).txt", 0); // test escaped escape before unescaped ) -> should find none; looks for paren\).txt file + checkEntries(bundle, "paren\\\\).txt", 0); // test escaped escape before unescaped ) -> should find none; looks + // for paren\).txt file checkEntries(bundle, "paren(", 1); // test unescaped trailing ( -> should find one checkEntries(bundle, "paren\\(", 1); // test escaped trailing ( -> should find one checkEntries(bundle, "paren\\\\(", 0); // test escaped escape before ( -> should find none; looks for paren\( @@ -121,7 +126,8 @@ public void testBug328795() throws BundleException { checkEntries(bundle, "paren*", 4); // test trailing wild cards checkEntries(bundle, "paren*.txt", 2); // test middle wild cards checkEntries(bundle, "paren\\*", 0); // test escaped wild card -> should find none; looks for paren* - checkEntries(bundle, "paren\\\\*", 0); // test escaped escape before wild card -> should find none; looks for paren\* + checkEntries(bundle, "paren\\\\*", 0); // test escaped escape before wild card -> should find none; looks for + // paren\* checkEntries(bundle, "p*r*n*", 4); // test multiple wild cards checkEntries(bundle, "p*r*n*.txt", 2); // test multiple wild cards checkEntries(bundle, "*)*", 2); diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/ClassLoadingBundleTests.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/ClassLoadingBundleTests.java index 37600dedb5f..6e9ea6eaa17 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/ClassLoadingBundleTests.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/ClassLoadingBundleTests.java @@ -110,7 +110,7 @@ public void testLoadTriggerClass() throws Exception { installer.installBundle("chain.test.b"); //$NON-NLS-1$ installer.installBundle("chain.test.c"); //$NON-NLS-1$ installer.installBundle("chain.test.d"); //$NON-NLS-1$ - assertTrue("Did not resolve chainTest", installer.resolveBundles(new Bundle[] {chainTest})); //$NON-NLS-1$ + assertTrue("Did not resolve chainTest", installer.resolveBundles(new Bundle[] { chainTest })); //$NON-NLS-1$ chainTest.start(Bundle.START_ACTIVATION_POLICY); chainTestA.start(Bundle.START_ACTIVATION_POLICY); assertEquals("Wrong state", Bundle.STARTING, chainTest.getState()); //$NON-NLS-1$ @@ -139,7 +139,7 @@ public void testChainDepedencies() throws Exception { expectedEvents[4] = new BundleEvent(BundleEvent.STARTED, chainTestB); expectedEvents[5] = new BundleEvent(BundleEvent.STARTED, chainTestA); - installer.refreshPackages(new Bundle[] {chainTestB}); + installer.refreshPackages(new Bundle[] { chainTestB }); ((ITestRunner) chainTest.loadClass("chain.test.TestSingleChain").newInstance()).testIt(); //$NON-NLS-1$ @@ -166,7 +166,7 @@ public void testMultiChainDepedencies01() throws Exception { expectedEvents[6] = new BundleEvent(BundleEvent.STOPPED, chainTestC); expectedEvents[7] = new BundleEvent(BundleEvent.STOPPED, chainTestD); - installer.refreshPackages(new Bundle[] {chainTestC, chainTestD}); + installer.refreshPackages(new Bundle[] { chainTestC, chainTestD }); Object[] actualEvents = simpleResults.getResults(8); compareResults(expectedEvents, actualEvents); @@ -189,7 +189,7 @@ public void testMultiChainDepedencies02() throws Exception { Bundle chainTestC = installer.installBundle("chain.test.c"); //$NON-NLS-1$ Bundle chainTestD = installer.installBundle("chain.test.d"); //$NON-NLS-1$ syncListenerResults.getResults(0); - installer.resolveBundles(new Bundle[] {chainTestA, chainTestB, chainTestC, chainTestD}); + installer.resolveBundles(new Bundle[] { chainTestA, chainTestB, chainTestC, chainTestD }); Object[] expectedEvents = new Object[8]; expectedEvents[0] = new BundleEvent(BundleEvent.RESOLVED, chainTestD); @@ -204,7 +204,7 @@ public void testMultiChainDepedencies02() throws Exception { Object[] actualEvents = syncListenerResults.getResults(8); compareResults(expectedEvents, actualEvents); - installer.refreshPackages(new Bundle[] {chainTestC, chainTestD}); + installer.refreshPackages(new Bundle[] { chainTestC, chainTestD }); expectedEvents = new Object[20]; expectedEvents[0] = new BundleEvent(BundleEvent.STOPPING, chainTestA); @@ -249,7 +249,7 @@ public void testBug300692_01() throws BundleException { sl.setBundleStartLevel(chainTestB, testSL); sl.setBundleStartLevel(chainTestC, testSL); sl.setBundleStartLevel(chainTestD, testSL); - installer.resolveBundles(new Bundle[] {chainTest, chainTestA, chainTestB, chainTestC, chainTestD}); + installer.resolveBundles(new Bundle[] { chainTest, chainTestA, chainTestB, chainTestC, chainTestD }); Object[] expectedEvents = new Object[5]; expectedEvents[0] = new BundleEvent(BundleEvent.RESOLVED, chainTestD); @@ -265,7 +265,8 @@ public void testBug300692_01() throws BundleException { chainTest.start(); sl.setStartLevel(testSL); Object[] expectedFrameworkEvents = new Object[1]; - expectedFrameworkEvents[0] = new FrameworkEvent(FrameworkEvent.STARTLEVEL_CHANGED, OSGiTestsActivator.getContext().getBundle(0), null); + expectedFrameworkEvents[0] = new FrameworkEvent(FrameworkEvent.STARTLEVEL_CHANGED, + OSGiTestsActivator.getContext().getBundle(0), null); Object[] actualFrameworkEvents = frameworkListenerResults.getResults(1); compareResults(expectedFrameworkEvents, actualFrameworkEvents); @@ -292,7 +293,8 @@ public void testBug300692_01() throws BundleException { System.getProperties().remove("test.bug300692"); sl.setStartLevel(currentSL); Object[] expectedFrameworkEvents = new Object[1]; - expectedFrameworkEvents[0] = new FrameworkEvent(FrameworkEvent.STARTLEVEL_CHANGED, OSGiTestsActivator.getContext().getBundle(0), null); + expectedFrameworkEvents[0] = new FrameworkEvent(FrameworkEvent.STARTLEVEL_CHANGED, + OSGiTestsActivator.getContext().getBundle(0), null); Object[] actualFrameworkEvents = frameworkListenerResults.getResults(1); compareResults(expectedFrameworkEvents, actualFrameworkEvents); } @@ -315,7 +317,7 @@ public void testBug300692_02() throws BundleException { sl.setBundleStartLevel(chainTestB, testSL); sl.setBundleStartLevel(chainTestC, testSL); sl.setBundleStartLevel(chainTestD, testSL); - installer.resolveBundles(new Bundle[] {chainTest, chainTestA, chainTestB, chainTestC, chainTestD}); + installer.resolveBundles(new Bundle[] { chainTest, chainTestA, chainTestB, chainTestC, chainTestD }); Object[] expectedEvents = new Object[5]; expectedEvents[0] = new BundleEvent(BundleEvent.RESOLVED, chainTestD); @@ -332,7 +334,8 @@ public void testBug300692_02() throws BundleException { chainTest.start(); sl.setStartLevel(testSL); Object[] expectedFrameworkEvents = new Object[1]; - expectedFrameworkEvents[0] = new FrameworkEvent(FrameworkEvent.STARTLEVEL_CHANGED, OSGiTestsActivator.getContext().getBundle(0), null); + expectedFrameworkEvents[0] = new FrameworkEvent(FrameworkEvent.STARTLEVEL_CHANGED, + OSGiTestsActivator.getContext().getBundle(0), null); Object[] actualFrameworkEvents = frameworkListenerResults.getResults(1); compareResults(expectedFrameworkEvents, actualFrameworkEvents); @@ -361,7 +364,8 @@ public void testBug300692_02() throws BundleException { System.getProperties().remove("test.bug300692.listener"); sl.setStartLevel(currentSL); Object[] expectedFrameworkEvents = new Object[1]; - expectedFrameworkEvents[0] = new FrameworkEvent(FrameworkEvent.STARTLEVEL_CHANGED, OSGiTestsActivator.getContext().getBundle(0), null); + expectedFrameworkEvents[0] = new FrameworkEvent(FrameworkEvent.STARTLEVEL_CHANGED, + OSGiTestsActivator.getContext().getBundle(0), null); Object[] actualFrameworkEvents = frameworkListenerResults.getResults(1); compareResults(expectedFrameworkEvents, actualFrameworkEvents); } @@ -384,7 +388,7 @@ public void testBug408629() throws BundleException { sl.setBundleStartLevel(chainTestB, testSL); sl.setBundleStartLevel(chainTestC, testSL); sl.setBundleStartLevel(chainTestD, testSL); - installer.resolveBundles(new Bundle[] {chainTest, chainTestA, chainTestB, chainTestC, chainTestD}); + installer.resolveBundles(new Bundle[] { chainTest, chainTestA, chainTestB, chainTestC, chainTestD }); // eager start chainTestD chainTestD.start(); @@ -404,7 +408,8 @@ public void testBug408629() throws BundleException { chainTest.start(); sl.setStartLevel(testSL); Object[] expectedFrameworkEvents = new Object[1]; - expectedFrameworkEvents[0] = new FrameworkEvent(FrameworkEvent.STARTLEVEL_CHANGED, OSGiTestsActivator.getContext().getBundle(0), null); + expectedFrameworkEvents[0] = new FrameworkEvent(FrameworkEvent.STARTLEVEL_CHANGED, + OSGiTestsActivator.getContext().getBundle(0), null); Object[] actualFrameworkEvents = frameworkListenerResults.getResults(1); compareResults(expectedFrameworkEvents, actualFrameworkEvents); @@ -454,7 +459,8 @@ public void testBug408629() throws BundleException { System.getProperties().remove("test.bug300692.listener"); sl.setStartLevel(currentSL); Object[] expectedFrameworkEvents = new Object[1]; - expectedFrameworkEvents[0] = new FrameworkEvent(FrameworkEvent.STARTLEVEL_CHANGED, OSGiTestsActivator.getContext().getBundle(0), null); + expectedFrameworkEvents[0] = new FrameworkEvent(FrameworkEvent.STARTLEVEL_CHANGED, + OSGiTestsActivator.getContext().getBundle(0), null); Object[] actualFrameworkEvents = frameworkListenerResults.getResults(1); compareResults(expectedFrameworkEvents, actualFrameworkEvents); } @@ -477,9 +483,10 @@ public void testClassCircularityError() throws Exception { public void testFragmentPackageAccess() throws Exception { Bundle hostA = installer.installBundle("fragment.test.attach.host.a"); //$NON-NLS-1$ Bundle fragA = installer.installBundle("fragment.test.attach.frag.a"); //$NON-NLS-1$ - assertTrue("Host/Frag resolve", installer.resolveBundles(new Bundle[] {hostA, fragA})); //$NON-NLS-1$ + assertTrue("Host/Frag resolve", installer.resolveBundles(new Bundle[] { hostA, fragA })); //$NON-NLS-1$ - ITestRunner testRunner = (ITestRunner) hostA.loadClass("fragment.test.attach.host.a.internal.test.TestPackageAccess").newInstance(); //$NON-NLS-1$ + ITestRunner testRunner = (ITestRunner) hostA + .loadClass("fragment.test.attach.host.a.internal.test.TestPackageAccess").newInstance(); //$NON-NLS-1$ testRunner.testIt(); } @@ -488,7 +495,7 @@ public void testFragmentMultiHost() throws Exception { Bundle hostA1 = installer.installBundle("fragment.test.attach.host.a"); //$NON-NLS-1$ Bundle hostA2 = installer.installBundle("fragment.test.attach.host.a.v2"); //$NON-NLS-1$ Bundle fragA = installer.installBundle("fragment.test.attach.frag.a"); //$NON-NLS-1$ - assertTrue("Host/Frag resolve", installer.resolveBundles(new Bundle[] {hostA1, hostA2, fragA})); //$NON-NLS-1$ + assertTrue("Host/Frag resolve", installer.resolveBundles(new Bundle[] { hostA1, hostA2, fragA })); //$NON-NLS-1$ assertEquals("Wrong number of hosts", 2, installer.getPackageAdmin().getHosts(fragA).length); //$NON-NLS-1$ runTestRunner(hostA1, "fragment.test.attach.host.a.internal.test.TestPackageAccess"); //$NON-NLS-1$ @@ -504,14 +511,14 @@ private void runTestRunner(Bundle host, String classname) throws Exception { @Test public void testFragmentExportPackage() throws Exception { Bundle hostA = installer.installBundle("fragment.test.attach.host.a"); //$NON-NLS-1$ - assertTrue("Host resolve", installer.resolveBundles(new Bundle[] {hostA})); //$NON-NLS-1$ + assertTrue("Host resolve", installer.resolveBundles(new Bundle[] { hostA })); //$NON-NLS-1$ // make sure class loader for hostA is initialized hostA.loadClass("fragment.test.attach.host.a.internal.test.PackageAccessTest"); //$NON-NLS-1$ Bundle fragB = installer.installBundle("fragment.test.attach.frag.b"); //$NON-NLS-1$ Bundle hostARequire = installer.installBundle("fragment.test.attach.host.a.require"); //$NON-NLS-1$ - assertTrue("RequireA/Frag", installer.resolveBundles(new Bundle[] {hostARequire, fragB})); //$NON-NLS-1$ + assertTrue("RequireA/Frag", installer.resolveBundles(new Bundle[] { hostARequire, fragB })); //$NON-NLS-1$ hostARequire.loadClass("fragment.test.attach.frag.b.Test"); //$NON-NLS-1$ } @@ -522,7 +529,8 @@ public void testLegacyLazyStart() throws Exception { Bundle legacyA = installer.installBundle("legacy.lazystart.a"); //$NON-NLS-1$ Bundle legacyB = installer.installBundle("legacy.lazystart.b"); //$NON-NLS-1$ Bundle legacyC = installer.installBundle("legacy.lazystart.c"); //$NON-NLS-1$ - assertTrue("legacy lazy start resolve", installer.resolveBundles(new Bundle[] {legacy, legacyA, legacyB, legacyC})); //$NON-NLS-1$ + assertTrue("legacy lazy start resolve", //$NON-NLS-1$ + installer.resolveBundles(new Bundle[] { legacy, legacyA, legacyB, legacyC })); ((ITestRunner) legacy.loadClass("legacy.lazystart.SimpleLegacy").newInstance()).testIt(); //$NON-NLS-1$ Object[] expectedEvents = new Object[1]; @@ -549,14 +557,16 @@ public void testLegacyLazyStart() throws Exception { @Test public void testLegacyLoadActivation() throws Exception { - // test that calling loadClass from a non-lazy start bundle does not activate the bundle + // test that calling loadClass from a non-lazy start bundle does not activate + // the bundle Bundle test = installer.installBundle("test"); //$NON-NLS-1$ assertThrows(ClassNotFoundException.class, () -> test.loadClass("does.not.exist.Test")); //$NON-NLS-1$ Object[] expectedEvents = new Object[0]; Object[] actualEvents = simpleResults.getResults(0); compareResults(expectedEvents, actualEvents); - // test that calling loadClass from a lazy start bundle does not activates a bundle + // test that calling loadClass from a lazy start bundle does not activates a + // bundle // This is not disabled by default (bug 503742) Bundle legacyA = installer.installBundle("legacy.lazystart.a"); //$NON-NLS-1$ assertThrows(ClassNotFoundException.class, () -> legacyA.loadClass("does.not.exist.Test")); //$NON-NLS-1$ @@ -572,7 +582,7 @@ public void testOSGiLazyStart() throws Exception { Bundle osgiA = installer.installBundle("osgi.lazystart.a"); //$NON-NLS-1$ Bundle osgiB = installer.installBundle("osgi.lazystart.b"); //$NON-NLS-1$ Bundle osgiC = installer.installBundle("osgi.lazystart.c"); //$NON-NLS-1$ - assertTrue("osgi lazy start resolve", installer.resolveBundles(new Bundle[] {osgi, osgiA, osgiB, osgiC})); //$NON-NLS-1$ + assertTrue("osgi lazy start resolve", installer.resolveBundles(new Bundle[] { osgi, osgiA, osgiB, osgiC })); //$NON-NLS-1$ ((ITestRunner) osgi.loadClass("osgi.lazystart.LazySimple").newInstance()).testIt(); //$NON-NLS-1$ Object[] expectedEvents = new Object[1]; @@ -601,7 +611,7 @@ public void testOSGiLazyStart() throws Exception { public void testOSGiLazyStartDelay() throws Exception { final Bundle osgiD = installer.installBundle("osgi.lazystart.d"); //$NON-NLS-1$ final Bundle osgiE = installer.installBundle("osgi.lazystart.e"); //$NON-NLS-1$ - assertTrue("osgi lazy start resolve", installer.resolveBundles(new Bundle[] {osgiD, osgiE})); //$NON-NLS-1$ + assertTrue("osgi lazy start resolve", installer.resolveBundles(new Bundle[] { osgiD, osgiE })); //$NON-NLS-1$ Thread t = new Thread(() -> { try { @@ -622,22 +632,25 @@ public void testOSGiLazyStartDelay() throws Exception { @Test public void testStartTransientByLoadClass() throws Exception { - // install a bundle and set its start-level high, then crank up the framework start-level. This should result in no events + // install a bundle and set its start-level high, then crank up the framework + // start-level. This should result in no events Bundle osgiA = installer.installBundle("osgi.lazystart.a"); //$NON-NLS-1$ - installer.resolveBundles(new Bundle[] {osgiA}); + installer.resolveBundles(new Bundle[] { osgiA }); StartLevel startLevel = installer.getStartLevel(); startLevel.setBundleStartLevel(osgiA, startLevel.getStartLevel() + 10); // test transient start by loadClass startLevel.setStartLevel(startLevel.getStartLevel() + 15); Object[] expectedFrameworkEvents = new Object[1]; - expectedFrameworkEvents[0] = new FrameworkEvent(FrameworkEvent.STARTLEVEL_CHANGED, OSGiTestsActivator.getContext().getBundle(0), null); + expectedFrameworkEvents[0] = new FrameworkEvent(FrameworkEvent.STARTLEVEL_CHANGED, + OSGiTestsActivator.getContext().getBundle(0), null); Object[] actualFrameworkEvents = frameworkListenerResults.getResults(1); compareResults(expectedFrameworkEvents, actualFrameworkEvents); startLevel.setStartLevel(startLevel.getStartLevel() - 15); expectedFrameworkEvents = new Object[1]; - expectedFrameworkEvents[0] = new FrameworkEvent(FrameworkEvent.STARTLEVEL_CHANGED, OSGiTestsActivator.getContext().getBundle(0), null); + expectedFrameworkEvents[0] = new FrameworkEvent(FrameworkEvent.STARTLEVEL_CHANGED, + OSGiTestsActivator.getContext().getBundle(0), null); actualFrameworkEvents = frameworkListenerResults.getResults(1); compareResults(expectedFrameworkEvents, actualFrameworkEvents); @@ -645,7 +658,8 @@ public void testStartTransientByLoadClass() throws Exception { Object[] actualEvents = simpleResults.getResults(0); compareResults(expectedEvents, actualEvents); - // now load a class from it before the start-level is met. This should result in no events + // now load a class from it before the start-level is met. This should result in + // no events osgiA.loadClass("osgi.lazystart.a.ATest"); //$NON-NLS-1$ expectedEvents = new Object[0]; actualEvents = simpleResults.getResults(0); @@ -653,7 +667,8 @@ public void testStartTransientByLoadClass() throws Exception { startLevel.setStartLevel(startLevel.getStartLevel() + 15); expectedFrameworkEvents = new Object[1]; - expectedFrameworkEvents[0] = new FrameworkEvent(FrameworkEvent.STARTLEVEL_CHANGED, OSGiTestsActivator.getContext().getBundle(0), null); + expectedFrameworkEvents[0] = new FrameworkEvent(FrameworkEvent.STARTLEVEL_CHANGED, + OSGiTestsActivator.getContext().getBundle(0), null); actualFrameworkEvents = frameworkListenerResults.getResults(1); compareResults(expectedFrameworkEvents, actualFrameworkEvents); @@ -664,7 +679,8 @@ public void testStartTransientByLoadClass() throws Exception { startLevel.setStartLevel(startLevel.getStartLevel() - 15); expectedFrameworkEvents = new Object[1]; - expectedFrameworkEvents[0] = new FrameworkEvent(FrameworkEvent.STARTLEVEL_CHANGED, OSGiTestsActivator.getContext().getBundle(0), null); + expectedFrameworkEvents[0] = new FrameworkEvent(FrameworkEvent.STARTLEVEL_CHANGED, + OSGiTestsActivator.getContext().getBundle(0), null); actualFrameworkEvents = frameworkListenerResults.getResults(1); compareResults(expectedFrameworkEvents, actualFrameworkEvents); @@ -676,7 +692,8 @@ public void testStartTransientByLoadClass() throws Exception { // now load a class while start-level is met. startLevel.setStartLevel(startLevel.getStartLevel() + 15); expectedFrameworkEvents = new Object[1]; - expectedFrameworkEvents[0] = new FrameworkEvent(FrameworkEvent.STARTLEVEL_CHANGED, OSGiTestsActivator.getContext().getBundle(0), null); + expectedFrameworkEvents[0] = new FrameworkEvent(FrameworkEvent.STARTLEVEL_CHANGED, + OSGiTestsActivator.getContext().getBundle(0), null); actualFrameworkEvents = frameworkListenerResults.getResults(1); compareResults(expectedFrameworkEvents, actualFrameworkEvents); @@ -688,7 +705,8 @@ public void testStartTransientByLoadClass() throws Exception { startLevel.setStartLevel(startLevel.getStartLevel() - 15); expectedFrameworkEvents = new Object[1]; - expectedFrameworkEvents[0] = new FrameworkEvent(FrameworkEvent.STARTLEVEL_CHANGED, OSGiTestsActivator.getContext().getBundle(0), null); + expectedFrameworkEvents[0] = new FrameworkEvent(FrameworkEvent.STARTLEVEL_CHANGED, + OSGiTestsActivator.getContext().getBundle(0), null); actualFrameworkEvents = frameworkListenerResults.getResults(1); compareResults(expectedFrameworkEvents, actualFrameworkEvents); @@ -700,22 +718,25 @@ public void testStartTransientByLoadClass() throws Exception { @Test public void testStartTransient() throws Exception { - // install a bundle and set its start-level high, then crank up the framework start-level. This should result in no events + // install a bundle and set its start-level high, then crank up the framework + // start-level. This should result in no events Bundle osgiA = installer.installBundle("osgi.lazystart.a"); //$NON-NLS-1$ - installer.resolveBundles(new Bundle[] {osgiA}); + installer.resolveBundles(new Bundle[] { osgiA }); StartLevel startLevel = installer.getStartLevel(); startLevel.setBundleStartLevel(osgiA, startLevel.getStartLevel() + 10); // test transient start Bundle.start(START_TRANSIENT) startLevel.setStartLevel(startLevel.getStartLevel() + 15); Object[] expectedFrameworkEvents = new Object[1]; - expectedFrameworkEvents[0] = new FrameworkEvent(FrameworkEvent.STARTLEVEL_CHANGED, OSGiTestsActivator.getContext().getBundle(0), null); + expectedFrameworkEvents[0] = new FrameworkEvent(FrameworkEvent.STARTLEVEL_CHANGED, + OSGiTestsActivator.getContext().getBundle(0), null); Object[] actualFrameworkEvents = frameworkListenerResults.getResults(1); compareResults(expectedFrameworkEvents, actualFrameworkEvents); startLevel.setStartLevel(startLevel.getStartLevel() - 15); expectedFrameworkEvents = new Object[1]; - expectedFrameworkEvents[0] = new FrameworkEvent(FrameworkEvent.STARTLEVEL_CHANGED, OSGiTestsActivator.getContext().getBundle(0), null); + expectedFrameworkEvents[0] = new FrameworkEvent(FrameworkEvent.STARTLEVEL_CHANGED, + OSGiTestsActivator.getContext().getBundle(0), null); actualFrameworkEvents = frameworkListenerResults.getResults(1); compareResults(expectedFrameworkEvents, actualFrameworkEvents); @@ -723,7 +744,8 @@ public void testStartTransient() throws Exception { Object[] actualEvents = simpleResults.getResults(0); compareResults(expectedEvents, actualEvents); - // now call start(START_TRANSIENT) before the start-level is met. This should result in no events + // now call start(START_TRANSIENT) before the start-level is met. This should + // result in no events try { osgiA.start(Bundle.START_TRANSIENT); assertFalse("Bundle is started!!", osgiA.getState() == Bundle.ACTIVE); //$NON-NLS-1$ @@ -736,13 +758,15 @@ public void testStartTransient() throws Exception { startLevel.setStartLevel(startLevel.getStartLevel() + 15); expectedFrameworkEvents = new Object[1]; - expectedFrameworkEvents[0] = new FrameworkEvent(FrameworkEvent.STARTLEVEL_CHANGED, OSGiTestsActivator.getContext().getBundle(0), null); + expectedFrameworkEvents[0] = new FrameworkEvent(FrameworkEvent.STARTLEVEL_CHANGED, + OSGiTestsActivator.getContext().getBundle(0), null); actualFrameworkEvents = frameworkListenerResults.getResults(1); compareResults(expectedFrameworkEvents, actualFrameworkEvents); startLevel.setStartLevel(startLevel.getStartLevel() - 15); expectedFrameworkEvents = new Object[1]; - expectedFrameworkEvents[0] = new FrameworkEvent(FrameworkEvent.STARTLEVEL_CHANGED, OSGiTestsActivator.getContext().getBundle(0), null); + expectedFrameworkEvents[0] = new FrameworkEvent(FrameworkEvent.STARTLEVEL_CHANGED, + OSGiTestsActivator.getContext().getBundle(0), null); actualFrameworkEvents = frameworkListenerResults.getResults(1); compareResults(expectedFrameworkEvents, actualFrameworkEvents); @@ -753,7 +777,8 @@ public void testStartTransient() throws Exception { // now call start(START_TRANSIENT) while start-level is met. startLevel.setStartLevel(startLevel.getStartLevel() + 15); expectedFrameworkEvents = new Object[1]; - expectedFrameworkEvents[0] = new FrameworkEvent(FrameworkEvent.STARTLEVEL_CHANGED, OSGiTestsActivator.getContext().getBundle(0), null); + expectedFrameworkEvents[0] = new FrameworkEvent(FrameworkEvent.STARTLEVEL_CHANGED, + OSGiTestsActivator.getContext().getBundle(0), null); actualFrameworkEvents = frameworkListenerResults.getResults(1); compareResults(expectedFrameworkEvents, actualFrameworkEvents); @@ -766,7 +791,8 @@ public void testStartTransient() throws Exception { startLevel.setStartLevel(startLevel.getStartLevel() - 15); expectedFrameworkEvents = new Object[1]; - expectedFrameworkEvents[0] = new FrameworkEvent(FrameworkEvent.STARTLEVEL_CHANGED, OSGiTestsActivator.getContext().getBundle(0), null); + expectedFrameworkEvents[0] = new FrameworkEvent(FrameworkEvent.STARTLEVEL_CHANGED, + OSGiTestsActivator.getContext().getBundle(0), null); actualFrameworkEvents = frameworkListenerResults.getResults(1); compareResults(expectedFrameworkEvents, actualFrameworkEvents); @@ -778,7 +804,8 @@ public void testStartTransient() throws Exception { @Test public void testStartResolve() throws Exception { - // install a bundle and set its start-level high, then crank up the framework start-level. This should result in no events + // install a bundle and set its start-level high, then crank up the framework + // start-level. This should result in no events Bundle test = installer.installBundle("test"); //$NON-NLS-1$ StartLevel startLevel = installer.getStartLevel(); startLevel.setBundleStartLevel(test, startLevel.getStartLevel() + 10); @@ -787,7 +814,8 @@ public void testStartResolve() throws Exception { assertEquals("Wrong state", Bundle.INSTALLED, test.getState()); //$NON-NLS-1$ startLevel.setStartLevel(startLevel.getStartLevel() + 15); Object[] expectedFrameworkEvents = new Object[1]; - expectedFrameworkEvents[0] = new FrameworkEvent(FrameworkEvent.STARTLEVEL_CHANGED, OSGiTestsActivator.getContext().getBundle(0), null); + expectedFrameworkEvents[0] = new FrameworkEvent(FrameworkEvent.STARTLEVEL_CHANGED, + OSGiTestsActivator.getContext().getBundle(0), null); Object[] actualFrameworkEvents = frameworkListenerResults.getResults(1); compareResults(expectedFrameworkEvents, actualFrameworkEvents); assertEquals("Wrong state", Bundle.ACTIVE, test.getState()); //$NON-NLS-1$ @@ -796,7 +824,7 @@ public void testStartResolve() throws Exception { @Test public void testStopTransient() throws Exception { Bundle osgiA = installer.installBundle("osgi.lazystart.a"); //$NON-NLS-1$ - installer.resolveBundles(new Bundle[] {osgiA}); + installer.resolveBundles(new Bundle[] { osgiA }); StartLevel startLevel = installer.getStartLevel(); startLevel.setBundleStartLevel(osgiA, startLevel.getStartLevel() + 10); // persistently start the bundle @@ -805,7 +833,8 @@ public void testStopTransient() throws Exception { // test that the bundle is started when start-level is met startLevel.setStartLevel(startLevel.getStartLevel() + 15); Object[] expectedFrameworkEvents = new Object[1]; - expectedFrameworkEvents[0] = new FrameworkEvent(FrameworkEvent.STARTLEVEL_CHANGED, OSGiTestsActivator.getContext().getBundle(0), null); + expectedFrameworkEvents[0] = new FrameworkEvent(FrameworkEvent.STARTLEVEL_CHANGED, + OSGiTestsActivator.getContext().getBundle(0), null); Object[] actualFrameworkEvents = frameworkListenerResults.getResults(1); compareResults(expectedFrameworkEvents, actualFrameworkEvents); @@ -816,7 +845,8 @@ public void testStopTransient() throws Exception { startLevel.setStartLevel(startLevel.getStartLevel() - 15); expectedFrameworkEvents = new Object[1]; - expectedFrameworkEvents[0] = new FrameworkEvent(FrameworkEvent.STARTLEVEL_CHANGED, OSGiTestsActivator.getContext().getBundle(0), null); + expectedFrameworkEvents[0] = new FrameworkEvent(FrameworkEvent.STARTLEVEL_CHANGED, + OSGiTestsActivator.getContext().getBundle(0), null); actualFrameworkEvents = frameworkListenerResults.getResults(1); compareResults(expectedFrameworkEvents, actualFrameworkEvents); @@ -828,7 +858,8 @@ public void testStopTransient() throws Exception { // now call stop(STOP_TRANSIENT) while the start-level is met. startLevel.setStartLevel(startLevel.getStartLevel() + 15); expectedFrameworkEvents = new Object[1]; - expectedFrameworkEvents[0] = new FrameworkEvent(FrameworkEvent.STARTLEVEL_CHANGED, OSGiTestsActivator.getContext().getBundle(0), null); + expectedFrameworkEvents[0] = new FrameworkEvent(FrameworkEvent.STARTLEVEL_CHANGED, + OSGiTestsActivator.getContext().getBundle(0), null); actualFrameworkEvents = frameworkListenerResults.getResults(1); compareResults(expectedFrameworkEvents, actualFrameworkEvents); @@ -846,14 +877,16 @@ public void testStopTransient() throws Exception { startLevel.setStartLevel(startLevel.getStartLevel() - 15); expectedFrameworkEvents = new Object[1]; - expectedFrameworkEvents[0] = new FrameworkEvent(FrameworkEvent.STARTLEVEL_CHANGED, OSGiTestsActivator.getContext().getBundle(0), null); + expectedFrameworkEvents[0] = new FrameworkEvent(FrameworkEvent.STARTLEVEL_CHANGED, + OSGiTestsActivator.getContext().getBundle(0), null); actualFrameworkEvents = frameworkListenerResults.getResults(1); compareResults(expectedFrameworkEvents, actualFrameworkEvents); // now make sure the bundle still restarts when start-level is met startLevel.setStartLevel(startLevel.getStartLevel() + 15); expectedFrameworkEvents = new Object[1]; - expectedFrameworkEvents[0] = new FrameworkEvent(FrameworkEvent.STARTLEVEL_CHANGED, OSGiTestsActivator.getContext().getBundle(0), null); + expectedFrameworkEvents[0] = new FrameworkEvent(FrameworkEvent.STARTLEVEL_CHANGED, + OSGiTestsActivator.getContext().getBundle(0), null); actualFrameworkEvents = frameworkListenerResults.getResults(1); compareResults(expectedFrameworkEvents, actualFrameworkEvents); @@ -864,7 +897,8 @@ public void testStopTransient() throws Exception { startLevel.setStartLevel(startLevel.getStartLevel() - 15); expectedFrameworkEvents = new Object[1]; - expectedFrameworkEvents[0] = new FrameworkEvent(FrameworkEvent.STARTLEVEL_CHANGED, OSGiTestsActivator.getContext().getBundle(0), null); + expectedFrameworkEvents[0] = new FrameworkEvent(FrameworkEvent.STARTLEVEL_CHANGED, + OSGiTestsActivator.getContext().getBundle(0), null); actualFrameworkEvents = frameworkListenerResults.getResults(1); compareResults(expectedFrameworkEvents, actualFrameworkEvents); @@ -913,7 +947,7 @@ public void testBug258659_02() throws Exception { }; OSGiTestsActivator.getContext().addBundleListener(testLoadClassListener); try { - installer.refreshPackages(new Bundle[] {osgiA}); + installer.refreshPackages(new Bundle[] { osgiA }); Object[] expectedEvents = new Object[1]; expectedEvents[0] = new BundleEvent(BundleEvent.STARTED, osgiA); Object[] actualEvents = simpleResults.getResults(1); @@ -966,7 +1000,7 @@ public void testBug258659_04() throws Exception { // listen for the events from refreshing OSGiTestsActivator.getContext().addBundleListener(testLoadClassListener); try { - installer.refreshPackages(new Bundle[] {test}); + installer.refreshPackages(new Bundle[] { test }); Object[] expectedEvents = new Object[3]; expectedEvents[0] = new BundleEvent(BundleEvent.STOPPED, test); expectedEvents[1] = new BundleEvent(BundleEvent.STARTED, test); @@ -982,7 +1016,7 @@ public void testBug258659_04() throws Exception { public void testBug213791() throws Exception { // install a bundle and call start(START_ACTIVATION_POLICY) twice Bundle osgiA = installer.installBundle("osgi.lazystart.a"); //$NON-NLS-1$ - installer.resolveBundles(new Bundle[] {osgiA}); + installer.resolveBundles(new Bundle[] { osgiA }); if (osgiA.getState() == Bundle.STARTING) osgiA.stop(); osgiA.start(Bundle.START_ACTIVATION_POLICY); @@ -1019,7 +1053,7 @@ public void testThreadLock() throws Exception { @Test public void testURLsBug164077() throws Exception { Bundle test = installer.installBundle("test"); //$NON-NLS-1$ - installer.resolveBundles(new Bundle[] {test}); + installer.resolveBundles(new Bundle[] { test }); URL[] urls = new URL[2]; urls[0] = test.getResource("a/b/c/d"); //$NON-NLS-1$ urls[1] = test.getEntry("a/b/c/d"); //$NON-NLS-1$ @@ -1070,7 +1104,7 @@ public void testURLsBug164077() throws Exception { @Test public void testEntryURLEqualsHashCode() throws Exception { Bundle test = installer.installBundle("test"); //$NON-NLS-1$ - installer.resolveBundles(new Bundle[] {test}); + installer.resolveBundles(new Bundle[] { test }); URL testEntry1 = test.getEntry("a/b/c/d"); //$NON-NLS-1$ URL testEntry2 = test.getEntry("a/b/c/d"); //$NON-NLS-1$ assertEquals("url equals 1.0", testEntry1, testEntry2); //$NON-NLS-1$ @@ -1088,7 +1122,7 @@ public void testEntryURLEqualsHashCode() throws Exception { @Test public void testResourceURLEqualsHashCode() throws Exception { Bundle test = installer.installBundle("test"); //$NON-NLS-1$ - installer.resolveBundles(new Bundle[] {test}); + installer.resolveBundles(new Bundle[] { test }); URL testResource1 = test.getResource("a/b/c/d"); //$NON-NLS-1$ URL testResource2 = test.getResource("a/b/c/d"); //$NON-NLS-1$ assertEquals("url equals 1.0", testResource1, testResource2); //$NON-NLS-1$ @@ -1106,7 +1140,7 @@ public void testResourceURLEqualsHashCode() throws Exception { @Test public void testGetEntryDir01() throws BundleException { Bundle test = installer.installBundle("test"); //$NON-NLS-1$ - installer.resolveBundles(new Bundle[] {test}); + installer.resolveBundles(new Bundle[] { test }); URL aDir = test.getEntry("a"); //$NON-NLS-1$ assertNotNull("aDir", aDir); //$NON-NLS-1$ assertTrue(aDir.toExternalForm(), aDir.getFile().endsWith("/")); //$NON-NLS-1$ @@ -1126,7 +1160,8 @@ public void testGetEntryDir01() throws BundleException { assertFalse(dResource.toExternalForm(), dResource.getFile().endsWith("/")); //$NON-NLS-1$ dResource = test.getEntry("a/b/c/d/"); //$NON-NLS-1$ - if (dResource != null) // note that File bundles will return non-null whilc jar'ed bundles will return null + if (dResource != null) // note that File bundles will return non-null whilc jar'ed bundles will return + // null assertFalse(dResource.toExternalForm(), dResource.getFile().endsWith("/")); //$NON-NLS-1$ } @@ -1134,7 +1169,7 @@ public void testGetEntryDir01() throws BundleException { @Test public void testGetResourceDir01() throws BundleException { Bundle test = installer.installBundle("test"); //$NON-NLS-1$ - installer.resolveBundles(new Bundle[] {test}); + installer.resolveBundles(new Bundle[] { test }); URL aDir = test.getResource("a"); //$NON-NLS-1$ assertNotNull("aDir", aDir); //$NON-NLS-1$ assertTrue(aDir.toExternalForm(), aDir.getFile().endsWith("/")); //$NON-NLS-1$ @@ -1154,7 +1189,8 @@ public void testGetResourceDir01() throws BundleException { assertFalse(dResource.toExternalForm(), dResource.getFile().endsWith("/")); //$NON-NLS-1$ dResource = test.getResource("a/b/c/d/"); //$NON-NLS-1$ - if (dResource != null) // note that File bundles will return non-null whilc jar'ed bundles will return null + if (dResource != null) // note that File bundles will return non-null whilc jar'ed bundles will return + // null assertFalse(dResource.toExternalForm(), dResource.getFile().endsWith("/")); //$NON-NLS-1$ } @@ -1171,7 +1207,9 @@ public void testBootGetResources01() throws Exception { assertEquals("manifest number", 1, manifestURLs.size()); //$NON-NLS-1$ URL manifest = manifestURLs.get(0); int dotIndex = manifest.getHost().indexOf('.'); - long bundleId = dotIndex >= 0 && dotIndex < manifest.getHost().length() - 1 ? Long.parseLong(manifest.getHost().substring(0, dotIndex)) : Long.parseLong(manifest.getHost()); + long bundleId = dotIndex >= 0 && dotIndex < manifest.getHost().length() - 1 + ? Long.parseLong(manifest.getHost().substring(0, dotIndex)) + : Long.parseLong(manifest.getHost()); assertEquals("host id", test.getBundleId(), bundleId); //$NON-NLS-1$ } @@ -1182,7 +1220,7 @@ public void testBootGetResources02() throws Exception { if (System.getProperty(Constants.FRAMEWORK_BOOTDELEGATION) != null) return; // cannot really test this if this property is set Bundle test = installer.installBundle("test"); //$NON-NLS-1$ - installer.resolveBundles(new Bundle[] {test}); + installer.resolveBundles(new Bundle[] { test }); BundleWiring wiring = test.adapt(BundleWiring.class); ClassLoader bcl = wiring.getClassLoader(); URLClassLoader cl = new URLClassLoader(new URL[0], bcl); @@ -1193,7 +1231,9 @@ public void testBootGetResources02() throws Exception { URL manifest = manifestURLs.get(0); assertEquals("wrong protocol", "bundleresource", manifest.getProtocol()); int dotIndex = manifest.getHost().indexOf('.'); - long bundleId = dotIndex >= 0 && dotIndex < manifest.getHost().length() - 1 ? Long.parseLong(manifest.getHost().substring(0, dotIndex)) : Long.parseLong(manifest.getHost()); + long bundleId = dotIndex >= 0 && dotIndex < manifest.getHost().length() - 1 + ? Long.parseLong(manifest.getHost().substring(0, dotIndex)) + : Long.parseLong(manifest.getHost()); assertEquals("host id", test.getBundleId(), bundleId); //$NON-NLS-1$ cl.close(); } @@ -1215,7 +1255,7 @@ public void testMultipleGetResources01a() throws Exception { Bundle test = installer.installBundle("test"); //$NON-NLS-1$ // test that we can get multiple resources from a bundle // and use that bundle's class loader as a parent - installer.resolveBundles(new Bundle[] {test}); + installer.resolveBundles(new Bundle[] { test }); BundleWiring wiring = test.adapt(BundleWiring.class); ClassLoader bcl = wiring.getClassLoader(); URLClassLoader cl = new URLClassLoader(new URL[0], bcl); @@ -1248,7 +1288,8 @@ public void testMultipleGetResources03() throws Exception { installer.installBundle("test"); //$NON-NLS-1$ Bundle test2 = installer.installBundle("test2"); //$NON-NLS-1$ // test that we can get multiple resources from a bundle - // test that using a context gives correct results for multiple resources (bug 261853) + // test that using a context gives correct results for multiple resources (bug + // 261853) Enumeration resources = test2.getResources("data/"); //$NON-NLS-1$ assertNotNull("resources", resources); //$NON-NLS-1$ List resourceURLs = Collections.list(resources); @@ -1264,7 +1305,7 @@ public void testListResources() throws BundleException { installer.installBundle("test"); //$NON-NLS-1$ Bundle test2 = installer.installBundle("test2"); //$NON-NLS-1$ - assertTrue("Could not resolve test2 bundle", installer.resolveBundles(new Bundle[] {test2})); + assertTrue("Could not resolve test2 bundle", installer.resolveBundles(new Bundle[] { test2 })); BundleWiring test2Wiring = test2.adapt(BundleWiring.class); Collection resources = test2Wiring.listResources("/", "*", 0); assertTrue("could not find resource", resources.contains("resource2")); @@ -1304,7 +1345,8 @@ public void testURLExternalFormat03() throws Exception { // test the external format of bundle resource URLs URL entry = test.getEntry("data/resource1"); //$NON-NLS-1$ assertNotNull("entry", entry); //$NON-NLS-1$ - URI uri1 = new URI(entry.getProtocol(), null, entry.getHost(), entry.getPort(), entry.getPath(), null, entry.getQuery()); + URI uri1 = new URI(entry.getProtocol(), null, entry.getHost(), entry.getPort(), entry.getPath(), null, + entry.getQuery()); URI uri2 = new URI(entry.getProtocol(), entry.getHost(), entry.getPath(), entry.getQuery()); URI uri3 = new URI(entry.toExternalForm()); @@ -1324,7 +1366,8 @@ public void testURLExternalFormat04() throws Exception { // test the external format of bundle resource URLs URL entry = test.getResource("data/resource1"); //$NON-NLS-1$ assertNotNull("entry", entry); //$NON-NLS-1$ - URI uri1 = new URI(entry.getProtocol(), null, entry.getHost(), entry.getPort(), entry.getPath(), null, entry.getQuery()); + URI uri1 = new URI(entry.getProtocol(), null, entry.getHost(), entry.getPort(), entry.getPath(), null, + entry.getQuery()); URI uri2 = new URI(entry.getProtocol(), entry.getHost(), entry.getPath(), entry.getQuery()); URI uri3 = new URI(entry.toExternalForm()); URL url1 = uri1.toURL(); @@ -1351,7 +1394,7 @@ public void testURI() throws URISyntaxException { public void testMultipleExportFragments01() throws Exception { Bundle host = installer.installBundle("host.multiple.exports"); //$NON-NLS-1$ Bundle frag = installer.installBundle("frag.multiple.exports"); //$NON-NLS-1$ - installer.resolveBundles(new Bundle[] {host, frag}); + installer.resolveBundles(new Bundle[] { host, frag }); PackageAdmin packageAdmin = installer.getPackageAdmin(); ExportedPackage[] hostExports = packageAdmin.getExportedPackages(host); assertEquals("Number host exports", 4, hostExports == null ? 0 : hostExports.length); //$NON-NLS-1$ @@ -1385,7 +1428,7 @@ public void testMultipleExportFragments02() throws Exception { Bundle frag = installer.installBundle("frag.multiple.exports"); //$NON-NLS-1$ Bundle client1 = installer.installBundle("client1.multiple.exports"); //$NON-NLS-1$ - installer.resolveBundles(new Bundle[] {host, frag, client1}); + installer.resolveBundles(new Bundle[] { host, frag, client1 }); client1.start(); client1.stop(); Object[] expectedEvents = new Object[4]; @@ -1403,7 +1446,7 @@ public void testMultipleExportFragments03() throws Exception { Bundle frag = installer.installBundle("frag.multiple.exports"); //$NON-NLS-1$ Bundle client2 = installer.installBundle("client2.multiple.exports"); //$NON-NLS-1$ - installer.resolveBundles(new Bundle[] {host, frag, client2}); + installer.resolveBundles(new Bundle[] { host, frag, client2 }); client2.start(); client2.stop(); Object[] expectedEvents = new Object[4]; @@ -1423,7 +1466,7 @@ public void testXFriends() throws Exception { Bundle test1 = installer.installBundle("xfriends.test1"); //$NON-NLS-1$ Bundle test2 = installer.installBundle("xfriends.test2"); //$NON-NLS-1$ Bundle test3 = installer.installBundle("xfriends.test3"); //$NON-NLS-1$ - installer.resolveBundles(new Bundle[] {test1, test2, test3}); + installer.resolveBundles(new Bundle[] { test1, test2, test3 }); test2.start(); test2.stop(); test3.start(); @@ -1443,20 +1486,22 @@ public void testXFriends() throws Exception { @Test public void testImporterExporter01() throws BundleException { Bundle importerExporter1 = installer.installBundle("exporter.importer1"); //$NON-NLS-1$ - installer.resolveBundles(new Bundle[] {importerExporter1}); + installer.resolveBundles(new Bundle[] { importerExporter1 }); PackageAdmin pa = installer.getPackageAdmin(); ExportedPackage[] origExportedPackages = pa.getExportedPackages("exporter.importer.test"); //$NON-NLS-1$ assertNotNull("No exporter.importer.test found", origExportedPackages); //$NON-NLS-1$ assertEquals("Wrong number of exports", 1, origExportedPackages.length); //$NON-NLS-1$ Bundle exporter = origExportedPackages[0].getExportingBundle(); assertEquals("Wrong exporter", importerExporter1, exporter); //$NON-NLS-1$ - // TODO need to get clarification from OSGi on what is returned by getImportingBundles when there is no importers + // TODO need to get clarification from OSGi on what is returned by + // getImportingBundles when there is no importers Bundle[] origImporters = origExportedPackages[0].getImportingBundles(); assertTrue("Should have no importers", origImporters == null || origImporters.length == 0); //$NON-NLS-1$ - // install another importer/exporter. This bundle should wire to the original exporter + // install another importer/exporter. This bundle should wire to the original + // exporter Bundle importerExporter2 = installer.installBundle("exporter.importer2"); //$NON-NLS-1$ - installer.resolveBundles(new Bundle[] {importerExporter2}); + installer.resolveBundles(new Bundle[] { importerExporter2 }); origImporters = origExportedPackages[0].getImportingBundles(); assertNotNull("No importers found", origImporters); //$NON-NLS-1$ @@ -1478,7 +1523,7 @@ public void testImporterExporter01() throws BundleException { public void testImporterExporter02() throws BundleException { Bundle importerExporter3 = installer.installBundle("exporter.importer3"); //$NON-NLS-1$ Bundle importerExporter4 = installer.installBundle("exporter.importer4"); //$NON-NLS-1$ - installer.resolveBundles(new Bundle[] {importerExporter3, importerExporter4}); + installer.resolveBundles(new Bundle[] { importerExporter3, importerExporter4 }); importerExporter3.start(); importerExporter3.stop(); @@ -1495,10 +1540,10 @@ public void testUninstallInUse01() throws BundleException { Bundle exporter1 = installer.installBundle("exporter.importer1"); //$NON-NLS-1$ BundleRevision iExporter1 = exporter1.adapt(BundleRevision.class); Bundle exporter2 = installer.installBundle("exporter.importer2"); //$NON-NLS-1$ - installer.resolveBundles(new Bundle[] {exporter1, exporter2}); + installer.resolveBundles(new Bundle[] { exporter1, exporter2 }); exporter1.uninstall(); Bundle importer = installer.installBundle("exporter.importer4"); //$NON-NLS-1$ - installer.resolveBundles(new Bundle[] {importer}); + installer.resolveBundles(new Bundle[] { importer }); BundleWiring importerWiring = importer.adapt(BundleWiring.class); assertNotNull("Bundle b has no wiring.", importerWiring); List bImports = importerWiring.getRequiredWires(PackageNamespace.PACKAGE_NAMESPACE); @@ -1509,7 +1554,7 @@ public void testUninstallInUse01() throws BundleException { @Test public void testBug207847() throws BundleException { Bundle test = installer.installBundle("test"); //$NON-NLS-1$ - installer.resolveBundles(new Bundle[] {test}); + installer.resolveBundles(new Bundle[] { test }); test.start(); Bundle frag1 = installer.installBundle("test.fragment1"); //$NON-NLS-1$ @@ -1517,7 +1562,7 @@ public void testBug207847() throws BundleException { Bundle frag3 = installer.installBundle("test.fragment3"); //$NON-NLS-1$ Bundle frag4 = installer.installBundle("test.fragment4"); //$NON-NLS-1$ Bundle frag5 = installer.installBundle("test.fragment5"); //$NON-NLS-1$ - installer.resolveBundles(new Bundle[] {frag1, frag2, frag3, frag4, frag5}); + installer.resolveBundles(new Bundle[] { frag1, frag2, frag3, frag4, frag5 }); assertTrue("host is not resolved", (test.getState() & Bundle.ACTIVE) != 0); //$NON-NLS-1$ assertTrue("frag1 is not resolved", (frag1.getState() & Bundle.RESOLVED) != 0); //$NON-NLS-1$ @@ -1531,14 +1576,14 @@ public void testBug207847() throws BundleException { public void testBug235958() throws BundleException { Bundle testX = installer.installBundle("test.bug235958.x"); //$NON-NLS-1$ Bundle testY = installer.installBundle("test.bug235958.y"); //$NON-NLS-1$ - installer.resolveBundles(new Bundle[] {testX, testY}); + installer.resolveBundles(new Bundle[] { testX, testY }); testX.start(); } @Test public void testBuddyClassLoadingRegistered1() throws Exception { Bundle registeredA = installer.installBundle("buddy.registered.a"); //$NON-NLS-1$ - installer.resolveBundles(new Bundle[] {registeredA}); + installer.resolveBundles(new Bundle[] { registeredA }); Enumeration testFiles = registeredA.getResources("resources/test.txt"); //$NON-NLS-1$ assertNotNull("testFiles", testFiles); //$NON-NLS-1$ ArrayList texts = new ArrayList<>(); @@ -1549,7 +1594,7 @@ public void testBuddyClassLoadingRegistered1() throws Exception { Bundle registeredATest1 = installer.installBundle("buddy.registered.a.test1"); //$NON-NLS-1$ Bundle registeredATest2 = installer.installBundle("buddy.registered.a.test2"); //$NON-NLS-1$ - installer.resolveBundles(new Bundle[] {registeredATest1, registeredATest2}); + installer.resolveBundles(new Bundle[] { registeredATest1, registeredATest2 }); testFiles = registeredA.getResources("resources/test.txt"); //$NON-NLS-1$ assertNotNull("testFiles", testFiles); //$NON-NLS-1$ texts = new ArrayList<>(); @@ -1566,7 +1611,7 @@ public void testBuddyClassLoadingRegistered1() throws Exception { @Test public void testBuddyClassLoadingRegistered2() throws Exception { Bundle registeredA = installer.installBundle("buddy.registered.a"); //$NON-NLS-1$ - installer.resolveBundles(new Bundle[] {registeredA}); + installer.resolveBundles(new Bundle[] { registeredA }); URL testFile = registeredA.getResource("resources/test1.txt"); //$NON-NLS-1$ assertNull("test1.txt", testFile); //$NON-NLS-1$ @@ -1575,7 +1620,7 @@ public void testBuddyClassLoadingRegistered2() throws Exception { Bundle registeredATest1 = installer.installBundle("buddy.registered.a.test1"); //$NON-NLS-1$ Bundle registeredATest2 = installer.installBundle("buddy.registered.a.test2"); //$NON-NLS-1$ - installer.resolveBundles(new Bundle[] {registeredATest1, registeredATest2}); + installer.resolveBundles(new Bundle[] { registeredATest1, registeredATest2 }); testFile = registeredA.getResource("resources/test1.txt"); //$NON-NLS-1$ assertNotNull("test1.txt", testFile); //$NON-NLS-1$ @@ -1589,14 +1634,14 @@ public void testBuddyClassLoadingRegistered2() throws Exception { @Test public void testBuddyClassLoadingRegistered3() throws Exception { Bundle registeredA = installer.installBundle("buddy.registered.a"); //$NON-NLS-1$ - installer.resolveBundles(new Bundle[] {registeredA}); + installer.resolveBundles(new Bundle[] { registeredA }); assertThrows(ClassNotFoundException.class, () -> registeredA.loadClass("buddy.registered.a.test1.ATest")); assertThrows(ClassNotFoundException.class, () -> registeredA.loadClass("buddy.registered.a.test2.ATest")); Bundle registeredATest1 = installer.installBundle("buddy.registered.a.test1"); //$NON-NLS-1$ Bundle registeredATest2 = installer.installBundle("buddy.registered.a.test2"); //$NON-NLS-1$ - installer.resolveBundles(new Bundle[] {registeredATest1, registeredATest2}); + installer.resolveBundles(new Bundle[] { registeredATest1, registeredATest2 }); assertNotNull("Class buddy.registered.a.test1.ATest", registeredA.loadClass("buddy.registered.a.test1.ATest")); assertNotNull("Class buddy.registered.a.test2.ATest", registeredA.loadClass("buddy.registered.a.test2.ATest")); @@ -1669,7 +1714,7 @@ public void testBuddyClassLoadingDependentListResources() throws Exception { @Test public void testBuddyClassLoadingDependent1() throws Exception { Bundle dependentA = installer.installBundle("buddy.dependent.a"); //$NON-NLS-1$ - installer.resolveBundles(new Bundle[] {dependentA}); + installer.resolveBundles(new Bundle[] { dependentA }); Enumeration testFiles = dependentA.getResources("resources/test.txt"); //$NON-NLS-1$ assertNotNull("testFiles", testFiles); //$NON-NLS-1$ ArrayList texts = new ArrayList<>(); @@ -1680,7 +1725,7 @@ public void testBuddyClassLoadingDependent1() throws Exception { Bundle dependentATest1 = installer.installBundle("buddy.dependent.a.test1"); //$NON-NLS-1$ Bundle dependentATest2 = installer.installBundle("buddy.dependent.a.test2"); //$NON-NLS-1$ - installer.resolveBundles(new Bundle[] {dependentATest1, dependentATest2}); + installer.resolveBundles(new Bundle[] { dependentATest1, dependentATest2 }); testFiles = dependentA.getResources("resources/test.txt"); //$NON-NLS-1$ assertNotNull("testFiles", testFiles); //$NON-NLS-1$ texts = new ArrayList<>(); @@ -1695,7 +1740,7 @@ public void testBuddyClassLoadingDependent1() throws Exception { @Test public void testBuddyClassLoadingDependent2() throws Exception { Bundle dependentA = installer.installBundle("buddy.dependent.a"); //$NON-NLS-1$ - installer.resolveBundles(new Bundle[] {dependentA}); + installer.resolveBundles(new Bundle[] { dependentA }); URL testFile = dependentA.getResource("resources/test1.txt"); //$NON-NLS-1$ assertNull("test1.txt", testFile); //$NON-NLS-1$ @@ -1704,7 +1749,7 @@ public void testBuddyClassLoadingDependent2() throws Exception { Bundle dependentATest1 = installer.installBundle("buddy.dependent.a.test1"); //$NON-NLS-1$ Bundle dependentATest2 = installer.installBundle("buddy.dependent.a.test2"); //$NON-NLS-1$ - installer.resolveBundles(new Bundle[] {dependentATest1, dependentATest2}); + installer.resolveBundles(new Bundle[] { dependentATest1, dependentATest2 }); testFile = dependentA.getResource("resources/test1.txt"); //$NON-NLS-1$ assertNotNull("test1.txt", testFile); //$NON-NLS-1$ @@ -1734,7 +1779,7 @@ public void testBuddyClassLoadingDependent3() throws Exception { @Test public void testBuddyClassLoadingInvalid() throws Exception { Bundle invalidA = installer.installBundle("buddy.invalid.a"); //$NON-NLS-1$ - installer.resolveBundles(new Bundle[] {invalidA}); + installer.resolveBundles(new Bundle[] { invalidA }); invalidA.getResource("doesNotExist"); assertThrows(ClassNotFoundException.class, () -> invalidA.loadClass("does.not.Exist")); //$NON-NLS-1$ @@ -1745,7 +1790,7 @@ public void testBuddyClassloadingBug438904() throws Exception { Bundle host = installer.installBundle("test.bug438904.host"); Bundle frag = installer.installBundle("test.bug438904.frag"); Bundle global = installer.installBundle("test.bug438904.global"); - installer.resolveBundles(new Bundle[] {host, frag, global}); + installer.resolveBundles(new Bundle[] { host, frag, global }); global.loadClass("test.bug438904.host.Test1"); global.loadClass("test.bug438904.frag.Test2"); } @@ -1890,13 +1935,14 @@ public void testBug306181() throws BundleException { sl.setBundleStartLevel(a, newSL); sl.setBundleStartLevel(b, newSL); - installer.resolveBundles(new Bundle[] {a, b}); + installer.resolveBundles(new Bundle[] { a, b }); a.start(); b.start(Bundle.START_ACTIVATION_POLICY); sl.setStartLevel(newSL); Object[] expectedFrameworkEvents = new Object[1]; - expectedFrameworkEvents[0] = new FrameworkEvent(FrameworkEvent.STARTLEVEL_CHANGED, OSGiTestsActivator.getContext().getBundle(0), null); + expectedFrameworkEvents[0] = new FrameworkEvent(FrameworkEvent.STARTLEVEL_CHANGED, + OSGiTestsActivator.getContext().getBundle(0), null); Object[] actualFrameworkEvents = frameworkListenerResults.getResults(1); compareResults(expectedFrameworkEvents, actualFrameworkEvents); @@ -1910,7 +1956,8 @@ public void testBug306181() throws BundleException { sl.setInitialBundleStartLevel(origBundleSL); sl.setStartLevel(origSL); Object[] expectedFrameworkEvents = new Object[1]; - expectedFrameworkEvents[0] = new FrameworkEvent(FrameworkEvent.STARTLEVEL_CHANGED, OSGiTestsActivator.getContext().getBundle(0), null); + expectedFrameworkEvents[0] = new FrameworkEvent(FrameworkEvent.STARTLEVEL_CHANGED, + OSGiTestsActivator.getContext().getBundle(0), null); Object[] actualFrameworkEvents = frameworkListenerResults.getResults(1); compareResults(expectedFrameworkEvents, actualFrameworkEvents); } @@ -1918,7 +1965,7 @@ public void testBug306181() throws BundleException { @Test public void testBug348805() throws BundleException { - final boolean[] endCalled = {false}; + final boolean[] endCalled = { false }; ResolverHookFactory error = triggers -> new ResolverHook() { public void filterSingletonCollisions(BundleCapability singleton, Collection collisionCandidates) { // Nothing @@ -1980,7 +2027,7 @@ public void end() { @Test public void testBug370258_beginException() throws BundleException { - final boolean[] endCalled = {false}; + final boolean[] endCalled = { false }; ResolverHookFactory endHook = triggers -> new ResolverHook() { public void filterSingletonCollisions(BundleCapability singleton, Collection collisionCandidates) { // Nothing @@ -2019,7 +2066,7 @@ public void end() { @Test public void testBug370258_endException() throws BundleException { - final boolean[] endCalled = {false}; + final boolean[] endCalled = { false }; ResolverHookFactory endHook = triggers -> new ResolverHook() { public void filterSingletonCollisions(BundleCapability singleton, Collection collisionCandidates) { // Nothing @@ -2105,7 +2152,7 @@ public void testBug490902() throws BundleException, InterruptedException, ClassN InstantiationException, IllegalAccessException { final Bundle a1 = installer.installBundle("test.bug490902.a"); final Bundle b1 = installer.installBundle("test.bug490902.b"); - installer.resolveBundles(new Bundle[] {a1, b1}); + installer.resolveBundles(new Bundle[] { a1, b1 }); final CountDownLatch startingB = new CountDownLatch(1); final CountDownLatch endedSecondThread = new CountDownLatch(1); @@ -2195,7 +2242,8 @@ public void run() { } @Override - public void ungetService(Bundle bundle, ServiceRegistration registration, WeavingHook service) { + public void ungetService(Bundle bundle, ServiceRegistration registration, + WeavingHook service) { // nothing } }; @@ -2224,7 +2272,8 @@ public void run() { assertEquals("Unexpected number of woven classes.", 2, called.size()); for (WovenClass wovenClass : called) { if (weavingHookClasses.contains(wovenClass.getClassName())) { - assertNull("Did not expect to find class: " + wovenClass.getDefinedClass(), wovenClass.getDefinedClass()); + assertNull("Did not expect to find class: " + wovenClass.getDefinedClass(), + wovenClass.getDefinedClass()); } else { assertEquals("Expected the inner runnable class.", run.getClass(), wovenClass.getDefinedClass()); } @@ -2234,12 +2283,13 @@ public void run() { @Test public void testLoaderUninstalledBundle() throws BundleException, IOException { String testResourcePath = "testResource"; - File config = OSGiTestsActivator.getContext().getDataFile(getName()); //$NON-NLS-1$ + File config = OSGiTestsActivator.getContext().getDataFile(getName()); // $NON-NLS-1$ Map testHeaders = new HashMap<>(); testHeaders.put(Constants.BUNDLE_MANIFESTVERSION, "2"); testHeaders.put(Constants.BUNDLE_SYMBOLICNAME, getName()); config.mkdirs(); - File testBundleFile = SystemBundleTests.createBundle(config, getName(), testHeaders, Collections.singletonMap(testResourcePath, "testValue")); + File testBundleFile = SystemBundleTests.createBundle(config, getName(), testHeaders, + Collections.singletonMap(testResourcePath, "testValue")); Bundle test = getContext().installBundle(getName(), new FileInputStream(testBundleFile)); test.start(); BundleWiring wiring = test.adapt(BundleWiring.class); @@ -2252,7 +2302,7 @@ public void testLoaderUninstalledBundle() throws BundleException, IOException { testResource = bundleClassLoader.findLocalResource(testResourcePath); assertNull("Found resource.", testResource); - Object[] expectedFrameworkEvents = new Object[] {new FrameworkEvent(FrameworkEvent.INFO, test, null)}; + Object[] expectedFrameworkEvents = new Object[] { new FrameworkEvent(FrameworkEvent.INFO, test, null) }; Object[] actualFrameworkEvents = frameworkListenerResults.getResults(1); compareResults(expectedFrameworkEvents, actualFrameworkEvents); @@ -2273,7 +2323,7 @@ public void testLoaderUninstalledBundle() throws BundleException, IOException { @Test public void testStaleLoaderNPE() throws BundleException, IOException, InterruptedException { - File config = OSGiTestsActivator.getContext().getDataFile(getName()); //$NON-NLS-1$ + File config = OSGiTestsActivator.getContext().getDataFile(getName()); // $NON-NLS-1$ config.mkdirs(); Map exporterHeaders = new HashMap<>(); @@ -2289,7 +2339,8 @@ public void testStaleLoaderNPE() throws BundleException, IOException, Interrupte exporterContent.put("export3/resource.txt", "resource.txt"); exporterContent.put("export4/", null); exporterContent.put("export4/resource.txt", "resource.txt"); - File exporterBundleFile = SystemBundleTests.createBundle(config, getName() + "-exporter", exporterHeaders, exporterContent); + File exporterBundleFile = SystemBundleTests.createBundle(config, getName() + "-exporter", exporterHeaders, + exporterContent); Map importerHeaders = new HashMap<>(); importerHeaders.put(Constants.BUNDLE_MANIFESTVERSION, "2"); @@ -2299,7 +2350,8 @@ public void testStaleLoaderNPE() throws BundleException, IOException, Interrupte importerContent.put("importer/", null); importerContent.put("importer/resource.txt", "resource.txt"); importerContent.put("importer/SomeClass.class", "SomeClass.class"); - File importerBundleFile = SystemBundleTests.createBundle(config, getName() + "-importer", importerHeaders, importerContent); + File importerBundleFile = SystemBundleTests.createBundle(config, getName() + "-importer", importerHeaders, + importerContent); Map requirerHeaders = new HashMap<>(); requirerHeaders.put(Constants.BUNDLE_MANIFESTVERSION, "2"); @@ -2309,13 +2361,15 @@ public void testStaleLoaderNPE() throws BundleException, IOException, Interrupte requirerContent.put("requirer/", null); requirerContent.put("requirer/resource.txt", "resource.txt"); requirerContent.put("requirer/SomeClass.class", "SomeClass.class"); - File requirerBundleFile = SystemBundleTests.createBundle(config, getName() + "-requirer", requirerHeaders, requirerContent); + File requirerBundleFile = SystemBundleTests.createBundle(config, getName() + "-requirer", requirerHeaders, + requirerContent); Bundle exporter = getContext().installBundle(getName() + "-exporter", new FileInputStream(exporterBundleFile)); exporter.start(); Bundle importer = getContext().installBundle(getName() + "-importer", new FileInputStream(importerBundleFile)); importer.start(); - final Bundle requirer = getContext().installBundle(getName() + "-requirer", new FileInputStream(requirerBundleFile)); + final Bundle requirer = getContext().installBundle(getName() + "-requirer", + new FileInputStream(requirerBundleFile)); requirer.start(); BundleWiring importerWiring = importer.adapt(BundleWiring.class); @@ -2338,7 +2392,8 @@ public void testStaleLoaderNPE() throws BundleException, IOException, Interrupte // invalid wires by refreshing the exporter refreshBundles(Collections.singleton(exporter)); - // add a framework event listener to find error message about invalud class loaders + // add a framework event listener to find error message about invalud class + // loaders final BlockingQueue events = new LinkedBlockingQueue<>(); getContext().addFrameworkListener(event -> { if (event.getBundle() == requirer) { @@ -2368,7 +2423,8 @@ public void testStaleLoaderNPE() throws BundleException, IOException, Interrupte assertEquals("Wrong bundle for event.", requirer, event.getBundle()); assertEquals("Wrong event type.", FrameworkEvent.ERROR, event.getType()); assertTrue("Wrong exception: " + event.getThrowable(), event.getThrowable() instanceof RuntimeException); - assertTrue("Wrong message: " + event.getThrowable().getMessage(), event.getThrowable().getMessage().startsWith("Invalid class loader")); + assertTrue("Wrong message: " + event.getThrowable().getMessage(), + event.getThrowable().getMessage().startsWith("Invalid class loader")); // make sure there are no others assertNull("Found more events.", events.poll(1, TimeUnit.SECONDS)); @@ -2448,11 +2504,12 @@ public void testBug565522FragmentClasspath() throws Exception { void refreshBundles(Collection bundles) throws InterruptedException { final CountDownLatch refreshSignal = new CountDownLatch(1); - getContext().getBundle(Constants.SYSTEM_BUNDLE_LOCATION).adapt(FrameworkWiring.class).refreshBundles(bundles, event -> { - if (event.getType() == FrameworkEvent.PACKAGES_REFRESHED) { - refreshSignal.countDown(); - } - }); + getContext().getBundle(Constants.SYSTEM_BUNDLE_LOCATION).adapt(FrameworkWiring.class).refreshBundles(bundles, + event -> { + if (event.getType() == FrameworkEvent.PACKAGES_REFRESHED) { + refreshSignal.countDown(); + } + }); refreshSignal.await(30, TimeUnit.SECONDS); } } diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/ConnectTests.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/ConnectTests.java index ea5d1a1d68b..d74ec56338a 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/ConnectTests.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/ConnectTests.java @@ -12,6 +12,7 @@ * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.osgi.tests.bundles; + import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotEquals; @@ -837,20 +838,20 @@ public void testGetConnectHeaders() throws Exception { doTestConnect(connector, Collections.singletonMap(HookRegistry.PROP_HOOK_CONFIGURATORS_EXCLUDE, "org.eclipse.equinox.weaving.hooks.WeavingHook"), f -> { - try { - f.start(); - Bundle b = f.getBundleContext().getBundle(NAME); - assertFalse("Content is not closed", m.getContent().isOpen()); - // Bundle.getHeaders() will eventually call - // ConnectBundleFile.getConnectHeaders() which opens the connect content - headers2.set(b.getHeaders()); - assertTrue("Content is not open", m.getContent().isOpen()); - f.stop(); - f.waitForStop(5000); - } catch (Throwable t) { - sneakyThrow(t); - } - }); + try { + f.start(); + Bundle b = f.getBundleContext().getBundle(NAME); + assertFalse("Content is not closed", m.getContent().isOpen()); + // Bundle.getHeaders() will eventually call + // ConnectBundleFile.getConnectHeaders() which opens the connect content + headers2.set(b.getHeaders()); + assertTrue("Content is not open", m.getContent().isOpen()); + f.stop(); + f.waitForStop(5000); + } catch (Throwable t) { + sneakyThrow(t); + } + }); Dictionary h1 = headers1.get(); Dictionary h2 = headers2.get(); @@ -945,12 +946,10 @@ public void testJavaExportsConnect() { f.start(); Bundle b = f.getBundleContext().installBundle("javaExport"); b.start(); - assertTrue("No java export found.", - b.adapt(BundleWiring.class).getCapabilities(PackageNamespace.PACKAGE_NAMESPACE).stream() - .findFirst() - .map(c -> "java.test.export" - .equals(c.getAttributes().get(PackageNamespace.PACKAGE_NAMESPACE))) - .orElse(false)); + assertTrue("No java export found.", b.adapt(BundleWiring.class) + .getCapabilities(PackageNamespace.PACKAGE_NAMESPACE).stream().findFirst() + .map(c -> "java.test.export".equals(c.getAttributes().get(PackageNamespace.PACKAGE_NAMESPACE))) + .orElse(false)); } catch (Throwable t) { sneakyThrow(t); } diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/DiscardBundleTests.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/DiscardBundleTests.java index 0e08b167de7..9896eade9e1 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/DiscardBundleTests.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/DiscardBundleTests.java @@ -122,8 +122,7 @@ public void testLimitResolutionAfterDiscard() throws Exception { // Install non extension bundles. // If a discarded bundle causes on of these bundles to refresh then // it should not be allowed to resolve. - File discard = createBundle(root, "discard", - Collections.singletonMap("Export-Package", "discard")); + File discard = createBundle(root, "discard", Collections.singletonMap("Export-Package", "discard")); String discardLocation = REFERENCE_PROTOCOL + discard.toURI(); // Optionally import the package from a discarded bundle @@ -148,8 +147,7 @@ public void testLimitResolutionAfterDiscard() throws Exception { extensionHeaders.remove(Constants.EXPORT_PACKAGE); extensionHeaders.put(Constants.BUNDLE_SYMBOLICNAME, "importDiscardExtension"); extensionHeaders.put(Constants.IMPORT_PACKAGE, "discard.extesion; resolution:=optional"); - File importDiscardExtension = createBundle(root, "importDiscardExtension", - extensionHeaders); + File importDiscardExtension = createBundle(root, "importDiscardExtension", extensionHeaders); String importDiscardExtensionLocation = REFERENCE_PROTOCOL + importDiscardExtension.toURI(); equinox.getBundleContext().installBundle(discardLocation).start(); diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/ExtensionBundleTests.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/ExtensionBundleTests.java index 4d4fb923641..a2c95b19a4d 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/ExtensionBundleTests.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/ExtensionBundleTests.java @@ -36,7 +36,7 @@ public class ExtensionBundleTests extends AbstractBundleTests { public void testFrameworkExtension01() throws Exception { Bundle fwkext = installer.installBundle("ext.framework.a", false); //$NON-NLS-1$ Bundle importer = installer.installBundle("ext.framework.a.importer"); //$NON-NLS-1$ - installer.resolveBundles(new Bundle[] {fwkext, importer}); + installer.resolveBundles(new Bundle[] { fwkext, importer }); importer.start(); importer.stop(); @@ -50,7 +50,7 @@ public void testFrameworkExtension01() throws Exception { public void testFrameworkExtension02() throws Exception { Bundle fwkext = installer.installBundle("ext.framework.a", false); //$NON-NLS-1$ Bundle importer = installer.installBundle("ext.framework.a.requires"); //$NON-NLS-1$ - installer.resolveBundles(new Bundle[] {fwkext, importer}); + installer.resolveBundles(new Bundle[] { fwkext, importer }); importer.start(); importer.stop(); @@ -64,7 +64,7 @@ public void testFrameworkExtension02() throws Exception { public void testExtClasspathExtension01() throws Exception { Bundle fwkext = installer.installBundle("ext.extclasspath.a", false); //$NON-NLS-1$ Bundle importer = installer.installBundle("ext.extclasspath.a.importer"); //$NON-NLS-1$ - installer.resolveBundles(new Bundle[] {fwkext, importer}); + installer.resolveBundles(new Bundle[] { fwkext, importer }); importer.start(); importer.stop(); @@ -77,15 +77,18 @@ public void testExtClasspathExtension01() throws Exception { @Test public void testExtensionBundleWithRequireCapabilityOsgiEeInstalls() throws BundleException { Bundle b = installer.installBundle("ext.framework.osgiee.b", false); - assertTrue("Could not resolve bundle: " + b, installer.resolveBundles(new Bundle[] {b})); + assertTrue("Could not resolve bundle: " + b, installer.resolveBundles(new Bundle[] { b })); BundleWiring wiring = b.adapt(BundleWiring.class); assertNotNull("No wiring for bundle: " + b, wiring); List allRequired = wiring.getRequiredWires(null); assertEquals("Wrong number of wires: " + allRequired, 2, allRequired.size()); BundleWire hostWire = wiring.getRequiredWires(HostNamespace.HOST_NAMESPACE).get(0); - assertEquals("Wrong provider for host: " + hostWire.getProvider().getBundle(), 0, hostWire.getProvider().getBundle().getBundleId()); - BundleWire eeWire = wiring.getRequiredWires(ExecutionEnvironmentNamespace.EXECUTION_ENVIRONMENT_NAMESPACE).get(0); - assertEquals("Wrong provider for osgi.ee: " + eeWire.getProvider().getBundle(), 0, eeWire.getProvider().getBundle().getBundleId()); + assertEquals("Wrong provider for host: " + hostWire.getProvider().getBundle(), 0, + hostWire.getProvider().getBundle().getBundleId()); + BundleWire eeWire = wiring.getRequiredWires(ExecutionEnvironmentNamespace.EXECUTION_ENVIRONMENT_NAMESPACE) + .get(0); + assertEquals("Wrong provider for osgi.ee: " + eeWire.getProvider().getBundle(), 0, + eeWire.getProvider().getBundle().getBundleId()); } @Test @@ -93,7 +96,7 @@ public void testActivatorOrder() throws Exception { Bundle b = installer.installBundle("ext.framework.a", false); Bundle bImp = installer.installBundle("ext.framework.a.importer"); Bundle bReq = installer.installBundle("ext.framework.a.requires"); - installer.resolveBundles(new Bundle[] {b, bImp, bReq}); + installer.resolveBundles(new Bundle[] { b, bImp, bReq }); try { bImp.start(); @@ -101,7 +104,9 @@ public void testActivatorOrder() throws Exception { } finally { installer.uninstallAllBundles(); } - List expectedEvents = Arrays.asList(bImp.getSymbolicName() + " STARTED", bReq.getSymbolicName() + " STARTED", bReq.getSymbolicName() + " STOPPED", bImp.getSymbolicName() + " STOPPED"); + List expectedEvents = Arrays.asList(bImp.getSymbolicName() + " STARTED", + bReq.getSymbolicName() + " STARTED", bReq.getSymbolicName() + " STOPPED", + bImp.getSymbolicName() + " STOPPED"); assertEquals("Expected number of events not found", expectedEvents.size(), events.size()); for (int i = 0; i < events.size(); i++) { assertEquals("Expected event not found", expectedEvents.get(i), events.get(i)); diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/ImportJavaSEPackagesTests.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/ImportJavaSEPackagesTests.java index 38e7ba73c6b..0395220608c 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/ImportJavaSEPackagesTests.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/ImportJavaSEPackagesTests.java @@ -73,8 +73,10 @@ public void testExportPackageCannotContainJavaPackages() throws Exception { Bundle testBundle = systemContext.installBundle(bundle.toURI().toString()); testBundle.start(); }); - assertEquals("It should throw a bundle exception of type manifest error", BundleException.MANIFEST_ERROR, e.getType()); - assertTrue("It should throw a Bundle Exception stating Invalid manifest header Export-Package", e.getMessage().contains("Cannot specify java.* packages in Export headers")); + assertEquals("It should throw a bundle exception of type manifest error", BundleException.MANIFEST_ERROR, + e.getType()); + assertTrue("It should throw a Bundle Exception stating Invalid manifest header Export-Package", + e.getMessage().contains("Cannot specify java.* packages in Export headers")); } finally { stopQuietly(equinox); } @@ -97,10 +99,13 @@ public void testImportPackageCanContainJavaPackages() throws Exception { Bundle testBundle = systemContext.installBundle(bundle.toURI().toString()); testBundle.start(); Dictionary testHeaders = testBundle.getHeaders(); - assertTrue(Constants.IMPORT_PACKAGE + " does not contain the java.* package", testHeaders.get(Constants.IMPORT_PACKAGE).contains(JAVA_LANG)); - List pkgWires = testBundle.adapt(BundleWiring.class).getRequiredWires(PackageNamespace.PACKAGE_NAMESPACE); + assertTrue(Constants.IMPORT_PACKAGE + " does not contain the java.* package", + testHeaders.get(Constants.IMPORT_PACKAGE).contains(JAVA_LANG)); + List pkgWires = testBundle.adapt(BundleWiring.class) + .getRequiredWires(PackageNamespace.PACKAGE_NAMESPACE); assertEquals("Wrong number of package requiremens: ", 1, pkgWires.size()); - assertEquals("Wrong package found: " + pkgWires.get(0), JAVA_LANG, pkgWires.get(0).getCapability().getAttributes().get(PackageNamespace.PACKAGE_NAMESPACE)); + assertEquals("Wrong package found: " + pkgWires.get(0), JAVA_LANG, + pkgWires.get(0).getCapability().getAttributes().get(PackageNamespace.PACKAGE_NAMESPACE)); } finally { stopQuietly(equinox); } @@ -143,10 +148,11 @@ private int calculateJavaPackageCount() throws Exception { Object descriptor = getDescriptor.invoke(m); if ((Boolean) isAutomatic.invoke(descriptor)) { /* - * Automatic modules are supposed to export all their packages. - * However, java.lang.module.ModuleDescriptor::exports returns an empty set for them. - * Add all their packages (as returned by java.lang.module.ModuleDescriptor::packages) - * to the list of VM supplied packages. + * Automatic modules are supposed to export all their packages. However, + * java.lang.module.ModuleDescriptor::exports returns an empty set for them. Add + * all their packages (as returned by + * java.lang.module.ModuleDescriptor::packages) to the list of VM supplied + * packages. */ for (String packageName : ((Set) packagesMethod.invoke(descriptor))) { if (packageName.startsWith("java.")) { @@ -184,9 +190,12 @@ public void doSystemPackages(int rv, int expectedPackages) throws Exception { equinox.start(); BundleContext systemContext = equinox.getBundleContext(); Dictionary testHeaders = equinox.getHeaders(); - assertTrue(Constants.EXPORT_PACKAGE + " does not contain the java.lang package", testHeaders.get(Constants.EXPORT_PACKAGE).contains(JAVA_LANG)); - assertTrue(Constants.EXPORT_PACKAGE + " does not contain the java.util package", testHeaders.get(Constants.EXPORT_PACKAGE).contains(JAVA_UTIL)); - List capabilities = equinox.adapt(BundleWiring.class).getCapabilities(PackageNamespace.PACKAGE_NAMESPACE); + assertTrue(Constants.EXPORT_PACKAGE + " does not contain the java.lang package", + testHeaders.get(Constants.EXPORT_PACKAGE).contains(JAVA_LANG)); + assertTrue(Constants.EXPORT_PACKAGE + " does not contain the java.util package", + testHeaders.get(Constants.EXPORT_PACKAGE).contains(JAVA_UTIL)); + List capabilities = equinox.adapt(BundleWiring.class) + .getCapabilities(PackageNamespace.PACKAGE_NAMESPACE); int count = 0; for (BundleCapability cap : capabilities) { diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/ListenerTests.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/ListenerTests.java index 91223bd03b0..90f1696321a 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/ListenerTests.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/ListenerTests.java @@ -94,7 +94,7 @@ public void testBundleListenersOrder() throws Exception { j = j + 2; } - //synchronous listener will be called first + // synchronous listener will be called first i = 0; for (Bundle b : bundles) { BundleListener bundleListener = createSynchronousBundleListener(); diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/LoggingTests.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/LoggingTests.java index 0b1249c3ff7..956d6669868 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/LoggingTests.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/LoggingTests.java @@ -61,7 +61,8 @@ class LogServiceReference { private final ServiceReference fwkLogRef; final FrameworkLog fwkLog; - public LogServiceReference(ServiceReference logRef, ExtendedLogService logService, ServiceReference readerRef, ExtendedLogReaderService readerService, ServiceReference fwkLogRef, FrameworkLog fwkLog) { + public LogServiceReference(ServiceReference logRef, ExtendedLogService logService, ServiceReference readerRef, + ExtendedLogReaderService readerService, ServiceReference fwkLogRef, FrameworkLog fwkLog) { this.logRef = logRef; this.logService = logService; @@ -214,7 +215,8 @@ public void testLogService() throws BundleException { iLogListener2.addContext(new ArrayList(context)); logListener.addContext(new ArrayList(context)); - logger.log(new FrameworkLogEntry(a, testBundle.getSymbolicName(), a.getSeverity(), a.getCode(), a.getMessage(), 0, null, null), LogService.LOG_ERROR, a.getMessage()); + logger.log(new FrameworkLogEntry(a, testBundle.getSymbolicName(), a.getSeverity(), a.getCode(), + a.getMessage(), 0, null, null), LogService.LOG_ERROR, a.getMessage()); assertTrue("Missing context", iLogListener1.waitforContext()); assertTrue("Missing context", iLogListener2.waitforContext()); assertTrue("Missing context", logListener.waitforContext()); @@ -338,7 +340,8 @@ public void testFrameworkLog() throws BundleException { Platform.addLogListener(iLogListener2); logRef.readerService.addLogListener(logListener, logListener); try { - FrameworkLogEntry fwkLogEntry = new FrameworkLogEntry(a, testBundle.getSymbolicName(), a.getSeverity(), a.getCode(), a.getMessage(), 0, null, null); + FrameworkLogEntry fwkLogEntry = new FrameworkLogEntry(a, testBundle.getSymbolicName(), a.getSeverity(), + a.getCode(), a.getMessage(), 0, null, null); logRef.fwkLog.log(fwkLogEntry); assertTrue("Missing context", iLogListener1.waitforContext()); assertTrue("Missing context", iLogListener2.waitforContext()); @@ -358,7 +361,8 @@ public void testFrameworkLog() throws BundleException { logListener.addContext(new ArrayList(context)); logListener.entries.clear(); - logRef.fwkLog.log(new FrameworkLogEntry(testBundle.getSymbolicName(), a.getSeverity(), a.getCode(), a.getMessage(), 0, null, null)); + logRef.fwkLog.log(new FrameworkLogEntry(testBundle.getSymbolicName(), a.getSeverity(), a.getCode(), + a.getMessage(), 0, null, null)); assertTrue("Missing context", iLogListener1.waitforContext()); assertTrue("Missing context", iLogListener2.waitforContext()); // there is no status here @@ -457,12 +461,14 @@ public void testBug347183() throws BundleException { ILogListener recurseLog = (status, plugin) -> ILog.of(testBundle).log(status); Platform.addLogListener(recurseLog); try { - logRef.fwkLog.log(new FrameworkLogEntry(getContext().getBundle().getSymbolicName(), FrameworkLogEntry.ERROR, 0, "Test message", 0, null, null)); + logRef.fwkLog.log(new FrameworkLogEntry(getContext().getBundle().getSymbolicName(), FrameworkLogEntry.ERROR, + 0, "Test message", 0, null, null)); // prime the log so we don't have to create it in the logging call ILog.of(testBundle); - logRef.fwkLog.log(new FrameworkLogEntry(getContext().getBundle().getSymbolicName(), FrameworkLogEntry.ERROR, 0, "Test message", 0, null, null)); + logRef.fwkLog.log(new FrameworkLogEntry(getContext().getBundle().getSymbolicName(), FrameworkLogEntry.ERROR, + 0, "Test message", 0, null, null)); } finally { Platform.removeLogListener(recurseLog); } diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/MultiReleaseJarTests.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/MultiReleaseJarTests.java index f35244ef350..63ef77222d7 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/MultiReleaseJarTests.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/MultiReleaseJarTests.java @@ -101,62 +101,92 @@ private static File createMRJarBundle() throws BundleException, IOException { bundleEntries.put("multi/", null); bundleEntries.put("multi/release/", null); bundleEntries.put("multi/release/test/", null); - bundleEntries.put("multi/release/test/TestClassBase.class", getBytes("multi/release/test/TestClassBase.class", base)); + bundleEntries.put("multi/release/test/TestClassBase.class", + getBytes("multi/release/test/TestClassBase.class", base)); bundleEntries.put("multi/release/test/TestClass8.class", getBytes("multi/release/test/TestClass8.class", base)); bundleEntries.put("multi/release/test/TestClass9.class", getBytes("multi/release/test/TestClass9.class", base)); - bundleEntries.put("multi/release/test/TestClass10.class", getBytes("multi/release/test/TestClass10.class", base)); - bundleEntries.put("multi/release/test/TestClass11.class", getBytes("multi/release/test/TestClass11.class", base)); - bundleEntries.put("multi/release/test/TestService.class", getBytes("multi/release/test/TestService.class", base)); - bundleEntries.put("multi/release/test/TestService9.class", getBytes("multi/release/test/TestService9.class", base)); - bundleEntries.put("multi/release/test/TestServiceBase.class", getBytes("multi/release/test/TestServiceBase.class", base)); - - bundleEntries.put("multi/release/test/testResourceBase.txt", getBytes("multi/release/test/testResourceBase.txt", base)); - bundleEntries.put("multi/release/test/testResource8.txt", getBytes("multi/release/test/testResource8.txt", base)); - bundleEntries.put("multi/release/test/testResource9.txt", getBytes("multi/release/test/testResource9.txt", base)); - bundleEntries.put("multi/release/test/testResource10.txt", getBytes("multi/release/test/testResource10.txt", base)); - bundleEntries.put("multi/release/test/testResource11.txt", getBytes("multi/release/test/testResource11.txt", base)); + bundleEntries.put("multi/release/test/TestClass10.class", + getBytes("multi/release/test/TestClass10.class", base)); + bundleEntries.put("multi/release/test/TestClass11.class", + getBytes("multi/release/test/TestClass11.class", base)); + bundleEntries.put("multi/release/test/TestService.class", + getBytes("multi/release/test/TestService.class", base)); + bundleEntries.put("multi/release/test/TestService9.class", + getBytes("multi/release/test/TestService9.class", base)); + bundleEntries.put("multi/release/test/TestServiceBase.class", + getBytes("multi/release/test/TestServiceBase.class", base)); + + bundleEntries.put("multi/release/test/testResourceBase.txt", + getBytes("multi/release/test/testResourceBase.txt", base)); + bundleEntries.put("multi/release/test/testResource8.txt", + getBytes("multi/release/test/testResource8.txt", base)); + bundleEntries.put("multi/release/test/testResource9.txt", + getBytes("multi/release/test/testResource9.txt", base)); + bundleEntries.put("multi/release/test/testResource10.txt", + getBytes("multi/release/test/testResource10.txt", base)); + bundleEntries.put("multi/release/test/testResource11.txt", + getBytes("multi/release/test/testResource11.txt", base)); bundleEntries.put("META-INF/services/", null); - bundleEntries.put("META-INF/services/multi.release.test.TestService", "multi.release.test.TestServiceBase".getBytes(StandardCharsets.UTF_8)); + bundleEntries.put("META-INF/services/multi.release.test.TestService", + "multi.release.test.TestServiceBase".getBytes(StandardCharsets.UTF_8)); bundleEntries.put("META-INF/versions/", null); bundleEntries.put("META-INF/versions/8/", null); bundleEntries.put("META-INF/versions/8/multi/", null); bundleEntries.put("META-INF/versions/8/multi/release/", null); bundleEntries.put("META-INF/versions/8/multi/release/test/", null); - bundleEntries.put("META-INF/versions/8/multi/release/test/TestClass8.class", getBytes("multi/release/test/TestClass8.class", base, new byte[] {'0', '8'})); - bundleEntries.put("META-INF/versions/8/multi/release/test/TestClassAdd8.class", getBytes("multi/release/test/TestClassAdd8.class", base)); - bundleEntries.put("META-INF/versions/8/multi/release/test/testResource8.txt", getBytes("multi/release/test/testResource8.txt", base, new byte[] {'0', '8'})); - bundleEntries.put("META-INF/versions/8/multi/release/test/testResourceAdd8.txt", getBytes("multi/release/test/testResourceAdd8.txt", base)); + bundleEntries.put("META-INF/versions/8/multi/release/test/TestClass8.class", + getBytes("multi/release/test/TestClass8.class", base, new byte[] { '0', '8' })); + bundleEntries.put("META-INF/versions/8/multi/release/test/TestClassAdd8.class", + getBytes("multi/release/test/TestClassAdd8.class", base)); + bundleEntries.put("META-INF/versions/8/multi/release/test/testResource8.txt", + getBytes("multi/release/test/testResource8.txt", base, new byte[] { '0', '8' })); + bundleEntries.put("META-INF/versions/8/multi/release/test/testResourceAdd8.txt", + getBytes("multi/release/test/testResourceAdd8.txt", base)); bundleEntries.put("META-INF/versions/9/", null); bundleEntries.put("META-INF/versions/9/META-INF/", null); bundleEntries.put("META-INF/versions/9/META-INF/addedFor9.txt", "added for 9".getBytes(StandardCharsets.UTF_8)); bundleEntries.put("META-INF/versions/9/META-INF/addedDirFor9/", null); - bundleEntries.put("META-INF/versions/9/META-INF/addedDirFor9/addedFor9.txt", "added for 9".getBytes(StandardCharsets.UTF_8)); + bundleEntries.put("META-INF/versions/9/META-INF/addedDirFor9/addedFor9.txt", + "added for 9".getBytes(StandardCharsets.UTF_8)); bundleEntries.put("META-INF/versions/9/META-INF/services/", null); - bundleEntries.put("META-INF/versions/9/META-INF/services/multi.release.test.TestService", "multi.release.test.TestService9".getBytes(StandardCharsets.UTF_8)); + bundleEntries.put("META-INF/versions/9/META-INF/services/multi.release.test.TestService", + "multi.release.test.TestService9".getBytes(StandardCharsets.UTF_8)); bundleEntries.put("META-INF/versions/9/multi/", null); bundleEntries.put("META-INF/versions/9/multi/release/", null); bundleEntries.put("META-INF/versions/9/multi/release/test/", null); - bundleEntries.put("META-INF/versions/9/multi/release/test/TestClass9.class", getBytes("multi/release/test/TestClass9.class", base, new byte[] {'0', '9'})); - bundleEntries.put("META-INF/versions/9/multi/release/test/TestClassAdd9.class", getBytes("multi/release/test/TestClassAdd9.class", base)); - bundleEntries.put("META-INF/versions/9/multi/release/test/testResource9.txt", getBytes("multi/release/test/testResource9.txt", base, new byte[] {'0', '9'})); - bundleEntries.put("META-INF/versions/9/multi/release/test/testResourceAdd9.txt", getBytes("multi/release/test/testResourceAdd9.txt", base)); + bundleEntries.put("META-INF/versions/9/multi/release/test/TestClass9.class", + getBytes("multi/release/test/TestClass9.class", base, new byte[] { '0', '9' })); + bundleEntries.put("META-INF/versions/9/multi/release/test/TestClassAdd9.class", + getBytes("multi/release/test/TestClassAdd9.class", base)); + bundleEntries.put("META-INF/versions/9/multi/release/test/testResource9.txt", + getBytes("multi/release/test/testResource9.txt", base, new byte[] { '0', '9' })); + bundleEntries.put("META-INF/versions/9/multi/release/test/testResourceAdd9.txt", + getBytes("multi/release/test/testResourceAdd9.txt", base)); bundleEntries.put("META-INF/versions/10/", null); bundleEntries.put("META-INF/versions/10/multi/", null); bundleEntries.put("META-INF/versions/10/multi/release/", null); bundleEntries.put("META-INF/versions/10/multi/release/test/", null); - bundleEntries.put("META-INF/versions/10/multi/release/test/TestClass10.class", getBytes("multi/release/test/TestClass10.class", base, new byte[] {'1', '0'})); - bundleEntries.put("META-INF/versions/10/multi/release/test/TestClassAdd10.class", getBytes("multi/release/test/TestClassAdd10.class", base)); - bundleEntries.put("META-INF/versions/10/multi/release/test/testResource10.txt", getBytes("multi/release/test/testResource10.txt", base, new byte[] {'1', '0'})); - bundleEntries.put("META-INF/versions/10/multi/release/test/testResourceAdd10.txt", getBytes("multi/release/test/testResourceAdd10.txt", base)); + bundleEntries.put("META-INF/versions/10/multi/release/test/TestClass10.class", + getBytes("multi/release/test/TestClass10.class", base, new byte[] { '1', '0' })); + bundleEntries.put("META-INF/versions/10/multi/release/test/TestClassAdd10.class", + getBytes("multi/release/test/TestClassAdd10.class", base)); + bundleEntries.put("META-INF/versions/10/multi/release/test/testResource10.txt", + getBytes("multi/release/test/testResource10.txt", base, new byte[] { '1', '0' })); + bundleEntries.put("META-INF/versions/10/multi/release/test/testResourceAdd10.txt", + getBytes("multi/release/test/testResourceAdd10.txt", base)); bundleEntries.put("META-INF/versions/11/", null); bundleEntries.put("META-INF/versions/11/multi/", null); bundleEntries.put("META-INF/versions/11/multi/release/", null); bundleEntries.put("META-INF/versions/11/multi/release/test/", null); - bundleEntries.put("META-INF/versions/11/multi/release/test/TestClass11.class", getBytes("multi/release/test/TestClass11.class", base, new byte[] {'1', '1'})); - bundleEntries.put("META-INF/versions/11/multi/release/test/TestClassAdd11.class", getBytes("multi/release/test/TestClassAdd11.class", base)); - bundleEntries.put("META-INF/versions/11/multi/release/test/testResource11.txt", getBytes("multi/release/test/testResource11.txt", base, new byte[] {'1', '1'})); - bundleEntries.put("META-INF/versions/11/multi/release/test/testResourceAdd11.txt", getBytes("multi/release/test/testResourceAdd11.txt", base)); + bundleEntries.put("META-INF/versions/11/multi/release/test/TestClass11.class", + getBytes("multi/release/test/TestClass11.class", base, new byte[] { '1', '1' })); + bundleEntries.put("META-INF/versions/11/multi/release/test/TestClassAdd11.class", + getBytes("multi/release/test/TestClassAdd11.class", base)); + bundleEntries.put("META-INF/versions/11/multi/release/test/testResource11.txt", + getBytes("multi/release/test/testResource11.txt", base, new byte[] { '1', '1' })); + bundleEntries.put("META-INF/versions/11/multi/release/test/testResourceAdd11.txt", + getBytes("multi/release/test/testResourceAdd11.txt", base)); bundleEntries.put("META-INF/versions/8/OSGI-INF/", null); bundleEntries.put("META-INF/versions/8/OSGI-INF/MANIFEST.MF", getBytes("manifests/manifest8.mf", base)); @@ -172,16 +202,26 @@ private static File createMRJarBundle() throws BundleException, IOException { classPathJarEntries.put("multi/release/", null); classPathJarEntries.put("multi/release/test/", null); classPathJarEntries.put("multi/release/test/sub/", null); - classPathJarEntries.put("multi/release/test/sub/TestClassBase.class", getBytes("multi/release/test/sub/TestClassBase.class", base)); - classPathJarEntries.put("multi/release/test/sub/TestClass8.class", getBytes("multi/release/test/sub/TestClass8.class", base)); - classPathJarEntries.put("multi/release/test/sub/TestClass9.class", getBytes("multi/release/test/sub/TestClass9.class", base)); - classPathJarEntries.put("multi/release/test/sub/TestClass10.class", getBytes("multi/release/test/sub/TestClass10.class", base)); - classPathJarEntries.put("multi/release/test/sub/TestClass11.class", getBytes("multi/release/test/sub/TestClass11.class", base)); - classPathJarEntries.put("multi/release/test/sub/testResourceBase.txt", getBytes("multi/release/test/sub/testResourceBase.txt", base)); - classPathJarEntries.put("multi/release/test/sub/testResource8.txt", getBytes("multi/release/test/sub/testResource8.txt", base)); - classPathJarEntries.put("multi/release/test/sub/testResource9.txt", getBytes("multi/release/test/sub/testResource9.txt", base)); - classPathJarEntries.put("multi/release/test/sub/testResource10.txt", getBytes("multi/release/test/sub/testResource10.txt", base)); - classPathJarEntries.put("multi/release/test/sub/testResource11.txt", getBytes("multi/release/test/sub/testResource11.txt", base)); + classPathJarEntries.put("multi/release/test/sub/TestClassBase.class", + getBytes("multi/release/test/sub/TestClassBase.class", base)); + classPathJarEntries.put("multi/release/test/sub/TestClass8.class", + getBytes("multi/release/test/sub/TestClass8.class", base)); + classPathJarEntries.put("multi/release/test/sub/TestClass9.class", + getBytes("multi/release/test/sub/TestClass9.class", base)); + classPathJarEntries.put("multi/release/test/sub/TestClass10.class", + getBytes("multi/release/test/sub/TestClass10.class", base)); + classPathJarEntries.put("multi/release/test/sub/TestClass11.class", + getBytes("multi/release/test/sub/TestClass11.class", base)); + classPathJarEntries.put("multi/release/test/sub/testResourceBase.txt", + getBytes("multi/release/test/sub/testResourceBase.txt", base)); + classPathJarEntries.put("multi/release/test/sub/testResource8.txt", + getBytes("multi/release/test/sub/testResource8.txt", base)); + classPathJarEntries.put("multi/release/test/sub/testResource9.txt", + getBytes("multi/release/test/sub/testResource9.txt", base)); + classPathJarEntries.put("multi/release/test/sub/testResource10.txt", + getBytes("multi/release/test/sub/testResource10.txt", base)); + classPathJarEntries.put("multi/release/test/sub/testResource11.txt", + getBytes("multi/release/test/sub/testResource11.txt", base)); classPathJarEntries.put("META-INF/versions/", null); classPathJarEntries.put("META-INF/versions/8/", null); @@ -189,60 +229,88 @@ private static File createMRJarBundle() throws BundleException, IOException { classPathJarEntries.put("META-INF/versions/8/multi/release/", null); classPathJarEntries.put("META-INF/versions/8/multi/release/test/", null); classPathJarEntries.put("META-INF/versions/8/multi/release/test/sub/", null); - classPathJarEntries.put("META-INF/versions/8/multi/release/test/sub/TestClass8.class", getBytes("multi/release/test/sub/TestClass8.class", base, new byte[] {'0', '8'})); - classPathJarEntries.put("META-INF/versions/8/multi/release/test/sub/TestClassAdd8.class", getBytes("multi/release/test/sub/TestClassAdd8.class", base)); - classPathJarEntries.put("META-INF/versions/8/multi/release/test/sub/testResource8.txt", getBytes("multi/release/test/sub/testResource8.txt", base, new byte[] {'0', '8'})); - classPathJarEntries.put("META-INF/versions/8/multi/release/test/sub/testResourceAdd8.txt", getBytes("multi/release/test/sub/testResourceAdd8.txt", base)); + classPathJarEntries.put("META-INF/versions/8/multi/release/test/sub/TestClass8.class", + getBytes("multi/release/test/sub/TestClass8.class", base, new byte[] { '0', '8' })); + classPathJarEntries.put("META-INF/versions/8/multi/release/test/sub/TestClassAdd8.class", + getBytes("multi/release/test/sub/TestClassAdd8.class", base)); + classPathJarEntries.put("META-INF/versions/8/multi/release/test/sub/testResource8.txt", + getBytes("multi/release/test/sub/testResource8.txt", base, new byte[] { '0', '8' })); + classPathJarEntries.put("META-INF/versions/8/multi/release/test/sub/testResourceAdd8.txt", + getBytes("multi/release/test/sub/testResourceAdd8.txt", base)); classPathJarEntries.put("META-INF/versions/9/", null); classPathJarEntries.put("META-INF/versions/9/multi/", null); classPathJarEntries.put("META-INF/versions/9/multi/release/", null); classPathJarEntries.put("META-INF/versions/9/multi/release/test/", null); classPathJarEntries.put("META-INF/versions/9/multi/release/test/sub/", null); - classPathJarEntries.put("META-INF/versions/9/multi/release/test/sub/TestClass9.class", getBytes("multi/release/test/sub/TestClass9.class", base, new byte[] {'0', '9'})); - classPathJarEntries.put("META-INF/versions/9/multi/release/test/sub/TestClassAdd9.class", getBytes("multi/release/test/sub/TestClassAdd9.class", base)); - classPathJarEntries.put("META-INF/versions/9/multi/release/test/sub/testResource9.txt", getBytes("multi/release/test/sub/testResource9.txt", base, new byte[] {'0', '9'})); - classPathJarEntries.put("META-INF/versions/9/multi/release/test/sub/testResourceAdd9.txt", getBytes("multi/release/test/sub/testResourceAdd9.txt", base)); + classPathJarEntries.put("META-INF/versions/9/multi/release/test/sub/TestClass9.class", + getBytes("multi/release/test/sub/TestClass9.class", base, new byte[] { '0', '9' })); + classPathJarEntries.put("META-INF/versions/9/multi/release/test/sub/TestClassAdd9.class", + getBytes("multi/release/test/sub/TestClassAdd9.class", base)); + classPathJarEntries.put("META-INF/versions/9/multi/release/test/sub/testResource9.txt", + getBytes("multi/release/test/sub/testResource9.txt", base, new byte[] { '0', '9' })); + classPathJarEntries.put("META-INF/versions/9/multi/release/test/sub/testResourceAdd9.txt", + getBytes("multi/release/test/sub/testResourceAdd9.txt", base)); classPathJarEntries.put("META-INF/versions/10/", null); classPathJarEntries.put("META-INF/versions/10/multi/", null); classPathJarEntries.put("META-INF/versions/10/multi/release/", null); classPathJarEntries.put("META-INF/versions/10/multi/release/test/", null); classPathJarEntries.put("META-INF/versions/10/multi/release/test/sub/", null); - classPathJarEntries.put("META-INF/versions/10/multi/release/test/sub/TestClass10.class", getBytes("multi/release/test/sub/TestClass10.class", base, new byte[] {'1', '0'})); - classPathJarEntries.put("META-INF/versions/10/multi/release/test/sub/TestClassAdd10.class", getBytes("multi/release/test/sub/TestClassAdd10.class", base)); - classPathJarEntries.put("META-INF/versions/10/multi/release/test/sub/testResource10.txt", getBytes("multi/release/test/sub/testResource10.txt", base, new byte[] {'1', '0'})); - classPathJarEntries.put("META-INF/versions/10/multi/release/test/sub/testResourceAdd10.txt", getBytes("multi/release/test/sub/testResourceAdd10.txt", base)); + classPathJarEntries.put("META-INF/versions/10/multi/release/test/sub/TestClass10.class", + getBytes("multi/release/test/sub/TestClass10.class", base, new byte[] { '1', '0' })); + classPathJarEntries.put("META-INF/versions/10/multi/release/test/sub/TestClassAdd10.class", + getBytes("multi/release/test/sub/TestClassAdd10.class", base)); + classPathJarEntries.put("META-INF/versions/10/multi/release/test/sub/testResource10.txt", + getBytes("multi/release/test/sub/testResource10.txt", base, new byte[] { '1', '0' })); + classPathJarEntries.put("META-INF/versions/10/multi/release/test/sub/testResourceAdd10.txt", + getBytes("multi/release/test/sub/testResourceAdd10.txt", base)); classPathJarEntries.put("META-INF/versions/11/", null); classPathJarEntries.put("META-INF/versions/11/multi/", null); classPathJarEntries.put("META-INF/versions/11/multi/release/", null); classPathJarEntries.put("META-INF/versions/11/multi/release/test/", null); classPathJarEntries.put("META-INF/versions/11/multi/release/test/sub/", null); - classPathJarEntries.put("META-INF/versions/11/multi/release/test/sub/TestClass11.class", getBytes("multi/release/test/sub/TestClass11.class", base, new byte[] {'1', '1'})); - classPathJarEntries.put("META-INF/versions/11/multi/release/test/sub/TestClassAdd11.class", getBytes("multi/release/test/sub/TestClassAdd11.class", base)); - classPathJarEntries.put("META-INF/versions/11/multi/release/test/sub/testResource11.txt", getBytes("multi/release/test/sub/testResource11.txt", base, new byte[] {'1', '1'})); - classPathJarEntries.put("META-INF/versions/11/multi/release/test/sub/testResourceAdd11.txt", getBytes("multi/release/test/sub/testResourceAdd11.txt", base)); + classPathJarEntries.put("META-INF/versions/11/multi/release/test/sub/TestClass11.class", + getBytes("multi/release/test/sub/TestClass11.class", base, new byte[] { '1', '1' })); + classPathJarEntries.put("META-INF/versions/11/multi/release/test/sub/TestClassAdd11.class", + getBytes("multi/release/test/sub/TestClassAdd11.class", base)); + classPathJarEntries.put("META-INF/versions/11/multi/release/test/sub/testResource11.txt", + getBytes("multi/release/test/sub/testResource11.txt", base, new byte[] { '1', '1' })); + classPathJarEntries.put("META-INF/versions/11/multi/release/test/sub/testResourceAdd11.txt", + getBytes("multi/release/test/sub/testResourceAdd11.txt", base)); createMRJar(classpathMrJar, Collections.emptyMap(), classPathJarEntries); - bundleEntries.put(classpathMrJar.getName(), StorageUtil.getBytes(new FileInputStream(classpathMrJar), -1, 4000)); + bundleEntries.put(classpathMrJar.getName(), + StorageUtil.getBytes(new FileInputStream(classpathMrJar), -1, 4000)); - // This will not be required by the spec, but equinox does support exploded inner jars in a bundle + // This will not be required by the spec, but equinox does support exploded + // inner jars in a bundle bundleEntries.put("classPathDir/", null); bundleEntries.put("classPathDir/multi/", null); bundleEntries.put("classPathDir/multi/release/", null); bundleEntries.put("classPathDir/multi/release/test/", null); bundleEntries.put("classPathDir/multi/release/test/sub2/", null); - bundleEntries.put("classPathDir/multi/release/test/sub2/TestClassBase.class", getBytes("multi/release/test/sub2/TestClassBase.class", base)); - bundleEntries.put("classPathDir/multi/release/test/sub2/TestClass8.class", getBytes("multi/release/test/sub2/TestClass8.class", base)); - bundleEntries.put("classPathDir/multi/release/test/sub2/TestClass9.class", getBytes("multi/release/test/sub2/TestClass9.class", base)); - bundleEntries.put("classPathDir/multi/release/test/sub2/TestClass10.class", getBytes("multi/release/test/sub2/TestClass10.class", base)); - bundleEntries.put("classPathDir/multi/release/test/sub2/TestClass11.class", getBytes("multi/release/test/sub2/TestClass11.class", base)); - bundleEntries.put("classPathDir/multi/release/test/sub2/testResourceBase.txt", getBytes("multi/release/test/sub2/testResourceBase.txt", base)); - bundleEntries.put("classPathDir/multi/release/test/sub2/testResource8.txt", getBytes("multi/release/test/sub2/testResource8.txt", base)); - bundleEntries.put("classPathDir/multi/release/test/sub2/testResource9.txt", getBytes("multi/release/test/sub2/testResource9.txt", base)); - bundleEntries.put("classPathDir/multi/release/test/sub2/testResource10.txt", getBytes("multi/release/test/sub2/testResource10.txt", base)); - bundleEntries.put("classPathDir/multi/release/test/sub2/testResource11.txt", getBytes("multi/release/test/sub2/testResource11.txt", base)); + bundleEntries.put("classPathDir/multi/release/test/sub2/TestClassBase.class", + getBytes("multi/release/test/sub2/TestClassBase.class", base)); + bundleEntries.put("classPathDir/multi/release/test/sub2/TestClass8.class", + getBytes("multi/release/test/sub2/TestClass8.class", base)); + bundleEntries.put("classPathDir/multi/release/test/sub2/TestClass9.class", + getBytes("multi/release/test/sub2/TestClass9.class", base)); + bundleEntries.put("classPathDir/multi/release/test/sub2/TestClass10.class", + getBytes("multi/release/test/sub2/TestClass10.class", base)); + bundleEntries.put("classPathDir/multi/release/test/sub2/TestClass11.class", + getBytes("multi/release/test/sub2/TestClass11.class", base)); + bundleEntries.put("classPathDir/multi/release/test/sub2/testResourceBase.txt", + getBytes("multi/release/test/sub2/testResourceBase.txt", base)); + bundleEntries.put("classPathDir/multi/release/test/sub2/testResource8.txt", + getBytes("multi/release/test/sub2/testResource8.txt", base)); + bundleEntries.put("classPathDir/multi/release/test/sub2/testResource9.txt", + getBytes("multi/release/test/sub2/testResource9.txt", base)); + bundleEntries.put("classPathDir/multi/release/test/sub2/testResource10.txt", + getBytes("multi/release/test/sub2/testResource10.txt", base)); + bundleEntries.put("classPathDir/multi/release/test/sub2/testResource11.txt", + getBytes("multi/release/test/sub2/testResource11.txt", base)); String classPathDirManifest = // "Manifest-Version: 1\n" + // @@ -255,40 +323,56 @@ private static File createMRJarBundle() throws BundleException, IOException { bundleEntries.put("classPathDir/META-INF/versions/8/multi/release/", null); bundleEntries.put("classPathDir/META-INF/versions/8/multi/release/test/", null); bundleEntries.put("classPathDir/META-INF/versions/8/multi/release/test/sub2/", null); - bundleEntries.put("classPathDir/META-INF/versions/8/multi/release/test/sub2/TestClass8.class", getBytes("multi/release/test/sub2/TestClass8.class", base, new byte[] {'0', '8'})); - bundleEntries.put("classPathDir/META-INF/versions/8/multi/release/test/sub2/TestClassAdd8.class", getBytes("multi/release/test/sub2/TestClassAdd8.class", base)); - bundleEntries.put("classPathDir/META-INF/versions/8/multi/release/test/sub2/testResource8.txt", getBytes("multi/release/test/sub2/testResource8.txt", base, new byte[] {'0', '8'})); - bundleEntries.put("classPathDir/META-INF/versions/8/multi/release/test/sub2/testResourceAdd8.txt", getBytes("multi/release/test/sub2/testResourceAdd8.txt", base)); + bundleEntries.put("classPathDir/META-INF/versions/8/multi/release/test/sub2/TestClass8.class", + getBytes("multi/release/test/sub2/TestClass8.class", base, new byte[] { '0', '8' })); + bundleEntries.put("classPathDir/META-INF/versions/8/multi/release/test/sub2/TestClassAdd8.class", + getBytes("multi/release/test/sub2/TestClassAdd8.class", base)); + bundleEntries.put("classPathDir/META-INF/versions/8/multi/release/test/sub2/testResource8.txt", + getBytes("multi/release/test/sub2/testResource8.txt", base, new byte[] { '0', '8' })); + bundleEntries.put("classPathDir/META-INF/versions/8/multi/release/test/sub2/testResourceAdd8.txt", + getBytes("multi/release/test/sub2/testResourceAdd8.txt", base)); bundleEntries.put("classPathDir/META-INF/versions/9/", null); bundleEntries.put("classPathDir/META-INF/versions/9/multi/", null); bundleEntries.put("classPathDir/META-INF/versions/9/multi/release/", null); bundleEntries.put("classPathDir/META-INF/versions/9/multi/release/test/", null); bundleEntries.put("classPathDir/META-INF/versions/9/multi/release/test/sub2/", null); - bundleEntries.put("classPathDir/META-INF/versions/9/multi/release/test/sub2/TestClass9.class", getBytes("multi/release/test/sub2/TestClass9.class", base, new byte[] {'0', '9'})); - bundleEntries.put("classPathDir/META-INF/versions/9/multi/release/test/sub2/TestClassAdd9.class", getBytes("multi/release/test/sub2/TestClassAdd9.class", base)); - bundleEntries.put("classPathDir/META-INF/versions/9/multi/release/test/sub2/testResource9.txt", getBytes("multi/release/test/sub2/testResource9.txt", base, new byte[] {'0', '9'})); - bundleEntries.put("classPathDir/META-INF/versions/9/multi/release/test/sub2/testResourceAdd9.txt", getBytes("multi/release/test/sub2/testResourceAdd9.txt", base)); + bundleEntries.put("classPathDir/META-INF/versions/9/multi/release/test/sub2/TestClass9.class", + getBytes("multi/release/test/sub2/TestClass9.class", base, new byte[] { '0', '9' })); + bundleEntries.put("classPathDir/META-INF/versions/9/multi/release/test/sub2/TestClassAdd9.class", + getBytes("multi/release/test/sub2/TestClassAdd9.class", base)); + bundleEntries.put("classPathDir/META-INF/versions/9/multi/release/test/sub2/testResource9.txt", + getBytes("multi/release/test/sub2/testResource9.txt", base, new byte[] { '0', '9' })); + bundleEntries.put("classPathDir/META-INF/versions/9/multi/release/test/sub2/testResourceAdd9.txt", + getBytes("multi/release/test/sub2/testResourceAdd9.txt", base)); bundleEntries.put("classPathDir/META-INF/versions/10/", null); bundleEntries.put("classPathDir/META-INF/versions/10/multi/", null); bundleEntries.put("classPathDir/META-INF/versions/10/multi/release/", null); bundleEntries.put("classPathDir/META-INF/versions/10/multi/release/test/", null); bundleEntries.put("classPathDir/META-INF/versions/10/multi/release/test/sub2/", null); - bundleEntries.put("classPathDir/META-INF/versions/10/multi/release/test/sub2/TestClass10.class", getBytes("multi/release/test/sub2/TestClass10.class", base, new byte[] {'1', '0'})); - bundleEntries.put("classPathDir/META-INF/versions/10/multi/release/test/sub2/TestClassAdd10.class", getBytes("multi/release/test/sub2/TestClassAdd10.class", base)); - bundleEntries.put("classPathDir/META-INF/versions/10/multi/release/test/sub2/testResource10.txt", getBytes("multi/release/test/sub2/testResource10.txt", base, new byte[] {'1', '0'})); - bundleEntries.put("classPathDir/META-INF/versions/10/multi/release/test/sub2/testResourceAdd10.txt", getBytes("multi/release/test/sub2/testResourceAdd10.txt", base)); + bundleEntries.put("classPathDir/META-INF/versions/10/multi/release/test/sub2/TestClass10.class", + getBytes("multi/release/test/sub2/TestClass10.class", base, new byte[] { '1', '0' })); + bundleEntries.put("classPathDir/META-INF/versions/10/multi/release/test/sub2/TestClassAdd10.class", + getBytes("multi/release/test/sub2/TestClassAdd10.class", base)); + bundleEntries.put("classPathDir/META-INF/versions/10/multi/release/test/sub2/testResource10.txt", + getBytes("multi/release/test/sub2/testResource10.txt", base, new byte[] { '1', '0' })); + bundleEntries.put("classPathDir/META-INF/versions/10/multi/release/test/sub2/testResourceAdd10.txt", + getBytes("multi/release/test/sub2/testResourceAdd10.txt", base)); bundleEntries.put("classPathDir/META-INF/versions/11/", null); bundleEntries.put("classPathDir/META-INF/versions/11/multi/", null); bundleEntries.put("classPathDir/META-INF/versions/11/multi/release/", null); bundleEntries.put("classPathDir/META-INF/versions/11/multi/release/test/", null); bundleEntries.put("classPathDir/META-INF/versions/11/multi/release/test/sub2/", null); - bundleEntries.put("classPathDir/META-INF/versions/11/multi/release/test/sub2/TestClass11.class", getBytes("multi/release/test/sub2/TestClass11.class", base, new byte[] {'1', '1'})); - bundleEntries.put("classPathDir/META-INF/versions/11/multi/release/test/sub2/TestClassAdd11.class", getBytes("multi/release/test/sub2/TestClassAdd11.class", base)); - bundleEntries.put("classPathDir/META-INF/versions/11/multi/release/test/sub2/testResource11.txt", getBytes("multi/release/test/sub2/testResource11.txt", base, new byte[] {'1', '1'})); - bundleEntries.put("classPathDir/META-INF/versions/11/multi/release/test/sub2/testResourceAdd11.txt", getBytes("multi/release/test/sub2/testResourceAdd11.txt", base)); + bundleEntries.put("classPathDir/META-INF/versions/11/multi/release/test/sub2/TestClass11.class", + getBytes("multi/release/test/sub2/TestClass11.class", base, new byte[] { '1', '1' })); + bundleEntries.put("classPathDir/META-INF/versions/11/multi/release/test/sub2/TestClassAdd11.class", + getBytes("multi/release/test/sub2/TestClassAdd11.class", base)); + bundleEntries.put("classPathDir/META-INF/versions/11/multi/release/test/sub2/testResource11.txt", + getBytes("multi/release/test/sub2/testResource11.txt", base, new byte[] { '1', '1' })); + bundleEntries.put("classPathDir/META-INF/versions/11/multi/release/test/sub2/testResourceAdd11.txt", + getBytes("multi/release/test/sub2/testResourceAdd11.txt", base)); createMRJar(mrJarBundle, bundleHeaders, bundleEntries); return mrJarBundle; @@ -365,7 +449,7 @@ private void doTestMultiReleaseClassLoad(int rv) throws Exception { System.setProperty("java.specification.version", Integer.toString(rv)); } - File config = OSGiTestsActivator.getContext().getDataFile(getName()); //$NON-NLS-1$ + File config = OSGiTestsActivator.getContext().getDataFile(getName()); // $NON-NLS-1$ Equinox equinox = new Equinox(Collections.singletonMap(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath())); try { @@ -376,32 +460,50 @@ private void doTestMultiReleaseClassLoad(int rv) throws Exception { assertEquals("Wrong class.", "BASEXX", loadClass("multi.release.test.TestClassBase", mrBundle, false)); assertEquals("Wrong class.", "BASEXX", loadClass("multi.release.test.TestClass8", mrBundle, false)); assertEquals("Wrong class.", CNFE, loadClass("multi.release.test.TestClassAdd8", mrBundle, true)); - assertEquals("Wrong class.", (rv >= 9) ? "BASE09" : "BASEXX", loadClass("multi.release.test.TestClass9", mrBundle, false)); - assertEquals("Wrong class.", (rv >= 9) ? "ADD09" : CNFE, loadClass("multi.release.test.TestClassAdd9", mrBundle, true)); - assertEquals("Wrong class.", (rv >= 10) ? "BASE10" : "BASEXX", loadClass("multi.release.test.TestClass10", mrBundle, false)); - assertEquals("Wrong class.", (rv >= 10) ? "ADD10" : CNFE, loadClass("multi.release.test.TestClassAdd10", mrBundle, true)); - assertEquals("Wrong class.", (rv >= 11) ? "BASE11" : "BASEXX", loadClass("multi.release.test.TestClass11", mrBundle, false)); - assertEquals("Wrong class.", (rv >= 11) ? "ADD11" : CNFE, loadClass("multi.release.test.TestClassAdd11", mrBundle, true)); + assertEquals("Wrong class.", (rv >= 9) ? "BASE09" : "BASEXX", + loadClass("multi.release.test.TestClass9", mrBundle, false)); + assertEquals("Wrong class.", (rv >= 9) ? "ADD09" : CNFE, + loadClass("multi.release.test.TestClassAdd9", mrBundle, true)); + assertEquals("Wrong class.", (rv >= 10) ? "BASE10" : "BASEXX", + loadClass("multi.release.test.TestClass10", mrBundle, false)); + assertEquals("Wrong class.", (rv >= 10) ? "ADD10" : CNFE, + loadClass("multi.release.test.TestClassAdd10", mrBundle, true)); + assertEquals("Wrong class.", (rv >= 11) ? "BASE11" : "BASEXX", + loadClass("multi.release.test.TestClass11", mrBundle, false)); + assertEquals("Wrong class.", (rv >= 11) ? "ADD11" : CNFE, + loadClass("multi.release.test.TestClassAdd11", mrBundle, true)); assertEquals("Wrong class.", "BASEXX", loadClass("multi.release.test.sub.TestClassBase", mrBundle, false)); assertEquals("Wrong class.", "BASEXX", loadClass("multi.release.test.sub.TestClass8", mrBundle, false)); assertEquals("Wrong class.", CNFE, loadClass("multi.release.test.TestClassAdd8", mrBundle, true)); - assertEquals("Wrong class.", (rv >= 9) ? "BASE09" : "BASEXX", loadClass("multi.release.test.sub.TestClass9", mrBundle, false)); - assertEquals("Wrong class.", (rv >= 9) ? "ADD09" : CNFE, loadClass("multi.release.test.sub.TestClassAdd9", mrBundle, true)); - assertEquals("Wrong class.", (rv >= 10) ? "BASE10" : "BASEXX", loadClass("multi.release.test.sub.TestClass10", mrBundle, false)); - assertEquals("Wrong class.", (rv >= 10) ? "ADD10" : CNFE, loadClass("multi.release.test.sub.TestClassAdd10", mrBundle, true)); - assertEquals("Wrong class.", (rv >= 11) ? "BASE11" : "BASEXX", loadClass("multi.release.test.sub.TestClass11", mrBundle, false)); - assertEquals("Wrong class.", (rv >= 11) ? "ADD11" : CNFE, loadClass("multi.release.test.sub.TestClassAdd11", mrBundle, true)); + assertEquals("Wrong class.", (rv >= 9) ? "BASE09" : "BASEXX", + loadClass("multi.release.test.sub.TestClass9", mrBundle, false)); + assertEquals("Wrong class.", (rv >= 9) ? "ADD09" : CNFE, + loadClass("multi.release.test.sub.TestClassAdd9", mrBundle, true)); + assertEquals("Wrong class.", (rv >= 10) ? "BASE10" : "BASEXX", + loadClass("multi.release.test.sub.TestClass10", mrBundle, false)); + assertEquals("Wrong class.", (rv >= 10) ? "ADD10" : CNFE, + loadClass("multi.release.test.sub.TestClassAdd10", mrBundle, true)); + assertEquals("Wrong class.", (rv >= 11) ? "BASE11" : "BASEXX", + loadClass("multi.release.test.sub.TestClass11", mrBundle, false)); + assertEquals("Wrong class.", (rv >= 11) ? "ADD11" : CNFE, + loadClass("multi.release.test.sub.TestClassAdd11", mrBundle, true)); assertEquals("Wrong class.", "BASEXX", loadClass("multi.release.test.sub2.TestClassBase", mrBundle, false)); assertEquals("Wrong class.", "BASEXX", loadClass("multi.release.test.sub2.TestClass8", mrBundle, false)); assertEquals("Wrong class.", CNFE, loadClass("multi.release.test.TestClassAdd8", mrBundle, true)); - assertEquals("Wrong class.", (rv >= 9) ? "BASE09" : "BASEXX", loadClass("multi.release.test.sub2.TestClass9", mrBundle, false)); - assertEquals("Wrong class.", (rv >= 9) ? "ADD09" : CNFE, loadClass("multi.release.test.sub2.TestClassAdd9", mrBundle, true)); - assertEquals("Wrong class.", (rv >= 10) ? "BASE10" : "BASEXX", loadClass("multi.release.test.sub2.TestClass10", mrBundle, false)); - assertEquals("Wrong class.", (rv >= 10) ? "ADD10" : CNFE, loadClass("multi.release.test.sub2.TestClassAdd10", mrBundle, true)); - assertEquals("Wrong class.", (rv >= 11) ? "BASE11" : "BASEXX", loadClass("multi.release.test.sub2.TestClass11", mrBundle, false)); - assertEquals("Wrong class.", (rv >= 11) ? "ADD11" : CNFE, loadClass("multi.release.test.sub2.TestClassAdd11", mrBundle, true)); + assertEquals("Wrong class.", (rv >= 9) ? "BASE09" : "BASEXX", + loadClass("multi.release.test.sub2.TestClass9", mrBundle, false)); + assertEquals("Wrong class.", (rv >= 9) ? "ADD09" : CNFE, + loadClass("multi.release.test.sub2.TestClassAdd9", mrBundle, true)); + assertEquals("Wrong class.", (rv >= 10) ? "BASE10" : "BASEXX", + loadClass("multi.release.test.sub2.TestClass10", mrBundle, false)); + assertEquals("Wrong class.", (rv >= 10) ? "ADD10" : CNFE, + loadClass("multi.release.test.sub2.TestClassAdd10", mrBundle, true)); + assertEquals("Wrong class.", (rv >= 11) ? "BASE11" : "BASEXX", + loadClass("multi.release.test.sub2.TestClass11", mrBundle, false)); + assertEquals("Wrong class.", (rv >= 11) ? "ADD11" : CNFE, + loadClass("multi.release.test.sub2.TestClassAdd11", mrBundle, true)); } finally { stopQuietly(equinox); } @@ -445,7 +547,7 @@ private void doTestMultiReleaseGetResource(int rv) throws Exception { System.setProperty("java.specification.version", Integer.toString(rv)); } - File config = OSGiTestsActivator.getContext().getDataFile(getName()); //$NON-NLS-1$ + File config = OSGiTestsActivator.getContext().getDataFile(getName()); // $NON-NLS-1$ Equinox equinox = new Equinox(Collections.singletonMap(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath())); try { @@ -454,35 +556,59 @@ private void doTestMultiReleaseGetResource(int rv) throws Exception { Bundle mrBundle = systemContext.installBundle(mrJarBundle.toURI().toString()); mrBundle.start(); - assertEquals("Wrong resource.", "RESOURCE XX", readResource("multi/release/test/testResourceBase.txt", mrBundle)); - assertEquals("Wrong resource.", "RESOURCE XX", readResource("multi/release/test/testResource8.txt", mrBundle)); + assertEquals("Wrong resource.", "RESOURCE XX", + readResource("multi/release/test/testResourceBase.txt", mrBundle)); + assertEquals("Wrong resource.", "RESOURCE XX", + readResource("multi/release/test/testResource8.txt", mrBundle)); assertEquals("Wrong resource.", RNF, readResource("multi/release/test/testResourceAdd8.txt", mrBundle)); - assertEquals("Wrong resource.", (rv >= 9) ? "RESOURCE 09" : "RESOURCE XX", readResource("multi/release/test/testResource9.txt", mrBundle)); - assertEquals("Wrong resource.", (rv >= 9) ? "ADD 09" : RNF, readResource("multi/release/test/testResourceAdd9.txt", mrBundle)); - assertEquals("Wrong resource.", (rv >= 10) ? "RESOURCE 10" : "RESOURCE XX", readResource("multi/release/test/testResource10.txt", mrBundle)); - assertEquals("Wrong resource.", (rv >= 10) ? "ADD 10" : RNF, readResource("multi/release/test/testResourceAdd10.txt", mrBundle)); - assertEquals("Wrong resource.", (rv >= 11) ? "RESOURCE 11" : "RESOURCE XX", readResource("multi/release/test/testResource11.txt", mrBundle)); - assertEquals("Wrong resource.", (rv >= 11) ? "ADD 11" : RNF, readResource("multi/release/test/testResourceAdd11.txt", mrBundle)); - - assertEquals("Wrong resource.", "RESOURCE XX", readResource("multi/release/test/sub/testResourceBase.txt", mrBundle)); - assertEquals("Wrong resource.", "RESOURCE XX", readResource("multi/release/test/sub/testResource8.txt", mrBundle)); + assertEquals("Wrong resource.", (rv >= 9) ? "RESOURCE 09" : "RESOURCE XX", + readResource("multi/release/test/testResource9.txt", mrBundle)); + assertEquals("Wrong resource.", (rv >= 9) ? "ADD 09" : RNF, + readResource("multi/release/test/testResourceAdd9.txt", mrBundle)); + assertEquals("Wrong resource.", (rv >= 10) ? "RESOURCE 10" : "RESOURCE XX", + readResource("multi/release/test/testResource10.txt", mrBundle)); + assertEquals("Wrong resource.", (rv >= 10) ? "ADD 10" : RNF, + readResource("multi/release/test/testResourceAdd10.txt", mrBundle)); + assertEquals("Wrong resource.", (rv >= 11) ? "RESOURCE 11" : "RESOURCE XX", + readResource("multi/release/test/testResource11.txt", mrBundle)); + assertEquals("Wrong resource.", (rv >= 11) ? "ADD 11" : RNF, + readResource("multi/release/test/testResourceAdd11.txt", mrBundle)); + + assertEquals("Wrong resource.", "RESOURCE XX", + readResource("multi/release/test/sub/testResourceBase.txt", mrBundle)); + assertEquals("Wrong resource.", "RESOURCE XX", + readResource("multi/release/test/sub/testResource8.txt", mrBundle)); assertEquals("Wrong resource.", RNF, readResource("multi/release/test/testResourceAdd8.txt", mrBundle)); - assertEquals("Wrong resource.", (rv >= 9) ? "RESOURCE 09" : "RESOURCE XX", readResource("multi/release/test/sub/testResource9.txt", mrBundle)); - assertEquals("Wrong resource.", (rv >= 9) ? "ADD 09" : RNF, readResource("multi/release/test/sub/testResourceAdd9.txt", mrBundle)); - assertEquals("Wrong resource.", (rv >= 10) ? "RESOURCE 10" : "RESOURCE XX", readResource("multi/release/test/sub/testResource10.txt", mrBundle)); - assertEquals("Wrong resource.", (rv >= 10) ? "ADD 10" : RNF, readResource("multi/release/test/sub/testResourceAdd10.txt", mrBundle)); - assertEquals("Wrong resource.", (rv >= 11) ? "RESOURCE 11" : "RESOURCE XX", readResource("multi/release/test/sub/testResource11.txt", mrBundle)); - assertEquals("Wrong resource.", (rv >= 11) ? "ADD 11" : RNF, readResource("multi/release/test/sub/testResourceAdd11.txt", mrBundle)); - - assertEquals("Wrong resource.", "RESOURCE XX", readResource("multi/release/test/sub2/testResourceBase.txt", mrBundle)); - assertEquals("Wrong resource.", "RESOURCE XX", readResource("multi/release/test/sub2/testResource8.txt", mrBundle)); + assertEquals("Wrong resource.", (rv >= 9) ? "RESOURCE 09" : "RESOURCE XX", + readResource("multi/release/test/sub/testResource9.txt", mrBundle)); + assertEquals("Wrong resource.", (rv >= 9) ? "ADD 09" : RNF, + readResource("multi/release/test/sub/testResourceAdd9.txt", mrBundle)); + assertEquals("Wrong resource.", (rv >= 10) ? "RESOURCE 10" : "RESOURCE XX", + readResource("multi/release/test/sub/testResource10.txt", mrBundle)); + assertEquals("Wrong resource.", (rv >= 10) ? "ADD 10" : RNF, + readResource("multi/release/test/sub/testResourceAdd10.txt", mrBundle)); + assertEquals("Wrong resource.", (rv >= 11) ? "RESOURCE 11" : "RESOURCE XX", + readResource("multi/release/test/sub/testResource11.txt", mrBundle)); + assertEquals("Wrong resource.", (rv >= 11) ? "ADD 11" : RNF, + readResource("multi/release/test/sub/testResourceAdd11.txt", mrBundle)); + + assertEquals("Wrong resource.", "RESOURCE XX", + readResource("multi/release/test/sub2/testResourceBase.txt", mrBundle)); + assertEquals("Wrong resource.", "RESOURCE XX", + readResource("multi/release/test/sub2/testResource8.txt", mrBundle)); assertEquals("Wrong resource.", RNF, readResource("multi/release/test/testResourceAdd8.txt", mrBundle)); - assertEquals("Wrong resource.", (rv >= 9) ? "RESOURCE 09" : "RESOURCE XX", readResource("multi/release/test/sub2/testResource9.txt", mrBundle)); - assertEquals("Wrong resource.", (rv >= 9) ? "ADD 09" : RNF, readResource("multi/release/test/sub2/testResourceAdd9.txt", mrBundle)); - assertEquals("Wrong resource.", (rv >= 10) ? "RESOURCE 10" : "RESOURCE XX", readResource("multi/release/test/sub2/testResource10.txt", mrBundle)); - assertEquals("Wrong resource.", (rv >= 10) ? "ADD 10" : RNF, readResource("multi/release/test/sub2/testResourceAdd10.txt", mrBundle)); - assertEquals("Wrong resource.", (rv >= 11) ? "RESOURCE 11" : "RESOURCE XX", readResource("multi/release/test/sub2/testResource11.txt", mrBundle)); - assertEquals("Wrong resource.", (rv >= 11) ? "ADD 11" : RNF, readResource("multi/release/test/sub2/testResourceAdd11.txt", mrBundle)); + assertEquals("Wrong resource.", (rv >= 9) ? "RESOURCE 09" : "RESOURCE XX", + readResource("multi/release/test/sub2/testResource9.txt", mrBundle)); + assertEquals("Wrong resource.", (rv >= 9) ? "ADD 09" : RNF, + readResource("multi/release/test/sub2/testResourceAdd9.txt", mrBundle)); + assertEquals("Wrong resource.", (rv >= 10) ? "RESOURCE 10" : "RESOURCE XX", + readResource("multi/release/test/sub2/testResource10.txt", mrBundle)); + assertEquals("Wrong resource.", (rv >= 10) ? "ADD 10" : RNF, + readResource("multi/release/test/sub2/testResourceAdd10.txt", mrBundle)); + assertEquals("Wrong resource.", (rv >= 11) ? "RESOURCE 11" : "RESOURCE XX", + readResource("multi/release/test/sub2/testResource11.txt", mrBundle)); + assertEquals("Wrong resource.", (rv >= 11) ? "ADD 11" : RNF, + readResource("multi/release/test/sub2/testResourceAdd11.txt", mrBundle)); } finally { stopQuietly(equinox); @@ -495,7 +621,8 @@ private String readResource(String name, Bundle mrBundle) throws Exception { String result = readURL(url); int lastSlash = name.lastIndexOf('/'); - Collection resourcePaths = wiring.listResources(name.substring(0, lastSlash + 1), name.substring(lastSlash + 1), 0); + Collection resourcePaths = wiring.listResources(name.substring(0, lastSlash + 1), + name.substring(lastSlash + 1), 0); if (result == RNF) { if (!resourcePaths.isEmpty()) { fail("listResources found path for '" + name + "'"); @@ -552,7 +679,7 @@ private void doTestMultiReleaseGetResources(int rv) throws Exception { System.setProperty("java.specification.version", Integer.toString(rv)); } - File config = OSGiTestsActivator.getContext().getDataFile(getName()); //$NON-NLS-1$ + File config = OSGiTestsActivator.getContext().getDataFile(getName()); // $NON-NLS-1$ Equinox equinox = new Equinox(Collections.singletonMap(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath())); try { @@ -561,35 +688,59 @@ private void doTestMultiReleaseGetResources(int rv) throws Exception { Bundle mrBundle = systemContext.installBundle(mrJarBundle.toURI().toString()); mrBundle.start(); - assertEquals("Wrong resource.", "RESOURCE XX", readResources("multi/release/test/testResourceBase.txt", mrBundle)); - assertEquals("Wrong resource.", "RESOURCE XX", readResources("multi/release/test/testResource8.txt", mrBundle)); + assertEquals("Wrong resource.", "RESOURCE XX", + readResources("multi/release/test/testResourceBase.txt", mrBundle)); + assertEquals("Wrong resource.", "RESOURCE XX", + readResources("multi/release/test/testResource8.txt", mrBundle)); assertEquals("Wrong resource.", RNF, readResources("multi/release/test/testResourceAdd8.txt", mrBundle)); - assertEquals("Wrong resource.", (rv >= 9) ? "RESOURCE 09" : "RESOURCE XX", readResources("multi/release/test/testResource9.txt", mrBundle)); - assertEquals("Wrong resource.", (rv >= 9) ? "ADD 09" : RNF, readResources("multi/release/test/testResourceAdd9.txt", mrBundle)); - assertEquals("Wrong resource.", (rv >= 10) ? "RESOURCE 10" : "RESOURCE XX", readResources("multi/release/test/testResource10.txt", mrBundle)); - assertEquals("Wrong resource.", (rv >= 10) ? "ADD 10" : RNF, readResources("multi/release/test/testResourceAdd10.txt", mrBundle)); - assertEquals("Wrong resource.", (rv >= 11) ? "RESOURCE 11" : "RESOURCE XX", readResources("multi/release/test/testResource11.txt", mrBundle)); - assertEquals("Wrong resource.", (rv >= 11) ? "ADD 11" : RNF, readResources("multi/release/test/testResourceAdd11.txt", mrBundle)); - - assertEquals("Wrong resource.", "RESOURCE XX", readResources("multi/release/test/sub/testResourceBase.txt", mrBundle)); - assertEquals("Wrong resource.", "RESOURCE XX", readResources("multi/release/test/sub/testResource8.txt", mrBundle)); + assertEquals("Wrong resource.", (rv >= 9) ? "RESOURCE 09" : "RESOURCE XX", + readResources("multi/release/test/testResource9.txt", mrBundle)); + assertEquals("Wrong resource.", (rv >= 9) ? "ADD 09" : RNF, + readResources("multi/release/test/testResourceAdd9.txt", mrBundle)); + assertEquals("Wrong resource.", (rv >= 10) ? "RESOURCE 10" : "RESOURCE XX", + readResources("multi/release/test/testResource10.txt", mrBundle)); + assertEquals("Wrong resource.", (rv >= 10) ? "ADD 10" : RNF, + readResources("multi/release/test/testResourceAdd10.txt", mrBundle)); + assertEquals("Wrong resource.", (rv >= 11) ? "RESOURCE 11" : "RESOURCE XX", + readResources("multi/release/test/testResource11.txt", mrBundle)); + assertEquals("Wrong resource.", (rv >= 11) ? "ADD 11" : RNF, + readResources("multi/release/test/testResourceAdd11.txt", mrBundle)); + + assertEquals("Wrong resource.", "RESOURCE XX", + readResources("multi/release/test/sub/testResourceBase.txt", mrBundle)); + assertEquals("Wrong resource.", "RESOURCE XX", + readResources("multi/release/test/sub/testResource8.txt", mrBundle)); assertEquals("Wrong resource.", RNF, readResources("multi/release/test/testResourceAdd8.txt", mrBundle)); - assertEquals("Wrong resource.", (rv >= 9) ? "RESOURCE 09" : "RESOURCE XX", readResources("multi/release/test/sub/testResource9.txt", mrBundle)); - assertEquals("Wrong resource.", (rv >= 9) ? "ADD 09" : RNF, readResources("multi/release/test/sub/testResourceAdd9.txt", mrBundle)); - assertEquals("Wrong resource.", (rv >= 10) ? "RESOURCE 10" : "RESOURCE XX", readResources("multi/release/test/sub/testResource10.txt", mrBundle)); - assertEquals("Wrong resource.", (rv >= 10) ? "ADD 10" : RNF, readResources("multi/release/test/sub/testResourceAdd10.txt", mrBundle)); - assertEquals("Wrong resource.", (rv >= 11) ? "RESOURCE 11" : "RESOURCE XX", readResources("multi/release/test/sub/testResource11.txt", mrBundle)); - assertEquals("Wrong resource.", (rv >= 11) ? "ADD 11" : RNF, readResources("multi/release/test/sub/testResourceAdd11.txt", mrBundle)); - - assertEquals("Wrong resource.", "RESOURCE XX", readResources("multi/release/test/sub2/testResourceBase.txt", mrBundle)); - assertEquals("Wrong resource.", "RESOURCE XX", readResources("multi/release/test/sub2/testResource8.txt", mrBundle)); + assertEquals("Wrong resource.", (rv >= 9) ? "RESOURCE 09" : "RESOURCE XX", + readResources("multi/release/test/sub/testResource9.txt", mrBundle)); + assertEquals("Wrong resource.", (rv >= 9) ? "ADD 09" : RNF, + readResources("multi/release/test/sub/testResourceAdd9.txt", mrBundle)); + assertEquals("Wrong resource.", (rv >= 10) ? "RESOURCE 10" : "RESOURCE XX", + readResources("multi/release/test/sub/testResource10.txt", mrBundle)); + assertEquals("Wrong resource.", (rv >= 10) ? "ADD 10" : RNF, + readResources("multi/release/test/sub/testResourceAdd10.txt", mrBundle)); + assertEquals("Wrong resource.", (rv >= 11) ? "RESOURCE 11" : "RESOURCE XX", + readResources("multi/release/test/sub/testResource11.txt", mrBundle)); + assertEquals("Wrong resource.", (rv >= 11) ? "ADD 11" : RNF, + readResources("multi/release/test/sub/testResourceAdd11.txt", mrBundle)); + + assertEquals("Wrong resource.", "RESOURCE XX", + readResources("multi/release/test/sub2/testResourceBase.txt", mrBundle)); + assertEquals("Wrong resource.", "RESOURCE XX", + readResources("multi/release/test/sub2/testResource8.txt", mrBundle)); assertEquals("Wrong resource.", RNF, readResources("multi/release/test/testResourceAdd8.txt", mrBundle)); - assertEquals("Wrong resource.", (rv >= 9) ? "RESOURCE 09" : "RESOURCE XX", readResources("multi/release/test/sub2/testResource9.txt", mrBundle)); - assertEquals("Wrong resource.", (rv >= 9) ? "ADD 09" : RNF, readResources("multi/release/test/sub2/testResourceAdd9.txt", mrBundle)); - assertEquals("Wrong resource.", (rv >= 10) ? "RESOURCE 10" : "RESOURCE XX", readResources("multi/release/test/sub2/testResource10.txt", mrBundle)); - assertEquals("Wrong resource.", (rv >= 10) ? "ADD 10" : RNF, readResources("multi/release/test/sub2/testResourceAdd10.txt", mrBundle)); - assertEquals("Wrong resource.", (rv >= 11) ? "RESOURCE 11" : "RESOURCE XX", readResources("multi/release/test/sub2/testResource11.txt", mrBundle)); - assertEquals("Wrong resource.", (rv >= 11) ? "ADD 11" : RNF, readResources("multi/release/test/sub2/testResourceAdd11.txt", mrBundle)); + assertEquals("Wrong resource.", (rv >= 9) ? "RESOURCE 09" : "RESOURCE XX", + readResources("multi/release/test/sub2/testResource9.txt", mrBundle)); + assertEquals("Wrong resource.", (rv >= 9) ? "ADD 09" : RNF, + readResources("multi/release/test/sub2/testResourceAdd9.txt", mrBundle)); + assertEquals("Wrong resource.", (rv >= 10) ? "RESOURCE 10" : "RESOURCE XX", + readResources("multi/release/test/sub2/testResource10.txt", mrBundle)); + assertEquals("Wrong resource.", (rv >= 10) ? "ADD 10" : RNF, + readResources("multi/release/test/sub2/testResourceAdd10.txt", mrBundle)); + assertEquals("Wrong resource.", (rv >= 11) ? "RESOURCE 11" : "RESOURCE XX", + readResources("multi/release/test/sub2/testResource11.txt", mrBundle)); + assertEquals("Wrong resource.", (rv >= 11) ? "ADD 11" : RNF, + readResources("multi/release/test/sub2/testResourceAdd11.txt", mrBundle)); } finally { stopQuietly(equinox); @@ -677,7 +828,7 @@ private void doTestMultiReleaseListResources(int rv) throws Exception { expectedRecurse.add("multi/release/test/sub2/testResourceAdd11.txt"); } - File config = OSGiTestsActivator.getContext().getDataFile(getName()); //$NON-NLS-1$ + File config = OSGiTestsActivator.getContext().getDataFile(getName()); // $NON-NLS-1$ Equinox equinox = new Equinox(Collections.singletonMap(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath())); try { @@ -736,7 +887,7 @@ private void doTestMultiReleaseBundleManifest(int rv) throws Exception { expectedPkg = "pkg" + rv; } - File config = OSGiTestsActivator.getContext().getDataFile(getName()); //$NON-NLS-1$ + File config = OSGiTestsActivator.getContext().getDataFile(getName()); // $NON-NLS-1$ Equinox equinox = new Equinox(Collections.singletonMap(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath())); try { @@ -748,7 +899,8 @@ private void doTestMultiReleaseBundleManifest(int rv) throws Exception { List capWires = mrBundle.adapt(BundleWiring.class).getRequiredWires(expectedCap); assertEquals("Wrong number of capability wires.", 1, capWires.size()); - List pkgReqs = mrBundle.adapt(BundleRevision.class).getDeclaredRequirements(PackageNamespace.PACKAGE_NAMESPACE); + List pkgReqs = mrBundle.adapt(BundleRevision.class) + .getDeclaredRequirements(PackageNamespace.PACKAGE_NAMESPACE); assertEquals("Wrong number of package requiremens.", 1, pkgReqs.size()); String filter = pkgReqs.get(0).getDirectives().get(Namespace.REQUIREMENT_FILTER_DIRECTIVE); assertTrue("Wrong package filter: " + filter, filter.contains(expectedPkg)); @@ -760,7 +912,7 @@ private void doTestMultiReleaseBundleManifest(int rv) throws Exception { @Test public void testMultiReleaseBundleManifestChangeRuntime() throws Exception { - File config = OSGiTestsActivator.getContext().getDataFile(getName()); //$NON-NLS-1$ + File config = OSGiTestsActivator.getContext().getDataFile(getName()); // $NON-NLS-1$ Map configMap = Collections.singletonMap(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); Equinox equinox = new Equinox(configMap); String location; @@ -795,7 +947,8 @@ public void testMultiReleaseBundleManifestChangeRuntime() throws Exception { } } - private void doTestMultiReleaseBundleManifestChangeRuntime(int rv, Map configMap, String location) throws BundleException { + private void doTestMultiReleaseBundleManifestChangeRuntime(int rv, Map configMap, String location) + throws BundleException { if (rv < 9) { System.setProperty("java.specification.version", "1." + rv); } else { @@ -825,7 +978,8 @@ private void doTestMultiReleaseBundleManifestChangeRuntime(int rv, Map capWires = mrBundle.adapt(BundleWiring.class).getRequiredWires(expectedCap); assertEquals("Wrong number of capability wires: " + rv, 1, capWires.size()); - List pkgReqs = mrBundle.adapt(BundleRevision.class).getDeclaredRequirements(PackageNamespace.PACKAGE_NAMESPACE); + List pkgReqs = mrBundle.adapt(BundleRevision.class) + .getDeclaredRequirements(PackageNamespace.PACKAGE_NAMESPACE); assertEquals("Wrong number of package requiremens: " + rv, 1, pkgReqs.size()); String filter = pkgReqs.get(0).getDirectives().get(Namespace.REQUIREMENT_FILTER_DIRECTIVE); assertTrue("Wrong package filter: " + rv + " " + filter, filter.contains(expectedPkg)); @@ -842,7 +996,7 @@ public void testMultiReleaseBundleDeletedRestart() throws Exception { System.setProperty("java.specification.version", "9"); - File config = OSGiTestsActivator.getContext().getDataFile(getName()); //$NON-NLS-1$ + File config = OSGiTestsActivator.getContext().getDataFile(getName()); // $NON-NLS-1$ Map configMap = Collections.singletonMap(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); Equinox equinox = new Equinox(configMap); @@ -871,7 +1025,7 @@ public void testMultiReleaseBundleDeletedRestart() throws Exception { public void testMultiReleasePreventMetaInfServiceVersions() throws Exception { System.setProperty("java.specification.version", "9"); - File config = OSGiTestsActivator.getContext().getDataFile(getName()); //$NON-NLS-1$ + File config = OSGiTestsActivator.getContext().getDataFile(getName()); // $NON-NLS-1$ Map configMap = Collections.singletonMap(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); Equinox equinox = new Equinox(configMap); @@ -882,7 +1036,8 @@ public void testMultiReleasePreventMetaInfServiceVersions() throws Exception { mrBundle.start(); Class testServiceClass = mrBundle.loadClass("multi.release.test.TestService"); - ServiceLoader loader = ServiceLoader.load(testServiceClass, mrBundle.adapt(BundleWiring.class).getClassLoader()); + ServiceLoader loader = ServiceLoader.load(testServiceClass, + mrBundle.adapt(BundleWiring.class).getClassLoader()); Object testService = loader.iterator().next(); assertEquals("Wrong service found.", "SERVICE_BASE", testService.toString()); } finally { @@ -894,7 +1049,7 @@ public void testMultiReleasePreventMetaInfServiceVersions() throws Exception { public void testMultiReleasePreventMetaInfResourceURLs() throws Exception { System.setProperty("java.specification.version", "9"); - File config = OSGiTestsActivator.getContext().getDataFile(getName()); //$NON-NLS-1$ + File config = OSGiTestsActivator.getContext().getDataFile(getName()); // $NON-NLS-1$ Map configMap = Collections.singletonMap(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); Equinox equinox = new Equinox(configMap); @@ -918,7 +1073,7 @@ public void testMultiReleasePreventMetaInfResourceURLs() throws Exception { public void testMultiReleasePreventMetaInfVersionListing() throws Exception { System.setProperty("java.specification.version", "9"); - File config = OSGiTestsActivator.getContext().getDataFile(getName()); //$NON-NLS-1$ + File config = OSGiTestsActivator.getContext().getDataFile(getName()); // $NON-NLS-1$ Map configMap = Collections.singletonMap(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); Equinox equinox = new Equinox(configMap); diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/NativeCodeBundleTests.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/NativeCodeBundleTests.java index 24a8e0307b4..615a14db125 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/NativeCodeBundleTests.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/NativeCodeBundleTests.java @@ -88,7 +88,7 @@ public void testNativeCode03() throws Exception { public void testNativeCode04() throws Exception { setNativeAttribute("nativecodetest", "unresolved"); Bundle nativetestC = installer.installBundle("nativetest.c"); - installer.resolveBundles(new Bundle[] {nativetestC}); + installer.resolveBundles(new Bundle[] { nativetestC }); assertTrue("1.0", nativetestC.getState() == Bundle.INSTALLED); } @@ -162,7 +162,8 @@ private String getContent(String file) throws IOException { private void setNativeAttribute(String key, String value) { Bundle systemBundle = OSGiTestsActivator.getContext().getBundle(0); ModuleRevision systemRevision = (ModuleRevision) systemBundle.adapt(BundleRevision.class); - ModuleCapability nativeCapability = systemRevision.getModuleCapabilities(NativeNamespace.NATIVE_NAMESPACE).get(0); + ModuleCapability nativeCapability = systemRevision.getModuleCapabilities(NativeNamespace.NATIVE_NAMESPACE) + .get(0); Map attrs = new HashMap(nativeCapability.getAttributes()); attrs.put(key, value); nativeCapability.setTransientAttrs(attrs); diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/PackageAdminBundleTests.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/PackageAdminBundleTests.java index 38fe7ac4288..a8a86e8b4c1 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/PackageAdminBundleTests.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/PackageAdminBundleTests.java @@ -96,8 +96,8 @@ public void testBundleEvents01() throws Exception { Bundle chainTestB = installer.installBundle("chain.test.b"); //$NON-NLS-1$ Bundle chainTestC = installer.installBundle("chain.test.c"); //$NON-NLS-1$ Bundle chainTestD = installer.installBundle("chain.test.d"); //$NON-NLS-1$ - Bundle[] resolveBundles = new Bundle[] {chainTestC, chainTestA, chainTestB, chainTest, chainTestD}; - Bundle[] dependencyOrder = new Bundle[] {chainTest, chainTestA, chainTestB, chainTestC, chainTestD}; + Bundle[] resolveBundles = new Bundle[] { chainTestC, chainTestA, chainTestB, chainTest, chainTestD }; + Bundle[] dependencyOrder = new Bundle[] { chainTest, chainTestA, chainTestB, chainTestC, chainTestD }; TestListener testListener = new TestListener(); OSGiTestsActivator.getContext().addBundleListener(testListener); try { @@ -106,12 +106,14 @@ public void testBundleEvents01() throws Exception { assertEquals("Event count", 10, events.length); //$NON-NLS-1$ int j = 0; for (int i = dependencyOrder.length - 1; i >= 0; i--, j++) { - assertTrue("Resolved Event Bundle: " + dependencyOrder[i].getSymbolicName(), dependencyOrder[i] == events[j].getBundle()); //$NON-NLS-1$ + assertTrue("Resolved Event Bundle: " + dependencyOrder[i].getSymbolicName(), //$NON-NLS-1$ + dependencyOrder[i] == events[j].getBundle()); assertEquals("Expecting Resolved event", BundleEvent.RESOLVED, events[j].getType()); //$NON-NLS-1$ } j = 5; for (int i = dependencyOrder.length - 1; i >= 0; i--, j++) { - assertTrue("Lazy Starting Bundle: " + dependencyOrder[i].getSymbolicName(), dependencyOrder[i] == events[j].getBundle()); //$NON-NLS-1$ + assertTrue("Lazy Starting Bundle: " + dependencyOrder[i].getSymbolicName(), //$NON-NLS-1$ + dependencyOrder[i] == events[j].getBundle()); assertEquals("Expecting Lazy Starting event", BundleEvent.LAZY_ACTIVATION, events[j].getType()); //$NON-NLS-1$ } } finally { @@ -126,37 +128,42 @@ public void testBundleEvents02() throws Exception { Bundle chainTestB = installer.installBundle("chain.test.b"); //$NON-NLS-1$ Bundle chainTestC = installer.installBundle("chain.test.c"); //$NON-NLS-1$ Bundle chainTestD = installer.installBundle("chain.test.d"); //$NON-NLS-1$ - Bundle[] resolveBundles = new Bundle[] {chainTestC, chainTestA, chainTestB, chainTest, chainTestD}; - Bundle[] dependencyOrder = new Bundle[] {chainTest, chainTestA, chainTestB, chainTestC, chainTestD}; + Bundle[] resolveBundles = new Bundle[] { chainTestC, chainTestA, chainTestB, chainTest, chainTestD }; + Bundle[] dependencyOrder = new Bundle[] { chainTest, chainTestA, chainTestB, chainTestC, chainTestD }; TestListener testListener = new TestListener(); OSGiTestsActivator.getContext().addBundleListener(testListener); try { installer.resolveBundles(resolveBundles); BundleEvent[] events = testListener.getEvents(); - // throw away the events. This was already tested + // throw away the events. This was already tested installer.refreshPackages(resolveBundles); events = testListener.getEvents(); assertEquals("Event count", 25, events.length); //$NON-NLS-1$ int j = 0; for (int i = 0; i < dependencyOrder.length; i++, j += 2) { - assertTrue("Stopping Event Bundle: " + dependencyOrder[i].getSymbolicName(), dependencyOrder[i] == events[j].getBundle()); //$NON-NLS-1$ + assertTrue("Stopping Event Bundle: " + dependencyOrder[i].getSymbolicName(), //$NON-NLS-1$ + dependencyOrder[i] == events[j].getBundle()); assertEquals("Expecting Stopping event", BundleEvent.STOPPING, events[j].getType()); //$NON-NLS-1$ - assertTrue("Stopped Event Bundle: " + dependencyOrder[i].getSymbolicName(), dependencyOrder[i] == events[j + 1].getBundle()); //$NON-NLS-1$ + assertTrue("Stopped Event Bundle: " + dependencyOrder[i].getSymbolicName(), //$NON-NLS-1$ + dependencyOrder[i] == events[j + 1].getBundle()); assertEquals("Expecting Stopping event", BundleEvent.STOPPED, events[j + 1].getType()); //$NON-NLS-1$ } j = 10; for (int i = 0; i < dependencyOrder.length; i++, j++) { - assertTrue("Unresolved Event Bundle: " + dependencyOrder[i].getSymbolicName(), dependencyOrder[i] == events[j].getBundle()); //$NON-NLS-1$ + assertTrue("Unresolved Event Bundle: " + dependencyOrder[i].getSymbolicName(), //$NON-NLS-1$ + dependencyOrder[i] == events[j].getBundle()); assertEquals("Expecting Unresolved event", BundleEvent.UNRESOLVED, events[j].getType()); //$NON-NLS-1$ } j = 15; for (int i = dependencyOrder.length - 1; i >= 0; i--, j++) { - assertTrue("Resolved Event Bundle: " + dependencyOrder[i].getSymbolicName(), dependencyOrder[i] == events[j].getBundle()); //$NON-NLS-1$ + assertTrue("Resolved Event Bundle: " + dependencyOrder[i].getSymbolicName(), //$NON-NLS-1$ + dependencyOrder[i] == events[j].getBundle()); assertEquals("Expecting Resolved event", BundleEvent.RESOLVED, events[j].getType()); //$NON-NLS-1$ } j = 20; for (int i = dependencyOrder.length - 1; i >= 0; i--, j++) { - assertTrue("Lazy Starting Event Bundle: " + dependencyOrder[i].getSymbolicName(), dependencyOrder[i] == events[j].getBundle()); //$NON-NLS-1$ + assertTrue("Lazy Starting Event Bundle: " + dependencyOrder[i].getSymbolicName(), //$NON-NLS-1$ + dependencyOrder[i] == events[j].getBundle()); assertEquals("Expecting Lazy Starting event", BundleEvent.LAZY_ACTIVATION, events[j].getType()); //$NON-NLS-1$ } @@ -224,7 +231,7 @@ public void testBug289719() throws Exception { Bug289719Listener testListener = new Bug289719Listener(); try { - installer.resolveBundles(new Bundle[] {bug259903a, bug259903b, bug259903c}); + installer.resolveBundles(new Bundle[] { bug259903a, bug259903b, bug259903c }); bug259903a.start(); bug259903b.start(); bug259903c.start(); @@ -232,24 +239,50 @@ public void testBug289719() throws Exception { installer.getStartLevel().setBundleStartLevel(bug259903b, 3); installer.getStartLevel().setBundleStartLevel(bug259903a, 4); OSGiTestsActivator.getContext().addBundleListener(testListener); - BundleEvent[] expectedEvents = new BundleEvent[] {new BundleEvent(BundleEvent.STOPPING, bug259903a), new BundleEvent(BundleEvent.STOPPED, bug259903a), new BundleEvent(BundleEvent.STOPPING, bug259903b), new BundleEvent(BundleEvent.STOPPED, bug259903b), new BundleEvent(BundleEvent.STOPPING, bug259903c), new BundleEvent(BundleEvent.STOPPED, bug259903c), new BundleEvent(BundleEvent.UNRESOLVED, bug259903a), new BundleEvent(BundleEvent.UNRESOLVED, bug259903b), new BundleEvent(BundleEvent.UNRESOLVED, bug259903c), new BundleEvent(BundleEvent.RESOLVED, bug259903c), new BundleEvent(BundleEvent.RESOLVED, bug259903b), new BundleEvent(BundleEvent.RESOLVED, bug259903a), new BundleEvent(BundleEvent.STARTING, bug259903c), new BundleEvent(BundleEvent.STARTED, bug259903c), - new BundleEvent(BundleEvent.STARTING, bug259903b), new BundleEvent(BundleEvent.STARTED, bug259903b), new BundleEvent(BundleEvent.STARTING, bug259903a), new BundleEvent(BundleEvent.STARTED, bug259903a)}; + BundleEvent[] expectedEvents = new BundleEvent[] { new BundleEvent(BundleEvent.STOPPING, bug259903a), + new BundleEvent(BundleEvent.STOPPED, bug259903a), new BundleEvent(BundleEvent.STOPPING, bug259903b), + new BundleEvent(BundleEvent.STOPPED, bug259903b), new BundleEvent(BundleEvent.STOPPING, bug259903c), + new BundleEvent(BundleEvent.STOPPED, bug259903c), + new BundleEvent(BundleEvent.UNRESOLVED, bug259903a), + new BundleEvent(BundleEvent.UNRESOLVED, bug259903b), + new BundleEvent(BundleEvent.UNRESOLVED, bug259903c), + new BundleEvent(BundleEvent.RESOLVED, bug259903c), + new BundleEvent(BundleEvent.RESOLVED, bug259903b), + new BundleEvent(BundleEvent.RESOLVED, bug259903a), + new BundleEvent(BundleEvent.STARTING, bug259903c), new BundleEvent(BundleEvent.STARTED, bug259903c), + new BundleEvent(BundleEvent.STARTING, bug259903b), new BundleEvent(BundleEvent.STARTED, bug259903b), + new BundleEvent(BundleEvent.STARTING, bug259903a), + new BundleEvent(BundleEvent.STARTED, bug259903a) }; testListener.setExpectedEvents(expectedEvents); - // add a small delay to ensure the async bundle start-level changes above are done (bug 300820) + // add a small delay to ensure the async bundle start-level changes above are + // done (bug 300820) Thread.sleep(500); - installer.refreshPackages(new Bundle[] {bug259903a}); + installer.refreshPackages(new Bundle[] { bug259903a }); Throwable[] results = testListener.getFailures(); assertEquals(getMessage(results), 0, results.length); - expectedEvents = new BundleEvent[] {new BundleEvent(BundleEvent.STOPPING, bug259903c), new BundleEvent(BundleEvent.STOPPED, bug259903c), new BundleEvent(BundleEvent.STOPPING, bug259903b), new BundleEvent(BundleEvent.STOPPED, bug259903b), new BundleEvent(BundleEvent.STOPPING, bug259903a), new BundleEvent(BundleEvent.STOPPED, bug259903a), new BundleEvent(BundleEvent.UNRESOLVED, bug259903c), new BundleEvent(BundleEvent.UNRESOLVED, bug259903b), new BundleEvent(BundleEvent.UNRESOLVED, bug259903a), new BundleEvent(BundleEvent.RESOLVED, bug259903a), new BundleEvent(BundleEvent.RESOLVED, bug259903b), new BundleEvent(BundleEvent.RESOLVED, bug259903c), new BundleEvent(BundleEvent.STARTING, bug259903a), new BundleEvent(BundleEvent.STARTED, bug259903a), - new BundleEvent(BundleEvent.STARTING, bug259903b), new BundleEvent(BundleEvent.STARTED, bug259903b), new BundleEvent(BundleEvent.STARTING, bug259903c), new BundleEvent(BundleEvent.STARTED, bug259903c)}; + expectedEvents = new BundleEvent[] { new BundleEvent(BundleEvent.STOPPING, bug259903c), + new BundleEvent(BundleEvent.STOPPED, bug259903c), new BundleEvent(BundleEvent.STOPPING, bug259903b), + new BundleEvent(BundleEvent.STOPPED, bug259903b), new BundleEvent(BundleEvent.STOPPING, bug259903a), + new BundleEvent(BundleEvent.STOPPED, bug259903a), + new BundleEvent(BundleEvent.UNRESOLVED, bug259903c), + new BundleEvent(BundleEvent.UNRESOLVED, bug259903b), + new BundleEvent(BundleEvent.UNRESOLVED, bug259903a), + new BundleEvent(BundleEvent.RESOLVED, bug259903a), + new BundleEvent(BundleEvent.RESOLVED, bug259903b), + new BundleEvent(BundleEvent.RESOLVED, bug259903c), + new BundleEvent(BundleEvent.STARTING, bug259903a), new BundleEvent(BundleEvent.STARTED, bug259903a), + new BundleEvent(BundleEvent.STARTING, bug259903b), new BundleEvent(BundleEvent.STARTED, bug259903b), + new BundleEvent(BundleEvent.STARTING, bug259903c), + new BundleEvent(BundleEvent.STARTED, bug259903c) }; testListener.setExpectedEvents(expectedEvents); installer.getStartLevel().setBundleStartLevel(bug259903c, 4); installer.getStartLevel().setBundleStartLevel(bug259903b, 4); installer.getStartLevel().setBundleStartLevel(bug259903a, 4); - // add a small delay to ensure the async bundle start-level changes above are done (bug 300820) + // add a small delay to ensure the async bundle start-level changes above are + // done (bug 300820) Thread.sleep(500); - installer.refreshPackages(new Bundle[] {bug259903a}); + installer.refreshPackages(new Bundle[] { bug259903a }); results = testListener.getFailures(); assertEquals(getMessage(results), 0, results.length); @@ -264,34 +297,37 @@ public void testBug415447() { Bundle[] systemBundles = pa.getBundles(Constants.SYSTEM_BUNDLE_SYMBOLICNAME, null); assertNotNull("No system bundles found.", systemBundles); assertEquals("Srong number of system bundles.", 1, systemBundles.length); - assertEquals("Wrong system bundle found.", OSGiTestsActivator.getContext().getBundle(Constants.SYSTEM_BUNDLE_LOCATION), systemBundles[0]); + assertEquals("Wrong system bundle found.", + OSGiTestsActivator.getContext().getBundle(Constants.SYSTEM_BUNDLE_LOCATION), systemBundles[0]); } @Test public void testUninstallWhileResolving() throws BundleException { - ServiceRegistration resolverHookReg = getContext().registerService(ResolverHookFactory.class, triggers -> new ResolverHook() { + ServiceRegistration resolverHookReg = getContext() + .registerService(ResolverHookFactory.class, triggers -> new ResolverHook() { - @Override - public void filterSingletonCollisions(BundleCapability singleton, Collection collisionCandidates) { - // Nothing - } + @Override + public void filterSingletonCollisions(BundleCapability singleton, + Collection collisionCandidates) { + // Nothing + } - @Override - public void filterResolvable(Collection candidates) { - // prevent all resolves - candidates.clear(); - } + @Override + public void filterResolvable(Collection candidates) { + // prevent all resolves + candidates.clear(); + } - @Override - public void filterMatches(BundleRequirement requirement, Collection candidates) { - // nothing - } + @Override + public void filterMatches(BundleRequirement requirement, Collection candidates) { + // nothing + } - @Override - public void end() { - // nothing - } - }, null); + @Override + public void end() { + // nothing + } + }, null); try { Bundle b1 = installer.installBundle("test.uninstall.start1"); //$NON-NLS-1$ Bundle b2 = installer.installBundle("test.uninstall.start2"); //$NON-NLS-1$ @@ -307,7 +343,8 @@ public void end() { } resolverHookReg.unregister(); resolverHookReg = null; - getContext().getBundle(Constants.SYSTEM_BUNDLE_LOCATION).adapt(FrameworkWiring.class).resolveBundles(Arrays.asList(b1, b2)); + getContext().getBundle(Constants.SYSTEM_BUNDLE_LOCATION).adapt(FrameworkWiring.class) + .resolveBundles(Arrays.asList(b1, b2)); } finally { if (resolverHookReg != null) { resolverHookReg.unregister(); diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/PersistedBundleTests.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/PersistedBundleTests.java index 11b0f1ef937..2451ed59f09 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/PersistedBundleTests.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/PersistedBundleTests.java @@ -64,8 +64,8 @@ public void testImmediatePersistence() throws Exception { } /* - * Test that a negative value for eclipse.stateSaveDelayInterval results in - * no persistence. + * Test that a negative value for eclipse.stateSaveDelayInterval results in no + * persistence. */ @Test public void testNoPersistence() throws Exception { diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/SubstituteExportsBundleTests.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/SubstituteExportsBundleTests.java index 54ef18bf738..046b017cf3c 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/SubstituteExportsBundleTests.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/SubstituteExportsBundleTests.java @@ -205,7 +205,8 @@ public void testSubstituteExports06() throws Exception { @Test public void testSubstituteExports07() throws Exception { - // same as previous split test but bundles are installed in opposite order to force the opposite classes to load + // same as previous split test but bundles are installed in opposite order to + // force the opposite classes to load Bundle jBundle = installer.installBundle("substitutes.j"); //$NON-NLS-1$ Bundle iBundle = installer.installBundle("substitutes.i"); //$NON-NLS-1$ Bundle lBundle = installer.installBundle("substitutes.l"); //$NON-NLS-1$ @@ -261,7 +262,8 @@ public void testSubstituteExports07() throws Exception { assertEquals("pBundle has different copy of Ny", nY, pBundle.loadClass(classNameNy)); //$NON-NLS-1$ assertEquals("qBundle has different copy of Ny", nY, qBundle.loadClass(classNameNy)); //$NON-NLS-1$ - String[] unexpectedClasseNames = new String[] {"substitutes.x.Ix", "substitutes.x.Kx", "substitutes.x.Mx", "substitutes.y.Iy", "substitutes.y.Ky", "substitutes.y.My"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ + String[] unexpectedClasseNames = new String[] { "substitutes.x.Ix", "substitutes.x.Kx", "substitutes.x.Mx", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + "substitutes.y.Iy", "substitutes.y.Ky", "substitutes.y.My" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ for (String unexpectedClasseName : unexpectedClasseNames) { for (Bundle bundle : allBundles) { assertThrows("Found class " + unexpectedClasseName + " in bundle " + bundle, @@ -312,7 +314,8 @@ public void testSubstituteExports11() throws BundleException { Bundle nBundle = installer.installBundle("substitutes.n"); //$NON-NLS-1$ Bundle pBundle = installer.installBundle("substitutes.p"); //$NON-NLS-1$ Bundle qBundle = installer.installBundle("substitutes.q"); //$NON-NLS-1$ - Bundle[] allBundles = new Bundle[] {iBundle, jBundle, mBundle, nBundle, pBundle, qBundle}; // k and l do not depend on i + Bundle[] allBundles = new Bundle[] { iBundle, jBundle, mBundle, nBundle, pBundle, qBundle }; // k and l do not + // depend on i doRefreshTest(allBundles, iBundle); } @@ -326,7 +329,8 @@ public void testSubstituteExports12() throws BundleException { Bundle mBundle = installer.installBundle("substitutes.m"); //$NON-NLS-1$ Bundle qBundle = installer.installBundle("substitutes.q"); //$NON-NLS-1$ Bundle pBundle = installer.installBundle("substitutes.p"); //$NON-NLS-1$ - Bundle[] allBundles = new Bundle[] {iBundle, jBundle, mBundle, nBundle, pBundle, qBundle}; // k and l do not depend on j + Bundle[] allBundles = new Bundle[] { iBundle, jBundle, mBundle, nBundle, pBundle, qBundle }; // k and l do not + // depend on j doRefreshTest(allBundles, jBundle); } @@ -387,7 +391,14 @@ public void testSubstituteExports14() throws BundleException { Bundle nBundle = installer.installBundle("substitutes.n"); //$NON-NLS-1$ Bundle pBundle = installer.installBundle("substitutes.p"); //$NON-NLS-1$ Bundle qBundle = installer.installBundle("substitutes.q"); //$NON-NLS-1$ - Bundle[] allBundles = new Bundle[] {iBundle, jBundle, kBundle, lBundle, mBundle, nBundle, pBundle, qBundle}; // k and l do not depend on i + Bundle[] allBundles = new Bundle[] { iBundle, jBundle, kBundle, lBundle, mBundle, nBundle, pBundle, qBundle }; // k + // and + // l + // do + // not + // depend + // on + // i assertTrue("Bundles are not resolved", installer.resolveBundles(allBundles)); //$NON-NLS-1$ PackageAdmin pa = installer.getPackageAdmin(); diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/SyncEventListenerTestResults.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/SyncEventListenerTestResults.java index 4a3dee3779a..6a93920289f 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/SyncEventListenerTestResults.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/SyncEventListenerTestResults.java @@ -15,6 +15,6 @@ import org.osgi.framework.SynchronousBundleListener; -public class SyncEventListenerTestResults extends EventListenerTestResults implements SynchronousBundleListener{ +public class SyncEventListenerTestResults extends EventListenerTestResults implements SynchronousBundleListener { // implements SynchronousBundleListener } diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/SystemBundleTests.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/SystemBundleTests.java index 0eb84e98d7b..a3a9ade3544 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/SystemBundleTests.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/SystemBundleTests.java @@ -621,11 +621,13 @@ private void checkParentClassLoader(Map configuration) @Test public void testChangeEE() throws IOException, BundleException { - URL javaSE8Profile = OSGiTestsActivator.getContext().getBundle(Constants.SYSTEM_BUNDLE_LOCATION).getEntry("JavaSE-1.8.profile"); - URL javaSE9Profile = OSGiTestsActivator.getContext().getBundle(Constants.SYSTEM_BUNDLE_LOCATION).getEntry("JavaSE-9.profile"); + URL javaSE8Profile = OSGiTestsActivator.getContext().getBundle(Constants.SYSTEM_BUNDLE_LOCATION) + .getEntry("JavaSE-1.8.profile"); + URL javaSE9Profile = OSGiTestsActivator.getContext().getBundle(Constants.SYSTEM_BUNDLE_LOCATION) + .getEntry("JavaSE-9.profile"); // configure equinox for javaSE 9 - File config = OSGiTestsActivator.getContext().getDataFile(getName()); //$NON-NLS-1$ + File config = OSGiTestsActivator.getContext().getDataFile(getName()); // $NON-NLS-1$ Map configuration = new HashMap<>(); configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); configuration.put("osgi.java.profile", javaSE9Profile.toExternalForm()); //$NON-NLS-1$ @@ -645,7 +647,8 @@ public void testChangeEE() throws IOException, BundleException { long bid = b.getBundleId(); // should resolve fine - Assert.assertTrue("Could not resolve bundle.", equinox.adapt(FrameworkWiring.class).resolveBundles(Collections.singleton(b))); + Assert.assertTrue("Could not resolve bundle.", + equinox.adapt(FrameworkWiring.class).resolveBundles(Collections.singleton(b))); // put the framework back to the RESOLVED state stop(equinox); @@ -656,7 +659,8 @@ public void testChangeEE() throws IOException, BundleException { equinox.start(); // bundle should fail to resolve b = equinox.getBundleContext().getBundle(bid); - Assert.assertFalse("Could resolve bundle.", equinox.adapt(FrameworkWiring.class).resolveBundles(Collections.singleton(b))); + Assert.assertFalse("Could resolve bundle.", + equinox.adapt(FrameworkWiring.class).resolveBundles(Collections.singleton(b))); // put the framework back to the RESOLVED state stop(equinox); @@ -667,7 +671,8 @@ public void testChangeEE() throws IOException, BundleException { equinox.start(); // bundle should succeed to resolve again b = equinox.getBundleContext().getBundle(bid); - Assert.assertTrue("Could not resolve bundle.", equinox.adapt(FrameworkWiring.class).resolveBundles(Collections.singleton(b))); + Assert.assertTrue("Could not resolve bundle.", + equinox.adapt(FrameworkWiring.class).resolveBundles(Collections.singleton(b))); // put the framework back to the RESOLVED state stop(equinox); @@ -686,10 +691,10 @@ public void testMRUBundleFileListExpectedToFail() throws Exception { private void doMRUBundleFileList(int limit) throws Exception { // create/start/stop/start/stop test - File config = OSGiTestsActivator.getContext().getDataFile(getName()); //$NON-NLS-1$ + File config = OSGiTestsActivator.getContext().getDataFile(getName()); // $NON-NLS-1$ Map configuration = new HashMap<>(); configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); - configuration.put("osgi.bundlefile.limit", Integer.toString(limit)); //$NON-NLS-1$//$NON-NLS-2$ + configuration.put("osgi.bundlefile.limit", Integer.toString(limit)); //$NON-NLS-1$ //$NON-NLS-2$ final Equinox equinox = new Equinox(configuration); equinox.init(); @@ -729,7 +734,8 @@ private void openAllBundleFiles(BundleContext context) { // get an entry from each bundle to ensure each one gets opened. for (Bundle bundle : bundles) { assertNotNull("No manifest for: " + bundle, bundle.getEntry("/META-INF/MANIFEST.MF")); - // An exception used to get thrown here when we tried to close the least used bundle file + // An exception used to get thrown here when we tried to close the least used + // bundle file } } @@ -767,7 +773,8 @@ public void testURLExternalFormat01() throws BundleException { assertNotNull("entry1", entry1); //$NON-NLS-1$ URL entry2 = test2.getEntry("data/resource1"); //$NON-NLS-1$ assertNotNull("entry2", entry2); //$NON-NLS-1$ - assertFalse("External form is equal: " + entry1.toExternalForm(), entry1.toExternalForm().equals(entry2.toExternalForm())); //$NON-NLS-1$ + assertFalse("External form is equal: " + entry1.toExternalForm(), //$NON-NLS-1$ + entry1.toExternalForm().equals(entry2.toExternalForm())); assertFalse("Host is equal: " + entry1.getHost(), entry1.getHost().equals(entry2.getHost())); //$NON-NLS-1$ assertFalse("URL is equal: " + entry1.toExternalForm(), entry1.equals(entry2)); //$NON-NLS-1$ @@ -780,7 +787,8 @@ public void testURLExternalFormat01() throws BundleException { assertNotNull("entry1", entry1); //$NON-NLS-1$ entry2 = substitutes2.getResource("data/resource1"); //$NON-NLS-1$ assertNotNull("entry2", entry2); //$NON-NLS-1$ - assertFalse("External form is equal: " + entry1.toExternalForm(), entry1.toExternalForm().equals(entry2.toExternalForm())); //$NON-NLS-1$ + assertFalse("External form is equal: " + entry1.toExternalForm(), //$NON-NLS-1$ + entry1.toExternalForm().equals(entry2.toExternalForm())); assertFalse("Host is equal: " + entry1.getHost(), entry1.getHost().equals(entry2.getHost())); //$NON-NLS-1$ assertFalse("URL is equal: " + entry1.toExternalForm(), entry1.equals(entry2)); //$NON-NLS-1$ @@ -835,14 +843,16 @@ public void testURLMultiplexing01() throws Exception { // register a protocol hander in the "root" framework Dictionary props = new Hashtable(); props.put(URLConstants.URL_HANDLER_PROTOCOL, getName().toLowerCase()); - ServiceRegistration handlerReg = OSGiTestsActivator.getContext().registerService(URLStreamHandlerService.class, new TestHandler(), props); + ServiceRegistration handlerReg = OSGiTestsActivator.getContext().registerService(URLStreamHandlerService.class, + new TestHandler(), props); URL baseTestUrl = new URL(getName().toLowerCase(), "", "/test/url"); System.getProperties().put("test.url", baseTestUrl); System.setProperty("test.url.spec", baseTestUrl.toExternalForm()); Bundle geturlBundle = systemContext1.installBundle(installer.getBundleLocation("geturl")); geturlBundle.start(); - PrivilegedAction geturlAction = systemContext1.getService(systemContext1.getServiceReference(PrivilegedAction.class)); + PrivilegedAction geturlAction = systemContext1 + .getService(systemContext1.getServiceReference(PrivilegedAction.class)); geturlAction.run(); // put the framework 1 back to the RESOLVED state @@ -904,26 +914,27 @@ private void verifyUUID(String uuid) { } // make sure there is not an extra section. assertThrows("Too many sections in uuid: " + uuid, NoSuchElementException.class, () -> st.nextToken()); - // now verify each section of the UUID can be decoded as a hex string and is the correct size + // now verify each section of the UUID can be decoded as a hex string and is the + // correct size for (int i = 0; i < uuidSections.length; i++) { int limit = 0; switch (i) { - case 0 : { - limit = 10; // "0x" + 4* == 10 len - break; - } - case 1 : - case 2 : - case 3 : { - limit = 6; // "0x" + 2* == 6 len - break; - } - case 4 : { - limit = 14; // "0x" + 6* == 14 len - break; - } - default : - break; + case 0: { + limit = 10; // "0x" + 4* == 10 len + break; + } + case 1: + case 2: + case 3: { + limit = 6; // "0x" + 2* == 6 len + break; + } + case 4: { + limit = 14; // "0x" + 6* == 14 len + break; + } + default: + break; } assertTrue("UUIDSection is too big: " + uuidSections[i], uuidSections[i].length() <= limit); Long.decode(uuidSections[i]); @@ -972,10 +983,11 @@ public void testBug304213() throws Exception { @Test public void testBug351083DevClassPath() throws InvalidSyntaxException, BundleException { // create/start/stop/start/stop test - BundleInstaller testBundleInstaller = new BundleInstaller("test_files/devCPTests", OSGiTestsActivator.getContext()); + BundleInstaller testBundleInstaller = new BundleInstaller("test_files/devCPTests", + OSGiTestsActivator.getContext()); try { - File config = OSGiTestsActivator.getContext().getDataFile(getName()); //$NON-NLS-1$ + File config = OSGiTestsActivator.getContext().getDataFile(getName()); // $NON-NLS-1$ Map configuration = new HashMap<>(); configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); configuration.put("osgi.dev", "../devCP"); @@ -1115,7 +1127,7 @@ public void testWeavingPersistence() throws Exception { private void doTestBug351519Refresh(Boolean refreshDuplicates) throws Exception { // Create a framework with equinox.refresh.duplicate.bsn=false configuration - File config = OSGiTestsActivator.getContext().getDataFile(getName()); //$NON-NLS-1$ + File config = OSGiTestsActivator.getContext().getDataFile(getName()); // $NON-NLS-1$ Map configuration = new HashMap<>(); configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); if (refreshDuplicates != null) { @@ -1212,7 +1224,8 @@ public void testBug258209_1() throws Exception { testTCCL.start(); assertEquals("Unexpected state", Bundle.RESOLVED, testTCCL.getState()); //$NON-NLS-1$ - // this will start the framework on the current thread; test that the correct tccl is used + // this will start the framework on the current thread; test that the correct + // tccl is used equinox.start(); assertEquals("Unexpected state", Bundle.ACTIVE, testTCCL.getState()); //$NON-NLS-1$ @@ -1272,16 +1285,18 @@ public void testBug413879() throws Exception { dynamicImports.add("*"); }, null); - ServiceRegistration resolverHookReg = systemContext.registerService(ResolverHookFactory.class, triggers -> { - // just trying to delay the resolve so that we get two threads trying to apply off the same snapshot - try { - Thread.sleep(500); - } catch (InterruptedException e) { - Thread.currentThread().interrupt(); - throw new RuntimeException(e); - } - return null; - }, null); + ServiceRegistration resolverHookReg = systemContext + .registerService(ResolverHookFactory.class, triggers -> { + // just trying to delay the resolve so that we get two threads trying to apply + // off the same snapshot + try { + Thread.sleep(500); + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new RuntimeException(e); + } + return null; + }, null); final Set errors = Collections.newSetFromMap(new ConcurrentHashMap()); try { @@ -1312,7 +1327,7 @@ public void testBug413879() throws Exception { @Test public void testBug414070() throws BundleException, InstantiationException, IllegalAccessException, ClassNotFoundException { - File config = OSGiTestsActivator.getContext().getDataFile(getName()); //$NON-NLS-1$ + File config = OSGiTestsActivator.getContext().getDataFile(getName()); // $NON-NLS-1$ Map configuration = new HashMap<>(); configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); Equinox equinox = new Equinox(configuration); @@ -1356,13 +1371,14 @@ public void testBug414070() }); stop(equinox); - List expectedOrder = Arrays.asList(systemBundle, chainTest, chainTestA, chainTestB, chainTestC, chainTestD); + List expectedOrder = Arrays.asList(systemBundle, chainTest, chainTestA, chainTestB, chainTestC, + chainTestD); assertArrayEquals("Wrong stopping order", expectedOrder.toArray(), stoppingOrder.toArray()); } @Test public void testBug412228() throws BundleException { - File config = OSGiTestsActivator.getContext().getDataFile(getName()); //$NON-NLS-1$ + File config = OSGiTestsActivator.getContext().getDataFile(getName()); // $NON-NLS-1$ Map configuration = new HashMap<>(); configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); Equinox equinox = new Equinox(configuration); @@ -1382,7 +1398,7 @@ public void testBug412228() throws BundleException { @Test public void testBug432632() throws BundleException, IOException { - File config = OSGiTestsActivator.getContext().getDataFile(getName()); //$NON-NLS-1$ + File config = OSGiTestsActivator.getContext().getDataFile(getName()); // $NON-NLS-1$ config.mkdirs(); // create a config.ini with some system property substitutes Properties configIni = new Properties(); @@ -1398,9 +1414,11 @@ public void testBug432632() throws BundleException, IOException { BundleContext systemContext = equinox.getBundleContext(); // check for substitution - assertEquals("Wrong value for test.substitute1", "Some.PASSED.test", systemContext.getProperty("test.substitute1")); + assertEquals("Wrong value for test.substitute1", "Some.PASSED.test", + systemContext.getProperty("test.substitute1")); // check that non-substitution keeps $ delimiters. - assertEquals("Wrong value for test.substitute2", "Some.$test.prop2$.test", systemContext.getProperty("test.substitute2")); + assertEquals("Wrong value for test.substitute2", "Some.$test.prop2$.test", + systemContext.getProperty("test.substitute2")); stop(equinox); } @@ -1409,14 +1427,15 @@ public void testDynamicSecurityManager() throws BundleException { SecurityManager sm = System.getSecurityManager(); assertNull("SecurityManager must be null to test.", sm); try { - File config = OSGiTestsActivator.getContext().getDataFile(getName()); //$NON-NLS-1$ + File config = OSGiTestsActivator.getContext().getDataFile(getName()); // $NON-NLS-1$ Map configuration = new HashMap<>(); configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); Equinox equinox = new Equinox(configuration); equinox.start(); Bundle substitutesA = null; substitutesA = equinox.getBundleContext().installBundle(installer.getBundleLocation("substitutes.a")); //$NON-NLS-1$ - assertTrue("BundleCould not resolve.", equinox.adapt(FrameworkWiring.class).resolveBundles(Collections.singleton(substitutesA))); + assertTrue("BundleCould not resolve.", + equinox.adapt(FrameworkWiring.class).resolveBundles(Collections.singleton(substitutesA))); substitutesA.adapt(BundleWiring.class).findEntries("/", null, 0); // set security manager after resolving System.setSecurityManager(new SecurityManager() { @@ -1443,7 +1462,7 @@ public void checkPermission(Permission perm) { @Test public void testNullConfigurationValue() throws BundleException { System.setProperty(nullTest, "system"); - File config = OSGiTestsActivator.getContext().getDataFile(getName()); //$NON-NLS-1$ + File config = OSGiTestsActivator.getContext().getDataFile(getName()); // $NON-NLS-1$ Map configuration = new HashMap<>(); configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); configuration.put(nullTest, null); @@ -1462,7 +1481,7 @@ public void testNullConfigurationValueRequiredProperty() throws BundleException assertNotNull(systemProcessor); try { System.setProperty(Constants.FRAMEWORK_PROCESSOR, "hyperflux"); - File config = OSGiTestsActivator.getContext().getDataFile(getName()); //$NON-NLS-1$ + File config = OSGiTestsActivator.getContext().getDataFile(getName()); // $NON-NLS-1$ Map configuration = new HashMap<>(); configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); configuration.put(Constants.FRAMEWORK_PROCESSOR, null); @@ -1514,7 +1533,7 @@ public void testAllNullConfigurationValues() throws BundleException { for (Object key : systemProperties.keySet()) { configuration.put((String) key, null); } - File config = OSGiTestsActivator.getContext().getDataFile(getName()); //$NON-NLS-1$ + File config = OSGiTestsActivator.getContext().getDataFile(getName()); // $NON-NLS-1$ configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); Equinox equinox = new Equinox(configuration); equinox.start(); @@ -1536,7 +1555,7 @@ public void testAllNullConfigurationValues() throws BundleException { @Test public void testNullConfigurationValueSystemProperties() throws BundleException { System.setProperty(nullTest, "system"); - File config = OSGiTestsActivator.getContext().getDataFile(getName()); //$NON-NLS-1$ + File config = OSGiTestsActivator.getContext().getDataFile(getName()); // $NON-NLS-1$ Map configuration = new HashMap<>(); configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); configuration.put("osgi.framework.useSystemProperties", "true"); @@ -1549,7 +1568,8 @@ public void testNullConfigurationValueSystemProperties() throws BundleException assertNull("Did not get null system value.", System.getProperties().get(nullTest)); // also test EnvironmentInfo effects on system properties - ServiceReference envRef = equinox.getBundleContext().getServiceReference(EnvironmentInfo.class); + ServiceReference envRef = equinox.getBundleContext() + .getServiceReference(EnvironmentInfo.class); EnvironmentInfo envInfo = equinox.getBundleContext().getService(envRef); envInfo.setProperty(getName(), getName()); assertEquals("Got wrong value from system properties.", System.getProperty(getName()), getName()); @@ -1560,13 +1580,14 @@ public void testNullConfigurationValueSystemProperties() throws BundleException @Test public void testBackedBySystemReplaceSystemProperties() throws BundleException { - File config = OSGiTestsActivator.getContext().getDataFile(getName()); //$NON-NLS-1$ + File config = OSGiTestsActivator.getContext().getDataFile(getName()); // $NON-NLS-1$ Map configuration = new HashMap<>(); configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); configuration.put("osgi.framework.useSystemProperties", "true"); Equinox equinox = new Equinox(configuration); equinox.start(); - ServiceReference envRef = equinox.getBundleContext().getServiceReference(EnvironmentInfo.class); + ServiceReference envRef = equinox.getBundleContext() + .getServiceReference(EnvironmentInfo.class); EnvironmentInfo envInfo = equinox.getBundleContext().getService(envRef); // replace the system properties with a copy @@ -1583,7 +1604,8 @@ public void testBackedBySystemReplaceSystemProperties() throws BundleException { // also test EnvironmentInfo properties assertEquals("Wrong context value", getName(), envInfo.getProperty(systemKey)); - assertEquals("Wrong EquinoxConfiguration config value", getName(), ((EquinoxConfiguration) envInfo).getConfiguration(systemKey)); + assertEquals("Wrong EquinoxConfiguration config value", getName(), + ((EquinoxConfiguration) envInfo).getConfiguration(systemKey)); // set environment info prop String envKey = getName() + ".env"; @@ -1596,12 +1618,13 @@ public void testBackedBySystemReplaceSystemProperties() throws BundleException { @Test public void testLocalConfigReplaceSystemProperties() throws BundleException { - File config = OSGiTestsActivator.getContext().getDataFile(getName()); //$NON-NLS-1$ + File config = OSGiTestsActivator.getContext().getDataFile(getName()); // $NON-NLS-1$ Map configuration = new HashMap<>(); configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); Equinox equinox = new Equinox(configuration); equinox.start(); - ServiceReference envRef = equinox.getBundleContext().getServiceReference(EnvironmentInfo.class); + ServiceReference envRef = equinox.getBundleContext() + .getServiceReference(EnvironmentInfo.class); EnvironmentInfo envInfo = equinox.getBundleContext().getService(envRef); // replace the system properties with a copy @@ -1620,8 +1643,10 @@ public void testLocalConfigReplaceSystemProperties() throws BundleException { // also test EnvironmentInfo properties. // remember the getProperty method is backed by system properties assertEquals("Wrong context value", getName(), envInfo.getProperty(systemKey)); - // config options are not backed by system properties when framework is not using system properties for configuration - assertNull("Wrong EquinoxConfiguration config value", ((EquinoxConfiguration) envInfo).getConfiguration(systemKey)); + // config options are not backed by system properties when framework is not + // using system properties for configuration + assertNull("Wrong EquinoxConfiguration config value", + ((EquinoxConfiguration) envInfo).getConfiguration(systemKey)); // set environment info prop String envKey = getName() + ".env"; @@ -1634,7 +1659,7 @@ public void testLocalConfigReplaceSystemProperties() throws BundleException { @Test public void testSystemNLFragment() throws BundleException { - File config = OSGiTestsActivator.getContext().getDataFile(getName()); //$NON-NLS-1$ + File config = OSGiTestsActivator.getContext().getDataFile(getName()); // $NON-NLS-1$ Map configuration = new HashMap<>(); configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); configuration.put("osgi.nl", "zh"); @@ -1679,7 +1704,8 @@ public void testOSGiDevSetsCheckConfiguration() throws BundleException { Equinox equinox = new Equinox(configuration); equinox.start(); BundleContext systemContext = equinox.getBundleContext(); - assertEquals("Wrong value for: " + EquinoxConfiguration.PROP_CHECK_CONFIGURATION, "true", systemContext.getProperty(EquinoxConfiguration.PROP_CHECK_CONFIGURATION)); + assertEquals("Wrong value for: " + EquinoxConfiguration.PROP_CHECK_CONFIGURATION, "true", + systemContext.getProperty(EquinoxConfiguration.PROP_CHECK_CONFIGURATION)); equinox.stop(); } finally { if (originalCheckConfiguration != null) { @@ -1690,7 +1716,7 @@ public void testOSGiDevSetsCheckConfiguration() throws BundleException { @Test public void testProvideOSGiEEandNative() throws BundleException { - File config = OSGiTestsActivator.getContext().getDataFile(getName()); //$NON-NLS-1$ + File config = OSGiTestsActivator.getContext().getDataFile(getName()); // $NON-NLS-1$ Map configuration = new HashMap<>(); configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); configuration.put("osgi.equinox.allow.restricted.provides", "true"); @@ -1775,13 +1801,13 @@ public void testSystemBundleListener() throws BundleException, InterruptedExcept SynchronousBundleListener systemBundleListener = event -> { if (event.getBundle().getBundleId() == 0) { switch (event.getType()) { - case BundleEvent.STOPPING : - stoppingEvent.incrementAndGet(); - break; - case BundleEvent.STOPPED : - stoppedEvent.incrementAndGet(); - default : - break; + case BundleEvent.STOPPING: + stoppingEvent.incrementAndGet(); + break; + case BundleEvent.STOPPED: + stoppedEvent.incrementAndGet(); + default: + break; } } }; @@ -1814,7 +1840,8 @@ public void testExtraSystemBundleHeaders() throws BundleException { config.mkdirs(); Map configuration = new HashMap<>(); configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); - configuration.put(Constants.FRAMEWORK_SYSTEMCAPABILITIES, "osgi.ee; osgi.ee=JavaSE; version:Version=1.8, something.system"); + configuration.put(Constants.FRAMEWORK_SYSTEMCAPABILITIES, + "osgi.ee; osgi.ee=JavaSE; version:Version=1.8, something.system"); configuration.put(Constants.FRAMEWORK_SYSTEMPACKAGES, "something.system"); configuration.put(Constants.FRAMEWORK_SYSTEMCAPABILITIES_EXTRA, "something.extra"); configuration.put(Constants.FRAMEWORK_SYSTEMPACKAGES_EXTRA, "something.extra"); @@ -1824,45 +1851,56 @@ public void testExtraSystemBundleHeaders() throws BundleException { Dictionary headers = equinox.getHeaders(); String provideCapability = headers.get(Constants.PROVIDE_CAPABILITY); String exportPackage = headers.get(Constants.EXPORT_PACKAGE); - assertTrue("Unexpected Provide-Capability header: " + provideCapability, provideCapability.contains("something.system")); + assertTrue("Unexpected Provide-Capability header: " + provideCapability, + provideCapability.contains("something.system")); assertTrue("Unexpected Export-Package header: " + exportPackage, exportPackage.contains("something.system")); - assertTrue("Unexpected Provide-Capability header: " + provideCapability, provideCapability.contains("something.extra")); + assertTrue("Unexpected Provide-Capability header: " + provideCapability, + provideCapability.contains("something.extra")); assertTrue("Unexpected Export-Package header: " + exportPackage, exportPackage.contains("something.extra")); stop(equinox); - configuration.put(EquinoxConfiguration.PROP_SYSTEM_PROVIDE_HEADER, EquinoxConfiguration.SYSTEM_PROVIDE_HEADER_ORIGINAL); + configuration.put(EquinoxConfiguration.PROP_SYSTEM_PROVIDE_HEADER, + EquinoxConfiguration.SYSTEM_PROVIDE_HEADER_ORIGINAL); equinox = new Equinox(configuration); equinox.start(); headers = equinox.getHeaders(); provideCapability = headers.get(Constants.PROVIDE_CAPABILITY); exportPackage = headers.get(Constants.EXPORT_PACKAGE); - assertFalse("Unexpected Provide-Capability header: " + provideCapability, provideCapability.contains("something.system")); + assertFalse("Unexpected Provide-Capability header: " + provideCapability, + provideCapability.contains("something.system")); assertFalse("Unexpected Export-Package header: " + exportPackage, exportPackage.contains("something.system")); - assertFalse("Unexpected Provide-Capability header: " + provideCapability, provideCapability.contains("something.extra")); + assertFalse("Unexpected Provide-Capability header: " + provideCapability, + provideCapability.contains("something.extra")); assertFalse("Unexpected Export-Package header: " + exportPackage, exportPackage.contains("something.extra")); stop(equinox); - configuration.put(EquinoxConfiguration.PROP_SYSTEM_PROVIDE_HEADER, EquinoxConfiguration.SYSTEM_PROVIDE_HEADER_SYSTEM); + configuration.put(EquinoxConfiguration.PROP_SYSTEM_PROVIDE_HEADER, + EquinoxConfiguration.SYSTEM_PROVIDE_HEADER_SYSTEM); equinox = new Equinox(configuration); equinox.start(); headers = equinox.getHeaders(); provideCapability = headers.get(Constants.PROVIDE_CAPABILITY); exportPackage = headers.get(Constants.EXPORT_PACKAGE); - assertTrue("Unexpected Provide-Capability header: " + provideCapability, provideCapability.contains("something.system")); + assertTrue("Unexpected Provide-Capability header: " + provideCapability, + provideCapability.contains("something.system")); assertTrue("Unexpected Export-Package header: " + exportPackage, exportPackage.contains("something.system")); - assertFalse("Unexpected Provide-Capability header: " + provideCapability, provideCapability.contains("something.extra")); + assertFalse("Unexpected Provide-Capability header: " + provideCapability, + provideCapability.contains("something.extra")); assertFalse("Unexpected Export-Package header: " + exportPackage, exportPackage.contains("something.extra")); stop(equinox); - configuration.put(EquinoxConfiguration.PROP_SYSTEM_PROVIDE_HEADER, EquinoxConfiguration.SYSTEM_PROVIDE_HEADER_SYSTEM_EXTRA); + configuration.put(EquinoxConfiguration.PROP_SYSTEM_PROVIDE_HEADER, + EquinoxConfiguration.SYSTEM_PROVIDE_HEADER_SYSTEM_EXTRA); equinox = new Equinox(configuration); equinox.start(); headers = equinox.getHeaders(); provideCapability = headers.get(Constants.PROVIDE_CAPABILITY); exportPackage = headers.get(Constants.EXPORT_PACKAGE); - assertTrue("Unexpected Provide-Capability header: " + provideCapability, provideCapability.contains("something.system")); + assertTrue("Unexpected Provide-Capability header: " + provideCapability, + provideCapability.contains("something.system")); assertTrue("Unexpected Export-Package header: " + exportPackage, exportPackage.contains("something.system")); - assertTrue("Unexpected Provide-Capability header: " + provideCapability, provideCapability.contains("something.extra")); + assertTrue("Unexpected Provide-Capability header: " + provideCapability, + provideCapability.contains("something.extra")); assertTrue("Unexpected Export-Package header: " + exportPackage, exportPackage.contains("something.extra")); stop(equinox); } @@ -1947,7 +1985,8 @@ private void doTestJavaProfile(String javaSpecVersion, String expectedEEName, St stop(equinox); assertEquals("Wrong state for SystemBundle", Bundle.RESOLVED, equinox.getState()); //$NON-NLS-1$ - assertTrue("Wrong osgi EE: expected: " + expectedEEName + " but was: " + osgiEE, osgiEE.endsWith(expectedEEName)); + assertTrue("Wrong osgi EE: expected: " + expectedEEName + " but was: " + osgiEE, + osgiEE.endsWith(expectedEEName)); } private static File[] createBundles(File outputDir, int bundleCount) throws IOException { @@ -1961,7 +2000,8 @@ private static File[] createBundles(File outputDir, int bundleCount) throws IOEx return bundles; } - private static File[] createBundles(File outputDir, int bundleCount, Map extraHeaders) throws IOException { + private static File[] createBundles(File outputDir, int bundleCount, Map extraHeaders) + throws IOException { outputDir.mkdirs(); File[] bundles = new File[bundleCount]; @@ -1975,7 +2015,8 @@ private static File[] createBundles(File outputDir, int bundleCount, Map configuration = new HashMap<>(); configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); configuration.put("osgi.framework", "boo"); - // Initialize and start a framework specifying an invalid osgi.framework configuration value. + // Initialize and start a framework specifying an invalid osgi.framework + // configuration value. Equinox equinox = null; equinox = new Equinox(configuration); equinox.start(); @@ -2080,14 +2122,17 @@ public void testBug405919() throws Exception { for (int i = 0; i < innerCaps.size(); i++) { Capability innerCap = innerCaps.get(i); Capability outerCap = outerCaps.get(i); - assertEquals("Capability namespaces differ: " + outerCap.getNamespace(), outerCap.getNamespace(), innerCap.getNamespace()); + assertEquals("Capability namespaces differ: " + outerCap.getNamespace(), outerCap.getNamespace(), + innerCap.getNamespace()); String namespace = outerCap.getNamespace(); if (NativeNamespace.NATIVE_NAMESPACE.equals(namespace) || "eclipse.platform".equals(namespace)) { // Ignore these because they are known to differ. continue; } - assertEquals("Capability attributes differ: " + outerCap.getNamespace(), outerCap.getAttributes(), innerCap.getAttributes()); - assertEquals("Capability directives differ: " + outerCap.getNamespace(), outerCap.getDirectives(), innerCap.getDirectives()); + assertEquals("Capability attributes differ: " + outerCap.getNamespace(), outerCap.getAttributes(), + innerCap.getAttributes()); + assertEquals("Capability directives differ: " + outerCap.getNamespace(), outerCap.getDirectives(), + innerCap.getDirectives()); } // Requirements. List innerReqs = inner.getRequirements(null); @@ -2096,9 +2141,12 @@ public void testBug405919() throws Exception { for (int i = 0; i < innerReqs.size(); i++) { Requirement innerReq = innerReqs.get(i); Requirement outerReq = outerReqs.get(i); - assertEquals("Requirement namespaces differ: " + outerReq.getNamespace(), outerReq.getNamespace(), innerReq.getNamespace()); - assertEquals("Requirement attributes differ: " + outerReq.getNamespace(), outerReq.getAttributes(), innerReq.getAttributes()); - assertEquals("Requirement directives differ: " + outerReq.getNamespace(), outerReq.getDirectives(), innerReq.getDirectives()); + assertEquals("Requirement namespaces differ: " + outerReq.getNamespace(), outerReq.getNamespace(), + innerReq.getNamespace()); + assertEquals("Requirement attributes differ: " + outerReq.getNamespace(), outerReq.getAttributes(), + innerReq.getAttributes()); + assertEquals("Requirement directives differ: " + outerReq.getNamespace(), outerReq.getDirectives(), + innerReq.getDirectives()); } } finally { stop(equinox); @@ -2169,7 +2217,7 @@ public void testDaemonActiveThread() throws BundleException, InterruptedExceptio @Test public void testLazyTriggerOnLoadError() throws BundleException { // create/start/stop/start/stop test - File config = OSGiTestsActivator.getContext().getDataFile(getName()); //$NON-NLS-1$ + File config = OSGiTestsActivator.getContext().getDataFile(getName()); // $NON-NLS-1$ Map configuration = new HashMap<>(); configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); configuration.put(EquinoxConfiguration.PROP_COMPATIBILITY_START_LAZY_ON_FAIL_CLASSLOAD, "true"); @@ -2266,7 +2314,7 @@ void checkActiveThreadType(Equinox equinox, boolean expectIsDeamon) { @Test public void testWindowsAlias() throws BundleException { String origOS = System.getProperty("os.name"); - File config = OSGiTestsActivator.getContext().getDataFile(getName()); //$NON-NLS-1$ + File config = OSGiTestsActivator.getContext().getDataFile(getName()); // $NON-NLS-1$ Map configuration = new HashMap(); configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); System.setProperty("os.name", "Windows 5000"); @@ -2284,7 +2332,7 @@ public void testWindowsAlias() throws BundleException { @Test public void testOverrideEquinoxConfigAreaProp() throws BundleException { - File config = OSGiTestsActivator.getContext().getDataFile(getName()); //$NON-NLS-1$ + File config = OSGiTestsActivator.getContext().getDataFile(getName()); // $NON-NLS-1$ Map configuration = new HashMap(); configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); configuration.put(EquinoxLocations.PROP_CONFIG_AREA, config.getAbsolutePath() + "-override"); @@ -2299,7 +2347,8 @@ public void testOverrideEquinoxConfigAreaProp() throws BundleException { assertTrue("No logs found.", logs.hasMoreElements()); LogEntry entry = logs.nextElement(); assertEquals("Wrong log level.", LogLevel.WARN, entry.getLogLevel()); - assertTrue("Wrong message found: " + entry.getMessage(), entry.getMessage().contains(EquinoxLocations.PROP_CONFIG_AREA)); + assertTrue("Wrong message found: " + entry.getMessage(), + entry.getMessage().contains(EquinoxLocations.PROP_CONFIG_AREA)); } finally { stop(equinox); } @@ -2307,7 +2356,7 @@ public void testOverrideEquinoxConfigAreaProp() throws BundleException { @Test public void testLogOrderMultipleListeners() throws Exception { - File config = OSGiTestsActivator.getContext().getDataFile(getName()); //$NON-NLS-1$ + File config = OSGiTestsActivator.getContext().getDataFile(getName()); // $NON-NLS-1$ Map configuration = new HashMap(); configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); Equinox equinox = null; @@ -2365,7 +2414,7 @@ public void testCaptureLogEntryLocation() throws BundleException, InterruptedExc } private void doTestCaptureLogEntryLocation(boolean captureLocation) throws BundleException, InterruptedException { - File config = OSGiTestsActivator.getContext().getDataFile(getName()); //$NON-NLS-1$ + File config = OSGiTestsActivator.getContext().getDataFile(getName()); // $NON-NLS-1$ Map configuration = new HashMap(); configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); if (!captureLocation) { @@ -2416,7 +2465,7 @@ public void testSystemCapabilitiesBug522125() throws Exception { URL relativeURL = new URL("file:" + relative); relativeURL.openStream().close(); final ClassLoader osgiClassLoader = getClass().getClassLoader(); - URLClassLoader cl = new URLClassLoader(new URL[] {relativeURL}) { + URLClassLoader cl = new URLClassLoader(new URL[] { relativeURL }) { @Override protected Class loadClass(String name, boolean resolve) throws ClassNotFoundException { @@ -2431,7 +2480,7 @@ protected Class loadClass(String name, boolean resolve) throws ClassNotFoundE ServiceLoader sLoader = ServiceLoader.load(FrameworkFactory.class, cl); FrameworkFactory factory = sLoader.iterator().next(); - File config = OSGiTestsActivator.getContext().getDataFile(getName()); //$NON-NLS-1$ + File config = OSGiTestsActivator.getContext().getDataFile(getName()); // $NON-NLS-1$ Map configuration = new HashMap<>(); configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); configuration.put(EquinoxConfiguration.PROP_FRAMEWORK, relativeURL.toExternalForm()); @@ -2455,7 +2504,7 @@ protected Class loadClass(String name, boolean resolve) throws ClassNotFoundE @Test public void testStartLevelSorting() throws Exception { - File config = OSGiTestsActivator.getContext().getDataFile(getName()); //$NON-NLS-1$ + File config = OSGiTestsActivator.getContext().getDataFile(getName()); // $NON-NLS-1$ Map configuration = new HashMap(); configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); Equinox equinox = null; @@ -2467,7 +2516,8 @@ public void testStartLevelSorting() throws Exception { final List testBundles = Collections.synchronizedList(new ArrayList()); final List startedBundles = Collections.synchronizedList(new ArrayList()); for (int i = 0; i < numBundles / 2; i++) { - Bundle b = equinox.getBundleContext().installBundle("reference:file:///" + testBundleFiles[i].getAbsolutePath()); + Bundle b = equinox.getBundleContext() + .installBundle("reference:file:///" + testBundleFiles[i].getAbsolutePath()); b.adapt(BundleStartLevel.class).setStartLevel(i + 2); testBundles.add(b); b.start(); @@ -2494,7 +2544,8 @@ public void bundleChanged(BundleEvent event) { } else if (installBundles.compareAndSet(false, true)) { for (int i = numBundles / 2; i < numBundles; i++) { try { - Bundle b = finalEquinox.getBundleContext().installBundle("reference:file:///" + testBundleFiles[i].getAbsolutePath()); + Bundle b = finalEquinox.getBundleContext() + .installBundle("reference:file:///" + testBundleFiles[i].getAbsolutePath()); b.adapt(BundleStartLevel.class).setStartLevel(i + 2); testBundles.add(b); b.start(); @@ -2509,7 +2560,8 @@ public void bundleChanged(BundleEvent event) { equinox.getBundleContext().addBundleListener(initialListener); long startTime = System.currentTimeMillis(); final CountDownLatch waitForStartLevel = new CountDownLatch(1); - equinox.adapt(FrameworkStartLevel.class).setStartLevel(numBundles * 3, event -> waitForStartLevel.countDown()); + equinox.adapt(FrameworkStartLevel.class).setStartLevel(numBundles * 3, + event -> waitForStartLevel.countDown()); waitForStartLevel.await(20, TimeUnit.SECONDS); System.out.println("Start time: " + (System.currentTimeMillis() - startTime)); @@ -2592,7 +2644,7 @@ public void bundleChanged(BundleEvent event) { @Test public void testStartLevelSingleThread() throws Exception { - File config = OSGiTestsActivator.getContext().getDataFile(getName()); //$NON-NLS-1$ + File config = OSGiTestsActivator.getContext().getDataFile(getName()); // $NON-NLS-1$ Map configuration = new HashMap(); configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); Equinox equinox = null; @@ -2602,7 +2654,8 @@ public void testStartLevelSingleThread() throws Exception { equinox = new Equinox(configuration); equinox.start(); for (int i = 0; i < numBundles; i++) { - Bundle b = equinox.getBundleContext().installBundle("reference:file:///" + testBundleFiles[i].getAbsolutePath()); + Bundle b = equinox.getBundleContext() + .installBundle("reference:file:///" + testBundleFiles[i].getAbsolutePath()); b.adapt(BundleStartLevel.class).setStartLevel(5); b.start(); } @@ -2670,7 +2723,8 @@ private void doTestStartLevelMultiThread(int expectedCount, final boolean restri equinox.start(); FrameworkWiring fwkWiring = equinox.adapt(FrameworkWiring.class); for (int i = 0; i < numBundles; i++) { - Bundle b = equinox.getBundleContext().installBundle("reference:file:///" + testBundleFiles[i].getAbsolutePath()); + Bundle b = equinox.getBundleContext() + .installBundle("reference:file:///" + testBundleFiles[i].getAbsolutePath()); if (i < 30) { b.adapt(BundleStartLevel.class).setStartLevel(5); } else { @@ -2729,7 +2783,8 @@ private void doTestStartLevelMultiThread(int expectedCount, final boolean restri boolean b2pa = b2.adapt(Module.class).isParallelActivated(); assertTrue("Wrong order to start bundles: " + b1 + " - " + b2, b1pa || (!b1pa && !b2pa)); if (!b1pa) { - assertTrue("Wrong order to start bundles: " + b1 + " - " + b2, b1.getBundleId() < b2.getBundleId()); + assertTrue("Wrong order to start bundles: " + b1 + " - " + b2, + b1.getBundleId() < b2.getBundleId()); } } } else { @@ -2743,7 +2798,7 @@ private void doTestStartLevelMultiThread(int expectedCount, final boolean restri @Test public void testParallelActivationPersistence() throws IOException, BundleException { - File config = OSGiTestsActivator.getContext().getDataFile(getName()); //$NON-NLS-1$ + File config = OSGiTestsActivator.getContext().getDataFile(getName()); // $NON-NLS-1$ Map configuration = new HashMap(); configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); final int numBundles = 4; @@ -2754,7 +2809,8 @@ public void testParallelActivationPersistence() throws IOException, BundleExcept equinox.start(); FrameworkWiring fwkWiring = equinox.adapt(FrameworkWiring.class); for (int i = 0; i < numBundles; i++) { - Bundle b = equinox.getBundleContext().installBundle("reference:file:///" + testBundleFiles[i].getAbsolutePath()); + Bundle b = equinox.getBundleContext() + .installBundle("reference:file:///" + testBundleFiles[i].getAbsolutePath()); Module m = b.adapt(Module.class); assertFalse("Wrong initial value for parallelActivation", m.isParallelActivated()); if (b.getBundleId() % 2 == 0) { @@ -2787,7 +2843,7 @@ public void testParallelActivationPersistence() throws IOException, BundleExcept @Test public void testBundleIDLock() throws Exception { - File config = OSGiTestsActivator.getContext().getDataFile(getName()); //$NON-NLS-1$ + File config = OSGiTestsActivator.getContext().getDataFile(getName()); // $NON-NLS-1$ Map configuration = new HashMap<>(); configuration.put(EquinoxConfiguration.PROP_FILE_LIMIT, "10"); configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); @@ -2830,7 +2886,7 @@ public void testBundleIDLock() throws Exception { @Test public void testMRUBundleFileListOverflow() throws Exception { - File config = OSGiTestsActivator.getContext().getDataFile(getName()); //$NON-NLS-1$ + File config = OSGiTestsActivator.getContext().getDataFile(getName()); // $NON-NLS-1$ final int numBundles = 5000; final File[] testBundles = createBundles(new File(config, "bundles"), numBundles); //$NON-NLS-1$ @@ -2844,7 +2900,8 @@ public void testMRUBundleFileListOverflow() throws Exception { Map configuration = new HashMap<>(); configuration.put(EquinoxConfiguration.PROP_FILE_LIMIT, "10"); configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); - //configuration.put(EquinoxConfiguration.PROP_DEBUG, debugOptions.getAbsolutePath()); + // configuration.put(EquinoxConfiguration.PROP_DEBUG, + // debugOptions.getAbsolutePath()); final Equinox equinox = new Equinox(configuration); equinox.start(); @@ -2887,7 +2944,7 @@ public void testMRUBundleFileListOverflow() throws Exception { @Test public void testZipBundleFileOpenLock() throws Exception { - File config = OSGiTestsActivator.getContext().getDataFile(getName()); //$NON-NLS-1$ + File config = OSGiTestsActivator.getContext().getDataFile(getName()); // $NON-NLS-1$ config.mkdirs(); Map bundleHeaders = new HashMap<>(); @@ -2911,7 +2968,8 @@ public void testZipBundleFileOpenLock() throws Exception { final BundleContext systemContext = equinox.getBundleContext(); String converterFilter = "(&(objectClass=" + URLConverter.class.getName() + ")(protocol=bundleentry))"; - final URLConverter converter = systemContext.getService(systemContext.getServiceReferences(URLConverter.class, converterFilter).iterator().next()); + final URLConverter converter = systemContext + .getService(systemContext.getServiceReferences(URLConverter.class, converterFilter).iterator().next()); final Bundle testBundle = systemContext.installBundle("file:///" + testBundleFile.getAbsolutePath()); testBundle.start(); @@ -2935,7 +2993,8 @@ public void testZipBundleFileOpenLock() throws Exception { assertNotNull("Failed to convert to file URL", dirBURL); URL dirAURL = converter.toFileURL(testBundle.getEntry("dirA/")); assertNotNull("Failed to convert to file URL", dirAURL); - List allEntries = testBundle.adapt(BundleWiring.class).findEntries("/", "*", BundleWiring.FINDENTRIES_RECURSE); + List allEntries = testBundle.adapt(BundleWiring.class).findEntries("/", "*", + BundleWiring.FINDENTRIES_RECURSE); assertEquals("Wrong number of entries: " + allEntries, 8, allEntries.size()); } catch (IOException e) { throw new AssertionFailedError(e.getMessage()); @@ -2975,17 +3034,20 @@ public void testZipBundleFileOpenLock() throws Exception { @Test public void testContextFinderGetResource() throws Exception { - File config = OSGiTestsActivator.getContext().getDataFile(getName()); //$NON-NLS-1$ + File config = OSGiTestsActivator.getContext().getDataFile(getName()); // $NON-NLS-1$ Map configuration = new HashMap(); configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); - configuration.put(EquinoxConfiguration.PROP_CONTEXTCLASSLOADER_PARENT, EquinoxConfiguration.CONTEXTCLASSLOADER_PARENT_FWK); + configuration.put(EquinoxConfiguration.PROP_CONTEXTCLASSLOADER_PARENT, + EquinoxConfiguration.CONTEXTCLASSLOADER_PARENT_FWK); Equinox equinox = null; try { equinox = new Equinox(configuration); equinox.init(); BundleContext bc = equinox.getBundleContext(); // get the context finder explicitly to test - ClassLoader contextFinder = bc.getService(bc.getServiceReferences(ClassLoader.class, "(equinox.classloader.type=contextClassLoader)").iterator().next()); + ClassLoader contextFinder = bc.getService( + bc.getServiceReferences(ClassLoader.class, "(equinox.classloader.type=contextClassLoader)") + .iterator().next()); // Using a resource we know is in the framework String resource = "profile.list"; URL fwkURL = Bundle.class.getClassLoader().getResource(resource); @@ -3005,7 +3067,7 @@ public void testContextFinderGetResource() throws Exception { @Test public void testDynamicImportFromSystemBundle() throws Exception { - File config = OSGiTestsActivator.getContext().getDataFile(getName()); //$NON-NLS-1$ + File config = OSGiTestsActivator.getContext().getDataFile(getName()); // $NON-NLS-1$ Map configuration = new HashMap(); configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); configuration.put(Constants.FRAMEWORK_SYSTEMPACKAGES_EXTRA, "some.system.pkg"); @@ -3044,7 +3106,7 @@ public void testDynamicImportFromSystemBundle() throws Exception { @Test public void testDynamicImportPrivatePackage() throws Exception { - File config = OSGiTestsActivator.getContext().getDataFile(getName()); //$NON-NLS-1$ + File config = OSGiTestsActivator.getContext().getDataFile(getName()); // $NON-NLS-1$ Map configuration = new HashMap(); configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); Equinox equinox = null; @@ -3117,7 +3179,7 @@ private long doTestExistingBundleFile(BundleContext bc, long next, File rootStor } private Path createGenerationContent(long nextBundleID, File rootStore, boolean directory) throws IOException { - Path nextBundleFile = rootStore.toPath().resolve( nextBundleID + "/0/bundleFile") ; + Path nextBundleFile = rootStore.toPath().resolve(nextBundleID + "/0/bundleFile"); if (directory) { nextBundleFile = nextBundleFile.resolve("testContent.txt"); } @@ -3125,11 +3187,12 @@ private Path createGenerationContent(long nextBundleID, File rootStore, boolean return Files.write(nextBundleFile, Arrays.asList("Some Content")); } - // Note this is more of a performance test. It has a timeout that will cause it to + // Note this is more of a performance test. It has a timeout that will cause it + // to // fail if it takes too long. @Test public void testMassiveParallelInstallStart() throws Exception { - File config = OSGiTestsActivator.getContext().getDataFile(getName()); //$NON-NLS-1$ + File config = OSGiTestsActivator.getContext().getDataFile(getName()); // $NON-NLS-1$ Map configuration = new HashMap<>(); configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); @@ -3175,7 +3238,8 @@ public void testMassiveParallelInstallStart() throws Exception { Assert.assertEquals("Errors found.", Collections.emptyList(), errors); Assert.assertEquals("Wrong number of bundles.", numBundles + 1, systemContext.getBundles().length); - List providedWires = equinox.adapt(BundleWiring.class).getProvidedWires(PackageNamespace.PACKAGE_NAMESPACE); + List providedWires = equinox.adapt(BundleWiring.class) + .getProvidedWires(PackageNamespace.PACKAGE_NAMESPACE); Assert.assertEquals("Wrong number of provided wires.", numBundles, providedWires.size()); stop(equinox); @@ -3184,8 +3248,7 @@ public void testMassiveParallelInstallStart() throws Exception { @Test public void testDeleteBundleFile() throws IOException, BundleException { File config = OSGiTestsActivator.getContext().getDataFile(getName()); - Equinox equinox = new Equinox( - Collections.singletonMap(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath())); + Equinox equinox = new Equinox(Collections.singletonMap(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath())); equinox.start(); BundleContext bc = equinox.getBundleContext(); diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/classes/Activator.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/classes/Activator.java index 129445301d0..f2140add0f2 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/classes/Activator.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/classes/Activator.java @@ -21,7 +21,8 @@ public class Activator implements BundleActivator { @Override public void start(BundleContext context) throws Exception { - context.registerService(Activator.class, this, new Hashtable<>(Collections.singletonMap("activator", this.getClass().getSimpleName()))); + context.registerService(Activator.class, this, + new Hashtable<>(Collections.singletonMap("activator", this.getClass().getSimpleName()))); } @Override diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/configuration/EclipseStarterConfigIniTest.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/configuration/EclipseStarterConfigIniTest.java index 29bd553abe3..2e966dab36a 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/configuration/EclipseStarterConfigIniTest.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/configuration/EclipseStarterConfigIniTest.java @@ -30,13 +30,15 @@ public class EclipseStarterConfigIniTest extends OSGiTest { public static Test suite() { TestSuite suite = new TestSuite(EclipseStarterConfigIniTest.class.getName()); - ConfigurationSessionTestSuite falseCompatBootDelegation = new ConfigurationSessionTestSuite(PI_OSGI_TESTS, EclipseStarterConfigIniTest.class.getName()); + ConfigurationSessionTestSuite falseCompatBootDelegation = new ConfigurationSessionTestSuite(PI_OSGI_TESTS, + EclipseStarterConfigIniTest.class.getName()); addRequiredOSGiTestsBundles(falseCompatBootDelegation); falseCompatBootDelegation.addTest(new EclipseStarterConfigIniTest("testFalseCompatBootDelegation")); falseCompatBootDelegation.setConfigIniValue("osgi.compatibility.bootdelegation", "false"); suite.addTest(falseCompatBootDelegation); - ConfigurationSessionTestSuite defaultCompatBootDelegation = new ConfigurationSessionTestSuite(PI_OSGI_TESTS, EclipseStarterConfigIniTest.class.getName()); + ConfigurationSessionTestSuite defaultCompatBootDelegation = new ConfigurationSessionTestSuite(PI_OSGI_TESTS, + EclipseStarterConfigIniTest.class.getName()); addRequiredOSGiTestsBundles(defaultCompatBootDelegation); defaultCompatBootDelegation.addTest(new EclipseStarterConfigIniTest("testDefaultCompatBootDelegation")); suite.addTest(defaultCompatBootDelegation); diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/configuration/EclipseStarterConfigurationAreaTest.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/configuration/EclipseStarterConfigurationAreaTest.java index de0e2940057..22026d07142 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/configuration/EclipseStarterConfigurationAreaTest.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/configuration/EclipseStarterConfigurationAreaTest.java @@ -29,7 +29,8 @@ public class EclipseStarterConfigurationAreaTest extends OSGiTest { public static Test suite() { TestSuite suite = new TestSuite(EclipseStarterConfigurationAreaTest.class.getName()); - ConfigurationSessionTestSuite initialization = new ConfigurationSessionTestSuite(PI_OSGI_TESTS, EclipseStarterConfigurationAreaTest.class.getName()); + ConfigurationSessionTestSuite initialization = new ConfigurationSessionTestSuite(PI_OSGI_TESTS, + EclipseStarterConfigurationAreaTest.class.getName()); addRequiredOSGiTestsBundles(initialization); initialization.addBundle("org.eclipse.osgi.compatibility.state"); // disable clean-up, we want to reuse the configuration @@ -40,7 +41,8 @@ public static Test suite() { // restart with cache but remove the compatibility fragment IPath configPath = initialization.getConfigurationPath(); - ConfigurationSessionTestSuite removeExtension = new ConfigurationSessionTestSuite(PI_OSGI_TESTS, EclipseStarterConfigurationAreaTest.class.getName()); + ConfigurationSessionTestSuite removeExtension = new ConfigurationSessionTestSuite(PI_OSGI_TESTS, + EclipseStarterConfigurationAreaTest.class.getName()); removeExtension.setConfigurationPath(configPath); addRequiredOSGiTestsBundles(removeExtension); removeExtension.addTest(new EclipseStarterConfigurationAreaTest("testRemoveExtension")); @@ -54,13 +56,15 @@ public EclipseStarterConfigurationAreaTest(String name) { public void testInitializeExtension() { // initialization session - List fragWires = getContext().getBundle(Constants.SYSTEM_BUNDLE_LOCATION).adapt(BundleWiring.class).getProvidedWires(HostNamespace.HOST_NAMESPACE); + List fragWires = getContext().getBundle(Constants.SYSTEM_BUNDLE_LOCATION).adapt(BundleWiring.class) + .getProvidedWires(HostNamespace.HOST_NAMESPACE); assertEquals("Wrong number of system fragments.", 1, fragWires.size()); } public void testRemoveExtension() { // removed extension session - List fragWires = getContext().getBundle(Constants.SYSTEM_BUNDLE_LOCATION).adapt(BundleWiring.class).getProvidedWires(HostNamespace.HOST_NAMESPACE); + List fragWires = getContext().getBundle(Constants.SYSTEM_BUNDLE_LOCATION).adapt(BundleWiring.class) + .getProvidedWires(HostNamespace.HOST_NAMESPACE); assertEquals("Wrong number of system fragments.", 0, fragWires.size()); } diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/configuration/MovableConfigurationAreaTest.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/configuration/MovableConfigurationAreaTest.java index c2076b9ca51..fe30042496c 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/configuration/MovableConfigurationAreaTest.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/configuration/MovableConfigurationAreaTest.java @@ -32,7 +32,8 @@ public class MovableConfigurationAreaTest extends OSGiTest { static void doMove(final IPath sourcePath, final IPath destinationPath) { - assertTrue("Failed moving " + sourcePath + " to " + destinationPath, sourcePath.toFile().renameTo(destinationPath.toFile())); + assertTrue("Failed moving " + sourcePath + " to " + destinationPath, + sourcePath.toFile().renameTo(destinationPath.toFile())); } static void doTakeSnapshot(final IPath destinationPath) { @@ -50,7 +51,8 @@ static void doTakeSnapshot(final IPath destinationPath) { public static Test suite() { TestSuite suite = new TestSuite(MovableConfigurationAreaTest.class.getName()); - ConfigurationSessionTestSuite initialization = new ConfigurationSessionTestSuite(PI_OSGI_TESTS, MovableConfigurationAreaTest.class.getName()); + ConfigurationSessionTestSuite initialization = new ConfigurationSessionTestSuite(PI_OSGI_TESTS, + MovableConfigurationAreaTest.class.getName()); addRequiredOSGiTestsBundles(initialization); initialization.setReadOnly(true); // disable clean-up, we want to reuse the configuration @@ -72,7 +74,8 @@ public void runBare() throws Throwable { } }); - ConfigurationSessionTestSuite afterMoving = new ConfigurationSessionTestSuite(PI_OSGI_TESTS, MovableConfigurationAreaTest.class.getName()); + ConfigurationSessionTestSuite afterMoving = new ConfigurationSessionTestSuite(PI_OSGI_TESTS, + MovableConfigurationAreaTest.class.getName()); afterMoving.setConfigurationPath(destinationPath); afterMoving.addMinimalBundleSet(); afterMoving.setReadOnly(true); @@ -89,15 +92,17 @@ public MovableConfigurationAreaTest(String name) { } /** - * Tries to install a plug-in that has no manifest. Should fail because by default the manifest generation area - * is under the configuration area (which is read-only here) + * Tries to install a plug-in that has no manifest. Should fail because by + * default the manifest generation area is under the configuration area (which + * is read-only here) */ public void testAfterMoving() throws MalformedURLException, IOException, BundleException { // try to install plug-in // ensure it is not installed Bundle installed = null; try { - installed = BundleTestingHelper.installBundle(getContext(), OSGiTestsActivator.TEST_FILES_ROOT + "configuration/bundle02"); + installed = BundleTestingHelper.installBundle(getContext(), + OSGiTestsActivator.TEST_FILES_ROOT + "configuration/bundle02"); // should have failed with BundleException, does not have a bundle manifest fail("1.0"); } catch (BundleException be) { @@ -112,9 +117,10 @@ public void testAfterMoving() throws MalformedURLException, IOException, BundleE public void testInitialization() throws MalformedURLException, IOException { // initialization session try { - Bundle installed = BundleTestingHelper.installBundle("1.0", getContext(), OSGiTestsActivator.TEST_FILES_ROOT + "configuration/bundle01"); + Bundle installed = BundleTestingHelper.installBundle("1.0", getContext(), + OSGiTestsActivator.TEST_FILES_ROOT + "configuration/bundle01"); // not read-only yet, should work fine - if (!BundleTestingHelper.resolveBundles(getContext(), new Bundle[] {installed})) + if (!BundleTestingHelper.resolveBundles(getContext(), new Bundle[] { installed })) fail("1.1"); } catch (BundleException be) { fail("1.2", be); diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/configuration/ReadOnlyConfigurationAreaTest.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/configuration/ReadOnlyConfigurationAreaTest.java index 6434538ae9d..035775a055e 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/configuration/ReadOnlyConfigurationAreaTest.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/configuration/ReadOnlyConfigurationAreaTest.java @@ -28,7 +28,8 @@ public class ReadOnlyConfigurationAreaTest extends OSGiTest { public static Test suite() { - ConfigurationSessionTestSuite suite = new ConfigurationSessionTestSuite(PI_OSGI_TESTS, ReadOnlyConfigurationAreaTest.class); + ConfigurationSessionTestSuite suite = new ConfigurationSessionTestSuite(PI_OSGI_TESTS, + ReadOnlyConfigurationAreaTest.class); suite.setReadOnly(true); addRequiredOSGiTestsBundles(suite); return suite; @@ -41,9 +42,10 @@ public ReadOnlyConfigurationAreaTest(String name) { public void test0thSession() throws MalformedURLException, IOException { // initialization session try { - Bundle installed = BundleTestingHelper.installBundle("1.0", getContext(), OSGiTestsActivator.TEST_FILES_ROOT + "configuration/bundle01"); + Bundle installed = BundleTestingHelper.installBundle("1.0", getContext(), + OSGiTestsActivator.TEST_FILES_ROOT + "configuration/bundle01"); // not read-only yet, should work fine - if (!BundleTestingHelper.resolveBundles(getContext(), new Bundle[] {installed})) + if (!BundleTestingHelper.resolveBundles(getContext(), new Bundle[] { installed })) fail("1.1"); } catch (BundleException be) { fail("1.2", be); @@ -74,15 +76,17 @@ public void test1stSessionFollowUp() throws IOException { } /** - * Tries to install a plug-in that has no manifest. Should fail because by default the manifest generation area - * is under the configuration area (which is read-only here) + * Tries to install a plug-in that has no manifest. Should fail because by + * default the manifest generation area is under the configuration area (which + * is read-only here) */ public void test2ndSession() throws BundleException, IOException { // try to install plug-in // ensure it is not installed Bundle installed = null; try { - installed = BundleTestingHelper.installBundle(getContext(), OSGiTestsActivator.TEST_FILES_ROOT + "configuration/bundle02"); + installed = BundleTestingHelper.installBundle(getContext(), + OSGiTestsActivator.TEST_FILES_ROOT + "configuration/bundle02"); // should have failed with BundleException, does not have a bundle manifest fail("1.0"); } catch (BundleException be) { @@ -103,15 +107,17 @@ public void test2ndSessionFollowUp() throws IOException { } /** - * Tries to install a plug-in that has manifest. Should fail because by default the manifest generation area - * is under the configuration area (which is read-only here) + * Tries to install a plug-in that has manifest. Should fail because by default + * the manifest generation area is under the configuration area (which is + * read-only here) */ public void test3rdSession() throws BundleException, IOException { // install plug-in // ensure it is not installed Bundle installed = null; try { - installed = BundleTestingHelper.installBundle(getContext(), OSGiTestsActivator.TEST_FILES_ROOT + "configuration/bundle03"); + installed = BundleTestingHelper.installBundle(getContext(), + OSGiTestsActivator.TEST_FILES_ROOT + "configuration/bundle03"); // should have failed - cannot install a bundle in read-only mode fail("1.0"); } catch (BundleException be) { diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/container/AbstractTest.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/container/AbstractTest.java index b26b2f2bb27..5491cc64232 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/container/AbstractTest.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/container/AbstractTest.java @@ -65,7 +65,8 @@ protected DummyContainerAdaptor createDummyAdaptor(ResolverHook hook) { } protected DummyContainerAdaptor createDummyAdaptor(DebugOptions debugOptions) { - return new DummyContainerAdaptor(new DummyCollisionHook(false), null, new DummyResolverHookFactory(), debugOptions); + return new DummyContainerAdaptor(new DummyCollisionHook(false), null, new DummyResolverHookFactory(), + debugOptions); } protected Bundle getBundle() { @@ -90,22 +91,27 @@ protected BundleContext getSystemBundleContext() { return getSystemBundle().getBundleContext(); } - protected Module installDummyModule(String manifestFile, String location, ModuleContainer container) throws BundleException, IOException { + protected Module installDummyModule(String manifestFile, String location, ModuleContainer container) + throws BundleException, IOException { return installDummyModule(manifestFile, location, null, null, null, container); } - protected Module installDummyModule(String manifestFile, String location, String alias, String extraExports, String extraCapabilities, ModuleContainer container) throws BundleException, IOException { + protected Module installDummyModule(String manifestFile, String location, String alias, String extraExports, + String extraCapabilities, ModuleContainer container) throws BundleException, IOException { Map manifest = getManifest(manifestFile); - ModuleRevisionBuilder builder = OSGiManifestBuilderFactory.createBuilder(manifest, alias, extraExports, extraCapabilities); + ModuleRevisionBuilder builder = OSGiManifestBuilderFactory.createBuilder(manifest, alias, extraExports, + extraCapabilities); Module system = container.getModule(0); return container.install(system, location, builder, null); } - protected Module installDummyModule(Map manifest, String location, ModuleContainer container) throws BundleException { + protected Module installDummyModule(Map manifest, String location, ModuleContainer container) + throws BundleException { return installDummyModule(manifest, -1, location, container); } - protected Module installDummyModule(Map manifest, long id, String location, ModuleContainer container) throws BundleException { + protected Module installDummyModule(Map manifest, long id, String location, + ModuleContainer container) throws BundleException { ModuleRevisionBuilder builder = OSGiManifestBuilderFactory.createBuilder(manifest); if (id > 0) { builder.setId(id); diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/container/AllTests.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/container/AllTests.java index 2da06965c60..fc62a334d6f 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/container/AllTests.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/container/AllTests.java @@ -23,7 +23,6 @@ ModuleContainerUsageTest.class, // NamespaceListTest.class, // NamespaceListBuilderTest.class, // - ModuleWiringTest.class -}) + ModuleWiringTest.class }) public class AllTests { } diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/container/ModuleContainerUsageTest.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/container/ModuleContainerUsageTest.java index 0c2f869c936..b2fe57b3349 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/container/ModuleContainerUsageTest.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/container/ModuleContainerUsageTest.java @@ -80,8 +80,7 @@ public void filterMatches(BundleRequirement requirement, Collection revisionInfo, - Collection candidates) { + private void filterBasedOnEE(AtomicReference revisionInfo, Collection candidates) { Long eeIndex = revisionInfo.get(); // if the eeIndex is set for the revision then check if the package is // available in the specified EE @@ -120,12 +119,10 @@ public void end() { // the set of packages // above for the specified EE_INDEX StringBuilder systemEEs = new StringBuilder(); - systemEEs.append( - "osgi.ee; osgi.ee=\"JavaSE\"; version:List=\"1.0, 1.1, 1.2, 1.3, 1.4, 1.5\"; " + EE_INDEX - + ":Long=1"); - systemEEs.append( - ",osgi.ee; osgi.ee=\"JavaSE\"; version:List=\"1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6\"; " + EE_INDEX - + ":Long=2"); + systemEEs.append("osgi.ee; osgi.ee=\"JavaSE\"; version:List=\"1.0, 1.1, 1.2, 1.3, 1.4, 1.5\"; " + + EE_INDEX + ":Long=1"); + systemEEs.append(",osgi.ee; osgi.ee=\"JavaSE\"; version:List=\"1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6\"; " + + EE_INDEX + ":Long=2"); systemEEs.append( ",osgi.ee; osgi.ee=\"JavaSE\"; version:List=\"1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7\"; " + EE_INDEX + ":Long=3"); @@ -143,10 +140,8 @@ public void end() { executionEnvironments.addAll(systemBundle.getCurrentRevision() .getDeclaredCapabilities(ExecutionEnvironmentNamespace.EXECUTION_ENVIRONMENT_NAMESPACE)); - Module m1 = installModule(container, "m1", "1.0", "test.pkg1", "JavaSE-1.5", - executionEnvironments); - Module m2 = installModule(container, "m2", "1.0", "test.pkg1,test.pkg2", "JavaSE-1.5", - executionEnvironments); + Module m1 = installModule(container, "m1", "1.0", "test.pkg1", "JavaSE-1.5", executionEnvironments); + Module m2 = installModule(container, "m2", "1.0", "test.pkg1,test.pkg2", "JavaSE-1.5", executionEnvironments); Module m3 = installModule(container, "m3", "1.0", "test.pkg1,test.pkg2,test.pkg3", "JavaSE-1.7", executionEnvironments); diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/container/ResolutionReportTest.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/container/ResolutionReportTest.java index 14e98c9d4ce..74c435650ef 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/container/ResolutionReportTest.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/container/ResolutionReportTest.java @@ -31,12 +31,14 @@ import org.osgi.resource.*; public class ResolutionReportTest extends AbstractTest { - // TODO Add test for dynamic resolution in conjunction with UNRESOLVED_PROVIDER entries. + // TODO Add test for dynamic resolution in conjunction with UNRESOLVED_PROVIDER + // entries. @Test public void testResolutionReportListenerService() throws Exception { DummyResolverHook hook = new DummyResolverHook(); - registerService(org.osgi.framework.hooks.resolver.ResolverHookFactory.class, new DummyResolverHookFactory(hook)); + registerService(org.osgi.framework.hooks.resolver.ResolverHookFactory.class, + new DummyResolverHookFactory(hook)); getSystemBundle().adapt(FrameworkWiring.class).resolveBundles(Collections.singleton(getSystemBundle())); assertEquals("No resolution report listener callback", 1, hook.getResolutionReports().size()); assertNotNull("Resolution report was null", hook.getResolutionReports().get(0)); @@ -81,7 +83,8 @@ public void testResolutionReportEntrySingletonSelectionNoneResolved() throws Exc DummyContainerAdaptor adaptor = createDummyAdaptor(hook); ModuleContainer container = adaptor.getContainer(); Module resolutionReporta = installDummyModule("resolution.report.a.MF", "resolution.report.a", container); - Module resolutionReportaV1 = installDummyModule("resolution.report.a.v1.MF", "resolution.report.a.v1", container); + Module resolutionReportaV1 = installDummyModule("resolution.report.a.v1.MF", "resolution.report.a.v1", + container); assertResolutionDoesNotSucceed(container, Arrays.asList(resolutionReporta, resolutionReportaV1)); ResolutionReport report = hook.getResolutionReports().get(0); Map> resourceToEntries = report.getEntries(); @@ -99,7 +102,8 @@ public void testResolutionReportEntrySingletonSelectionHighestVersionResolved() DummyContainerAdaptor adaptor = createDummyAdaptor(hook); ModuleContainer container = adaptor.getContainer(); Module resolutionReporta = installDummyModule("resolution.report.a.MF", "resolution.report.a", container); - Module resolutionReportaV1 = installDummyModule("resolution.report.a.v1.MF", "resolution.report.a.v1", container); + Module resolutionReportaV1 = installDummyModule("resolution.report.a.v1.MF", "resolution.report.a.v1", + container); container.resolve(Arrays.asList(resolutionReportaV1), true); clearResolutionReports(hook); assertResolutionDoesNotSucceed(container, Arrays.asList(resolutionReporta)); @@ -121,7 +125,8 @@ public void testResolutionReportEntrySingletonSelectionLowestVersionResolved() t Module resolutionReporta = installDummyModule("resolution.report.a.MF", "resolution.report.a", container); container.resolve(Arrays.asList(resolutionReporta), true); clearResolutionReports(hook); - Module resolutionReportaV1 = installDummyModule("resolution.report.a.v1.MF", "resolution.report.a.v1", container); + Module resolutionReportaV1 = installDummyModule("resolution.report.a.v1.MF", "resolution.report.a.v1", + container); assertResolutionDoesNotSucceed(container, Arrays.asList(resolutionReportaV1)); ResolutionReport report = hook.getResolutionReports().get(0); Map> resourceToEntries = report.getEntries(); @@ -166,7 +171,10 @@ public void testResolutionReportEntryUnresolvedProvider01() throws Exception { assertResolutionReportEntriesSize(entries, 1); ResolutionReport.Entry entry = entries.get(0); assertResolutionReportEntryTypeUnresolvedProvider(entry.getType()); - assertResolutionReportEntryDataUnresolvedProvider(entry.getData(), new UnresolvedProviderEntryBuilder().requirement(resolutionReportC.getCurrentRevision().getRequirements("resolution.report.d").get(0)).capability(resolutionReportD.getCurrentRevision().getCapabilities("resolution.report.d").get(0)).build()); + assertResolutionReportEntryDataUnresolvedProvider(entry.getData(), new UnresolvedProviderEntryBuilder() + .requirement(resolutionReportC.getCurrentRevision().getRequirements("resolution.report.d").get(0)) + .capability(resolutionReportD.getCurrentRevision().getCapabilities("resolution.report.d").get(0)) + .build()); entries = resourceToEntries.get(resolutionReportD.getCurrentRevision()); assertResolutionReportEntriesSize(entries, 1); @@ -192,7 +200,13 @@ public void testResolutionReportEntryUnresolvedProvider02() throws Exception { assertResolutionReportEntriesSize(entries, 1); ResolutionReport.Entry entry = entries.get(0); assertResolutionReportEntryTypeUnresolvedProvider(entry.getType()); - assertResolutionReportEntryDataUnresolvedProvider(entry.getData(), new UnresolvedProviderEntryBuilder().requirement(resolutionReportG.getCurrentRevision().getRequirements(PackageNamespace.PACKAGE_NAMESPACE).get(1)).capability(resolutionReportF.getCurrentRevision().getCapabilities(PackageNamespace.PACKAGE_NAMESPACE).get(0)).build()); + assertResolutionReportEntryDataUnresolvedProvider(entry.getData(), + new UnresolvedProviderEntryBuilder() + .requirement(resolutionReportG.getCurrentRevision() + .getRequirements(PackageNamespace.PACKAGE_NAMESPACE).get(1)) + .capability(resolutionReportF.getCurrentRevision() + .getCapabilities(PackageNamespace.PACKAGE_NAMESPACE).get(0)) + .build()); entries = resourceToEntries.get(resolutionReportF.getCurrentRevision()); assertResolutionReportEntriesSize(entries, 1); @@ -255,18 +269,21 @@ private void assertResolutionReportEntryTypeUnresolvedProvider(ResolutionReport. assertResolutionReportEntryType(ResolutionReport.Entry.Type.UNRESOLVED_PROVIDER, type); } - private void assertResolutionReportEntryDataMissingCapability(Object data, String namespace, String namespaceValue) { + private void assertResolutionReportEntryDataMissingCapability(Object data, String namespace, + String namespaceValue) { assertResolutionReportEntryDataNotNull(data); assertTrue("Wrong resolution report entry data type", data instanceof Requirement); Requirement requirement = (Requirement) data; assertEquals("Wrong requirement namespace", namespace, requirement.getNamespace()); if (namespaceValue == null) return; - assertTrue("Wrong requirement namespace value", requirement.getDirectives().get(Namespace.REQUIREMENT_FILTER_DIRECTIVE).contains(namespace + "=" + namespaceValue)); + assertTrue("Wrong requirement namespace value", requirement.getDirectives() + .get(Namespace.REQUIREMENT_FILTER_DIRECTIVE).contains(namespace + "=" + namespaceValue)); } @SuppressWarnings("unchecked") - private void assertResolutionReportEntryDataUnresolvedProvider(Object data, Map> expected) { + private void assertResolutionReportEntryDataUnresolvedProvider(Object data, + Map> expected) { assertResolutionReportEntryDataNotNull(data); assertTrue("Wrong resolution report entry data type", data instanceof Map); Map> unresolvedProviders = (Map>) data; @@ -284,7 +301,8 @@ private void assertResolutionReportEntryTypeMissingCapability(ResolutionReport.E assertResolutionReportEntryType(ResolutionReport.Entry.Type.MISSING_CAPABILITY, type); } - private void assertResolutionReportEntryType(ResolutionReport.Entry.Type expected, ResolutionReport.Entry.Type actual) { + private void assertResolutionReportEntryType(ResolutionReport.Entry.Type expected, + ResolutionReport.Entry.Type actual) { assertEquals("Wrong resolution report entry type", expected, actual); } } diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/container/TestModuleContainer.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/container/TestModuleContainer.java index b77a56e643c..98327ff333b 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/container/TestModuleContainer.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/container/TestModuleContainer.java @@ -134,8 +134,11 @@ private DummyModuleDatabase getDatabase() throws BundleException { String osName = context.getProperty(OSGI_OS); String wsName = context.getProperty(OSGI_WS); String archName = context.getProperty(OSGI_ARCH); - extraCapabilities += EclipsePlatformNamespace.ECLIPSE_PLATFORM_NAMESPACE + "; " + OSGI_OS + "=" + osName + "; " + OSGI_WS + "=" + wsName + "; " + OSGI_ARCH + "=" + archName; - ModuleRevisionBuilder systembuilder = OSGiManifestBuilderFactory.createBuilder(asMap(systemBundle.getHeaders("")), Constants.SYSTEM_BUNDLE_SYMBOLICNAME, extraPackages, extraCapabilities); + extraCapabilities += EclipsePlatformNamespace.ECLIPSE_PLATFORM_NAMESPACE + "; " + OSGI_OS + "=" + osName + "; " + + OSGI_WS + "=" + wsName + "; " + OSGI_ARCH + "=" + archName; + ModuleRevisionBuilder systembuilder = OSGiManifestBuilderFactory.createBuilder( + asMap(systemBundle.getHeaders("")), Constants.SYSTEM_BUNDLE_SYMBOLICNAME, extraPackages, + extraCapabilities); container.install(null, systemBundle.getLocation(), systembuilder, null); final List installErrors = new ArrayList<>(0); @@ -147,7 +150,8 @@ private DummyModuleDatabase getDatabase() throws BundleException { continue; executor.execute(() -> { try { - ModuleRevisionBuilder builder = OSGiManifestBuilderFactory.createBuilder(asMap(bundle.getHeaders(""))); + ModuleRevisionBuilder builder = OSGiManifestBuilderFactory + .createBuilder(asMap(bundle.getHeaders(""))); container.install(null, bundle.getLocation(), builder, null); } catch (Throwable t) { t.printStackTrace(); @@ -380,7 +384,8 @@ public void testExecutionEnvironment() throws BundleException, IOException { DummyContainerAdaptor adaptor = createDummyAdaptor(); ModuleContainer container = adaptor.getContainer(); String extraCapabilities = "osgi.ee; osgi.ee=JavaSE; version:List=\"1.3, 1.4, 1.5, 1.6, 1.7\""; - installDummyModule("system.bundle.MF", Constants.SYSTEM_BUNDLE_LOCATION, null, null, extraCapabilities, container); + installDummyModule("system.bundle.MF", Constants.SYSTEM_BUNDLE_LOCATION, null, null, extraCapabilities, + container); container.resolve(null, false); Module ee1 = installDummyModule("ee1_v1.MF", "ee1", container); @@ -397,14 +402,18 @@ public void testExecutionEnvironment() throws BundleException, IOException { assertNull("ee3 is resolved", ee3Wiring); // make sure the fragment ee requirement did not get merged into the host - List ee1Requirements = ee1Wiring.getModuleRequirements(ExecutionEnvironmentNamespace.EXECUTION_ENVIRONMENT_NAMESPACE); + List ee1Requirements = ee1Wiring + .getModuleRequirements(ExecutionEnvironmentNamespace.EXECUTION_ENVIRONMENT_NAMESPACE); assertEquals("Wrong number of requirements", 1, ee1Requirements.size()); - List ee1Wires = ee1Wiring.getRequiredModuleWires(ExecutionEnvironmentNamespace.EXECUTION_ENVIRONMENT_NAMESPACE); + List ee1Wires = ee1Wiring + .getRequiredModuleWires(ExecutionEnvironmentNamespace.EXECUTION_ENVIRONMENT_NAMESPACE); assertEquals("Wrong number of wires", 1, ee1Wires.size()); - List ee2Requirements = ee2Wiring.getModuleRequirements(ExecutionEnvironmentNamespace.EXECUTION_ENVIRONMENT_NAMESPACE); + List ee2Requirements = ee2Wiring + .getModuleRequirements(ExecutionEnvironmentNamespace.EXECUTION_ENVIRONMENT_NAMESPACE); assertEquals("Wrong number of requirements", 1, ee2Requirements.size()); - List ee2Wires = ee2Wiring.getRequiredModuleWires(ExecutionEnvironmentNamespace.EXECUTION_ENVIRONMENT_NAMESPACE); + List ee2Wires = ee2Wiring + .getRequiredModuleWires(ExecutionEnvironmentNamespace.EXECUTION_ENVIRONMENT_NAMESPACE); assertEquals("Wrong number of wires", 1, ee2Wires.size()); } @@ -413,7 +422,8 @@ public void testPlatformFilter01() throws BundleException, IOException { DummyContainerAdaptor adaptor = createDummyAdaptor(); ModuleContainer container = adaptor.getContainer(); String extraCapabilities = EclipsePlatformNamespace.ECLIPSE_PLATFORM_NAMESPACE + "; osgi.os=foo; osgi.arch=bar"; - installDummyModule("system.bundle.MF", Constants.SYSTEM_BUNDLE_LOCATION, null, null, extraCapabilities, container); + installDummyModule("system.bundle.MF", Constants.SYSTEM_BUNDLE_LOCATION, null, null, extraCapabilities, + container); container.resolve(null, false); Module platformFilter1 = installDummyModule("platformFilter1_v1.MF", "ee1", container); @@ -428,7 +438,8 @@ public void testPlatformFilter02() throws BundleException, IOException { DummyContainerAdaptor adaptor = createDummyAdaptor(); ModuleContainer container = adaptor.getContainer(); String extraCapabilities = EclipsePlatformNamespace.ECLIPSE_PLATFORM_NAMESPACE + "; osgi.os=baz; osgi.arch=boz"; - installDummyModule("system.bundle.MF", Constants.SYSTEM_BUNDLE_LOCATION, null, null, extraCapabilities, container); + installDummyModule("system.bundle.MF", Constants.SYSTEM_BUNDLE_LOCATION, null, null, extraCapabilities, + container); container.resolve(null, false); Module platformFilter1 = installDummyModule("platformFilter1_v1.MF", "ee1", container); @@ -523,7 +534,8 @@ public void testSingleton02() throws BundleException, IOException { ResolverHookFactory resolverHookFactory = triggers -> new ResolverHook() { @Override - public void filterSingletonCollisions(BundleCapability singleton, Collection collisionCandidates) { + public void filterSingletonCollisions(BundleCapability singleton, + Collection collisionCandidates) { collisionCandidates.clear(); } @@ -542,7 +554,8 @@ public void end() { // nothing } }; - DummyContainerAdaptor adaptor = new DummyContainerAdaptor(new DummyCollisionHook(false), Collections.emptyMap(), resolverHookFactory); + DummyContainerAdaptor adaptor = new DummyContainerAdaptor(new DummyCollisionHook(false), Collections.emptyMap(), + resolverHookFactory); ModuleContainer container = adaptor.getContainer(); Module s1 = installDummyModule("singleton1_v1.MF", "s1_v1", container); @@ -582,7 +595,8 @@ public void testSingleton04() throws BundleException, IOException { ResolverHookFactory resolverHookFactory = triggers -> new ResolverHook() { @Override - public void filterSingletonCollisions(BundleCapability singleton, Collection collisionCandidates) { + public void filterSingletonCollisions(BundleCapability singleton, + Collection collisionCandidates) { // nothing } @@ -601,7 +615,8 @@ public void end() { // nothing } }; - DummyContainerAdaptor adaptor = new DummyContainerAdaptor(new DummyCollisionHook(false), Collections.emptyMap(), resolverHookFactory); + DummyContainerAdaptor adaptor = new DummyContainerAdaptor(new DummyCollisionHook(false), Collections.emptyMap(), + resolverHookFactory); ModuleContainer container = adaptor.getContainer(); Module s1_v1 = installDummyModule("singleton1_v1.MF", "s1_v1", container); @@ -659,7 +674,14 @@ public void testEventsInstall() throws BundleException, IOException { Module c7 = installDummyModule("c7_v1.MF", "c7_v1", container); List actual = adaptor.getDatabase().getModuleEvents(); - List expected = Arrays.asList(new DummyModuleEvent(c1, ModuleEvent.INSTALLED, State.INSTALLED), new DummyModuleEvent(c2, ModuleEvent.INSTALLED, State.INSTALLED), new DummyModuleEvent(c3, ModuleEvent.INSTALLED, State.INSTALLED), new DummyModuleEvent(c4, ModuleEvent.INSTALLED, State.INSTALLED), new DummyModuleEvent(c5, ModuleEvent.INSTALLED, State.INSTALLED), new DummyModuleEvent(c6, ModuleEvent.INSTALLED, State.INSTALLED), new DummyModuleEvent(c7, ModuleEvent.INSTALLED, State.INSTALLED)); + List expected = Arrays.asList( + new DummyModuleEvent(c1, ModuleEvent.INSTALLED, State.INSTALLED), + new DummyModuleEvent(c2, ModuleEvent.INSTALLED, State.INSTALLED), + new DummyModuleEvent(c3, ModuleEvent.INSTALLED, State.INSTALLED), + new DummyModuleEvent(c4, ModuleEvent.INSTALLED, State.INSTALLED), + new DummyModuleEvent(c5, ModuleEvent.INSTALLED, State.INSTALLED), + new DummyModuleEvent(c6, ModuleEvent.INSTALLED, State.INSTALLED), + new DummyModuleEvent(c7, ModuleEvent.INSTALLED, State.INSTALLED)); assertEquals("Wrong install events.", expected, actual); } @@ -685,7 +707,14 @@ public void testEventsResolved() throws BundleException, IOException { container.resolve(Arrays.asList(c1, c2, c3, c4, c5, c6, c7), true); List actual = database.getModuleEvents(); - List expected = new ArrayList<>(Arrays.asList(new DummyModuleEvent(c1, ModuleEvent.RESOLVED, State.RESOLVED), new DummyModuleEvent(c2, ModuleEvent.RESOLVED, State.RESOLVED), new DummyModuleEvent(c3, ModuleEvent.RESOLVED, State.RESOLVED), new DummyModuleEvent(c4, ModuleEvent.RESOLVED, State.RESOLVED), new DummyModuleEvent(c5, ModuleEvent.RESOLVED, State.RESOLVED), new DummyModuleEvent(c6, ModuleEvent.RESOLVED, State.RESOLVED), new DummyModuleEvent(c7, ModuleEvent.RESOLVED, State.RESOLVED))); + List expected = new ArrayList<>( + Arrays.asList(new DummyModuleEvent(c1, ModuleEvent.RESOLVED, State.RESOLVED), + new DummyModuleEvent(c2, ModuleEvent.RESOLVED, State.RESOLVED), + new DummyModuleEvent(c3, ModuleEvent.RESOLVED, State.RESOLVED), + new DummyModuleEvent(c4, ModuleEvent.RESOLVED, State.RESOLVED), + new DummyModuleEvent(c5, ModuleEvent.RESOLVED, State.RESOLVED), + new DummyModuleEvent(c6, ModuleEvent.RESOLVED, State.RESOLVED), + new DummyModuleEvent(c7, ModuleEvent.RESOLVED, State.RESOLVED))); assertEvents(expected, actual, false); } @@ -713,8 +742,23 @@ public void testEventsRefresh() throws BundleException, IOException { container.refresh(Arrays.asList(systemBundle)); List actual = database.getModuleEvents(); - List expected = new ArrayList<>(Arrays.asList(new DummyModuleEvent(systemBundle, ModuleEvent.UNRESOLVED, State.INSTALLED), new DummyModuleEvent(c1, ModuleEvent.UNRESOLVED, State.INSTALLED), new DummyModuleEvent(c2, ModuleEvent.UNRESOLVED, State.INSTALLED), new DummyModuleEvent(c3, ModuleEvent.UNRESOLVED, State.INSTALLED), new DummyModuleEvent(c4, ModuleEvent.UNRESOLVED, State.INSTALLED), new DummyModuleEvent(c5, ModuleEvent.UNRESOLVED, State.INSTALLED), new DummyModuleEvent(c6, ModuleEvent.UNRESOLVED, State.INSTALLED), new DummyModuleEvent(c7, ModuleEvent.UNRESOLVED, State.INSTALLED), new DummyModuleEvent(systemBundle, ModuleEvent.RESOLVED, State.RESOLVED), new DummyModuleEvent(c1, ModuleEvent.RESOLVED, State.RESOLVED), - new DummyModuleEvent(c2, ModuleEvent.RESOLVED, State.RESOLVED), new DummyModuleEvent(c3, ModuleEvent.RESOLVED, State.RESOLVED), new DummyModuleEvent(c4, ModuleEvent.RESOLVED, State.RESOLVED), new DummyModuleEvent(c5, ModuleEvent.RESOLVED, State.RESOLVED), new DummyModuleEvent(c6, ModuleEvent.RESOLVED, State.RESOLVED), new DummyModuleEvent(c7, ModuleEvent.RESOLVED, State.RESOLVED))); + List expected = new ArrayList<>( + Arrays.asList(new DummyModuleEvent(systemBundle, ModuleEvent.UNRESOLVED, State.INSTALLED), + new DummyModuleEvent(c1, ModuleEvent.UNRESOLVED, State.INSTALLED), + new DummyModuleEvent(c2, ModuleEvent.UNRESOLVED, State.INSTALLED), + new DummyModuleEvent(c3, ModuleEvent.UNRESOLVED, State.INSTALLED), + new DummyModuleEvent(c4, ModuleEvent.UNRESOLVED, State.INSTALLED), + new DummyModuleEvent(c5, ModuleEvent.UNRESOLVED, State.INSTALLED), + new DummyModuleEvent(c6, ModuleEvent.UNRESOLVED, State.INSTALLED), + new DummyModuleEvent(c7, ModuleEvent.UNRESOLVED, State.INSTALLED), + new DummyModuleEvent(systemBundle, ModuleEvent.RESOLVED, State.RESOLVED), + new DummyModuleEvent(c1, ModuleEvent.RESOLVED, State.RESOLVED), + new DummyModuleEvent(c2, ModuleEvent.RESOLVED, State.RESOLVED), + new DummyModuleEvent(c3, ModuleEvent.RESOLVED, State.RESOLVED), + new DummyModuleEvent(c4, ModuleEvent.RESOLVED, State.RESOLVED), + new DummyModuleEvent(c5, ModuleEvent.RESOLVED, State.RESOLVED), + new DummyModuleEvent(c6, ModuleEvent.RESOLVED, State.RESOLVED), + new DummyModuleEvent(c7, ModuleEvent.RESOLVED, State.RESOLVED))); assertEvents(expected, actual, false); } @@ -839,7 +883,8 @@ public void testRemovalPending() throws BundleException, IOException { container.update(c6, OSGiManifestBuilderFactory.createBuilder(getManifest("c6_v1.MF")), null); container.resolve(Arrays.asList(c4, c6), true); - // Again we only have two since the previous current revisions did not have any dependents + // Again we only have two since the previous current revisions did not have any + // dependents removalPending = container.getRemovalPending(); assertEquals("Wrong number of removal pending", 2, removalPending.size()); assertTrue("Wrong module removalPending: " + removalPending, @@ -1092,29 +1137,45 @@ public void testLazy01() throws BundleException, IOException { lazy1.start(StartOptions.USE_ACTIVATION_POLICY); List actual = database.getModuleEvents(); - List expected = new ArrayList<>(Arrays.asList(new DummyModuleEvent(lazy1, ModuleEvent.RESOLVED, State.RESOLVED), new DummyModuleEvent(lazy1, ModuleEvent.LAZY_ACTIVATION, State.LAZY_STARTING))); + List expected = new ArrayList<>( + Arrays.asList(new DummyModuleEvent(lazy1, ModuleEvent.RESOLVED, State.RESOLVED), + new DummyModuleEvent(lazy1, ModuleEvent.LAZY_ACTIVATION, State.LAZY_STARTING))); assertEvents(expected, actual, true); lazy1.start(StartOptions.LAZY_TRIGGER); actual = database.getModuleEvents(); - expected = new ArrayList<>(Arrays.asList(new DummyModuleEvent(lazy1, ModuleEvent.STARTING, State.STARTING), new DummyModuleEvent(lazy1, ModuleEvent.STARTED, State.ACTIVE))); + expected = new ArrayList<>(Arrays.asList(new DummyModuleEvent(lazy1, ModuleEvent.STARTING, State.STARTING), + new DummyModuleEvent(lazy1, ModuleEvent.STARTED, State.ACTIVE))); assertEvents(expected, actual, true); container.refresh(Arrays.asList(lazy1)); actual = database.getModuleEvents(); - expected = new ArrayList<>(Arrays.asList(new DummyModuleEvent(lazy1, ModuleEvent.STOPPING, State.STOPPING), new DummyModuleEvent(lazy1, ModuleEvent.STOPPED, State.RESOLVED), new DummyModuleEvent(lazy1, ModuleEvent.UNRESOLVED, State.INSTALLED), new DummyModuleEvent(lazy1, ModuleEvent.RESOLVED, State.RESOLVED), new DummyModuleEvent(lazy1, ModuleEvent.LAZY_ACTIVATION, State.LAZY_STARTING))); + expected = new ArrayList<>(Arrays.asList(new DummyModuleEvent(lazy1, ModuleEvent.STOPPING, State.STOPPING), + new DummyModuleEvent(lazy1, ModuleEvent.STOPPED, State.RESOLVED), + new DummyModuleEvent(lazy1, ModuleEvent.UNRESOLVED, State.INSTALLED), + new DummyModuleEvent(lazy1, ModuleEvent.RESOLVED, State.RESOLVED), + new DummyModuleEvent(lazy1, ModuleEvent.LAZY_ACTIVATION, State.LAZY_STARTING))); assertEvents(expected, actual, true); container.update(lazy1, OSGiManifestBuilderFactory.createBuilder(getManifest("lazy1_v1.MF")), null); actual = database.getModuleEvents(); - expected = new ArrayList<>(Arrays.asList(new DummyModuleEvent(lazy1, ModuleEvent.STOPPING, State.STOPPING), new DummyModuleEvent(lazy1, ModuleEvent.STOPPED, State.RESOLVED), new DummyModuleEvent(lazy1, ModuleEvent.UNRESOLVED, State.INSTALLED), new DummyModuleEvent(lazy1, ModuleEvent.UPDATED, State.INSTALLED), new DummyModuleEvent(lazy1, ModuleEvent.RESOLVED, State.RESOLVED), new DummyModuleEvent(lazy1, ModuleEvent.LAZY_ACTIVATION, State.LAZY_STARTING))); + expected = new ArrayList<>(Arrays.asList(new DummyModuleEvent(lazy1, ModuleEvent.STOPPING, State.STOPPING), + new DummyModuleEvent(lazy1, ModuleEvent.STOPPED, State.RESOLVED), + new DummyModuleEvent(lazy1, ModuleEvent.UNRESOLVED, State.INSTALLED), + new DummyModuleEvent(lazy1, ModuleEvent.UPDATED, State.INSTALLED), + new DummyModuleEvent(lazy1, ModuleEvent.RESOLVED, State.RESOLVED), + new DummyModuleEvent(lazy1, ModuleEvent.LAZY_ACTIVATION, State.LAZY_STARTING))); assertEvents(expected, actual, true); container.refresh(Arrays.asList(lazy1)); actual = database.getModuleEvents(); - expected = new ArrayList<>(Arrays.asList(new DummyModuleEvent(lazy1, ModuleEvent.STOPPING, State.STOPPING), new DummyModuleEvent(lazy1, ModuleEvent.STOPPED, State.RESOLVED), new DummyModuleEvent(lazy1, ModuleEvent.UNRESOLVED, State.INSTALLED), new DummyModuleEvent(lazy1, ModuleEvent.RESOLVED, State.RESOLVED), new DummyModuleEvent(lazy1, ModuleEvent.LAZY_ACTIVATION, State.LAZY_STARTING))); + expected = new ArrayList<>(Arrays.asList(new DummyModuleEvent(lazy1, ModuleEvent.STOPPING, State.STOPPING), + new DummyModuleEvent(lazy1, ModuleEvent.STOPPED, State.RESOLVED), + new DummyModuleEvent(lazy1, ModuleEvent.UNRESOLVED, State.INSTALLED), + new DummyModuleEvent(lazy1, ModuleEvent.RESOLVED, State.RESOLVED), + new DummyModuleEvent(lazy1, ModuleEvent.LAZY_ACTIVATION, State.LAZY_STARTING))); assertEvents(expected, actual, true); } @@ -1158,11 +1219,15 @@ public void testSettings01() throws BundleException, IOException { container.getFrameworkStartLevel().setStartLevel(3); List actualContainerEvents = database.getContainerEvents(1); - List expectedContainerEvents = new ArrayList<>(Arrays.asList(new DummyContainerEvent(ContainerEvent.START_LEVEL, systemBundle, null))); + List expectedContainerEvents = new ArrayList<>( + Arrays.asList(new DummyContainerEvent(ContainerEvent.START_LEVEL, systemBundle, null))); assertEquals("Wrong container events.", expectedContainerEvents, actualContainerEvents); actual = database.getModuleEvents(3); - List expected = new ArrayList<>(Arrays.asList(new DummyModuleEvent(lazy1, ModuleEvent.LAZY_ACTIVATION, State.LAZY_STARTING), new DummyModuleEvent(c4, ModuleEvent.STARTING, State.STARTING), new DummyModuleEvent(c4, ModuleEvent.STARTED, State.ACTIVE))); + List expected = new ArrayList<>( + Arrays.asList(new DummyModuleEvent(lazy1, ModuleEvent.LAZY_ACTIVATION, State.LAZY_STARTING), + new DummyModuleEvent(c4, ModuleEvent.STARTING, State.STARTING), + new DummyModuleEvent(c4, ModuleEvent.STARTED, State.ACTIVE))); assertEvents(expected, actual, true); ByteArrayOutputStream bytes = new ByteArrayOutputStream(); @@ -1198,20 +1263,28 @@ public void testSettings01() throws BundleException, IOException { systemBundle.start(); actualContainerEvents = database.getContainerEvents(); - expectedContainerEvents = new ArrayList<>(Arrays.asList(new DummyContainerEvent(ContainerEvent.START_LEVEL, systemBundle, null), new DummyContainerEvent(ContainerEvent.STARTED, systemBundle, null))); + expectedContainerEvents = new ArrayList<>( + Arrays.asList(new DummyContainerEvent(ContainerEvent.START_LEVEL, systemBundle, null), + new DummyContainerEvent(ContainerEvent.STARTED, systemBundle, null))); actual = database.getModuleEvents(2); - expected = new ArrayList<>(Arrays.asList(new DummyModuleEvent(systemBundle, ModuleEvent.STARTING, State.STARTING), new DummyModuleEvent(systemBundle, ModuleEvent.STARTED, State.ACTIVE))); + expected = new ArrayList<>( + Arrays.asList(new DummyModuleEvent(systemBundle, ModuleEvent.STARTING, State.STARTING), + new DummyModuleEvent(systemBundle, ModuleEvent.STARTED, State.ACTIVE))); assertEvents(expected, actual, true); container.getFrameworkStartLevel().setStartLevel(3); actualContainerEvents = database.getContainerEvents(1); - expectedContainerEvents = new ArrayList<>(Arrays.asList(new DummyContainerEvent(ContainerEvent.START_LEVEL, systemBundle, null))); + expectedContainerEvents = new ArrayList<>( + Arrays.asList(new DummyContainerEvent(ContainerEvent.START_LEVEL, systemBundle, null))); assertEquals("Wrong container events.", expectedContainerEvents, actualContainerEvents); actual = database.getModuleEvents(3); - expected = new ArrayList<>(Arrays.asList(new DummyModuleEvent(lazy1, ModuleEvent.LAZY_ACTIVATION, State.LAZY_STARTING), new DummyModuleEvent(c4, ModuleEvent.STARTING, State.STARTING), new DummyModuleEvent(c4, ModuleEvent.STARTED, State.ACTIVE))); + expected = new ArrayList<>( + Arrays.asList(new DummyModuleEvent(lazy1, ModuleEvent.LAZY_ACTIVATION, State.LAZY_STARTING), + new DummyModuleEvent(c4, ModuleEvent.STARTING, State.STARTING), + new DummyModuleEvent(c4, ModuleEvent.STARTED, State.ACTIVE))); assertEvents(expected, actual, true); } @@ -1303,41 +1376,88 @@ private void doTestEventsStartLevel(int beginningStartLevel) throws BundleExcept if (beginningStartLevel == 1) { actualModuleEvents = database.getModuleEvents(2); - List expectedModuleEvents = new ArrayList<>(Arrays.asList(new DummyModuleEvent(systemBundle, ModuleEvent.STARTING, State.STARTING), new DummyModuleEvent(systemBundle, ModuleEvent.STARTED, State.ACTIVE))); + List expectedModuleEvents = new ArrayList<>( + Arrays.asList(new DummyModuleEvent(systemBundle, ModuleEvent.STARTING, State.STARTING), + new DummyModuleEvent(systemBundle, ModuleEvent.STARTED, State.ACTIVE))); assertEvents(expectedModuleEvents, actualModuleEvents, true); List actualContainerEvents = database.getContainerEvents(); - List expectedContainerEvents = new ArrayList<>(Arrays.asList(new DummyContainerEvent(ContainerEvent.STARTED, systemBundle, null))); + List expectedContainerEvents = new ArrayList<>( + Arrays.asList(new DummyContainerEvent(ContainerEvent.STARTED, systemBundle, null))); assertEquals("Wrong container events.", expectedContainerEvents, actualContainerEvents); container.getFrameworkStartLevel().setStartLevel(100); actualModuleEvents = database.getModuleEvents(14); - expectedModuleEvents = new ArrayList<>(Arrays.asList(new DummyModuleEvent(c7, ModuleEvent.STARTING, State.STARTING), new DummyModuleEvent(c7, ModuleEvent.STARTED, State.ACTIVE), new DummyModuleEvent(c6, ModuleEvent.STARTING, State.STARTING), new DummyModuleEvent(c6, ModuleEvent.STARTED, State.ACTIVE), new DummyModuleEvent(c5, ModuleEvent.STARTING, State.STARTING), new DummyModuleEvent(c5, ModuleEvent.STARTED, State.ACTIVE), new DummyModuleEvent(c4, ModuleEvent.STARTING, State.STARTING), new DummyModuleEvent(c4, ModuleEvent.STARTED, State.ACTIVE), new DummyModuleEvent(c3, ModuleEvent.STARTING, State.STARTING), new DummyModuleEvent(c3, ModuleEvent.STARTED, State.ACTIVE), new DummyModuleEvent(c2, ModuleEvent.STARTING, State.STARTING), - new DummyModuleEvent(c2, ModuleEvent.STARTED, State.ACTIVE), new DummyModuleEvent(c1, ModuleEvent.STARTING, State.STARTING), new DummyModuleEvent(c1, ModuleEvent.STARTED, State.ACTIVE))); + expectedModuleEvents = new ArrayList<>( + Arrays.asList(new DummyModuleEvent(c7, ModuleEvent.STARTING, State.STARTING), + new DummyModuleEvent(c7, ModuleEvent.STARTED, State.ACTIVE), + new DummyModuleEvent(c6, ModuleEvent.STARTING, State.STARTING), + new DummyModuleEvent(c6, ModuleEvent.STARTED, State.ACTIVE), + new DummyModuleEvent(c5, ModuleEvent.STARTING, State.STARTING), + new DummyModuleEvent(c5, ModuleEvent.STARTED, State.ACTIVE), + new DummyModuleEvent(c4, ModuleEvent.STARTING, State.STARTING), + new DummyModuleEvent(c4, ModuleEvent.STARTED, State.ACTIVE), + new DummyModuleEvent(c3, ModuleEvent.STARTING, State.STARTING), + new DummyModuleEvent(c3, ModuleEvent.STARTED, State.ACTIVE), + new DummyModuleEvent(c2, ModuleEvent.STARTING, State.STARTING), + new DummyModuleEvent(c2, ModuleEvent.STARTED, State.ACTIVE), + new DummyModuleEvent(c1, ModuleEvent.STARTING, State.STARTING), + new DummyModuleEvent(c1, ModuleEvent.STARTED, State.ACTIVE))); actualContainerEvents = database.getContainerEvents(1); - expectedContainerEvents = new ArrayList<>(Arrays.asList(new DummyContainerEvent(ContainerEvent.START_LEVEL, systemBundle, null))); + expectedContainerEvents = new ArrayList<>( + Arrays.asList(new DummyContainerEvent(ContainerEvent.START_LEVEL, systemBundle, null))); assertEquals("Wrong container events.", expectedContainerEvents, actualContainerEvents); } else { actualModuleEvents = database.getModuleEvents(16); - List expectedModuleEvents = new ArrayList<>(Arrays.asList(new DummyModuleEvent(systemBundle, ModuleEvent.STARTING, State.STARTING), new DummyModuleEvent(c7, ModuleEvent.STARTING, State.STARTING), new DummyModuleEvent(c7, ModuleEvent.STARTED, State.ACTIVE), new DummyModuleEvent(c6, ModuleEvent.STARTING, State.STARTING), new DummyModuleEvent(c6, ModuleEvent.STARTED, State.ACTIVE), new DummyModuleEvent(c5, ModuleEvent.STARTING, State.STARTING), new DummyModuleEvent(c5, ModuleEvent.STARTED, State.ACTIVE), new DummyModuleEvent(c4, ModuleEvent.STARTING, State.STARTING), new DummyModuleEvent(c4, ModuleEvent.STARTED, State.ACTIVE), new DummyModuleEvent(c3, ModuleEvent.STARTING, State.STARTING), new DummyModuleEvent(c3, ModuleEvent.STARTED, State.ACTIVE), - new DummyModuleEvent(c2, ModuleEvent.STARTING, State.STARTING), new DummyModuleEvent(c2, ModuleEvent.STARTED, State.ACTIVE), new DummyModuleEvent(c1, ModuleEvent.STARTING, State.STARTING), new DummyModuleEvent(c1, ModuleEvent.STARTED, State.ACTIVE), new DummyModuleEvent(systemBundle, ModuleEvent.STARTED, State.ACTIVE))); + List expectedModuleEvents = new ArrayList<>( + Arrays.asList(new DummyModuleEvent(systemBundle, ModuleEvent.STARTING, State.STARTING), + new DummyModuleEvent(c7, ModuleEvent.STARTING, State.STARTING), + new DummyModuleEvent(c7, ModuleEvent.STARTED, State.ACTIVE), + new DummyModuleEvent(c6, ModuleEvent.STARTING, State.STARTING), + new DummyModuleEvent(c6, ModuleEvent.STARTED, State.ACTIVE), + new DummyModuleEvent(c5, ModuleEvent.STARTING, State.STARTING), + new DummyModuleEvent(c5, ModuleEvent.STARTED, State.ACTIVE), + new DummyModuleEvent(c4, ModuleEvent.STARTING, State.STARTING), + new DummyModuleEvent(c4, ModuleEvent.STARTED, State.ACTIVE), + new DummyModuleEvent(c3, ModuleEvent.STARTING, State.STARTING), + new DummyModuleEvent(c3, ModuleEvent.STARTED, State.ACTIVE), + new DummyModuleEvent(c2, ModuleEvent.STARTING, State.STARTING), + new DummyModuleEvent(c2, ModuleEvent.STARTED, State.ACTIVE), + new DummyModuleEvent(c1, ModuleEvent.STARTING, State.STARTING), + new DummyModuleEvent(c1, ModuleEvent.STARTED, State.ACTIVE), + new DummyModuleEvent(systemBundle, ModuleEvent.STARTED, State.ACTIVE))); assertEvents(expectedModuleEvents, actualModuleEvents, true); List actualContainerEvents = database.getContainerEvents(); - List expectedContainerEvents = new ArrayList<>(Arrays.asList(new DummyContainerEvent(ContainerEvent.STARTED, systemBundle, null))); + List expectedContainerEvents = new ArrayList<>( + Arrays.asList(new DummyContainerEvent(ContainerEvent.STARTED, systemBundle, null))); assertEquals("Wrong container events.", expectedContainerEvents, actualContainerEvents); } if (beginningStartLevel == 1) { container.getFrameworkStartLevel().setStartLevel(1); actualModuleEvents = database.getModuleEvents(14); - List expectedModuleEvents = new ArrayList<>(Arrays.asList(new DummyModuleEvent(c1, ModuleEvent.STOPPING, State.STOPPING), new DummyModuleEvent(c1, ModuleEvent.STOPPED, State.RESOLVED), new DummyModuleEvent(c2, ModuleEvent.STOPPING, State.STOPPING), new DummyModuleEvent(c2, ModuleEvent.STOPPED, State.RESOLVED), new DummyModuleEvent(c3, ModuleEvent.STOPPING, State.STOPPING), new DummyModuleEvent(c3, ModuleEvent.STOPPED, State.RESOLVED), new DummyModuleEvent(c4, ModuleEvent.STOPPING, State.STOPPING), new DummyModuleEvent(c4, ModuleEvent.STOPPED, State.RESOLVED), new DummyModuleEvent(c5, ModuleEvent.STOPPING, State.STOPPING), new DummyModuleEvent(c5, ModuleEvent.STOPPED, State.RESOLVED), new DummyModuleEvent(c6, ModuleEvent.STOPPING, State.STOPPING), - new DummyModuleEvent(c6, ModuleEvent.STOPPED, State.RESOLVED), new DummyModuleEvent(c7, ModuleEvent.STOPPING, State.STOPPING), new DummyModuleEvent(c7, ModuleEvent.STOPPED, State.RESOLVED))); + List expectedModuleEvents = new ArrayList<>( + Arrays.asList(new DummyModuleEvent(c1, ModuleEvent.STOPPING, State.STOPPING), + new DummyModuleEvent(c1, ModuleEvent.STOPPED, State.RESOLVED), + new DummyModuleEvent(c2, ModuleEvent.STOPPING, State.STOPPING), + new DummyModuleEvent(c2, ModuleEvent.STOPPED, State.RESOLVED), + new DummyModuleEvent(c3, ModuleEvent.STOPPING, State.STOPPING), + new DummyModuleEvent(c3, ModuleEvent.STOPPED, State.RESOLVED), + new DummyModuleEvent(c4, ModuleEvent.STOPPING, State.STOPPING), + new DummyModuleEvent(c4, ModuleEvent.STOPPED, State.RESOLVED), + new DummyModuleEvent(c5, ModuleEvent.STOPPING, State.STOPPING), + new DummyModuleEvent(c5, ModuleEvent.STOPPED, State.RESOLVED), + new DummyModuleEvent(c6, ModuleEvent.STOPPING, State.STOPPING), + new DummyModuleEvent(c6, ModuleEvent.STOPPED, State.RESOLVED), + new DummyModuleEvent(c7, ModuleEvent.STOPPING, State.STOPPING), + new DummyModuleEvent(c7, ModuleEvent.STOPPED, State.RESOLVED))); assertEvents(expectedModuleEvents, actualModuleEvents, true); List actualContainerEvents = database.getContainerEvents(1); - List expectedContainerEvents = new ArrayList<>(Arrays.asList(new DummyContainerEvent(ContainerEvent.START_LEVEL, systemBundle, null))); + List expectedContainerEvents = new ArrayList<>( + Arrays.asList(new DummyContainerEvent(ContainerEvent.START_LEVEL, systemBundle, null))); assertEquals("Wrong container events.", expectedContainerEvents, actualContainerEvents); } @@ -1345,16 +1465,34 @@ private void doTestEventsStartLevel(int beginningStartLevel) throws BundleExcept if (beginningStartLevel == 1) { actualModuleEvents = database.getModuleEvents(2); - List expectedModuleEvents = new ArrayList<>(Arrays.asList(new DummyModuleEvent(systemBundle, ModuleEvent.STOPPING, State.STOPPING), new DummyModuleEvent(systemBundle, ModuleEvent.STOPPED, State.RESOLVED))); + List expectedModuleEvents = new ArrayList<>( + Arrays.asList(new DummyModuleEvent(systemBundle, ModuleEvent.STOPPING, State.STOPPING), + new DummyModuleEvent(systemBundle, ModuleEvent.STOPPED, State.RESOLVED))); assertEvents(expectedModuleEvents, actualModuleEvents, true); } else { actualModuleEvents = database.getModuleEvents(16); - List expectedModuleEvents = new ArrayList<>(Arrays.asList(new DummyModuleEvent(systemBundle, ModuleEvent.STOPPING, State.STOPPING), new DummyModuleEvent(c1, ModuleEvent.STOPPING, State.STOPPING), new DummyModuleEvent(c1, ModuleEvent.STOPPED, State.RESOLVED), new DummyModuleEvent(c2, ModuleEvent.STOPPING, State.STOPPING), new DummyModuleEvent(c2, ModuleEvent.STOPPED, State.RESOLVED), new DummyModuleEvent(c3, ModuleEvent.STOPPING, State.STOPPING), new DummyModuleEvent(c3, ModuleEvent.STOPPED, State.RESOLVED), new DummyModuleEvent(c4, ModuleEvent.STOPPING, State.STOPPING), new DummyModuleEvent(c4, ModuleEvent.STOPPED, State.RESOLVED), new DummyModuleEvent(c5, ModuleEvent.STOPPING, State.STOPPING), new DummyModuleEvent(c5, ModuleEvent.STOPPED, State.RESOLVED), - new DummyModuleEvent(c6, ModuleEvent.STOPPING, State.STOPPING), new DummyModuleEvent(c6, ModuleEvent.STOPPED, State.RESOLVED), new DummyModuleEvent(c7, ModuleEvent.STOPPING, State.STOPPING), new DummyModuleEvent(c7, ModuleEvent.STOPPED, State.RESOLVED), new DummyModuleEvent(systemBundle, ModuleEvent.STOPPED, State.RESOLVED))); + List expectedModuleEvents = new ArrayList<>( + Arrays.asList(new DummyModuleEvent(systemBundle, ModuleEvent.STOPPING, State.STOPPING), + new DummyModuleEvent(c1, ModuleEvent.STOPPING, State.STOPPING), + new DummyModuleEvent(c1, ModuleEvent.STOPPED, State.RESOLVED), + new DummyModuleEvent(c2, ModuleEvent.STOPPING, State.STOPPING), + new DummyModuleEvent(c2, ModuleEvent.STOPPED, State.RESOLVED), + new DummyModuleEvent(c3, ModuleEvent.STOPPING, State.STOPPING), + new DummyModuleEvent(c3, ModuleEvent.STOPPED, State.RESOLVED), + new DummyModuleEvent(c4, ModuleEvent.STOPPING, State.STOPPING), + new DummyModuleEvent(c4, ModuleEvent.STOPPED, State.RESOLVED), + new DummyModuleEvent(c5, ModuleEvent.STOPPING, State.STOPPING), + new DummyModuleEvent(c5, ModuleEvent.STOPPED, State.RESOLVED), + new DummyModuleEvent(c6, ModuleEvent.STOPPING, State.STOPPING), + new DummyModuleEvent(c6, ModuleEvent.STOPPED, State.RESOLVED), + new DummyModuleEvent(c7, ModuleEvent.STOPPING, State.STOPPING), + new DummyModuleEvent(c7, ModuleEvent.STOPPED, State.RESOLVED), + new DummyModuleEvent(systemBundle, ModuleEvent.STOPPED, State.RESOLVED))); assertEvents(expectedModuleEvents, actualModuleEvents, true); } List actualContainerEvents = database.getContainerEvents(); - List expectedContainerEvents = new ArrayList<>(Arrays.asList(new DummyContainerEvent(ContainerEvent.STOPPED, systemBundle, null))); + List expectedContainerEvents = new ArrayList<>( + Arrays.asList(new DummyContainerEvent(ContainerEvent.STOPPED, systemBundle, null))); assertEquals("Wrong container events.", expectedContainerEvents, actualContainerEvents); } @@ -1363,7 +1501,8 @@ public void testDynamicImport01() throws BundleException, IOException { DummyContainerAdaptor adaptor = createDummyAdaptor(); ModuleContainer container = adaptor.getContainer(); - Module systemBundle = installDummyModule("system.bundle.MF", Constants.SYSTEM_BUNDLE_LOCATION, null, null, "osgi.ee; osgi.ee=JavaSE; version:Version=\"1.5.0\"", container); + Module systemBundle = installDummyModule("system.bundle.MF", Constants.SYSTEM_BUNDLE_LOCATION, null, null, + "osgi.ee; osgi.ee=JavaSE; version:Version=\"1.5.0\"", container); container.resolve(Arrays.asList(systemBundle), true); @@ -1398,7 +1537,8 @@ public void testDynamicImport02() throws BundleException, IOException { DummyContainerAdaptor adaptor = createDummyAdaptor(); ModuleContainer container = adaptor.getContainer(); - Module systemBundle = installDummyModule("system.bundle.MF", Constants.SYSTEM_BUNDLE_LOCATION, null, null, "osgi.ee; osgi.ee=JavaSE; version:Version=\"1.5.0\"", container); + Module systemBundle = installDummyModule("system.bundle.MF", Constants.SYSTEM_BUNDLE_LOCATION, null, null, + "osgi.ee; osgi.ee=JavaSE; version:Version=\"1.5.0\"", container); container.resolve(Arrays.asList(systemBundle), true); @@ -1511,7 +1651,8 @@ public void testDynamicImport05() throws BundleException, IOException { DummyContainerAdaptor adaptor = createDummyAdaptor(); ModuleContainer container = adaptor.getContainer(); - Module systemBundle = installDummyModule("system.bundle.MF", Constants.SYSTEM_BUNDLE_LOCATION, null, null, "osgi.ee; osgi.ee=JavaSE; version:Version=\"1.5.0\"", container); + Module systemBundle = installDummyModule("system.bundle.MF", Constants.SYSTEM_BUNDLE_LOCATION, null, null, + "osgi.ee; osgi.ee=JavaSE; version:Version=\"1.5.0\"", container); container.resolve(Arrays.asList(systemBundle), true); @@ -1614,7 +1755,8 @@ public void testDynamicImport08() throws BundleException, IOException { // make sure h1 is not resolved ModuleWiring h1Wiring = h1.getCurrentRevision().getWiring(); assertNull("h1 got resolved somehow.", h1Wiring); - // do not resolve the host first; make sure it gets pulled in while attempting to resolve + // do not resolve the host first; make sure it gets pulled in while attempting + // to resolve // to a fragment capability. ModuleWire dynamicWire = container.resolveDynamic("f1.a", dynamic2.getCurrentRevision()); assertNotNull("Dynamic wire not found.", dynamicWire); @@ -1634,7 +1776,8 @@ public void testDynamicImportMiss01() throws BundleException, IOException { DummyContainerAdaptor adaptor = createDummyAdaptor(); ModuleContainer container = adaptor.getContainer(); - Module systemBundle = installDummyModule("system.bundle.MF", Constants.SYSTEM_BUNDLE_LOCATION, null, null, "osgi.ee; osgi.ee=JavaSE; version:Version=\"1.5.0\"", container); + Module systemBundle = installDummyModule("system.bundle.MF", Constants.SYSTEM_BUNDLE_LOCATION, null, null, + "osgi.ee; osgi.ee=JavaSE; version:Version=\"1.5.0\"", container); container.resolve(Arrays.asList(systemBundle), true); Module c1 = installDummyModule("c1_v1.MF", "c1_v1", container); @@ -1685,7 +1828,8 @@ public void testRequireBundleUses() throws BundleException, IOException { } /* - * Test that a resolve process does not blow up because of one unresolvable uses constraint issue + * Test that a resolve process does not blow up because of one unresolvable uses + * constraint issue */ @Test public void testUses1() throws BundleException, IOException { @@ -1708,7 +1852,8 @@ public void testUses1() throws BundleException, IOException { @Test public void testUses1Dynamic() throws BundleException, IOException { - DummyContainerAdaptor adaptor = createDummyAdaptor(new DummyDebugOptions(Collections.singletonMap("org.eclipse.osgi/resolver/report", "true"))); + DummyContainerAdaptor adaptor = createDummyAdaptor( + new DummyDebugOptions(Collections.singletonMap("org.eclipse.osgi/resolver/report", "true"))); ModuleContainer container = adaptor.getContainer(); Module systemBundle = installDummyModule("system.bundle.MF", Constants.SYSTEM_BUNDLE_LOCATION, container); @@ -1833,6 +1978,7 @@ public void testUses4() throws BundleException, IOException { /** * Test optional constraints + * * @throws BundleException * @throws IOException */ @@ -1887,8 +2033,10 @@ public void testUses6FragConflicts() throws BundleException, IOException { assertNull("resolution report has a resolution exception.", report.getResolutionException()); assertEquals("n1 should resolve.", State.RESOLVED, uses_n1.getState()); - // TODO The following should be true, but on the current resolver in Mars the host is thrown away also - //Assert.assertEquals("n2 should resolve.", State.RESOLVED, uses_n2.getState()); + // TODO The following should be true, but on the current resolver in Mars the + // host is thrown away also + // Assert.assertEquals("n2 should resolve.", State.RESOLVED, + // uses_n2.getState()); assertEquals("n2.frag should not resolve.", State.INSTALLED, uses_n2_frag.getState()); assertEquals("n3 should resolve.", State.RESOLVED, uses_n3.getState()); } @@ -1897,7 +2045,8 @@ public void testUses6FragConflicts() throws BundleException, IOException { public void testUsesTimeout() throws BundleException { // Always want to go to zero threads when idle int coreThreads = 0; - // use the number of processors - 1 because we use the current thread when rejected + // use the number of processors - 1 because we use the current thread when + // rejected int maxThreads = Math.max(Runtime.getRuntime().availableProcessors() - 1, 1); // idle timeout; make it short to get rid of threads quickly after resolve int idleTimeout = 5; @@ -1909,15 +2058,18 @@ public void testUsesTimeout() throws BundleException { t.setDaemon(true); return t; }; - // use a rejection policy that simply runs the task in the current thread once the max threads is reached + // use a rejection policy that simply runs the task in the current thread once + // the max threads is reached RejectedExecutionHandler rejectHandler = (r, exe) -> r.run(); - ExecutorService executor = new ThreadPoolExecutor(coreThreads, maxThreads, idleTimeout, TimeUnit.SECONDS, queue, threadFactory, rejectHandler); + ExecutorService executor = new ThreadPoolExecutor(coreThreads, maxThreads, idleTimeout, TimeUnit.SECONDS, queue, + threadFactory, rejectHandler); ScheduledExecutorService timeoutExecutor = new ScheduledThreadPoolExecutor(1); Map configuration = new HashMap<>(); configuration.put(EquinoxConfiguration.PROP_RESOLVER_BATCH_TIMEOUT, "5000"); Map debugOpts = Collections.emptyMap(); - DummyContainerAdaptor adaptor = new DummyContainerAdaptor(new DummyCollisionHook(false), configuration, new DummyResolverHookFactory(), new DummyDebugOptions(debugOpts)); + DummyContainerAdaptor adaptor = new DummyContainerAdaptor(new DummyCollisionHook(false), configuration, + new DummyResolverHookFactory(), new DummyDebugOptions(debugOpts)); adaptor.setResolverExecutor(executor); adaptor.setTimeoutExecutor(timeoutExecutor); ModuleContainer container = adaptor.getContainer(); @@ -2040,8 +2192,8 @@ public void testMultiCardinalityUses() throws BundleException, IOException { Module c6v150 = installDummyModule("c6_v150.MF", "c6_v150", container); Module c6v170 = installDummyModule("c6_v170.MF", "c6_v170", container); - // Module c6v180 = installDummyModule("c6_v180.MF", "c6_v180", container); - // Module c6v120 = installDummyModule("c6_v120.MF", "c6_v120", container); + // Module c6v180 = installDummyModule("c6_v180.MF", "c6_v180", container); + // Module c6v120 = installDummyModule("c6_v120.MF", "c6_v120", container); container.resolve(null, false); @@ -2106,9 +2258,12 @@ public void testCompatSingleton() throws BundleException, IOException { Module s2 = installDummyModule("compatSingleton2.MF", "s2", container); Module s3 = installDummyModule("compatSingleton3.MF", "s3", container); - String s1Singleton = s1.getCurrentRevision().getCapabilities(IdentityNamespace.IDENTITY_NAMESPACE).iterator().next().getDirectives().get(IdentityNamespace.CAPABILITY_SINGLETON_DIRECTIVE); - String s2Singleton = s2.getCurrentRevision().getCapabilities(IdentityNamespace.IDENTITY_NAMESPACE).iterator().next().getDirectives().get(IdentityNamespace.CAPABILITY_SINGLETON_DIRECTIVE); - String s3Singleton = s3.getCurrentRevision().getCapabilities(IdentityNamespace.IDENTITY_NAMESPACE).iterator().next().getDirectives().get(IdentityNamespace.CAPABILITY_SINGLETON_DIRECTIVE); + String s1Singleton = s1.getCurrentRevision().getCapabilities(IdentityNamespace.IDENTITY_NAMESPACE).iterator() + .next().getDirectives().get(IdentityNamespace.CAPABILITY_SINGLETON_DIRECTIVE); + String s2Singleton = s2.getCurrentRevision().getCapabilities(IdentityNamespace.IDENTITY_NAMESPACE).iterator() + .next().getDirectives().get(IdentityNamespace.CAPABILITY_SINGLETON_DIRECTIVE); + String s3Singleton = s3.getCurrentRevision().getCapabilities(IdentityNamespace.IDENTITY_NAMESPACE).iterator() + .next().getDirectives().get(IdentityNamespace.CAPABILITY_SINGLETON_DIRECTIVE); assertEquals("Wrong singleton directive: " + s1, "true", s1Singleton); assertNull("Wrong singleton directive: " + s2, s2Singleton); @@ -2123,9 +2278,12 @@ public void testCompatReprovide() throws BundleException, IOException { Module b2 = installDummyModule("compatReprovide2.MF", "b2", container); Module b3 = installDummyModule("compatReprovide3.MF", "b3", container); - String b1Visibility = b1.getCurrentRevision().getRequirements(BundleNamespace.BUNDLE_NAMESPACE).iterator().next().getDirectives().get(BundleNamespace.REQUIREMENT_VISIBILITY_DIRECTIVE); - String b2Visibility = b2.getCurrentRevision().getRequirements(BundleNamespace.BUNDLE_NAMESPACE).iterator().next().getDirectives().get(BundleNamespace.REQUIREMENT_VISIBILITY_DIRECTIVE); - String b3Visibility = b3.getCurrentRevision().getRequirements(BundleNamespace.BUNDLE_NAMESPACE).iterator().next().getDirectives().get(BundleNamespace.REQUIREMENT_VISIBILITY_DIRECTIVE); + String b1Visibility = b1.getCurrentRevision().getRequirements(BundleNamespace.BUNDLE_NAMESPACE).iterator() + .next().getDirectives().get(BundleNamespace.REQUIREMENT_VISIBILITY_DIRECTIVE); + String b2Visibility = b2.getCurrentRevision().getRequirements(BundleNamespace.BUNDLE_NAMESPACE).iterator() + .next().getDirectives().get(BundleNamespace.REQUIREMENT_VISIBILITY_DIRECTIVE); + String b3Visibility = b3.getCurrentRevision().getRequirements(BundleNamespace.BUNDLE_NAMESPACE).iterator() + .next().getDirectives().get(BundleNamespace.REQUIREMENT_VISIBILITY_DIRECTIVE); assertEquals("Wrong visibility directive: " + b1, BundleNamespace.VISIBILITY_REEXPORT, b1Visibility); assertNull("Wrong visibility directive: ", b2Visibility); @@ -2140,13 +2298,19 @@ public void testCompatOptional() throws BundleException, IOException { Module b2 = installDummyModule("compatOptional2.MF", "b2", container); Module b3 = installDummyModule("compatOptional3.MF", "b3", container); - String b1BundleResolution = b1.getCurrentRevision().getRequirements(BundleNamespace.BUNDLE_NAMESPACE).iterator().next().getDirectives().get(Namespace.REQUIREMENT_RESOLUTION_DIRECTIVE); - String b2BundleResolution = b2.getCurrentRevision().getRequirements(BundleNamespace.BUNDLE_NAMESPACE).iterator().next().getDirectives().get(Namespace.REQUIREMENT_RESOLUTION_DIRECTIVE); - String b3BundleResolution = b3.getCurrentRevision().getRequirements(BundleNamespace.BUNDLE_NAMESPACE).iterator().next().getDirectives().get(Namespace.REQUIREMENT_RESOLUTION_DIRECTIVE); + String b1BundleResolution = b1.getCurrentRevision().getRequirements(BundleNamespace.BUNDLE_NAMESPACE).iterator() + .next().getDirectives().get(Namespace.REQUIREMENT_RESOLUTION_DIRECTIVE); + String b2BundleResolution = b2.getCurrentRevision().getRequirements(BundleNamespace.BUNDLE_NAMESPACE).iterator() + .next().getDirectives().get(Namespace.REQUIREMENT_RESOLUTION_DIRECTIVE); + String b3BundleResolution = b3.getCurrentRevision().getRequirements(BundleNamespace.BUNDLE_NAMESPACE).iterator() + .next().getDirectives().get(Namespace.REQUIREMENT_RESOLUTION_DIRECTIVE); - String b1PackageResolution = b1.getCurrentRevision().getRequirements(PackageNamespace.PACKAGE_NAMESPACE).iterator().next().getDirectives().get(Namespace.REQUIREMENT_RESOLUTION_DIRECTIVE); - String b2PackageResolution = b2.getCurrentRevision().getRequirements(PackageNamespace.PACKAGE_NAMESPACE).iterator().next().getDirectives().get(Namespace.REQUIREMENT_RESOLUTION_DIRECTIVE); - String b3PackageResolution = b3.getCurrentRevision().getRequirements(PackageNamespace.PACKAGE_NAMESPACE).iterator().next().getDirectives().get(Namespace.REQUIREMENT_RESOLUTION_DIRECTIVE); + String b1PackageResolution = b1.getCurrentRevision().getRequirements(PackageNamespace.PACKAGE_NAMESPACE) + .iterator().next().getDirectives().get(Namespace.REQUIREMENT_RESOLUTION_DIRECTIVE); + String b2PackageResolution = b2.getCurrentRevision().getRequirements(PackageNamespace.PACKAGE_NAMESPACE) + .iterator().next().getDirectives().get(Namespace.REQUIREMENT_RESOLUTION_DIRECTIVE); + String b3PackageResolution = b3.getCurrentRevision().getRequirements(PackageNamespace.PACKAGE_NAMESPACE) + .iterator().next().getDirectives().get(Namespace.REQUIREMENT_RESOLUTION_DIRECTIVE); assertEquals("Wrong resolution directive: " + b1, Namespace.RESOLUTION_OPTIONAL, b1BundleResolution); assertNull("Wrong resolution directive: ", b2BundleResolution); @@ -2163,7 +2327,8 @@ public void testCompatProvidePackage() throws BundleException, IOException { ModuleContainer container = adaptor.getContainer(); Module b1 = installDummyModule("compatProvidePackage1.MF", "b1", container); - List packageCaps = b1.getCurrentRevision().getModuleCapabilities(PackageNamespace.PACKAGE_NAMESPACE); + List packageCaps = b1.getCurrentRevision() + .getModuleCapabilities(PackageNamespace.PACKAGE_NAMESPACE); assertEquals("Wrong number of exports", 5, packageCaps.size()); assertEquals("Wrong package name.", "foo", @@ -2205,7 +2370,8 @@ public void testBug457118() throws BundleException, IOException { assertEquals("c should resolve.", State.RESOLVED, c.getState()); assertEquals("d should resolve.", State.RESOLVED, d.getState()); - List bundleWires = e.getCurrentRevision().getWiring().getRequiredModuleWires(BundleNamespace.BUNDLE_NAMESPACE); + List bundleWires = e.getCurrentRevision().getWiring() + .getRequiredModuleWires(BundleNamespace.BUNDLE_NAMESPACE); assertEquals("Wrong number of bundle wires: " + bundleWires, 1, bundleWires.size()); assertEquals("Wrong bundle provider", a.getCurrentRevision(), bundleWires.get(0).getProvider()); } @@ -2250,7 +2416,8 @@ public void testNativeWithFilterChars() throws BundleException, IOException { // install the system.bundle String extraCapabilities = "osgi.native; osgi.native.osname=\"Windows NT (unknown)\""; - Module systemBundle = installDummyModule("system.bundle.MF", Constants.SYSTEM_BUNDLE_LOCATION, Constants.SYSTEM_BUNDLE_SYMBOLICNAME, null, extraCapabilities, container); + Module systemBundle = installDummyModule("system.bundle.MF", Constants.SYSTEM_BUNDLE_LOCATION, + Constants.SYSTEM_BUNDLE_SYMBOLICNAME, null, extraCapabilities, container); ResolutionReport report = container.resolve(Arrays.asList(systemBundle), true); assertNull("Failed to resolve system.bundle.", report.getResolutionException()); @@ -2279,8 +2446,10 @@ public void testUTF8LineContinuation() throws BundleException, IOException { Module testModule = installDummyModule(manifest, manifest.get(Constants.BUNDLE_SYMBOLICNAME), container); assertEquals("Wrong bns for the bundle.", utfString, testModule.getCurrentRevision().getSymbolicName()); - ModuleCapability exportPackage = testModule.getCurrentRevision().getModuleCapabilities(PackageNamespace.PACKAGE_NAMESPACE).get(0); - ModuleRequirement importPackage = testModule.getCurrentRevision().getModuleRequirements(PackageNamespace.PACKAGE_NAMESPACE).get(0); + ModuleCapability exportPackage = testModule.getCurrentRevision() + .getModuleCapabilities(PackageNamespace.PACKAGE_NAMESPACE).get(0); + ModuleRequirement importPackage = testModule.getCurrentRevision() + .getModuleRequirements(PackageNamespace.PACKAGE_NAMESPACE).get(0); String actualPackageName = (String) exportPackage.getAttributes().get(PackageNamespace.PACKAGE_NAMESPACE); assertEquals("Wrong exported package name.", utfString, actualPackageName); @@ -2297,7 +2466,8 @@ public void testDynamicWithOptionalImport() throws BundleException, IOException ModuleContainer container = adaptor.getContainer(); // install the system.bundle - Module systemBundle = installDummyModule("system.bundle.MF", Constants.SYSTEM_BUNDLE_LOCATION, Constants.SYSTEM_BUNDLE_SYMBOLICNAME, null, null, container); + Module systemBundle = installDummyModule("system.bundle.MF", Constants.SYSTEM_BUNDLE_LOCATION, + Constants.SYSTEM_BUNDLE_SYMBOLICNAME, null, null, container); ResolutionReport report = container.resolve(Arrays.asList(systemBundle), true); assertNull("Failed to resolve system.bundle.", report.getResolutionException()); @@ -2313,10 +2483,13 @@ public void testDynamicWithOptionalImport() throws BundleException, IOException report = container.resolve(Arrays.asList(optionalImporterModule), true); assertNull("Failed to resolve system.bundle.", report.getResolutionException()); - //dynamic and optional imports are same. Optional import is not satisfied we should only see the dynamic import - List importReqsList = optionalImporterModule.getCurrentRevision().getWiring().getRequirements(PackageNamespace.PACKAGE_NAMESPACE); + // dynamic and optional imports are same. Optional import is not satisfied we + // should only see the dynamic import + List importReqsList = optionalImporterModule.getCurrentRevision().getWiring() + .getRequirements(PackageNamespace.PACKAGE_NAMESPACE); assertEquals("Wrong number of imports.", 1, importReqsList.size()); - assertEquals("Import was not dynamic", PackageNamespace.RESOLUTION_DYNAMIC, importReqsList.get(0).getDirectives().get(Namespace.REQUIREMENT_RESOLUTION_DIRECTIVE)); + assertEquals("Import was not dynamic", PackageNamespace.RESOLUTION_DYNAMIC, + importReqsList.get(0).getDirectives().get(Namespace.REQUIREMENT_RESOLUTION_DIRECTIVE)); // install a exporter to satisfy existing optional import Map exporterManifest = new HashMap<>(); @@ -2334,7 +2507,8 @@ public void testDynamicWithOptionalImport() throws BundleException, IOException report = container.resolve(Arrays.asList(optionalImporterModule), true); assertNull("Failed to resolve system.bundle.", report.getResolutionException()); - importReqsList = optionalImporterModule.getCurrentRevision().getWiring().getRequirements(PackageNamespace.PACKAGE_NAMESPACE); + importReqsList = optionalImporterModule.getCurrentRevision().getWiring() + .getRequirements(PackageNamespace.PACKAGE_NAMESPACE); assertEquals("Wrong number of imports.", 2, importReqsList.size()); } @@ -2344,7 +2518,8 @@ public void testDynamicWithExport() throws BundleException, IOException { ModuleContainer container = adaptor.getContainer(); // install the system.bundle - Module systemBundle = installDummyModule("system.bundle.MF", Constants.SYSTEM_BUNDLE_LOCATION, Constants.SYSTEM_BUNDLE_SYMBOLICNAME, null, null, container); + Module systemBundle = installDummyModule("system.bundle.MF", Constants.SYSTEM_BUNDLE_LOCATION, + Constants.SYSTEM_BUNDLE_SYMBOLICNAME, null, null, container); ResolutionReport report = container.resolve(Arrays.asList(systemBundle), true); assertNull("Failed to resolve system.bundle.", report.getResolutionException()); @@ -2360,10 +2535,13 @@ public void testDynamicWithExport() throws BundleException, IOException { report = container.resolve(Arrays.asList(optionalImporterModule), true); assertNull("Failed to resolve system.bundle.", report.getResolutionException()); - //dynamic and optional imports are same. Optional import is not satisfied we should only see the dynamic import - List importReqsList = optionalImporterModule.getCurrentRevision().getWiring().getRequirements(PackageNamespace.PACKAGE_NAMESPACE); + // dynamic and optional imports are same. Optional import is not satisfied we + // should only see the dynamic import + List importReqsList = optionalImporterModule.getCurrentRevision().getWiring() + .getRequirements(PackageNamespace.PACKAGE_NAMESPACE); assertEquals("Wrong number of imports.", 1, importReqsList.size()); - assertEquals("Import was not dynamic", PackageNamespace.RESOLUTION_DYNAMIC, importReqsList.get(0).getDirectives().get(Namespace.REQUIREMENT_RESOLUTION_DIRECTIVE)); + assertEquals("Import was not dynamic", PackageNamespace.RESOLUTION_DYNAMIC, + importReqsList.get(0).getDirectives().get(Namespace.REQUIREMENT_RESOLUTION_DIRECTIVE)); ModuleWire dynamicWire = container.resolveDynamic("exporter", optionalImporterModule.getCurrentRevision()); assertNull("Expected no dynamic wire.", dynamicWire); @@ -2375,7 +2553,8 @@ public void testSubstitutableExport() throws BundleException, IOException { ModuleContainer container = adaptor.getContainer(); // install the system.bundle - Module systemBundle = installDummyModule("system.bundle.MF", Constants.SYSTEM_BUNDLE_LOCATION, Constants.SYSTEM_BUNDLE_SYMBOLICNAME, null, null, container); + Module systemBundle = installDummyModule("system.bundle.MF", Constants.SYSTEM_BUNDLE_LOCATION, + Constants.SYSTEM_BUNDLE_SYMBOLICNAME, null, null, container); ResolutionReport report = container.resolve(Arrays.asList(systemBundle), true); assertNull("Failed to resolve system.bundle.", report.getResolutionException()); @@ -2388,7 +2567,8 @@ public void testSubstitutableExport() throws BundleException, IOException { Module moduleSubsExport = installDummyModule(exporterManifest, "exporter", container); report = container.resolve(Arrays.asList(moduleSubsExport), true); assertNull("Failed to resolve", report.getResolutionException()); - List reqs = moduleSubsExport.getCurrentRevision().getWiring().getRequirements(PackageNamespace.PACKAGE_NAMESPACE); + List reqs = moduleSubsExport.getCurrentRevision().getWiring() + .getRequirements(PackageNamespace.PACKAGE_NAMESPACE); assertEquals("Wrong number of imports.", 0, reqs.size()); container.uninstall(moduleSubsExport); @@ -2410,7 +2590,8 @@ public void testSubstitutableExport() throws BundleException, IOException { report = container.resolve(Arrays.asList(moduleSubsExport/* ,moduleExport */), true); assertNull("Failed to resolve", report.getResolutionException()); - List caps = moduleSubsExport.getCurrentRevision().getWiring().getCapabilities(PackageNamespace.PACKAGE_NAMESPACE); + List caps = moduleSubsExport.getCurrentRevision().getWiring() + .getCapabilities(PackageNamespace.PACKAGE_NAMESPACE); assertEquals("Wrong number of capabilities.", 0, caps.size()); reqs = moduleSubsExport.getCurrentRevision().getWiring().getRequirements(PackageNamespace.PACKAGE_NAMESPACE); @@ -2425,11 +2606,13 @@ public void testSubstitutableExport() throws BundleException, IOException { @Test public void testSubstitutableExportBatch() throws BundleException, IOException { - DummyContainerAdaptor adaptor = new DummyContainerAdaptor(new DummyCollisionHook(false), Collections.singletonMap(EquinoxConfiguration.PROP_RESOLVER_REVISION_BATCH_SIZE, Integer.toString(1))); + DummyContainerAdaptor adaptor = new DummyContainerAdaptor(new DummyCollisionHook(false), + Collections.singletonMap(EquinoxConfiguration.PROP_RESOLVER_REVISION_BATCH_SIZE, Integer.toString(1))); ModuleContainer container = adaptor.getContainer(); // install the system.bundle - Module systemBundle = installDummyModule("system.bundle.MF", Constants.SYSTEM_BUNDLE_LOCATION, Constants.SYSTEM_BUNDLE_SYMBOLICNAME, null, null, container); + Module systemBundle = installDummyModule("system.bundle.MF", Constants.SYSTEM_BUNDLE_LOCATION, + Constants.SYSTEM_BUNDLE_SYMBOLICNAME, null, null, container); ResolutionReport report = container.resolve(Arrays.asList(systemBundle), true); assertNull("Failed to resolve system.bundle.", report.getResolutionException()); @@ -2466,13 +2649,15 @@ public void testSubstitutableExportBatch() throws BundleException, IOException { manifest.put(Constants.IMPORT_PACKAGE, "pkgUser, exporter"); Module moduleImporter3 = installDummyModule(manifest, "importer3", container); - report = container.resolve(Arrays.asList(moduleExport, moduleSubsExport, moduleImporter1, moduleImporter2, moduleImporter3), true); + report = container.resolve( + Arrays.asList(moduleExport, moduleSubsExport, moduleImporter1, moduleImporter2, moduleImporter3), true); assertNull("Failed to resolve", report.getResolutionException()); ModuleWiring subsExportWiring = moduleSubsExport.getCurrentRevision().getWiring(); Collection substituteNames = subsExportWiring.getSubstitutedNames(); assertEquals("Wrong number of exports: " + substituteNames, 1, substituteNames.size()); - List providedWires = moduleSubsExport.getCurrentRevision().getWiring().getProvidedModuleWires(PackageNamespace.PACKAGE_NAMESPACE); + List providedWires = moduleSubsExport.getCurrentRevision().getWiring() + .getProvidedModuleWires(PackageNamespace.PACKAGE_NAMESPACE); assertEquals("Wrong number of wires.", 2, providedWires.size()); ModuleWiring importer3Wiring = moduleImporter3.getCurrentRevision().getWiring(); @@ -2489,11 +2674,12 @@ public void testR3() throws BundleException, IOException { DummyContainerAdaptor adaptor = createDummyAdaptor(); ModuleContainer container = adaptor.getContainer(); // install the system.bundle - Module systemBundle = installDummyModule("system.bundle.MF", Constants.SYSTEM_BUNDLE_LOCATION, Constants.SYSTEM_BUNDLE_SYMBOLICNAME, null, null, container); + Module systemBundle = installDummyModule("system.bundle.MF", Constants.SYSTEM_BUNDLE_LOCATION, + Constants.SYSTEM_BUNDLE_SYMBOLICNAME, null, null, container); ResolutionReport report = container.resolve(Arrays.asList(systemBundle), true); assertNull("Failed to resolve system.bundle.", report.getResolutionException()); - //R3 bundle + // R3 bundle Map exporterManifest = new HashMap<>(); exporterManifest = new HashMap<>(); exporterManifest.put(Constants.BUNDLE_SYMBOLICNAME, "exporter"); @@ -2502,10 +2688,11 @@ public void testR3() throws BundleException, IOException { Module moduleExport = installDummyModule(exporterManifest, "exporter", container); report = container.resolve(Arrays.asList(moduleExport, moduleExport), true); assertNull("Failed to resolve", report.getResolutionException()); - List reqs = moduleExport.getCurrentRevision().getWiring().getRequirements(PackageNamespace.PACKAGE_NAMESPACE); + List reqs = moduleExport.getCurrentRevision().getWiring() + .getRequirements(PackageNamespace.PACKAGE_NAMESPACE); assertEquals("Wrong number of imports.", 0, reqs.size()); - //R3 bundle + // R3 bundle exporterManifest.clear(); exporterManifest.put(Constants.BUNDLE_SYMBOLICNAME, "dynamicExporter"); exporterManifest.put(Constants.EXPORT_PACKAGE, "exporter; version=\"1.0\""); @@ -2528,7 +2715,8 @@ public void testR3() throws BundleException, IOException { } private static Map getUTFManifest(String packageName) throws IOException, BundleException { - // using manifest class to force a split line right in the middle of a double byte UTF-8 character + // using manifest class to force a split line right in the middle of a double + // byte UTF-8 character ByteArrayOutputStream out = new ByteArrayOutputStream(); { Manifest m = new Manifest(); @@ -2549,14 +2737,16 @@ public void testPersistence() throws BundleException, IOException { ModuleContainer container = adaptor.getContainer(); // install the system.bundle - installDummyModule("system.bundle.MF", Constants.SYSTEM_BUNDLE_LOCATION, Constants.SYSTEM_BUNDLE_SYMBOLICNAME, null, null, container); + installDummyModule("system.bundle.MF", Constants.SYSTEM_BUNDLE_LOCATION, Constants.SYSTEM_BUNDLE_SYMBOLICNAME, + null, null, container); Map attrs = new HashMap<>(); attrs.put("string", "sValue"); attrs.put("string.list1", Arrays.asList("v1", "v2", "v3")); attrs.put("string.list2", Arrays.asList("v4", "v5", "v6")); attrs.put("version", Version.valueOf("1.1")); - attrs.put("version.list", Arrays.asList(Version.valueOf("1.0"), Version.valueOf("2.0"), Version.valueOf("3.0"))); + attrs.put("version.list", + Arrays.asList(Version.valueOf("1.0"), Version.valueOf("2.0"), Version.valueOf("3.0"))); attrs.put("long", Long.valueOf(12345)); attrs.put("long.list", Arrays.asList(Long.valueOf(1), Long.valueOf(2), Long.valueOf(3))); attrs.put("double", Double.valueOf(1.2345)); @@ -2568,7 +2758,8 @@ public void testPersistence() throws BundleException, IOException { Map providerManifest = new HashMap<>(); providerManifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); providerManifest.put(Constants.BUNDLE_SYMBOLICNAME, "provider"); - providerManifest.put(Constants.EXPORT_PACKAGE, "provider; version=1.1; attr1=attr1; attr2=attr2; dir1:=dir1; dir2:=dir2"); + providerManifest.put(Constants.EXPORT_PACKAGE, + "provider; version=1.1; attr1=attr1; attr2=attr2; dir1:=dir1; dir2:=dir2"); providerManifest.put(Constants.PROVIDE_CAPABILITY, "provider.cap;"// + " string=sValue;"// + " string.list1:List=\"v1,v2,v3\";"// @@ -2582,13 +2773,15 @@ public void testPersistence() throws BundleException, IOException { + " uri:uri=some.uri;" // + " set:set=\"s1,s2,s3\""); Module providerModule = installDummyModule(providerManifest, "provider", container); - Map providerAttrs = providerModule.getCurrentRevision().getCapabilities("provider.cap").get(0).getAttributes(); + Map providerAttrs = providerModule.getCurrentRevision().getCapabilities("provider.cap").get(0) + .getAttributes(); assertEquals("Wrong provider attrs", attrs, providerAttrs); Map requirerManifest = new HashMap<>(); requirerManifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); requirerManifest.put(Constants.BUNDLE_SYMBOLICNAME, "requirer"); - requirerManifest.put(Constants.IMPORT_PACKAGE, "provider; version=1.1; attr1=attr1; attr2=attr2; dir1:=dir1; dir2:=dir2"); + requirerManifest.put(Constants.IMPORT_PACKAGE, + "provider; version=1.1; attr1=attr1; attr2=attr2; dir1:=dir1; dir2:=dir2"); requirerManifest.put(Constants.REQUIRE_CAPABILITY, "optional;"// + " resolution:=optional; " // + " string=sValue;"// @@ -2616,7 +2809,8 @@ public void testPersistence() throws BundleException, IOException { + "provider.cap; filter:=\"(set=s2)\"" // + ""); Module requirerModule = installDummyModule(requirerManifest, "requirer", container); - Map requirerAttrs = requirerModule.getCurrentRevision().getRequirements("optional").get(0).getAttributes(); + Map requirerAttrs = requirerModule.getCurrentRevision().getRequirements("optional").get(0) + .getAttributes(); assertEquals("Wrong requirer attrs", attrs, requirerAttrs); ResolutionReport report = container.resolve(Collections.singleton(requirerModule), true); assertNull("Error resolving.", report.getResolutionException()); @@ -2647,7 +2841,8 @@ public void testInvalidAttributes() throws IOException, BundleException { ModuleContainer container = adaptor.getContainer(); // install the system.bundle - installDummyModule("system.bundle.MF", Constants.SYSTEM_BUNDLE_LOCATION, Constants.SYSTEM_BUNDLE_SYMBOLICNAME, null, null, container); + installDummyModule("system.bundle.MF", Constants.SYSTEM_BUNDLE_LOCATION, Constants.SYSTEM_BUNDLE_SYMBOLICNAME, + null, null, container); // provider with all supported types Map invalidAttrManifest = new HashMap<>(); @@ -2683,7 +2878,8 @@ public void testStoreInvalidAttributes() throws BundleException, IOException { ModuleContainer container = adaptor.getContainer(); // install the system.bundle - installDummyModule("system.bundle.MF", Constants.SYSTEM_BUNDLE_LOCATION, Constants.SYSTEM_BUNDLE_SYMBOLICNAME, null, null, container); + installDummyModule("system.bundle.MF", Constants.SYSTEM_BUNDLE_LOCATION, Constants.SYSTEM_BUNDLE_SYMBOLICNAME, + null, null, container); Integer testInt = Integer.valueOf(1); List testIntList = Collections.singletonList(testInt); @@ -2691,13 +2887,15 @@ public void testStoreInvalidAttributes() throws BundleException, IOException { builder.setSymbolicName("invalid.attr"); builder.setVersion(Version.valueOf("1.0.0")); builder.addCapability("test", Collections.emptyMap(), Collections.singletonMap("test", (Object) testInt)); - builder.addCapability("test.list", Collections.emptyMap(), Collections.singletonMap("test.list", (Object) testIntList)); + builder.addCapability("test.list", Collections.emptyMap(), + Collections.singletonMap("test.list", (Object) testIntList)); Module invalid = container.install(null, builder.getSymbolicName(), builder, null); Object testAttr = invalid.getCurrentRevision().getCapabilities("test").get(0).getAttributes().get("test"); assertEquals("Wrong test attr", testInt, testAttr); - Object testAttrList = invalid.getCurrentRevision().getCapabilities("test.list").get(0).getAttributes().get("test.list"); + Object testAttrList = invalid.getCurrentRevision().getCapabilities("test.list").get(0).getAttributes() + .get("test.list"); assertEquals("Wrong test list attr", testIntList, testAttrList); ByteArrayOutputStream bytes = new ByteArrayOutputStream(); @@ -2725,7 +2923,8 @@ public void testStoreInvalidAttributes() throws BundleException, IOException { testAttr = invalid.getCurrentRevision().getCapabilities("test").get(0).getAttributes().get("test"); assertEquals("Wrong test attr", testIntString, testAttr); - testAttrList = invalid.getCurrentRevision().getCapabilities("test.list").get(0).getAttributes().get("test.list"); + testAttrList = invalid.getCurrentRevision().getCapabilities("test.list").get(0).getAttributes() + .get("test.list"); assertEquals("Wrong test list attr", testIntStringList, testAttrList); } @@ -2739,7 +2938,8 @@ public void testBug483849() throws BundleException, IOException { ResolutionReport report = container.resolve(Arrays.asList(host), true); assertNull("Failed to resolve host.", report.getResolutionException()); - // install and dynamically attach a fragment that exports a package and resolve an importer + // install and dynamically attach a fragment that exports a package and resolve + // an importer Module frag = installDummyModule("bug483849.frag.MF", "frag", container); Module importer = installDummyModule("bug483849.importer.MF", "importer", container); report = container.resolve(Arrays.asList(frag, importer), true); @@ -2752,12 +2952,14 @@ public void testBug483849() throws BundleException, IOException { Map updateManifest = getManifest("bug483849.host.MF"); ModuleRevisionBuilder updateBuilder = OSGiManifestBuilderFactory.createBuilder(updateManifest); container.update(host, updateBuilder, null); - // refresh host which should force the importer to re-resolve to the new revision + // refresh host which should force the importer to re-resolve to the new + // revision report = container.refresh(Collections.singleton(host)); ModuleWiring importerWiring = importer.getCurrentRevision().getWiring(); assertNotNull("No wiring for importer.", importerWiring); - List importerPackageWires = importerWiring.getRequiredModuleWires(PackageNamespace.PACKAGE_NAMESPACE); + List importerPackageWires = importerWiring + .getRequiredModuleWires(PackageNamespace.PACKAGE_NAMESPACE); assertEquals("Wrong number of importer package Wires.", 1, importerPackageWires.size()); assertEquals("Wrong provider wiring.", host.getCurrentRevision().getWiring(), @@ -2777,7 +2979,8 @@ public void testStartLevelDeadlock() throws BundleException, IOException { container.getFrameworkStartLevel().setInitialBundleStartLevel(2); // install the system.bundle - Module systemBundle = installDummyModule("system.bundle.MF", Constants.SYSTEM_BUNDLE_LOCATION, Constants.SYSTEM_BUNDLE_SYMBOLICNAME, null, null, container); + Module systemBundle = installDummyModule("system.bundle.MF", Constants.SYSTEM_BUNDLE_LOCATION, + Constants.SYSTEM_BUNDLE_SYMBOLICNAME, null, null, container); ResolutionReport report = container.resolve(Arrays.asList(systemBundle), true); assertNull("Failed to resolve system.bundle.", report.getResolutionException()); systemBundle.start(); @@ -2803,7 +3006,8 @@ public void testSystemBundleOnDemandFragments() throws BundleException, IOExcept ModuleContainer container = adaptor.getContainer(); // install the system.bundle - Module systemBundle = installDummyModule("system.bundle.MF", Constants.SYSTEM_BUNDLE_LOCATION, Constants.SYSTEM_BUNDLE_SYMBOLICNAME, null, null, container); + Module systemBundle = installDummyModule("system.bundle.MF", Constants.SYSTEM_BUNDLE_LOCATION, + Constants.SYSTEM_BUNDLE_SYMBOLICNAME, null, null, container); // install an equinox fragment Map equinoxFragManifest = new HashMap<>(); @@ -2822,9 +3026,11 @@ public void testSystemBundleOnDemandFragments() throws BundleException, IOExcept ResolutionReport report = container.resolve(Arrays.asList(systemBundle), true); assertNull("Failed to resolve system.bundle.", report.getResolutionException()); - List hostWires = systemBundle.getCurrentRevision().getWiring().getProvidedModuleWires(HostNamespace.HOST_NAMESPACE); + List hostWires = systemBundle.getCurrentRevision().getWiring() + .getProvidedModuleWires(HostNamespace.HOST_NAMESPACE); assertEquals("Wrong number of fragments.", 2, hostWires.size()); - Set fragmentRevisions = new HashSet(Arrays.asList(equinoxFrag.getCurrentRevision(), systemFrag.getCurrentRevision())); + Set fragmentRevisions = new HashSet( + Arrays.asList(equinoxFrag.getCurrentRevision(), systemFrag.getCurrentRevision())); for (ModuleWire hostWire : hostWires) { if (!fragmentRevisions.remove(hostWire.getRequirer())) { fail("Unexpected fragment revision: " + hostWire.getRequirer()); @@ -2849,8 +3055,8 @@ public void testUnresolvedHostWithFragmentCycle() throws BundleException { installDummyModule(hostManifest, "host11", container); hostManifest.put(Constants.BUNDLE_VERSION, "1.2"); installDummyModule(hostManifest, "host12", container); - //hostManifest.put(Constants.BUNDLE_VERSION, "1.3"); - //installDummyModule(hostManifest, "host13", container); + // hostManifest.put(Constants.BUNDLE_VERSION, "1.3"); + // installDummyModule(hostManifest, "host13", container); // install a host.impl fragment Map hostImplManifest = new HashMap<>(); @@ -2956,7 +3162,8 @@ private void doTestStartOnResolve(boolean enabled) throws BundleException, IOExc ModuleContainer container = adaptor.getContainer(); // install the system.bundle - Module systemBundle = installDummyModule("system.bundle.MF", Constants.SYSTEM_BUNDLE_LOCATION, Constants.SYSTEM_BUNDLE_SYMBOLICNAME, null, null, container); + Module systemBundle = installDummyModule("system.bundle.MF", Constants.SYSTEM_BUNDLE_LOCATION, + Constants.SYSTEM_BUNDLE_SYMBOLICNAME, null, null, container); ResolutionReport report = container.resolve(Arrays.asList(systemBundle), true); assertNull("Failed to resolve system.bundle.", report.getResolutionException()); systemBundle.start(); @@ -3000,7 +3207,8 @@ public void testResolveDeadlock() throws BundleException, IOException, Interrupt ModuleContainer container = adaptor.getContainer(); // install the system.bundle - Module systemBundle = installDummyModule("system.bundle.MF", Constants.SYSTEM_BUNDLE_LOCATION, Constants.SYSTEM_BUNDLE_SYMBOLICNAME, null, null, container); + Module systemBundle = installDummyModule("system.bundle.MF", Constants.SYSTEM_BUNDLE_LOCATION, + Constants.SYSTEM_BUNDLE_SYMBOLICNAME, null, null, container); ResolutionReport report = container.resolve(Arrays.asList(systemBundle), true); assertNull("Failed to resolve system.bundle.", report.getResolutionException()); systemBundle.start(); @@ -3046,7 +3254,8 @@ class RecurseResolverHook implements ResolverHook { volatile ModuleContainer container; volatile Module dynamicImport; final AtomicInteger id = new AtomicInteger(); - List expectedErrors = Collections.synchronizedList(new ArrayList()); + List expectedErrors = Collections + .synchronizedList(new ArrayList()); @Override public void filterResolvable(Collection candidates) { @@ -3083,7 +3292,8 @@ public void filterResolvable(Collection candidates) { } @Override - public void filterSingletonCollisions(BundleCapability singleton, Collection collisionCandidates) { + public void filterSingletonCollisions(BundleCapability singleton, + Collection collisionCandidates) { // nothing } @@ -3109,7 +3319,8 @@ public void testRecurseResolutionPermits() throws BundleException, IOException { final ModuleContainer container = adaptor.getContainer(); // install the system.bundle - Module systemBundle = installDummyModule("system.bundle.MF", Constants.SYSTEM_BUNDLE_LOCATION, Constants.SYSTEM_BUNDLE_SYMBOLICNAME, null, null, container); + Module systemBundle = installDummyModule("system.bundle.MF", Constants.SYSTEM_BUNDLE_LOCATION, + Constants.SYSTEM_BUNDLE_SYMBOLICNAME, null, null, container); ResolutionReport report = container.resolve(Arrays.asList(systemBundle), true); assertNull("Failed to resolve system.bundle.", report.getResolutionException()); systemBundle.start(); @@ -3119,13 +3330,15 @@ public void testRecurseResolutionPermits() throws BundleException, IOException { manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); manifest.put(Constants.BUNDLE_SYMBOLICNAME, "dynamicImport"); manifest.put(Constants.DYNAMICIMPORT_PACKAGE, "*"); - final Module dynamicImport = installDummyModule(manifest, manifest.get(Constants.BUNDLE_SYMBOLICNAME), container); + final Module dynamicImport = installDummyModule(manifest, manifest.get(Constants.BUNDLE_SYMBOLICNAME), + container); dynamicImport.start(); resolverHook.dynamicImport = dynamicImport; resolverHook.container = container; final AtomicReference dynamicWire = new AtomicReference<>(); - Runnable runForEvents = () -> dynamicWire.set(container.resolveDynamic("org.osgi.framework", dynamicImport.getCurrentRevision())); + Runnable runForEvents = () -> dynamicWire + .set(container.resolveDynamic("org.osgi.framework", dynamicImport.getCurrentRevision())); adaptor.setRunForEvents(runForEvents); // install a bundle to resolve manifest.clear(); @@ -3156,12 +3369,14 @@ public void testSystemBundleFragmentsPackageImport() throws BundleException, IOE ResolutionReport report = container.resolve(Arrays.asList(systemFrag), true); assertNull("Failed to resolve system.bundle.", report.getResolutionException()); - List hostWires = systemBundle.getCurrentRevision().getWiring().getProvidedModuleWires(HostNamespace.HOST_NAMESPACE); + List hostWires = systemBundle.getCurrentRevision().getWiring() + .getProvidedModuleWires(HostNamespace.HOST_NAMESPACE); assertEquals("Wrong number of fragments.", 1, hostWires.size()); assertEquals("Unexpected fragment revision: " + hostWires, systemFrag.getCurrentRevision(), hostWires.get(0).getRequirer()); - List systemBundleRequiredWires = systemBundle.getCurrentRevision().getWiring().getRequiredModuleWires(null); + List systemBundleRequiredWires = systemBundle.getCurrentRevision().getWiring() + .getRequiredModuleWires(null); assertEquals("No required wires expected.", 0, systemBundleRequiredWires.size()); } @@ -3183,12 +3398,14 @@ public void testSystemBundleFragmentsNonPayloadRequirements() throws BundleExcep ResolutionReport report = container.resolve(Arrays.asList(systemFrag), true); assertNull("Failed to resolve system.bundle.", report.getResolutionException()); - List hostWires = systemBundle.getCurrentRevision().getWiring().getProvidedModuleWires(HostNamespace.HOST_NAMESPACE); + List hostWires = systemBundle.getCurrentRevision().getWiring() + .getProvidedModuleWires(HostNamespace.HOST_NAMESPACE); assertEquals("Wrong number of fragments.", 1, hostWires.size()); assertEquals("Unexpected fragment revision: " + hostWires, systemFrag.getCurrentRevision(), hostWires.get(0).getRequirer()); - List systemBundleRequiredWires = systemBundle.getCurrentRevision().getWiring().getRequiredModuleWires(null); + List systemBundleRequiredWires = systemBundle.getCurrentRevision().getWiring() + .getRequiredModuleWires(null); assertEquals("No required wires expected.", 0, systemBundleRequiredWires.size()); List fragRequiredWires = systemFrag.getCurrentRevision().getWiring().getRequiredModuleWires(null); @@ -3202,7 +3419,8 @@ public void testSystemBundleFragmentsWithPayloadRequirements() throws BundleExce Module systemBundle = createContainerWithSystemBundle(true); ModuleContainer container = systemBundle.getContainer(); - // install an system.bundle fragment that requires a payload requirement from system.bundle + // install an system.bundle fragment that requires a payload requirement from + // system.bundle Map systemFragManifest = new HashMap<>(); systemFragManifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); systemFragManifest.put(Constants.BUNDLE_SYMBOLICNAME, "systemFrag"); @@ -3214,15 +3432,19 @@ public void testSystemBundleFragmentsWithPayloadRequirements() throws BundleExce ResolutionReport report = container.resolve(Arrays.asList(systemFrag), true); assertNull("Failed to resolve system.bundle.", report.getResolutionException()); - List hostWires = systemBundle.getCurrentRevision().getWiring().getProvidedModuleWires(HostNamespace.HOST_NAMESPACE); + List hostWires = systemBundle.getCurrentRevision().getWiring() + .getProvidedModuleWires(HostNamespace.HOST_NAMESPACE); assertEquals("Wrong number of fragments.", 1, hostWires.size()); assertEquals("Unexpected fragment revision: " + hostWires, systemFrag.getCurrentRevision(), hostWires.get(0).getRequirer()); - List systemBundleRequiredWires = systemBundle.getCurrentRevision().getWiring().getRequiredModuleWires(null); + List systemBundleRequiredWires = systemBundle.getCurrentRevision().getWiring() + .getRequiredModuleWires(null); assertEquals("Wrong number of wires.", 1, systemBundleRequiredWires.size()); - assertEquals("Wrong requirer.", systemBundle.getCurrentRevision(), systemBundleRequiredWires.get(0).getRequirer()); - assertEquals("Wrong requirement.", systemFrag.getCurrentRevision(), systemBundleRequiredWires.get(0).getRequirement().getRevision()); + assertEquals("Wrong requirer.", systemBundle.getCurrentRevision(), + systemBundleRequiredWires.get(0).getRequirer()); + assertEquals("Wrong requirement.", systemFrag.getCurrentRevision(), + systemBundleRequiredWires.get(0).getRequirement().getRevision()); List fragRequiredWires = systemFrag.getCurrentRevision().getWiring().getRequiredModuleWires(null); assertEquals("Wrong number of required wires.", 1, fragRequiredWires.size()); @@ -3248,21 +3470,28 @@ public void testSystemBundleFragmentRequiresOtherFragment() throws BundleExcepti systemFragManifest2.put(Constants.BUNDLE_MANIFESTVERSION, "2"); systemFragManifest2.put(Constants.BUNDLE_SYMBOLICNAME, "systemFrag2"); systemFragManifest2.put(Constants.FRAGMENT_HOST, Constants.SYSTEM_BUNDLE_SYMBOLICNAME); - systemFragManifest2.put(Constants.REQUIRE_CAPABILITY, "fragment.capability; filter:=\"(fragment.capability=test)\""); + systemFragManifest2.put(Constants.REQUIRE_CAPABILITY, + "fragment.capability; filter:=\"(fragment.capability=test)\""); Module systemFrag2 = installDummyModule(systemFragManifest2, "systemFrag2", container); ResolutionReport report = container.resolve(Arrays.asList(systemFrag2), true); assertNull("Failed to resolve system.bundle.", report.getResolutionException()); - List hostWires = systemBundle.getCurrentRevision().getWiring().getProvidedModuleWires(HostNamespace.HOST_NAMESPACE); + List hostWires = systemBundle.getCurrentRevision().getWiring() + .getProvidedModuleWires(HostNamespace.HOST_NAMESPACE); assertEquals("Wrong number of fragments.", 2, hostWires.size()); - List systemBundleRequiredWires = systemBundle.getCurrentRevision().getWiring().getRequiredModuleWires(null); + List systemBundleRequiredWires = systemBundle.getCurrentRevision().getWiring() + .getRequiredModuleWires(null); assertEquals("Wrong number of wires.", 1, systemBundleRequiredWires.size()); - assertEquals("Wrong requirer.", systemBundle.getCurrentRevision(), systemBundleRequiredWires.get(0).getRequirer()); - assertEquals("Wrong requirement.", systemFrag2.getCurrentRevision(), systemBundleRequiredWires.get(0).getRequirement().getRevision()); - assertEquals("Wrong provider.", systemBundle.getCurrentRevision(), systemBundleRequiredWires.get(0).getProvider()); - assertEquals("Wrong capability.", systemFrag1.getCurrentRevision(), systemBundleRequiredWires.get(0).getCapability().getRevision()); + assertEquals("Wrong requirer.", systemBundle.getCurrentRevision(), + systemBundleRequiredWires.get(0).getRequirer()); + assertEquals("Wrong requirement.", systemFrag2.getCurrentRevision(), + systemBundleRequiredWires.get(0).getRequirement().getRevision()); + assertEquals("Wrong provider.", systemBundle.getCurrentRevision(), + systemBundleRequiredWires.get(0).getProvider()); + assertEquals("Wrong capability.", systemFrag1.getCurrentRevision(), + systemBundleRequiredWires.get(0).getCapability().getRevision()); List fragRequiredWires = systemFrag2.getCurrentRevision().getWiring().getRequiredModuleWires(null); assertEquals("Wrong number of required wires.", 1, fragRequiredWires.size()); @@ -3283,33 +3512,40 @@ public void testSystemBundleFragmentRequiresOtherFragmentFailResolution() throws systemFragManifest1.put(Constants.PROVIDE_CAPABILITY, "fragment.capability; fragment.capability=test1"); Module systemFrag1 = installDummyModule(systemFragManifest1, "systemFrag1", container); - // install an system.bundle fragment that requires a fragment capability, but fails to match + // install an system.bundle fragment that requires a fragment capability, but + // fails to match Map systemFragManifest2 = new HashMap<>(); systemFragManifest2.put(Constants.BUNDLE_MANIFESTVERSION, "2"); systemFragManifest2.put(Constants.BUNDLE_SYMBOLICNAME, "systemFrag2"); systemFragManifest2.put(Constants.FRAGMENT_HOST, Constants.SYSTEM_BUNDLE_SYMBOLICNAME); - systemFragManifest2.put(Constants.REQUIRE_CAPABILITY, "fragment.capability; filter:=\"(fragment.capability=test4)\""); + systemFragManifest2.put(Constants.REQUIRE_CAPABILITY, + "fragment.capability; filter:=\"(fragment.capability=test4)\""); systemFragManifest2.put(Constants.PROVIDE_CAPABILITY, "fragment.capability; fragment.capability=test2"); Module systemFrag2 = installDummyModule(systemFragManifest2, "systemFrag2", container); - // install an system.bundle fragment that requires a fragment capability from a fragment that fails to resolve + // install an system.bundle fragment that requires a fragment capability from a + // fragment that fails to resolve Map systemFragManifest3 = new HashMap<>(); systemFragManifest3.put(Constants.BUNDLE_MANIFESTVERSION, "2"); systemFragManifest3.put(Constants.BUNDLE_SYMBOLICNAME, "systemFrag3"); systemFragManifest3.put(Constants.FRAGMENT_HOST, Constants.SYSTEM_BUNDLE_SYMBOLICNAME); - systemFragManifest3.put(Constants.REQUIRE_CAPABILITY, "fragment.capability; filter:=\"(fragment.capability=test2)\""); + systemFragManifest3.put(Constants.REQUIRE_CAPABILITY, + "fragment.capability; filter:=\"(fragment.capability=test2)\""); systemFragManifest3.put(Constants.PROVIDE_CAPABILITY, "fragment.capability; fragment.capability=test3"); Module systemFrag3 = installDummyModule(systemFragManifest3, "systemFrag3", container); ResolutionReport report = container.resolve(Collections.emptyList(), false); assertNotNull("Expected failure message", report.getEntries().get(systemFrag3.getCurrentRevision())); - List hostWires = systemBundle.getCurrentRevision().getWiring().getProvidedModuleWires(HostNamespace.HOST_NAMESPACE); + List hostWires = systemBundle.getCurrentRevision().getWiring() + .getProvidedModuleWires(HostNamespace.HOST_NAMESPACE); assertEquals("Wrong number of fragments.", 1, hostWires.size()); - List systemFrag1HostWires = systemFrag1.getCurrentRevision().getWiring().getRequiredModuleWires(HostNamespace.HOST_NAMESPACE); + List systemFrag1HostWires = systemFrag1.getCurrentRevision().getWiring() + .getRequiredModuleWires(HostNamespace.HOST_NAMESPACE); assertWires(systemFrag1HostWires, hostWires); - // install a bundle that can satisfy the failed requirement, but it should not be allowed since it is not a fragment + // install a bundle that can satisfy the failed requirement, but it should not + // be allowed since it is not a fragment Map provideCapabilityManifest1 = new HashMap<>(); provideCapabilityManifest1.put(Constants.BUNDLE_MANIFESTVERSION, "2"); provideCapabilityManifest1.put(Constants.BUNDLE_SYMBOLICNAME, "provideCapabilityBundle1"); @@ -3318,7 +3554,8 @@ public void testSystemBundleFragmentRequiresOtherFragmentFailResolution() throws hostWires = systemBundle.getCurrentRevision().getWiring().getProvidedModuleWires(HostNamespace.HOST_NAMESPACE); assertEquals("Wrong number of fragments.", 1, hostWires.size()); - systemFrag1HostWires = systemFrag1.getCurrentRevision().getWiring().getRequiredModuleWires(HostNamespace.HOST_NAMESPACE); + systemFrag1HostWires = systemFrag1.getCurrentRevision().getWiring() + .getRequiredModuleWires(HostNamespace.HOST_NAMESPACE); assertWires(systemFrag1HostWires, hostWires); // install a fragment that satisfies the failed requirement @@ -3334,20 +3571,27 @@ public void testSystemBundleFragmentRequiresOtherFragmentFailResolution() throws hostWires = systemBundle.getCurrentRevision().getWiring().getProvidedModuleWires(HostNamespace.HOST_NAMESPACE); assertEquals("Wrong number of fragments.", 4, hostWires.size()); - systemFrag1HostWires = systemFrag1.getCurrentRevision().getWiring().getRequiredModuleWires(HostNamespace.HOST_NAMESPACE); - List systemFrag2HostWires = systemFrag2.getCurrentRevision().getWiring().getRequiredModuleWires(HostNamespace.HOST_NAMESPACE); - List systemFrag3HostWires = systemFrag3.getCurrentRevision().getWiring().getRequiredModuleWires(HostNamespace.HOST_NAMESPACE); - List systemFrag4HostWires = systemFrag4.getCurrentRevision().getWiring().getRequiredModuleWires(HostNamespace.HOST_NAMESPACE); + systemFrag1HostWires = systemFrag1.getCurrentRevision().getWiring() + .getRequiredModuleWires(HostNamespace.HOST_NAMESPACE); + List systemFrag2HostWires = systemFrag2.getCurrentRevision().getWiring() + .getRequiredModuleWires(HostNamespace.HOST_NAMESPACE); + List systemFrag3HostWires = systemFrag3.getCurrentRevision().getWiring() + .getRequiredModuleWires(HostNamespace.HOST_NAMESPACE); + List systemFrag4HostWires = systemFrag4.getCurrentRevision().getWiring() + .getRequiredModuleWires(HostNamespace.HOST_NAMESPACE); assertWires(systemFrag1HostWires, hostWires); assertWires(systemFrag2HostWires, hostWires); assertWires(systemFrag3HostWires, hostWires); assertWires(systemFrag4HostWires, hostWires); - List fragmentCapabilities = systemBundle.getCurrentRevision().getWiring().getModuleCapabilities("fragment.capability"); + List fragmentCapabilities = systemBundle.getCurrentRevision().getWiring() + .getModuleCapabilities("fragment.capability"); assertEquals("Wrong number of fragment capabilities.", 4, fragmentCapabilities.size()); // Use set since the order of required and provided wires will be different - Set hostRequiredFragmentCapWires = new HashSet<>(systemBundle.getCurrentRevision().getWiring().getRequiredModuleWires("fragment.capability")); - Set hostProvidedFragmentCapWires = new HashSet<>(systemBundle.getCurrentRevision().getWiring().getProvidedModuleWires("fragment.capability")); + Set hostRequiredFragmentCapWires = new HashSet<>( + systemBundle.getCurrentRevision().getWiring().getRequiredModuleWires("fragment.capability")); + Set hostProvidedFragmentCapWires = new HashSet<>( + systemBundle.getCurrentRevision().getWiring().getProvidedModuleWires("fragment.capability")); assertEquals("Wrong number of wires.", 2, hostProvidedFragmentCapWires.size()); assertEquals("Wrong wires found from host.", hostRequiredFragmentCapWires, hostProvidedFragmentCapWires); } @@ -3370,9 +3614,11 @@ public void testMultipleSystemBundleFragmentsWithSameName() throws BundleExcepti ResolutionReport report = container.resolve(Arrays.asList(systemFrag1), true); assertNull("Unexpected failure message", report.getResolutionException()); - List hostWires = systemBundle.getCurrentRevision().getWiring().getProvidedModuleWires(HostNamespace.HOST_NAMESPACE); + List hostWires = systemBundle.getCurrentRevision().getWiring() + .getProvidedModuleWires(HostNamespace.HOST_NAMESPACE); assertEquals("Wrong number of fragments.", 1, hostWires.size()); - List systemFrag1HostWires = systemFrag1.getCurrentRevision().getWiring().getRequiredModuleWires(HostNamespace.HOST_NAMESPACE); + List systemFrag1HostWires = systemFrag1.getCurrentRevision().getWiring() + .getRequiredModuleWires(HostNamespace.HOST_NAMESPACE); assertWires(systemFrag1HostWires, hostWires); Map systemFragManifest2 = new HashMap<>(); @@ -3396,7 +3642,8 @@ public void testMultipleSystemBundleFragmentsWithSameName() throws BundleExcepti hostWires = systemBundle.getCurrentRevision().getWiring().getProvidedModuleWires(HostNamespace.HOST_NAMESPACE); assertEquals("Wrong number of fragments.", 1, hostWires.size()); - systemFrag1HostWires = systemFrag1.getCurrentRevision().getWiring().getRequiredModuleWires(HostNamespace.HOST_NAMESPACE); + systemFrag1HostWires = systemFrag1.getCurrentRevision().getWiring() + .getRequiredModuleWires(HostNamespace.HOST_NAMESPACE); assertWires(systemFrag1HostWires, hostWires); // uninstall the fragments so we can start over @@ -3423,7 +3670,8 @@ public void testMultipleSystemBundleFragmentsWithSameName() throws BundleExcepti assertNull("Unexpected failure message", report.getResolutionException()); hostWires = systemBundle.getCurrentRevision().getWiring().getProvidedModuleWires(HostNamespace.HOST_NAMESPACE); - List systemFrag3HostWires = systemFrag3.getCurrentRevision().getWiring().getRequiredModuleWires(HostNamespace.HOST_NAMESPACE); + List systemFrag3HostWires = systemFrag3.getCurrentRevision().getWiring() + .getRequiredModuleWires(HostNamespace.HOST_NAMESPACE); assertWires(systemFrag3HostWires, hostWires); } @@ -3497,6 +3745,7 @@ public void filterResolvable(Collection candidates) { } } } + @Override public void filterMatches(BundleRequirement requirement, Collection candidates) { } @@ -3526,17 +3775,14 @@ public void end() { ResolutionReport report = container.resolve(Arrays.asList(systemFrag2), true); assertNotNull("Should fail to resolve fragment", report.getResolutionException()); - assertNotNull("Should fail to resolve fragment", - report.getEntries().get(systemFrag1.getCurrentRevision())); + assertNotNull("Should fail to resolve fragment", report.getEntries().get(systemFrag1.getCurrentRevision())); assertEquals("Expected module not be resolved.", Module.State.INSTALLED, systemFrag2.getState()); assertEquals("Expected module not be resolved.", Module.State.INSTALLED, systemFrag1.getState()); report = container.resolve(Arrays.asList(systemFrag2), false); - assertNotNull("Should fail to resolve fragment", - report.getEntries().get(systemFrag2.getCurrentRevision())); - assertNotNull("Should fail to resolve fragment", - report.getEntries().get(systemFrag1.getCurrentRevision())); + assertNotNull("Should fail to resolve fragment", report.getEntries().get(systemFrag2.getCurrentRevision())); + assertNotNull("Should fail to resolve fragment", report.getEntries().get(systemFrag1.getCurrentRevision())); assertEquals("Expected module not be resolved.", Module.State.INSTALLED, systemFrag2.getState()); assertEquals("Expected module not be resolved.", Module.State.INSTALLED, systemFrag1.getState()); @@ -3554,7 +3800,8 @@ private Module createContainerWithSystemBundle(boolean resolveSystemBundle, Reso // install the system.bundle String systemCapability = "osgi.ee; osgi.ee=\"JavaSE\"; version:List=\"1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6\", equinox.test; equinox.test=system, osgi.native; osgi.native.osname=test"; - Module systemBundle = installDummyModule("system.bundle.MF", Constants.SYSTEM_BUNDLE_LOCATION, Constants.SYSTEM_BUNDLE_SYMBOLICNAME, null, systemCapability, container); + Module systemBundle = installDummyModule("system.bundle.MF", Constants.SYSTEM_BUNDLE_LOCATION, + Constants.SYSTEM_BUNDLE_SYMBOLICNAME, null, systemCapability, container); if (resolveSystemBundle) { ResolutionReport report = container.resolve(Collections.singleton(systemBundle), true); assertNull("Found resolution exception.", report.getResolutionException()); @@ -3701,7 +3948,8 @@ public void testModuleIDSetting() throws BundleException, IOException { ModuleContainer container = adaptor.getContainer(); // install the system.bundle - Module systemBundle = installDummyModule("system.bundle.MF", Constants.SYSTEM_BUNDLE_LOCATION, Constants.SYSTEM_BUNDLE_SYMBOLICNAME, null, null, container); + Module systemBundle = installDummyModule("system.bundle.MF", Constants.SYSTEM_BUNDLE_LOCATION, + Constants.SYSTEM_BUNDLE_SYMBOLICNAME, null, null, container); ResolutionReport report = container.resolve(Arrays.asList(systemBundle), true); assertNull("Failed to resolve system.bundle.", report.getResolutionException()); @@ -3766,14 +4014,16 @@ public void testStartDeadLock() throws BundleException, InterruptedException, IO CountDownLatch startLatch = new CountDownLatch(1); CountDownLatch stopLatch = new CountDownLatch(1); - DummyContainerAdaptor adaptor = new DummyContainerAdaptor(new DummyCollisionHook(false), Collections.singletonMap(EquinoxConfiguration.PROP_MODULE_LOCK_TIMEOUT, "1")); + DummyContainerAdaptor adaptor = new DummyContainerAdaptor(new DummyCollisionHook(false), + Collections.singletonMap(EquinoxConfiguration.PROP_MODULE_LOCK_TIMEOUT, "1")); adaptor.setStartLatch(startLatch); adaptor.setStopLatch(stopLatch); ModuleContainer container = adaptor.getContainer(); // install the system.bundle - Module systemBundle = installDummyModule("system.bundle.MF", Constants.SYSTEM_BUNDLE_LOCATION, Constants.SYSTEM_BUNDLE_SYMBOLICNAME, null, null, container); + Module systemBundle = installDummyModule("system.bundle.MF", Constants.SYSTEM_BUNDLE_LOCATION, + Constants.SYSTEM_BUNDLE_SYMBOLICNAME, null, null, container); ResolutionReport report = container.resolve(Arrays.asList(systemBundle), true); assertNull("Failed to resolve system.bundle.", report.getResolutionException()); systemBundle.start(); @@ -3831,7 +4081,8 @@ public void testUsesWithRequireReexport() throws BundleException, IOException { ModuleContainer container = adaptor.getContainer(); // install the system.bundle - Module systemBundle = installDummyModule("system.bundle.MF", Constants.SYSTEM_BUNDLE_LOCATION, Constants.SYSTEM_BUNDLE_SYMBOLICNAME, null, null, container); + Module systemBundle = installDummyModule("system.bundle.MF", Constants.SYSTEM_BUNDLE_LOCATION, + Constants.SYSTEM_BUNDLE_SYMBOLICNAME, null, null, container); ResolutionReport report = container.resolve(Arrays.asList(systemBundle), true); assertNull("Failed to resolve system.bundle.", report.getResolutionException()); @@ -3882,7 +4133,8 @@ public void testUsesWithRequireReexport() throws BundleException, IOException { reexporterSplit3Manifest.put(Constants.REQUIRE_BUNDLE, "split3; visibility:=reexport"); Module moduleReexportSplit3 = installDummyModule(reexporterSplit3Manifest, "reexportSplit3", container); - // install test export that requires reexportSplit3 (should get access to all 3 parts) + // install test export that requires reexportSplit3 (should get access to all 3 + // parts) Map testExporterUses = new HashMap<>(); testExporterUses.put(Constants.BUNDLE_MANIFESTVERSION, "2"); testExporterUses.put(Constants.BUNDLE_SYMBOLICNAME, "test.exporter"); @@ -3890,7 +4142,8 @@ public void testUsesWithRequireReexport() throws BundleException, IOException { testExporterUses.put(Constants.EXPORT_PACKAGE, "export.pkg; uses:=split.pkg"); Module testExporter = installDummyModule(testExporterUses, "test.exporter", container); - // install test requirer that requires the exporter and reexport1 (should get access to only part 1) + // install test requirer that requires the exporter and reexport1 (should get + // access to only part 1) // part 1 is a subset of what the exporter has access to so it should resolve Map testRequireUses = new HashMap<>(); testRequireUses.put(Constants.BUNDLE_MANIFESTVERSION, "2"); @@ -3898,7 +4151,8 @@ public void testUsesWithRequireReexport() throws BundleException, IOException { testRequireUses.put(Constants.REQUIRE_BUNDLE, "test.exporter, reexport1"); Module testRequirer = installDummyModule(testRequireUses, "test.requirer", container); - report = container.resolve(Arrays.asList(moduleSplit1, moduleSplit2, moduleSplit3, moduleReexport1, moduleReexportSplit3, testExporter, testRequirer), true); + report = container.resolve(Arrays.asList(moduleSplit1, moduleSplit2, moduleSplit3, moduleReexport1, + moduleReexportSplit3, testExporter, testRequirer), true); assertNull("Failed to resolve", report.getResolutionException()); } @@ -4079,7 +4333,8 @@ private static void assertWires(List required, List... p } private void assertEvents(List expected, List actual, boolean orderMatters) { - for (List expectedCommon = removeFirstListOfCommonEvents(expected); !expectedCommon.isEmpty(); expectedCommon = removeFirstListOfCommonEvents(expected)) { + for (List expectedCommon = removeFirstListOfCommonEvents(expected); !expectedCommon + .isEmpty(); expectedCommon = removeFirstListOfCommonEvents(expected)) { List actualCommon = removeFirstListOfCommonEvents(actual); if (expectedCommon.size() != actualCommon.size()) { assertEquals("Wrong number of events found in: " + actualCommon, expectedCommon.size(), diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/container/dummys/DummyContainerAdaptor.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/container/dummys/DummyContainerAdaptor.java index e7f9254ba6a..0c8b77dfa10 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/container/dummys/DummyContainerAdaptor.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/container/dummys/DummyContainerAdaptor.java @@ -51,11 +51,13 @@ public DummyContainerAdaptor(ModuleCollisionHook collisionHook, Map configuration, ResolverHookFactory resolverHookFactory) { + public DummyContainerAdaptor(ModuleCollisionHook collisionHook, Map configuration, + ResolverHookFactory resolverHookFactory) { this(collisionHook, configuration, resolverHookFactory, null); } - public DummyContainerAdaptor(ModuleCollisionHook collisionHook, Map configuration, ResolverHookFactory resolverHookFactory, DebugOptions debugOptions) { + public DummyContainerAdaptor(ModuleCollisionHook collisionHook, Map configuration, + ResolverHookFactory resolverHookFactory, DebugOptions debugOptions) { this.collisionHook = collisionHook; this.configuration = configuration == null ? new HashMap<>() : configuration; this.resolverHookFactory = resolverHookFactory; @@ -79,7 +81,8 @@ public ResolverHookFactory getResolverHookFactory() { } @Override - public void publishContainerEvent(ContainerEvent type, Module module, Throwable error, FrameworkListener... listeners) { + public void publishContainerEvent(ContainerEvent type, Module module, Throwable error, + FrameworkListener... listeners) { moduleDatabase.addEvent(new DummyContainerEvent(type, module, error, listeners)); } diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/container/dummys/DummyModule.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/container/dummys/DummyModule.java index 8e7e7de2118..e5a8bf65217 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/container/dummys/DummyModule.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/container/dummys/DummyModule.java @@ -25,11 +25,13 @@ public class DummyModule extends Module { private final CountDownLatch startLatch; private final CountDownLatch stopLatch; - public DummyModule(Long id, String location, ModuleContainer container, EnumSet settings, int startlevel) { + public DummyModule(Long id, String location, ModuleContainer container, EnumSet settings, + int startlevel) { this(id, location, container, settings, startlevel, null, null); } - public DummyModule(Long id, String location, ModuleContainer container, EnumSet settings, int startlevel, CountDownLatch startLatch, CountDownLatch stopLatch) { + public DummyModule(Long id, String location, ModuleContainer container, EnumSet settings, int startlevel, + CountDownLatch startLatch, CountDownLatch stopLatch) { super(id, location, container, settings, startlevel); this.startLatch = startLatch == null ? new CountDownLatch(0) : startLatch; this.stopLatch = stopLatch == null ? new CountDownLatch(0) : stopLatch; diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/container/dummys/DummyModuleDatabase.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/container/dummys/DummyModuleDatabase.java index d2fc7168933..2de6896309c 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/container/dummys/DummyModuleDatabase.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/container/dummys/DummyModuleDatabase.java @@ -119,7 +119,8 @@ public static class DummyContainerEvent { public final Throwable error; public final FrameworkListener[] listeners; - public DummyContainerEvent(ContainerEvent type, Module module, Throwable error, FrameworkListener... listeners) { + public DummyContainerEvent(ContainerEvent type, Module module, Throwable error, + FrameworkListener... listeners) { this.type = type; this.module = module; this.error = error; diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/container/dummys/DummyResolverHook.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/container/dummys/DummyResolverHook.java index 5d114f88ebc..c931b4ab539 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/container/dummys/DummyResolverHook.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/container/dummys/DummyResolverHook.java @@ -19,7 +19,8 @@ public void filterResolvable(Collection candidates) { } @Override - public void filterSingletonCollisions(BundleCapability singleton, Collection collisionCandidates) { + public void filterSingletonCollisions(BundleCapability singleton, + Collection collisionCandidates) { // TODO Auto-generated method stub } diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/debugoptions/DebugOptionsTestCase.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/debugoptions/DebugOptionsTestCase.java index 10d831fc043..86a748b8c35 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/debugoptions/DebugOptionsTestCase.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/debugoptions/DebugOptionsTestCase.java @@ -52,8 +52,10 @@ public class DebugOptionsTestCase extends CoreTest { Dictionary props = null; TestDebugOptionsListener listener = null; ServiceRegistration reg = null; - private final static String TRACE_ELEMENT_DELIMITER = "|"; //$NON-NLS-1$ // this value needs to match EclipseDebugTrace#TRACE_ELEMENT_DELIMITER - private final static String TRACE_ELEMENT_DELIMITER_ENCODED = "|"; //$NON-NLS-1$ // this value needs to match EclipseDebugTrace#TRACE_ELEMENT_DELIMITER_ENCODED + private final static String TRACE_ELEMENT_DELIMITER = "|"; //$NON-NLS-1$ // this value needs to match + // EclipseDebugTrace#TRACE_ELEMENT_DELIMITER + private final static String TRACE_ELEMENT_DELIMITER_ENCODED = "|"; //$NON-NLS-1$ // this value needs to match + // EclipseDebugTrace#TRACE_ELEMENT_DELIMITER_ENCODED private final static SimpleDateFormat TRACE_FILE_DATE_FORMATTER = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS"); //$NON-NLS-1$ private final static String LINE_SEPARATOR; private boolean verboseDebug = true; // default is true @@ -89,12 +91,13 @@ public void testRegistration01() { } /** - * Test that a new {@link FrameworkDebugTraceEntry} object created without a trace class - * has 'org.eclipse.osgi.tests.debugoptions.DebugOptionsTestCase' as the class name and - * 'testTracingEntry01' as the method name that it determined as the caller of it. + * Test that a new {@link FrameworkDebugTraceEntry} object created without a + * trace class has 'org.eclipse.osgi.tests.debugoptions.DebugOptionsTestCase' as + * the class name and 'testTracingEntry01' as the method name that it determined + * as the caller of it. * - * This test mimics the tracing framework to ensure that the correct class name and method name - * are returned and written to the trace file. + * This test mimics the tracing framework to ensure that the correct class name + * and method name are returned and written to the trace file. */ public void testTracingEntry01() { @@ -104,25 +107,29 @@ public void testTracingEntry01() { FrameworkDebugTraceEntry traceEntry = new FrameworkDebugTraceEntry(bundleName, optionPath, message, null); String correctClassName = "org.eclipse.osgi.tests.debugoptions.DebugOptionsTestCase"; //$NON-NLS-1$ String correctMethodName = "testTracingEntry01"; //$NON-NLS-1$ - assertEquals("The class calling the trace API does not match the expected value.", correctClassName, traceEntry.getClassName()); //$NON-NLS-1$ - assertEquals("The method calling the trace API does not match the expected value.", correctMethodName, traceEntry.getMethodName()); //$NON-NLS-1$ + assertEquals("The class calling the trace API does not match the expected value.", correctClassName, //$NON-NLS-1$ + traceEntry.getClassName()); + assertEquals("The method calling the trace API does not match the expected value.", correctMethodName, //$NON-NLS-1$ + traceEntry.getMethodName()); } /** - * Test that a new {@link FrameworkDebugTraceEntry} object created with a trace class - * of 'org.eclipse.osgi.tests.debugoptions.DebugOptionsTestCase' has the correct class name and - * method name of the caller. + * Test that a new {@link FrameworkDebugTraceEntry} object created with a trace + * class of 'org.eclipse.osgi.tests.debugoptions.DebugOptionsTestCase' has the + * correct class name and method name of the caller. * - * This test mimics the tracing framework to ensure that the correct class name and method name - * are returned and written to the trace file. + * This test mimics the tracing framework to ensure that the correct class name + * and method name are returned and written to the trace file. */ public void testTracingEntry02() { String correctClassName = Runner1.class.getName(); String correctMethodName = "run"; //$NON-NLS-1$ FrameworkDebugTraceEntry traceEntry = new Runner1().run(); - assertEquals("The class calling the trace API does not match the expected value.", correctClassName, traceEntry.getClassName()); //$NON-NLS-1$ - assertEquals("The method calling the trace API does not match the expected value.", correctMethodName, traceEntry.getMethodName()); //$NON-NLS-1$ + assertEquals("The class calling the trace API does not match the expected value.", correctClassName, //$NON-NLS-1$ + traceEntry.getClassName()); + assertEquals("The method calling the trace API does not match the expected value.", correctMethodName, //$NON-NLS-1$ + traceEntry.getMethodName()); } static class Runner1 { @@ -176,7 +183,8 @@ public void testDyanmicEnablement03() { TestDebugOptionsListener anotherListener = new TestDebugOptionsListener(); Dictionary anotherProps = new Hashtable(); anotherProps.put(DebugOptions.LISTENER_SYMBOLICNAME, "anotherListener"); //$NON-NLS-1$ - ServiceRegistration anotherReg = OSGiTestsActivator.getContext().registerService(DebugOptionsListener.class.getName(), anotherListener, anotherProps); + ServiceRegistration anotherReg = OSGiTestsActivator.getContext() + .registerService(DebugOptionsListener.class.getName(), anotherListener, anotherProps); assertTrue("Not called", anotherListener.gotCalled()); //$NON-NLS-1$ debugOptions.setDebugEnabled(true); @@ -257,7 +265,8 @@ public void testBatchSetOptionsWhenEnabled() { // create the new set of options debugOptions.setOptions(newOptions); // make sure the listener got called - assertTrue("Listener did not get called when setting batch options when tracing is enabled", listener.gotCalled()); //$NON-NLS-1$ + assertTrue("Listener did not get called when setting batch options when tracing is enabled", //$NON-NLS-1$ + listener.gotCalled()); // get all of the options Map/* */ currentOptions = debugOptions.getOptions(); // make sure the Map object returned is not the same Map object that was set @@ -266,11 +275,14 @@ public void testBatchSetOptionsWhenEnabled() { assertEquals("The amount of options retrieved is not correct", newOptions.size(), currentOptions.size()); // make sure the values are correct String actualValue = (String) currentOptions.get(key1); - assertEquals("The original option for key1 does not match the retrieved option when tracing is enabled", "ok1", actualValue); + assertEquals("The original option for key1 does not match the retrieved option when tracing is enabled", "ok1", + actualValue); actualValue = (String) currentOptions.get(key2); - assertEquals("The original option for key1 does not match the retrieved option when tracing is enabled", "ok2", actualValue); + assertEquals("The original option for key1 does not match the retrieved option when tracing is enabled", "ok2", + actualValue); actualValue = (String) currentOptions.get(key3); - assertEquals("The original option for key1 does not match the retrieved option when tracing is enabled", "ok3", actualValue); + assertEquals("The original option for key1 does not match the retrieved option when tracing is enabled", "ok3", + actualValue); // add a new batch of options String key4 = getName() + "/debug/disableCheck4"; String key5 = getName() + "/debug/disableCheck5"; @@ -283,7 +295,8 @@ public void testBatchSetOptionsWhenEnabled() { // create the new set of options debugOptions.setOptions(newOptions2); // make sure the listener got called - assertTrue("Listener did not get called when setting batch options when tracing is enabled", listener.gotCalled()); //$NON-NLS-1$ + assertTrue("Listener did not get called when setting batch options when tracing is enabled", //$NON-NLS-1$ + listener.gotCalled()); // make sure the Map object returned is not the same Map object that was set Map currentOptions2 = debugOptions.getOptions(); assertNotSame("The Map object set is the exact same Map object returned", newOptions, currentOptions2); @@ -298,11 +311,14 @@ public void testBatchSetOptionsWhenEnabled() { assertNull("The original option for key3 is in the returned options (it should not be there)", actualValue); // make sure the new values are correct actualValue = (String) currentOptions2.get(key4); - assertEquals("The new option for key4 does not match the retrieved option when tracing is enabled", "ok4", actualValue); + assertEquals("The new option for key4 does not match the retrieved option when tracing is enabled", "ok4", + actualValue); actualValue = (String) currentOptions2.get(key5); - assertEquals("The new option for key5 does not match the retrieved option when tracing is enabled", "ok5", actualValue); + assertEquals("The new option for key5 does not match the retrieved option when tracing is enabled", "ok5", + actualValue); actualValue = (String) currentOptions2.get(key6); - assertEquals("The new option for key6 does not match the retrieved option when tracing is enabled", "ok6", actualValue); + assertEquals("The new option for key6 does not match the retrieved option when tracing is enabled", "ok6", + actualValue); } public void testSetNullOptions() { @@ -350,27 +366,34 @@ public void testBatchSetOptionsWhenDisabled() { // create the new set of options debugOptions.setOptions(newOptions); // make sure the listener got called - assertTrue("Listener did not get called when setting batch options when tracing is enabled", listener.gotCalled()); //$NON-NLS-1$ + assertTrue("Listener did not get called when setting batch options when tracing is enabled", //$NON-NLS-1$ + listener.gotCalled()); // disable tracing debugOptions.setDebugEnabled(false); - // get all of the options (should be the disabled option set - which should contain only the recently set options) + // get all of the options (should be the disabled option set - which should + // contain only the recently set options) Map currentOptions = debugOptions.getOptions(); // make sure the Map returned is not the same Map object that was set - assertNotSame("The Map object retrieved is the exact same Map object returned when tracing is disabled.", newOptions, currentOptions); + assertNotSame("The Map object retrieved is the exact same Map object returned when tracing is disabled.", + newOptions, currentOptions); // make sure the size is correct (it should be the same as the original Map) - assertEquals("The amount of options retrieved is not the same after tracing is disabled", newOptions.size(), currentOptions.size()); + assertEquals("The amount of options retrieved is not the same after tracing is disabled", newOptions.size(), + currentOptions.size()); // make sure the values are correct - check key1 String actualValue = (String) currentOptions.get(key1); assertNotNull("The value for key1 is null", actualValue); - assertEquals("The original option for key1 does not match the retrieved option when tracing is disabled", "ok1", actualValue); + assertEquals("The original option for key1 does not match the retrieved option when tracing is disabled", "ok1", + actualValue); // check key2 actualValue = (String) currentOptions.get(key2); assertNotNull("The value for key2 is null", actualValue); - assertEquals("The original option for key2 does not match the retrieved option when tracing is disabled", "ok2", actualValue); + assertEquals("The original option for key2 does not match the retrieved option when tracing is disabled", "ok2", + actualValue); // check key3 actualValue = (String) currentOptions.get(key3); assertNotNull("The value for key3 is null", actualValue); - assertEquals("The original option for key3 does not match the retrieved option when tracing is disabled", "ok3", actualValue); + assertEquals("The original option for key3 does not match the retrieved option when tracing is disabled", "ok3", + actualValue); // add a new batch of options when tracing is disabled String key4 = getName() + "/debug/disableCheck4"; String key5 = getName() + "/debug/disableCheck5"; @@ -398,12 +421,16 @@ public void testBatchSetOptionsWhenDisabled() { assertNull("The original option for key3 is in the returned options (it should not be there)", actualValue); // make sure the new values are correct actualValue = (String) currentOptions2.get(key4); - assertEquals("The new option for key4 does not match the retrieved option when tracing is disabled", "ok4", actualValue); + assertEquals("The new option for key4 does not match the retrieved option when tracing is disabled", "ok4", + actualValue); actualValue = (String) currentOptions2.get(key5); - assertEquals("The new option for key5 does not match the retrieved option when tracing is disabled", "ok5", actualValue); + assertEquals("The new option for key5 does not match the retrieved option when tracing is disabled", "ok5", + actualValue); actualValue = (String) currentOptions2.get(key6); - assertEquals("The new option for key6 does not match the retrieved option when tracing is disabled", "ok6", actualValue); - // testing of options when tracing is re-enabled is done in testSetOptionsWhenDisabled so it is not needed here + assertEquals("The new option for key6 does not match the retrieved option when tracing is disabled", "ok6", + actualValue); + // testing of options when tracing is re-enabled is done in + // testSetOptionsWhenDisabled so it is not needed here } public void testSetOptionsWhenDisabled() { @@ -424,11 +451,13 @@ public void testSetOptionsWhenDisabled() { // check for the value actualValue = debugOptions.getOption(testKey, "not ok"); assertEquals("The 'default' value supplied was not returned when tracing is disabled.", "not ok", actualValue); - // try setting the value to "ok" (this should be a no-op and return the 'default' value) + // try setting the value to "ok" (this should be a no-op and return the + // 'default' value) debugOptions.setOption(testKey, "ok"); actualValue = debugOptions.getOption(testKey, "not ok"); assertEquals("The 'default' value supplied was not returned when tracing is disabled.", "not ok", actualValue); - // remove the option and check for the value (it should still exist after re-enabling tracing) + // remove the option and check for the value (it should still exist after + // re-enabling tracing) debugOptions.removeOption(testKey); // re-enable tracing debugOptions.setDebugEnabled(true); @@ -448,11 +477,14 @@ public void testStringValues() { debugOptions.setOption(testKey, "test"); // check to make sure the value returned is correct String actualValue = debugOptions.getOption(testKey, "default"); - assertEquals("The correct option value was not returned from the debug option: " + testKey, "test", actualValue); - // remove the option and check for the value (it should not exist so the default value should be returned) + assertEquals("The correct option value was not returned from the debug option: " + testKey, "test", + actualValue); + // remove the option and check for the value (it should not exist so the default + // value should be returned) debugOptions.removeOption(testKey); actualValue = debugOptions.getOption(testKey, "default"); - assertEquals("The 'default' value supplied was not returned when the key does not exist in the DebugOptions.", "default", actualValue); + assertEquals("The 'default' value supplied was not returned when the key does not exist in the DebugOptions.", + "default", actualValue); } public void testIntegerValues() { @@ -470,11 +502,14 @@ public void testIntegerValues() { // set the value of this key so that a NumberFormatException will occur debugOptions.setOption(testKey, "test"); actualValue = debugOptions.getIntegerOption(testKey, 0); - assertEquals("The 'default' value supplied was not returned when a NumberFormatException occurs.", 0, actualValue); - // remove the option and check for the value (it should not exist so the default value should be returned) + assertEquals("The 'default' value supplied was not returned when a NumberFormatException occurs.", 0, + actualValue); + // remove the option and check for the value (it should not exist so the default + // value should be returned) debugOptions.removeOption(testKey); actualValue = debugOptions.getIntegerOption(testKey, 0); - assertEquals("The 'default' value supplied was not returned when the key does not exist in the DebugOptions.", 0, actualValue); + assertEquals("The 'default' value supplied was not returned when the key does not exist in the DebugOptions.", + 0, actualValue); } public void testBooleanValues() { @@ -515,7 +550,8 @@ private TestDebugTrace createDebugTrace(final File traceFile) { */ public void testVerboseDebugging() { - // TODO: Convert this back to {@link DebugOptions} once is/setVerbose becomes API + // TODO: Convert this back to {@link DebugOptions} once is/setVerbose becomes + // API FrameworkDebugOptions fwDebugOptions = (FrameworkDebugOptions) debugOptions; if (!debugOptions.isDebugEnabled()) { debugOptions.setDebugEnabled(true); @@ -534,16 +570,18 @@ public void testVerboseDebugging() { debugTrace.trace("/debug", "testing 3"); //$NON-NLS-1$ //$NON-NLS-2$ debugTrace.traceEntry("/debug"); //$NON-NLS-1$ //$NON-NLS-2$ debugTrace.traceEntry("/debug", "arg"); //$NON-NLS-1$ //$NON-NLS-2$ - debugTrace.traceEntry("/debug", new String[] {"arg1", "arg2"}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + debugTrace.traceEntry("/debug", new String[] { "arg1", "arg2" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ debugTrace.traceExit("/debug"); //$NON-NLS-1$ debugTrace.traceExit("/debug", "returnValue"); //$NON-NLS-1$ //$NON-NLS-2$ traceOutput = readTraceFile(traceFile); // Note: this call will also delete the trace file } catch (InvalidTraceEntry invalidEx) { - fail("Failed 'DebugTrace.trace(option, message)' test as an invalid trace entry was found. Actual Value: '" + invalidEx.getActualValue() + "'.", invalidEx); //$NON-NLS-1$ //$NON-NLS-2$ + fail("Failed 'DebugTrace.trace(option, message)' test as an invalid trace entry was found. Actual Value: '" //$NON-NLS-1$ + + invalidEx.getActualValue() + "'.", invalidEx); //$NON-NLS-1$ } // make sure all 3 entries exist assertEquals("Wrong number of trace entries", 8, traceOutput.length); //$NON-NLS-1$ - // validate the trace("/debug", "testing 1", new Exception(exceptionMessage1)) call when verbose tracing is disabled + // validate the trace("/debug", "testing 1", new Exception(exceptionMessage1)) + // call when verbose tracing is disabled assertEquals("Thread name is incorrect", Thread.currentThread().getName(), traceOutput[0].getThreadName()); //$NON-NLS-1$ assertNull("A bundle was found when it should be null", traceOutput[0].getBundleSymbolicName()); //$NON-NLS-1$ assertNull("A class name was found when it should be null", traceOutput[0].getClassName()); //$NON-NLS-1$ @@ -554,9 +592,11 @@ public void testVerboseDebugging() { expectedThrowableText1.append(exceptionMessage1); expectedThrowableText1.append(DebugOptionsTestCase.LINE_SEPARATOR); expectedThrowableText1.append(DebugOptionsTestCase.TAB_CHARACTER); - expectedThrowableText1.append("at org.eclipse.osgi.tests.debugoptions.DebugOptionsTestCase.testVerboseDebugging(DebugOptionsTestCase.java:"); //$NON-NLS-1$ + expectedThrowableText1.append( + "at org.eclipse.osgi.tests.debugoptions.DebugOptionsTestCase.testVerboseDebugging(DebugOptionsTestCase.java:"); //$NON-NLS-1$ if (!traceOutput[0].getThrowableText().startsWith(expectedThrowableText1.toString())) { - final StringBuilder errorMessage = new StringBuilder("The expected throwable text does not start with the actual throwable text."); //$NON-NLS-1$ + final StringBuilder errorMessage = new StringBuilder( + "The expected throwable text does not start with the actual throwable text."); //$NON-NLS-1$ errorMessage.append(DebugOptionsTestCase.LINE_SEPARATOR); errorMessage.append(DebugOptionsTestCase.LINE_SEPARATOR); errorMessage.append("Expected"); //$NON-NLS-1$ @@ -573,11 +613,13 @@ public void testVerboseDebugging() { errorMessage.append(traceOutput[0].getThrowableText()); fail(errorMessage.toString()); } - // validate the trace("/debug", "testing 2") call when verbose tracing is re-enabled + // validate the trace("/debug", "testing 2") call when verbose tracing is + // re-enabled assertEquals("Thread name is incorrect", Thread.currentThread().getName(), traceOutput[1].getThreadName()); //$NON-NLS-1$ assertEquals("Bundle name is incorrect", getName(), traceOutput[1].getBundleSymbolicName()); //$NON-NLS-1$ assertEquals("option-path value is incorrect", "/debug", traceOutput[1].getOptionPath()); //$NON-NLS-1$//$NON-NLS-2$ - assertEquals("class name value is incorrect", DebugOptionsTestCase.class.getName(), traceOutput[1].getClassName()); //$NON-NLS-1$ + assertEquals("class name value is incorrect", DebugOptionsTestCase.class.getName(), //$NON-NLS-1$ + traceOutput[1].getClassName()); assertEquals("method name value is incorrect", "testVerboseDebugging", traceOutput[1].getMethodName()); //$NON-NLS-1$ //$NON-NLS-2$ assertEquals("trace message is incorrect", "testing 2", traceOutput[1].getMessage()); //$NON-NLS-1$ //$NON-NLS-2$ assertNull("The throwable text was found when it should be null", traceOutput[1].getThrowableText()); @@ -590,15 +632,26 @@ public void testVerboseDebugging() { assertEquals("trace message is incorrect", "testing 3", traceOutput[2].getMessage()); //$NON-NLS-1$ //$NON-NLS-2$ assertNull("The throwable text was found when it should be null", traceOutput[2].getThrowableText()); // validate the traceEntry("/debug") call when verbose is disabled - assertEquals("trace message is incorrect", "Entering method org.eclipse.osgi.tests.debugoptions.DebugOptionsTestCase#testVerboseDebugging with no parameters", traceOutput[3].getMessage()); //$NON-NLS-1$ //$NON-NLS-2$ + assertEquals("trace message is incorrect", //$NON-NLS-1$ + "Entering method org.eclipse.osgi.tests.debugoptions.DebugOptionsTestCase#testVerboseDebugging with no parameters", //$NON-NLS-1$ + traceOutput[3].getMessage()); // validate the traceEntry("/debug", "arg") call when verbose is disabled - assertEquals("trace message is incorrect", "Entering method org.eclipse.osgi.tests.debugoptions.DebugOptionsTestCase#testVerboseDebugging with parameters: (arg)", traceOutput[4].getMessage()); //$NON-NLS-1$ //$NON-NLS-2$ - // validate the traceEntry("/debug", new String[] {"arg1", "arg2"}) call when verbose is disabled - assertEquals("trace message is incorrect", "Entering method org.eclipse.osgi.tests.debugoptions.DebugOptionsTestCase#testVerboseDebugging with parameters: (arg1 arg2)", traceOutput[5].getMessage()); //$NON-NLS-1$ //$NON-NLS-2$ + assertEquals("trace message is incorrect", //$NON-NLS-1$ + "Entering method org.eclipse.osgi.tests.debugoptions.DebugOptionsTestCase#testVerboseDebugging with parameters: (arg)", //$NON-NLS-1$ + traceOutput[4].getMessage()); + // validate the traceEntry("/debug", new String[] {"arg1", "arg2"}) call when + // verbose is disabled + assertEquals("trace message is incorrect", //$NON-NLS-1$ + "Entering method org.eclipse.osgi.tests.debugoptions.DebugOptionsTestCase#testVerboseDebugging with parameters: (arg1 arg2)", //$NON-NLS-1$ + traceOutput[5].getMessage()); // validate the traceExit("/debug") call when verbose is disabled - assertEquals("trace message is incorrect", "Exiting method org.eclipse.osgi.tests.debugoptions.DebugOptionsTestCase#testVerboseDebugging with a void return", traceOutput[6].getMessage()); //$NON-NLS-1$ //$NON-NLS-2$ + assertEquals("trace message is incorrect", //$NON-NLS-1$ + "Exiting method org.eclipse.osgi.tests.debugoptions.DebugOptionsTestCase#testVerboseDebugging with a void return", //$NON-NLS-1$ + traceOutput[6].getMessage()); // validate the traceExit("/debug", "returnValue") call when verbose is disabled - assertEquals("trace message is incorrect", "Exiting method org.eclipse.osgi.tests.debugoptions.DebugOptionsTestCase#testVerboseDebugging with result: returnValue", traceOutput[7].getMessage()); //$NON-NLS-1$ //$NON-NLS-2$ + assertEquals("trace message is incorrect", //$NON-NLS-1$ + "Exiting method org.eclipse.osgi.tests.debugoptions.DebugOptionsTestCase#testVerboseDebugging with result: returnValue", //$NON-NLS-1$ + traceOutput[7].getMessage()); // make sure the file is deleted traceFile.delete(); // reset verbose debugging to the default (true) @@ -607,7 +660,7 @@ public void testVerboseDebugging() { /** * test DebugTrace.trace(option, message); - */ + */ public void testTraceFile01() { final File traceFile = OSGiTestsActivator.getContext().getDataFile(getName() + ".trace"); //$NON-NLS-1$ @@ -619,13 +672,15 @@ public void testTraceFile01() { debugTrace.trace("/debug", "testing 3"); //$NON-NLS-1$ //$NON-NLS-2$ traceOutput = readTraceFile(traceFile); // Note: this call will also delete the trace file } catch (InvalidTraceEntry invalidEx) { - fail("Failed 'DebugTrace.trace(option, message)' test as an invalid trace entry was found. Actual Value: '" + invalidEx.getActualValue() + "'.", invalidEx); //$NON-NLS-1$ //$NON-NLS-2$ + fail("Failed 'DebugTrace.trace(option, message)' test as an invalid trace entry was found. Actual Value: '" //$NON-NLS-1$ + + invalidEx.getActualValue() + "'.", invalidEx); //$NON-NLS-1$ } assertEquals("Wrong number of trace entries", 2, traceOutput.length); //$NON-NLS-1$ assertEquals("Thread name is incorrect", Thread.currentThread().getName(), traceOutput[0].getThreadName()); //$NON-NLS-1$ assertEquals("Bundle name is incorrect", getName(), traceOutput[0].getBundleSymbolicName()); //$NON-NLS-1$ assertEquals("option-path value is incorrect", "/debug", traceOutput[0].getOptionPath()); //$NON-NLS-1$//$NON-NLS-2$ - assertEquals("class name value is incorrect", DebugOptionsTestCase.class.getName(), traceOutput[0].getClassName()); //$NON-NLS-1$ + assertEquals("class name value is incorrect", DebugOptionsTestCase.class.getName(), //$NON-NLS-1$ + traceOutput[0].getClassName()); assertEquals("method name value is incorrect", "testTraceFile01", traceOutput[0].getMethodName()); //$NON-NLS-1$ //$NON-NLS-2$ assertEquals("trace message is incorrect", "testing 1", traceOutput[0].getMessage()); //$NON-NLS-1$ //$NON-NLS-2$ assertNull("throwable should be null", traceOutput[0].getThrowableText()); //$NON-NLS-1$ @@ -633,7 +688,8 @@ public void testTraceFile01() { assertEquals("Thread name is incorrect", Thread.currentThread().getName(), traceOutput[1].getThreadName()); //$NON-NLS-1$ assertEquals("Bundle name is incorrect", getName(), traceOutput[1].getBundleSymbolicName()); //$NON-NLS-1$ assertEquals("option-path value is incorrect", "/debug", traceOutput[1].getOptionPath()); //$NON-NLS-1$//$NON-NLS-2$ - assertEquals("class name value is incorrect", DebugOptionsTestCase.class.getName(), traceOutput[1].getClassName()); //$NON-NLS-1$ + assertEquals("class name value is incorrect", DebugOptionsTestCase.class.getName(), //$NON-NLS-1$ + traceOutput[1].getClassName()); assertEquals("method name value is incorrect", "testTraceFile01", traceOutput[1].getMethodName()); //$NON-NLS-1$ //$NON-NLS-2$ assertEquals("trace message is incorrect", "testing 3", traceOutput[1].getMessage()); //$NON-NLS-1$ //$NON-NLS-2$ assertNull("throwable should be null", traceOutput[1].getThrowableText()); //$NON-NLS-1$ @@ -658,25 +714,29 @@ public void testTraceFile02() { debugTrace.trace("/debug", "testing 3", new Exception(exceptionMessage3)); //$NON-NLS-1$ //$NON-NLS-2$ traceOutput = readTraceFile(traceFile); // Note: this call will also delete the trace file } catch (InvalidTraceEntry invalidEx) { - fail("Failed 'DebugTrace.trace(option, message, Throwable)' test as an invalid trace entry was found. Actual Value: '" + invalidEx.getActualValue() + "'.", invalidEx); //$NON-NLS-1$ //$NON-NLS-2$ + fail("Failed 'DebugTrace.trace(option, message, Throwable)' test as an invalid trace entry was found. Actual Value: '" //$NON-NLS-1$ + + invalidEx.getActualValue() + "'.", invalidEx); //$NON-NLS-1$ } final StringBuilder expectedThrowableText1 = new StringBuilder("java.lang.Exception: "); //$NON-NLS-1$ expectedThrowableText1.append(exceptionMessage1); expectedThrowableText1.append(DebugOptionsTestCase.LINE_SEPARATOR); expectedThrowableText1.append(DebugOptionsTestCase.TAB_CHARACTER); - expectedThrowableText1.append("at org.eclipse.osgi.tests.debugoptions.DebugOptionsTestCase.testTraceFile02(DebugOptionsTestCase.java:"); //$NON-NLS-1$ + expectedThrowableText1.append( + "at org.eclipse.osgi.tests.debugoptions.DebugOptionsTestCase.testTraceFile02(DebugOptionsTestCase.java:"); //$NON-NLS-1$ assertEquals("Wrong number of trace entries", 2, traceOutput.length); //$NON-NLS-1$ assertEquals("Thread name is incorrect", Thread.currentThread().getName(), traceOutput[0].getThreadName()); //$NON-NLS-1$ assertEquals("Bundle name is incorrect", getName(), traceOutput[0].getBundleSymbolicName()); //$NON-NLS-1$ assertEquals("option-path value is incorrect", "/debug", traceOutput[0].getOptionPath()); //$NON-NLS-1$//$NON-NLS-2$ - assertEquals("class name value is incorrect", DebugOptionsTestCase.class.getName(), traceOutput[0].getClassName()); //$NON-NLS-1$ + assertEquals("class name value is incorrect", DebugOptionsTestCase.class.getName(), //$NON-NLS-1$ + traceOutput[0].getClassName()); assertEquals("method name value is incorrect", "testTraceFile02", traceOutput[0].getMethodName()); //$NON-NLS-1$ //$NON-NLS-2$ assertEquals("trace message is incorrect", "testing 1", traceOutput[0].getMessage()); //$NON-NLS-1$ //$NON-NLS-2$ assertNotNull("throwable text should not be null", traceOutput[0].getThrowableText()); //$NON-NLS-1$ if (!traceOutput[0].getThrowableText().startsWith(expectedThrowableText1.toString())) { - final StringBuilder errorMessage = new StringBuilder("The expected throwable text does not start with the actual throwable text."); //$NON-NLS-1$ + final StringBuilder errorMessage = new StringBuilder( + "The expected throwable text does not start with the actual throwable text."); //$NON-NLS-1$ errorMessage.append(DebugOptionsTestCase.LINE_SEPARATOR); errorMessage.append(DebugOptionsTestCase.LINE_SEPARATOR); errorMessage.append("Expected"); //$NON-NLS-1$ @@ -700,17 +760,20 @@ public void testTraceFile02() { expectedThrowableText2.append(exceptionMessage3); expectedThrowableText2.append(DebugOptionsTestCase.LINE_SEPARATOR); expectedThrowableText2.append(DebugOptionsTestCase.TAB_CHARACTER); - expectedThrowableText2.append("at org.eclipse.osgi.tests.debugoptions.DebugOptionsTestCase.testTraceFile02(DebugOptionsTestCase.java:"); //$NON-NLS-1$ + expectedThrowableText2.append( + "at org.eclipse.osgi.tests.debugoptions.DebugOptionsTestCase.testTraceFile02(DebugOptionsTestCase.java:"); //$NON-NLS-1$ assertEquals("Thread name is incorrect", Thread.currentThread().getName(), traceOutput[1].getThreadName()); //$NON-NLS-1$ assertEquals("Bundle name is incorrect", getName(), traceOutput[1].getBundleSymbolicName()); //$NON-NLS-1$ assertEquals("option-path value is incorrect", "/debug", traceOutput[1].getOptionPath()); //$NON-NLS-1$//$NON-NLS-2$ - assertEquals("class name value is incorrect", DebugOptionsTestCase.class.getName(), traceOutput[1].getClassName()); //$NON-NLS-1$ + assertEquals("class name value is incorrect", DebugOptionsTestCase.class.getName(), //$NON-NLS-1$ + traceOutput[1].getClassName()); assertEquals("method name value is incorrect", "testTraceFile02", traceOutput[1].getMethodName()); //$NON-NLS-1$ //$NON-NLS-2$ assertEquals("trace message is incorrect", "testing 3", traceOutput[1].getMessage()); //$NON-NLS-1$ //$NON-NLS-2$ assertNotNull("throwable text should not be null", traceOutput[1].getThrowableText()); //$NON-NLS-1$ if (!traceOutput[1].getThrowableText().startsWith(expectedThrowableText2.toString())) { - final StringBuilder errorMessage = new StringBuilder("The expected throwable text does not start with the actual throwable text."); //$NON-NLS-1$ + final StringBuilder errorMessage = new StringBuilder( + "The expected throwable text does not start with the actual throwable text."); //$NON-NLS-1$ errorMessage.append(DebugOptionsTestCase.LINE_SEPARATOR); errorMessage.append(DebugOptionsTestCase.LINE_SEPARATOR); errorMessage.append("Expected"); //$NON-NLS-1$ @@ -734,7 +797,7 @@ public void testTraceFile02() { /** * test DebugTrace.traceDumpStack(option) - */ + */ public void testTraceFile03() { final File traceFile = OSGiTestsActivator.getContext().getDataFile(getName() + ".trace"); //$NON-NLS-1$ @@ -746,13 +809,15 @@ public void testTraceFile03() { debugTrace.traceDumpStack("/debug"); //$NON-NLS-1$ traceOutput = readTraceFile(traceFile); // Note: this call will also delete the trace file } catch (InvalidTraceEntry invalidEx) { - fail("Failed 'DebugTrace.traceDumpStack(option)' test as an invalid trace entry was found. Actual Value: '" + invalidEx.getActualValue() + "'.", invalidEx); //$NON-NLS-1$ //$NON-NLS-2$ + fail("Failed 'DebugTrace.traceDumpStack(option)' test as an invalid trace entry was found. Actual Value: '" //$NON-NLS-1$ + + invalidEx.getActualValue() + "'.", invalidEx); //$NON-NLS-1$ } assertEquals("Wrong number of trace entries", 2, traceOutput.length); //$NON-NLS-1$ assertEquals("Thread name is incorrect", Thread.currentThread().getName(), traceOutput[0].getThreadName()); //$NON-NLS-1$ assertEquals("Bundle name is incorrect", getName(), traceOutput[0].getBundleSymbolicName()); //$NON-NLS-1$ assertEquals("option-path value is incorrect", "/debug", traceOutput[0].getOptionPath()); //$NON-NLS-1$//$NON-NLS-2$ - assertEquals("class name value is incorrect", DebugOptionsTestCase.class.getName(), traceOutput[0].getClassName()); //$NON-NLS-1$ + assertEquals("class name value is incorrect", DebugOptionsTestCase.class.getName(), //$NON-NLS-1$ + traceOutput[0].getClassName()); assertEquals("method name value is incorrect", "testTraceFile03", traceOutput[0].getMethodName()); //$NON-NLS-1$ //$NON-NLS-2$ assertTrue("Trace message is not a stack dump", traceOutput[0].getMessage().startsWith("Thread Stack dump: ")); //$NON-NLS-1$ //$NON-NLS-2$ assertNull("throwable should be null", traceOutput[0].getThrowableText()); //$NON-NLS-1$ @@ -760,7 +825,8 @@ public void testTraceFile03() { assertEquals("Thread name is incorrect", Thread.currentThread().getName(), traceOutput[1].getThreadName()); //$NON-NLS-1$ assertEquals("Bundle name is incorrect", getName(), traceOutput[1].getBundleSymbolicName()); //$NON-NLS-1$ assertEquals("option-path value is incorrect", "/debug", traceOutput[1].getOptionPath()); //$NON-NLS-1$//$NON-NLS-2$ - assertEquals("class name value is incorrect", DebugOptionsTestCase.class.getName(), traceOutput[1].getClassName()); //$NON-NLS-1$ + assertEquals("class name value is incorrect", DebugOptionsTestCase.class.getName(), //$NON-NLS-1$ + traceOutput[1].getClassName()); assertEquals("method name value is incorrect", "testTraceFile03", traceOutput[1].getMethodName()); //$NON-NLS-1$ //$NON-NLS-2$ assertTrue("Trace message is not a stack dump", traceOutput[1].getMessage().startsWith("Thread Stack dump: ")); //$NON-NLS-1$ //$NON-NLS-2$ assertNull("throwable should be null", traceOutput[1].getThrowableText()); //$NON-NLS-1$ @@ -770,7 +836,7 @@ public void testTraceFile03() { /** * test DebugTrace.traceEntry(option) - */ + */ public void testTraceFile04() { final File traceFile = OSGiTestsActivator.getContext().getDataFile(getName() + ".trace"); //$NON-NLS-1$ @@ -782,13 +848,15 @@ public void testTraceFile04() { debugTrace.traceEntry("/debug"); //$NON-NLS-1$ traceOutput = readTraceFile(traceFile); // Note: this call will also delete the trace file } catch (InvalidTraceEntry invalidEx) { - fail("Failed 'DebugTrace.traceEntry(option)' test as an invalid trace entry was found. Actual Value: '" + invalidEx.getActualValue() + "'.", invalidEx); //$NON-NLS-1$ //$NON-NLS-2$ + fail("Failed 'DebugTrace.traceEntry(option)' test as an invalid trace entry was found. Actual Value: '" //$NON-NLS-1$ + + invalidEx.getActualValue() + "'.", invalidEx); //$NON-NLS-1$ } assertEquals("Wrong number of trace entries", 2, traceOutput.length); //$NON-NLS-1$ assertEquals("Thread name is incorrect", Thread.currentThread().getName(), traceOutput[0].getThreadName()); //$NON-NLS-1$ assertEquals("Bundle name is incorrect", getName(), traceOutput[0].getBundleSymbolicName()); //$NON-NLS-1$ assertEquals("option-path value is incorrect", "/debug", traceOutput[0].getOptionPath()); //$NON-NLS-1$//$NON-NLS-2$ - assertEquals("class name value is incorrect", DebugOptionsTestCase.class.getName(), traceOutput[0].getClassName()); //$NON-NLS-1$ + assertEquals("class name value is incorrect", DebugOptionsTestCase.class.getName(), //$NON-NLS-1$ + traceOutput[0].getClassName()); assertEquals("method name value is incorrect", "testTraceFile04", traceOutput[0].getMethodName()); //$NON-NLS-1$ //$NON-NLS-2$ assertEquals("Trace message is not correct", "Entering method with no parameters", traceOutput[0].getMessage()); //$NON-NLS-1$ //$NON-NLS-2$ assertNull("throwable should be null", traceOutput[0].getThrowableText()); //$NON-NLS-1$ @@ -796,7 +864,8 @@ public void testTraceFile04() { assertEquals("Thread name is incorrect", Thread.currentThread().getName(), traceOutput[1].getThreadName()); //$NON-NLS-1$ assertEquals("Bundle name is incorrect", getName(), traceOutput[1].getBundleSymbolicName()); //$NON-NLS-1$ assertEquals("option-path value is incorrect", "/debug", traceOutput[1].getOptionPath()); //$NON-NLS-1$//$NON-NLS-2$ - assertEquals("class name value is incorrect", DebugOptionsTestCase.class.getName(), traceOutput[1].getClassName()); //$NON-NLS-1$ + assertEquals("class name value is incorrect", DebugOptionsTestCase.class.getName(), //$NON-NLS-1$ + traceOutput[1].getClassName()); assertEquals("method name value is incorrect", "testTraceFile04", traceOutput[1].getMethodName()); //$NON-NLS-1$ //$NON-NLS-2$ assertEquals("Trace message is not correct", "Entering method with no parameters", traceOutput[1].getMessage()); //$NON-NLS-1$ //$NON-NLS-2$ assertNull("throwable should be null", traceOutput[1].getThrowableText()); //$NON-NLS-1$ @@ -818,23 +887,28 @@ public void testTraceFile05() { debugTrace.traceEntry("/debug", new String("arg3")); //$NON-NLS-1$ //$NON-NLS-2$ traceOutput = readTraceFile(traceFile); // Note: this call will also delete the trace file } catch (InvalidTraceEntry invalidEx) { - fail("Failed 'DebugTrace.traceEntry(option, methodArgument)' test as an invalid trace entry was found. Actual Value: '" + invalidEx.getActualValue() + "'.", invalidEx); //$NON-NLS-1$ //$NON-NLS-2$ + fail("Failed 'DebugTrace.traceEntry(option, methodArgument)' test as an invalid trace entry was found. Actual Value: '" //$NON-NLS-1$ + + invalidEx.getActualValue() + "'.", invalidEx); //$NON-NLS-1$ } assertEquals("Wrong number of trace entries", 2, traceOutput.length); //$NON-NLS-1$ assertEquals("Thread name is incorrect", Thread.currentThread().getName(), traceOutput[0].getThreadName()); //$NON-NLS-1$ assertEquals("Bundle name is incorrect", getName(), traceOutput[0].getBundleSymbolicName()); //$NON-NLS-1$ assertEquals("option-path value is incorrect", "/debug", traceOutput[0].getOptionPath()); //$NON-NLS-1$//$NON-NLS-2$ - assertEquals("class name value is incorrect", DebugOptionsTestCase.class.getName(), traceOutput[0].getClassName()); //$NON-NLS-1$ + assertEquals("class name value is incorrect", DebugOptionsTestCase.class.getName(), //$NON-NLS-1$ + traceOutput[0].getClassName()); assertEquals("method name value is incorrect", "testTraceFile05", traceOutput[0].getMethodName()); //$NON-NLS-1$ //$NON-NLS-2$ - assertEquals("Trace message is not correct", "Entering method with parameters: (arg1)", traceOutput[0].getMessage()); //$NON-NLS-1$ //$NON-NLS-2$ + assertEquals("Trace message is not correct", "Entering method with parameters: (arg1)", //$NON-NLS-1$ //$NON-NLS-2$ + traceOutput[0].getMessage()); assertNull("throwable should be null", traceOutput[0].getThrowableText()); //$NON-NLS-1$ assertEquals("Wrong number of trace entries for trace without an exception", 2, traceOutput.length); //$NON-NLS-1$ assertEquals("Thread name is incorrect", Thread.currentThread().getName(), traceOutput[1].getThreadName()); //$NON-NLS-1$ assertEquals("Bundle name is incorrect", getName(), traceOutput[1].getBundleSymbolicName()); //$NON-NLS-1$ assertEquals("option-path value is incorrect", "/debug", traceOutput[1].getOptionPath()); //$NON-NLS-1$//$NON-NLS-2$ - assertEquals("class name value is incorrect", DebugOptionsTestCase.class.getName(), traceOutput[1].getClassName()); //$NON-NLS-1$ + assertEquals("class name value is incorrect", DebugOptionsTestCase.class.getName(), //$NON-NLS-1$ + traceOutput[1].getClassName()); assertEquals("method name value is incorrect", "testTraceFile05", traceOutput[1].getMethodName()); //$NON-NLS-1$ //$NON-NLS-2$ - assertEquals("Trace message is not correct", "Entering method with parameters: (arg3)", traceOutput[1].getMessage()); //$NON-NLS-1$ //$NON-NLS-2$ + assertEquals("Trace message is not correct", "Entering method with parameters: (arg3)", //$NON-NLS-1$ //$NON-NLS-2$ + traceOutput[1].getMessage()); assertNull("throwable should be null", traceOutput[1].getThrowableText()); //$NON-NLS-1$ // delete the trace file traceFile.delete(); @@ -849,28 +923,33 @@ public void testTraceFile06() { TestDebugTrace debugTrace = this.createDebugTrace(traceFile); TraceEntry[] traceOutput = null; try { - debugTrace.traceEntry("/debug", new String[] {"arg1", "arg2"}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - debugTrace.traceEntry("/notset", new String[] {"arg3", "arg4"}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - debugTrace.traceEntry("/debug", new String[] {"arg5", "arg6"}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + debugTrace.traceEntry("/debug", new String[] { "arg1", "arg2" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + debugTrace.traceEntry("/notset", new String[] { "arg3", "arg4" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + debugTrace.traceEntry("/debug", new String[] { "arg5", "arg6" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ traceOutput = readTraceFile(traceFile); // Note: this call will also delete the trace file } catch (InvalidTraceEntry invalidEx) { - fail("Failed 'DebugTrace.traceEntry(option, methodArgument[])' test as an invalid trace entry was found. Actual Value: '" + invalidEx.getActualValue() + "'.", invalidEx); //$NON-NLS-1$ //$NON-NLS-2$ + fail("Failed 'DebugTrace.traceEntry(option, methodArgument[])' test as an invalid trace entry was found. Actual Value: '" //$NON-NLS-1$ + + invalidEx.getActualValue() + "'.", invalidEx); //$NON-NLS-1$ } assertEquals("Wrong number of trace entries", 2, traceOutput.length); //$NON-NLS-1$ assertEquals("Thread name is incorrect", Thread.currentThread().getName(), traceOutput[0].getThreadName()); //$NON-NLS-1$ assertEquals("Bundle name is incorrect", getName(), traceOutput[0].getBundleSymbolicName()); //$NON-NLS-1$ assertEquals("option-path value is incorrect", "/debug", traceOutput[0].getOptionPath()); //$NON-NLS-1$//$NON-NLS-2$ - assertEquals("class name value is incorrect", DebugOptionsTestCase.class.getName(), traceOutput[0].getClassName()); //$NON-NLS-1$ + assertEquals("class name value is incorrect", DebugOptionsTestCase.class.getName(), //$NON-NLS-1$ + traceOutput[0].getClassName()); assertEquals("method name value is incorrect", "testTraceFile06", traceOutput[0].getMethodName()); //$NON-NLS-1$ //$NON-NLS-2$ - assertEquals("Trace message is not correct", "Entering method with parameters: (arg1 arg2)", traceOutput[0].getMessage()); //$NON-NLS-1$ //$NON-NLS-2$ + assertEquals("Trace message is not correct", "Entering method with parameters: (arg1 arg2)", //$NON-NLS-1$ //$NON-NLS-2$ + traceOutput[0].getMessage()); assertNull("throwable should be null", traceOutput[0].getThrowableText()); //$NON-NLS-1$ assertEquals("Wrong number of trace entries for trace without an exception", 2, traceOutput.length); //$NON-NLS-1$ assertEquals("Thread name is incorrect", Thread.currentThread().getName(), traceOutput[1].getThreadName()); //$NON-NLS-1$ assertEquals("Bundle name is incorrect", getName(), traceOutput[1].getBundleSymbolicName()); //$NON-NLS-1$ assertEquals("option-path value is incorrect", "/debug", traceOutput[1].getOptionPath()); //$NON-NLS-1$//$NON-NLS-2$ - assertEquals("class name value is incorrect", DebugOptionsTestCase.class.getName(), traceOutput[1].getClassName()); //$NON-NLS-1$ + assertEquals("class name value is incorrect", DebugOptionsTestCase.class.getName(), //$NON-NLS-1$ + traceOutput[1].getClassName()); assertEquals("method name value is incorrect", "testTraceFile06", traceOutput[1].getMethodName()); //$NON-NLS-1$ //$NON-NLS-2$ - assertEquals("Trace message is not correct", "Entering method with parameters: (arg5 arg6)", traceOutput[1].getMessage()); //$NON-NLS-1$ //$NON-NLS-2$ + assertEquals("Trace message is not correct", "Entering method with parameters: (arg5 arg6)", //$NON-NLS-1$ //$NON-NLS-2$ + traceOutput[1].getMessage()); assertNull("throwable should be null", traceOutput[1].getThrowableText()); //$NON-NLS-1$ // delete the trace file traceFile.delete(); @@ -918,7 +997,7 @@ public void testEntryExitWithBracesInArgs() throws InvalidTraceEntry { /** * test DebugTrace.traceExit(option) - */ + */ public void testTraceFile07() { final File traceFile = OSGiTestsActivator.getContext().getDataFile(getName() + ".trace"); //$NON-NLS-1$ @@ -930,13 +1009,15 @@ public void testTraceFile07() { debugTrace.traceExit("/debug"); //$NON-NLS-1$ traceOutput = readTraceFile(traceFile); // Note: this call will also delete the trace file } catch (InvalidTraceEntry invalidEx) { - fail("Failed 'DebugTrace.traceExit(option)' test as an invalid trace entry was found. Actual Value: '" + invalidEx.getActualValue() + "'.", invalidEx); //$NON-NLS-1$ //$NON-NLS-2$ + fail("Failed 'DebugTrace.traceExit(option)' test as an invalid trace entry was found. Actual Value: '" //$NON-NLS-1$ + + invalidEx.getActualValue() + "'.", invalidEx); //$NON-NLS-1$ } assertEquals("Wrong number of trace entries", 2, traceOutput.length); //$NON-NLS-1$ assertEquals("Thread name is incorrect", Thread.currentThread().getName(), traceOutput[0].getThreadName()); //$NON-NLS-1$ assertEquals("Bundle name is incorrect", getName(), traceOutput[0].getBundleSymbolicName()); //$NON-NLS-1$ assertEquals("option-path value is incorrect", "/debug", traceOutput[0].getOptionPath()); //$NON-NLS-1$//$NON-NLS-2$ - assertEquals("class name value is incorrect", DebugOptionsTestCase.class.getName(), traceOutput[0].getClassName()); //$NON-NLS-1$ + assertEquals("class name value is incorrect", DebugOptionsTestCase.class.getName(), //$NON-NLS-1$ + traceOutput[0].getClassName()); assertEquals("method name value is incorrect", "testTraceFile07", traceOutput[0].getMethodName()); //$NON-NLS-1$ //$NON-NLS-2$ assertEquals("Trace message is not correct", "Exiting method with a void return", traceOutput[0].getMessage()); //$NON-NLS-1$ //$NON-NLS-2$ assertNull("throwable should be null", traceOutput[0].getThrowableText()); //$NON-NLS-1$ @@ -944,7 +1025,8 @@ public void testTraceFile07() { assertEquals("Thread name is incorrect", Thread.currentThread().getName(), traceOutput[1].getThreadName()); //$NON-NLS-1$ assertEquals("Bundle name is incorrect", getName(), traceOutput[1].getBundleSymbolicName()); //$NON-NLS-1$ assertEquals("option-path value is incorrect", "/debug", traceOutput[1].getOptionPath()); //$NON-NLS-1$//$NON-NLS-2$ - assertEquals("class name value is incorrect", DebugOptionsTestCase.class.getName(), traceOutput[1].getClassName()); //$NON-NLS-1$ + assertEquals("class name value is incorrect", DebugOptionsTestCase.class.getName(), //$NON-NLS-1$ + traceOutput[1].getClassName()); assertEquals("method name value is incorrect", "testTraceFile07", traceOutput[1].getMethodName()); //$NON-NLS-1$ //$NON-NLS-2$ assertEquals("Trace message is not correct", "Exiting method with a void return", traceOutput[1].getMessage()); //$NON-NLS-1$ //$NON-NLS-2$ assertNull("throwable should be null", traceOutput[1].getThrowableText()); //$NON-NLS-1$ @@ -954,7 +1036,7 @@ public void testTraceFile07() { /** * test DebugTrace.traceExit(option, result) - */ + */ public void testTraceFile08() { final File traceFile = OSGiTestsActivator.getContext().getDataFile(getName() + ".trace"); //$NON-NLS-1$ @@ -966,31 +1048,37 @@ public void testTraceFile08() { debugTrace.traceExit("/debug", new String("returnValue3")); //$NON-NLS-1$ //$NON-NLS-2$ traceOutput = readTraceFile(traceFile); // Note: this call will also delete the trace file } catch (InvalidTraceEntry invalidEx) { - fail("Failed 'DebugTrace.traceExit(option, result)' test as an invalid trace entry was found. Actual Value: '" + invalidEx.getActualValue() + "'.", invalidEx); //$NON-NLS-1$ //$NON-NLS-2$ + fail("Failed 'DebugTrace.traceExit(option, result)' test as an invalid trace entry was found. Actual Value: '" //$NON-NLS-1$ + + invalidEx.getActualValue() + "'.", invalidEx); //$NON-NLS-1$ } assertEquals("Wrong number of trace entries", 2, traceOutput.length); //$NON-NLS-1$ assertEquals("Thread name is incorrect", Thread.currentThread().getName(), traceOutput[0].getThreadName()); //$NON-NLS-1$ assertEquals("Bundle name is incorrect", getName(), traceOutput[0].getBundleSymbolicName()); //$NON-NLS-1$ assertEquals("option-path value is incorrect", "/debug", traceOutput[0].getOptionPath()); //$NON-NLS-1$//$NON-NLS-2$ - assertEquals("class name value is incorrect", DebugOptionsTestCase.class.getName(), traceOutput[0].getClassName()); //$NON-NLS-1$ + assertEquals("class name value is incorrect", DebugOptionsTestCase.class.getName(), //$NON-NLS-1$ + traceOutput[0].getClassName()); assertEquals("method name value is incorrect", "testTraceFile08", traceOutput[0].getMethodName()); //$NON-NLS-1$ //$NON-NLS-2$ - assertEquals("Trace message is not correct", "Exiting method with result: returnValue1", traceOutput[0].getMessage()); //$NON-NLS-1$ //$NON-NLS-2$ + assertEquals("Trace message is not correct", "Exiting method with result: returnValue1", //$NON-NLS-1$ //$NON-NLS-2$ + traceOutput[0].getMessage()); assertNull("throwable should be null", traceOutput[0].getThrowableText()); //$NON-NLS-1$ assertEquals("Wrong number of trace entries for trace without an exception", 2, traceOutput.length); //$NON-NLS-1$ assertEquals("Thread name is incorrect", Thread.currentThread().getName(), traceOutput[1].getThreadName()); //$NON-NLS-1$ assertEquals("Bundle name is incorrect", getName(), traceOutput[1].getBundleSymbolicName()); //$NON-NLS-1$ assertEquals("option-path value is incorrect", "/debug", traceOutput[1].getOptionPath()); //$NON-NLS-1$//$NON-NLS-2$ - assertEquals("class name value is incorrect", DebugOptionsTestCase.class.getName(), traceOutput[1].getClassName()); //$NON-NLS-1$ + assertEquals("class name value is incorrect", DebugOptionsTestCase.class.getName(), //$NON-NLS-1$ + traceOutput[1].getClassName()); assertEquals("method name value is incorrect", "testTraceFile08", traceOutput[1].getMethodName()); //$NON-NLS-1$ //$NON-NLS-2$ - assertEquals("Trace message is not correct", "Exiting method with result: returnValue3", traceOutput[1].getMessage()); //$NON-NLS-1$ //$NON-NLS-2$ + assertEquals("Trace message is not correct", "Exiting method with result: returnValue3", //$NON-NLS-1$ //$NON-NLS-2$ + traceOutput[1].getMessage()); assertNull("throwable should be null", traceOutput[1].getThrowableText()); //$NON-NLS-1$ // delete the trace file traceFile.delete(); } /** - * tests DebugTrace.trace(option, message) where the 'option' and 'message contain a '|' character (the delimiter). - */ + * tests DebugTrace.trace(option, message) where the 'option' and 'message + * contain a '|' character (the delimiter). + */ public void testTraceFile09() { final File traceFile = OSGiTestsActivator.getContext().getDataFile(getName() + ".trace"); //$NON-NLS-1$ @@ -1002,7 +1090,8 @@ public void testTraceFile09() { debugTrace.trace("/debug|path", "|A message with | multiple || characters.|"); traceOutput = readTraceFile(traceFile); // Note: this call will also delete the trace file } catch (InvalidTraceEntry invalidEx) { - fail("Failed 'DebugTrace.trace(option, message)' test as an invalid trace entry was found. Actual Value: '" + invalidEx.getActualValue() + "'.", invalidEx); //$NON-NLS-1$ //$NON-NLS-2$ + fail("Failed 'DebugTrace.trace(option, message)' test as an invalid trace entry was found. Actual Value: '" //$NON-NLS-1$ + + invalidEx.getActualValue() + "'.", invalidEx); //$NON-NLS-1$ } assertEquals("Wrong number of entries", 2, traceOutput.length); String optionPath = decodeString(traceOutput[0].getOptionPath()); @@ -1046,7 +1135,8 @@ public void close() throws IOException { try { traceOutput = readTraceFile(traceFile); } catch (InvalidTraceEntry e) { - fail("Failed 'DebugTrace.trace(option, message)' test as an invalid trace entry was found. Actual Value: '" + e.getActualValue() + "'.", e); //$NON-NLS-1$ //$NON-NLS-2$ + fail("Failed 'DebugTrace.trace(option, message)' test as an invalid trace entry was found. Actual Value: '" //$NON-NLS-1$ + + e.getActualValue() + "'.", e); //$NON-NLS-1$ } assertEquals("Wrong number of entries", 2, traceOutput.length); String optionPath = decodeString(traceOutput[0].getOptionPath()); @@ -1067,7 +1157,8 @@ private static String decodeString(final String inputString) { final StringBuilder tempBuffer = new StringBuilder(inputString); int currentIndex = tempBuffer.indexOf(TRACE_ELEMENT_DELIMITER_ENCODED); while (currentIndex >= 0) { - tempBuffer.replace(currentIndex, currentIndex + TRACE_ELEMENT_DELIMITER_ENCODED.length(), TRACE_ELEMENT_DELIMITER); + tempBuffer.replace(currentIndex, currentIndex + TRACE_ELEMENT_DELIMITER_ENCODED.length(), + TRACE_ELEMENT_DELIMITER); currentIndex = tempBuffer.indexOf(TRACE_ELEMENT_DELIMITER_ENCODED); } return tempBuffer.toString(); @@ -1079,7 +1170,8 @@ private TraceEntry[] readTraceFile(File traceFile) throws InvalidTraceEntry { List traceEntries = new ArrayList(); this.verboseDebug = true; // default is true try { - traceReader = new BufferedReader(new InputStreamReader(new FileInputStream(traceFile), StandardCharsets.UTF_8)); + traceReader = new BufferedReader( + new InputStreamReader(new FileInputStream(traceFile), StandardCharsets.UTF_8)); TraceEntry entry = null; while ((entry = this.readMessage(traceReader)) != null) { traceEntries.add(entry); @@ -1141,7 +1233,8 @@ private TraceEntry readMessage(final BufferedReader traceReader) throws IOExcept // third entry - bundle symbolic name symbolicName = this.readEntry(traceReader); if ((symbolicName == null) || (symbolicName.length() == 0)) { - throw new InvalidTraceEntry("The bundle symbolic name in a trace entry is null or empty", symbolicName); //$NON-NLS-1$ + throw new InvalidTraceEntry("The bundle symbolic name in a trace entry is null or empty", //$NON-NLS-1$ + symbolicName); } // fourth entry - option path optionPath = this.readEntry(traceReader); @@ -1161,13 +1254,15 @@ private TraceEntry readMessage(final BufferedReader traceReader) throws IOExcept // seventh entry - line number final String lineNumberString = this.readEntry(traceReader); if ((lineNumberString == null) || (lineNumberString.length() == 0)) { - throw new InvalidTraceEntry("The line number in a trace entry is null or empty", lineNumberString); //$NON-NLS-1$ + throw new InvalidTraceEntry("The line number in a trace entry is null or empty", //$NON-NLS-1$ + lineNumberString); } lineNumber = Integer.valueOf(lineNumberString).intValue(); } - // eighth entry - message (valid if verbose debugging is off) + // eighth entry - message (valid if verbose debugging is off) final String message = this.readEntry(traceReader); - // read in the next character. if it is \r or \n then the throwable was not supplied (valid if verbose debugging is off) + // read in the next character. if it is \r or \n then the throwable was not + // supplied (valid if verbose debugging is off) traceReader.mark(1); inputChar = (char) traceReader.read(); String throwable = null; @@ -1180,7 +1275,8 @@ private TraceEntry readMessage(final BufferedReader traceReader) throws IOExcept } } // create the entry - result = new TraceEntry(threadName, timestamp, symbolicName, optionPath, className, methodName, lineNumber, message, throwable); + result = new TraceEntry(threadName, timestamp, symbolicName, optionPath, className, methodName, + lineNumber, message, throwable); break; // no point in reading any more information since the TraceEntry is created } // read the next character @@ -1203,7 +1299,10 @@ private String readEntry(final Reader traceReader) throws IOException { } static public class TraceEntry { - /** If a bundles symbolic name is not specified then the default value of /debug can be used */ + /** + * If a bundles symbolic name is not specified then the default value of /debug + * can be used + */ public final static String DEFAULT_OPTION_PATH = "/debug"; //$NON-NLS-1$ /** @@ -1252,7 +1351,9 @@ static public class TraceEntry { */ private final String throwableText; - public TraceEntry(final String traceThreadName, final long traceTimestamp, final String traceBundleName, final String traceOptionPath, final String traceClassName, final String traceMethodName, final int traceLineNumber, final String traceMessage) { + public TraceEntry(final String traceThreadName, final long traceTimestamp, final String traceBundleName, + final String traceOptionPath, final String traceClassName, final String traceMethodName, + final int traceLineNumber, final String traceMessage) { this.threadName = traceThreadName; this.bundleSymbolicName = traceBundleName; @@ -1265,7 +1366,9 @@ public TraceEntry(final String traceThreadName, final long traceTimestamp, final this.throwableText = null; } - public TraceEntry(final String traceThreadName, final long traceTimestamp, final String traceBundleName, final String traceOptionPath, final String traceClassName, final String traceMethodName, final int traceLineNumber, final String traceMessage, final String traceThrowable) { + public TraceEntry(final String traceThreadName, final long traceTimestamp, final String traceBundleName, + final String traceOptionPath, final String traceClassName, final String traceMethodName, + final int traceLineNumber, final String traceMessage, final String traceThrowable) { this.threadName = traceThreadName; this.bundleSymbolicName = traceBundleName; diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/filter/FilterTests.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/filter/FilterTests.java index 3d2e139dd10..a6d6de93d9b 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/filter/FilterTests.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/filter/FilterTests.java @@ -62,7 +62,6 @@ public static Collection allFilterFactories() { @Parameter(1) public FilterFactory filterFactory; - static final int ISTRUE = 1; static final int ISFALSE = 2; static final int ISILLEGAL = 3; diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/hooks/framework/AbstractFrameworkHookTests.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/hooks/framework/AbstractFrameworkHookTests.java index 8dd11843cd6..2090ff7608f 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/hooks/framework/AbstractFrameworkHookTests.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/hooks/framework/AbstractFrameworkHookTests.java @@ -74,7 +74,8 @@ protected synchronized Class loadClass(String name, boolean resolve) throws C throw new RuntimeException(e); } } - if (name.startsWith("org.eclipse") || name.startsWith("org.osgi.framework.FrameworkUtil") || name.equals(FrameworkUtilHelper.class.getName())) { + if (name.startsWith("org.eclipse") || name.startsWith("org.osgi.framework.FrameworkUtil") + || name.equals(FrameworkUtilHelper.class.getName())) { Class result = findLoadedClass(name); if (result == null) result = findClass(name); @@ -107,7 +108,8 @@ protected void assertBundleNotDiscarded(String location, Framework framework) { } protected Framework createFramework(Map configuration) throws Exception { - FrameworkFactory factory = (FrameworkFactory) classLoader.loadClass(EquinoxFactory.class.getName()).newInstance(); + FrameworkFactory factory = (FrameworkFactory) classLoader.loadClass(EquinoxFactory.class.getName()) + .newInstance(); Framework framework = factory.newFramework(configuration); return framework; } @@ -142,9 +144,9 @@ private void setUpClassLoader() throws Exception { String osgiFramework = context.getProperty(EclipseStarter.PROP_FRAMEWORK); URL[] urls; if ("folder".equals(context.getProperty(EclipseStarter.PROP_FRAMEWORK_SHAPE))) - urls = new URL[] {new URL(osgiFramework), new URL(osgiFramework + "bin/")}; + urls = new URL[] { new URL(osgiFramework), new URL(osgiFramework + "bin/") }; else - urls = new URL[] {new URL(osgiFramework)}; + urls = new URL[] { new URL(osgiFramework) }; classLoader = new BasicURLClassLoader(urls, getClass().getClassLoader(), testURL); } } diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/hooks/framework/ActivatorOrderTest.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/hooks/framework/ActivatorOrderTest.java index 6d33025bb24..5daa4f29b83 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/hooks/framework/ActivatorOrderTest.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/hooks/framework/ActivatorOrderTest.java @@ -43,7 +43,8 @@ protected void setUp() throws Exception { File file = OSGiTestsActivator.getContext().getDataFile(getName()); HashMap configuration = new HashMap<>(); configuration.put(Constants.FRAMEWORK_STORAGE, file.getAbsolutePath()); - configuration.put(HookRegistry.PROP_HOOK_CONFIGURATORS, HOOK_CONFIGURATOR_CLASS1 + "," + HOOK_CONFIGURATOR_CLASS2 + "," + HOOK_CONFIGURATOR_CLASS3); + configuration.put(HookRegistry.PROP_HOOK_CONFIGURATORS, + HOOK_CONFIGURATOR_CLASS1 + "," + HOOK_CONFIGURATOR_CLASS2 + "," + HOOK_CONFIGURATOR_CLASS3); framework = createFramework(configuration); } @@ -57,7 +58,8 @@ public void testActivatorOrder() throws Exception { Class clazz3 = classLoader.loadClass(HOOK_CONFIGURATOR_CLASS3); clazz3.getField("events").set(null, actualEvents); - List expectedEvents = Arrays.asList("HOOK1 STARTED", "HOOK2 STARTED", "HOOK3 STARTED", "HOOK3 STOPPED", "HOOK2 STOPPED", "HOOK1 STOPPED"); + List expectedEvents = Arrays.asList("HOOK1 STARTED", "HOOK2 STARTED", "HOOK3 STARTED", "HOOK3 STOPPED", + "HOOK2 STOPPED", "HOOK1 STOPPED"); initAndStart(framework); stop(framework); diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/hooks/framework/ClassLoaderHookTests.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/hooks/framework/ClassLoaderHookTests.java index 1f5ec20f299..b0cca3f8b17 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/hooks/framework/ClassLoaderHookTests.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/hooks/framework/ClassLoaderHookTests.java @@ -119,14 +119,15 @@ public void testRejectTransformationFromWeavingHook() throws Exception { setRejectTransformation(true); initAndStartFramework(); framework.getBundleContext().registerService(WeavingHook.class, wovenClass -> { - wovenClass.setBytes(new byte[] {'b', 'a', 'd', 'b', 'y', 't', 'e', 's'}); + wovenClass.setBytes(new byte[] { 'b', 'a', 'd', 'b', 'y', 't', 'e', 's' }); wovenClass.getDynamicImports().add("badimport"); }, null); Bundle b = installBundle(); b.loadClass(TEST_CLASSNAME); // class load must succeed because the badbytes got rejected // make sure we don't have any dynamic imports added - assertEquals("Found some imports.", 0, b.adapt(BundleRevision.class).getWiring().getRequirements(PackageNamespace.PACKAGE_NAMESPACE).size()); + assertEquals("Found some imports.", 0, + b.adapt(BundleRevision.class).getWiring().getRequirements(PackageNamespace.PACKAGE_NAMESPACE).size()); // no don't reject setRejectTransformation(false); @@ -139,7 +140,8 @@ public void testRejectTransformationFromWeavingHook() throws Exception { } // class load must fail because the badbytes got used to define the class // make sure we have a dynamic imports added - assertEquals("Found some imports.", 1, b.adapt(BundleRevision.class).getWiring().getRequirements(PackageNamespace.PACKAGE_NAMESPACE).size()); + assertEquals("Found some imports.", 1, + b.adapt(BundleRevision.class).getWiring().getRequirements(PackageNamespace.PACKAGE_NAMESPACE).size()); } public void testRejectTransformationFromClassLoadingHook() throws Exception { diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/hooks/framework/ContextFinderTests.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/hooks/framework/ContextFinderTests.java index f2b8c73d896..9f8f58297fe 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/hooks/framework/ContextFinderTests.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/hooks/framework/ContextFinderTests.java @@ -50,7 +50,9 @@ protected void tearDown() throws Exception { public void testContextClassLoaderNullLocal() throws InvalidSyntaxException, IOException { BundleContext bc = framework.getBundleContext(); - ClassLoader contextFinder = bc.getService(bc.getServiceReferences(ClassLoader.class, "(equinox.classloader.type=contextClassLoader)").iterator().next()); + ClassLoader contextFinder = bc + .getService(bc.getServiceReferences(ClassLoader.class, "(equinox.classloader.type=contextClassLoader)") + .iterator().next()); Enumeration result = contextFinder.getResources("does/not/exist.txt"); assertNotNull("Null result.", result); assertFalse("Found unexpected result", result.hasMoreElements()); diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/hooks/framework/EmbeddedEquinoxWithURLInClassLoadTests.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/hooks/framework/EmbeddedEquinoxWithURLInClassLoadTests.java index 51ac468423e..e89cc9fc654 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/hooks/framework/EmbeddedEquinoxWithURLInClassLoadTests.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/hooks/framework/EmbeddedEquinoxWithURLInClassLoadTests.java @@ -56,9 +56,11 @@ public void testFrameworkClassLoaderWithNewURI() throws Exception { public void testEmbeddedURLHandler() throws Exception { initAndStart(framework); - Bundle testHandler = framework.getBundleContext().installBundle(bundleInstaller.getBundleLocation("test.protocol.handler")); + Bundle testHandler = framework.getBundleContext() + .installBundle(bundleInstaller.getBundleLocation("test.protocol.handler")); testHandler.start(); - Bundle testHandlerUser = framework.getBundleContext().installBundle(bundleInstaller.getBundleLocation("test.protocol.handler.user")); + Bundle testHandlerUser = framework.getBundleContext() + .installBundle(bundleInstaller.getBundleLocation("test.protocol.handler.user")); testHandlerUser.start(); try { URL testingURL = new URL("testing1://test"); diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/hooks/framework/StorageHookTests.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/hooks/framework/StorageHookTests.java index 4ff05b3e231..02ab0c18b1d 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/hooks/framework/StorageHookTests.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/hooks/framework/StorageHookTests.java @@ -58,8 +58,8 @@ public class StorageHookTests extends AbstractFrameworkHookTests { private String location; /* - * Bundles must be discarded if a storage hook throws an - * IllegalStateException during validation. + * Bundles must be discarded if a storage hook throws an IllegalStateException + * during validation. */ public void testBundleDiscardedWhenClasspathStorageHookInvalidates() throws Exception { initAndStartFramework(); @@ -83,8 +83,8 @@ public void testBundleNotDiscardedWhenClasspathStorageHookValidates() throws Exc } /* - * A storage hook with the wrong factory class should cause bundle - * installation to fail. + * A storage hook with the wrong factory class should cause bundle installation + * to fail. */ public void testWrongStorageHookFactoryClassOnBundleInstall() throws Exception { setFactoryClassInvalid(true); @@ -99,8 +99,8 @@ public void testWrongStorageHookFactoryClassOnBundleInstall() throws Exception { } /* - * A storage hook with the wrong factory class should cause bundle update - * to fail. + * A storage hook with the wrong factory class should cause bundle update to + * fail. */ public void testWrongStorageHookFactoryClassOnBundleUpdate() throws Exception { initAndStartFramework(); @@ -116,8 +116,8 @@ public void testWrongStorageHookFactoryClassOnBundleUpdate() throws Exception { } /* - * A storage hook with the wrong factory class should cause a framework - * restart with persisted bundles to fail. + * A storage hook with the wrong factory class should cause a framework restart + * with persisted bundles to fail. */ public void testWrongStorageHookFactoryClassOnFrameworkRestart() throws Exception { initAndStartFramework(); @@ -138,10 +138,12 @@ public void testCleanOnFailLoad() throws Exception { setFactoryHookFailLoad(true); restartFramework(); assertBundleDiscarded(); - // install a bundle without reference to test that the staging area is created correctly after clean + // install a bundle without reference to test that the staging area is created + // correctly after clean File bundlesBase = new File(OSGiTestsActivator.getContext().getDataFile(getName()), "bundles"); bundlesBase.mkdirs(); - framework.getBundleContext().installBundle(SystemBundleTests.createBundle(bundlesBase, getName(), false, false).toURI().toString()); + framework.getBundleContext() + .installBundle(SystemBundleTests.createBundle(bundlesBase, getName(), false, false).toURI().toString()); } public void testDeletingGenerationCalledOnDiscard() throws Exception { @@ -233,7 +235,8 @@ public void testAdaptModuleRevisionBuilder() throws Exception { b.uninstall(); installBundle(); b = framework.getBundleContext().getBundle(location); - BundleCapability bundleCap = b.adapt(BundleRevision.class).getDeclaredCapabilities(BundleNamespace.BUNDLE_NAMESPACE).iterator().next(); + BundleCapability bundleCap = b.adapt(BundleRevision.class) + .getDeclaredCapabilities(BundleNamespace.BUNDLE_NAMESPACE).iterator().next(); assertEquals("Wrong attribute value", "testAttribute", bundleCap.getAttributes().get("matching.attribute")); assertEquals("Wrong attribute value", "testDirective", bundleCap.getDirectives().get("matching.directive")); } @@ -243,16 +246,20 @@ public void testFrameworkUtilHelper() throws Exception { initAndStartFramework(); Class frameworkUtilClass = classLoader.loadClass("org.osgi.framework.FrameworkUtil"); Bundle b = (Bundle) frameworkUtilClass.getMethod("getBundle", Class.class).invoke(null, String.class); - assertEquals("Wrong bundle found.", framework.getBundleContext().getBundle(Constants.SYSTEM_BUNDLE_LOCATION), b); - PackageAdmin packageAdmin = framework.getBundleContext().getService(framework.getBundleContext().getServiceReference(PackageAdmin.class)); + assertEquals("Wrong bundle found.", framework.getBundleContext().getBundle(Constants.SYSTEM_BUNDLE_LOCATION), + b); + PackageAdmin packageAdmin = framework.getBundleContext() + .getService(framework.getBundleContext().getServiceReference(PackageAdmin.class)); b = packageAdmin.getBundle(String.class); - assertEquals("Wrong bundle found.", framework.getBundleContext().getBundle(Constants.SYSTEM_BUNDLE_LOCATION), b); + assertEquals("Wrong bundle found.", framework.getBundleContext().getBundle(Constants.SYSTEM_BUNDLE_LOCATION), + b); } public void testHandleContent() throws Exception { initAndStartFramework(); - // install with an empty stream, the hook will replace it will content to a real bundle + // install with an empty stream, the hook will replace it will content to a real + // bundle setFactoryClassHandleContent(true); Bundle b = framework.getBundleContext().installBundle("testBundle", new ByteArrayInputStream(new byte[0])); assertEquals("Wrong symbolicName", "testHandleContentConnection", b.getSymbolicName()); @@ -263,17 +270,20 @@ public void testHandleContent() throws Exception { assertEquals("Wrong symbolicName", "testHandleContentConnection", b.getSymbolicName()); b.uninstall(); - // tell the hook to no longer handle content, the default behavior of the framework will be used + // tell the hook to no longer handle content, the default behavior of the + // framework will be used setFactoryClassHandleContent(false); b = installBundle(); assertEquals("Wrong symbolicName", "test1", b.getSymbolicName()); - // tell the hook to handle content again, update will update to the content supplied from the hook + // tell the hook to handle content again, update will update to the content + // supplied from the hook setFactoryClassHandleContent(true); b.update(new ByteArrayInputStream(new byte[0])); assertEquals("Wrong symbolicName", "testHandleContentConnection", b.getSymbolicName()); - // tell the hook to no longer handle content, update will go back to using content derived from the original location + // tell the hook to no longer handle content, update will go back to using + // content derived from the original location setFactoryClassHandleContent(false); b.update(); assertEquals("Wrong symbolicName", "test1", b.getSymbolicName()); @@ -289,7 +299,8 @@ public void testNullStorageHook() throws Exception { initAndStartFramework(); File bundlesBase = new File(OSGiTestsActivator.getContext().getDataFile(getName()), "bundles"); bundlesBase.mkdirs(); - String initialBundleLoc = SystemBundleTests.createBundle(bundlesBase, getName(), false, false).toURI().toString(); + String initialBundleLoc = SystemBundleTests.createBundle(bundlesBase, getName(), false, false).toURI() + .toString(); Bundle initialBundle = framework.getBundleContext().installBundle(initialBundleLoc); assertNotNull("Expected to have an initial bundle.", initialBundle); @@ -299,7 +310,8 @@ public void testNullStorageHook() throws Exception { assertNotNull("Expected to have a bundle after install.", b); stop(framework); - // create new framework to make sure null storage hook works from persistence also. + // create new framework to make sure null storage hook works from persistence + // also. framework = createFramework(configuration); framework.init(); @@ -344,21 +356,25 @@ private void assertBundleNotDiscarded() { private void assertCreateStorageHookCalled() throws Exception { Class clazz = classLoader.loadClass(HOOK_CONFIGURATOR_CLASS); - assertTrue("Storage hook factory createStorageHook not called by framework", clazz.getField(HOOK_CONFIGURATOR_FIELD_CREATE_STORAGE_HOOK_CALLED).getBoolean(null)); + assertTrue("Storage hook factory createStorageHook not called by framework", + clazz.getField(HOOK_CONFIGURATOR_FIELD_CREATE_STORAGE_HOOK_CALLED).getBoolean(null)); } private void assertThrowable(Throwable t) { - assertTrue("Unexpected exception", t != null && (t instanceof IllegalStateException) && t.getMessage().startsWith("The factory class ")); + assertTrue("Unexpected exception", + t != null && (t instanceof IllegalStateException) && t.getMessage().startsWith("The factory class ")); } private void assertStorageHookValidateCalled() throws Exception { Class clazz = classLoader.loadClass(HOOK_CONFIGURATOR_CLASS); - assertTrue("Storage hook validate not called by framework", clazz.getField(HOOK_CONFIGURATOR_FIELD_VALIDATE_CALLED).getBoolean(null)); + assertTrue("Storage hook validate not called by framework", + clazz.getField(HOOK_CONFIGURATOR_FIELD_VALIDATE_CALLED).getBoolean(null)); } private void assertStorageHookDeletingGenerationCalled() throws Exception { Class clazz = classLoader.loadClass(HOOK_CONFIGURATOR_CLASS); - assertTrue("Storage hook deletingGeneration not called by framework", clazz.getField(HOOK_CONFIGURATOR_FIELD_DELETING_CALLED).getBoolean(null)); + assertTrue("Storage hook deletingGeneration not called by framework", + clazz.getField(HOOK_CONFIGURATOR_FIELD_DELETING_CALLED).getBoolean(null)); } private void initAndStartFramework() throws Exception { diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/internal/plugins/InstallTests.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/internal/plugins/InstallTests.java index 8fb4483b3ac..f8f726f0c75 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/internal/plugins/InstallTests.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/internal/plugins/InstallTests.java @@ -39,12 +39,15 @@ protected void setUp() throws Exception { } public void testInstallNoVersionManifest01() throws BundleException, IOException { - // Note that this test case has changed since the removing of plugin.xml conversion + // Note that this test case has changed since the removing of plugin.xml + // conversion // Before this tested that a plugin.xml with no version specified would fail. - // It is valid for a bundle to omit Bundle-Version header (and default to version 0.0.0 + // It is valid for a bundle to omit Bundle-Version header (and default to + // version 0.0.0 Bundle installed = null; try { - installed = BundleTestingHelper.installBundle(OSGiTestsActivator.getContext(), OSGiTestsActivator.TEST_FILES_ROOT + "internal/plugins/installTests/bundle03"); //$NON-NLS-1$ + installed = BundleTestingHelper.installBundle(OSGiTestsActivator.getContext(), + OSGiTestsActivator.TEST_FILES_ROOT + "internal/plugins/installTests/bundle03"); //$NON-NLS-1$ // success - should allow manifests with no version. } catch (BundleException be) { // should not have failed with BundleException @@ -62,7 +65,9 @@ public void testInstallNoVersionManifest01() throws BundleException, IOException public void testInstallInvalidManifest02() throws IOException, BundleException { Bundle installed = null; try { - installed = BundleTestingHelper.installBundle("testInstallInvalidManifest02", OSGiTestsActivator.getContext(), OSGiTestsActivator.TEST_FILES_ROOT + "internal/plugins/installTests/bundle11"); //$NON-NLS-1$ //$NON-NLS-2$ + installed = BundleTestingHelper.installBundle("testInstallInvalidManifest02", //$NON-NLS-1$ + OSGiTestsActivator.getContext(), + OSGiTestsActivator.TEST_FILES_ROOT + "internal/plugins/installTests/bundle11"); //$NON-NLS-1$ // should have failed with BundleException fail("Expected a failure with no Bundle-SymbolicName header"); //$NON-NLS-1$ } catch (BundleException be) { @@ -81,7 +86,9 @@ public void testInstallInvalidManifest02() throws IOException, BundleException { public void testInstallInvalidManifest03() throws IOException, BundleException { Bundle installed = null; try { - installed = BundleTestingHelper.installBundle("testInstallInvalidManifest03", OSGiTestsActivator.getContext(), OSGiTestsActivator.TEST_FILES_ROOT + "internal/plugins/installTests/bundle12"); //$NON-NLS-1$ //$NON-NLS-2$ + installed = BundleTestingHelper.installBundle("testInstallInvalidManifest03", //$NON-NLS-1$ + OSGiTestsActivator.getContext(), + OSGiTestsActivator.TEST_FILES_ROOT + "internal/plugins/installTests/bundle12"); //$NON-NLS-1$ // should have failed with BundleException fail("Expected a failure with duplicate directives"); //$NON-NLS-1$ } catch (BundleException be) { @@ -95,12 +102,15 @@ public void testInstallInvalidManifest03() throws IOException, BundleException { } /** - * Test invalid manifest; use attributes bundle-version and bundle-symbolic-name in Export-Package + * Test invalid manifest; use attributes bundle-version and bundle-symbolic-name + * in Export-Package */ public void testInstallInvalidManifest04() throws IOException, BundleException { Bundle installed = null; try { - installed = BundleTestingHelper.installBundle("testInstallInvalidManifest04", OSGiTestsActivator.getContext(), OSGiTestsActivator.TEST_FILES_ROOT + "internal/plugins/installTests/bundle13"); //$NON-NLS-1$ //$NON-NLS-2$ + installed = BundleTestingHelper.installBundle("testInstallInvalidManifest04", //$NON-NLS-1$ + OSGiTestsActivator.getContext(), + OSGiTestsActivator.TEST_FILES_ROOT + "internal/plugins/installTests/bundle13"); //$NON-NLS-1$ // should have failed with BundleException fail("Expected a failure with duplicate attributes"); //$NON-NLS-1$ } catch (BundleException be) { @@ -119,7 +129,9 @@ public void testInstallInvalidManifest04() throws IOException, BundleException { public void testInstallInvalidManifest05() throws IOException, BundleException { Bundle installed = null; try { - installed = BundleTestingHelper.installBundle("testInstallInvalidManifest05", OSGiTestsActivator.getContext(), OSGiTestsActivator.TEST_FILES_ROOT + "internal/plugins/installTests/bundle14"); //$NON-NLS-1$ //$NON-NLS-2$ + installed = BundleTestingHelper.installBundle("testInstallInvalidManifest05", //$NON-NLS-1$ + OSGiTestsActivator.getContext(), + OSGiTestsActivator.TEST_FILES_ROOT + "internal/plugins/installTests/bundle14"); //$NON-NLS-1$ // should have failed with BundleException fail("Expected a failure with duplicate imports"); //$NON-NLS-1$ } catch (BundleException be) { @@ -139,7 +151,8 @@ public void testStartError01() throws IOException, BundleException { Bundle installed = null; try { try { - installed = BundleTestingHelper.installBundle("testStartError01", OSGiTestsActivator.getContext(), OSGiTestsActivator.TEST_FILES_ROOT + "internal/plugins/installTests/bundle15"); //$NON-NLS-1$ //$NON-NLS-2$ + installed = BundleTestingHelper.installBundle("testStartError01", OSGiTestsActivator.getContext(), //$NON-NLS-1$ + OSGiTestsActivator.TEST_FILES_ROOT + "internal/plugins/installTests/bundle15"); //$NON-NLS-1$ // should be able to install } catch (BundleException be) { // failed to install unresolvable bundle @@ -169,8 +182,10 @@ public void testStartError02() throws IOException, BundleException { Bundle fragment = null; try { try { - host = BundleTestingHelper.installBundle("testStartError02_host", OSGiTestsActivator.getContext(), OSGiTestsActivator.TEST_FILES_ROOT + "internal/plugins/installTests/bundle16"); //$NON-NLS-1$ //$NON-NLS-2$ - fragment = BundleTestingHelper.installBundle("testStartError02_frag", OSGiTestsActivator.getContext(), OSGiTestsActivator.TEST_FILES_ROOT + "internal/plugins/installTests/bundle17"); //$NON-NLS-1$ //$NON-NLS-2$ + host = BundleTestingHelper.installBundle("testStartError02_host", OSGiTestsActivator.getContext(), //$NON-NLS-1$ + OSGiTestsActivator.TEST_FILES_ROOT + "internal/plugins/installTests/bundle16"); //$NON-NLS-1$ + fragment = BundleTestingHelper.installBundle("testStartError02_frag", OSGiTestsActivator.getContext(), //$NON-NLS-1$ + OSGiTestsActivator.TEST_FILES_ROOT + "internal/plugins/installTests/bundle17"); //$NON-NLS-1$ // should be able to install host } catch (BundleException be) { // failed to install unresolvable bundle @@ -205,7 +220,8 @@ public void testStartError02() throws IOException, BundleException { public void testUnsupportedOperation01() throws IOException, BundleException { Bundle installed = null; try { - installed = BundleTestingHelper.installBundle("testUnsupportedOperation01", OSGiTestsActivator.getContext(), OSGiTestsActivator.TEST_FILES_ROOT + "internal/plugins/installTests/bundle18"); //$NON-NLS-1$ //$NON-NLS-2$ + installed = BundleTestingHelper.installBundle("testUnsupportedOperation01", OSGiTestsActivator.getContext(), //$NON-NLS-1$ + OSGiTestsActivator.TEST_FILES_ROOT + "internal/plugins/installTests/bundle18"); //$NON-NLS-1$ // should have failed with BundleException fail("Expected an unsupported operation exception"); //$NON-NLS-1$ } catch (BundleException be) { @@ -220,7 +236,8 @@ public void testUnsupportedOperation01() throws IOException, BundleException { public void testInstallLocationWithSpaces() throws BundleException, IOException { Bundle installed = null; - installed = BundleTestingHelper.installBundle(OSGiTestsActivator.getContext(), OSGiTestsActivator.TEST_FILES_ROOT + "internal/plugins/installTests/bundle 01"); //$NON-NLS-1$ + installed = BundleTestingHelper.installBundle(OSGiTestsActivator.getContext(), + OSGiTestsActivator.TEST_FILES_ROOT + "internal/plugins/installTests/bundle 01"); //$NON-NLS-1$ try { assertEquals("1.0", "bundle01", installed.getSymbolicName()); //$NON-NLS-1$ //$NON-NLS-2$ assertEquals("1.1", Bundle.INSTALLED, installed.getState()); //$NON-NLS-1$ @@ -232,7 +249,8 @@ public void testInstallLocationWithSpaces() throws BundleException, IOException public void testInstallLocationWithUnderscores() throws BundleException, IOException { Bundle installed = null; - installed = BundleTestingHelper.installBundle(OSGiTestsActivator.getContext(), OSGiTestsActivator.TEST_FILES_ROOT + "internal/plugins/installTests/bundle02_1.0.0"); //$NON-NLS-1$ + installed = BundleTestingHelper.installBundle(OSGiTestsActivator.getContext(), + OSGiTestsActivator.TEST_FILES_ROOT + "internal/plugins/installTests/bundle02_1.0.0"); //$NON-NLS-1$ try { assertEquals("1.0", "bundle02", installed.getSymbolicName()); //$NON-NLS-1$ //$NON-NLS-2$ assertEquals("1.1", Bundle.INSTALLED, installed.getState()); //$NON-NLS-1$ @@ -246,14 +264,16 @@ public void testInstallLocationWithUnderscores() throws BundleException, IOExcep /** Ensures we see a bundle with only a extension point as a singleton */ public void testInstallBundleWithExtensionPointOnly() throws BundleException, IOException { Bundle installed = null; - installed = BundleTestingHelper.installBundle(OSGiTestsActivator.getContext(), OSGiTestsActivator.TEST_FILES_ROOT + "internal/plugins/installTests/bundle04"); //$NON-NLS-1$ + installed = BundleTestingHelper.installBundle(OSGiTestsActivator.getContext(), + OSGiTestsActivator.TEST_FILES_ROOT + "internal/plugins/installTests/bundle04"); //$NON-NLS-1$ try { assertEquals("1.0", "bundle04", installed.getSymbolicName()); //$NON-NLS-1$ //$NON-NLS-2$ assertEquals("1.1", Bundle.INSTALLED, installed.getState()); //$NON-NLS-1$ assertEquals("1.2", "1.3.7", installed.getHeaders().get(Constants.BUNDLE_VERSION)); //$NON-NLS-1$ //$NON-NLS-2$ String symbolicNameString = installed.getHeaders().get(Constants.BUNDLE_SYMBOLICNAME); assertNotNull("1.3", symbolicNameString); //$NON-NLS-1$ - ManifestElement[] symbolicNameHeader = ManifestElement.parseHeader(Constants.BUNDLE_SYMBOLICNAME, symbolicNameString); + ManifestElement[] symbolicNameHeader = ManifestElement.parseHeader(Constants.BUNDLE_SYMBOLICNAME, + symbolicNameString); assertEquals("1.4", 1, symbolicNameHeader.length); //$NON-NLS-1$ assertEquals("1.5", "true", symbolicNameHeader[0].getDirective(Constants.SINGLETON_DIRECTIVE)); //$NON-NLS-1$ //$NON-NLS-2$ @@ -266,14 +286,16 @@ public void testInstallBundleWithExtensionPointOnly() throws BundleException, IO /** Ensures we see a bundle with only a extension as a singleton */ public void testInstallBundleWithExtensionOnly() throws BundleException, IOException { Bundle installed = null; - installed = BundleTestingHelper.installBundle(OSGiTestsActivator.getContext(), OSGiTestsActivator.TEST_FILES_ROOT + "internal/plugins/installTests/bundle05"); //$NON-NLS-1$ + installed = BundleTestingHelper.installBundle(OSGiTestsActivator.getContext(), + OSGiTestsActivator.TEST_FILES_ROOT + "internal/plugins/installTests/bundle05"); //$NON-NLS-1$ try { assertEquals("1.0", "bundle05", installed.getSymbolicName()); //$NON-NLS-1$ //$NON-NLS-2$ assertEquals("1.1", Bundle.INSTALLED, installed.getState()); //$NON-NLS-1$ assertEquals("1.2", "1.3.8", installed.getHeaders().get(Constants.BUNDLE_VERSION)); //$NON-NLS-1$ //$NON-NLS-2$ String symbolicNameString = installed.getHeaders().get(Constants.BUNDLE_SYMBOLICNAME); assertNotNull("1.3", symbolicNameString); //$NON-NLS-1$ - ManifestElement[] symbolicNameHeader = ManifestElement.parseHeader(Constants.BUNDLE_SYMBOLICNAME, symbolicNameString); + ManifestElement[] symbolicNameHeader = ManifestElement.parseHeader(Constants.BUNDLE_SYMBOLICNAME, + symbolicNameString); assertEquals("1.4", 1, symbolicNameHeader.length); //$NON-NLS-1$ assertEquals("1.5", "true", symbolicNameHeader[0].getDirective(Constants.SINGLETON_DIRECTIVE)); //$NON-NLS-1$ //$NON-NLS-2$ @@ -283,17 +305,22 @@ public void testInstallBundleWithExtensionOnly() throws BundleException, IOExcep } } - /** Ensures we see a bundle with only extension and extension point as a singleton */ + /** + * Ensures we see a bundle with only extension and extension point as a + * singleton + */ public void testInstallBundleWithExtensionAndExtensionPoint() throws BundleException, IOException { Bundle installed = null; - installed = BundleTestingHelper.installBundle(OSGiTestsActivator.getContext(), OSGiTestsActivator.TEST_FILES_ROOT + "internal/plugins/installTests/bundle06"); //$NON-NLS-1$ + installed = BundleTestingHelper.installBundle(OSGiTestsActivator.getContext(), + OSGiTestsActivator.TEST_FILES_ROOT + "internal/plugins/installTests/bundle06"); //$NON-NLS-1$ try { assertEquals("1.0", "bundle06", installed.getSymbolicName()); //$NON-NLS-1$ //$NON-NLS-2$ assertEquals("1.1", Bundle.INSTALLED, installed.getState()); //$NON-NLS-1$ assertEquals("1.2", "1.3.9", installed.getHeaders().get(Constants.BUNDLE_VERSION)); //$NON-NLS-1$ //$NON-NLS-2$ String symbolicNameString = installed.getHeaders().get(Constants.BUNDLE_SYMBOLICNAME); assertNotNull("1.3", symbolicNameString); //$NON-NLS-1$ - ManifestElement[] symbolicNameHeader = ManifestElement.parseHeader(Constants.BUNDLE_SYMBOLICNAME, symbolicNameString); + ManifestElement[] symbolicNameHeader = ManifestElement.parseHeader(Constants.BUNDLE_SYMBOLICNAME, + symbolicNameString); assertEquals("1.4", 1, symbolicNameHeader.length); //$NON-NLS-1$ assertEquals("1.5", "true", symbolicNameHeader[0].getDirective(Constants.SINGLETON_DIRECTIVE)); //$NON-NLS-1$ //$NON-NLS-2$ @@ -305,11 +332,15 @@ public void testInstallBundleWithExtensionAndExtensionPoint() throws BundleExcep /** Ensures two versions of a non-singleton bundle are accepted */ public void testInstall2NonSingletonBundles() throws BundleException, IOException { - Bundle installed1 = org.eclipse.core.tests.harness.BundleTestingHelper.installBundle(OSGiTestsActivator.getContext(), OSGiTestsActivator.TEST_FILES_ROOT + "internal/plugins/installTests/bundle07"); //$NON-NLS-1$ - ServiceReference packageAdminSR = OSGiTestsActivator.getContext().getServiceReference(PackageAdmin.class.getName()); + Bundle installed1 = org.eclipse.core.tests.harness.BundleTestingHelper.installBundle( + OSGiTestsActivator.getContext(), + OSGiTestsActivator.TEST_FILES_ROOT + "internal/plugins/installTests/bundle07"); //$NON-NLS-1$ + ServiceReference packageAdminSR = OSGiTestsActivator.getContext() + .getServiceReference(PackageAdmin.class.getName()); PackageAdmin packageAdmin = (PackageAdmin) OSGiTestsActivator.getContext().getService(packageAdminSR); packageAdmin.resolveBundles(null); - Bundle installed2 = BundleTestingHelper.installBundle(OSGiTestsActivator.getContext(), OSGiTestsActivator.TEST_FILES_ROOT + "internal/plugins/installTests/bundle07b"); //$NON-NLS-1$ + Bundle installed2 = BundleTestingHelper.installBundle(OSGiTestsActivator.getContext(), + OSGiTestsActivator.TEST_FILES_ROOT + "internal/plugins/installTests/bundle07b"); //$NON-NLS-1$ packageAdmin.resolveBundles(null); OSGiTestsActivator.getContext().ungetService(packageAdminSR); try { @@ -328,11 +359,14 @@ public void testInstall2NonSingletonBundles() throws BundleException, IOExceptio /** Ensures two versions of a singleton bundle are accepted */ public void testInstall2SingletonBundles() throws BundleException, IOException { - Bundle installed1 = BundleTestingHelper.installBundle(OSGiTestsActivator.getContext(), OSGiTestsActivator.TEST_FILES_ROOT + "internal/plugins/installTests/bundle08"); //$NON-NLS-1$ - ServiceReference packageAdminSR = OSGiTestsActivator.getContext().getServiceReference(PackageAdmin.class.getName()); + Bundle installed1 = BundleTestingHelper.installBundle(OSGiTestsActivator.getContext(), + OSGiTestsActivator.TEST_FILES_ROOT + "internal/plugins/installTests/bundle08"); //$NON-NLS-1$ + ServiceReference packageAdminSR = OSGiTestsActivator.getContext() + .getServiceReference(PackageAdmin.class.getName()); PackageAdmin packageAdmin = (PackageAdmin) OSGiTestsActivator.getContext().getService(packageAdminSR); packageAdmin.resolveBundles(null); - Bundle installed2 = BundleTestingHelper.installBundle(OSGiTestsActivator.getContext(), OSGiTestsActivator.TEST_FILES_ROOT + "internal/plugins/installTests/bundle08b"); //$NON-NLS-1$ + Bundle installed2 = BundleTestingHelper.installBundle(OSGiTestsActivator.getContext(), + OSGiTestsActivator.TEST_FILES_ROOT + "internal/plugins/installTests/bundle08b"); //$NON-NLS-1$ packageAdmin.resolveBundles(null); OSGiTestsActivator.getContext().ungetService(packageAdminSR); try { diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/perf/BasePerformanceTest.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/perf/BasePerformanceTest.java index 12dea038190..bd80773fbc6 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/perf/BasePerformanceTest.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/perf/BasePerformanceTest.java @@ -47,7 +47,8 @@ protected State buildRandomState(int size) { for (int j = 0; j < exportPackages.length; j++) { String packageName = "package." + exportedPackages++; Version packageVersion = Version.parseVersion("1.0.0"); - exportPackages[j] = stateFactory.createExportPackageDescription(packageName, packageVersion, null, null, true, null); + exportPackages[j] = stateFactory.createExportPackageDescription(packageName, packageVersion, null, null, + true, null); } int importPackageCount = Math.min(exportPackageCount, random.nextInt(5)); int importedPackageIndex = random.nextInt(exportPackageCount + 1); @@ -57,7 +58,8 @@ protected State buildRandomState(int size) { if (importedPackageIndex > exportPackageCount) importedPackageIndex = 1; String packageName = "package." + index; - importPackages[j] = stateFactory.createImportPackageSpecification(packageName, new VersionRange("1.0.0"), null, null, null, null, null); + importPackages[j] = stateFactory.createImportPackageSpecification(packageName, + new VersionRange("1.0.0"), null, null, null, null, null); } BundleSpecification[] requiredBundles = new BundleSpecification[Math.min(i, random.nextInt(5))]; @@ -67,10 +69,13 @@ protected State buildRandomState(int size) { Version requiredVersion = bundles[requiredIndex].getVersion(); boolean export = random.nextInt(10) > 6; boolean optional = random.nextInt(10) > 8; - requiredBundles[j] = stateFactory.createBundleSpecification(requiredName, new VersionRange(requiredVersion.toString()), export, optional); + requiredBundles[j] = stateFactory.createBundleSpecification(requiredName, + new VersionRange(requiredVersion.toString()), export, optional); } - bundles[i] = stateFactory.createBundleDescription(bundleId, symbolicName, version, symbolicName, requiredBundles, (HostSpecification) null, importPackages, exportPackages, null, random.nextDouble() > 0.05); + bundles[i] = stateFactory.createBundleDescription(bundleId, symbolicName, version, symbolicName, + requiredBundles, (HostSpecification) null, importPackages, exportPackages, null, + random.nextDouble() > 0.05); state.addBundle(bundles[i]); } return state; diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/perf/StateUsesPerformanceTest.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/perf/StateUsesPerformanceTest.java index cf9f08c2e72..25db3776232 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/perf/StateUsesPerformanceTest.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/perf/StateUsesPerformanceTest.java @@ -25,7 +25,8 @@ public StateUsesPerformanceTest(String name) { super(name); } - private void doUsesResolution(int stateSize, int repetitions, String localName, String degradation) throws BundleException { + private void doUsesResolution(int stateSize, int repetitions, String localName, String degradation) + throws BundleException { final State originalState = buildRandomState(stateSize); addUsesBundles(originalState); PerformanceTestRunner runner = new PerformanceTestRunner() { @@ -61,35 +62,45 @@ private void addUsesBundles(State state) throws BundleException { manifest.put(Constants.BUNDLE_SYMBOLICNAME, "A"); manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); manifest.put(Constants.EXPORT_PACKAGE, "a"); - state.addBundle(state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), id++)); + state.addBundle(state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + id++)); manifest = new Hashtable(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); manifest.put(Constants.BUNDLE_SYMBOLICNAME, "A"); manifest.put(Constants.BUNDLE_VERSION, "2.0.0"); manifest.put(Constants.EXPORT_PACKAGE, "a"); - state.addBundle(state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), id++)); + state.addBundle(state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + id++)); manifest = new Hashtable(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); manifest.put(Constants.BUNDLE_SYMBOLICNAME, "A"); manifest.put(Constants.BUNDLE_VERSION, "3.0.0"); manifest.put(Constants.EXPORT_PACKAGE, "a"); - state.addBundle(state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), id++)); + state.addBundle(state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + id++)); manifest = new Hashtable(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); manifest.put(Constants.BUNDLE_SYMBOLICNAME, "A"); manifest.put(Constants.BUNDLE_VERSION, "4.0.0"); manifest.put(Constants.EXPORT_PACKAGE, "a"); - state.addBundle(state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), id++)); + state.addBundle(state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + id++)); manifest = new Hashtable(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); manifest.put(Constants.BUNDLE_SYMBOLICNAME, "A"); manifest.put(Constants.BUNDLE_VERSION, "5.0.0"); manifest.put(Constants.EXPORT_PACKAGE, "a"); - state.addBundle(state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), id++)); + state.addBundle(state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + id++)); manifest = new Hashtable(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); @@ -97,7 +108,9 @@ private void addUsesBundles(State state) throws BundleException { manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); manifest.put(Constants.EXPORT_PACKAGE, "b; uses:=a"); manifest.put(Constants.REQUIRE_BUNDLE, "A; bundle-version=\"[1.0.0,2.0.0)\"; visibility:=reexport"); - state.addBundle(state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), id++)); + state.addBundle(state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + id++)); manifest = new Hashtable(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); @@ -105,7 +118,9 @@ private void addUsesBundles(State state) throws BundleException { manifest.put(Constants.BUNDLE_VERSION, "2.0.0"); manifest.put(Constants.EXPORT_PACKAGE, "b; uses:=a"); manifest.put(Constants.REQUIRE_BUNDLE, "A; bundle-version=\"[1.0.0,2.0.0)\"; visibility:=reexport"); - state.addBundle(state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), id++)); + state.addBundle(state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + id++)); manifest = new Hashtable(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); @@ -113,7 +128,9 @@ private void addUsesBundles(State state) throws BundleException { manifest.put(Constants.BUNDLE_VERSION, "3.0.0"); manifest.put(Constants.EXPORT_PACKAGE, "b; uses:=a"); manifest.put(Constants.REQUIRE_BUNDLE, "A; bundle-version=\"[1.0.0,2.0.0)\"; visibility:=reexport"); - state.addBundle(state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), id++)); + state.addBundle(state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + id++)); manifest = new Hashtable(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); @@ -121,7 +138,9 @@ private void addUsesBundles(State state) throws BundleException { manifest.put(Constants.BUNDLE_VERSION, "4.0.0"); manifest.put(Constants.EXPORT_PACKAGE, "b; uses:=a"); manifest.put(Constants.REQUIRE_BUNDLE, "A; bundle-version=\"[1.0.0,2.0.0)\"; visibility:=reexport"); - state.addBundle(state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), id++)); + state.addBundle(state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + id++)); manifest = new Hashtable(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); @@ -129,7 +148,9 @@ private void addUsesBundles(State state) throws BundleException { manifest.put(Constants.BUNDLE_VERSION, "5.0.0"); manifest.put(Constants.EXPORT_PACKAGE, "b; uses:=a"); manifest.put(Constants.REQUIRE_BUNDLE, "A; bundle-version=\"[1.0.0,2.0.0)\"; visibility:=reexport"); - state.addBundle(state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), id++)); + state.addBundle(state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + id++)); manifest = new Hashtable(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); @@ -137,7 +158,9 @@ private void addUsesBundles(State state) throws BundleException { manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); manifest.put(Constants.EXPORT_PACKAGE, "c; uses:=a"); manifest.put(Constants.REQUIRE_BUNDLE, "A; bundle-version=\"[2.0.0,3.0.0)\"; visibility:=reexport"); - state.addBundle(state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), id++)); + state.addBundle(state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + id++)); manifest = new Hashtable(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); @@ -145,7 +168,9 @@ private void addUsesBundles(State state) throws BundleException { manifest.put(Constants.BUNDLE_VERSION, "2.0.0"); manifest.put(Constants.EXPORT_PACKAGE, "c; uses:=a"); manifest.put(Constants.REQUIRE_BUNDLE, "A; bundle-version=\"[2.0.0,3.0.0)\"; visibility:=reexport"); - state.addBundle(state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), id++)); + state.addBundle(state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + id++)); manifest = new Hashtable(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); @@ -153,7 +178,9 @@ private void addUsesBundles(State state) throws BundleException { manifest.put(Constants.BUNDLE_VERSION, "3.0.0"); manifest.put(Constants.EXPORT_PACKAGE, "c; uses:=a"); manifest.put(Constants.REQUIRE_BUNDLE, "A; bundle-version=\"[2.0.0,3.0.0)\"; visibility:=reexport"); - state.addBundle(state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), id++)); + state.addBundle(state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + id++)); manifest = new Hashtable(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); @@ -161,7 +188,9 @@ private void addUsesBundles(State state) throws BundleException { manifest.put(Constants.BUNDLE_VERSION, "4.0.0"); manifest.put(Constants.EXPORT_PACKAGE, "c; uses:=a"); manifest.put(Constants.REQUIRE_BUNDLE, "A; bundle-version=\"[2.0.0,3.0.0)\"; visibility:=reexport"); - state.addBundle(state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), id++)); + state.addBundle(state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + id++)); manifest = new Hashtable(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); @@ -169,7 +198,9 @@ private void addUsesBundles(State state) throws BundleException { manifest.put(Constants.BUNDLE_VERSION, "5.0.0"); manifest.put(Constants.EXPORT_PACKAGE, "c; uses:=a"); manifest.put(Constants.REQUIRE_BUNDLE, "A; bundle-version=\"[2.0.0,3.0.0)\"; visibility:=reexport"); - state.addBundle(state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), id++)); + state.addBundle(state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + id++)); manifest = new Hashtable(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); @@ -177,7 +208,9 @@ private void addUsesBundles(State state) throws BundleException { manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); manifest.put(Constants.EXPORT_PACKAGE, "f; uses:=b"); manifest.put(Constants.REQUIRE_BUNDLE, "A, B, C"); - state.addBundle(state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), id++)); + state.addBundle(state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + id++)); } } diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestAttributes_001.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestAttributes_001.java index 84329666246..298da2d57c1 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestAttributes_001.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestAttributes_001.java @@ -37,12 +37,12 @@ public void testTest_001() { bundle_3 = create_bundle_3(sof); bundle_4 = create_bundle_4(sof); bundle_5 = create_bundle_5(sof); - //*************************************************** + // *************************************************** // stage a // expect to pass =true - //*************************************************** + // *************************************************** addBundlesToState_a(state); - //*************************************************** + // *************************************************** try { state.resolve(); } catch (Throwable t) { diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestBSN_001.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestBSN_001.java index 680566a5472..4b88730708c 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestBSN_001.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestBSN_001.java @@ -33,12 +33,12 @@ public void testTest_001() { bundle_1 = create_bundle_1(sof); bundle_2 = create_bundle_2(sof); bundle_3 = create_bundle_3(sof); - //*************************************************** + // *************************************************** // stage a // expect to pass =true - //*************************************************** + // *************************************************** addBundlesToState_a(state); - //*************************************************** + // *************************************************** try { state.resolve(); } catch (Throwable t) { diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestCycle_001.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestCycle_001.java index bb23bb294c9..ef18b628f10 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestCycle_001.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestCycle_001.java @@ -31,12 +31,12 @@ public void testTest_001() { bundle_1 = create_bundle_1(sof); bundle_2 = create_bundle_2(sof); - //*************************************************** + // *************************************************** // stage a // expect to pass =true - //*************************************************** + // *************************************************** addBundlesToState_a(state); - //*************************************************** + // *************************************************** try { state.resolve(); } catch (Throwable t) { diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestCycle_002.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestCycle_002.java index 0c4e54adac4..2e27b50aa5b 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestCycle_002.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestCycle_002.java @@ -33,12 +33,12 @@ public void testTest_002() { bundle_1 = create_bundle_1(sof); bundle_2 = create_bundle_2(sof); bundle_3 = create_bundle_3(sof); - //*************************************************** + // *************************************************** // stage a // expect to pass =true - //*************************************************** + // *************************************************** addBundlesToState_a(state); - //*************************************************** + // *************************************************** try { state.resolve(); } catch (Throwable t) { diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestCycle_003.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestCycle_003.java index 00aad6c06f6..78beb976060 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestCycle_003.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestCycle_003.java @@ -33,12 +33,12 @@ public void testTest_003() { bundle_1 = create_bundle_1(sof); bundle_2 = create_bundle_2(sof); bundle_3 = create_bundle_3(sof); - //*************************************************** + // *************************************************** // stage a // expect to pass =true - //*************************************************** + // *************************************************** addBundlesToState_a(state); - //*************************************************** + // *************************************************** try { state.resolve(); } catch (Throwable t) { diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestCycle_004.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestCycle_004.java index 11fab2276c7..49d6a6d5020 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestCycle_004.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestCycle_004.java @@ -31,12 +31,12 @@ public void testTest_001() { bundle_1 = create_bundle_1(sof); bundle_2 = create_bundle_2(sof); - //*************************************************** + // *************************************************** // stage a // expect to pass =true - //*************************************************** + // *************************************************** addBundlesToState_a(state); - //*************************************************** + // *************************************************** try { state.resolve(); } catch (Throwable t) { diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestCycle_005.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestCycle_005.java index c3235594fbd..54ef9ca3a2a 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestCycle_005.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestCycle_005.java @@ -33,12 +33,12 @@ public void testTest_002() { bundle_1 = create_bundle_1(sof); bundle_2 = create_bundle_2(sof); bundle_3 = create_bundle_3(sof); - //*************************************************** + // *************************************************** // stage a // expect to pass =true - //*************************************************** + // *************************************************** addBundlesToState_a(state); - //*************************************************** + // *************************************************** try { state.resolve(); } catch (Throwable t) { diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestCycle_006.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestCycle_006.java index 42567868a4d..53b33579783 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestCycle_006.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestCycle_006.java @@ -19,7 +19,6 @@ import org.eclipse.osgi.tests.services.resolver.AbstractStateTest; import org.osgi.framework.BundleException; - public class TestCycle_006 extends AbstractStateTest { public TestCycle_006(String testName) { super(testName); @@ -29,7 +28,6 @@ public TestCycle_006(String testName) { BundleDescription bundle_2 = null; BundleDescription bundle_3 = null; - public void testTest_003() { State state = buildEmptyState(); StateObjectFactory sof = StateObjectFactory.defaultFactory; @@ -37,24 +35,22 @@ public void testTest_003() { bundle_1 = create_bundle_1(sof); bundle_2 = create_bundle_2(sof); bundle_3 = create_bundle_3(sof); - //*************************************************** + // *************************************************** // stage a // expect to pass =true - //*************************************************** + // *************************************************** addBundlesToState_a(state); - //*************************************************** + // *************************************************** try { state.resolve(); } catch (Throwable t) { - fail("unexpected exception class=" + t.getClass().getName() - + " message=" + t.getMessage()); + fail("unexpected exception class=" + t.getClass().getName() + " message=" + t.getMessage()); return; } checkBundlesResolved_a(); checkWiring_a(); } // end of method - public void checkWiringState_1() { } // end method @@ -64,14 +60,12 @@ public void checkWiringState_2() { public void checkWiringState_3() { } // end method - public void checkWiring_a() { checkWiringState_1(); checkWiringState_2(); checkWiringState_3(); } // end method - public void addBundlesToState_a(State state) { boolean added = false; added = state.addBundle(bundle_1); @@ -82,14 +76,12 @@ public void addBundlesToState_a(State state) { assertTrue("failed to add bundle ", added); } // end method - public void checkBundlesResolved_a() { assertTrue("unexpected bundle resolution state", !bundle_1.isResolved()); assertTrue("unexpected bundle resolution state", !bundle_2.isResolved()); assertTrue("unexpected bundle resolution state", bundle_3.isResolved()); } // end method - public BundleDescription create_bundle_1(StateObjectFactory sof) { java.util.Dictionary dictionary_1 = new java.util.Properties(); BundleDescription bundle = null; diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestDynamic_001.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestDynamic_001.java index c71e611d631..1ff2405ca61 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestDynamic_001.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestDynamic_001.java @@ -20,7 +20,6 @@ import org.eclipse.osgi.tests.services.resolver.AbstractStateTest; import org.osgi.framework.BundleException; - public class TestDynamic_001 extends AbstractStateTest { public TestDynamic_001(String testName) { super(testName); @@ -29,24 +28,22 @@ public TestDynamic_001(String testName) { BundleDescription bundle_1 = null; BundleDescription bundle_2 = null; - public void testTest_001() { State state = buildEmptyState(); StateObjectFactory sof = StateObjectFactory.defaultFactory; bundle_1 = create_bundle_1(sof); bundle_2 = create_bundle_2(sof); - //*************************************************** + // *************************************************** // stage a // expect to pass =true - //*************************************************** + // *************************************************** addBundlesToState_a(state); - //*************************************************** + // *************************************************** try { state.resolve(); } catch (Throwable t) { - fail("unexpected exception class=" + t.getClass().getName() - + " message=" + t.getMessage()); + fail("unexpected exception class=" + t.getClass().getName() + " message=" + t.getMessage()); return; } checkBundlesResolved_a(); @@ -59,20 +56,17 @@ public void testTest_001() { } // end of method - public void checkWiringState_1() { } // end method public void checkWiringState_2() { } // end method - public void checkWiring_a() { checkWiringState_1(); checkWiringState_2(); } // end method - public void addBundlesToState_a(State state) { boolean added = false; added = state.addBundle(bundle_1); @@ -81,13 +75,11 @@ public void addBundlesToState_a(State state) { assertTrue("failed to add bundle ", added); } // end method - public void checkBundlesResolved_a() { assertTrue("unexpected bundle resolution state", bundle_1.isResolved()); assertTrue("unexpected bundle resolution state", bundle_2.isResolved()); } // end method - public BundleDescription create_bundle_1(StateObjectFactory sof) { java.util.Dictionary dictionary_1 = new java.util.Properties(); BundleDescription bundle = null; diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestDynamic_002.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestDynamic_002.java index 7102c2149df..beccec9c1d7 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestDynamic_002.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestDynamic_002.java @@ -20,7 +20,6 @@ import org.eclipse.osgi.tests.services.resolver.AbstractStateTest; import org.osgi.framework.BundleException; - public class TestDynamic_002 extends AbstractStateTest { public TestDynamic_002(String testName) { super(testName); @@ -30,7 +29,6 @@ public TestDynamic_002(String testName) { BundleDescription bundle_2 = null; BundleDescription bundle_3 = null; - public void testTest_002() { State state = buildEmptyState(); StateObjectFactory sof = StateObjectFactory.defaultFactory; @@ -38,17 +36,16 @@ public void testTest_002() { bundle_1 = create_bundle_1(sof); bundle_2 = create_bundle_2(sof); bundle_3 = create_bundle_3(sof); - //*************************************************** + // *************************************************** // stage a // expect to pass =true - //*************************************************** + // *************************************************** addBundlesToState_a(state); - //*************************************************** + // *************************************************** try { state.resolve(); } catch (Throwable t) { - fail("unexpected exception class=" + t.getClass().getName() - + " message=" + t.getMessage()); + fail("unexpected exception class=" + t.getClass().getName() + " message=" + t.getMessage()); return; } checkBundlesResolved_a(); @@ -60,7 +57,6 @@ public void testTest_002() { } // end of method - public void checkWiringState_1() { ExportPackageDescription[] exports = bundle_1.getResolvedImports(); assertNotNull("export array is unexpectedly null", exports); @@ -84,14 +80,12 @@ public void checkWiringState_2() { public void checkWiringState_3() { } // end method - public void checkWiring_a() { checkWiringState_1(); checkWiringState_2(); checkWiringState_3(); } // end method - public void addBundlesToState_a(State state) { boolean added = false; added = state.addBundle(bundle_1); @@ -102,14 +96,12 @@ public void addBundlesToState_a(State state) { assertTrue("failed to add bundle ", added); } // end method - public void checkBundlesResolved_a() { assertTrue("unexpected bundle resolution state", bundle_1.isResolved()); assertTrue("unexpected bundle resolution state", bundle_2.isResolved()); assertTrue("unexpected bundle resolution state", bundle_3.isResolved()); } // end method - public BundleDescription create_bundle_1(StateObjectFactory sof) { java.util.Dictionary dictionary_1 = new java.util.Properties(); BundleDescription bundle = null; diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestDynamic_003.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestDynamic_003.java index b9ecc0eb7d7..77b93a98800 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestDynamic_003.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestDynamic_003.java @@ -20,7 +20,6 @@ import org.eclipse.osgi.tests.services.resolver.AbstractStateTest; import org.osgi.framework.BundleException; - public class TestDynamic_003 extends AbstractStateTest { public TestDynamic_003(String testName) { super(testName); @@ -30,7 +29,6 @@ public TestDynamic_003(String testName) { BundleDescription bundle_2 = null; BundleDescription bundle_3 = null; - public void testTest_003() { State state = buildEmptyState(); StateObjectFactory sof = StateObjectFactory.defaultFactory; @@ -38,17 +36,16 @@ public void testTest_003() { bundle_1 = create_bundle_1(sof); bundle_2 = create_bundle_2(sof); bundle_3 = create_bundle_3(sof); - //*************************************************** + // *************************************************** // stage a // expect to pass =true - //*************************************************** + // *************************************************** addBundlesToState_a(state); - //*************************************************** + // *************************************************** try { state.resolve(); } catch (Throwable t) { - fail("unexpected exception class=" + t.getClass().getName() - + " message=" + t.getMessage()); + fail("unexpected exception class=" + t.getClass().getName() + " message=" + t.getMessage()); return; } checkBundlesResolved_a(); @@ -61,7 +58,6 @@ public void testTest_003() { } // end of method - public void checkWiringState_1() { ExportPackageDescription[] exports = bundle_1.getResolvedImports(); assertNotNull("export array is unexpectedly null", exports); @@ -85,14 +81,12 @@ public void checkWiringState_2() { public void checkWiringState_3() { } // end method - public void checkWiring_a() { checkWiringState_1(); checkWiringState_2(); checkWiringState_3(); } // end method - public void addBundlesToState_a(State state) { boolean added = false; added = state.addBundle(bundle_1); @@ -103,14 +97,12 @@ public void addBundlesToState_a(State state) { assertTrue("failed to add bundle ", added); } // end method - public void checkBundlesResolved_a() { assertTrue("unexpected bundle resolution state", bundle_1.isResolved()); assertTrue("unexpected bundle resolution state", bundle_2.isResolved()); assertTrue("unexpected bundle resolution state", bundle_3.isResolved()); } // end method - public BundleDescription create_bundle_1(StateObjectFactory sof) { java.util.Dictionary dictionary_1 = new java.util.Properties(); BundleDescription bundle = null; diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestDynamic_004.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestDynamic_004.java index 9a13a526e0e..e1c1df3d081 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestDynamic_004.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestDynamic_004.java @@ -20,7 +20,6 @@ import org.eclipse.osgi.tests.services.resolver.AbstractStateTest; import org.osgi.framework.BundleException; - public class TestDynamic_004 extends AbstractStateTest { public TestDynamic_004(String testName) { super(testName); @@ -31,7 +30,6 @@ public TestDynamic_004(String testName) { BundleDescription bundle_3 = null; BundleDescription bundle_4 = null; - public void testTest_003() { State state = buildEmptyState(); StateObjectFactory sof = StateObjectFactory.defaultFactory; @@ -40,17 +38,16 @@ public void testTest_003() { bundle_2 = create_bundle_2(sof); bundle_3 = create_bundle_3(sof); bundle_4 = create_bundle_4(sof); - //*************************************************** + // *************************************************** // stage a // expect to pass =true - //*************************************************** + // *************************************************** addBundlesToState_a(state); - //*************************************************** + // *************************************************** try { state.resolve(); } catch (Throwable t) { - fail("unexpected exception class=" + t.getClass().getName() - + " message=" + t.getMessage()); + fail("unexpected exception class=" + t.getClass().getName() + " message=" + t.getMessage()); return; } checkBundlesResolved_a(); @@ -63,7 +60,6 @@ public void testTest_003() { } // end of method - public void checkWiringState_1() { ExportPackageDescription[] exports = bundle_1.getResolvedImports(); assertNotNull("export array is unexpectedly null", exports); @@ -98,7 +94,6 @@ public void checkWiringState_3() { public void checkWiringState_4() { } // end method - public void checkWiring_a() { checkWiringState_1(); checkWiringState_2(); @@ -106,7 +101,6 @@ public void checkWiring_a() { checkWiringState_4(); } // end method - public void addBundlesToState_a(State state) { boolean added = false; added = state.addBundle(bundle_1); @@ -119,7 +113,6 @@ public void addBundlesToState_a(State state) { assertTrue("failed to add bundle ", added); } // end method - public void checkBundlesResolved_a() { assertTrue("unexpected bundle resolution state", bundle_1.isResolved()); assertTrue("unexpected bundle resolution state", bundle_2.isResolved()); @@ -127,7 +120,6 @@ public void checkBundlesResolved_a() { assertTrue("unexpected bundle resolution state", bundle_4.isResolved()); } // end method - public BundleDescription create_bundle_1(StateObjectFactory sof) { java.util.Dictionary dictionary_1 = new java.util.Properties(); BundleDescription bundle = null; diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestDynamic_005.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestDynamic_005.java index 82d8f1468d7..2b2d7b8f86f 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestDynamic_005.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestDynamic_005.java @@ -20,7 +20,6 @@ import org.eclipse.osgi.tests.services.resolver.AbstractStateTest; import org.osgi.framework.BundleException; - public class TestDynamic_005 extends AbstractStateTest { public TestDynamic_005(String testName) { super(testName); @@ -30,7 +29,6 @@ public TestDynamic_005(String testName) { BundleDescription bundle_2 = null; BundleDescription bundle_3 = null; - public void testTest_005() { State state = buildEmptyState(); StateObjectFactory sof = StateObjectFactory.defaultFactory; @@ -38,17 +36,16 @@ public void testTest_005() { bundle_1 = create_bundle_1(sof); bundle_2 = create_bundle_2(sof); bundle_3 = create_bundle_3(sof); - //*************************************************** + // *************************************************** // stage a // expect to pass =true - //*************************************************** + // *************************************************** addBundlesToState_a(state); - //*************************************************** + // *************************************************** try { state.resolve(); } catch (Throwable t) { - fail("unexpected exception class=" + t.getClass().getName() - + " message=" + t.getMessage()); + fail("unexpected exception class=" + t.getClass().getName() + " message=" + t.getMessage()); return; } checkBundlesResolved_a(); @@ -61,7 +58,6 @@ public void testTest_005() { } // end of method - public void checkWiringState_1() { } // end method @@ -71,14 +67,12 @@ public void checkWiringState_2() { public void checkWiringState_3() { } // end method - public void checkWiring_a() { checkWiringState_1(); checkWiringState_2(); checkWiringState_3(); } // end method - public void addBundlesToState_a(State state) { boolean added = false; added = state.addBundle(bundle_1); @@ -89,14 +83,12 @@ public void addBundlesToState_a(State state) { assertTrue("failed to add bundle ", added); } // end method - public void checkBundlesResolved_a() { assertTrue("unexpected bundle resolution state", bundle_1.isResolved()); assertTrue("unexpected bundle resolution state", bundle_2.isResolved()); assertTrue("unexpected bundle resolution state", bundle_3.isResolved()); } // end method - public BundleDescription create_bundle_1(StateObjectFactory sof) { java.util.Dictionary dictionary_1 = new java.util.Properties(); BundleDescription bundle = null; diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestDynamic_006.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestDynamic_006.java index 0f8a52af978..4954ff85ac4 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestDynamic_006.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestDynamic_006.java @@ -20,7 +20,6 @@ import org.eclipse.osgi.tests.services.resolver.AbstractStateTest; import org.osgi.framework.BundleException; - public class TestDynamic_006 extends AbstractStateTest { public TestDynamic_006(String testName) { super(testName); @@ -30,7 +29,6 @@ public TestDynamic_006(String testName) { BundleDescription bundle_2 = null; BundleDescription bundle_3 = null; - public void testTest_005() { State state = buildEmptyState(); StateObjectFactory sof = StateObjectFactory.defaultFactory; @@ -38,17 +36,16 @@ public void testTest_005() { bundle_1 = create_bundle_1(sof); bundle_2 = create_bundle_2(sof); bundle_3 = create_bundle_3(sof); - //*************************************************** + // *************************************************** // stage a // expect to pass =true - //*************************************************** + // *************************************************** addBundlesToState_a(state); - //*************************************************** + // *************************************************** try { state.resolve(); } catch (Throwable t) { - fail("unexpected exception class=" + t.getClass().getName() - + " message=" + t.getMessage()); + fail("unexpected exception class=" + t.getClass().getName() + " message=" + t.getMessage()); return; } checkBundlesResolved_a(); @@ -61,7 +58,6 @@ public void testTest_005() { } // end of method - public void checkWiringState_1() { } // end method @@ -71,14 +67,12 @@ public void checkWiringState_2() { public void checkWiringState_3() { } // end method - public void checkWiring_a() { checkWiringState_1(); checkWiringState_2(); checkWiringState_3(); } // end method - public void addBundlesToState_a(State state) { boolean added = false; added = state.addBundle(bundle_1); @@ -89,14 +83,12 @@ public void addBundlesToState_a(State state) { assertTrue("failed to add bundle ", added); } // end method - public void checkBundlesResolved_a() { assertTrue("unexpected bundle resolution state", bundle_1.isResolved()); assertTrue("unexpected bundle resolution state", bundle_2.isResolved()); assertTrue("unexpected bundle resolution state", bundle_3.isResolved()); } // end method - public BundleDescription create_bundle_1(StateObjectFactory sof) { java.util.Dictionary dictionary_1 = new java.util.Properties(); BundleDescription bundle = null; diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestGenerated_001.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestGenerated_001.java index 0fbf39c0aae..3c66e7bb697 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestGenerated_001.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestGenerated_001.java @@ -20,8 +20,6 @@ import org.eclipse.osgi.tests.services.resolver.AbstractStateTest; import org.osgi.framework.BundleException; - - public class TestGenerated_001 extends AbstractStateTest { public TestGenerated_001(String testName) { super(testName); @@ -52,17 +50,16 @@ public void testTest_001() { bundle_8 = create_bundle_8(sof); bundle_9 = create_bundle_9(sof); bundle_10 = create_bundle_10(sof); - //*************************************************** + // *************************************************** // stage a // expect to pass =true - //*************************************************** + // *************************************************** addBundlesToState_a(state); - //*************************************************** + // *************************************************** try { state.resolve(); } catch (Throwable t) { - fail("unexpected exception class=" + t.getClass().getName() - + " message=" + t.getMessage()); + fail("unexpected exception class=" + t.getClass().getName() + " message=" + t.getMessage()); return; } checkBundlesResolved_a(); diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestGrouping_001.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestGrouping_001.java index 5414ba6d2af..eda8d9ceb9e 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestGrouping_001.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestGrouping_001.java @@ -20,7 +20,6 @@ import org.eclipse.osgi.tests.services.resolver.AbstractStateTest; import org.osgi.framework.BundleException; - public class TestGrouping_001 extends AbstractStateTest { public TestGrouping_001(String testName) { super(testName); @@ -30,7 +29,6 @@ public TestGrouping_001(String testName) { BundleDescription bundle_2 = null; BundleDescription bundle_3 = null; - public void testTest_001() { State state = buildEmptyState(); StateObjectFactory sof = StateObjectFactory.defaultFactory; @@ -38,24 +36,22 @@ public void testTest_001() { bundle_1 = create_bundle_1(sof); bundle_2 = create_bundle_2(sof); bundle_3 = create_bundle_3(sof); - //*************************************************** + // *************************************************** // stage a // expect to pass =true - //*************************************************** + // *************************************************** addBundlesToState_a(state); - //*************************************************** + // *************************************************** try { state.resolve(); } catch (Throwable t) { - fail("unexpected exception class=" + t.getClass().getName() - + " message=" + t.getMessage()); + fail("unexpected exception class=" + t.getClass().getName() + " message=" + t.getMessage()); return; } checkBundlesResolved_a(); checkWiring_a(); } // end of method - public void checkWiringState_1() { ExportPackageDescription[] exports = bundle_1.getResolvedImports(); assertNotNull("export array is unexpectedly null", exports); @@ -79,14 +75,12 @@ public void checkWiringState_2() { public void checkWiringState_3() { } // end method - public void checkWiring_a() { checkWiringState_1(); checkWiringState_2(); checkWiringState_3(); } // end method - public void addBundlesToState_a(State state) { boolean added = false; added = state.addBundle(bundle_1); @@ -97,14 +91,12 @@ public void addBundlesToState_a(State state) { assertTrue("failed to add bundle ", added); } // end method - public void checkBundlesResolved_a() { assertTrue("unexpected bundle resolution state", bundle_1.isResolved()); assertTrue("unexpected bundle resolution state", bundle_2.isResolved()); assertTrue("unexpected bundle resolution state", bundle_3.isResolved()); } // end method - public BundleDescription create_bundle_1(StateObjectFactory sof) { java.util.Dictionary dictionary_1 = new java.util.Properties(); BundleDescription bundle = null; diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestGrouping_002.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestGrouping_002.java index 0a2b0636b49..cff021b1141 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestGrouping_002.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestGrouping_002.java @@ -19,7 +19,6 @@ import org.eclipse.osgi.tests.services.resolver.AbstractStateTest; import org.osgi.framework.BundleException; - public class TestGrouping_002 extends AbstractStateTest { public TestGrouping_002(String testName) { super(testName); @@ -29,7 +28,6 @@ public TestGrouping_002(String testName) { BundleDescription bundle_2 = null; BundleDescription bundle_3 = null; - public void testTest_002() { State state = buildEmptyState(); StateObjectFactory sof = StateObjectFactory.defaultFactory; @@ -37,24 +35,22 @@ public void testTest_002() { bundle_1 = create_bundle_1(sof); bundle_2 = create_bundle_2(sof); bundle_3 = create_bundle_3(sof); - //*************************************************** + // *************************************************** // stage a // expect to pass =true - //*************************************************** + // *************************************************** addBundlesToState_a(state); - //*************************************************** + // *************************************************** try { state.resolve(); } catch (Throwable t) { - fail("unexpected exception class=" + t.getClass().getName() - + " message=" + t.getMessage()); + fail("unexpected exception class=" + t.getClass().getName() + " message=" + t.getMessage()); return; } checkBundlesResolved_a(); checkWiring_a(); } // end of method - public void checkWiringState_1() { } // end method @@ -64,14 +60,12 @@ public void checkWiringState_2() { public void checkWiringState_3() { } // end method - public void checkWiring_a() { checkWiringState_1(); checkWiringState_2(); checkWiringState_3(); } // end method - public void addBundlesToState_a(State state) { boolean added = false; added = state.addBundle(bundle_1); @@ -82,14 +76,12 @@ public void addBundlesToState_a(State state) { assertTrue("failed to add bundle ", added); } // end method - public void checkBundlesResolved_a() { assertTrue("unexpected bundle resolution state", !bundle_1.isResolved()); assertTrue("unexpected bundle resolution state", bundle_2.isResolved()); assertTrue("unexpected bundle resolution state", bundle_3.isResolved()); } // end method - public BundleDescription create_bundle_1(StateObjectFactory sof) { java.util.Dictionary dictionary_1 = new java.util.Properties(); BundleDescription bundle = null; diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestGrouping_003.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestGrouping_003.java index d22487cb0a6..fbdb1ccce94 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestGrouping_003.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestGrouping_003.java @@ -20,7 +20,6 @@ import org.eclipse.osgi.tests.services.resolver.AbstractStateTest; import org.osgi.framework.BundleException; - public class TestGrouping_003 extends AbstractStateTest { public TestGrouping_003(String testName) { super(testName); @@ -32,7 +31,6 @@ public TestGrouping_003(String testName) { BundleDescription bundle_4 = null; BundleDescription bundle_5 = null; - public void testTest_003() { State state = buildEmptyState(); StateObjectFactory sof = StateObjectFactory.defaultFactory; @@ -42,24 +40,22 @@ public void testTest_003() { bundle_3 = create_bundle_3(sof); bundle_4 = create_bundle_4(sof); bundle_5 = create_bundle_5(sof); - //*************************************************** + // *************************************************** // stage a // expect to pass =true - //*************************************************** + // *************************************************** addBundlesToState_a(state); - //*************************************************** + // *************************************************** try { state.resolve(); } catch (Throwable t) { - fail("unexpected exception class=" + t.getClass().getName() - + " message=" + t.getMessage()); + fail("unexpected exception class=" + t.getClass().getName() + " message=" + t.getMessage()); return; } checkBundlesResolved_a(); checkWiring_a(); } // end of method - public void checkWiringState_1() { ExportPackageDescription[] exports = bundle_1.getResolvedImports(); assertNotNull("export array is unexpectedly null", exports); @@ -103,7 +99,6 @@ public void checkWiringState_4() { public void checkWiringState_5() { } // end method - public void checkWiring_a() { checkWiringState_1(); checkWiringState_2(); @@ -112,7 +107,6 @@ public void checkWiring_a() { checkWiringState_5(); } // end method - public void addBundlesToState_a(State state) { boolean added = false; added = state.addBundle(bundle_1); @@ -127,7 +121,6 @@ public void addBundlesToState_a(State state) { assertTrue("failed to add bundle ", added); } // end method - public void checkBundlesResolved_a() { assertTrue("unexpected bundle resolution state", bundle_1.isResolved()); assertTrue("unexpected bundle resolution state", bundle_2.isResolved()); @@ -136,7 +129,6 @@ public void checkBundlesResolved_a() { assertTrue("unexpected bundle resolution state", bundle_5.isResolved()); } // end method - public BundleDescription create_bundle_1(StateObjectFactory sof) { java.util.Dictionary dictionary_1 = new java.util.Properties(); BundleDescription bundle = null; diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestGrouping_006.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestGrouping_006.java index fb3aee63d98..e604e8a5890 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestGrouping_006.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestGrouping_006.java @@ -19,7 +19,6 @@ import org.eclipse.osgi.tests.services.resolver.AbstractStateTest; import org.osgi.framework.BundleException; - public class TestGrouping_006 extends AbstractStateTest { public TestGrouping_006(String testName) { super(testName); @@ -29,7 +28,6 @@ public TestGrouping_006(String testName) { BundleDescription bundle_2 = null; BundleDescription bundle_3 = null; - public void testTest_001() { State state = buildEmptyState(); StateObjectFactory sof = StateObjectFactory.defaultFactory; @@ -37,24 +35,22 @@ public void testTest_001() { bundle_1 = create_bundle_1(sof); bundle_2 = create_bundle_2(sof); bundle_3 = create_bundle_3(sof); - //*************************************************** + // *************************************************** // stage a // expect to pass =true - //*************************************************** + // *************************************************** addBundlesToState_a(state); - //*************************************************** + // *************************************************** try { state.resolve(); } catch (Throwable t) { - fail("unexpected exception class=" + t.getClass().getName() - + " message=" + t.getMessage()); + fail("unexpected exception class=" + t.getClass().getName() + " message=" + t.getMessage()); return; } checkBundlesResolved_a(); checkWiring_a(); } // end of method - public void checkWiringState_1() { } // end method @@ -64,14 +60,12 @@ public void checkWiringState_2() { public void checkWiringState_3() { } // end method - public void checkWiring_a() { checkWiringState_1(); checkWiringState_2(); checkWiringState_3(); } // end method - public void addBundlesToState_a(State state) { boolean added = false; added = state.addBundle(bundle_1); @@ -82,14 +76,12 @@ public void addBundlesToState_a(State state) { assertTrue("failed to add bundle ", added); } // end method - public void checkBundlesResolved_a() { assertTrue("unexpected bundle resolution state", !bundle_1.isResolved()); assertTrue("unexpected bundle resolution state", bundle_2.isResolved()); assertTrue("unexpected bundle resolution state", bundle_3.isResolved()); } // end method - public BundleDescription create_bundle_1(StateObjectFactory sof) { java.util.Dictionary dictionary_1 = new java.util.Properties(); BundleDescription bundle = null; diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestGrouping_008.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestGrouping_008.java index 08879aa8e0b..4cd8107de73 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestGrouping_008.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestGrouping_008.java @@ -20,7 +20,6 @@ import org.eclipse.osgi.service.resolver.ExportPackageDescription; import org.eclipse.osgi.tests.services.resolver.AbstractStateTest; - public class TestGrouping_008 extends AbstractStateTest { public TestGrouping_008(String testName) { super(testName); @@ -30,7 +29,6 @@ public TestGrouping_008(String testName) { BundleDescription bundle_2 = null; BundleDescription bundle_3 = null; - public void testTest_008() { State state = buildEmptyState(); StateObjectFactory sof = StateObjectFactory.defaultFactory; @@ -38,24 +36,22 @@ public void testTest_008() { bundle_1 = create_bundle_1(sof); bundle_2 = create_bundle_2(sof); bundle_3 = create_bundle_3(sof); - //*************************************************** + // *************************************************** // stage a // expect to pass =true - //*************************************************** + // *************************************************** addBundlesToState_a(state); - //*************************************************** + // *************************************************** try { state.resolve(); } catch (Throwable t) { - fail("unexpected exception class=" + t.getClass().getName() - + " message=" + t.getMessage()); + fail("unexpected exception class=" + t.getClass().getName() + " message=" + t.getMessage()); return; } checkBundlesResolved_a(); checkWiring_a(); } // end of method - public void checkWiringState_1() { BundleDescription[] requires = bundle_1.getResolvedRequires(); assertNotNull("requires array is unexpectedly null", requires); @@ -87,15 +83,12 @@ public void checkWiringState_2() { public void checkWiringState_3() { } // end method - - public void checkWiring_a() { checkWiringState_1(); checkWiringState_2(); checkWiringState_3(); } // end method - public void addBundlesToState_a(State state) { boolean added = false; added = state.addBundle(bundle_1); @@ -106,14 +99,12 @@ public void addBundlesToState_a(State state) { assertTrue("failed to add bundle ", added); } // end method - public void checkBundlesResolved_a() { assertTrue("unexpected bundle resolution state", bundle_1.isResolved()); assertTrue("unexpected bundle resolution state", bundle_2.isResolved()); assertTrue("unexpected bundle resolution state", bundle_3.isResolved()); } // end method - public BundleDescription create_bundle_1(StateObjectFactory sof) { java.util.Dictionary dictionary_1 = new java.util.Properties(); BundleDescription bundle = null; @@ -157,5 +148,4 @@ public BundleDescription create_bundle_3(StateObjectFactory sof) { return bundle; } // end of method - } // end of testcase diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestOptional_001.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestOptional_001.java index 611d4f14136..07498a39b9f 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestOptional_001.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestOptional_001.java @@ -20,7 +20,6 @@ import org.eclipse.osgi.tests.services.resolver.AbstractStateTest; import org.osgi.framework.BundleException; - public class TestOptional_001 extends AbstractStateTest { public TestOptional_001(String testName) { super(testName); @@ -30,7 +29,6 @@ public TestOptional_001(String testName) { BundleDescription bundle_2 = null; BundleDescription bundle_3 = null; - public void testTest_002() { State state = buildEmptyState(); StateObjectFactory sof = StateObjectFactory.defaultFactory; @@ -38,24 +36,22 @@ public void testTest_002() { bundle_1 = create_bundle_1(sof); bundle_2 = create_bundle_2(sof); bundle_3 = create_bundle_3(sof); - //*************************************************** + // *************************************************** // stage a // expect to pass =true - //*************************************************** + // *************************************************** addBundlesToState_a(state); - //*************************************************** + // *************************************************** try { state.resolve(); } catch (Throwable t) { - fail("unexpected exception class=" + t.getClass().getName() - + " message=" + t.getMessage()); + fail("unexpected exception class=" + t.getClass().getName() + " message=" + t.getMessage()); return; } checkBundlesResolved_a(); checkWiring_a(); } // end of method - public void checkWiringState_1() { ExportPackageDescription[] exports = bundle_1.getResolvedImports(); assertNotNull("export array is unexpectedly null", exports); @@ -81,14 +77,12 @@ public void checkWiringState_2() { public void checkWiringState_3() { } // end method - public void checkWiring_a() { checkWiringState_1(); checkWiringState_2(); checkWiringState_3(); } // end method - public void addBundlesToState_a(State state) { boolean added = false; added = state.addBundle(bundle_1); @@ -99,14 +93,12 @@ public void addBundlesToState_a(State state) { assertTrue("failed to add bundle ", added); } // end method - public void checkBundlesResolved_a() { assertTrue("unexpected bundle resolution state", bundle_1.isResolved()); assertTrue("unexpected bundle resolution state", bundle_2.isResolved()); assertTrue("unexpected bundle resolution state", bundle_3.isResolved()); } // end method - public BundleDescription create_bundle_1(StateObjectFactory sof) { java.util.Dictionary dictionary_1 = new java.util.Properties(); BundleDescription bundle = null; diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestOptional_002.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestOptional_002.java index 68e1f4ea626..66944d4a676 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestOptional_002.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestOptional_002.java @@ -20,7 +20,6 @@ import org.eclipse.osgi.tests.services.resolver.AbstractStateTest; import org.osgi.framework.BundleException; - public class TestOptional_002 extends AbstractStateTest { public TestOptional_002(String testName) { super(testName); @@ -30,7 +29,6 @@ public TestOptional_002(String testName) { BundleDescription bundle_2 = null; BundleDescription bundle_3 = null; - public void testTest_002() { State state = buildEmptyState(); StateObjectFactory sof = StateObjectFactory.defaultFactory; @@ -38,24 +36,22 @@ public void testTest_002() { bundle_1 = create_bundle_1(sof); bundle_2 = create_bundle_2(sof); bundle_3 = create_bundle_3(sof); - //*************************************************** + // *************************************************** // stage a // expect to pass =true - //*************************************************** + // *************************************************** addBundlesToState_a(state); - //*************************************************** + // *************************************************** try { state.resolve(); } catch (Throwable t) { - fail("unexpected exception class=" + t.getClass().getName() - + " message=" + t.getMessage()); + fail("unexpected exception class=" + t.getClass().getName() + " message=" + t.getMessage()); return; } checkBundlesResolved_a(); checkWiring_a(); } // end of method - public void checkWiringState_1() { ExportPackageDescription[] exports = bundle_1.getResolvedImports(); assertNotNull("export array is unexpectedly null", exports); @@ -81,14 +77,12 @@ public void checkWiringState_2() { public void checkWiringState_3() { } // end method - public void checkWiring_a() { checkWiringState_1(); checkWiringState_2(); checkWiringState_3(); } // end method - public void addBundlesToState_a(State state) { boolean added = false; added = state.addBundle(bundle_1); @@ -99,14 +93,12 @@ public void addBundlesToState_a(State state) { assertTrue("failed to add bundle ", added); } // end method - public void checkBundlesResolved_a() { assertTrue("unexpected bundle resolution state", bundle_1.isResolved()); assertTrue("unexpected bundle resolution state", bundle_2.isResolved()); assertTrue("unexpected bundle resolution state", bundle_3.isResolved()); } // end method - public BundleDescription create_bundle_1(StateObjectFactory sof) { java.util.Dictionary dictionary_1 = new java.util.Properties(); BundleDescription bundle = null; diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestPropagation_001.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestPropagation_001.java index 13558be6c0e..99fe887e53c 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestPropagation_001.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestPropagation_001.java @@ -20,7 +20,6 @@ import org.eclipse.osgi.tests.services.resolver.AbstractStateTest; import org.osgi.framework.BundleException; - public class TestPropagation_001 extends AbstractStateTest { public TestPropagation_001(String testName) { super(testName); @@ -31,7 +30,6 @@ public TestPropagation_001(String testName) { BundleDescription bundle_3 = null; BundleDescription bundle_4 = null; - public void testTest_001() { State state = buildEmptyState(); StateObjectFactory sof = StateObjectFactory.defaultFactory; @@ -40,24 +38,22 @@ public void testTest_001() { bundle_2 = create_bundle_2(sof); bundle_3 = create_bundle_3(sof); bundle_4 = create_bundle_4(sof); - //*************************************************** + // *************************************************** // stage a // expect to pass =true - //*************************************************** + // *************************************************** addBundlesToState_a(state); - //*************************************************** + // *************************************************** try { state.resolve(); } catch (Throwable t) { - fail("unexpected exception class=" + t.getClass().getName() - + " message=" + t.getMessage()); + fail("unexpected exception class=" + t.getClass().getName() + " message=" + t.getMessage()); return; } checkBundlesResolved_a(); checkWiring_a(); } // end of method - public void checkWiringState_1() { ExportPackageDescription[] exports = bundle_1.getResolvedImports(); assertNotNull("export array is unexpectedly null", exports); @@ -95,7 +91,6 @@ public void checkWiringState_3() { public void checkWiringState_4() { } // end method - public void checkWiring_a() { checkWiringState_1(); checkWiringState_2(); @@ -103,7 +98,6 @@ public void checkWiring_a() { checkWiringState_4(); } // end method - public void addBundlesToState_a(State state) { boolean added = false; added = state.addBundle(bundle_1); @@ -116,7 +110,6 @@ public void addBundlesToState_a(State state) { assertTrue("failed to add bundle ", added); } // end method - public void checkBundlesResolved_a() { assertTrue("unexpected bundle resolution state", bundle_1.isResolved()); assertTrue("unexpected bundle resolution state", bundle_2.isResolved()); @@ -124,7 +117,6 @@ public void checkBundlesResolved_a() { assertTrue("unexpected bundle resolution state", bundle_4.isResolved()); } // end method - public BundleDescription create_bundle_1(StateObjectFactory sof) { java.util.Dictionary dictionary_1 = new java.util.Properties(); BundleDescription bundle = null; diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestPropagation_003.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestPropagation_003.java index 9b38077ceb4..13f39568415 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestPropagation_003.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestPropagation_003.java @@ -20,7 +20,6 @@ import org.eclipse.osgi.tests.services.resolver.AbstractStateTest; import org.osgi.framework.BundleException; - public class TestPropagation_003 extends AbstractStateTest { public TestPropagation_003(String testName) { super(testName); @@ -31,7 +30,6 @@ public TestPropagation_003(String testName) { BundleDescription bundle_3 = null; BundleDescription bundle_4 = null; - public void testTest_001() { State state = buildEmptyState(); StateObjectFactory sof = StateObjectFactory.defaultFactory; @@ -40,24 +38,22 @@ public void testTest_001() { bundle_2 = create_bundle_2(sof); bundle_3 = create_bundle_3(sof); bundle_4 = create_bundle_4(sof); - //*************************************************** + // *************************************************** // stage a // expect to pass =true - //*************************************************** + // *************************************************** addBundlesToState_a(state); - //*************************************************** + // *************************************************** try { state.resolve(); } catch (Throwable t) { - fail("unexpected exception class=" + t.getClass().getName() - + " message=" + t.getMessage()); + fail("unexpected exception class=" + t.getClass().getName() + " message=" + t.getMessage()); return; } checkBundlesResolved_a(); checkWiring_a(); } // end of method - public void checkWiringState_1() { } // end method @@ -81,7 +77,6 @@ public void checkWiringState_3() { public void checkWiringState_4() { } // end method - public void checkWiring_a() { checkWiringState_1(); checkWiringState_2(); @@ -89,7 +84,6 @@ public void checkWiring_a() { checkWiringState_4(); } // end method - public void addBundlesToState_a(State state) { boolean added = false; added = state.addBundle(bundle_1); @@ -102,7 +96,6 @@ public void addBundlesToState_a(State state) { assertTrue("failed to add bundle ", added); } // end method - public void checkBundlesResolved_a() { assertTrue("unexpected bundle resolution state", !bundle_1.isResolved()); assertTrue("unexpected bundle resolution state", bundle_2.isResolved()); @@ -110,7 +103,6 @@ public void checkBundlesResolved_a() { assertTrue("unexpected bundle resolution state", bundle_4.isResolved()); } // end method - public BundleDescription create_bundle_1(StateObjectFactory sof) { java.util.Dictionary dictionary_1 = new java.util.Properties(); BundleDescription bundle = null; diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestRFC79_001.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestRFC79_001.java index 1498cb38de8..3d4bf7058c8 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestRFC79_001.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestRFC79_001.java @@ -20,7 +20,6 @@ import org.eclipse.osgi.tests.services.resolver.AbstractStateTest; import org.osgi.framework.BundleException; - public class TestRFC79_001 extends AbstractStateTest { public TestRFC79_001(String testName) { super(testName); @@ -30,7 +29,6 @@ public TestRFC79_001(String testName) { BundleDescription bundle_2 = null; BundleDescription bundle_3 = null; - public void testTest_001() { State state = buildEmptyState(); StateObjectFactory sof = StateObjectFactory.defaultFactory; @@ -38,24 +36,22 @@ public void testTest_001() { bundle_1 = create_bundle_1(sof); bundle_2 = create_bundle_2(sof); bundle_3 = create_bundle_3(sof); - //*************************************************** + // *************************************************** // stage a // expect to pass =true - //*************************************************** + // *************************************************** addBundlesToState_a(state); - //*************************************************** + // *************************************************** try { state.resolve(); } catch (Throwable t) { - fail("unexpected exception class=" + t.getClass().getName() - + " message=" + t.getMessage()); + fail("unexpected exception class=" + t.getClass().getName() + " message=" + t.getMessage()); return; } checkBundlesResolved_a(); checkWiring_a(); } // end of method - public void checkWiringState_1() { ExportPackageDescription[] exports = bundle_1.getResolvedImports(); assertNotNull("export array is unexpectedly null", exports); @@ -98,14 +94,12 @@ public void checkWiringState_3() { } // end for } // end method - public void checkWiring_a() { checkWiringState_1(); checkWiringState_2(); checkWiringState_3(); } // end method - public void addBundlesToState_a(State state) { boolean added = false; added = state.addBundle(bundle_1); @@ -116,14 +110,12 @@ public void addBundlesToState_a(State state) { assertTrue("failed to add bundle ", added); } // end method - public void checkBundlesResolved_a() { assertTrue("unexpected bundle resolution state", bundle_1.isResolved()); assertTrue("unexpected bundle resolution state", bundle_2.isResolved()); assertTrue("unexpected bundle resolution state", bundle_3.isResolved()); } // end method - public BundleDescription create_bundle_1(StateObjectFactory sof) { java.util.Dictionary dictionary_1 = new java.util.Properties(); BundleDescription bundle = null; diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestRFC79_002.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestRFC79_002.java index c45da1b4b6c..2eb373b6534 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestRFC79_002.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestRFC79_002.java @@ -20,7 +20,6 @@ import org.eclipse.osgi.tests.services.resolver.AbstractStateTest; import org.osgi.framework.BundleException; - public class TestRFC79_002 extends AbstractStateTest { public TestRFC79_002(String testName) { super(testName); @@ -32,7 +31,6 @@ public TestRFC79_002(String testName) { BundleDescription bundle_4 = null; BundleDescription bundle_5 = null; - public void testTest_002() { State state = buildEmptyState(); StateObjectFactory sof = StateObjectFactory.defaultFactory; @@ -42,24 +40,22 @@ public void testTest_002() { bundle_3 = create_bundle_3(sof); bundle_4 = create_bundle_4(sof); bundle_5 = create_bundle_5(sof); - //*************************************************** + // *************************************************** // stage a // expect to pass =true - //*************************************************** + // *************************************************** addBundlesToState_a(state); - //*************************************************** + // *************************************************** try { state.resolve(); } catch (Throwable t) { - fail("unexpected exception class=" + t.getClass().getName() - + " message=" + t.getMessage()); + fail("unexpected exception class=" + t.getClass().getName() + " message=" + t.getMessage()); return; } checkBundlesResolved_a(); checkWiring_a(); } // end of method - public void checkWiringState_1() { ExportPackageDescription[] exports = bundle_1.getResolvedImports(); assertNotNull("export array is unexpectedly null", exports); @@ -136,7 +132,6 @@ public void checkWiringState_5() { } // end for } // end method - public void checkWiring_a() { checkWiringState_1(); checkWiringState_2(); @@ -145,7 +140,6 @@ public void checkWiring_a() { checkWiringState_5(); } // end method - public void addBundlesToState_a(State state) { boolean added = false; added = state.addBundle(bundle_1); @@ -160,7 +154,6 @@ public void addBundlesToState_a(State state) { assertTrue("failed to add bundle ", added); } // end method - public void checkBundlesResolved_a() { assertTrue("unexpected bundle resolution state", bundle_1.isResolved()); assertTrue("unexpected bundle resolution state", bundle_2.isResolved()); @@ -169,7 +162,6 @@ public void checkBundlesResolved_a() { assertTrue("unexpected bundle resolution state", bundle_5.isResolved()); } // end method - public BundleDescription create_bundle_1(StateObjectFactory sof) { java.util.Dictionary dictionary_1 = new java.util.Properties(); BundleDescription bundle = null; diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestRFC79_003.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestRFC79_003.java index d116a1624a0..2f6826ba085 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestRFC79_003.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestRFC79_003.java @@ -20,7 +20,6 @@ import org.eclipse.osgi.tests.services.resolver.AbstractStateTest; import org.osgi.framework.BundleException; - public class TestRFC79_003 extends AbstractStateTest { public TestRFC79_003(String testName) { super(testName); @@ -31,7 +30,6 @@ public TestRFC79_003(String testName) { BundleDescription bundle_3 = null; BundleDescription bundle_4 = null; - public void testTest_003() { State state = buildEmptyState(); StateObjectFactory sof = StateObjectFactory.defaultFactory; @@ -40,24 +38,22 @@ public void testTest_003() { bundle_2 = create_bundle_2(sof); bundle_3 = create_bundle_3(sof); bundle_4 = create_bundle_4(sof); - //*************************************************** + // *************************************************** // stage a // expect to pass =true - //*************************************************** + // *************************************************** addBundlesToState_a(state); - //*************************************************** + // *************************************************** try { state.resolve(); } catch (Throwable t) { - fail("unexpected exception class=" + t.getClass().getName() - + " message=" + t.getMessage()); + fail("unexpected exception class=" + t.getClass().getName() + " message=" + t.getMessage()); return; } checkBundlesResolved_a(); checkWiring_a(); } // end of method - public void checkWiringState_1() { ExportPackageDescription[] exports = bundle_1.getResolvedImports(); assertNotNull("export array is unexpectedly null", exports); @@ -120,8 +116,6 @@ public void checkWiringState_4() { } // end for } // end method - - public void checkWiring_a() { checkWiringState_1(); checkWiringState_2(); @@ -129,7 +123,6 @@ public void checkWiring_a() { checkWiringState_4(); } // end method - public void addBundlesToState_a(State state) { boolean added = false; added = state.addBundle(bundle_1); @@ -142,7 +135,6 @@ public void addBundlesToState_a(State state) { assertTrue("failed to add bundle ", added); } // end method - public void checkBundlesResolved_a() { assertTrue("unexpected bundle resolution state", bundle_1.isResolved()); assertTrue("unexpected bundle resolution state", bundle_2.isResolved()); @@ -150,7 +142,6 @@ public void checkBundlesResolved_a() { assertTrue("unexpected bundle resolution state", bundle_4.isResolved()); } // end method - public BundleDescription create_bundle_1(StateObjectFactory sof) { java.util.Dictionary dictionary_1 = new java.util.Properties(); BundleDescription bundle = null; @@ -186,7 +177,8 @@ public BundleDescription create_bundle_3(StateObjectFactory sof) { BundleDescription bundle = null; dictionary_3.put("Bundle-ManifestVersion", "2"); dictionary_3.put("Bundle-SymbolicName", "C"); - dictionary_3.put("Import-Package", "javax.servlet; version=2.1.0, org.foo.impl; version=\"[1.0.0, 1.0.0]\"; bundle-symbolic-name=A"); + dictionary_3.put("Import-Package", + "javax.servlet; version=2.1.0, org.foo.impl; version=\"[1.0.0, 1.0.0]\"; bundle-symbolic-name=A"); try { bundle = sof.createBundleDescription(dictionary_3, "bundle_3", 3); } catch (BundleException be) { @@ -209,5 +201,4 @@ public BundleDescription create_bundle_4(StateObjectFactory sof) { return bundle; } // end of method - } // end of testcase diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestRFC79_004.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestRFC79_004.java index b04b7831940..bfef98734a8 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestRFC79_004.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestRFC79_004.java @@ -20,7 +20,6 @@ import org.eclipse.osgi.tests.services.resolver.AbstractStateTest; import org.osgi.framework.BundleException; - public class TestRFC79_004 extends AbstractStateTest { public TestRFC79_004(String testName) { super(testName); @@ -31,7 +30,6 @@ public TestRFC79_004(String testName) { BundleDescription bundle_3 = null; BundleDescription bundle_4 = null; - public void testTest_004() { State state = buildEmptyState(); StateObjectFactory sof = StateObjectFactory.defaultFactory; @@ -40,24 +38,22 @@ public void testTest_004() { bundle_2 = create_bundle_2(sof); bundle_3 = create_bundle_3(sof); bundle_4 = create_bundle_4(sof); - //*************************************************** + // *************************************************** // stage a // expect to pass =true - //*************************************************** + // *************************************************** addBundlesToState_a(state); - //*************************************************** + // *************************************************** try { state.resolve(); } catch (Throwable t) { - fail("unexpected exception class=" + t.getClass().getName() - + " message=" + t.getMessage()); + fail("unexpected exception class=" + t.getClass().getName() + " message=" + t.getMessage()); return; } checkBundlesResolved_a(); checkWiring_a(); } // end of method - public void checkWiringState_1() { ExportPackageDescription[] exports = bundle_1.getResolvedImports(); assertNotNull("export array is unexpectedly null", exports); @@ -66,8 +62,10 @@ public void checkWiringState_1() { String exportPackageName = export.getName(); assertNotNull("package name is null", exportPackageName); if (exportPackageName.equals("org.apache.commons.logging")) { - assertNotNull("Package [org.apache.commons.logging] is not wired when it should be ", export.getExporter()); - assertEquals("Package [org.apache.commons.logging] is wired incorrectly ", export.getExporter(), bundle_4); + assertNotNull("Package [org.apache.commons.logging] is not wired when it should be ", + export.getExporter()); + assertEquals("Package [org.apache.commons.logging] is wired incorrectly ", export.getExporter(), + bundle_4); } else if (exportPackageName.equals("org.apache.commons.io")) { assertNotNull("Package [org.apache.commons.io] is not wired when it should be ", export.getExporter()); assertEquals("Package [org.apache.commons.io] is wired incorrectly ", export.getExporter(), bundle_4); @@ -83,8 +81,10 @@ public void checkWiringState_2() { String exportPackageName = export.getName(); assertNotNull("package name is null", exportPackageName); if (exportPackageName.equals("org.apache.commons.logging")) { - assertNotNull("Package [org.apache.commons.logging] is not wired when it should be ", export.getExporter()); - assertEquals("Package [org.apache.commons.logging] is wired incorrectly ", export.getExporter(), bundle_3); + assertNotNull("Package [org.apache.commons.logging] is not wired when it should be ", + export.getExporter()); + assertEquals("Package [org.apache.commons.logging] is wired incorrectly ", export.getExporter(), + bundle_3); } else if (exportPackageName.equals("org.apache.commons.io")) { assertNotNull("Package [org.apache.commons.io] is not wired when it should be ", export.getExporter()); assertEquals("Package [org.apache.commons.io] is wired incorrectly ", export.getExporter(), bundle_3); @@ -98,8 +98,6 @@ public void checkWiringState_3() { public void checkWiringState_4() { } // end method - - public void checkWiring_a() { checkWiringState_1(); checkWiringState_2(); @@ -107,7 +105,6 @@ public void checkWiring_a() { checkWiringState_4(); } // end method - public void addBundlesToState_a(State state) { boolean added = false; added = state.addBundle(bundle_1); @@ -120,7 +117,6 @@ public void addBundlesToState_a(State state) { assertTrue("failed to add bundle ", added); } // end method - public void checkBundlesResolved_a() { assertTrue("unexpected bundle resolution state", bundle_1.isResolved()); assertTrue("unexpected bundle resolution state", bundle_2.isResolved()); @@ -128,7 +124,6 @@ public void checkBundlesResolved_a() { assertTrue("unexpected bundle resolution state", bundle_4.isResolved()); } // end method - public BundleDescription create_bundle_1(StateObjectFactory sof) { java.util.Dictionary dictionary_1 = new java.util.Properties(); BundleDescription bundle = null; @@ -148,7 +143,8 @@ public BundleDescription create_bundle_2(StateObjectFactory sof) { BundleDescription bundle = null; dictionary_2.put("Bundle-ManifestVersion", "2"); dictionary_2.put("Bundle-SymbolicName", "B"); - dictionary_2.put("Import-Package", "org.apache.commons.logging; version=2.0.0, org.apache.commons.io; version=\"[2.0.0, 2.0.0]\""); + dictionary_2.put("Import-Package", + "org.apache.commons.logging; version=2.0.0, org.apache.commons.io; version=\"[2.0.0, 2.0.0]\""); try { bundle = sof.createBundleDescription(dictionary_2, "bundle_2", 2); } catch (BundleException be) { @@ -162,7 +158,8 @@ public BundleDescription create_bundle_3(StateObjectFactory sof) { BundleDescription bundle = null; dictionary_3.put("Bundle-ManifestVersion", "2"); dictionary_3.put("Bundle-SymbolicName", "ApacheCommons"); - dictionary_3.put("Export-Package", "org.apache.commons.logging; org.apache.commons.io; version=2.0.0; uses:=\"org.apache.commons.logging,org.apache.commons.io\""); + dictionary_3.put("Export-Package", + "org.apache.commons.logging; org.apache.commons.io; version=2.0.0; uses:=\"org.apache.commons.logging,org.apache.commons.io\""); try { bundle = sof.createBundleDescription(dictionary_3, "bundle_3", 3); } catch (BundleException be) { @@ -176,7 +173,8 @@ public BundleDescription create_bundle_4(StateObjectFactory sof) { BundleDescription bundle = null; dictionary_4.put("Bundle-ManifestVersion", "2"); dictionary_4.put("Bundle-SymbolicName", "ApacheCommons'"); - dictionary_4.put("Export-Package", "org.apache.commons.logging; org.apache.commons.io; version=2.1.0; uses:=\"org.apache.commons.logging,org.apache.commons.io\""); + dictionary_4.put("Export-Package", + "org.apache.commons.logging; org.apache.commons.io; version=2.1.0; uses:=\"org.apache.commons.logging,org.apache.commons.io\""); try { bundle = sof.createBundleDescription(dictionary_4, "bundle_4", 4); } catch (BundleException be) { @@ -185,5 +183,4 @@ public BundleDescription create_bundle_4(StateObjectFactory sof) { return bundle; } // end of method - } // end of testcase diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestRFC79_005.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestRFC79_005.java index 8a5bbad828a..28a703c718e 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestRFC79_005.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestRFC79_005.java @@ -20,7 +20,6 @@ import org.eclipse.osgi.tests.services.resolver.AbstractStateTest; import org.osgi.framework.BundleException; - public class TestRFC79_005 extends AbstractStateTest { public TestRFC79_005(String testName) { super(testName); @@ -30,7 +29,6 @@ public TestRFC79_005(String testName) { BundleDescription bundle_2 = null; BundleDescription bundle_3 = null; - public void testTest_005() { State state = buildEmptyState(); StateObjectFactory sof = StateObjectFactory.defaultFactory; @@ -38,24 +36,22 @@ public void testTest_005() { bundle_1 = create_bundle_1(sof); bundle_2 = create_bundle_2(sof); bundle_3 = create_bundle_3(sof); - //*************************************************** + // *************************************************** // stage a // expect to pass =true - //*************************************************** + // *************************************************** addBundlesToState_a(state); - //*************************************************** + // *************************************************** try { state.resolve(); } catch (Throwable t) { - fail("unexpected exception class=" + t.getClass().getName() - + " message=" + t.getMessage()); + fail("unexpected exception class=" + t.getClass().getName() + " message=" + t.getMessage()); return; } checkBundlesResolved_a(); checkWiring_a(); } // end of method - public void checkWiringState_1() { ExportPackageDescription[] exports = bundle_1.getResolvedImports(); assertNotNull("export array is unexpectedly null", exports); @@ -87,14 +83,12 @@ public void checkWiringState_2() { public void checkWiringState_3() { } // end method - public void checkWiring_a() { checkWiringState_1(); checkWiringState_2(); checkWiringState_3(); } // end method - public void addBundlesToState_a(State state) { boolean added = false; added = state.addBundle(bundle_1); @@ -105,14 +99,12 @@ public void addBundlesToState_a(State state) { assertTrue("failed to add bundle ", added); } // end method - public void checkBundlesResolved_a() { assertTrue("unexpected bundle resolution state", bundle_1.isResolved()); assertTrue("unexpected bundle resolution state", bundle_2.isResolved()); assertTrue("unexpected bundle resolution state", !bundle_3.isResolved()); } // end method - public BundleDescription create_bundle_1(StateObjectFactory sof) { java.util.Dictionary dictionary_1 = new java.util.Properties(); BundleDescription bundle = null; diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestRFC79_006.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestRFC79_006.java index 6b2d9b0c597..2606cac1d4b 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestRFC79_006.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestRFC79_006.java @@ -20,7 +20,6 @@ import org.eclipse.osgi.tests.services.resolver.AbstractStateTest; import org.osgi.framework.BundleException; - public class TestRFC79_006 extends AbstractStateTest { public TestRFC79_006(String testName) { super(testName); @@ -33,7 +32,6 @@ public TestRFC79_006(String testName) { BundleDescription bundle_5 = null; BundleDescription bundle_6 = null; - public void testTest_006() { State state = buildEmptyState(); StateObjectFactory sof = StateObjectFactory.defaultFactory; @@ -44,24 +42,22 @@ public void testTest_006() { bundle_4 = create_bundle_4(sof); bundle_5 = create_bundle_5(sof); bundle_6 = create_bundle_6(sof); - //*************************************************** + // *************************************************** // stage a // expect to pass =true - //*************************************************** + // *************************************************** addBundlesToState_a(state); - //*************************************************** + // *************************************************** try { state.resolve(); } catch (Throwable t) { - fail("unexpected exception class=" + t.getClass().getName() - + " message=" + t.getMessage()); + fail("unexpected exception class=" + t.getClass().getName() + " message=" + t.getMessage()); return; } checkBundlesResolved_a(); checkWiring_a(); } // end of method - public void checkWiringState_1() { ExportPackageDescription[] exports = bundle_1.getResolvedImports(); assertNotNull("export array is unexpectedly null", exports); @@ -120,7 +116,6 @@ public void checkWiring_a() { checkWiringState_6(); } // end method - public void addBundlesToState_a(State state) { boolean added = false; added = state.addBundle(bundle_1); @@ -137,7 +132,6 @@ public void addBundlesToState_a(State state) { assertTrue("failed to add bundle ", added); } // end method - public void checkBundlesResolved_a() { assertTrue("unexpected bundle resolution state", bundle_1.isResolved()); assertTrue("unexpected bundle resolution state", !bundle_2.isResolved()); @@ -147,13 +141,13 @@ public void checkBundlesResolved_a() { assertTrue("unexpected bundle resolution state", bundle_6.isResolved()); } // end method - public BundleDescription create_bundle_1(StateObjectFactory sof) { java.util.Dictionary dictionary_1 = new java.util.Properties(); BundleDescription bundle = null; dictionary_1.put("Bundle-ManifestVersion", "2"); dictionary_1.put("Bundle-SymbolicName", "Client A"); - dictionary_1.put("Import-Package", "org.xml.sax; version=\"[1.3.0, 1.3.0]\", org.w3c.dom; version=\"[2.1.0, 2.1.0]\", javax.xml.parsers; version=\"[1.1.0, 1.1.0]\""); + dictionary_1.put("Import-Package", + "org.xml.sax; version=\"[1.3.0, 1.3.0]\", org.w3c.dom; version=\"[2.1.0, 2.1.0]\", javax.xml.parsers; version=\"[1.1.0, 1.1.0]\""); try { bundle = sof.createBundleDescription(dictionary_1, "bundle_1", 1); } catch (BundleException be) { @@ -167,7 +161,8 @@ public BundleDescription create_bundle_2(StateObjectFactory sof) { BundleDescription bundle = null; dictionary_2.put("Bundle-ManifestVersion", "2"); dictionary_2.put("Bundle-SymbolicName", "Client B"); - dictionary_2.put("Import-Package", "org.xml.sax; version=\"[1.3.0, 1.3.0]\", org.w3c.dom; version=\"[2.2.0, 2.2.0]\", javax.xml.parsers; version=\"[1.1.0, 1.1.0]\""); + dictionary_2.put("Import-Package", + "org.xml.sax; version=\"[1.3.0, 1.3.0]\", org.w3c.dom; version=\"[2.2.0, 2.2.0]\", javax.xml.parsers; version=\"[1.1.0, 1.1.0]\""); try { bundle = sof.createBundleDescription(dictionary_2, "bundle_2", 2); } catch (BundleException be) { @@ -224,7 +219,8 @@ public BundleDescription create_bundle_6(StateObjectFactory sof) { dictionary_6.put("Bundle-ManifestVersion", "2"); dictionary_6.put("Bundle-SymbolicName", "JAXP"); dictionary_6.put("Export-Package", "javax.xml.parsers; version=1.1.0; uses:=\"org.w3c.dom,org.xml.sax\""); - dictionary_6.put("Import-Package", "org.w3c.dom; version=\"[2.1.0, 2.1.0]\", org.xml.sax; version=\"[1.3.0, 1.3.0]\""); + dictionary_6.put("Import-Package", + "org.w3c.dom; version=\"[2.1.0, 2.1.0]\", org.xml.sax; version=\"[1.3.0, 1.3.0]\""); try { bundle = sof.createBundleDescription(dictionary_6, "bundle_6", 6); } catch (BundleException be) { diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestRFC79_007.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestRFC79_007.java index 9fe9e5a8106..32c50885fdc 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestRFC79_007.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestRFC79_007.java @@ -20,7 +20,6 @@ import org.eclipse.osgi.tests.services.resolver.AbstractStateTest; import org.osgi.framework.BundleException; - public class TestRFC79_007 extends AbstractStateTest { public TestRFC79_007(String testName) { super(testName); @@ -32,7 +31,6 @@ public TestRFC79_007(String testName) { BundleDescription bundle_4 = null; BundleDescription bundle_5 = null; - public void testTest_007() { State state = buildEmptyState(); StateObjectFactory sof = StateObjectFactory.defaultFactory; @@ -42,24 +40,22 @@ public void testTest_007() { bundle_3 = create_bundle_3(sof); bundle_4 = create_bundle_4(sof); bundle_5 = create_bundle_5(sof); - //*************************************************** + // *************************************************** // stage a // expect to pass =true - //*************************************************** + // *************************************************** addBundlesToState_a(state); - //*************************************************** + // *************************************************** try { state.resolve(); } catch (Throwable t) { - fail("unexpected exception class=" + t.getClass().getName() - + " message=" + t.getMessage()); + fail("unexpected exception class=" + t.getClass().getName() + " message=" + t.getMessage()); return; } checkBundlesResolved_a(); checkWiring_a(); } // end of method - public void checkWiringState_1() { ExportPackageDescription[] exports = bundle_1.getResolvedImports(); assertNotNull("export array is unexpectedly null", exports); @@ -100,7 +96,6 @@ public void checkWiringState_4() { public void checkWiringState_5() { } // end method - public void checkWiring_a() { checkWiringState_1(); checkWiringState_2(); @@ -109,7 +104,6 @@ public void checkWiring_a() { checkWiringState_5(); } // end method - public void addBundlesToState_a(State state) { boolean added = false; added = state.addBundle(bundle_1); @@ -124,7 +118,6 @@ public void addBundlesToState_a(State state) { assertTrue("failed to add bundle ", added); } // end method - public void checkBundlesResolved_a() { assertTrue("unexpected bundle resolution state", bundle_1.isResolved()); assertTrue("unexpected bundle resolution state", bundle_2.isResolved()); @@ -133,7 +126,6 @@ public void checkBundlesResolved_a() { assertTrue("unexpected bundle resolution state", bundle_5.isResolved()); } // end method - public BundleDescription create_bundle_1(StateObjectFactory sof) { java.util.Dictionary dictionary_1 = new java.util.Properties(); BundleDescription bundle = null; diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestVersion_001.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestVersion_001.java index dad687e0a23..d20c753251a 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestVersion_001.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestVersion_001.java @@ -20,7 +20,6 @@ import org.eclipse.osgi.tests.services.resolver.AbstractStateTest; import org.osgi.framework.BundleException; - public class TestVersion_001 extends AbstractStateTest { public TestVersion_001(String testName) { super(testName); @@ -30,7 +29,6 @@ public TestVersion_001(String testName) { BundleDescription bundle_2 = null; BundleDescription bundle_3 = null; - public void testTest_001() { State state = buildEmptyState(); StateObjectFactory sof = StateObjectFactory.defaultFactory; @@ -38,24 +36,22 @@ public void testTest_001() { bundle_1 = create_bundle_1(sof); bundle_2 = create_bundle_2(sof); bundle_3 = create_bundle_3(sof); - //*************************************************** + // *************************************************** // stage a // expect to pass =true - //*************************************************** + // *************************************************** addBundlesToState_a(state); - //*************************************************** + // *************************************************** try { state.resolve(); } catch (Throwable t) { - fail("unexpected exception class=" + t.getClass().getName() - + " message=" + t.getMessage()); + fail("unexpected exception class=" + t.getClass().getName() + " message=" + t.getMessage()); return; } checkBundlesResolved_a(); checkWiring_a(); } // end of method - public void checkWiringState_1() { ExportPackageDescription[] exports = bundle_1.getResolvedImports(); assertNotNull("export array is unexpectedly null", exports); @@ -98,14 +94,12 @@ public void checkWiringState_3() { } // end for } // end method - public void checkWiring_a() { checkWiringState_1(); checkWiringState_2(); checkWiringState_3(); } // end method - public void addBundlesToState_a(State state) { boolean added = false; added = state.addBundle(bundle_1); @@ -116,14 +110,12 @@ public void addBundlesToState_a(State state) { assertTrue("failed to add bundle ", added); } // end method - public void checkBundlesResolved_a() { assertTrue("unexpected bundle resolution state", bundle_1.isResolved()); assertTrue("unexpected bundle resolution state", bundle_2.isResolved()); assertTrue("unexpected bundle resolution state", bundle_3.isResolved()); } // end method - public BundleDescription create_bundle_1(StateObjectFactory sof) { java.util.Dictionary dictionary_1 = new java.util.Properties(); BundleDescription bundle = null; @@ -168,5 +160,4 @@ public BundleDescription create_bundle_3(StateObjectFactory sof) { return bundle; } // end of method - } // end of testcase diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestVersion_002.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestVersion_002.java index 1609bebcd3e..c0a9375ff75 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestVersion_002.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestVersion_002.java @@ -20,7 +20,6 @@ import org.eclipse.osgi.tests.services.resolver.AbstractStateTest; import org.osgi.framework.BundleException; - public class TestVersion_002 extends AbstractStateTest { public TestVersion_002(String testName) { super(testName); @@ -30,7 +29,6 @@ public TestVersion_002(String testName) { BundleDescription bundle_2 = null; BundleDescription bundle_3 = null; - public void testTest_002() { State state = buildEmptyState(); StateObjectFactory sof = StateObjectFactory.defaultFactory; @@ -38,24 +36,22 @@ public void testTest_002() { bundle_1 = create_bundle_1(sof); bundle_2 = create_bundle_2(sof); bundle_3 = create_bundle_3(sof); - //*************************************************** + // *************************************************** // stage a // expect to pass =true - //*************************************************** + // *************************************************** addBundlesToState_a(state); - //*************************************************** + // *************************************************** try { state.resolve(); } catch (Throwable t) { - fail("unexpected exception class=" + t.getClass().getName() - + " message=" + t.getMessage()); + fail("unexpected exception class=" + t.getClass().getName() + " message=" + t.getMessage()); return; } checkBundlesResolved_a(); checkWiring_a(); } // end of method - public void checkWiringState_1() { ExportPackageDescription[] exports = bundle_1.getResolvedImports(); assertNotNull("export array is unexpectedly null", exports); @@ -87,14 +83,12 @@ public void checkWiringState_2() { public void checkWiringState_3() { } // end method - public void checkWiring_a() { checkWiringState_1(); checkWiringState_2(); checkWiringState_3(); } // end method - public void addBundlesToState_a(State state) { boolean added = false; added = state.addBundle(bundle_1); @@ -105,14 +99,12 @@ public void addBundlesToState_a(State state) { assertTrue("failed to add bundle ", added); } // end method - public void checkBundlesResolved_a() { assertTrue("unexpected bundle resolution state", bundle_1.isResolved()); assertTrue("unexpected bundle resolution state", bundle_2.isResolved()); assertTrue("unexpected bundle resolution state", bundle_3.isResolved()); } // end method - public BundleDescription create_bundle_1(StateObjectFactory sof) { java.util.Dictionary dictionary_1 = new java.util.Properties(); BundleDescription bundle = null; @@ -156,5 +148,4 @@ public BundleDescription create_bundle_3(StateObjectFactory sof) { return bundle; } // end of method - } // end of testcase diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestVersion_003.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestVersion_003.java index ec5f65f5ba2..6736254ce3a 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestVersion_003.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestVersion_003.java @@ -20,7 +20,6 @@ import org.eclipse.osgi.tests.services.resolver.AbstractStateTest; import org.osgi.framework.BundleException; - public class TestVersion_003 extends AbstractStateTest { public TestVersion_003(String testName) { super(testName); @@ -30,7 +29,6 @@ public TestVersion_003(String testName) { BundleDescription bundle_2 = null; BundleDescription bundle_3 = null; - public void testTest_003() { State state = buildEmptyState(); StateObjectFactory sof = StateObjectFactory.defaultFactory; @@ -38,24 +36,22 @@ public void testTest_003() { bundle_1 = create_bundle_1(sof); bundle_2 = create_bundle_2(sof); bundle_3 = create_bundle_3(sof); - //*************************************************** + // *************************************************** // stage a // expect to pass =true - //*************************************************** + // *************************************************** addBundlesToState_a(state); - //*************************************************** + // *************************************************** try { state.resolve(); } catch (Throwable t) { - fail("unexpected exception class=" + t.getClass().getName() - + " message=" + t.getMessage()); + fail("unexpected exception class=" + t.getClass().getName() + " message=" + t.getMessage()); return; } checkBundlesResolved_a(); checkWiring_a(); } // end of method - public void checkWiringState_1() { ExportPackageDescription[] exports = bundle_1.getResolvedImports(); assertNotNull("export array is unexpectedly null", exports); @@ -76,14 +72,12 @@ public void checkWiringState_2() { public void checkWiringState_3() { } // end method - public void checkWiring_a() { checkWiringState_1(); checkWiringState_2(); checkWiringState_3(); } // end method - public void addBundlesToState_a(State state) { boolean added = false; added = state.addBundle(bundle_1); @@ -94,14 +88,12 @@ public void addBundlesToState_a(State state) { assertTrue("failed to add bundle ", added); } // end method - public void checkBundlesResolved_a() { assertTrue("unexpected bundle resolution state", bundle_1.isResolved()); assertTrue("unexpected bundle resolution state", !bundle_2.isResolved()); assertTrue("unexpected bundle resolution state", bundle_3.isResolved()); } // end method - public BundleDescription create_bundle_1(StateObjectFactory sof) { java.util.Dictionary dictionary_1 = new java.util.Properties(); BundleDescription bundle = null; diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resource/AbstractResourceTest.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resource/AbstractResourceTest.java index 01ea6f2dd38..9f3ddc5f8d4 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resource/AbstractResourceTest.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resource/AbstractResourceTest.java @@ -32,7 +32,8 @@ public AbstractResourceTest(String name) { protected void setUp() throws Exception { super.setUp(); try { - installer = new BundleInstaller(OSGiTestsActivator.TEST_FILES_ROOT + "wiringTests/bundles", OSGiTestsActivator.getContext()); //$NON-NLS-1$ + installer = new BundleInstaller(OSGiTestsActivator.TEST_FILES_ROOT + "wiringTests/bundles", //$NON-NLS-1$ + OSGiTestsActivator.getContext()); } catch (InvalidSyntaxException e) { fail("Failed to create bundle installer", e); //$NON-NLS-1$ } diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resource/BasicTest.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resource/BasicTest.java index 0a652472a0a..0c72aaedb79 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resource/BasicTest.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resource/BasicTest.java @@ -91,7 +91,8 @@ public void testRequirementMatches() throws Exception { List requirements = requirer.getRequirements(capability1.getNamespace()); assertRequirements(requirements, 3); Requirement requirement1 = (Requirement) requirements.get(0); - // Match requirement with just a namespace (no filter, attributes, or directives). + // Match requirement with just a namespace (no filter, attributes, or + // directives). assertRequirementMatches(requirement1, capability1); Capability capability2 = createCapability2(); // Different namespaces should not match. @@ -99,13 +100,15 @@ public void testRequirementMatches() throws Exception { Requirement requirement2 = (Requirement) requirements.get(1); // Make sure the expected attributes are present. assertAttribute(requirement2, "b", "a"); - // Match requirement with namespace and attributes. Requirement attributes have no impact on matching. + // Match requirement with namespace and attributes. Requirement attributes have + // no impact on matching. assertRequirementMatches(requirement2, capability1); Requirement requirement3 = (Requirement) requirements.get(2); assertAttribute(requirement3, "b", "a"); assertAttribute(requirement3, "bar", "foo"); assertFilterDirective(requirement3); - // Match requirement with namespace, attributes, and filter (no other directives). + // Match requirement with namespace, attributes, and filter (no other + // directives). assertRequirementMatches(requirement3, capability1); Requirement requirement4 = (Requirement) requirements.get(3); assertAttribute(requirement4, "a", "b"); @@ -119,7 +122,8 @@ public void testRequirementMatches() throws Exception { assertAttribute(requirement5, "y", "x"); assertFilterDirective(requirement5); assertDirective(requirement5, "mandatory", "foo,x"); - // Mandatory directive should have no impact on generic capabilities or requirements. + // Mandatory directive should have no impact on generic capabilities or + // requirements. assertRequirementMatches(requirement5, capability2); } @@ -146,16 +150,11 @@ public void testIdentity() throws Exception { } /* - * TB1 - * Requirements: - * None - * Capabilities: - * osgi.identity;osgi.identity=resource.tb1;version=1.0.0;type=osgi.bundle - * osgi.wiring.host;osgi.wiring.host=resource.tb1;version=1.0.0 - * Wires: - * osgi.identity <-> TB3 - * osgi.wiring.host <-> TF1 - * TB4 <-> osgi.identity (via TF1) + * TB1 Requirements: None Capabilities: + * osgi.identity;osgi.identity=resource.tb1;version=1.0.0;type=osgi.bundle + * osgi.wiring.host;osgi.wiring.host=resource.tb1;version=1.0.0 Wires: + * osgi.identity <-> TB3 osgi.wiring.host <-> TF1 TB4 <-> osgi.identity (via + * TF1) */ private void assertTb1() { // Get the revision for TB1. @@ -205,13 +204,7 @@ private void assertTb1() { } /* - * TB2 - * Requirements: - * None - * Capabilities: - * None - * Wires: - * None + * TB2 Requirements: None Capabilities: None Wires: None */ private void assertTb2() { final BundleRevision revision = tb2.adapt(BundleRevision.class); @@ -223,16 +216,13 @@ private void assertTb2() { } /* - * TB3 - * Requirements: - * osgi.identity;osgi.identity=resource.tb1;version=1.0.0;type=osgi.bundle - * osgi.identity;osgi.identity=resource.tf1;version=1.0.0;type=osgi.fragment + * TB3 Requirements: + * osgi.identity;osgi.identity=resource.tb1;version=1.0.0;type=osgi.bundle + * osgi.identity;osgi.identity=resource.tf1;version=1.0.0;type=osgi.fragment * Capabilities: - * osgi.identity;osgi.identity=resource.tb3;version=1.0.0;type=osgi.bundle - * osgi.wiring.host;osgi.wiring.host=resource.tb3;version=1.0.0 - * Wires: - * TB1 <-> osgi.identity - * TF1 <-> osgi.identity + * osgi.identity;osgi.identity=resource.tb3;version=1.0.0;type=osgi.bundle + * osgi.wiring.host;osgi.wiring.host=resource.tb3;version=1.0.0 Wires: TB1 <-> + * osgi.identity TF1 <-> osgi.identity */ private void assertTb3() { // Get the revision for TB3. @@ -274,14 +264,10 @@ private void assertTb3() { } /* - * TB4 - * Requirements: - * None - * Capabilities: - * osgi.identity;osgi.identity=resource.tb4;version=1.0.0;type=osgi.bundle - * osgi.wiring.host;osgi.wiring.host=resource.tb4;version=1.0.0 - * Wires: - * osgi.identity <-> TB1 (via TF1) + * TB4 Requirements: None Capabilities: + * osgi.identity;osgi.identity=resource.tb4;version=1.0.0;type=osgi.bundle + * osgi.wiring.host;osgi.wiring.host=resource.tb4;version=1.0.0 Wires: + * osgi.identity <-> TB1 (via TF1) */ private void assertTb4() { // Get the revision for TB4. @@ -310,7 +296,8 @@ private void assertTb4() { assertWires(wires, 1); // Check the osgi.identity wire between TB4 and TB1 (via TF1). Wire wire = (Wire) wires.get(0); - // The requirer will be TB1's revision since fragment requirements are merged into the host... + // The requirer will be TB1's revision since fragment requirements are merged + // into the host... BundleRevision requirer = tb1.adapt(BundleRevision.class); // ...but the requirement will come from the fragment. Requirement requirement = getIdentityRequirement(tf1.adapt(BundleRevision.class), 0); @@ -318,15 +305,12 @@ private void assertTb4() { } /* - * TF1 - * Requirements: - * osgi.wiring.host;osgi.wiring.host=resource.tb1;version=1.0.0 - * osgi.identity;osgi.identity=resource.tb4;version=1.0.0;type=osgi.bundle + * TF1 Requirements: + * osgi.wiring.host;osgi.wiring.host=resource.tb1;version=1.0.0 + * osgi.identity;osgi.identity=resource.tb4;version=1.0.0;type=osgi.bundle * Capabilities: - * osgi.identity;osgi.identity=resource.tf1;version=1.0.0;type=osgi.fragment - * Wires: - * TB1 <-> osgi.wiring.host - * osgi.identity <-> TB3 + * osgi.identity;osgi.identity=resource.tf1;version=1.0.0;type=osgi.fragment + * Wires: TB1 <-> osgi.wiring.host osgi.identity <-> TB3 */ private void assertTf1() { // Get the revision for TF1. @@ -361,13 +345,10 @@ private void assertTf1() { } /* - * TF2 - * Requirements: - * osgi.wiring.host;osgi.wiring.host=resource.tb1;version=1.0.0 - * Capabilities: - * osgi.identity;osgi.identity=resource.tf2;version=1.0.0;type=osgi.fragment - * Wires: - * TB1 <-> osgi.wiring.host + * TF2 Requirements: + * osgi.wiring.host;osgi.wiring.host=resource.tb1;version=1.0.0 Capabilities: + * osgi.identity;osgi.identity=resource.tf2;version=1.0.0;type=osgi.fragment + * Wires: TB1 <-> osgi.wiring.host */ private void assertTf2() { // Get the revision for TF2. @@ -411,17 +392,20 @@ private void assertDirective(Requirement requirement, String name, String expect } private void assertFilterDirective(Requirement requirement) { - assertNotNull("Missing filter directive", requirement.getDirectives().get(Namespace.REQUIREMENT_FILTER_DIRECTIVE)); + assertNotNull("Missing filter directive", + requirement.getDirectives().get(Namespace.REQUIREMENT_FILTER_DIRECTIVE)); } - private void assertIdentityCapability(Capability capability, String symbolicName, Version version, String type, Map arbitraryAttrs, Map arbitraryDirs) { + private void assertIdentityCapability(Capability capability, String symbolicName, Version version, String type, + Map arbitraryAttrs, Map arbitraryDirs) { assertEquals("Wrong namespace", IdentityNamespace.IDENTITY_NAMESPACE, capability.getNamespace()); assertEquals("Wrong number of attributes", 3 + arbitraryAttrs.size(), capability.getAttributes().size()); // The osgi.identity attribute contains the symbolic name of the resource. assertSymbolicName(symbolicName, (String) capability.getAttributes().get(IdentityNamespace.IDENTITY_NAMESPACE)); // The version attribute must be of type Version. // The version attribute contains the version of the resource. - assertVersion(version, (Version) capability.getAttributes().get(IdentityNamespace.CAPABILITY_VERSION_ATTRIBUTE)); + assertVersion(version, + (Version) capability.getAttributes().get(IdentityNamespace.CAPABILITY_VERSION_ATTRIBUTE)); // The type attribute must be of type String. // The type attribute contains the resource type. assertType(type, (String) capability.getAttributes().get(IdentityNamespace.CAPABILITY_TYPE_ATTRIBUTE)); @@ -437,7 +421,8 @@ private void assertIdentityCapability(Capability capability, String symbolicName } } - private void assertIdentityWire(Wire wire, Capability capability, Resource provider, Requirement requirement, Resource requirer) { + private void assertIdentityWire(Wire wire, Capability capability, Resource provider, Requirement requirement, + Resource requirer) { assertEquals("Wrong capability", capability, wire.getCapability()); assertEquals("Wrong provider", provider, wire.getProvider()); assertEquals("Wrong requirement", requirement, wire.getRequirement()); @@ -454,7 +439,8 @@ private void assertNotIdentityCapability(CapabilityProvider provider) { private void assertNotRequirementMatches(Requirement requirement, Capability capability) { if (!(requirement instanceof BundleRequirement) || !(capability instanceof BundleCapability)) return; - assertFalse("Requirement matches capability", ((BundleRequirement) requirement).matches((BundleCapability) capability)); + assertFalse("Requirement matches capability", + ((BundleRequirement) requirement).matches((BundleCapability) capability)); } private void assertNotNull(Capability capability) { @@ -468,7 +454,8 @@ private void assertNotNull(Requirement requirement) { private void assertRequirementMatches(Requirement requirement, Capability capability) { if (!(requirement instanceof BundleRequirement) || !(capability instanceof BundleCapability)) return; - assertTrue("Requirement does not match capability", ((BundleRequirement) requirement).matches((BundleCapability) capability)); + assertTrue("Requirement does not match capability", + ((BundleRequirement) requirement).matches((BundleCapability) capability)); } private void assertRequirements(List requirements, int index) { @@ -547,6 +534,7 @@ private Requirement getIdentityRequirement(BundleRevision revision, int index) { } private String getType(BundleRevision revision) { - return (revision.getTypes() & BundleRevision.TYPE_FRAGMENT) == 0 ? IdentityNamespace.TYPE_BUNDLE : IdentityNamespace.TYPE_FRAGMENT; + return (revision.getTypes() & BundleRevision.TYPE_FRAGMENT) == 0 ? IdentityNamespace.TYPE_BUNDLE + : IdentityNamespace.TYPE_FRAGMENT; } } diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resource/ResolverHookTests.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resource/ResolverHookTests.java index 2b64f2de4e4..ffd69ab18ea 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resource/ResolverHookTests.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resource/ResolverHookTests.java @@ -31,8 +31,8 @@ public ResolverHookTests(String name) { } public void testSingletonIdentity() throws Exception { - final RuntimeException error[] = {null}; - final boolean called[] = {false}; + final RuntimeException error[] = { null }; + final boolean called[] = { false }; ResolverHookFactory resolverHookFactory = triggers -> new ResolverHook() { public void filterSingletonCollisions(BundleCapability singleton, Collection collisionCandidates) { @@ -41,13 +41,16 @@ public void filterSingletonCollisions(BundleCapability singleton, Collection col called[0] = true; try { assertEquals("Wrong namespace", IdentityNamespace.IDENTITY_NAMESPACE, singleton.getNamespace()); - assertEquals("Wrong singleton directive", "true", singleton.getDirectives().get(IdentityNamespace.CAPABILITY_SINGLETON_DIRECTIVE)); + assertEquals("Wrong singleton directive", "true", + singleton.getDirectives().get(IdentityNamespace.CAPABILITY_SINGLETON_DIRECTIVE)); String symbolicName = (String) singleton.getAttributes().get(IdentityNamespace.IDENTITY_NAMESPACE); for (Object collisionCandidate : collisionCandidates) { BundleCapability candidate = (BundleCapability) collisionCandidate; assertEquals("Wrong namespace", IdentityNamespace.IDENTITY_NAMESPACE, candidate.getNamespace()); - assertEquals("Wrong singleton directive", "true", candidate.getDirectives().get(IdentityNamespace.CAPABILITY_SINGLETON_DIRECTIVE)); - assertEquals("Wrong symbolic name", symbolicName, (String) candidate.getAttributes().get(IdentityNamespace.IDENTITY_NAMESPACE)); + assertEquals("Wrong singleton directive", "true", + candidate.getDirectives().get(IdentityNamespace.CAPABILITY_SINGLETON_DIRECTIVE)); + assertEquals("Wrong symbolic name", symbolicName, + (String) candidate.getAttributes().get(IdentityNamespace.IDENTITY_NAMESPACE)); } } catch (RuntimeException e) { error[0] = e; @@ -67,12 +70,14 @@ public void end() { } }; - ServiceRegistration hookReg = getContext().registerService(ResolverHookFactory.class, resolverHookFactory, null); + ServiceRegistration hookReg = getContext().registerService(ResolverHookFactory.class, resolverHookFactory, + null); try { Bundle tb1v1 = installer.installBundle("singleton.tb1v1"); Bundle tb1v2 = installer.installBundle("singleton.tb1v2"); - assertFalse(getContext().getBundle(0).adapt(FrameworkWiring.class).resolveBundles(Arrays.asList(new Bundle[] {tb1v1, tb1v2}))); + assertFalse(getContext().getBundle(0).adapt(FrameworkWiring.class) + .resolveBundles(Arrays.asList(new Bundle[] { tb1v1, tb1v2 }))); assertTrue("ResolverHook was not called", called[0]); if (error[0] != null) throw error[0]; diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/security/BaseSecurityTest.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/security/BaseSecurityTest.java index dfc8e2bf4fb..2719f7d1efe 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/security/BaseSecurityTest.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/security/BaseSecurityTest.java @@ -39,7 +39,7 @@ public class BaseSecurityTest extends CoreTest { - private static char[] PASSWORD_DEFAULT = {'c', 'h', 'a', 'n', 'g', 'e', 'i', 't'}; + private static char[] PASSWORD_DEFAULT = { 'c', 'h', 'a', 'n', 'g', 'e', 'i', 't' }; private static String TYPE_DEFAULT = "JKS"; protected static final String BUNDLE_SECURITY_TESTS = "org.eclipse.osgi.tests"; //$NON-NLS-1$ @@ -84,7 +84,8 @@ protected void registerEclipseTrustEngine() throws Exception { copy(eclipseURL.openStream(), tempEngine); - KeyStoreTrustEngine dummyTE = new KeyStoreTrustEngine(tempEngine.getAbsolutePath(), "JKS", "changeit".toCharArray(), "temp.jks", null); + KeyStoreTrustEngine dummyTE = new KeyStoreTrustEngine(tempEngine.getAbsolutePath(), "JKS", + "changeit".toCharArray(), "temp.jks", null); Hashtable properties = new Hashtable(7); properties.put(Constants.SERVICE_RANKING, Integer.valueOf(Integer.MAX_VALUE)); @@ -97,7 +98,7 @@ protected void tearDown() throws Exception { } public static void copy(InputStream in, File dst) throws IOException { - // InputStream in = new FileInputStream(src); + // InputStream in = new FileInputStream(src); OutputStream out = new FileOutputStream(dst); byte[] buf = new byte[1024]; @@ -110,7 +111,8 @@ public static void copy(InputStream in, File dst) throws IOException { } protected SignedContentFactory getSignedContentFactory() { - ServiceReference ref = OSGiTestsActivator.getContext().getServiceReference(SignedContentFactory.class.getName()); + ServiceReference ref = OSGiTestsActivator.getContext() + .getServiceReference(SignedContentFactory.class.getName()); assertNotNull("No SignedContentFactory service", ref); SignedContentFactory factory = (SignedContentFactory) OSGiTestsActivator.getContext().getService(ref); OSGiTestsActivator.getContext().ungetService(ref); @@ -173,7 +175,7 @@ protected static void setEclipseTrustEngine(ConfigurationSessionTestSuite suite) copy(eclipseURL.openStream(), tempFile); - suite.getSetup().setSystemProperty("osgi.framework.keystore", tempFile.toURL().toExternalForm()); //$NON-NLS-1$//$NON-NLS-2$ + suite.getSetup().setSystemProperty("osgi.framework.keystore", tempFile.toURL().toExternalForm()); //$NON-NLS-1$ //$NON-NLS-2$ } catch (Exception e) { throw new RuntimeException(e); } diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/security/BundleToJarInputStreamTest.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/security/BundleToJarInputStreamTest.java index 6503f57d1c1..6105cccf604 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/security/BundleToJarInputStreamTest.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/security/BundleToJarInputStreamTest.java @@ -46,11 +46,11 @@ public class BundleToJarInputStreamTest { - static private final List testJarNames = Arrays.asList("multiply_signed", - "SHA256withRSA", "SHA384withRSA", "SHA512withRSA", "signed_tsa", "signed_with_corrupt", - "signed_with_metadata_added", "signed_with_metadata_corrupt", "signed_with_metadata_removed", - "signed_with_metadata", "signed_with_missing_digest", "signed_with_sf_corrupted", "signed", "signedJava16", - "test.bug252098", "unsigned"); + static private final List testJarNames = Arrays.asList("multiply_signed", "SHA256withRSA", "SHA384withRSA", + "SHA512withRSA", "signed_tsa", "signed_with_corrupt", "signed_with_metadata_added", + "signed_with_metadata_corrupt", "signed_with_metadata_removed", "signed_with_metadata", + "signed_with_missing_digest", "signed_with_sf_corrupted", "signed", "signedJava16", "test.bug252098", + "unsigned"); static private final List corruptedJarNames = Arrays.asList("signed_with_corrupt", "signed_with_metadata_corrupt", "signed_with_sf_corrupted"); diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/security/OSGiAPICertificateTest.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/security/OSGiAPICertificateTest.java index dba4f32c2a3..b16457e4d8a 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/security/OSGiAPICertificateTest.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/security/OSGiAPICertificateTest.java @@ -49,16 +49,26 @@ public class OSGiAPICertificateTest extends BaseSecurityTest { private static String dnChain07TrueEscaped = escapeStar(dnChain07True); private static String dnChain08TrueEscaped = escapeStar(dnChain08True); - private static ConditionInfo info01True = new ConditionInfo(BundleSignerCondition.class.getName(), new String[] {"-"}); //$NON-NLS-1$ - private static ConditionInfo info02False = new ConditionInfo(BundleSignerCondition.class.getName(), new String[] {"-", "!"}); //$NON-NLS-1$ //$NON-NLS-2$ - private static ConditionInfo info03True = new ConditionInfo(BundleSignerCondition.class.getName(), new String[] {dnChain01True}); - private static ConditionInfo info04True = new ConditionInfo(BundleSignerCondition.class.getName(), new String[] {dnChain02True}); - private static ConditionInfo info05True = new ConditionInfo(BundleSignerCondition.class.getName(), new String[] {dnChain03True}); - private static ConditionInfo info06False = new ConditionInfo(BundleSignerCondition.class.getName(), new String[] {dnChain04False}); - private static ConditionInfo info07False = new ConditionInfo(BundleSignerCondition.class.getName(), new String[] {dnChain05False}); - private static ConditionInfo info08True = new ConditionInfo(BundleSignerCondition.class.getName(), new String[] {dnChain06True}); - private static ConditionInfo info09True = new ConditionInfo(BundleSignerCondition.class.getName(), new String[] {dnChain07True}); - private static ConditionInfo info10True = new ConditionInfo(BundleSignerCondition.class.getName(), new String[] {dnChain08True}); + private static ConditionInfo info01True = new ConditionInfo(BundleSignerCondition.class.getName(), + new String[] { "-" }); //$NON-NLS-1$ + private static ConditionInfo info02False = new ConditionInfo(BundleSignerCondition.class.getName(), + new String[] { "-", "!" }); //$NON-NLS-1$ //$NON-NLS-2$ + private static ConditionInfo info03True = new ConditionInfo(BundleSignerCondition.class.getName(), + new String[] { dnChain01True }); + private static ConditionInfo info04True = new ConditionInfo(BundleSignerCondition.class.getName(), + new String[] { dnChain02True }); + private static ConditionInfo info05True = new ConditionInfo(BundleSignerCondition.class.getName(), + new String[] { dnChain03True }); + private static ConditionInfo info06False = new ConditionInfo(BundleSignerCondition.class.getName(), + new String[] { dnChain04False }); + private static ConditionInfo info07False = new ConditionInfo(BundleSignerCondition.class.getName(), + new String[] { dnChain05False }); + private static ConditionInfo info08True = new ConditionInfo(BundleSignerCondition.class.getName(), + new String[] { dnChain06True }); + private static ConditionInfo info09True = new ConditionInfo(BundleSignerCondition.class.getName(), + new String[] { dnChain07True }); + private static ConditionInfo info10True = new ConditionInfo(BundleSignerCondition.class.getName(), + new String[] { dnChain08True }); private Collection installedBundles = new ArrayList<>(); @@ -261,7 +271,8 @@ public void testAdminPermission02() { try { getTrustEngine().addTrustAnchor(getTestCertificate("ca1_leafa"), "ca1_leafa"); //$NON-NLS-1$ //$NON-NLS-2$ Bundle testBundle = installBundle(getTestJarPath("signed")); //$NON-NLS-1$ - AdminPermission declaredPerm = new AdminPermission("(signer=" + dnChain01TrueEscaped + ")", AdminPermission.CONTEXT); //$NON-NLS-1$ //$NON-NLS-2$ + AdminPermission declaredPerm = new AdminPermission("(signer=" + dnChain01TrueEscaped + ")", //$NON-NLS-1$ //$NON-NLS-2$ + AdminPermission.CONTEXT); AdminPermission checkedPerm = new AdminPermission(testBundle, AdminPermission.CONTEXT); assertTrue("Security check failed", declaredPerm.implies(checkedPerm)); //$NON-NLS-1$ } catch (Exception e) { @@ -287,7 +298,8 @@ public void testAdminPermission04() { try { getTrustEngine().addTrustAnchor(getTestCertificate("ca1_leafa"), "ca1_leafa"); //$NON-NLS-1$ //$NON-NLS-2$ Bundle testBundle = installBundle(getTestJarPath("signed")); //$NON-NLS-1$ - AdminPermission declaredPerm = new AdminPermission("(!(signer=" + dnChain01TrueEscaped + "))", AdminPermission.CONTEXT); //$NON-NLS-1$ //$NON-NLS-2$ + AdminPermission declaredPerm = new AdminPermission("(!(signer=" + dnChain01TrueEscaped + "))", //$NON-NLS-1$ //$NON-NLS-2$ + AdminPermission.CONTEXT); AdminPermission checkedPerm = new AdminPermission(testBundle, AdminPermission.CONTEXT); assertFalse("Security check failed", declaredPerm.implies(checkedPerm)); //$NON-NLS-1$ } catch (Exception e) { @@ -300,7 +312,8 @@ public void testAdminPermission05() { try { getTrustEngine().addTrustAnchor(getTestCertificate("ca1_leafa"), "ca1_leafa"); //$NON-NLS-1$ //$NON-NLS-2$ Bundle testBundle = installBundle(getTestJarPath("signed")); //$NON-NLS-1$ - AdminPermission declaredPerm = new AdminPermission("(signer=" + dnChain02TrueEscaped + ")", AdminPermission.CONTEXT); //$NON-NLS-1$ //$NON-NLS-2$ + AdminPermission declaredPerm = new AdminPermission("(signer=" + dnChain02TrueEscaped + ")", //$NON-NLS-1$ //$NON-NLS-2$ + AdminPermission.CONTEXT); AdminPermission checkedPerm = new AdminPermission(testBundle, AdminPermission.CONTEXT); assertTrue("Security check failed", declaredPerm.implies(checkedPerm)); //$NON-NLS-1$ } catch (Exception e) { @@ -313,7 +326,8 @@ public void testAdminPermission06() { try { getTrustEngine().addTrustAnchor(getTestCertificate("ca1_leafa"), "ca1_leafa"); //$NON-NLS-1$ //$NON-NLS-2$ Bundle testBundle = installBundle(getTestJarPath("signed")); //$NON-NLS-1$ - AdminPermission declaredPerm = new AdminPermission("(signer=" + dnChain03TrueEscaped + ")", AdminPermission.CONTEXT); //$NON-NLS-1$ //$NON-NLS-2$ + AdminPermission declaredPerm = new AdminPermission("(signer=" + dnChain03TrueEscaped + ")", //$NON-NLS-1$ //$NON-NLS-2$ + AdminPermission.CONTEXT); AdminPermission checkedPerm = new AdminPermission(testBundle, AdminPermission.CONTEXT); assertTrue("Security check failed", declaredPerm.implies(checkedPerm)); //$NON-NLS-1$ } catch (Exception e) { @@ -326,7 +340,8 @@ public void testAdminPermission07() { try { getTrustEngine().addTrustAnchor(getTestCertificate("ca1_leafa"), "ca1_leafa"); //$NON-NLS-1$ //$NON-NLS-2$ Bundle testBundle = installBundle(getTestJarPath("signed")); //$NON-NLS-1$ - AdminPermission declaredPerm = new AdminPermission("(signer=" + dnChain04FalseEscaped + ")", AdminPermission.CONTEXT); //$NON-NLS-1$ //$NON-NLS-2$ + AdminPermission declaredPerm = new AdminPermission("(signer=" + dnChain04FalseEscaped + ")", //$NON-NLS-1$ //$NON-NLS-2$ + AdminPermission.CONTEXT); AdminPermission checkedPerm = new AdminPermission(testBundle, AdminPermission.CONTEXT); assertFalse("Security check failed", declaredPerm.implies(checkedPerm)); //$NON-NLS-1$ } catch (Exception e) { @@ -339,7 +354,8 @@ public void testAdminPermission08() { try { getTrustEngine().addTrustAnchor(getTestCertificate("ca1_leafa"), "ca1_leafa"); //$NON-NLS-1$ //$NON-NLS-2$ Bundle testBundle = installBundle(getTestJarPath("signed")); //$NON-NLS-1$ - AdminPermission declaredPerm = new AdminPermission("(signer=" + dnChain05FalseEscaped + ")", AdminPermission.CONTEXT); //$NON-NLS-1$ //$NON-NLS-2$ + AdminPermission declaredPerm = new AdminPermission("(signer=" + dnChain05FalseEscaped + ")", //$NON-NLS-1$ //$NON-NLS-2$ + AdminPermission.CONTEXT); AdminPermission checkedPerm = new AdminPermission(testBundle, AdminPermission.CONTEXT); assertFalse("Security check failed", declaredPerm.implies(checkedPerm)); //$NON-NLS-1$ } catch (Exception e) { @@ -352,7 +368,8 @@ public void testAdminPermission09() { try { getTrustEngine().addTrustAnchor(getTestCertificate("ca1_leafa"), "ca1_leafa"); //$NON-NLS-1$ //$NON-NLS-2$ Bundle testBundle = installBundle(getTestJarPath("signed")); //$NON-NLS-1$ - AdminPermission declaredPerm = new AdminPermission("(signer=" + dnChain06TrueEscaped + ")", AdminPermission.CONTEXT); //$NON-NLS-1$ //$NON-NLS-2$ + AdminPermission declaredPerm = new AdminPermission("(signer=" + dnChain06TrueEscaped + ")", //$NON-NLS-1$ //$NON-NLS-2$ + AdminPermission.CONTEXT); AdminPermission checkedPerm = new AdminPermission(testBundle, AdminPermission.CONTEXT); assertTrue("Security check failed", declaredPerm.implies(checkedPerm)); //$NON-NLS-1$ } catch (Exception e) { @@ -365,7 +382,8 @@ public void testAdminPermission10() { try { getTrustEngine().addTrustAnchor(getTestCertificate("ca1_leafa"), "ca1_leafa"); //$NON-NLS-1$ //$NON-NLS-2$ Bundle testBundle = installBundle(getTestJarPath("signed")); //$NON-NLS-1$ - AdminPermission declaredPerm = new AdminPermission("(signer=" + dnChain07TrueEscaped + ")", AdminPermission.CONTEXT); //$NON-NLS-1$ //$NON-NLS-2$ + AdminPermission declaredPerm = new AdminPermission("(signer=" + dnChain07TrueEscaped + ")", //$NON-NLS-1$ //$NON-NLS-2$ + AdminPermission.CONTEXT); AdminPermission checkedPerm = new AdminPermission(testBundle, AdminPermission.CONTEXT); assertTrue("Security check failed", declaredPerm.implies(checkedPerm)); //$NON-NLS-1$ } catch (Exception e) { @@ -378,7 +396,8 @@ public void testAdminPermission11() { try { getTrustEngine().addTrustAnchor(getTestCertificate("ca1_leafa"), "ca1_leafa"); //$NON-NLS-1$ //$NON-NLS-2$ Bundle testBundle = installBundle(getTestJarPath("signed")); //$NON-NLS-1$ - AdminPermission declaredPerm = new AdminPermission("(signer=" + dnChain08TrueEscaped + ")", AdminPermission.CONTEXT); //$NON-NLS-1$ //$NON-NLS-2$ + AdminPermission declaredPerm = new AdminPermission("(signer=" + dnChain08TrueEscaped + ")", //$NON-NLS-1$ //$NON-NLS-2$ + AdminPermission.CONTEXT); AdminPermission checkedPerm = new AdminPermission(testBundle, AdminPermission.CONTEXT); assertTrue("Security check failed", declaredPerm.implies(checkedPerm)); //$NON-NLS-1$ } catch (Exception e) { diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/security/SignedBundleTest.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/security/SignedBundleTest.java index 93446c4b035..a50f6d7caaf 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/security/SignedBundleTest.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/security/SignedBundleTest.java @@ -30,60 +30,53 @@ public class SignedBundleTest extends BaseSecurityTest { /* - private static Test[] s_tests = { - // positive tests - new SignedBundleTest("testSignedContent01", "unsigned", new String[] {}) { - public void runTest() { - testSignedContent01(); - } - }, new SignedBundleTest("SignedContent positive test: signed jar, 1 trusted signer", "signed", new String[] {"ca1_leafa"}) { - public void runTest() { - testSignedContent02(); - } - } - , new SignedBundleTest("SignedContent positive test: signed jar, 2 trusted signers", "multiply_signed", new String[] {"ca1_leafa", "ca1_leafb"}) {(non-Javadoc) - @see junit.framework.TestCase#runTest() - public void runTest() { - testSignedContent03(); - } - }}; - */ + * private static Test[] s_tests = { // positive tests new + * SignedBundleTest("testSignedContent01", "unsigned", new String[] {}) { public + * void runTest() { testSignedContent01(); } }, new + * SignedBundleTest("SignedContent positive test: signed jar, 1 trusted signer", + * "signed", new String[] {"ca1_leafa"}) { public void runTest() { + * testSignedContent02(); } } , new + * SignedBundleTest("SignedContent positive test: signed jar, 2 trusted signers" + * , "multiply_signed", new String[] {"ca1_leafa", "ca1_leafb"}) {(non-Javadoc) + * + * @see junit.framework.TestCase#runTest() public void runTest() { + * testSignedContent03(); } }}; + */ /* - //positive tests - signer1 signer2 valid - n/a n/a n/a = positive, unsigned ('unsigned.jar') - yes n/a yes = positive, 1 signer ('signed.jar','ca1_leafa') - yes yes yes = positive, 2 signers ('multiply_signed.jar','ca1_leafa,'ca1_leafb') - - //negative = untrusted tests - no n/a yes = negative, 1 signer, 1 untrusted ('signed.jar') - no no yes = negative, 2 signers, 2 untrusted ('multiply_signed.jar') - yes no yes = negative, 2 signers, 1 untrusted ('multiply_signed.jar', 'ca1_leafa') - - //negative = validity tests - yes n/a no = negative, 1 signer, 1 corrupt ('signed_with_corrupt.jar','ca1_leafa') - yes yes no = negative, 2 signers, 2 corrupt - - //TODO: OSGi-specific partial signer cases - //TODO: TSA tests (w/TSA signer trusted, untrusted, etc) - //TODO: More? NESTED JARS? - */ - - //private String jarName; - //private String[] aliases; + * //positive tests signer1 signer2 valid n/a n/a n/a = positive, unsigned + * ('unsigned.jar') yes n/a yes = positive, 1 signer ('signed.jar','ca1_leafa') + * yes yes yes = positive, 2 signers + * ('multiply_signed.jar','ca1_leafa,'ca1_leafb') + * + * //negative = untrusted tests no n/a yes = negative, 1 signer, 1 untrusted + * ('signed.jar') no no yes = negative, 2 signers, 2 untrusted + * ('multiply_signed.jar') yes no yes = negative, 2 signers, 1 untrusted + * ('multiply_signed.jar', 'ca1_leafa') + * + * //negative = validity tests yes n/a no = negative, 1 signer, 1 corrupt + * ('signed_with_corrupt.jar','ca1_leafa') yes yes no = negative, 2 signers, 2 + * corrupt + * + * //TODO: OSGi-specific partial signer cases //TODO: TSA tests (w/TSA signer + * trusted, untrusted, etc) //TODO: More? NESTED JARS? + */ + + // private String jarName; + // private String[] aliases; public SignedBundleTest() { super(); } public SignedBundleTest(String name, String jarname, String[] aliases) { super(name); - //this.jarName = jarname; - //this.aliases = aliases; + // this.jarName = jarname; + // this.aliases = aliases; } public static Test suite() { - ConfigurationSessionTestSuite suite = new ConfigurationSessionTestSuite(BUNDLE_SECURITY_TESTS, "Unit session tests for SignedContent"); + ConfigurationSessionTestSuite suite = new ConfigurationSessionTestSuite(BUNDLE_SECURITY_TESTS, + "Unit session tests for SignedContent"); OSGiTest.addRequiredOSGiTestsBundles(suite); suite.addTestSuite(SignedBundleTest.class); return suite; @@ -92,18 +85,16 @@ public static Test suite() { protected void setUp() throws Exception { registerEclipseTrustEngine(); /* - TrustEngine engine = getTrustEngine(); - - if (supportStore == null) { - fail("Could not open keystore with test certificates!"); - } - - // get the certs from the support store and add - for (int i = 0; i < aliases.length; i++) { - Certificate cert = supportStore.getCertificate(aliases[i]); - engine.addTrustAnchor(cert, aliases[i]); - } - */ + * TrustEngine engine = getTrustEngine(); + * + * if (supportStore == null) { + * fail("Could not open keystore with test certificates!"); } + * + * // get the certs from the support store and add for (int i = 0; i < + * aliases.length; i++) { Certificate cert = + * supportStore.getCertificate(aliases[i]); engine.addTrustAnchor(cert, + * aliases[i]); } + */ } @Override @@ -111,14 +102,14 @@ protected void tearDown() throws Exception { super.tearDown(); } - // SignedContent positive test: unsigned jar + // SignedContent positive test: unsigned jar public void testSignedContent01() { Bundle testBundle = null; try { testBundle = installBundle(getTestJarPath("unsigned")); assertNotNull("Test bundle not installed!", testBundle); - //getTrustEngine().addTrustAnchor(anchor, alias); + // getTrustEngine().addTrustAnchor(anchor, alias); // get the signed content for the bundle SignedContent signedContent = getSignedContentFactory().getSignedContent(testBundle); @@ -135,7 +126,7 @@ public void testSignedContent01() { } } - //SignedContent positive test: signed jar, 1 trusted signer + // SignedContent positive test: signed jar, 1 trusted signer public void testSignedContent02() { Bundle testBundle = null; @@ -180,7 +171,7 @@ public void testSignedContent02() { } } - //SignedContent positive test: signed jar, 2 trusted signers + // SignedContent positive test: signed jar, 2 trusted signers public void testSignedContent03() { Bundle testBundle = null; @@ -230,7 +221,7 @@ public void testSignedContent03() { } } - //SignedContent negative, 1 signer, 1 untrusted + // SignedContent negative, 1 signer, 1 untrusted public void testSignedContent04() { Bundle testBundle = null; try { @@ -261,7 +252,7 @@ public void testSignedContent04() { } } - //SignedContent negative, 2 signers, 2 untrusted + // SignedContent negative, 2 signers, 2 untrusted public void testSignedContent05() { Bundle testBundle = null; try { @@ -292,7 +283,7 @@ public void testSignedContent05() { } } - //SignedContent negative, 2 signers, 1 untrusted + // SignedContent negative, 2 signers, 1 untrusted public void testSignedContent06() { Bundle testBundle = null; try { @@ -315,7 +306,8 @@ public void testSignedContent06() { Certificate[] certs = info.getCertificateChain(); if (info.isTrusted()) { X509Certificate x509Cert = (X509Certificate) certs[0]; - assertTrue("CA1 LeafA signer is not trusted", x509Cert.getSubjectDN().getName().indexOf("CA1 LeafA") >= 0); + assertTrue("CA1 LeafA signer is not trusted", + x509Cert.getSubjectDN().getName().indexOf("CA1 LeafA") >= 0); } } } catch (Exception e) { @@ -392,7 +384,8 @@ public void testSignedContent07a() { } catch (LinkageError error) { // will happen if not running with runtime checks if ("all".equals(System.getProperty("osgi.signedcontent.support"))) { - // if signed content support is enabled then the cause is an InvalidContentException + // if signed content support is enabled then the cause is an + // InvalidContentException Throwable t = error.getCause(); assertTrue("Cause is the wrong type: " + t, t instanceof InvalidContentException); } @@ -439,13 +432,13 @@ public void testSignedContent08() { } } - // SignedContent positive test: unsigned jar + // SignedContent positive test: unsigned jar public void testSignedContent09() { try { File unsignedFile = getEntryFile(getTestJarPath("unsigned")); assertNotNull("Could not find unsigned file!", unsignedFile); - //getTrustEngine().addTrustAnchor(anchor, alias); + // getTrustEngine().addTrustAnchor(anchor, alias); // get the signed content for the bundle SignedContent signedContent = getSignedContentFactory().getSignedContent(unsignedFile); @@ -456,7 +449,7 @@ public void testSignedContent09() { } } - //SignedContent positive test: signed jar, 1 trusted signer + // SignedContent positive test: signed jar, 1 trusted signer public void testSignedContent10() { try { File signedFile = getEntryFile(getTestJarPath("signed")); @@ -492,7 +485,7 @@ public void testSignedContent10() { } } - //SignedContent positive test: signed jar, 2 trusted signers + // SignedContent positive test: signed jar, 2 trusted signers public void testSignedContent11() { try { File multipleSigned = getEntryFile(getTestJarPath("multiply_signed")); @@ -532,7 +525,7 @@ public void testSignedContent11() { } } - //SignedContent negative, 1 signer, 1 untrusted + // SignedContent negative, 1 signer, 1 untrusted public void testSignedContent12() { try { File signedFile = getEntryFile(getTestJarPath("signed")); @@ -555,7 +548,7 @@ public void testSignedContent12() { } } - //SignedContent negative, 2 signers, 2 untrusted + // SignedContent negative, 2 signers, 2 untrusted public void testSignedContent13() { try { File multipleSigned = getEntryFile(getTestJarPath("multiply_signed")); @@ -579,7 +572,7 @@ public void testSignedContent13() { } } - //SignedContent negative, 2 signers, 1 untrusted + // SignedContent negative, 2 signers, 1 untrusted public void testSignedContent14() { try { File multipleSigned = getEntryFile(getTestJarPath("multiply_signed")); @@ -601,7 +594,8 @@ public void testSignedContent14() { Certificate[] certs = info.getCertificateChain(); if (info.isTrusted()) { X509Certificate x509Cert = (X509Certificate) certs[0]; - assertTrue("CA1 LeafA signer is not trusted", x509Cert.getSubjectDN().getName().indexOf("CA1 LeafA") >= 0); + assertTrue("CA1 LeafA signer is not trusted", + x509Cert.getSubjectDN().getName().indexOf("CA1 LeafA") >= 0); } } } catch (Exception e) { @@ -673,7 +667,7 @@ public void testSignedContent16() { } } - //SignedContent positive test: signed jar, 1 trusted signer + // SignedContent positive test: signed jar, 1 trusted signer public void testBug225090_01() throws Exception { File signedFile = copyEntryFile(getTestJarPath("signed")); getTrustEngine().addTrustAnchor(getTestCertificate("ca1_leafa"), "ca1_leafa"); @@ -707,12 +701,12 @@ public void testBug225090_01() throws Exception { assertFalse("File should not exist", signedFile.exists()); } - // SignedContent positive test: unsigned jar + // SignedContent positive test: unsigned jar public void testBug225090_02() throws Exception { File unsignedFile = copyEntryFile(getTestJarPath("unsigned")); assertNotNull("Could not find unsigned file!", unsignedFile); - //getTrustEngine().addTrustAnchor(anchor, alias); + // getTrustEngine().addTrustAnchor(anchor, alias); // get the signed content for the bundle SignedContent signedContent = getSignedContentFactory().getSignedContent(unsignedFile); @@ -734,7 +728,7 @@ public void testBug228427_01() throws Exception { File signedFile = copyEntryFile(getTestJarPath("signed_with_metadata")); assertNotNull("Could not find signed file!", signedFile); - //getTrustEngine().addTrustAnchor(anchor, alias); + // getTrustEngine().addTrustAnchor(anchor, alias); // get the signed content for the bundle SignedContent signedContent = getSignedContentFactory().getSignedContent(signedFile); @@ -757,7 +751,7 @@ public void testBug228427_02() throws Exception { File signedFile = copyEntryFile(getTestJarPath("signed_with_metadata_added")); assertNotNull("Could not find signed file!", signedFile); - //getTrustEngine().addTrustAnchor(anchor, alias); + // getTrustEngine().addTrustAnchor(anchor, alias); // get the signed content for the bundle SignedContent signedContent = getSignedContentFactory().getSignedContent(signedFile); @@ -780,7 +774,7 @@ public void testBug228427_03() throws Exception { File signedFile = copyEntryFile(getTestJarPath("signed_with_metadata_corrupt")); assertNotNull("Could not find signed file!", signedFile); - //getTrustEngine().addTrustAnchor(anchor, alias); + // getTrustEngine().addTrustAnchor(anchor, alias); // get the signed content for the bundle SignedContent signedContent = getSignedContentFactory().getSignedContent(signedFile); @@ -792,7 +786,8 @@ public void testBug228427_03() throws Exception { for (SignedContentEntry entry : entries) { try { entry.verify(); - assertFalse("Wrong entry is validated: " + entry.getName(), "META-INF/test/test1.file".equals(entry.getName())); + assertFalse("Wrong entry is validated: " + entry.getName(), + "META-INF/test/test1.file".equals(entry.getName())); SignerInfo[] entryInfos = entry.getSignerInfos(); assertNotNull("SignerInfo is null", entryInfos); assertEquals("wrong number of entry signers", 1, entryInfos.length); @@ -812,7 +807,7 @@ public void testBug228427_04() throws Exception { File signedFile = copyEntryFile(getTestJarPath("signed_with_metadata_removed")); assertNotNull("Could not find signed file!", signedFile); - //getTrustEngine().addTrustAnchor(anchor, alias); + // getTrustEngine().addTrustAnchor(anchor, alias); // get the signed content for the bundle SignedContent signedContent = getSignedContentFactory().getSignedContent(signedFile); @@ -839,7 +834,7 @@ public void testBug236329_01() throws Exception { File signedFile = copyEntryFile(getTestJarPath("signed_with_sf_corrupted")); assertNotNull("Could not find signed file!", signedFile); - //getTrustEngine().addTrustAnchor(anchor, alias); + // getTrustEngine().addTrustAnchor(anchor, alias); // get the signed content for the bundle try { diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/securityadmin/SecurityAdminUnitTests.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/securityadmin/SecurityAdminUnitTests.java index c00749f4be3..dbf284a9dcf 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/securityadmin/SecurityAdminUnitTests.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/securityadmin/SecurityAdminUnitTests.java @@ -54,33 +54,54 @@ @SuppressWarnings("deprecation") public class SecurityAdminUnitTests extends AbstractBundleTests { - private static final PermissionInfo[] SOCKET_INFOS = new PermissionInfo[] {new PermissionInfo("java.net.SocketPermission", "localhost", "accept")}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - private static final PermissionInfo[] READONLY_INFOS = new PermissionInfo[] {new PermissionInfo("java.io.FilePermission", "<>", "read")}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + private static final PermissionInfo[] SOCKET_INFOS = new PermissionInfo[] { + new PermissionInfo("java.net.SocketPermission", "localhost", "accept") }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + private static final PermissionInfo[] READONLY_INFOS = new PermissionInfo[] { + new PermissionInfo("java.io.FilePermission", "<>", "read") }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ private static final PermissionInfo[] READWRITE_INFOS = new PermissionInfo[] { // multiple permission infos new PermissionInfo("java.io.FilePermission", "<>", "read"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ new PermissionInfo("java.io.FilePermission", "<>", "write") //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ }; - private static final PermissionInfo[] RELATIVE_EXEC_FILE_INFOS = new PermissionInfo[] {new PermissionInfo("java.io.FilePermission", "bin/*", "execute")}; - - private static final PermissionInfo[] RUNTIME_INFOS = new PermissionInfo[] {new PermissionInfo("java.lang.RuntimePermission", "exitVM", null)}; //$NON-NLS-1$ //$NON-NLS-2$ - - private static final ConditionInfo[] ALLLOCATION_CONDS = new ConditionInfo[] {new ConditionInfo("org.osgi.service.condpermadmin.BundleLocationCondition", new String[] {"*"})}; //$NON-NLS-1$ //$NON-NLS-2$ - private static final ConditionInfo MUT_SAT = new ConditionInfo("ext.framework.b.TestCondition", new String[] {"MUT_SAT", "true", "false", "true"}); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ - private static final ConditionInfo NOT_MUT_SAT = new ConditionInfo("ext.framework.b.TestCondition", new String[] {"NOT_MUT_SAT", "false", "false", "true"}); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ - private static final ConditionInfo POST_MUT_SAT = new ConditionInfo("ext.framework.b.TestCondition", new String[] {"POST_MUT_SAT", "true", "true", "true"}); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ - private static final ConditionInfo POST_MUT_UNSAT = new ConditionInfo("ext.framework.b.TestCondition", new String[] {"POST_MUT_UNSAT", "true", "true", "false"}); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ - - private static final ConditionInfo SIGNER_CONDITION1 = new ConditionInfo("org.osgi.service.condpermadmin.BundleSignerCondition", new String[] {"*;cn=test1,c=US"}); //$NON-NLS-1$//$NON-NLS-2$ - private static final ConditionInfo SIGNER_CONDITION2 = new ConditionInfo("org.osgi.service.condpermadmin.BundleSignerCondition", new String[] {"*;cn=test2,c=US"}); //$NON-NLS-1$//$NON-NLS-2$ - private static final ConditionInfo NOT_SIGNER_CONDITION1 = new ConditionInfo("org.osgi.service.condpermadmin.BundleSignerCondition", new String[] {"*;cn=test1,c=US", "!"}); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ + private static final PermissionInfo[] RELATIVE_EXEC_FILE_INFOS = new PermissionInfo[] { + new PermissionInfo("java.io.FilePermission", "bin/*", "execute") }; + + private static final PermissionInfo[] RUNTIME_INFOS = new PermissionInfo[] { + new PermissionInfo("java.lang.RuntimePermission", "exitVM", null) }; //$NON-NLS-1$ //$NON-NLS-2$ + + private static final ConditionInfo[] ALLLOCATION_CONDS = new ConditionInfo[] { + new ConditionInfo("org.osgi.service.condpermadmin.BundleLocationCondition", new String[] { "*" }) }; //$NON-NLS-1$ //$NON-NLS-2$ + private static final ConditionInfo MUT_SAT = new ConditionInfo("ext.framework.b.TestCondition", //$NON-NLS-1$ + new String[] { "MUT_SAT", "true", "false", "true" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ + private static final ConditionInfo NOT_MUT_SAT = new ConditionInfo("ext.framework.b.TestCondition", //$NON-NLS-1$ + new String[] { "NOT_MUT_SAT", "false", "false", "true" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ + private static final ConditionInfo POST_MUT_SAT = new ConditionInfo("ext.framework.b.TestCondition", //$NON-NLS-1$ + new String[] { "POST_MUT_SAT", "true", "true", "true" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ + private static final ConditionInfo POST_MUT_UNSAT = new ConditionInfo("ext.framework.b.TestCondition", //$NON-NLS-1$ + new String[] { "POST_MUT_UNSAT", "true", "true", "false" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ + + private static final ConditionInfo SIGNER_CONDITION1 = new ConditionInfo( + "org.osgi.service.condpermadmin.BundleSignerCondition", new String[] { "*;cn=test1,c=US" }); //$NON-NLS-1$//$NON-NLS-2$ + private static final ConditionInfo SIGNER_CONDITION2 = new ConditionInfo( + "org.osgi.service.condpermadmin.BundleSignerCondition", new String[] { "*;cn=test2,c=US" }); //$NON-NLS-1$//$NON-NLS-2$ + private static final ConditionInfo NOT_SIGNER_CONDITION1 = new ConditionInfo( + "org.osgi.service.condpermadmin.BundleSignerCondition", new String[] { "*;cn=test1,c=US", "!" }); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ private static final String TEST_BUNDLE = "test"; //$NON-NLS-1$ private static final String TEST2_BUNDLE = "test2"; //$NON-NLS-1$ - //private static final ConditionInfo POST_MUT_NOTSAT = new ConditionInfo("ext.framework.b.TestCondition", new String[] {"POST_MUT_NOTSAT", "true", "true", "false"}); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ - //private static final ConditionInfo POST_NOTMUT_SAT = new ConditionInfo("ext.framework.b.TestCondition", new String[] {"POST_NOTMUT_SAT", "true", "false", "true"}); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ - //private static final ConditionInfo POST_NOTMUT_NOTSAT = new ConditionInfo("ext.framework.b.TestCondition", new String[] {"POST_NOTMUT_NOTSAT", "true", "false", "false"}); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ + // private static final ConditionInfo POST_MUT_NOTSAT = new + // ConditionInfo("ext.framework.b.TestCondition", new String[] + // {"POST_MUT_NOTSAT", "true", "true", "false"}); //$NON-NLS-1$//$NON-NLS-2$ + // //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ + // private static final ConditionInfo POST_NOTMUT_SAT = new + // ConditionInfo("ext.framework.b.TestCondition", new String[] + // {"POST_NOTMUT_SAT", "true", "false", "true"}); //$NON-NLS-1$//$NON-NLS-2$ + // //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ + // private static final ConditionInfo POST_NOTMUT_NOTSAT = new + // ConditionInfo("ext.framework.b.TestCondition", new String[] + // {"POST_NOTMUT_NOTSAT", "true", "false", "false"}); //$NON-NLS-1$//$NON-NLS-2$ + // //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ private Policy previousPolicy; private Equinox equinox; @@ -97,7 +118,7 @@ public void setUp() throws Exception { // A simple PermissionCollection that only has AllPermission @Override public void add(Permission permission) { - //no adding to this policy + // no adding to this policy } @Override @@ -140,14 +161,16 @@ public void refresh() { } }); - File config = OSGiTestsActivator.getContext().getDataFile(getName()); //$NON-NLS-1$ + File config = OSGiTestsActivator.getContext().getDataFile(getName()); // $NON-NLS-1$ Map configuration = new HashMap<>(); configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); configuration.put(Constants.FRAMEWORK_SECURITY, Constants.FRAMEWORK_SECURITY_OSGI); equinox = new Equinox(configuration); equinox.init(); - cpa = equinox.getBundleContext().getService(equinox.getBundleContext().getServiceReference(ConditionalPermissionAdmin.class)); - pa = equinox.getBundleContext().getService(equinox.getBundleContext().getServiceReference(PermissionAdmin.class)); + cpa = equinox.getBundleContext() + .getService(equinox.getBundleContext().getServiceReference(ConditionalPermissionAdmin.class)); + pa = equinox.getBundleContext() + .getService(equinox.getBundleContext().getServiceReference(PermissionAdmin.class)); super.setUp(); } @@ -284,7 +307,8 @@ public void testNotLocationCondition01() throws BundleException { Bundle test = installTestBundle(TEST_BUNDLE); AccessControlContext acc = test.adapt(AccessControlContext.class); - ConditionalPermissionInfo condPermInfo = cpa.addConditionalPermissionInfo(getLocationConditions("xxx", true), SOCKET_INFOS); //$NON-NLS-1$ + ConditionalPermissionInfo condPermInfo = cpa.addConditionalPermissionInfo(getLocationConditions("xxx", true), //$NON-NLS-1$ + SOCKET_INFOS); testPermission(acc, new AllPermission(), false); testPermission(acc, new SocketPermission("localhost", "accept"), true); //$NON-NLS-1$ //$NON-NLS-2$ @@ -298,7 +322,8 @@ public void testNotLocationCondition02() throws BundleException { Bundle test = installTestBundle(TEST_BUNDLE); AccessControlContext acc = test.adapt(AccessControlContext.class); - ConditionalPermissionInfo condPermInfo = cpa.addConditionalPermissionInfo(getLocationConditions(test.getLocation(), true), SOCKET_INFOS); + ConditionalPermissionInfo condPermInfo = cpa + .addConditionalPermissionInfo(getLocationConditions(test.getLocation(), true), SOCKET_INFOS); testPermission(acc, new AllPermission(), false); testPermission(acc, new SocketPermission("localhost", "accept"), false); //$NON-NLS-1$ //$NON-NLS-2$ @@ -312,7 +337,8 @@ public void testMultipleLocationConditions01() throws BundleException { Bundle test = installTestBundle(TEST_BUNDLE); AccessControlContext acc = test.adapt(AccessControlContext.class); - ConditionalPermissionInfo condPermInfo1 = cpa.addConditionalPermissionInfo(getLocationConditions("xxx", false), SOCKET_INFOS); //$NON-NLS-1$ + ConditionalPermissionInfo condPermInfo1 = cpa.addConditionalPermissionInfo(getLocationConditions("xxx", false), //$NON-NLS-1$ + SOCKET_INFOS); ConditionalPermissionInfo condPermInfo2 = cpa.addConditionalPermissionInfo(ALLLOCATION_CONDS, READONLY_INFOS); testPermission(acc, new SocketPermission("localhost", "accept"), false); //$NON-NLS-1$ //$NON-NLS-2$ @@ -335,9 +361,11 @@ public void testMultipleLocationConditions02() throws BundleException { Bundle test = installTestBundle(TEST_BUNDLE); AccessControlContext pd = test.adapt(AccessControlContext.class); - ConditionalPermissionInfo condPermInfo1 = cpa.addConditionalPermissionInfo(getLocationConditions("xxx", false), SOCKET_INFOS); //$NON-NLS-1$ + ConditionalPermissionInfo condPermInfo1 = cpa.addConditionalPermissionInfo(getLocationConditions("xxx", false), //$NON-NLS-1$ + SOCKET_INFOS); ConditionalPermissionInfo condPermInfo2 = cpa.addConditionalPermissionInfo(ALLLOCATION_CONDS, READONLY_INFOS); - ConditionalPermissionInfo condPermInfo3 = cpa.addConditionalPermissionInfo(getLocationConditions(test.getLocation(), false), RUNTIME_INFOS); + ConditionalPermissionInfo condPermInfo3 = cpa + .addConditionalPermissionInfo(getLocationConditions(test.getLocation(), false), RUNTIME_INFOS); testPermission(pd, new SocketPermission("localhost", "accept"), false); //$NON-NLS-1$ //$NON-NLS-2$ testPermission(pd, new RuntimePermission("exitVM", null), true); //$NON-NLS-1$ @@ -375,7 +403,8 @@ public void testUpdate01() { public void testUpdate02() throws BundleException { ConditionalPermissionUpdate update = cpa.newConditionalPermissionUpdate(); List rows = update.getConditionalPermissionInfos(); - ConditionalPermissionInfo info = cpa.newConditionalPermissionInfo(null, ALLLOCATION_CONDS, READONLY_INFOS, ConditionalPermissionInfo.ALLOW); + ConditionalPermissionInfo info = cpa.newConditionalPermissionInfo(null, ALLLOCATION_CONDS, READONLY_INFOS, + ConditionalPermissionInfo.ALLOW); rows.add(info); assertTrue("failed to commit", update.commit()); //$NON-NLS-1$ @@ -398,8 +427,10 @@ public void testUpdate02() throws BundleException { public void testUpdate03() throws BundleException { ConditionalPermissionUpdate update = cpa.newConditionalPermissionUpdate(); List rows = update.getConditionalPermissionInfos(); - ConditionalPermissionInfo info1 = cpa.newConditionalPermissionInfo(null, ALLLOCATION_CONDS, READWRITE_INFOS, ConditionalPermissionInfo.DENY); - ConditionalPermissionInfo info2 = cpa.newConditionalPermissionInfo(null, ALLLOCATION_CONDS, READONLY_INFOS, ConditionalPermissionInfo.ALLOW); + ConditionalPermissionInfo info1 = cpa.newConditionalPermissionInfo(null, ALLLOCATION_CONDS, READWRITE_INFOS, + ConditionalPermissionInfo.DENY); + ConditionalPermissionInfo info2 = cpa.newConditionalPermissionInfo(null, ALLLOCATION_CONDS, READONLY_INFOS, + ConditionalPermissionInfo.ALLOW); rows.add(info1); rows.add(info2); assertTrue("failed to commit", update.commit()); //$NON-NLS-1$ @@ -431,8 +462,10 @@ public void testUpdate03() throws BundleException { public void testUpdate04() throws BundleException { ConditionalPermissionUpdate update = cpa.newConditionalPermissionUpdate(); List rows = update.getConditionalPermissionInfos(); - ConditionalPermissionInfo info1 = cpa.newConditionalPermissionInfo(null, ALLLOCATION_CONDS, READWRITE_INFOS, ConditionalPermissionInfo.DENY); - ConditionalPermissionInfo info2 = cpa.newConditionalPermissionInfo(null, ALLLOCATION_CONDS, READONLY_INFOS, ConditionalPermissionInfo.ALLOW); + ConditionalPermissionInfo info1 = cpa.newConditionalPermissionInfo(null, ALLLOCATION_CONDS, READWRITE_INFOS, + ConditionalPermissionInfo.DENY); + ConditionalPermissionInfo info2 = cpa.newConditionalPermissionInfo(null, ALLLOCATION_CONDS, READONLY_INFOS, + ConditionalPermissionInfo.ALLOW); rows.add(info1); rows.add(info2); assertTrue("failed to commit", update.commit()); //$NON-NLS-1$ @@ -468,13 +501,14 @@ public void testUpdate04() throws BundleException { public void testSecurityManager01() throws BundleException { ConditionalPermissionUpdate update = cpa.newConditionalPermissionUpdate(); List rows = update.getConditionalPermissionInfos(); - ConditionalPermissionInfo info = cpa.newConditionalPermissionInfo(null, ALLLOCATION_CONDS, READONLY_INFOS, ConditionalPermissionInfo.ALLOW); + ConditionalPermissionInfo info = cpa.newConditionalPermissionInfo(null, ALLLOCATION_CONDS, READONLY_INFOS, + ConditionalPermissionInfo.ALLOW); rows.add(info); assertTrue("failed to commit", update.commit()); //$NON-NLS-1$ Bundle test = installTestBundle(TEST_BUNDLE); ProtectionDomain pd = test.adapt(ProtectionDomain.class); - ProtectionDomain[] pds = new ProtectionDomain[] {pd}; + ProtectionDomain[] pds = new ProtectionDomain[] { pd }; testSMPermission(pds, new FilePermission("test", "write"), false); //$NON-NLS-1$ //$NON-NLS-2$ testSMPermission(pds, new FilePermission("test", "read"), true); //$NON-NLS-1$ //$NON-NLS-2$ testSMPermission(pds, new AllPermission(), false); @@ -496,14 +530,17 @@ public void testPostponedConditions01() throws BundleException { Bundle test2 = installTestBundle(TEST2_BUNDLE); ProtectionDomain pd1 = test1.adapt(ProtectionDomain.class); ProtectionDomain pd2 = test2.adapt(ProtectionDomain.class); - ProtectionDomain[] pds = new ProtectionDomain[] {pd1, pd2}; + ProtectionDomain[] pds = new ProtectionDomain[] { pd1, pd2 }; ConditionalPermissionUpdate update = cpa.newConditionalPermissionUpdate(); List rows = update.getConditionalPermissionInfos(); - rows.add(cpa.newConditionalPermissionInfo(null, new ConditionInfo[] {POST_MUT_SAT}, READONLY_INFOS, ConditionalPermissionInfo.DENY)); - rows.add(cpa.newConditionalPermissionInfo(null, new ConditionInfo[] {POST_MUT_UNSAT}, READONLY_INFOS, ConditionalPermissionInfo.ALLOW)); - rows.add(cpa.newConditionalPermissionInfo(null, ALLLOCATION_CONDS, READONLY_INFOS, ConditionalPermissionInfo.DENY)); - assertTrue("failed to commit", update.commit()); //$NON-NLS-1$); + rows.add(cpa.newConditionalPermissionInfo(null, new ConditionInfo[] { POST_MUT_SAT }, READONLY_INFOS, + ConditionalPermissionInfo.DENY)); + rows.add(cpa.newConditionalPermissionInfo(null, new ConditionInfo[] { POST_MUT_UNSAT }, READONLY_INFOS, + ConditionalPermissionInfo.ALLOW)); + rows.add(cpa.newConditionalPermissionInfo(null, ALLLOCATION_CONDS, READONLY_INFOS, + ConditionalPermissionInfo.DENY)); + assertTrue("failed to commit", update.commit()); //$NON-NLS-1$ ); testSMPermission(pds, new FilePermission("test", "read"), false); //$NON-NLS-1$ //$NON-NLS-2$ @@ -528,7 +565,7 @@ public void testPostponedConditions01() throws BundleException { update = cpa.newConditionalPermissionUpdate(); rows = update.getConditionalPermissionInfos(); rows.remove(0); - assertTrue("failed to commit", update.commit()); //$NON-NLS-1$); + assertTrue("failed to commit", update.commit()); //$NON-NLS-1$ ); testSMPermission(pds, new FilePermission("test", "read"), true); //$NON-NLS-1$ //$NON-NLS-2$ tc1unsat.setSatisfied(false); @@ -538,7 +575,7 @@ public void testPostponedConditions01() throws BundleException { update = cpa.newConditionalPermissionUpdate(); rows = update.getConditionalPermissionInfos(); rows.remove(0); - assertTrue("failed to commit", update.commit()); //$NON-NLS-1$); + assertTrue("failed to commit", update.commit()); //$NON-NLS-1$ ); testSMPermission(pds, new FilePermission("test", "read"), false); //$NON-NLS-1$ //$NON-NLS-2$ } @@ -551,15 +588,19 @@ public void testPostponedConditions02() throws BundleException { Bundle test2 = installTestBundle(TEST2_BUNDLE); ProtectionDomain pd1 = test1.adapt(ProtectionDomain.class); ProtectionDomain pd2 = test2.adapt(ProtectionDomain.class); - ProtectionDomain[] pds = new ProtectionDomain[] {pd1, pd2}; + ProtectionDomain[] pds = new ProtectionDomain[] { pd1, pd2 }; ConditionalPermissionUpdate update = cpa.newConditionalPermissionUpdate(); List rows = update.getConditionalPermissionInfos(); - rows.add(cpa.newConditionalPermissionInfo(null, new ConditionInfo[] {POST_MUT_SAT}, READONLY_INFOS, ConditionalPermissionInfo.DENY)); - rows.add(cpa.newConditionalPermissionInfo(null, new ConditionInfo[] {POST_MUT_SAT}, READONLY_INFOS, ConditionalPermissionInfo.DENY)); - rows.add(cpa.newConditionalPermissionInfo(null, new ConditionInfo[] {POST_MUT_UNSAT}, READONLY_INFOS, ConditionalPermissionInfo.DENY)); - rows.add(cpa.newConditionalPermissionInfo(null, ALLLOCATION_CONDS, READONLY_INFOS, ConditionalPermissionInfo.DENY)); - assertTrue("failed to commit", update.commit()); //$NON-NLS-1$); + rows.add(cpa.newConditionalPermissionInfo(null, new ConditionInfo[] { POST_MUT_SAT }, READONLY_INFOS, + ConditionalPermissionInfo.DENY)); + rows.add(cpa.newConditionalPermissionInfo(null, new ConditionInfo[] { POST_MUT_SAT }, READONLY_INFOS, + ConditionalPermissionInfo.DENY)); + rows.add(cpa.newConditionalPermissionInfo(null, new ConditionInfo[] { POST_MUT_UNSAT }, READONLY_INFOS, + ConditionalPermissionInfo.DENY)); + rows.add(cpa.newConditionalPermissionInfo(null, ALLLOCATION_CONDS, READONLY_INFOS, + ConditionalPermissionInfo.DENY)); + assertTrue("failed to commit", update.commit()); //$NON-NLS-1$ ); testSMPermission(pds, new FilePermission("test", "read"), false); //$NON-NLS-1$ //$NON-NLS-2$ @@ -572,7 +613,8 @@ public void testPostponedConditions02() throws BundleException { // ProtectionDomains are processed by the AccessControlContext (bug 269917) // Just make sure both tc1 and tc2 are not non-null at the same time. assertTrue("tc1sat and tc2sat are either both null or both non-null", (tc1sat == null) ^ (tc2sat == null)); //$NON-NLS-1$ - assertTrue("tc1unsat and tc2unsat are either both null or both non-null", (tc1unsat == null) ^ (tc2unsat == null)); //$NON-NLS-1$ + assertTrue("tc1unsat and tc2unsat are either both null or both non-null", //$NON-NLS-1$ + (tc1unsat == null) ^ (tc2unsat == null)); TestCondition modifySat = tc1sat != null ? tc1sat : tc2sat; TestCondition modifyUnsat = tc1unsat != null ? tc1unsat : tc2unsat; @@ -590,15 +632,19 @@ public void testPostponedConditions03() throws BundleException { Bundle test2 = installTestBundle(TEST2_BUNDLE); ProtectionDomain pd1 = test1.adapt(ProtectionDomain.class); ProtectionDomain pd2 = test2.adapt(ProtectionDomain.class); - ProtectionDomain[] pds = new ProtectionDomain[] {pd1, pd2}; + ProtectionDomain[] pds = new ProtectionDomain[] { pd1, pd2 }; ConditionalPermissionUpdate update = cpa.newConditionalPermissionUpdate(); List rows = update.getConditionalPermissionInfos(); - rows.add(cpa.newConditionalPermissionInfo(null, new ConditionInfo[] {POST_MUT_SAT}, READONLY_INFOS, ConditionalPermissionInfo.ALLOW)); - rows.add(cpa.newConditionalPermissionInfo(null, new ConditionInfo[] {POST_MUT_SAT}, READONLY_INFOS, ConditionalPermissionInfo.ALLOW)); - rows.add(cpa.newConditionalPermissionInfo(null, new ConditionInfo[] {POST_MUT_UNSAT}, READONLY_INFOS, ConditionalPermissionInfo.ALLOW)); - rows.add(cpa.newConditionalPermissionInfo(null, ALLLOCATION_CONDS, READONLY_INFOS, ConditionalPermissionInfo.ALLOW)); - assertTrue("failed to commit", update.commit()); //$NON-NLS-1$); + rows.add(cpa.newConditionalPermissionInfo(null, new ConditionInfo[] { POST_MUT_SAT }, READONLY_INFOS, + ConditionalPermissionInfo.ALLOW)); + rows.add(cpa.newConditionalPermissionInfo(null, new ConditionInfo[] { POST_MUT_SAT }, READONLY_INFOS, + ConditionalPermissionInfo.ALLOW)); + rows.add(cpa.newConditionalPermissionInfo(null, new ConditionInfo[] { POST_MUT_UNSAT }, READONLY_INFOS, + ConditionalPermissionInfo.ALLOW)); + rows.add(cpa.newConditionalPermissionInfo(null, ALLLOCATION_CONDS, READONLY_INFOS, + ConditionalPermissionInfo.ALLOW)); + assertTrue("failed to commit", update.commit()); //$NON-NLS-1$ ); testSMPermission(pds, new FilePermission("test", "read"), true); //$NON-NLS-1$ //$NON-NLS-2$ @@ -628,14 +674,17 @@ public void testPostponedConditions04() throws BundleException { Bundle test2 = installTestBundle(TEST2_BUNDLE); ProtectionDomain pd1 = test1.adapt(ProtectionDomain.class); ProtectionDomain pd2 = test2.adapt(ProtectionDomain.class); - ProtectionDomain[] pds = new ProtectionDomain[] {pd1, pd2}; + ProtectionDomain[] pds = new ProtectionDomain[] { pd1, pd2 }; ConditionalPermissionUpdate update = cpa.newConditionalPermissionUpdate(); List rows = update.getConditionalPermissionInfos(); - rows.add(cpa.newConditionalPermissionInfo(null, new ConditionInfo[] {POST_MUT_SAT}, READONLY_INFOS, ConditionalPermissionInfo.DENY)); - rows.add(cpa.newConditionalPermissionInfo(null, new ConditionInfo[] {POST_MUT_SAT}, READONLY_INFOS, ConditionalPermissionInfo.DENY)); - rows.add(cpa.newConditionalPermissionInfo(null, new ConditionInfo[] {POST_MUT_UNSAT}, READONLY_INFOS, ConditionalPermissionInfo.DENY)); - assertTrue("failed to commit", update.commit()); //$NON-NLS-1$); + rows.add(cpa.newConditionalPermissionInfo(null, new ConditionInfo[] { POST_MUT_SAT }, READONLY_INFOS, + ConditionalPermissionInfo.DENY)); + rows.add(cpa.newConditionalPermissionInfo(null, new ConditionInfo[] { POST_MUT_SAT }, READONLY_INFOS, + ConditionalPermissionInfo.DENY)); + rows.add(cpa.newConditionalPermissionInfo(null, new ConditionInfo[] { POST_MUT_UNSAT }, READONLY_INFOS, + ConditionalPermissionInfo.DENY)); + assertTrue("failed to commit", update.commit()); //$NON-NLS-1$ ); testSMPermission(pds, new FilePermission("test", "read"), false); //$NON-NLS-1$ //$NON-NLS-2$ @@ -648,7 +697,8 @@ public void testPostponedConditions04() throws BundleException { // ProtectionDomains are processed by the AccessControlContext (bug 269917) // Just make sure both tc1 and tc2 are not non-null at the same time. assertTrue("tc1sat and tc2sat are either both null or both non-null", (tc1sat == null) ^ (tc2sat == null)); //$NON-NLS-1$ - assertTrue("tc1unsat and tc2unsat are either both null or both non-null", (tc1unsat == null) ^ (tc2unsat == null)); //$NON-NLS-1$ + assertTrue("tc1unsat and tc2unsat are either both null or both non-null", //$NON-NLS-1$ + (tc1unsat == null) ^ (tc2unsat == null)); TestCondition modifySat = tc1sat != null ? tc1sat : tc2sat; TestCondition modifyUnsat = tc1unsat != null ? tc1unsat : tc2unsat; @@ -666,16 +716,21 @@ public void testPostponedConditions05() throws BundleException { Bundle test2 = installTestBundle(TEST2_BUNDLE); ProtectionDomain pd1 = test1.adapt(ProtectionDomain.class); ProtectionDomain pd2 = test2.adapt(ProtectionDomain.class); - ProtectionDomain[] pds = new ProtectionDomain[] {pd1, pd2}; + ProtectionDomain[] pds = new ProtectionDomain[] { pd1, pd2 }; ConditionalPermissionUpdate update = cpa.newConditionalPermissionUpdate(); List rows = update.getConditionalPermissionInfos(); - rows.add(cpa.newConditionalPermissionInfo(null, new ConditionInfo[] {POST_MUT_SAT}, READONLY_INFOS, ConditionalPermissionInfo.DENY)); - rows.add(cpa.newConditionalPermissionInfo(null, new ConditionInfo[] {POST_MUT_UNSAT}, READONLY_INFOS, ConditionalPermissionInfo.ALLOW)); - rows.add(cpa.newConditionalPermissionInfo(null, new ConditionInfo[] {POST_MUT_SAT}, READONLY_INFOS, ConditionalPermissionInfo.ALLOW)); - rows.add(cpa.newConditionalPermissionInfo(null, new ConditionInfo[] {POST_MUT_UNSAT}, READONLY_INFOS, ConditionalPermissionInfo.ALLOW)); - rows.add(cpa.newConditionalPermissionInfo(null, ALLLOCATION_CONDS, READONLY_INFOS, ConditionalPermissionInfo.ALLOW)); - assertTrue("failed to commit", update.commit()); //$NON-NLS-1$); + rows.add(cpa.newConditionalPermissionInfo(null, new ConditionInfo[] { POST_MUT_SAT }, READONLY_INFOS, + ConditionalPermissionInfo.DENY)); + rows.add(cpa.newConditionalPermissionInfo(null, new ConditionInfo[] { POST_MUT_UNSAT }, READONLY_INFOS, + ConditionalPermissionInfo.ALLOW)); + rows.add(cpa.newConditionalPermissionInfo(null, new ConditionInfo[] { POST_MUT_SAT }, READONLY_INFOS, + ConditionalPermissionInfo.ALLOW)); + rows.add(cpa.newConditionalPermissionInfo(null, new ConditionInfo[] { POST_MUT_UNSAT }, READONLY_INFOS, + ConditionalPermissionInfo.ALLOW)); + rows.add(cpa.newConditionalPermissionInfo(null, ALLLOCATION_CONDS, READONLY_INFOS, + ConditionalPermissionInfo.ALLOW)); + assertTrue("failed to commit", update.commit()); //$NON-NLS-1$ ); testSMPermission(pds, new FilePermission("test", "read"), false); //$NON-NLS-1$ //$NON-NLS-2$ @@ -701,13 +756,15 @@ public void testMutableConditions() throws BundleException { Bundle test1 = installTestBundle(TEST_BUNDLE); ProtectionDomain pd1 = test1.adapt(ProtectionDomain.class); - ProtectionDomain[] pds = new ProtectionDomain[] {pd1}; + ProtectionDomain[] pds = new ProtectionDomain[] { pd1 }; ConditionalPermissionUpdate update = cpa.newConditionalPermissionUpdate(); List rows = update.getConditionalPermissionInfos(); - rows.add(cpa.newConditionalPermissionInfo(null, new ConditionInfo[] {MUT_SAT}, READONLY_INFOS, ConditionalPermissionInfo.DENY)); - rows.add(cpa.newConditionalPermissionInfo(null, ALLLOCATION_CONDS, READONLY_INFOS, ConditionalPermissionInfo.ALLOW)); - assertTrue("failed to commit", update.commit()); //$NON-NLS-1$); + rows.add(cpa.newConditionalPermissionInfo(null, new ConditionInfo[] { MUT_SAT }, READONLY_INFOS, + ConditionalPermissionInfo.DENY)); + rows.add(cpa.newConditionalPermissionInfo(null, ALLLOCATION_CONDS, READONLY_INFOS, + ConditionalPermissionInfo.ALLOW)); + assertTrue("failed to commit", update.commit()); //$NON-NLS-1$ ); testSMPermission(pds, new FilePermission("test", "read"), false); //$NON-NLS-1$ //$NON-NLS-2$ @@ -722,9 +779,11 @@ public void testMutableConditions() throws BundleException { update = cpa.newConditionalPermissionUpdate(); rows = update.getConditionalPermissionInfos(); rows.clear(); - rows.add(cpa.newConditionalPermissionInfo(null, new ConditionInfo[] {NOT_MUT_SAT, MUT_SAT}, READONLY_INFOS, ConditionalPermissionInfo.DENY)); - rows.add(cpa.newConditionalPermissionInfo(null, ALLLOCATION_CONDS, READONLY_INFOS, ConditionalPermissionInfo.ALLOW)); - assertTrue("failed to commit", update.commit()); //$NON-NLS-1$); + rows.add(cpa.newConditionalPermissionInfo(null, new ConditionInfo[] { NOT_MUT_SAT, MUT_SAT }, READONLY_INFOS, + ConditionalPermissionInfo.DENY)); + rows.add(cpa.newConditionalPermissionInfo(null, ALLLOCATION_CONDS, READONLY_INFOS, + ConditionalPermissionInfo.ALLOW)); + assertTrue("failed to commit", update.commit()); //$NON-NLS-1$ ); testSMPermission(pds, new FilePermission("test", "read"), false); //$NON-NLS-1$ //$NON-NLS-2$ // test again to make sure we get the same result @@ -742,10 +801,11 @@ public void testAccessControlContext01() { // test single row with signer condition ConditionalPermissionUpdate update = cpa.newConditionalPermissionUpdate(); List rows = update.getConditionalPermissionInfos(); - rows.add(cpa.newConditionalPermissionInfo(null, new ConditionInfo[] {SIGNER_CONDITION1}, READONLY_INFOS, ConditionalPermissionInfo.ALLOW)); + rows.add(cpa.newConditionalPermissionInfo(null, new ConditionInfo[] { SIGNER_CONDITION1 }, READONLY_INFOS, + ConditionalPermissionInfo.ALLOW)); assertTrue("failed to commit", update.commit()); //$NON-NLS-1$ - AccessControlContext acc = cpa.getAccessControlContext(new String[] {"cn=t1,c=FR;cn=test1,c=US"}); //$NON-NLS-1$ + AccessControlContext acc = cpa.getAccessControlContext(new String[] { "cn=t1,c=FR;cn=test1,c=US" }); //$NON-NLS-1$ assertThrows(AccessControlException.class, () -> acc.checkPermission(new FilePermission("test", "write"))); acc.checkPermission(new FilePermission("test", "read")); //$NON-NLS-1$ //$NON-NLS-2$ } @@ -755,10 +815,11 @@ public void testAccessControlContext01a() { // test single row with signer condition ConditionalPermissionUpdate update = cpa.newConditionalPermissionUpdate(); List rows = update.getConditionalPermissionInfos(); - rows.add(cpa.newConditionalPermissionInfo(null, new ConditionInfo[] {SIGNER_CONDITION1}, READONLY_INFOS, ConditionalPermissionInfo.ALLOW)); + rows.add(cpa.newConditionalPermissionInfo(null, new ConditionInfo[] { SIGNER_CONDITION1 }, READONLY_INFOS, + ConditionalPermissionInfo.ALLOW)); assertTrue("failed to commit", update.commit()); //$NON-NLS-1$ - AccessControlContext acc = cpa.getAccessControlContext(new String[] {"cn=test1,c=US"}); //$NON-NLS-1$ + AccessControlContext acc = cpa.getAccessControlContext(new String[] { "cn=test1,c=US" }); //$NON-NLS-1$ assertThrows(AccessControlException.class, () -> acc.checkPermission(new FilePermission("test", "write"))); acc.checkPermission(new FilePermission("test", "read")); //$NON-NLS-1$ //$NON-NLS-2$ } @@ -768,12 +829,15 @@ public void testAccessControlContext02() { // test with DENY row ConditionalPermissionUpdate update = cpa.newConditionalPermissionUpdate(); List rows = update.getConditionalPermissionInfos(); - rows.add(cpa.newConditionalPermissionInfo(null, new ConditionInfo[] {SIGNER_CONDITION1}, READONLY_INFOS, ConditionalPermissionInfo.ALLOW)); - rows.add(cpa.newConditionalPermissionInfo(null, new ConditionInfo[] {SIGNER_CONDITION1}, READWRITE_INFOS, ConditionalPermissionInfo.DENY)); - rows.add(cpa.newConditionalPermissionInfo(null, new ConditionInfo[] {SIGNER_CONDITION1}, READWRITE_INFOS, ConditionalPermissionInfo.ALLOW)); + rows.add(cpa.newConditionalPermissionInfo(null, new ConditionInfo[] { SIGNER_CONDITION1 }, READONLY_INFOS, + ConditionalPermissionInfo.ALLOW)); + rows.add(cpa.newConditionalPermissionInfo(null, new ConditionInfo[] { SIGNER_CONDITION1 }, READWRITE_INFOS, + ConditionalPermissionInfo.DENY)); + rows.add(cpa.newConditionalPermissionInfo(null, new ConditionInfo[] { SIGNER_CONDITION1 }, READWRITE_INFOS, + ConditionalPermissionInfo.ALLOW)); assertTrue("failed to commit", update.commit()); //$NON-NLS-1$ - AccessControlContext acc = cpa.getAccessControlContext(new String[] {"cn=t1,c=FR;cn=test1,c=US"}); //$NON-NLS-1$ + AccessControlContext acc = cpa.getAccessControlContext(new String[] { "cn=t1,c=FR;cn=test1,c=US" }); //$NON-NLS-1$ assertThrows(AccessControlException.class, () -> acc.checkPermission(new FilePermission("test", "write"))); acc.checkPermission(new FilePermission("test", "read")); //$NON-NLS-1$ //$NON-NLS-2$ @@ -784,16 +848,18 @@ public void testAccessControlContext03() { // test multiple signer conditions ConditionalPermissionUpdate update = cpa.newConditionalPermissionUpdate(); List rows = update.getConditionalPermissionInfos(); - rows.add(cpa.newConditionalPermissionInfo(null, new ConditionInfo[] {SIGNER_CONDITION1}, READONLY_INFOS, ConditionalPermissionInfo.ALLOW)); + rows.add(cpa.newConditionalPermissionInfo(null, new ConditionInfo[] { SIGNER_CONDITION1 }, READONLY_INFOS, + ConditionalPermissionInfo.ALLOW)); assertTrue("failed to commit", update.commit()); //$NON-NLS-1$ - AccessControlContext acc = cpa.getAccessControlContext(new String[] {"cn=t1,c=FR;cn=test2,c=US"}); //$NON-NLS-1$ + AccessControlContext acc = cpa.getAccessControlContext(new String[] { "cn=t1,c=FR;cn=test2,c=US" }); //$NON-NLS-1$ assertThrows(AccessControlException.class, () -> acc.checkPermission(new FilePermission("test", "write"))); assertThrows(AccessControlException.class, () -> acc.checkPermission(new FilePermission("test", "read"))); update = cpa.newConditionalPermissionUpdate(); rows = update.getConditionalPermissionInfos(); - rows.add(cpa.newConditionalPermissionInfo(null, new ConditionInfo[] {SIGNER_CONDITION2}, READONLY_INFOS, ConditionalPermissionInfo.ALLOW)); + rows.add(cpa.newConditionalPermissionInfo(null, new ConditionInfo[] { SIGNER_CONDITION2 }, READONLY_INFOS, + ConditionalPermissionInfo.ALLOW)); assertTrue("failed to commit", update.commit()); //$NON-NLS-1$ AccessControlContext acc2 = cpa.getAccessControlContext(new String[] { "cn=t1,c=FR;cn=test2,c=US" }); //$NON-NLS-1$ assertThrows(AccessControlException.class, () -> acc2.checkPermission(new FilePermission("test", "write"))); @@ -805,15 +871,18 @@ public void testAccessControlContext04() { // test multiple signer conditions ConditionalPermissionUpdate update = cpa.newConditionalPermissionUpdate(); List rows = update.getConditionalPermissionInfos(); - rows.add(cpa.newConditionalPermissionInfo(null, new ConditionInfo[] {SIGNER_CONDITION1, SIGNER_CONDITION2}, READONLY_INFOS, ConditionalPermissionInfo.ALLOW)); - rows.add(cpa.newConditionalPermissionInfo(null, new ConditionInfo[] {SIGNER_CONDITION1}, READWRITE_INFOS, ConditionalPermissionInfo.ALLOW)); + rows.add(cpa.newConditionalPermissionInfo(null, new ConditionInfo[] { SIGNER_CONDITION1, SIGNER_CONDITION2 }, + READONLY_INFOS, ConditionalPermissionInfo.ALLOW)); + rows.add(cpa.newConditionalPermissionInfo(null, new ConditionInfo[] { SIGNER_CONDITION1 }, READWRITE_INFOS, + ConditionalPermissionInfo.ALLOW)); assertTrue("failed to commit", update.commit()); //$NON-NLS-1$ - AccessControlContext acc = cpa.getAccessControlContext(new String[] {"cn=t1,c=FR;cn=test2,c=US"}); //$NON-NLS-1$ + AccessControlContext acc = cpa.getAccessControlContext(new String[] { "cn=t1,c=FR;cn=test2,c=US" }); //$NON-NLS-1$ assertThrows(AccessControlException.class, () -> acc.checkPermission(new FilePermission("test", "write"))); assertThrows(AccessControlException.class, () -> acc.checkPermission(new FilePermission("test", "read"))); - AccessControlContext acc2 = cpa.getAccessControlContext(new String[] { "cn=t1,c=FR;cn=test1,c=US", "cn=t1,c=FR;cn=test2,c=US" }); //$NON-NLS-1$ //$NON-NLS-2$ + AccessControlContext acc2 = cpa + .getAccessControlContext(new String[] { "cn=t1,c=FR;cn=test1,c=US", "cn=t1,c=FR;cn=test2,c=US" }); //$NON-NLS-1$ //$NON-NLS-2$ acc2.checkPermission(new FilePermission("test", "write")); acc2.checkPermission(new FilePermission("test", "read")); //$NON-NLS-1$ //$NON-NLS-2$ } @@ -838,8 +907,10 @@ public void testAccessControlContext06() { // test with empty condition rows ConditionalPermissionUpdate update = cpa.newConditionalPermissionUpdate(); List rows = update.getConditionalPermissionInfos(); - rows.add(cpa.newConditionalPermissionInfo(null, new ConditionInfo[] {}, READONLY_INFOS, ConditionalPermissionInfo.ALLOW)); - rows.add(cpa.newConditionalPermissionInfo(null, new ConditionInfo[] {SIGNER_CONDITION1}, READWRITE_INFOS, ConditionalPermissionInfo.ALLOW)); + rows.add(cpa.newConditionalPermissionInfo(null, new ConditionInfo[] {}, READONLY_INFOS, + ConditionalPermissionInfo.ALLOW)); + rows.add(cpa.newConditionalPermissionInfo(null, new ConditionInfo[] { SIGNER_CONDITION1 }, READWRITE_INFOS, + ConditionalPermissionInfo.ALLOW)); assertTrue("failed to commit", update.commit()); //$NON-NLS-1$ AccessControlContext acc = cpa.getAccessControlContext(new String[] { "cn=t1,c=FR;cn=test2,c=US" }); //$NON-NLS-1$ @@ -852,9 +923,10 @@ public void testAccessControlContext07() { // test ! signer condition ConditionalPermissionUpdate update = cpa.newConditionalPermissionUpdate(); List rows = update.getConditionalPermissionInfos(); - rows.add(cpa.newConditionalPermissionInfo(null, new ConditionInfo[] {NOT_SIGNER_CONDITION1}, READONLY_INFOS, ConditionalPermissionInfo.ALLOW)); + rows.add(cpa.newConditionalPermissionInfo(null, new ConditionInfo[] { NOT_SIGNER_CONDITION1 }, READONLY_INFOS, + ConditionalPermissionInfo.ALLOW)); assertTrue("failed to commit", update.commit()); //$NON-NLS-1$ - AccessControlContext acc = cpa.getAccessControlContext(new String[] {"cn=t1,c=FR;cn=test1,c=US"}); //$NON-NLS-1$ + AccessControlContext acc = cpa.getAccessControlContext(new String[] { "cn=t1,c=FR;cn=test1,c=US" }); //$NON-NLS-1$ assertThrows(AccessControlException.class, () -> acc.checkPermission(new FilePermission("test", "write"))); assertThrows(AccessControlException.class, () -> acc.checkPermission(new FilePermission("test", "read"))); @@ -876,8 +948,10 @@ public void testEncodingInfos01() throws Exception { stop(equinox); equinox.init(); - cpa = equinox.getBundleContext().getService(equinox.getBundleContext().getServiceReference(ConditionalPermissionAdmin.class)); - pa = equinox.getBundleContext().getService(equinox.getBundleContext().getServiceReference(PermissionAdmin.class)); + cpa = equinox.getBundleContext() + .getService(equinox.getBundleContext().getServiceReference(ConditionalPermissionAdmin.class)); + pa = equinox.getBundleContext() + .getService(equinox.getBundleContext().getServiceReference(PermissionAdmin.class)); String info3 = "deny { [Test3] (Type3 \"name3\" \"action3\") } \"name3\""; //$NON-NLS-1$ @@ -905,48 +979,57 @@ public void testEncodingInfos01() throws Exception { @Test public void testEncodingInfos02() { - ConditionInfo cond1 = new ConditionInfo("Test1", new String[] {"arg1", "arg2"}); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$ - ConditionInfo cond2 = new ConditionInfo("Test1", new String[] {"arg1", "arg2", "arg3"}); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$ //$NON-NLS-4$ - ConditionInfo cond3 = new ConditionInfo("Test1", new String[] {"test } test", "} test"}); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$ + ConditionInfo cond1 = new ConditionInfo("Test1", new String[] { "arg1", "arg2" }); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$ + ConditionInfo cond2 = new ConditionInfo("Test1", new String[] { "arg1", "arg2", "arg3" }); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$ //$NON-NLS-4$ + ConditionInfo cond3 = new ConditionInfo("Test1", new String[] { "test } test", "} test" }); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$ PermissionInfo perm1 = new PermissionInfo("Type1", "name1", "action1"); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ PermissionInfo perm2 = new PermissionInfo("Type1", "}", "test }"); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$ // good info; mix case decision - ConditionalPermissionInfo testInfo1 = cpa.newConditionalPermissionInfo("name1", new ConditionInfo[] {cond1}, new PermissionInfo[] {perm1}, "allow"); //$NON-NLS-1$ //$NON-NLS-2$ - ConditionalPermissionInfo testInfo2 = checkGoodInfo("AlLoW { [Test1 \"arg1\" \"arg2\"] (Type1 \"name1\" \"action1\") } \"name1\""); //$NON-NLS-1$ + ConditionalPermissionInfo testInfo1 = cpa.newConditionalPermissionInfo("name1", new ConditionInfo[] { cond1 }, //$NON-NLS-1$ + new PermissionInfo[] { perm1 }, "allow"); //$NON-NLS-1$ + ConditionalPermissionInfo testInfo2 = checkGoodInfo( + "AlLoW { [Test1 \"arg1\" \"arg2\"] (Type1 \"name1\" \"action1\") } \"name1\""); //$NON-NLS-1$ checkInfos(testInfo1, testInfo2); - testInfo1 = cpa.newConditionalPermissionInfo("name1", new ConditionInfo[] {cond2}, new PermissionInfo[] {perm1}, "deny"); //$NON-NLS-1$ //$NON-NLS-2$ - testInfo2 = checkGoodInfo("dEnY { [Test1 \"arg1\" \"arg2\" \"arg3\"] (Type1 \"name1\" \"action1\") } \"name1\""); //$NON-NLS-1$ + testInfo1 = cpa.newConditionalPermissionInfo("name1", new ConditionInfo[] { cond2 }, //$NON-NLS-1$ + new PermissionInfo[] { perm1 }, "deny"); //$NON-NLS-1$ + testInfo2 = checkGoodInfo( + "dEnY { [Test1 \"arg1\" \"arg2\" \"arg3\"] (Type1 \"name1\" \"action1\") } \"name1\""); //$NON-NLS-1$ checkInfos(testInfo1, testInfo2); // good info; no conditions - testInfo1 = cpa.newConditionalPermissionInfo("name1", null, new PermissionInfo[] {perm1}, "deny"); //$NON-NLS-1$ //$NON-NLS-2$ + testInfo1 = cpa.newConditionalPermissionInfo("name1", null, new PermissionInfo[] { perm1 }, "deny"); //$NON-NLS-1$ //$NON-NLS-2$ testInfo2 = checkGoodInfo("dEnY { (Type1 \"name1\" \"action1\") } \"name1\""); //$NON-NLS-1$ checkInfos(testInfo1, testInfo2); // good info; no name - testInfo1 = cpa.newConditionalPermissionInfo(null, new ConditionInfo[] {cond1}, new PermissionInfo[] {perm1}, "allow"); //$NON-NLS-1$ + testInfo1 = cpa.newConditionalPermissionInfo(null, new ConditionInfo[] { cond1 }, + new PermissionInfo[] { perm1 }, "allow"); //$NON-NLS-1$ testInfo2 = checkGoodInfo("allow { [Test1 \"arg1\" \"arg2\"] (Type1 \"name1\" \"action1\") }"); //$NON-NLS-1$ checkInfos(testInfo1, testInfo2); // good info; empty name - testInfo1 = cpa.newConditionalPermissionInfo("", new ConditionInfo[] {cond1}, new PermissionInfo[] {perm1}, "allow"); //$NON-NLS-1$ //$NON-NLS-2$ + testInfo1 = cpa.newConditionalPermissionInfo("", new ConditionInfo[] { cond1 }, new PermissionInfo[] { perm1 }, //$NON-NLS-1$ + "allow"); //$NON-NLS-1$ testInfo2 = checkGoodInfo("allow { [Test1 \"arg1\" \"arg2\"] (Type1 \"name1\" \"action1\") } \"\""); //$NON-NLS-1$ checkInfos(testInfo1, testInfo2); // good info; no white space - testInfo1 = cpa.newConditionalPermissionInfo("name1", new ConditionInfo[] {cond1}, new PermissionInfo[] {perm1}, "allow"); //$NON-NLS-1$ //$NON-NLS-2$ + testInfo1 = cpa.newConditionalPermissionInfo("name1", new ConditionInfo[] { cond1 }, //$NON-NLS-1$ + new PermissionInfo[] { perm1 }, "allow"); //$NON-NLS-1$ testInfo2 = checkGoodInfo("allow{[Test1 \"arg1\" \"arg2\"](Type1 \"name1\" \"action1\")}\"name1\""); //$NON-NLS-1$ checkInfos(testInfo1, testInfo2); // good info; '}' in quoted value - testInfo1 = cpa.newConditionalPermissionInfo("name", new ConditionInfo[] {cond3}, new PermissionInfo[] {perm2}, "allow"); //$NON-NLS-1$ //$NON-NLS-2$ + testInfo1 = cpa.newConditionalPermissionInfo("name", new ConditionInfo[] { cond3 }, //$NON-NLS-1$ + new PermissionInfo[] { perm2 }, "allow"); //$NON-NLS-1$ testInfo2 = checkGoodInfo("allow { [Test1 \"test } test\" \"} test\"] (Type1 \"}\" \"test }\") } \"name\""); //$NON-NLS-1$ checkInfos(testInfo1, testInfo2); // good info; '}' in quoted value - testInfo1 = cpa.newConditionalPermissionInfo("na } me", new ConditionInfo[] {cond3}, new PermissionInfo[] {perm2}, "allow"); //$NON-NLS-1$ //$NON-NLS-2$ + testInfo1 = cpa.newConditionalPermissionInfo("na } me", new ConditionInfo[] { cond3 }, //$NON-NLS-1$ + new PermissionInfo[] { perm2 }, "allow"); //$NON-NLS-1$ testInfo2 = checkGoodInfo("allow { [Test1 \"test } test\" \"} test\"] (Type1 \"}\" \"test }\") } \"na } me\""); //$NON-NLS-1$ checkInfos(testInfo1, testInfo2); @@ -1014,7 +1097,8 @@ public void testRelativeFilePermission() throws BundleException { // test set by conditions ConditionalPermissionUpdate update = cpa.newConditionalPermissionUpdate(); List rows = update.getConditionalPermissionInfos(); - rows.add(cpa.newConditionalPermissionInfo(null, getLocationConditions(test.getLocation(), false), RELATIVE_EXEC_FILE_INFOS, ConditionalPermissionInfo.ALLOW)); + rows.add(cpa.newConditionalPermissionInfo(null, getLocationConditions(test.getLocation(), false), + RELATIVE_EXEC_FILE_INFOS, ConditionalPermissionInfo.ALLOW)); assertTrue("failed to commit", update.commit()); testPermission(acc, new FilePermission(testFile.getPath(), "write"), true); @@ -1030,7 +1114,8 @@ public void testRelativeFilePermission() throws BundleException { update = cpa.newConditionalPermissionUpdate(); rows = update.getConditionalPermissionInfos(); rows.clear(); - rows.add(cpa.newConditionalPermissionInfo(null, getLocationConditions(test.getLocation(), false), READONLY_INFOS, ConditionalPermissionInfo.ALLOW)); + rows.add(cpa.newConditionalPermissionInfo(null, getLocationConditions(test.getLocation(), false), + READONLY_INFOS, ConditionalPermissionInfo.ALLOW)); assertTrue("failed to commit", update.commit()); testPermission(acc, new FilePermission(testFile.getPath(), "write"), true); @@ -1061,22 +1146,26 @@ public void testRelativeFilePermission() throws BundleException { pa.setDefaultPermissions(null); testPermission(acc, new AllPermission(), true); - // Test that the ACC returned from CPA.getAccessControlContext does not handle relative file permissions + // Test that the ACC returned from CPA.getAccessControlContext does not handle + // relative file permissions update = cpa.newConditionalPermissionUpdate(); rows = update.getConditionalPermissionInfos(); - rows.add(cpa.newConditionalPermissionInfo(null, new ConditionInfo[] {SIGNER_CONDITION1}, RELATIVE_EXEC_FILE_INFOS, ConditionalPermissionInfo.ALLOW)); + rows.add(cpa.newConditionalPermissionInfo(null, new ConditionInfo[] { SIGNER_CONDITION1 }, + RELATIVE_EXEC_FILE_INFOS, ConditionalPermissionInfo.ALLOW)); assertTrue("failed to commit", update.commit()); File relativeExecutable = new File("bin/executableFile"); - acc = cpa.getAccessControlContext(new String[] {"cn=t1,c=FR;cn=test1,c=US"}); + acc = cpa.getAccessControlContext(new String[] { "cn=t1,c=FR;cn=test1,c=US" }); testPermission(acc, new FilePermission(relativeExecutable.getAbsolutePath(), "execute"), false); // update CPA to use absolute path update = cpa.newConditionalPermissionUpdate(); rows = update.getConditionalPermissionInfos(); rows.clear(); - PermissionInfo[] absExectInfos = new PermissionInfo[] {new PermissionInfo("java.io.FilePermission", relativeExecutable.getAbsolutePath(), "execute")}; - rows.add(cpa.newConditionalPermissionInfo(null, new ConditionInfo[] {SIGNER_CONDITION1}, absExectInfos, ConditionalPermissionInfo.ALLOW)); + PermissionInfo[] absExectInfos = new PermissionInfo[] { + new PermissionInfo("java.io.FilePermission", relativeExecutable.getAbsolutePath(), "execute") }; + rows.add(cpa.newConditionalPermissionInfo(null, new ConditionInfo[] { SIGNER_CONDITION1 }, absExectInfos, + ConditionalPermissionInfo.ALLOW)); assertTrue("failed to commit", update.commit()); testPermission(acc, new FilePermission(relativeExecutable.getAbsolutePath(), "execute"), true); @@ -1099,7 +1188,8 @@ public void testPermissionCheckCache() { // takes ~6sec } private void checkInfos(ConditionalPermissionInfo testInfo1, ConditionalPermissionInfo testInfo2) { - assertTrue("Infos are not equal: " + testInfo1.getEncoded() + " " + testInfo2.getEncoded(), testInfo1.equals(testInfo2)); + assertTrue("Infos are not equal: " + testInfo1.getEncoded() + " " + testInfo2.getEncoded(), + testInfo1.equals(testInfo2)); assertEquals("Info hash code is not equal", testInfo1.hashCode(), testInfo2.hashCode()); } @@ -1125,8 +1215,9 @@ private void testPermission(AccessControlContext acc, Permission permission, boo } private ConditionInfo[] getLocationConditions(String location, boolean not) { - String[] args = not ? new String[] {location, "!"} : new String[] {location}; //$NON-NLS-1$ - return new ConditionInfo[] {new ConditionInfo("org.osgi.service.condpermadmin.BundleLocationCondition", args)}; //$NON-NLS-1$ + String[] args = not ? new String[] { location, "!" } : new String[] { location }; //$NON-NLS-1$ + return new ConditionInfo[] { + new ConditionInfo("org.osgi.service.condpermadmin.BundleLocationCondition", args) }; //$NON-NLS-1$ } private Bundle installTestBundle(String name) throws BundleException { diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/securityadmin/SecurityManagerTests.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/securityadmin/SecurityManagerTests.java index 16e1e70ea7b..5b0ca3ba4d1 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/securityadmin/SecurityManagerTests.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/securityadmin/SecurityManagerTests.java @@ -68,11 +68,16 @@ import org.osgi.service.startlevel.StartLevel; public class SecurityManagerTests extends AbstractBundleTests { - private static final PermissionInfo hostFragmentPermission = new PermissionInfo(BundlePermission.class.getName(), "*", "host,fragment"); //$NON-NLS-1$ //$NON-NLS-2$ - private static final PermissionInfo hostFragmentProvidePermission = new PermissionInfo(BundlePermission.class.getName(), "*", "host,fragment,provide"); //$NON-NLS-1$ //$NON-NLS-2$ - private static final PermissionInfo allPackagePermission = new PermissionInfo(PackagePermission.class.getName(), "*", "import,export"); //$NON-NLS-1$ //$NON-NLS-2$ - private static final PermissionInfo importPackagePermission = new PermissionInfo(PackagePermission.class.getName(), "*", "import"); //$NON-NLS-1$ //$NON-NLS-2$ - private static final PermissionInfo importFrameworkPackagePermission = new PermissionInfo(PackagePermission.class.getName(), "org.osgi.framework", "import"); //$NON-NLS-1$ //$NON-NLS-2$ + private static final PermissionInfo hostFragmentPermission = new PermissionInfo(BundlePermission.class.getName(), + "*", "host,fragment"); //$NON-NLS-1$ //$NON-NLS-2$ + private static final PermissionInfo hostFragmentProvidePermission = new PermissionInfo( + BundlePermission.class.getName(), "*", "host,fragment,provide"); //$NON-NLS-1$ //$NON-NLS-2$ + private static final PermissionInfo allPackagePermission = new PermissionInfo(PackagePermission.class.getName(), + "*", "import,export"); //$NON-NLS-1$ //$NON-NLS-2$ + private static final PermissionInfo importPackagePermission = new PermissionInfo(PackagePermission.class.getName(), + "*", "import"); //$NON-NLS-1$ //$NON-NLS-2$ + private static final PermissionInfo importFrameworkPackagePermission = new PermissionInfo( + PackagePermission.class.getName(), "org.osgi.framework", "import"); //$NON-NLS-1$ //$NON-NLS-2$ private Policy previousPolicy; @Override @@ -181,10 +186,13 @@ public void testEnableSecurityManager02() throws BundleException { String locationSecurityA = installer.getBundleLocation("security.a"); //$NON-NLS-1$ String locationSecurityAFragA = installer.getBundleLocation("security.a.frag.a"); //$NON-NLS-1$ // set the security for the host and fragment - ConditionalPermissionAdmin ca = (ConditionalPermissionAdmin) systemContext.getService(systemContext.getServiceReference(ConditionalPermissionAdmin.class.getName())); + ConditionalPermissionAdmin ca = (ConditionalPermissionAdmin) systemContext + .getService(systemContext.getServiceReference(ConditionalPermissionAdmin.class.getName())); ConditionalPermissionUpdate update = ca.newConditionalPermissionUpdate(); List rows = update.getConditionalPermissionInfos(); - rows.add(ca.newConditionalPermissionInfo(null, null, new PermissionInfo[] {hostFragmentPermission, allPackagePermission}, ConditionalPermissionInfo.ALLOW)); + rows.add(ca.newConditionalPermissionInfo(null, null, + new PermissionInfo[] { hostFragmentPermission, allPackagePermission }, + ConditionalPermissionInfo.ALLOW)); assertTrue("Cannot commit rows", update.commit()); //$NON-NLS-1$ Bundle securityA = systemContext.installBundle(locationSecurityA); @@ -220,19 +228,23 @@ public void testEnableSecurityManager03() throws BundleException { // try installing a bundle to tests bug String locationSecurityA = installer.getBundleLocation("security.a"); //$NON-NLS-1$ // set the security for the bundle - ConditionalPermissionAdmin ca = (ConditionalPermissionAdmin) systemContext.getService(systemContext.getServiceReference(ConditionalPermissionAdmin.class.getName())); + ConditionalPermissionAdmin ca = (ConditionalPermissionAdmin) systemContext + .getService(systemContext.getServiceReference(ConditionalPermissionAdmin.class.getName())); ConditionalPermissionUpdate update = ca.newConditionalPermissionUpdate(); List rows = update.getConditionalPermissionInfos(); - rows.add(ca.newConditionalPermissionInfo(null, null, new PermissionInfo[] {hostFragmentPermission, importPackagePermission}, ConditionalPermissionInfo.ALLOW)); + rows.add(ca.newConditionalPermissionInfo(null, null, + new PermissionInfo[] { hostFragmentPermission, importPackagePermission }, + ConditionalPermissionInfo.ALLOW)); assertTrue("Cannot commit rows", update.commit()); //$NON-NLS-1$ Bundle securityA = systemContext.installBundle(locationSecurityA); equinox.start(); - PackageAdmin pa = (PackageAdmin) systemContext.getService(systemContext.getServiceReference(PackageAdmin.class.getName())); + PackageAdmin pa = (PackageAdmin) systemContext + .getService(systemContext.getServiceReference(PackageAdmin.class.getName())); try { - assertTrue(pa.resolveBundles(new Bundle[] {securityA})); + assertTrue(pa.resolveBundles(new Bundle[] { securityA })); ExportedPackage[] eps = pa.getExportedPackages(securityA); assertNull("Found unexpected exports", eps); //$NON-NLS-1$ RequiredBundle[] rbs = pa.getRequiredBundles(securityA.getSymbolicName()); @@ -241,7 +253,9 @@ public void testEnableSecurityManager03() throws BundleException { update = ca.newConditionalPermissionUpdate(); rows = update.getConditionalPermissionInfos(); rows.clear(); - rows.add(ca.newConditionalPermissionInfo(null, null, new PermissionInfo[] {hostFragmentProvidePermission, allPackagePermission}, ConditionalPermissionInfo.ALLOW)); + rows.add(ca.newConditionalPermissionInfo(null, null, + new PermissionInfo[] { hostFragmentProvidePermission, allPackagePermission }, + ConditionalPermissionInfo.ALLOW)); assertTrue("Cannot commit rows", update.commit()); //$NON-NLS-1$ securityA.uninstall(); @@ -282,32 +296,46 @@ public void testEnableSecurityManager04() throws Exception { String locationLinkAClient = installer.getBundleLocation("test.link.a.client"); //$NON-NLS-1$ // set the security for the bundles - ConditionInfo linkACondition = new ConditionInfo(BundleLocationCondition.class.getName(), new String[] {locationLinkA}); - ConditionInfo linkAClientCondition = new ConditionInfo(BundleLocationCondition.class.getName(), new String[] {locationLinkAClient}); - PermissionInfo filterPermission = new PermissionInfo(PackagePermission.class.getName(), "(&(name=test.link.a)(package.name=test.link.*))", "import"); //$NON-NLS-1$ //$NON-NLS-2$ - ConditionalPermissionAdmin ca = (ConditionalPermissionAdmin) systemContext.getService(systemContext.getServiceReference(ConditionalPermissionAdmin.class.getName())); + ConditionInfo linkACondition = new ConditionInfo(BundleLocationCondition.class.getName(), + new String[] { locationLinkA }); + ConditionInfo linkAClientCondition = new ConditionInfo(BundleLocationCondition.class.getName(), + new String[] { locationLinkAClient }); + PermissionInfo filterPermission = new PermissionInfo(PackagePermission.class.getName(), + "(&(name=test.link.a)(package.name=test.link.*))", "import"); //$NON-NLS-1$ //$NON-NLS-2$ + ConditionalPermissionAdmin ca = (ConditionalPermissionAdmin) systemContext + .getService(systemContext.getServiceReference(ConditionalPermissionAdmin.class.getName())); ConditionalPermissionUpdate update = ca.newConditionalPermissionUpdate(); List rows = update.getConditionalPermissionInfos(); - rows.add(ca.newConditionalPermissionInfo(null, new ConditionInfo[] {linkACondition}, new PermissionInfo[] {hostFragmentProvidePermission, allPackagePermission}, ConditionalPermissionInfo.ALLOW)); - rows.add(ca.newConditionalPermissionInfo(null, new ConditionInfo[] {linkAClientCondition}, new PermissionInfo[] {importFrameworkPackagePermission, filterPermission}, ConditionalPermissionInfo.ALLOW)); + rows.add(ca.newConditionalPermissionInfo(null, new ConditionInfo[] { linkACondition }, + new PermissionInfo[] { hostFragmentProvidePermission, allPackagePermission }, + ConditionalPermissionInfo.ALLOW)); + rows.add(ca.newConditionalPermissionInfo(null, new ConditionInfo[] { linkAClientCondition }, + new PermissionInfo[] { importFrameworkPackagePermission, filterPermission }, + ConditionalPermissionInfo.ALLOW)); assertTrue("Cannot commit rows", update.commit()); //$NON-NLS-1$ Bundle linkA = systemContext.installBundle(locationLinkA); Bundle linkAClient = systemContext.installBundle(locationLinkAClient); equinox.start(); - PackageAdmin pa = (PackageAdmin) systemContext.getService(systemContext.getServiceReference(PackageAdmin.class.getName())); + PackageAdmin pa = (PackageAdmin) systemContext + .getService(systemContext.getServiceReference(PackageAdmin.class.getName())); try { assertTrue(pa.resolveBundles(new Bundle[] { linkA, linkAClient })); // change import permission to fail filter match - filterPermission = new PermissionInfo(PackagePermission.class.getName(), "(&(name=fail.match)(package.name=test.link.*))", "import"); //$NON-NLS-1$ //$NON-NLS-2$ + filterPermission = new PermissionInfo(PackagePermission.class.getName(), + "(&(name=fail.match)(package.name=test.link.*))", "import"); //$NON-NLS-1$ //$NON-NLS-2$ update = ca.newConditionalPermissionUpdate(); rows = update.getConditionalPermissionInfos(); rows.clear(); - rows.add(ca.newConditionalPermissionInfo(null, new ConditionInfo[] {linkACondition}, new PermissionInfo[] {hostFragmentProvidePermission, allPackagePermission}, ConditionalPermissionInfo.ALLOW)); - rows.add(ca.newConditionalPermissionInfo(null, new ConditionInfo[] {linkAClientCondition}, new PermissionInfo[] {importFrameworkPackagePermission, filterPermission}, ConditionalPermissionInfo.ALLOW)); + rows.add(ca.newConditionalPermissionInfo(null, new ConditionInfo[] { linkACondition }, + new PermissionInfo[] { hostFragmentProvidePermission, allPackagePermission }, + ConditionalPermissionInfo.ALLOW)); + rows.add(ca.newConditionalPermissionInfo(null, new ConditionInfo[] { linkAClientCondition }, + new PermissionInfo[] { importFrameworkPackagePermission, filterPermission }, + ConditionalPermissionInfo.ALLOW)); assertTrue("Cannot commit rows", update.commit()); //$NON-NLS-1$ - pa.refreshPackages(new Bundle[] {linkA, linkAClient}); + pa.refreshPackages(new Bundle[] { linkA, linkAClient }); // hack to wait for refresh to end Thread.sleep(2000); assertEquals("linkA has wrong state", Bundle.RESOLVED, linkA.getState()); //$NON-NLS-1$ @@ -322,7 +350,7 @@ public void testEnableSecurityManager04() throws Exception { @Test public void testEnableSecurityManager05() throws BundleException { - File config = OSGiTestsActivator.getContext().getDataFile(getName()); //$NON-NLS-1$ + File config = OSGiTestsActivator.getContext().getDataFile(getName()); // $NON-NLS-1$ Map configuration = new HashMap<>(); configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); configuration.put(Constants.FRAMEWORK_SECURITY, Constants.FRAMEWORK_SECURITY_OSGI); @@ -344,8 +372,9 @@ public void testEnableSecurityManager05() throws BundleException { equinox.start(); try { - PackageAdmin pa = (PackageAdmin) systemContext.getService(systemContext.getServiceReference(PackageAdmin.class.getName())); - assertTrue(pa.resolveBundles(new Bundle[] {linkA, linkAClient})); + PackageAdmin pa = (PackageAdmin) systemContext + .getService(systemContext.getServiceReference(PackageAdmin.class.getName())); + assertTrue(pa.resolveBundles(new Bundle[] { linkA, linkAClient })); linkA.uninstall(); linkAClient.uninstall(); @@ -379,10 +408,13 @@ public void testLocalization01() throws BundleException { String locationSecurityA = installer.getBundleLocation("security.a"); //$NON-NLS-1$ String locationSecurityAFragA = installer.getBundleLocation("security.a.frag.a"); //$NON-NLS-1$ // set the security for the host and fragment - ConditionalPermissionAdmin ca = (ConditionalPermissionAdmin) systemContext.getService(systemContext.getServiceReference(ConditionalPermissionAdmin.class.getName())); + ConditionalPermissionAdmin ca = (ConditionalPermissionAdmin) systemContext + .getService(systemContext.getServiceReference(ConditionalPermissionAdmin.class.getName())); ConditionalPermissionUpdate update = ca.newConditionalPermissionUpdate(); List rows = update.getConditionalPermissionInfos(); - rows.add(ca.newConditionalPermissionInfo(null, null, new PermissionInfo[] {hostFragmentPermission, allPackagePermission}, ConditionalPermissionInfo.ALLOW)); + rows.add(ca.newConditionalPermissionInfo(null, null, + new PermissionInfo[] { hostFragmentPermission, allPackagePermission }, + ConditionalPermissionInfo.ALLOW)); assertTrue("Cannot commit rows", update.commit()); //$NON-NLS-1$ Bundle securityA = systemContext.installBundle(locationSecurityA); @@ -474,7 +506,8 @@ public void testBug287750() throws BundleException { String locationTestBundle = installer.getBundleLocation("test.bug287750"); //$NON-NLS-1$ testBundle = systemContext.installBundle(locationTestBundle); testBundle.start(); - StartLevel sl = (StartLevel) systemContext.getService(systemContext.getServiceReference(StartLevel.class.getName())); + StartLevel sl = (StartLevel) systemContext + .getService(systemContext.getServiceReference(StartLevel.class.getName())); if (sl.getStartLevel() != 10) try { Thread.sleep(1000); @@ -489,7 +522,7 @@ public void testBug287750() throws BundleException { @Test public void testBug367614() throws BundleException { - File config = OSGiTestsActivator.getContext().getDataFile(getName()); //$NON-NLS-1$ + File config = OSGiTestsActivator.getContext().getDataFile(getName()); // $NON-NLS-1$ Map configuration = new HashMap<>(); configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); configuration.put(Constants.FRAMEWORK_SECURITY, Constants.FRAMEWORK_SECURITY_OSGI); @@ -502,16 +535,19 @@ public void testBug367614() throws BundleException { assertEquals("Wrong state for SystemBundle", Bundle.ACTIVE, equinox.getState()); //$NON-NLS-1$ BundleContext systemContext = equinox.getBundleContext(); - ConditionalPermissionAdmin ca = (ConditionalPermissionAdmin) systemContext.getService(systemContext.getServiceReference(ConditionalPermissionAdmin.class.getName())); + ConditionalPermissionAdmin ca = (ConditionalPermissionAdmin) systemContext + .getService(systemContext.getServiceReference(ConditionalPermissionAdmin.class.getName())); ConditionalPermissionUpdate update = ca.newConditionalPermissionUpdate(); List rows = update.getConditionalPermissionInfos(); - rows.add(ca.newConditionalPermissionInfo("test", null, new PermissionInfo[] {allPackagePermission}, ConditionalPermissionInfo.ALLOW)); + rows.add(ca.newConditionalPermissionInfo("test", null, new PermissionInfo[] { allPackagePermission }, + ConditionalPermissionInfo.ALLOW)); assertTrue("Cannot commit rows", update.commit()); //$NON-NLS-1$ ConditionalPermissionUpdate update1 = ca.newConditionalPermissionUpdate(); rows = update1.getConditionalPermissionInfos(); - rows.add(ca.newConditionalPermissionInfo("test", null, new PermissionInfo[] {allPackagePermission}, ConditionalPermissionInfo.ALLOW)); + rows.add(ca.newConditionalPermissionInfo("test", null, new PermissionInfo[] { allPackagePermission }, + ConditionalPermissionInfo.ALLOW)); Throwable t1 = assertThrows(Throwable.class, () -> update1.commit()); assertTrue("Wrong exception: " + t1, t1 instanceof IllegalStateException); @@ -523,11 +559,13 @@ public void testBug367614() throws BundleException { equinox.start(); systemContext = equinox.getBundleContext(); - ca = (ConditionalPermissionAdmin) systemContext.getService(systemContext.getServiceReference(ConditionalPermissionAdmin.class.getName())); + ca = (ConditionalPermissionAdmin) systemContext + .getService(systemContext.getServiceReference(ConditionalPermissionAdmin.class.getName())); ConditionalPermissionUpdate update2 = ca.newConditionalPermissionUpdate(); rows = update2.getConditionalPermissionInfos(); - rows.add(ca.newConditionalPermissionInfo("test", null, new PermissionInfo[] {allPackagePermission}, ConditionalPermissionInfo.ALLOW)); + rows.add(ca.newConditionalPermissionInfo("test", null, new PermissionInfo[] { allPackagePermission }, + ConditionalPermissionInfo.ALLOW)); Throwable t2 = assertThrows(Throwable.class, () -> update2.commit()); assertTrue("Wrong exception: " + t2, t2 instanceof IllegalStateException); @@ -557,14 +595,16 @@ public void filterResolvable(Collection candidates) { } @Override - public void filterSingletonCollisions(BundleCapability singleton, Collection collisionCandidates) { + public void filterSingletonCollisions(BundleCapability singleton, + Collection collisionCandidates) { // nothing } @Override public void filterMatches(BundleRequirement requirement, Collection candidates) { // always remove candidates for dynamic import - if (PackageNamespace.RESOLUTION_DYNAMIC.equals(requirement.getDirectives().get(Namespace.REQUIREMENT_RESOLUTION_DIRECTIVE))) { + if (PackageNamespace.RESOLUTION_DYNAMIC + .equals(requirement.getDirectives().get(Namespace.REQUIREMENT_RESOLUTION_DIRECTIVE))) { candidates.clear(); } } @@ -581,10 +621,12 @@ public void end() { // try installing host and fragment to test bug 245678 String testDynamicImportLocation = installer.getBundleLocation("test.dynamicimport"); //$NON-NLS-1$ // set the security for the bundle - ConditionalPermissionAdmin ca = (ConditionalPermissionAdmin) systemContext.getService(systemContext.getServiceReference(ConditionalPermissionAdmin.class.getName())); + ConditionalPermissionAdmin ca = (ConditionalPermissionAdmin) systemContext + .getService(systemContext.getServiceReference(ConditionalPermissionAdmin.class.getName())); ConditionalPermissionUpdate update = ca.newConditionalPermissionUpdate(); List rows = update.getConditionalPermissionInfos(); - rows.add(ca.newConditionalPermissionInfo(null, null, new PermissionInfo[] {allPackagePermission}, ConditionalPermissionInfo.ALLOW)); + rows.add(ca.newConditionalPermissionInfo(null, null, new PermissionInfo[] { allPackagePermission }, + ConditionalPermissionInfo.ALLOW)); assertTrue("Cannot commit rows", update.commit()); //$NON-NLS-1$ Bundle testDynamicImport = systemContext.installBundle(testDynamicImportLocation); @@ -635,7 +677,8 @@ public void doJava12SecurityManagerSetting(String managerValue, boolean isSecuri } } catch (BundleException e) { if (isSecurityManager && e.getCause() instanceof UnsupportedOperationException) { - FrameworkWiring wiring = getContext().getBundle(Constants.SYSTEM_BUNDLE_LOCATION).adapt(FrameworkWiring.class); + FrameworkWiring wiring = getContext().getBundle(Constants.SYSTEM_BUNDLE_LOCATION) + .adapt(FrameworkWiring.class); Collection java12 = wiring.findProviders(new Requirement() { @Override diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/serviceregistry/ServiceExceptionTests.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/serviceregistry/ServiceExceptionTests.java index cf3d889dba3..c109a4407b3 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/serviceregistry/ServiceExceptionTests.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/serviceregistry/ServiceExceptionTests.java @@ -40,11 +40,14 @@ public void testServiceException01() throws InterruptedException, InvalidSyntaxE ServiceExceptionServiceFactory wrongObjectFactory = new ServiceExceptionServiceFactory("A String"); //$NON-NLS-1$ Hashtable props = new Hashtable(); props.put("name", testMethodName); //$NON-NLS-1$ - ServiceRegistration reg = OSGiTestsActivator.getContext().registerService(Runnable.class.getName(), wrongObjectFactory, props); - ServiceExceptionFrameworkListener listener = new ServiceExceptionFrameworkListener(OSGiTestsActivator.getBundle(), null, ServiceException.FACTORY_ERROR); + ServiceRegistration reg = OSGiTestsActivator.getContext().registerService(Runnable.class.getName(), + wrongObjectFactory, props); + ServiceExceptionFrameworkListener listener = new ServiceExceptionFrameworkListener( + OSGiTestsActivator.getBundle(), null, ServiceException.FACTORY_ERROR); OSGiTestsActivator.getContext().addFrameworkListener(listener); try { - ServiceReference[] refs = OSGiTestsActivator.getContext().getServiceReferences(Runnable.class.getName(), "(name=" + testMethodName + ")"); //$NON-NLS-1$ //$NON-NLS-2$ + ServiceReference[] refs = OSGiTestsActivator.getContext().getServiceReferences(Runnable.class.getName(), + "(name=" + testMethodName + ")"); //$NON-NLS-1$ //$NON-NLS-2$ assertNotNull("service refs is null", refs); //$NON-NLS-1$ assertEquals("Wrong number of references", 1, refs.length); //$NON-NLS-1$ Runnable service = (Runnable) OSGiTestsActivator.getContext().getService(refs[0]); @@ -69,11 +72,14 @@ public void testServiceException02() throws InterruptedException, InvalidSyntaxE ServiceExceptionServiceFactory nullObjectFactory = new ServiceExceptionServiceFactory(null); Hashtable props = new Hashtable(); props.put("name", testMethodName); //$NON-NLS-1$ - ServiceRegistration reg = OSGiTestsActivator.getContext().registerService(Runnable.class.getName(), nullObjectFactory, props); - ServiceExceptionFrameworkListener listener = new ServiceExceptionFrameworkListener(OSGiTestsActivator.getBundle(), null, ServiceException.FACTORY_ERROR); + ServiceRegistration reg = OSGiTestsActivator.getContext().registerService(Runnable.class.getName(), + nullObjectFactory, props); + ServiceExceptionFrameworkListener listener = new ServiceExceptionFrameworkListener( + OSGiTestsActivator.getBundle(), null, ServiceException.FACTORY_ERROR); OSGiTestsActivator.getContext().addFrameworkListener(listener); try { - ServiceReference[] refs = OSGiTestsActivator.getContext().getServiceReferences(Runnable.class.getName(), "(name=" + testMethodName + ")"); //$NON-NLS-1$ //$NON-NLS-2$ + ServiceReference[] refs = OSGiTestsActivator.getContext().getServiceReferences(Runnable.class.getName(), + "(name=" + testMethodName + ")"); //$NON-NLS-1$ //$NON-NLS-2$ assertNotNull("service refs is null", refs); //$NON-NLS-1$ assertEquals("Wrong number of references", 1, refs.length); //$NON-NLS-1$ Runnable service = (Runnable) OSGiTestsActivator.getContext().getService(refs[0]); @@ -99,11 +105,14 @@ public void testServiceException03() throws InterruptedException, InvalidSyntaxE ServiceExceptionServiceFactory runtimeExceptionFactory = new ServiceExceptionServiceFactory(cause); Hashtable props = new Hashtable(); props.put("name", testMethodName); //$NON-NLS-1$ - ServiceRegistration reg = OSGiTestsActivator.getContext().registerService(Runnable.class.getName(), runtimeExceptionFactory, props); - ServiceExceptionFrameworkListener listener = new ServiceExceptionFrameworkListener(OSGiTestsActivator.getBundle(), cause, ServiceException.FACTORY_EXCEPTION); + ServiceRegistration reg = OSGiTestsActivator.getContext().registerService(Runnable.class.getName(), + runtimeExceptionFactory, props); + ServiceExceptionFrameworkListener listener = new ServiceExceptionFrameworkListener( + OSGiTestsActivator.getBundle(), cause, ServiceException.FACTORY_EXCEPTION); OSGiTestsActivator.getContext().addFrameworkListener(listener); try { - ServiceReference[] refs = OSGiTestsActivator.getContext().getServiceReferences(Runnable.class.getName(), "(name=" + testMethodName + ")"); //$NON-NLS-1$ //$NON-NLS-2$ + ServiceReference[] refs = OSGiTestsActivator.getContext().getServiceReferences(Runnable.class.getName(), + "(name=" + testMethodName + ")"); //$NON-NLS-1$ //$NON-NLS-2$ assertNotNull("service refs is null", refs); //$NON-NLS-1$ assertEquals("Wrong number of references", 1, refs.length); //$NON-NLS-1$ Runnable service = (Runnable) OSGiTestsActivator.getContext().getService(refs[0]); @@ -129,11 +138,14 @@ public void testServiceException04() throws InterruptedException, InvalidSyntaxE ServiceExceptionServiceFactory errorFactory = new ServiceExceptionServiceFactory(cause); Hashtable props = new Hashtable(); props.put("name", testMethodName); //$NON-NLS-1$ - ServiceRegistration reg = OSGiTestsActivator.getContext().registerService(Runnable.class.getName(), errorFactory, props); - ServiceExceptionFrameworkListener listener = new ServiceExceptionFrameworkListener(OSGiTestsActivator.getBundle(), cause, ServiceException.FACTORY_EXCEPTION); + ServiceRegistration reg = OSGiTestsActivator.getContext().registerService(Runnable.class.getName(), + errorFactory, props); + ServiceExceptionFrameworkListener listener = new ServiceExceptionFrameworkListener( + OSGiTestsActivator.getBundle(), cause, ServiceException.FACTORY_EXCEPTION); OSGiTestsActivator.getContext().addFrameworkListener(listener); try { - ServiceReference[] refs = OSGiTestsActivator.getContext().getServiceReferences(Runnable.class.getName(), "(name=" + testMethodName + ")"); //$NON-NLS-1$ //$NON-NLS-2$ + ServiceReference[] refs = OSGiTestsActivator.getContext().getServiceReferences(Runnable.class.getName(), + "(name=" + testMethodName + ")"); //$NON-NLS-1$ //$NON-NLS-2$ assertNotNull("service refs is null", refs); //$NON-NLS-1$ assertEquals("Wrong number of references", 1, refs.length); //$NON-NLS-1$ Runnable service = (Runnable) OSGiTestsActivator.getContext().getService(refs[0]); diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/serviceregistry/ServiceHookTests.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/serviceregistry/ServiceHookTests.java index bbde0c67b5b..4583442a4a6 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/serviceregistry/ServiceHookTests.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/serviceregistry/ServiceHookTests.java @@ -64,133 +64,137 @@ public void testFindHook01() throws InvalidSyntaxException { props.put(Constants.SERVICE_DESCRIPTION, "service 3"); //$NON-NLS-1$ final ServiceRegistration reg3 = testContext.registerService(Runnable.class.getName(), runIt, props); - final int[] hookCalled = new int[] {0, 0, 0, 0, 0}; - final boolean[] startTest = new boolean[] {false}; - final AssertionFailedError[] hookErrors = new AssertionFailedError[] {null, null, null, null}; + final int[] hookCalled = new int[] { 0, 0, 0, 0, 0 }; + final boolean[] startTest = new boolean[] { false }; + final AssertionFailedError[] hookErrors = new AssertionFailedError[] { null, null, null, null }; // register find hook 1 props.put(Constants.SERVICE_DESCRIPTION, "find hook 1"); //$NON-NLS-1$ props.put(Constants.SERVICE_DESCRIPTION, "min value"); //$NON-NLS-1$ props.put(Constants.SERVICE_RANKING, Integer.valueOf(Integer.MIN_VALUE)); - ServiceRegistration regHook1 = testContext.registerService(FindHook.class.getName(), (FindHook) (context, name, filter, allServices, references) -> { - try { - synchronized (hookCalled) { - if (!startTest[0]) + ServiceRegistration regHook1 = testContext.registerService(FindHook.class.getName(), + (FindHook) (context, name, filter, allServices, references) -> { + try { + synchronized (hookCalled) { + if (!startTest[0]) + return; + hookCalled[++hookCalled[0]] = 1; + } + assertEquals("wrong context in hook", testContext, context); //$NON-NLS-1$ + assertEquals("wrong name in hook", Runnable.class.getName(), name); //$NON-NLS-1$ + assertEquals("wrong filter in hook", "(name=" + testMethodName + ")", filter); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + assertEquals("wrong allservices in hook", false, allServices); //$NON-NLS-1$ + assertEquals("wrong number of services in hook", 1, references.size()); //$NON-NLS-1$ + for (ServiceReference ref : references) { + assertNotEquals("service 1 is present", reg1.getReference(), ref); + assertNotEquals("service 2 is present", reg2.getReference(), ref); + } + + ServiceReference reference1 = reg1.getReference(); + assertThrows("add to collection succeeded", UnsupportedOperationException.class, + () -> references.add(reference1)); + assertThrows("addAll to collection succeeded", UnsupportedOperationException.class, + () -> references.addAll(Arrays.asList(reference1))); + } catch (AssertionFailedError a) { + hookErrors[0] = a; return; - hookCalled[++hookCalled[0]] = 1; - } - assertEquals("wrong context in hook", testContext, context); //$NON-NLS-1$ - assertEquals("wrong name in hook", Runnable.class.getName(), name); //$NON-NLS-1$ - assertEquals("wrong filter in hook", "(name=" + testMethodName + ")", filter); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - assertEquals("wrong allservices in hook", false, allServices); //$NON-NLS-1$ - assertEquals("wrong number of services in hook", 1, references.size()); //$NON-NLS-1$ - for (ServiceReference ref : references) { - assertNotEquals("service 1 is present", reg1.getReference(), ref); - assertNotEquals("service 2 is present", reg2.getReference(), ref); - } - - ServiceReference reference1 = reg1.getReference(); - assertThrows("add to collection succeeded", UnsupportedOperationException.class, - () -> references.add(reference1)); - assertThrows("addAll to collection succeeded", UnsupportedOperationException.class, - () -> references.addAll(Arrays.asList(reference1))); - } catch (AssertionFailedError a) { - hookErrors[0] = a; - return; - } - }, props); + } + }, props); // register find hook 2 props.put(Constants.SERVICE_DESCRIPTION, "find hook 2"); //$NON-NLS-1$ props.put(Constants.SERVICE_DESCRIPTION, "max value first"); //$NON-NLS-1$ props.put(Constants.SERVICE_RANKING, Integer.valueOf(Integer.MAX_VALUE)); - ServiceRegistration regHook2 = testContext.registerService(FindHook.class.getName(), (FindHook) (context, name, filter, allServices, references) -> { - try { - synchronized (hookCalled) { - if (!startTest[0]) + ServiceRegistration regHook2 = testContext.registerService(FindHook.class.getName(), + (FindHook) (context, name, filter, allServices, references) -> { + try { + synchronized (hookCalled) { + if (!startTest[0]) + return; + hookCalled[++hookCalled[0]] = 2; + } + assertEquals("wrong context in hook", testContext, context); //$NON-NLS-1$ + assertEquals("wrong name in hook", Runnable.class.getName(), name); //$NON-NLS-1$ + assertEquals("wrong filter in hook", "(name=" + testMethodName + ")", filter); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + assertEquals("wrong allservices in hook", false, allServices); //$NON-NLS-1$ + assertEquals("wrong number of services in hook", 3, references.size()); //$NON-NLS-1$ + + references.removeIf(ref -> ref.equals(reg2.getReference())); + + ServiceReference reference2 = reg2.getReference(); + assertThrows("add to collection succeeded", UnsupportedOperationException.class, + () -> references.add(reference2)); + assertThrows("addAll to collection succeeded", UnsupportedOperationException.class, + () -> references.addAll(Arrays.asList(reference2))); + } catch (AssertionFailedError a) { + hookErrors[1] = a; return; - hookCalled[++hookCalled[0]] = 2; - } - assertEquals("wrong context in hook", testContext, context); //$NON-NLS-1$ - assertEquals("wrong name in hook", Runnable.class.getName(), name); //$NON-NLS-1$ - assertEquals("wrong filter in hook", "(name=" + testMethodName + ")", filter); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - assertEquals("wrong allservices in hook", false, allServices); //$NON-NLS-1$ - assertEquals("wrong number of services in hook", 3, references.size()); //$NON-NLS-1$ - - references.removeIf(ref -> ref.equals(reg2.getReference())); - - ServiceReference reference2 = reg2.getReference(); - assertThrows("add to collection succeeded", UnsupportedOperationException.class, - () -> references.add(reference2)); - assertThrows("addAll to collection succeeded", UnsupportedOperationException.class, - () -> references.addAll(Arrays.asList(reference2))); - } catch (AssertionFailedError a) { - hookErrors[1] = a; - return; - } - }, props); + } + }, props); // register find hook 3 props.put(Constants.SERVICE_DESCRIPTION, "find hook 3"); //$NON-NLS-1$ props.put(Constants.SERVICE_DESCRIPTION, "max value second"); //$NON-NLS-1$ props.put(Constants.SERVICE_RANKING, Integer.valueOf(Integer.MAX_VALUE)); - ServiceRegistration regHook3 = testContext.registerService(FindHook.class.getName(), (FindHook) (context, name, filter, allServices, references) -> { - try { - synchronized (hookCalled) { - if (!startTest[0]) + ServiceRegistration regHook3 = testContext.registerService(FindHook.class.getName(), + (FindHook) (context, name, filter, allServices, references) -> { + try { + synchronized (hookCalled) { + if (!startTest[0]) + return; + hookCalled[++hookCalled[0]] = 3; + } + assertEquals("wrong context in hook", testContext, context); //$NON-NLS-1$ + assertEquals("wrong name in hook", Runnable.class.getName(), name); //$NON-NLS-1$ + assertEquals("wrong filter in hook", "(name=" + testMethodName + ")", filter); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + assertEquals("wrong allservices in hook", false, allServices); //$NON-NLS-1$ + assertEquals("wrong number of services in hook", 2, references.size()); //$NON-NLS-1$ + for (ServiceReference ref : references) { + assertNotEquals("service 2 is present", ref, reg2.getReference()); + } + + ServiceReference ref2 = reg2.getReference(); + assertThrows(UnsupportedOperationException.class, () -> references.add(ref2)); + assertThrows(UnsupportedOperationException.class, () -> references.addAll(Arrays.asList(ref2))); + } catch (AssertionFailedError a) { + hookErrors[2] = a; return; - hookCalled[++hookCalled[0]] = 3; - } - assertEquals("wrong context in hook", testContext, context); //$NON-NLS-1$ - assertEquals("wrong name in hook", Runnable.class.getName(), name); //$NON-NLS-1$ - assertEquals("wrong filter in hook", "(name=" + testMethodName + ")", filter); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - assertEquals("wrong allservices in hook", false, allServices); //$NON-NLS-1$ - assertEquals("wrong number of services in hook", 2, references.size()); //$NON-NLS-1$ - for (ServiceReference ref : references) { - assertNotEquals("service 2 is present", ref, reg2.getReference()); - } - - ServiceReference ref2 = reg2.getReference(); - assertThrows(UnsupportedOperationException.class, () -> references.add(ref2)); - assertThrows(UnsupportedOperationException.class, () -> references.addAll(Arrays.asList(ref2))); - } catch (AssertionFailedError a) { - hookErrors[2] = a; - return; - } - // throw an exception from the hook to test that the next hooks are called. - throw new RuntimeException(testMethodName); - }, props); + } + // throw an exception from the hook to test that the next hooks are called. + throw new RuntimeException(testMethodName); + }, props); // register find hook 4 props.put(Constants.SERVICE_DESCRIPTION, "find hook 4"); //$NON-NLS-1$ props.put(Constants.SERVICE_DESCRIPTION, "max value third"); //$NON-NLS-1$ props.put(Constants.SERVICE_RANKING, Integer.valueOf(Integer.MAX_VALUE)); - ServiceRegistration regHook4 = testContext.registerService(FindHook.class.getName(), (FindHook) (context, name, filter, allServices, references) -> { - try { - synchronized (hookCalled) { - if (!startTest[0]) + ServiceRegistration regHook4 = testContext.registerService(FindHook.class.getName(), + (FindHook) (context, name, filter, allServices, references) -> { + try { + synchronized (hookCalled) { + if (!startTest[0]) + return; + hookCalled[++hookCalled[0]] = 4; + } + assertEquals("wrong context in hook", testContext, context); //$NON-NLS-1$ + assertEquals("wrong name in hook", Runnable.class.getName(), name); //$NON-NLS-1$ + assertEquals("wrong filter in hook", "(name=" + testMethodName + ")", filter); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + assertEquals("wrong allservices in hook", false, allServices); //$NON-NLS-1$ + assertEquals("wrong number of services in hook", 2, references.size()); //$NON-NLS-1$ + + references.removeIf(ref -> { + assertNotEquals("service 2 is present", ref, reg2.getReference()); + return ref.equals(reg1.getReference()); + }); + + ServiceReference ref2 = reg2.getReference(); + assertThrows(UnsupportedOperationException.class, () -> references.add(ref2)); + assertThrows(UnsupportedOperationException.class, () -> references.addAll(Arrays.asList(ref2))); + } catch (AssertionFailedError a) { + hookErrors[3] = a; return; - hookCalled[++hookCalled[0]] = 4; - } - assertEquals("wrong context in hook", testContext, context); //$NON-NLS-1$ - assertEquals("wrong name in hook", Runnable.class.getName(), name); //$NON-NLS-1$ - assertEquals("wrong filter in hook", "(name=" + testMethodName + ")", filter); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - assertEquals("wrong allservices in hook", false, allServices); //$NON-NLS-1$ - assertEquals("wrong number of services in hook", 2, references.size()); //$NON-NLS-1$ - - references.removeIf(ref -> { - assertNotEquals("service 2 is present", ref, reg2.getReference()); - return ref.equals(reg1.getReference()); - }); - - ServiceReference ref2 = reg2.getReference(); - assertThrows(UnsupportedOperationException.class, () -> references.add(ref2)); - assertThrows(UnsupportedOperationException.class, () -> references.addAll(Arrays.asList(ref2))); - } catch (AssertionFailedError a) { - hookErrors[3] = a; - return; - } - }, props); + } + }, props); startTest[0] = true; // get reference and hook removes some services @@ -270,8 +274,8 @@ public void testEventHook01() throws InvalidSyntaxException { }; final BundleContext testContext = OSGiTestsActivator.getContext(); - final int[] hookCalled = new int[] {0, 0}; - final AssertionFailedError[] hookErrors = new AssertionFailedError[] {null}; + final int[] hookCalled = new int[] { 0, 0 }; + final AssertionFailedError[] hookErrors = new AssertionFailedError[] { null }; final List events = new ArrayList(); final ServiceListener sl = event -> { @@ -412,7 +416,7 @@ public void testListenerHook01() throws InvalidSyntaxException { // test the ListenerHook is called final BundleContext testContext = OSGiTestsActivator.getContext(); final Collection result = new ArrayList<>(); - final int[] hookCalled = new int[] {0, 0}; + final int[] hookCalled = new int[] { 0, 0 }; ListenerHook hook1 = new ListenerHook() { public void added(Collection listeners) { @@ -503,10 +507,11 @@ public void removed(Collection listeners) { @Test public void testListenerHook02() throws InvalidSyntaxException { final String testMethodName = "testListenerHook02"; //$NON-NLS-1$ - // test the ListenerHook works with the FilteredServiceListener optimization in equinox + // test the ListenerHook works with the FilteredServiceListener optimization in + // equinox final BundleContext testContext = OSGiTestsActivator.getContext(); final Collection result = new ArrayList<>(); - final int[] hookCalled = new int[] {0, 0}; + final int[] hookCalled = new int[] { 0, 0 }; ListenerHook hook1 = new ListenerHook() { public void added(Collection listeners) { diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/serviceregistry/ServiceRegistryTests.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/serviceregistry/ServiceRegistryTests.java index 80086d98bc0..e85aa2380f7 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/serviceregistry/ServiceRegistryTests.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/serviceregistry/ServiceRegistryTests.java @@ -58,24 +58,25 @@ public void testServiceListener01() throws InvalidSyntaxException { Runnable runIt = () -> { // nothing }; - final boolean[] results = new boolean[] {false, false, false, false}; + final boolean[] results = new boolean[] { false, false, false, false }; ServiceListener testListener = event -> { switch (event.getType()) { - case ServiceEvent.REGISTERED : - results[0] = true; - break; - case ServiceEvent.MODIFIED : - results[1] = true; - break; - case ServiceEvent.MODIFIED_ENDMATCH : - results[2] = true; - break; - case ServiceEvent.UNREGISTERING : - results[3] = true; - break; + case ServiceEvent.REGISTERED: + results[0] = true; + break; + case ServiceEvent.MODIFIED: + results[1] = true; + break; + case ServiceEvent.MODIFIED_ENDMATCH: + results[2] = true; + break; + case ServiceEvent.UNREGISTERING: + results[3] = true; + break; } }; - OSGiTestsActivator.getContext().addServiceListener(testListener, "(&(objectclass=java.lang.Runnable)(" + testMethodName.toLowerCase() + "=true))"); //$NON-NLS-1$ //$NON-NLS-2$ + OSGiTestsActivator.getContext().addServiceListener(testListener, + "(&(objectclass=java.lang.Runnable)(" + testMethodName.toLowerCase() + "=true))"); //$NON-NLS-1$ //$NON-NLS-2$ ServiceRegistration reg = null; try { @@ -147,24 +148,25 @@ public void testServiceListener02() throws InvalidSyntaxException { Runnable runIt = () -> { // nothing }; - final boolean[] results = new boolean[] {false, false, false, false}; + final boolean[] results = new boolean[] { false, false, false, false }; ServiceListener testListener = event -> { switch (event.getType()) { - case ServiceEvent.REGISTERED : - results[0] = true; - break; - case ServiceEvent.MODIFIED : - results[1] = true; - break; - case ServiceEvent.MODIFIED_ENDMATCH : - results[2] = true; - break; - case ServiceEvent.UNREGISTERING : - results[3] = true; - break; + case ServiceEvent.REGISTERED: + results[0] = true; + break; + case ServiceEvent.MODIFIED: + results[1] = true; + break; + case ServiceEvent.MODIFIED_ENDMATCH: + results[2] = true; + break; + case ServiceEvent.UNREGISTERING: + results[3] = true; + break; } }; - OSGiTestsActivator.getContext().addServiceListener(testListener, "(&(objectclass=java.lang.Runnable)(" + testMethodName.toLowerCase() + "=true))"); //$NON-NLS-1$ //$NON-NLS-2$ + OSGiTestsActivator.getContext().addServiceListener(testListener, + "(&(objectclass=java.lang.Runnable)(" + testMethodName.toLowerCase() + "=true))"); //$NON-NLS-1$ //$NON-NLS-2$ ServiceRegistration reg = null; try { @@ -236,24 +238,25 @@ public void testServiceListener03() throws InvalidSyntaxException { Runnable runIt = () -> { // nothing }; - final int[] results = new int[] {0, 0, 0, 0}; + final int[] results = new int[] { 0, 0, 0, 0 }; ServiceListener testListener = event -> { switch (event.getType()) { - case ServiceEvent.REGISTERED : - results[0]++; - break; - case ServiceEvent.MODIFIED : - results[1]++; - break; - case ServiceEvent.MODIFIED_ENDMATCH : - results[2]++; - break; - case ServiceEvent.UNREGISTERING : - results[3]++; - break; + case ServiceEvent.REGISTERED: + results[0]++; + break; + case ServiceEvent.MODIFIED: + results[1]++; + break; + case ServiceEvent.MODIFIED_ENDMATCH: + results[2]++; + break; + case ServiceEvent.UNREGISTERING: + results[3]++; + break; } }; - OSGiTestsActivator.getContext().addServiceListener(testListener, "(&(objectclass=java.lang.Runnable)(" + testMethodName.toLowerCase() + "=true))"); //$NON-NLS-1$ //$NON-NLS-2$ + OSGiTestsActivator.getContext().addServiceListener(testListener, + "(&(objectclass=java.lang.Runnable)(" + testMethodName.toLowerCase() + "=true))"); //$NON-NLS-1$ //$NON-NLS-2$ ServiceRegistration reg1 = null; ServiceRegistration reg2 = null; try { @@ -363,15 +366,18 @@ public void testServiceOrdering01() { props.put("name", testMethodName); //$NON-NLS-1$ props.put(Constants.SERVICE_DESCRIPTION, "min value"); //$NON-NLS-1$ props.put(Constants.SERVICE_RANKING, Integer.valueOf(Integer.MIN_VALUE)); - ServiceRegistration reg1 = OSGiTestsActivator.getContext().registerService(Runnable.class.getName(), runIt, props); + ServiceRegistration reg1 = OSGiTestsActivator.getContext().registerService(Runnable.class.getName(), runIt, + props); props.put(Constants.SERVICE_DESCRIPTION, "max value first"); //$NON-NLS-1$ props.put(Constants.SERVICE_RANKING, Integer.valueOf(Integer.MAX_VALUE)); - ServiceRegistration reg2 = OSGiTestsActivator.getContext().registerService(Runnable.class.getName(), runIt, props); + ServiceRegistration reg2 = OSGiTestsActivator.getContext().registerService(Runnable.class.getName(), runIt, + props); props.put(Constants.SERVICE_DESCRIPTION, "max value second"); //$NON-NLS-1$ props.put(Constants.SERVICE_RANKING, Integer.valueOf(Integer.MAX_VALUE)); - ServiceRegistration reg3 = OSGiTestsActivator.getContext().registerService(Runnable.class.getName(), runIt, props); + ServiceRegistration reg3 = OSGiTestsActivator.getContext().registerService(Runnable.class.getName(), runIt, + props); try { ServiceReference ref = null; @@ -392,9 +398,11 @@ public void testServiceOrdering01() { public void testDuplicateObjectClass() { ServiceRegistration reg = null; try { - reg = OSGiTestsActivator.getContext().registerService(new String[] {Runnable.class.getName(), Object.class.getName(), Object.class.getName()}, (Runnable) () -> { - // nothing - }, null); + reg = OSGiTestsActivator.getContext().registerService( + new String[] { Runnable.class.getName(), Object.class.getName(), Object.class.getName() }, + (Runnable) () -> { + // nothing + }, null); } finally { if (reg != null) reg.unregister(); @@ -412,15 +420,18 @@ public void testServiceReferenceCompare01() { props.put("name", testMethodName); //$NON-NLS-1$ props.put(Constants.SERVICE_DESCRIPTION, "min value"); //$NON-NLS-1$ props.put(Constants.SERVICE_RANKING, Integer.valueOf(Integer.MIN_VALUE)); - ServiceRegistration reg1 = OSGiTestsActivator.getContext().registerService(Runnable.class.getName(), runIt, props); + ServiceRegistration reg1 = OSGiTestsActivator.getContext().registerService(Runnable.class.getName(), runIt, + props); props.put(Constants.SERVICE_DESCRIPTION, "max value first"); //$NON-NLS-1$ props.put(Constants.SERVICE_RANKING, Integer.valueOf(Integer.MAX_VALUE)); - ServiceRegistration reg2 = OSGiTestsActivator.getContext().registerService(Runnable.class.getName(), runIt, props); + ServiceRegistration reg2 = OSGiTestsActivator.getContext().registerService(Runnable.class.getName(), runIt, + props); props.put(Constants.SERVICE_DESCRIPTION, "max value second"); //$NON-NLS-1$ props.put(Constants.SERVICE_RANKING, Integer.valueOf(Integer.MAX_VALUE)); - ServiceRegistration reg3 = OSGiTestsActivator.getContext().registerService(Runnable.class.getName(), runIt, props); + ServiceRegistration reg3 = OSGiTestsActivator.getContext().registerService(Runnable.class.getName(), runIt, + props); try { ServiceReference ref = OSGiTestsActivator.getContext().getServiceReference(Runnable.class.getName()); @@ -467,11 +478,13 @@ public void testModifiedRanking() { props.put(Constants.SERVICE_RANKING, Integer.valueOf(10)); ServiceRegistration reg2 = getContext().registerService(Runnable.class.getName(), runIt, props); try { - assertEquals("wrong service reference", reg1.getReference(), getContext().getServiceReference("java.lang.Runnable")); //$NON-NLS-1$//$NON-NLS-2$ + assertEquals("wrong service reference", reg1.getReference(), //$NON-NLS-1$ + getContext().getServiceReference("java.lang.Runnable")); //$NON-NLS-1$ props.put(Constants.SERVICE_RANKING, Integer.valueOf(20)); reg2.setProperties(props); - assertEquals("wrong service reference", reg2.getReference(), getContext().getServiceReference("java.lang.Runnable")); //$NON-NLS-1$//$NON-NLS-2$ + assertEquals("wrong service reference", reg2.getReference(), //$NON-NLS-1$ + getContext().getServiceReference("java.lang.Runnable")); //$NON-NLS-1$ } finally { if (reg1 != null) reg1.unregister(); @@ -516,9 +529,12 @@ public void testNullValue() throws InvalidSyntaxException { nullProps.put("test.non.null", "v1"); reg = OSGiTestsActivator.getContext().registerService(Object.class, new Object(), nullProps); assertFalse(OSGiTestsActivator.getContext().createFilter("(test.null=*)").match(reg.getReference())); - assertFalse(OSGiTestsActivator.getContext().createFilter("(test.null=*)").match(reg.getReference().getProperties())); - assertTrue(OSGiTestsActivator.getContext().createFilter("(&(!(test.null=*))(test.non.null=v1))").match(reg.getReference())); - assertTrue(OSGiTestsActivator.getContext().createFilter("(&(!(test.null=*))(test.non.null=v1))").match(reg.getReference().getProperties())); + assertFalse(OSGiTestsActivator.getContext().createFilter("(test.null=*)") + .match(reg.getReference().getProperties())); + assertTrue(OSGiTestsActivator.getContext().createFilter("(&(!(test.null=*))(test.non.null=v1))") + .match(reg.getReference())); + assertTrue(OSGiTestsActivator.getContext().createFilter("(&(!(test.null=*))(test.non.null=v1))") + .match(reg.getReference().getProperties())); } finally { if (reg != null) reg.unregister(); @@ -534,7 +550,8 @@ public void testNullKey() throws InvalidSyntaxException { nullProps.put("test.non.null", "v1"); reg = OSGiTestsActivator.getContext().registerService(Object.class, new Object(), nullProps); assertTrue(OSGiTestsActivator.getContext().createFilter("(test.non.null=v1)").match(reg.getReference())); - assertTrue(OSGiTestsActivator.getContext().createFilter("(test.non.null=v1)").match(reg.getReference().getProperties())); + assertTrue(OSGiTestsActivator.getContext().createFilter("(test.non.null=v1)") + .match(reg.getReference().getProperties())); } finally { if (reg != null) reg.unregister(); diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/serviceregistry/ServiceTrackerTests.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/serviceregistry/ServiceTrackerTests.java index 2eb28544476..df95f08f33f 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/serviceregistry/ServiceTrackerTests.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/serviceregistry/ServiceTrackerTests.java @@ -39,10 +39,11 @@ public void testServiceTracker01() throws InvalidSyntaxException { }; Hashtable props = new Hashtable(); props.put(testMethodName, Boolean.TRUE); - ServiceRegistration reg = OSGiTestsActivator.getContext().registerService(Runnable.class.getName(), runIt, props); + ServiceRegistration reg = OSGiTestsActivator.getContext().registerService(Runnable.class.getName(), runIt, + props); ServiceTracker testTracker = null; try { - final boolean[] results = new boolean[] {false, false, false}; + final boolean[] results = new boolean[] { false, false, false }; ServiceTrackerCustomizer testCustomizer = new ServiceTrackerCustomizer() { public Object addingService(ServiceReference reference) { results[0] = true; @@ -57,7 +58,8 @@ public void removedService(ServiceReference reference, Object service) { results[2] = true; } }; - Filter filter = FrameworkUtil.createFilter("(&(objectclass=java.lang.Runnable)(" + testMethodName.toLowerCase() + "=true))"); + Filter filter = FrameworkUtil + .createFilter("(&(objectclass=java.lang.Runnable)(" + testMethodName.toLowerCase() + "=true))"); testTracker = new ServiceTracker(OSGiTestsActivator.getContext(), filter, testCustomizer); testTracker.open(); assertTrue("Did not call addingService", results[0]); //$NON-NLS-1$ @@ -114,10 +116,11 @@ public void testServiceTracker02() throws InvalidSyntaxException { }; Hashtable props = new Hashtable(); props.put(testMethodName, Boolean.FALSE); - ServiceRegistration reg = OSGiTestsActivator.getContext().registerService(Runnable.class.getName(), runIt, props); + ServiceRegistration reg = OSGiTestsActivator.getContext().registerService(Runnable.class.getName(), runIt, + props); ServiceTracker testTracker = null; try { - final boolean[] results = new boolean[] {false, false, false}; + final boolean[] results = new boolean[] { false, false, false }; ServiceTrackerCustomizer testCustomizer = new ServiceTrackerCustomizer() { public Object addingService(ServiceReference reference) { results[0] = true; @@ -132,7 +135,8 @@ public void removedService(ServiceReference reference, Object service) { results[2] = true; } }; - Filter filter = FrameworkUtil.createFilter("(&(objectclass=java.lang.Runnable)(" + testMethodName.toLowerCase() + "=true))"); + Filter filter = FrameworkUtil + .createFilter("(&(objectclass=java.lang.Runnable)(" + testMethodName.toLowerCase() + "=true))"); testTracker = new ServiceTracker(OSGiTestsActivator.getContext(), filter, testCustomizer); testTracker.open(); assertFalse("Did call addingService", results[0]); //$NON-NLS-1$ @@ -189,10 +193,11 @@ public void testServiceTracker03() throws InvalidSyntaxException { }; Hashtable props = new Hashtable(); props.put(testMethodName, Boolean.TRUE); - ServiceRegistration reg = OSGiTestsActivator.getContext().registerService(Runnable.class.getName(), runIt, props); + ServiceRegistration reg = OSGiTestsActivator.getContext().registerService(Runnable.class.getName(), runIt, + props); ServiceTracker testTracker = null; try { - final boolean[] results = new boolean[] {false, false, false}; + final boolean[] results = new boolean[] { false, false, false }; ServiceTrackerCustomizer testCustomizer = new ServiceTrackerCustomizer() { public Object addingService(ServiceReference reference) { results[0] = true; @@ -207,7 +212,8 @@ public void removedService(ServiceReference reference, Object service) { results[2] = true; } }; - Filter filter = FrameworkUtil.createFilter("(&(objectclass=java.lang.Runnable)(" + testMethodName.toLowerCase() + "=true))"); + Filter filter = FrameworkUtil + .createFilter("(&(objectclass=java.lang.Runnable)(" + testMethodName.toLowerCase() + "=true))"); testTracker = new ServiceTracker(OSGiTestsActivator.getContext(), filter, testCustomizer); testTracker.open(); assertTrue("Did not call addingService", results[0]); //$NON-NLS-1$ diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/datalocation/BasicLocationTests.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/datalocation/BasicLocationTests.java index d99b7499a5b..55a89633796 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/datalocation/BasicLocationTests.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/datalocation/BasicLocationTests.java @@ -57,8 +57,10 @@ protected void setUp() throws Exception { prefix = windows ? "c:" : ""; - configLocationTracker = new ServiceTracker<>(OSGiTestsActivator.getContext(), OSGiTestsActivator.getContext().createFilter(Location.CONFIGURATION_FILTER), null); - instanceLocationTracker = new ServiceTracker<>(OSGiTestsActivator.getContext(), OSGiTestsActivator.getContext().createFilter(Location.INSTANCE_FILTER), null); + configLocationTracker = new ServiceTracker<>(OSGiTestsActivator.getContext(), + OSGiTestsActivator.getContext().createFilter(Location.CONFIGURATION_FILTER), null); + instanceLocationTracker = new ServiceTracker<>(OSGiTestsActivator.getContext(), + OSGiTestsActivator.getContext().createFilter(Location.INSTANCE_FILTER), null); configLocationTracker.open(); instanceLocationTracker.open(); @@ -85,9 +87,11 @@ private void checkLocation(Location location, boolean leading, boolean trailing, assertEquals(scheme, url.getProtocol()); if (!url.getProtocol().equals("file")) return; - assertTrue(url.toExternalForm() + " should " + (trailing ? "" : "not") + " have a trailing slash", url.getFile().endsWith("/") == trailing); + assertTrue(url.toExternalForm() + " should " + (trailing ? "" : "not") + " have a trailing slash", + url.getFile().endsWith("/") == trailing); if (windows) - assertTrue(url.toExternalForm() + " should " + (leading ? "" : "not") + " have a leading slash", url.getFile().startsWith("/") == leading); + assertTrue(url.toExternalForm() + " should " + (leading ? "" : "not") + " have a leading slash", + url.getFile().startsWith("/") == leading); } public void testCreateLocation01() { @@ -237,12 +241,14 @@ private void doTestLocateDataArea(Location location, String dataAreaPrefix, Stri if (namespace.startsWith("/")) { namespace = namespace.substring(1); } - assertTrue("Data area is not the expected value: " + dataArea.toExternalForm(), dataArea.toExternalForm().endsWith(dataAreaPrefix + namespace)); + assertTrue("Data area is not the expected value: " + dataArea.toExternalForm(), + dataArea.toExternalForm().endsWith(dataAreaPrefix + namespace)); } public void testSetLocationWithEmptyLockFile() { Location configLocation = configLocationTracker.getService(); - File testLocationFile = OSGiTestsActivator.getContext().getDataFile("testLocations/testSetLocationWithEmptyLockFile"); //$NON-NLS-1$ + File testLocationFile = OSGiTestsActivator.getContext() + .getDataFile("testLocations/testSetLocationWithEmptyLockFile"); //$NON-NLS-1$ Location testLocation = configLocation.createLocation(null, null, false); try { testLocation.set(testLocationFile.toURL(), true, ""); //$NON-NLS-1$ @@ -262,7 +268,8 @@ public void testSetLocationWithEmptyLockFile() { public void testSetLocationWithRelLockFile() { Location configLocation = configLocationTracker.getService(); - File testLocationFile = OSGiTestsActivator.getContext().getDataFile("testLocations/testSetLocationWithRelLockFile"); //$NON-NLS-1$ + File testLocationFile = OSGiTestsActivator.getContext() + .getDataFile("testLocations/testSetLocationWithRelLockFile"); //$NON-NLS-1$ Location testLocation = configLocation.createLocation(null, null, false); try { testLocation.set(testLocationFile.toURL(), true, ".mocklock"); //$NON-NLS-1$ @@ -281,7 +288,8 @@ public void testSetLocationWithRelLockFile() { public void testSetLocationWithAbsLockFile() { Location configLocation = configLocationTracker.getService(); - File testLocationFile = OSGiTestsActivator.getContext().getDataFile("testLocations/testSetLocationWithAbsLockFile"); //$NON-NLS-1$ + File testLocationFile = OSGiTestsActivator.getContext() + .getDataFile("testLocations/testSetLocationWithAbsLockFile"); //$NON-NLS-1$ File testLocationLockFile = OSGiTestsActivator.getContext().getDataFile("testLocations/mock.lock"); //$NON-NLS-1$ assertTrue(testLocationLockFile.isAbsolute()); Location testLocation = configLocation.createLocation(null, null, false); @@ -328,7 +336,8 @@ private static Map getLocations(Equinox equinox) throws Invali return locations; } - private static void addLocation(BundleContext context, String filter, Map locations) throws InvalidSyntaxException { + private static void addLocation(BundleContext context, String filter, Map locations) + throws InvalidSyntaxException { Collection> locationRefs = context.getServiceReferences(Location.class, filter); if (!locationRefs.isEmpty()) { locations.put(filter, context.getService(locationRefs.iterator().next())); @@ -372,7 +381,8 @@ public void testNone() throws Exception { Map locations = getLocations(equinox); assertNull("User location should be null", locations.get(Location.USER_FILTER)); assertNull("Instance location should be null", locations.get(Location.INSTANCE_FILTER)); - // TODO assertNull("Configuration location should be null", locations.get(Location.CONFIGURATION_FILTER)); + // TODO assertNull("Configuration location should be null", + // locations.get(Location.CONFIGURATION_FILTER)); } finally { equinox.stop(); } @@ -527,6 +537,7 @@ public void testDebugLogOnGetURL() throws Exception { } private LogReaderService getLogReaderService(Equinox equinox) { - return equinox.getBundleContext().getService(equinox.getBundleContext().getServiceReference(LogReaderService.class)); + return equinox.getBundleContext() + .getService(equinox.getBundleContext().getServiceReference(LogReaderService.class)); } } diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/datalocation/FileManagerTests.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/datalocation/FileManagerTests.java index 9596a0b9799..49ef7939b5d 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/datalocation/FileManagerTests.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/datalocation/FileManagerTests.java @@ -64,8 +64,7 @@ private void rm(File folder) { } /** - * Open a filemanager in readonly and ensure files are - * not created. + * Open a filemanager in readonly and ensure files are not created. */ public void testReadOnly() { File testDir = new File(base, "readOnlyManager"); @@ -85,21 +84,21 @@ public void testReadOnly() { manager1.add(fileName); fail("add succedded"); } catch (IOException e) { - //good + // good } try { manager1.lookup(fileName, true); fail("lookup succedded"); } catch (IOException e) { - //good + // good } try { manager1.createTempFile(fileName); fail("create temp file succedded"); } catch (IOException e) { - //good + // good } files = testDir.list(); assertEquals(files.length, 0); @@ -113,7 +112,7 @@ public void testReadOnly() { manager2.lookup(fileName, true); File tmpFile = manager2.createTempFile(fileName); writeToFile(tmpFile, "This file exists"); - manager2.update(new String[] {fileName}, new String[] {tmpFile.getName()}); + manager2.update(new String[] { fileName }, new String[] { tmpFile.getName() }); manager2.close(); manager2 = null; } catch (IOException e) { @@ -144,11 +143,11 @@ private String getInputStreamContents(InputStream is) throws IOException { } /** - * This tests a FM update where the a specific file is managed with a - * revision number of (n) and an update is requested while there already - * exists a file with revision number (n+1). FM should skip that generation - * number and update the database with file version set to (n+2). This test is - * possible if a power loss occurs between FM rename() and FM save(). + * This tests a FM update where the a specific file is managed with a revision + * number of (n) and an update is requested while there already exists a file + * with revision number (n+1). FM should skip that generation number and update + * the database with file version set to (n+2). This test is possible if a power + * loss occurs between FM rename() and FM save(). */ public void testExistingVersion() { String testFile = "testExistingVersion.txt"; @@ -167,7 +166,7 @@ public void testExistingVersion() { manager1.add(testFile); File file = manager1.createTempFile(testFile); writeToFile(file, "contents irrelevant"); - manager1.update(new String[] {testFile}, new String[] {file.getName()}); + manager1.update(new String[] { testFile }, new String[] { file.getName() }); if (!file1.exists() || file2.exists() || file3.exists() || file4.exists()) { fail("Failed to create a single test file"); return; @@ -179,7 +178,7 @@ public void testExistingVersion() { // update another file after generation 2 already exists... file = manager1.createTempFile(testFile); writeToFile(file, "file 3 contents"); - manager1.update(new String[] {testFile}, new String[] {file.getName()}); + manager1.update(new String[] { testFile }, new String[] { file.getName() }); if (!file3.exists() || file4.exists()) { fail("Failed to skip existing filemanager file."); return; @@ -209,8 +208,8 @@ public void testExistingVersion() { } /** - * This tests that FM apis throw exceptions if FM has not yet been opened - * or if FM has been closed. + * This tests that FM apis throw exceptions if FM has not yet been opened or if + * FM has been closed. */ public void testNotOpen() { String permanentFile = "testNotOpen.txt"; @@ -222,7 +221,7 @@ public void testNotOpen() { manager1.add(permanentFile); File tmpFile = manager1.createTempFile(permanentFile); this.writeToFile(tmpFile, "File exists"); - manager1.update(new String[] {permanentFile}, new String[] {tmpFile.getName()}); + manager1.update(new String[] { permanentFile }, new String[] { tmpFile.getName() }); manager1.add(scratchFile); } catch (IOException e) { fail("unexpected exception", e); @@ -279,7 +278,7 @@ void checkOpen(boolean open, String permanentFile, String scratchFile) { } if (tmpFile != null) { try { - manager2.update(new String[] {permanentFile}, new String[] {tmpFile.getName()}); + manager2.update(new String[] { permanentFile }, new String[] { tmpFile.getName() }); if (!open) fail("update did not fail."); } catch (IOException e) { @@ -302,13 +301,14 @@ void checkOpen(boolean open, String permanentFile, String scratchFile) { } /** - * This tests FM remove() then add(). On a remove(), the file can not be deleted as it may - * be in use by another FM. Then add() the file back and see if the version number written to - * is (n+1) where (n) is the version when remove() called. This is likely if framework uses - * -clean where on clean we remove the file, then on exit we add the file back. Make sure - * this is orderly. + * This tests FM remove() then add(). On a remove(), the file can not be deleted + * as it may be in use by another FM. Then add() the file back and see if the + * version number written to is (n+1) where (n) is the version when remove() + * called. This is likely if framework uses -clean where on clean we remove the + * file, then on exit we add the file back. Make sure this is orderly. * - * Currently is is a known issues that remove() will never delete any old manager contents. + * Currently is is a known issues that remove() will never delete any old + * manager contents. */ public void testRemoveThenAdd() { String fileName = "testRemoveThenAdd.txt"; @@ -323,11 +323,11 @@ public void testRemoveThenAdd() { // create version (1) File tmpFile = manager1.createTempFile(fileName); writeToFile(tmpFile, "File exists"); - manager1.update(new String[] {fileName}, new String[] {tmpFile.getName()}); + manager1.update(new String[] { fileName }, new String[] { tmpFile.getName() }); // do it again, now version (2) tmpFile = manager1.createTempFile(fileName); writeToFile(tmpFile, "File exists #2"); - manager1.update(new String[] {fileName}, new String[] {tmpFile.getName()}); + manager1.update(new String[] { fileName }, new String[] { tmpFile.getName() }); manager1.close(); // force a cleanup manager1 = null; // sanity check @@ -347,7 +347,7 @@ public void testRemoveThenAdd() { // write new file, ensure it version 3 tmpFile = manager2.createTempFile(fileName); writeToFile(tmpFile, "File exists #3"); - manager2.update(new String[] {fileName}, new String[] {tmpFile.getName()}); + manager2.update(new String[] { fileName }, new String[] { tmpFile.getName() }); testFile = manager2.lookup(fileName, false); assertNotNull(testFile); assertTrue(testFile.getName().endsWith(".3")); @@ -375,7 +375,8 @@ public void testRemoveThenAdd() { */ public void testMultipleFileManagers() { // This test relies on a file lock to fail if the same process already - // holds a file lock. This is true on Win32 but not on Linux/Mac unless using Java 6. + // holds a file lock. This is true on Win32 but not on Linux/Mac unless using + // Java 6. // So run this test for windows only. String ee = System.getProperty(Constants.FRAMEWORK_EXECUTIONENVIRONMENT); if (!"win32".equalsIgnoreCase(System.getProperty("osgi.os")) && ee.indexOf("JavaSE-1.6") == -1) @@ -391,7 +392,7 @@ public void testMultipleFileManagers() { assertNotNull(file); file = manager1.createTempFile(fileName); writeToFile(file, "test contents #1"); - manager1.update(new String[] {fileName}, new String[] {file.getName()}); + manager1.update(new String[] { fileName }, new String[] { file.getName() }); // ensure file is version #1 file = manager1.lookup(fileName, false); @@ -399,7 +400,7 @@ public void testMultipleFileManagers() { assertTrue(file.getName().endsWith(".1")); assertTrue(file1.exists()); - //new fileMangager using version #1 + // new fileMangager using version #1 manager2 = new StorageManager(base, null); manager2.open(true); // sanity check @@ -411,8 +412,8 @@ public void testMultipleFileManagers() { // back to manager #1, update file again, close file = manager1.createTempFile(fileName); writeToFile(file, "test contents #2"); - manager1.update(new String[] {fileName}, new String[] {file.getName()}); - //sanity check + manager1.update(new String[] { fileName }, new String[] { file.getName() }); + // sanity check assertTrue(file1.exists()); assertTrue(file2.exists()); manager1.close(); @@ -471,7 +472,7 @@ public void testJavaIOLocking() { manager1.open(true); // wait for lock fail("open with lock succedded"); } catch (IOException e) { - //good + // good } manager1.open(false); // don't wait, should work @@ -479,9 +480,9 @@ public void testJavaIOLocking() { manager1.add(fileName); fail("add succedded"); } catch (IOException e) { - //good + // good } - //sanity check, file should not be managed + // sanity check, file should not be managed assertNull(manager1.lookup(fileName, false)); manager1.close(); manager1 = null; @@ -511,7 +512,7 @@ public void testCleanupOnOpen() { // create version (1) File tmpFile = manager1.createTempFile(fileName); writeToFile(tmpFile, "File exists #1"); - manager1.update(new String[] {fileName}, new String[] {tmpFile.getName()}); + manager1.update(new String[] { fileName }, new String[] { tmpFile.getName() }); // sanity check assertTrue(file1.toString(), file1.exists()); assertFalse(file2.toString(), file2.exists()); @@ -520,7 +521,7 @@ public void testCleanupOnOpen() { // do it again, now version (2) tmpFile = manager1.createTempFile(fileName); writeToFile(tmpFile, "File exists #2"); - manager1.update(new String[] {fileName}, new String[] {tmpFile.getName()}); + manager1.update(new String[] { fileName }, new String[] { tmpFile.getName() }); // sanity check assertTrue(file1.toString(), file1.exists()); assertTrue(file2.toString(), file2.exists()); @@ -529,19 +530,21 @@ public void testCleanupOnOpen() { // do it again, now version (3) tmpFile = manager1.createTempFile(fileName); writeToFile(tmpFile, "File exists #3"); - manager1.update(new String[] {fileName}, new String[] {tmpFile.getName()}); + manager1.update(new String[] { fileName }, new String[] { tmpFile.getName() }); // sanity check assertTrue(file1.toString(), file1.exists()); assertTrue(file2.toString(), file2.exists()); assertTrue(file3.toString(), file3.exists()); // This test relies on a file lock to fail if the same process already - // holds a file lock. This is true on Win32 but not on Linux/Mac unless using Java 6. + // holds a file lock. This is true on Win32 but not on Linux/Mac unless using + // Java 6. // So run this test for windows only or Java 6 or higher. String ee = System.getProperty(Constants.FRAMEWORK_EXECUTIONENVIRONMENT); if ("win32".equalsIgnoreCase(System.getProperty("osgi.os")) || ee.indexOf("JavaSE-1.6") != -1) { // this is a Windows-only test or JavaSE-1.6 or higher test - // Check to see that a new manager does not delete on open/close while manager1 is open + // Check to see that a new manager does not delete on open/close while manager1 + // is open manager2 = new StorageManager(base, null); manager2.open(true); manager2.close(); @@ -595,7 +598,7 @@ public void testCleanupOnSave() { // create version (1) File tmpFile = manager1.createTempFile(fileName); writeToFile(tmpFile, "File exists #1"); - manager1.update(new String[] {fileName}, new String[] {tmpFile.getName()}); + manager1.update(new String[] { fileName }, new String[] { tmpFile.getName() }); // sanity check assertTrue(file1.toString(), file1.exists()); assertFalse(file2.toString(), file2.exists()); @@ -604,7 +607,7 @@ public void testCleanupOnSave() { // do it again, now version (2) tmpFile = manager1.createTempFile(fileName); writeToFile(tmpFile, "File exists #2"); - manager1.update(new String[] {fileName}, new String[] {tmpFile.getName()}); + manager1.update(new String[] { fileName }, new String[] { tmpFile.getName() }); // sanity check assertFalse(file1.toString(), file1.exists()); assertTrue(file2.toString(), file2.exists()); @@ -613,7 +616,7 @@ public void testCleanupOnSave() { // do it again, now version (3) tmpFile = manager1.createTempFile(fileName); writeToFile(tmpFile, "File exists #3"); - manager1.update(new String[] {fileName}, new String[] {tmpFile.getName()}); + manager1.update(new String[] { fileName }, new String[] { tmpFile.getName() }); // sanity check assertFalse(file1.toString(), file1.exists()); assertFalse(file2.toString(), file2.exists()); diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/datalocation/LocationAreaSessionTest.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/datalocation/LocationAreaSessionTest.java index f40b40fed70..7df2b3c7cf8 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/datalocation/LocationAreaSessionTest.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/datalocation/LocationAreaSessionTest.java @@ -48,7 +48,8 @@ public void runBare() throws Throwable { }); // attempt to lock same location with a session - ConfigurationSessionTestSuite sessionLock = new ConfigurationSessionTestSuite(PI_OSGI_TESTS, LocationAreaSessionTest.class.getName()); + ConfigurationSessionTestSuite sessionLock = new ConfigurationSessionTestSuite(PI_OSGI_TESTS, + LocationAreaSessionTest.class.getName()); addRequiredOSGiTestsBundles(sessionLock); try { sessionLock.getSetup().setSystemProperty(TEST_LOCATION_DIR, testLocationLockDir); @@ -145,11 +146,13 @@ static void doLock(String testLocationDir, boolean release, boolean succeed) { fail("The testLocationDir is not set"); ServiceReference[] refs = null; try { - refs = OSGiTestsActivator.getContext().getServiceReferences(Location.class.getName(), "(type=osgi.configuration.area)"); + refs = OSGiTestsActivator.getContext().getServiceReferences(Location.class.getName(), + "(type=osgi.configuration.area)"); } catch (InvalidSyntaxException e) { fail("failed to create filter", e); } - // this is test code so we are not very careful; just assume there is at lease one service. Do not copy and paste this code!!! + // this is test code so we are not very careful; just assume there is at lease + // one service. Do not copy and paste this code!!! Location configLocation = (Location) OSGiTestsActivator.getContext().getService(refs[0]); Location testLocation = null; try { diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/datalocation/StreamManagerTests.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/datalocation/StreamManagerTests.java index 7c243a1a606..bade48dddbc 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/datalocation/StreamManagerTests.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/datalocation/StreamManagerTests.java @@ -127,7 +127,7 @@ public void testReliableFile() { manager1.close(); manager1 = null; - //now, open new manager, verify file contents are #2 + // now, open new manager, verify file contents are #2 System.setProperty("osgi.useReliableFiles", "true"); // force reliable files manager2 = new StorageManager(base, null); manager2.open(true); @@ -140,9 +140,9 @@ public void testReliableFile() { // need to sleep, FAT32 doesn't have too fine granularity in timestamps try { Thread.sleep(5000); - } catch (InterruptedException e) {/*ignore*/ + } catch (InterruptedException e) {/* ignore */ } - //now, corrupt version 2 of the file + // now, corrupt version 2 of the file RandomAccessFile raf = new RandomAccessFile(file2, "rw"); raf.seek(20); raf.write('0'); // change 'O' to '0' @@ -152,14 +152,14 @@ public void testReliableFile() { manager1 = new StorageManager(base, null); manager1.open(true); - //request any valid stream available + // request any valid stream available is = manager1.getInputStream(fileName); assertNotNull(is); assertEquals(contents1, getInputStreamContents(is)); - //now request only the primary file + // now request only the primary file try { - InputStream[] isSet = manager1.getInputStreamSet(new String[] {fileName}); + InputStream[] isSet = manager1.getInputStreamSet(new String[] { fileName }); for (InputStream set : isSet) { if (set != null) { set.close(); @@ -167,10 +167,10 @@ public void testReliableFile() { } fail("getInputStreamSet was successful"); } catch (IOException e) { - //good + // good } - //now, corrupt version 1 of the file + // now, corrupt version 1 of the file raf = new RandomAccessFile(file1, "rw"); raf.seek(20); raf.write('0'); // change 'O' to '0' @@ -181,7 +181,7 @@ public void testReliableFile() { is = manager1.getInputStream(fileName); fail("get input stream succedded"); } catch (IOException e) { - //good + // good } manager1.close(); manager1 = null; @@ -209,7 +209,7 @@ public void testBigReliableFile() { manager1.close(); manager1 = null; - //now, open new manager, verify file contents are there + // now, open new manager, verify file contents are there System.setProperty("osgi.useReliableFiles", "true"); // force reliable files manager2 = new StorageManager(base, null); manager2.open(true); @@ -229,8 +229,8 @@ public void testBigReliableFile() { } /** - * This tests if migration from a prior (non-ReliableFile) .fileTable - * to the current .fileTable is correct. + * This tests if migration from a prior (non-ReliableFile) .fileTable to the + * current .fileTable is correct. * */ public void testMigration() { @@ -260,27 +260,27 @@ public void testMigration() { // update a new file File testFile = manager1.createTempFile(fileName); writeToFile(testFile, contents2); - manager1.update(new String[] {fileName}, new String[] {testFile.getName()}); + manager1.update(new String[] { fileName }, new String[] { testFile.getName() }); // again testFile = manager1.createTempFile(fileName); writeToFile(testFile, contents3); - manager1.update(new String[] {fileName}, new String[] {testFile.getName()}); + manager1.update(new String[] { fileName }, new String[] { testFile.getName() }); // again testFile = manager1.createTempFile(fileName); writeToFile(testFile, contents1); - manager1.update(new String[] {fileName}, new String[] {testFile.getName()}); + manager1.update(new String[] { fileName }, new String[] { testFile.getName() }); manager1.close(); manager1 = null; String[] files = managerDir.list(); assertEquals(4, files.length); - //original file never gets deleted + // original file never gets deleted assertTrue(fileTable.exists()); - //behaves like a reliableFile? + // behaves like a reliableFile? assertFalse(fileTable1.exists()); assertTrue(fileTable2.exists()); assertTrue(fileTable3.exists()); - //files are as expected? + // files are as expected? files = testDir.list(); assertEquals(2, files.length); assertTrue(file5.exists()); @@ -323,12 +323,12 @@ private void testAbort(boolean reliable) { System.setProperty("osgi.useReliableFiles", "true"); // force reliable files manager1 = new StorageManager(base, null); manager1.open(true); - //create version 1 + // create version 1 ManagedOutputStream smos = manager1.getOutputStream(fileName); smos.write(contents1.getBytes()); smos.close(); - //start creating version 2 + // start creating version 2 smos = manager1.getOutputStream(fileName); smos.write(contents2.getBytes()); smos.abort(); @@ -347,7 +347,7 @@ private void testAbort(boolean reliable) { System.setProperty("osgi.useReliableFiles", "true"); // force reliable files manager2 = new StorageManager(base, null); manager2.open(true); - //create version 1 + // create version 1 // now see if we're still on version #1 assertEquals(1, manager2.getId(fileName)); // check contents also @@ -391,7 +391,7 @@ private void testGetOutputStreamSet(boolean reliable) { System.setProperty("osgi.useReliableFiles", reliable ? "true" : "false"); // force reliable files manager1 = new StorageManager(mgrDir, null); manager1.open(true); - ManagedOutputStream[] outs = manager1.getOutputStreamSet(new String[] {fileName1, fileName2}); + ManagedOutputStream[] outs = manager1.getOutputStreamSet(new String[] { fileName1, fileName2 }); assertNotNull(outs); assertEquals(2, outs.length); @@ -404,7 +404,7 @@ private void testGetOutputStreamSet(boolean reliable) { assertTrue(file1_1.exists()); assertTrue(file2_1.exists()); - outs = manager1.getOutputStreamSet(new String[] {fileName1, fileName2}); + outs = manager1.getOutputStreamSet(new String[] { fileName1, fileName2 }); assertNotNull(outs); outs[0].write("new data #1".getBytes()); @@ -461,22 +461,23 @@ private void testAbortSet(boolean reliable) { System.setProperty("osgi.useReliableFiles", reliable ? "true" : "false"); // force reliable files manager1 = new StorageManager(mgrDir, null); manager1.open(true); - ManagedOutputStream[] outs = manager1.getOutputStreamSet(new String[] {fileName1, fileName2, fileName3, fileName4}); + ManagedOutputStream[] outs = manager1 + .getOutputStreamSet(new String[] { fileName1, fileName2, fileName3, fileName4 }); assertNotNull(outs); outs[0].write(contents1.getBytes()); outs[1].write(contents2.getBytes()); outs[2].write(contents2.getBytes()); outs[3].write(contents1.getBytes()); - //sanity check + // sanity check list = mgrDir.list(); assertEquals(5, list.length); outs[2].close(); outs[1].abort(); - outs[0].close(); //noop - outs[3].close(); //noop - outs[2].close(); //noop - outs[1].close(); //noop + outs[0].close(); // noop + outs[3].close(); // noop + outs[2].close(); // noop + outs[1].close(); // noop list = mgrDir.list(); assertEquals(1, list.length); assertNull(manager1.lookup(fileName1, false)); @@ -490,7 +491,7 @@ private void testAbortSet(boolean reliable) { System.setProperty("osgi.useReliableFiles", reliable ? "true" : "false"); // force reliable files manager2 = new StorageManager(mgrDir, null); manager2.open(true); - //create version 1 + // create version 1 assertNull(manager2.lookup(fileName1, false)); assertNull(manager2.lookup(fileName2, false)); assertNull(manager2.lookup(fileName3, false)); diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/resolver/AbstractStateTest.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/resolver/AbstractStateTest.java index 1cda30de39a..45dcd198192 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/resolver/AbstractStateTest.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/resolver/AbstractStateTest.java @@ -127,9 +127,11 @@ private void assertVersionConstraintEquals(String tag, VersionConstraint origina if (original.getSupplier() != null) { Object o = original.getSupplier(); if (o instanceof BundleDescription) - assertEquals(tag + ".5", (BundleDescription) original.getSupplier(), (BundleDescription) copy.getSupplier()); + assertEquals(tag + ".5", (BundleDescription) original.getSupplier(), + (BundleDescription) copy.getSupplier()); else - assertEquals(tag + ".5", (ExportPackageDescription) original.getSupplier(), (ExportPackageDescription) copy.getSupplier()); + assertEquals(tag + ".5", (ExportPackageDescription) original.getSupplier(), + (ExportPackageDescription) copy.getSupplier()); } } @@ -203,42 +205,48 @@ public State buildComplexState() throws BundleException { * org.eclipse.b1_1.0 exports org.eclipse.p1_1.0 imports org.eclipse.p2 */ final String B1_LOCATION = "org.eclipse.b1"; - final String B1_MANIFEST = "Bundle-SymbolicName: org.eclipse.b1\n" + "Bundle-Version: 1.0\n" + "Export-Package: org.eclipse.p1;specification-version=1.0\n" + "Import-Package: org.eclipse.p2"; + final String B1_MANIFEST = "Bundle-SymbolicName: org.eclipse.b1\n" + "Bundle-Version: 1.0\n" + + "Export-Package: org.eclipse.p1;specification-version=1.0\n" + "Import-Package: org.eclipse.p2"; BundleDescription b1 = state.getFactory().createBundleDescription(parseManifest(B1_MANIFEST), B1_LOCATION, 1); state.addBundle(b1); /* * org.eclipse.b2_2.0 exports org.eclipse.p2 imports org.eclipse.p1 */ final String B2_LOCATION = "org.eclipse.b2"; - final String B2_MANIFEST = "Bundle-SymbolicName: org.eclipse.b2\n" + "Bundle-Version: 2.0\n" + "Export-Package: org.eclipse.p2\n" + "Import-Package: org.eclipse.p1"; + final String B2_MANIFEST = "Bundle-SymbolicName: org.eclipse.b2\n" + "Bundle-Version: 2.0\n" + + "Export-Package: org.eclipse.p2\n" + "Import-Package: org.eclipse.p1"; BundleDescription b2 = state.getFactory().createBundleDescription(parseManifest(B2_MANIFEST), B2_LOCATION, 2); state.addBundle(b2); /* * org.eclipse.b3_2.0 exports org.eclipse.p2_2.0 */ final String B3_LOCATION = "org.eclipse.b3"; - final String B3_MANIFEST = "Bundle-SymbolicName: org.eclipse.b3\n" + "Bundle-Version: 2.0\n" + "Export-Package: org.eclipse.p2; specification-version=2.0"; + final String B3_MANIFEST = "Bundle-SymbolicName: org.eclipse.b3\n" + "Bundle-Version: 2.0\n" + + "Export-Package: org.eclipse.p2; specification-version=2.0"; BundleDescription b3 = state.getFactory().createBundleDescription(parseManifest(B3_MANIFEST), B3_LOCATION, 3); state.addBundle(b3); /* * org.eclipse.b4_1.0 requires org.eclipse.b1_* */ final String B4_LOCATION = "org.eclipse.b4"; - final String B4_MANIFEST = "Bundle-SymbolicName: org.eclipse.b4\n" + "Bundle-Version: 2.0\n" + "Require-Bundle: org.eclipse.b1"; + final String B4_MANIFEST = "Bundle-SymbolicName: org.eclipse.b4\n" + "Bundle-Version: 2.0\n" + + "Require-Bundle: org.eclipse.b1"; BundleDescription b4 = state.getFactory().createBundleDescription(parseManifest(B4_MANIFEST), B4_LOCATION, 4); state.addBundle(b4); /* * org.eclipse.b5_1.0 fragment for org.eclipse.b3_* */ final String B5_LOCATION = "org.eclipse.b5"; - final String B5_MANIFEST = "Bundle-SymbolicName: org.eclipse.b5\n" + "Bundle-Version: 1.0\n" + "Fragment-Host: org.eclipse.b3"; + final String B5_MANIFEST = "Bundle-SymbolicName: org.eclipse.b5\n" + "Bundle-Version: 1.0\n" + + "Fragment-Host: org.eclipse.b3"; BundleDescription b5 = state.getFactory().createBundleDescription(parseManifest(B5_MANIFEST), B5_LOCATION, 5); state.addBundle(b5); /* * org.eclipse.b6_1.0 requires org.eclipse.b4 */ final String B6_LOCATION = "org.eclipse.b6"; - final String B6_MANIFEST = "Bundle-SymbolicName: org.eclipse.b6\n" + "Bundle-Version: 1.0\n" + "Require-Bundle: org.eclipse.b4"; + final String B6_MANIFEST = "Bundle-SymbolicName: org.eclipse.b6\n" + "Bundle-Version: 1.0\n" + + "Require-Bundle: org.eclipse.b4"; BundleDescription b6 = state.getFactory().createBundleDescription(parseManifest(B6_MANIFEST), B6_LOCATION, 6); state.addBundle(b6); return state; @@ -254,8 +262,10 @@ public State buildInitialState() throws BundleException { * org.eclipse.b1_1.0 exports org.eclipse.p1_1.0 */ final String SYSTEM_BUNDLE_LOCATION = "org.eclipse.b1"; - final String SYSTEM_BUNDLE_MANIFEST = "Bundle-SymbolicName: org.osgi.framework\n" + "Bundle-Version: 3.0\n" + "Export-Package: org.osgi.framework; specification-version=3.0"; - BundleDescription b0 = state.getFactory().createBundleDescription(parseManifest(SYSTEM_BUNDLE_MANIFEST), SYSTEM_BUNDLE_LOCATION, 0); + final String SYSTEM_BUNDLE_MANIFEST = "Bundle-SymbolicName: org.osgi.framework\n" + "Bundle-Version: 3.0\n" + + "Export-Package: org.osgi.framework; specification-version=3.0"; + BundleDescription b0 = state.getFactory().createBundleDescription(parseManifest(SYSTEM_BUNDLE_MANIFEST), + SYSTEM_BUNDLE_LOCATION, 0); state.addBundle(b0); return state; } @@ -266,21 +276,24 @@ public State buildSimpleState() throws BundleException { * org.eclipse.b1_1.0 exports org.eclipse.p1_1.0 imports org.eclipse.p2 */ final String B1_LOCATION = "org.eclipse.b1"; - final String B1_MANIFEST = "Bundle-SymbolicName: org.eclipse.b1\n" + "Bundle-Version: 1.0\n" + "Export-Package: org.eclipse.p1;specification-version=1.0\n" + "Import-Package: org.eclipse.p2"; + final String B1_MANIFEST = "Bundle-SymbolicName: org.eclipse.b1\n" + "Bundle-Version: 1.0\n" + + "Export-Package: org.eclipse.p1;specification-version=1.0\n" + "Import-Package: org.eclipse.p2"; BundleDescription b1 = state.getFactory().createBundleDescription(parseManifest(B1_MANIFEST), B1_LOCATION, 1); state.addBundle(b1); /* * org.eclipse.b2_2.0 exports org.eclipse.p2 imports org.eclipse.p1 */ final String B2_LOCATION = "org.eclipse.b2"; - final String B2_MANIFEST = "Bundle-SymbolicName: org.eclipse.b2\n" + "Bundle-Version: 2.0\n" + "Export-Package: org.eclipse.p2\n" + "Import-Package: org.eclipse.p1"; + final String B2_MANIFEST = "Bundle-SymbolicName: org.eclipse.b2\n" + "Bundle-Version: 2.0\n" + + "Export-Package: org.eclipse.p2\n" + "Import-Package: org.eclipse.p1"; BundleDescription b2 = state.getFactory().createBundleDescription(parseManifest(B2_MANIFEST), B2_LOCATION, 2); state.addBundle(b2); /* * org.eclipse.b3_2.0 imports org.eclipse.p1_2.0 */ final String B3_LOCATION = "org.eclipse.b3"; - final String B3_MANIFEST = "Bundle-SymbolicName: org.eclipse.b3\n" + "Bundle-Version: 2.0\n" + "Import-Package: org.eclipse.p1; specification-version=2.0"; + final String B3_MANIFEST = "Bundle-SymbolicName: org.eclipse.b3\n" + "Bundle-Version: 2.0\n" + + "Import-Package: org.eclipse.p1; specification-version=2.0"; BundleDescription b3 = state.getFactory().createBundleDescription(parseManifest(B3_MANIFEST), B3_LOCATION, 3); state.addBundle(b3); return state; diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/resolver/DevModeTest.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/resolver/DevModeTest.java index 403a4476d60..8204bf3dac0 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/resolver/DevModeTest.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/resolver/DevModeTest.java @@ -29,7 +29,7 @@ public DevModeTest(String name) { private State buildDevModeState() { State state = buildEmptyState(); - Dictionary[] props = new Dictionary[] {new Hashtable()}; + Dictionary[] props = new Dictionary[] { new Hashtable() }; props[0].put("osgi.resolverMode", "development"); state.setPlatformProperties(props); return state; @@ -48,35 +48,50 @@ public void testDevModeDomino02() throws BundleException { manifest.put(Constants.EXPORT_PACKAGE, "a"); manifest.put(Constants.IMPORT_PACKAGE, "x, d"); manifest.put(Constants.REQUIRE_BUNDLE, "X, E"); - BundleDescription a = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription a = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); manifest.put(Constants.BUNDLE_SYMBOLICNAME, "B"); manifest.put(Constants.BUNDLE_VERSION, "1.0"); manifest.put(Constants.REQUIRE_BUNDLE, "A"); - BundleDescription b = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription b = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); manifest.put(Constants.BUNDLE_SYMBOLICNAME, "C"); manifest.put(Constants.BUNDLE_VERSION, "1.0"); manifest.put(Constants.REQUIRE_BUNDLE, "A"); - BundleDescription c = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription c = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); manifest.put(Constants.BUNDLE_SYMBOLICNAME, "D"); manifest.put(Constants.BUNDLE_VERSION, "1.0"); manifest.put(Constants.EXPORT_PACKAGE, "d"); - BundleDescription d = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription d = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); manifest.put(Constants.BUNDLE_SYMBOLICNAME, "E"); manifest.put(Constants.BUNDLE_VERSION, "1.0"); manifest.put(Constants.EXPORT_PACKAGE, "e"); - BundleDescription e = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription e = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); state.addBundle(a); state.addBundle(b); @@ -121,21 +136,30 @@ public void testDevModeDomino01() throws BundleException { manifest.put(Constants.EXPORT_PACKAGE, "a"); manifest.put(Constants.IMPORT_PACKAGE, "x"); manifest.put(Constants.REQUIRE_BUNDLE, "X"); - BundleDescription a = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription a = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); manifest.put(Constants.BUNDLE_SYMBOLICNAME, "B"); manifest.put(Constants.BUNDLE_VERSION, "1.0"); manifest.put(Constants.REQUIRE_BUNDLE, "A"); - BundleDescription b = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription b = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); manifest.put(Constants.BUNDLE_SYMBOLICNAME, "C"); manifest.put(Constants.BUNDLE_VERSION, "1.0"); manifest.put(Constants.REQUIRE_BUNDLE, "A"); - BundleDescription c = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription c = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); state.addBundle(a); state.addBundle(b); @@ -168,7 +192,10 @@ public void testDevModeFragment01() throws BundleException { manifest.put(Constants.BUNDLE_VERSION, "1.0"); manifest.put(Constants.EXPORT_PACKAGE, "a"); manifest.put(Constants.IMPORT_PACKAGE, "c"); - BundleDescription a = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription a = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); @@ -176,21 +203,30 @@ public void testDevModeFragment01() throws BundleException { manifest.put(Constants.BUNDLE_VERSION, "1.0"); manifest.put(Constants.FRAGMENT_HOST, "A"); manifest.put(Constants.EXPORT_PACKAGE, "a.frag"); - BundleDescription aFrag = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription aFrag = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); manifest.put(Constants.BUNDLE_SYMBOLICNAME, "B"); manifest.put(Constants.BUNDLE_VERSION, "1.0"); manifest.put(Constants.IMPORT_PACKAGE, "a, a.frag"); - BundleDescription b = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription b = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); manifest.put(Constants.BUNDLE_SYMBOLICNAME, "C"); manifest.put(Constants.BUNDLE_VERSION, "1.0"); manifest.put(Constants.EXPORT_PACKAGE, "c"); - BundleDescription c = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription c = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); state.addBundle(a); state.addBundle(aFrag); @@ -236,28 +272,40 @@ public void testDevModeSingleton01() throws BundleException { manifest.put(Constants.BUNDLE_SYMBOLICNAME, "A; singleton:=true"); manifest.put(Constants.BUNDLE_VERSION, "1.0"); manifest.put(Constants.EXPORT_PACKAGE, "a"); - BundleDescription a1 = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription a1 = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); manifest.put(Constants.BUNDLE_SYMBOLICNAME, "A; singleton:=true"); manifest.put(Constants.BUNDLE_VERSION, "2.0"); manifest.put(Constants.EXPORT_PACKAGE, "a"); - BundleDescription a2 = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription a2 = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); manifest.put(Constants.BUNDLE_SYMBOLICNAME, "B"); manifest.put(Constants.BUNDLE_VERSION, "1.0"); manifest.put(Constants.REQUIRE_BUNDLE, "A; bundle-version=2.0"); - BundleDescription b = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription b = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); manifest.put(Constants.BUNDLE_SYMBOLICNAME, "C"); manifest.put(Constants.BUNDLE_VERSION, "1.0"); manifest.put(Constants.REQUIRE_BUNDLE, "A; bundle-version=\"[1.0,2.0)\""); - BundleDescription c = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription c = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); state.addBundle(a1); state.addBundle(a2); @@ -291,28 +339,40 @@ public void testDevModeSingleton02() throws BundleException { manifest.put(Constants.BUNDLE_VERSION, "1.0"); manifest.put(Constants.EXPORT_PACKAGE, "a"); manifest.put(Constants.IMPORT_PACKAGE, "x"); - BundleDescription a1 = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription a1 = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); manifest.put(Constants.BUNDLE_SYMBOLICNAME, "A; singleton:=true"); manifest.put(Constants.BUNDLE_VERSION, "2.0"); manifest.put(Constants.EXPORT_PACKAGE, "a"); - BundleDescription a2 = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription a2 = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); manifest.put(Constants.BUNDLE_SYMBOLICNAME, "B"); manifest.put(Constants.BUNDLE_VERSION, "1.0"); manifest.put(Constants.REQUIRE_BUNDLE, "A; bundle-version=2.0"); - BundleDescription b = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription b = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); manifest.put(Constants.BUNDLE_SYMBOLICNAME, "C"); manifest.put(Constants.BUNDLE_VERSION, "1.0"); manifest.put(Constants.REQUIRE_BUNDLE, "A; bundle-version=\"[1.0,2.0)\""); - BundleDescription c = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription c = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); state.addBundle(a1); state.addBundle(a2); @@ -345,8 +405,12 @@ public void testDevModeGenericCapability() throws BundleException { manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); manifest.put(Constants.BUNDLE_SYMBOLICNAME, "A; singleton:=true"); manifest.put(Constants.BUNDLE_VERSION, "1.0"); - manifest.put(Constants.REQUIRE_CAPABILITY, "osgi.service; filter:=\"(objectClass=foo.Bar)\";\n" + " effective:=\"active\""); - BundleDescription a = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + manifest.put(Constants.REQUIRE_CAPABILITY, + "osgi.service; filter:=\"(objectClass=foo.Bar)\";\n" + " effective:=\"active\""); + BundleDescription a = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); state.addBundle(a); state.resolve(); @@ -359,7 +423,10 @@ public void testDevModeGenericCapability() throws BundleException { manifest.put(Constants.BUNDLE_SYMBOLICNAME, "B; singleton:=true"); manifest.put(Constants.BUNDLE_VERSION, "1.0"); manifest.put(Constants.PROVIDE_CAPABILITY, "osgi.service; objectClass:List=\"foo.Bar\""); - BundleDescription b = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription b = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); state.addBundle(b); state.resolve(); diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/resolver/DisabledInfoTest.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/resolver/DisabledInfoTest.java index 4a2ab80cd19..5c4f889d30d 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/resolver/DisabledInfoTest.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/resolver/DisabledInfoTest.java @@ -191,14 +191,20 @@ public void testBug251427() throws BundleException { private State buildTestState() throws BundleException { State state = buildEmptyState(); - final String B1_MANIFEST = "Bundle-ManifestVersion: 1\n" + "Bundle-SymbolicName: b1\n" + "Bundle-Version: 1.0\n" + "Import-Package: b2"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - BundleDescription b1 = state.getFactory().createBundleDescription(state, parseManifest(B1_MANIFEST), B1_LOCATION, 1); + final String B1_MANIFEST = "Bundle-ManifestVersion: 1\n" + "Bundle-SymbolicName: b1\n" + "Bundle-Version: 1.0\n" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + + "Import-Package: b2"; //$NON-NLS-1$ + BundleDescription b1 = state.getFactory().createBundleDescription(state, parseManifest(B1_MANIFEST), + B1_LOCATION, 1); state.addBundle(b1); - final String B2_MANIFEST = "Bundle-ManifestVersion: 1\n" + "Bundle-SymbolicName: b2\n" + "Bundle-Version: 1.0\n" + "Export-Package: b2\n" + "Import-Package: b3"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ - BundleDescription b2 = state.getFactory().createBundleDescription(state, parseManifest(B2_MANIFEST), B2_LOCATION, 2); + final String B2_MANIFEST = "Bundle-ManifestVersion: 1\n" + "Bundle-SymbolicName: b2\n" + "Bundle-Version: 1.0\n" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + + "Export-Package: b2\n" + "Import-Package: b3"; //$NON-NLS-1$ //$NON-NLS-2$ + BundleDescription b2 = state.getFactory().createBundleDescription(state, parseManifest(B2_MANIFEST), + B2_LOCATION, 2); state.addBundle(b2); - final String B3_MANIFEST = "Bundle-ManifestVersion: 1\n" + "Bundle-SymbolicName: b3\n" + "Bundle-Version: 1.0\n" + "Export-Package: b3; version=1.0"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - BundleDescription b3 = state.getFactory().createBundleDescription(state, parseManifest(B3_MANIFEST), B3_LOCATION, 3); + final String B3_MANIFEST = "Bundle-ManifestVersion: 1\n" + "Bundle-SymbolicName: b3\n" + "Bundle-Version: 1.0\n" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + + "Export-Package: b3; version=1.0"; //$NON-NLS-1$ + BundleDescription b3 = state.getFactory().createBundleDescription(state, parseManifest(B3_MANIFEST), + B3_LOCATION, 3); state.addBundle(b3); return state; } diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/resolver/GenericCapabilityTest.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/resolver/GenericCapabilityTest.java index 8cfb6241565..c28d70964e8 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/resolver/GenericCapabilityTest.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/resolver/GenericCapabilityTest.java @@ -48,7 +48,8 @@ public void testGenericsBasics() throws BundleException { capabililty.append(" aSet:set=\"a,b,c,d\";"); capabililty.append(" aString:string=\"someString\""); manifest.put(GENERIC_CAPABILITY, capabililty.toString()); - BundleDescription genCap = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); + BundleDescription genCap = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); manifest = new Hashtable(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); @@ -58,9 +59,11 @@ public void testGenericsBasics() throws BundleException { required.append("genericCapability:osgi.identity; selection-filter=\"(version=1.0)\","); required.append("foo; selection-filter=\"(version>=1.3.0)\","); required.append("bar:bartype; selection-filter=\"(attr1=value1)\","); - required.append("test.types:testtype; selection-filter=\"(&(aVersion>=2.0.0)(aLong>=5555)(aDouble>=1.00)(aUri=file:/test)(aSet=c)(aString=someString))\""); + required.append( + "test.types:testtype; selection-filter=\"(&(aVersion>=2.0.0)(aLong>=5555)(aDouble>=1.00)(aUri=file:/test)(aSet=c)(aString=someString))\""); manifest.put(GENERIC_REQUIRE, required.toString()); - BundleDescription genReq = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); + BundleDescription genReq = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); state.addBundle(genCap); state.addBundle(genReq); @@ -98,7 +101,8 @@ public void testGenericsUpdate() throws BundleException { capabililty.append(" aSet:set=\"a,b,c,d\";"); capabililty.append(" aString:string=\"someString\""); manifest.put(GENERIC_CAPABILITY, capabililty.toString()); - BundleDescription genCap = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); + BundleDescription genCap = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); manifest = new Hashtable(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); @@ -108,9 +112,11 @@ public void testGenericsUpdate() throws BundleException { required.append("genericCapability:osgi.identity; selection-filter=\"(version>=1.0)\","); required.append("foo; selection-filter=\"(version>=1.3.0)\","); required.append("bar:bartype; selection-filter=\"(attr1=value1)\","); - required.append("test.types:testtype; selection-filter=\"(&(aVersion>=2.0.0)(aLong>=5555)(aDouble>=1.00)(aUri=file:/test)(aSet=c)(aString=someString))\""); + required.append( + "test.types:testtype; selection-filter=\"(&(aVersion>=2.0.0)(aLong>=5555)(aDouble>=1.00)(aUri=file:/test)(aSet=c)(aString=someString))\""); manifest.put(GENERIC_REQUIRE, required.toString()); - BundleDescription genReq = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); + BundleDescription genReq = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); state.addBundle(genCap); state.addBundle(genReq); @@ -144,10 +150,11 @@ public void testGenericsUpdate() throws BundleException { capabililty.append(" aSet:set=\"a,b,c,d\";"); capabililty.append(" aString:string=\"someString\""); manifest.put(GENERIC_CAPABILITY, capabililty.toString()); - BundleDescription genCap2 = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), genCap.getBundleId()); + BundleDescription genCap2 = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), genCap.getBundleId()); state.updateBundle(genCap2); - state.resolve(new BundleDescription[] {genCap2}); + state.resolve(new BundleDescription[] { genCap2 }); assertTrue("3.0", genCap2.isResolved()); assertTrue("3.1", genReq.isResolved()); @@ -182,7 +189,8 @@ public void testGenericsRefresh() throws BundleException { capabililty.append(" aSet:set=\"a,b,c,d\";"); capabililty.append(" aString:string=\"someString\""); manifest.put(GENERIC_CAPABILITY, capabililty.toString()); - BundleDescription genCap = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); + BundleDescription genCap = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); manifest = new Hashtable(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); @@ -192,9 +200,11 @@ public void testGenericsRefresh() throws BundleException { required.append("genericCapability:osgi.identity; selection-filter=\"(version>=1.0)\","); required.append("foo; selection-filter=\"(version>=1.3.0)\","); required.append("bar:bartype; selection-filter=\"(attr1=value1)\","); - required.append("test.types:testtype; selection-filter=\"(&(aVersion>=2.0.0)(aLong>=5555)(aDouble>=1.00)(aUri=file:/test)(aSet=c)(aString=someString))\""); + required.append( + "test.types:testtype; selection-filter=\"(&(aVersion>=2.0.0)(aLong>=5555)(aDouble>=1.00)(aUri=file:/test)(aSet=c)(aString=someString))\""); manifest.put(GENERIC_REQUIRE, required.toString()); - BundleDescription genReq = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); + BundleDescription genReq = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); state.addBundle(genCap); state.addBundle(genReq); @@ -213,7 +223,7 @@ public void testGenericsRefresh() throws BundleException { assertTrue("2.4", genSpecs[3].isResolved()); assertEquals("2.4.1", genSpecs[3].getSupplier(), genCap.getGenericCapabilities()[3]); - state.resolve(new BundleDescription[] {genCap}); + state.resolve(new BundleDescription[] { genCap }); assertTrue("3.0", genCap.isResolved()); assertTrue("3.1", genReq.isResolved()); @@ -249,7 +259,8 @@ public void testGenericsFrags() throws BundleException { capabililty.append(" aSet:set=\"a,b,c,d\";"); capabililty.append(" aString:string=\"someString\""); manifest.put(GENERIC_CAPABILITY, capabililty.toString()); - BundleDescription genCap = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); + BundleDescription genCap = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); manifest.put(Constants.BUNDLE_SYMBOLICNAME, "genericCapability.frag1"); @@ -258,7 +269,8 @@ public void testGenericsFrags() throws BundleException { capabililty = new StringBuilder(); capabililty.append("fragmentStuff"); manifest.put(GENERIC_CAPABILITY, capabililty.toString()); - BundleDescription genCapFrag = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); + BundleDescription genCapFrag = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); manifest = new Hashtable(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); @@ -268,11 +280,14 @@ public void testGenericsFrags() throws BundleException { required.append("genericCapability:osgi.identity; selection-filter=\"(&(version=1.0.0)(type=osgi.bundle))\","); required.append("foo; selection-filter=\"(version>=1.3.0)\","); required.append("bar:bartype; selection-filter=\"(attr1=value1)\","); - required.append("test.types:testtype; selection-filter=\"(&(aVersion>=2.0.0)(aLong>=5555)(aDouble>=1.00)(aUri=file:/test)(aSet=c)(aString=someString))\","); + required.append( + "test.types:testtype; selection-filter=\"(&(aVersion>=2.0.0)(aLong>=5555)(aDouble>=1.00)(aUri=file:/test)(aSet=c)(aString=someString))\","); required.append("fragmentStuff,"); - required.append("genericCapability.frag1:osgi.identity; selection-filter=\"(&(version=1.0.0)(type=osgi.fragment))\""); + required.append( + "genericCapability.frag1:osgi.identity; selection-filter=\"(&(version=1.0.0)(type=osgi.fragment))\""); manifest.put(GENERIC_REQUIRE, required.toString()); - BundleDescription genReq = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); + BundleDescription genReq = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); state.addBundle(genCap); state.addBundle(genCapFrag); @@ -312,13 +327,15 @@ public void testGenericsIntraFrags() throws BundleException { manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); manifest.put(Constants.FRAGMENT_HOST, "org.eclipse.equinox.generic.host;bundle-version=\"1.0.0\""); manifest.put("Eclipse-GenericCapability", "frag.a"); - BundleDescription genFragA = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); + BundleDescription genFragA = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); manifest = new Hashtable(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); manifest.put(Constants.BUNDLE_SYMBOLICNAME, "org.eclipse.equinox.generic.host"); manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); - BundleDescription genHost = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); + BundleDescription genHost = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); manifest = new Hashtable(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); @@ -326,12 +343,16 @@ public void testGenericsIntraFrags() throws BundleException { manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); manifest.put(Constants.FRAGMENT_HOST, "org.eclipse.equinox.generic.host;bundle-version=\"1.0.0\""); StringBuilder required = new StringBuilder(); - required.append("org.eclipse.equinox.generic.host:osgi.identity; selection-filter=\"(&(version=1.0.0)(type=osgi.bundle))\","); + required.append( + "org.eclipse.equinox.generic.host:osgi.identity; selection-filter=\"(&(version=1.0.0)(type=osgi.bundle))\","); required.append("frag.a,"); - required.append("org.eclipse.equinox.generic.frag.a:osgi.identity; selection-filter=\"(&(version=1.0.0)(type=osgi.fragment))\","); - required.append("org.eclipse.equinox.generic.frag.b:osgi.identity; selection-filter=\"(&(version=1.0.0)(type=osgi.fragment))\""); + required.append( + "org.eclipse.equinox.generic.frag.a:osgi.identity; selection-filter=\"(&(version=1.0.0)(type=osgi.fragment))\","); + required.append( + "org.eclipse.equinox.generic.frag.b:osgi.identity; selection-filter=\"(&(version=1.0.0)(type=osgi.fragment))\""); manifest.put(GENERIC_REQUIRE, required.toString()); - BundleDescription genFragB = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); + BundleDescription genFragB = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); state.addBundle(genHost); state.addBundle(genFragA); @@ -375,7 +396,8 @@ public void testGenericsAliases() throws BundleException { manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); manifest.put(Constants.EXPORT_SERVICE, "org.osgi.service.log.LogService; version=1.2"); manifest.put("TJW-Export", "my.great.stuff; aLong:long=5150; aDouble:double=3.14; aVersion:version=1.2.0"); - BundleDescription genCap = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); + BundleDescription genCap = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); manifest = new Hashtable(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); @@ -383,8 +405,10 @@ public void testGenericsAliases() throws BundleException { manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); manifest.put(Constants.IMPORT_SERVICE, "org.osgi.service.log.LogService; selection-filter=(version>=1.0.0)"); manifest.put("TJW-Import", "my.great.stuff; selection-filter=(&(aLong<=10000)(aLong>=5000))"); - manifest.put(GENERIC_REQUIRE, "genericCapability:osgi.identity; selection-filter=\"(&(version=1.0.0)(type=osgi.bundle))\""); - BundleDescription genReq = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); + manifest.put(GENERIC_REQUIRE, + "genericCapability:osgi.identity; selection-filter=\"(&(version=1.0.0)(type=osgi.bundle))\""); + BundleDescription genReq = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); state.addBundle(genCap); state.addBundle(genReq); @@ -423,7 +447,8 @@ public void testGenericsOptionalMultiple() throws BundleException { capabililty.append("test.real.multiple:thisismultiple; version=1.0,"); capabililty.append("test.real.multiple:thisismultiple; version=2.0"); manifest.put(GENERIC_CAPABILITY, capabililty.toString()); - BundleDescription genCap = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); + BundleDescription genCap = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); manifest = new Hashtable(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); @@ -433,12 +458,14 @@ public void testGenericsOptionalMultiple() throws BundleException { required.append("genericCapability:osgi.identity; selection-filter=\"(&(version=1.0.0)(type=osgi.bundle))\","); required.append("foo; selection-filter=\"(version>=1.3.0)\","); required.append("bar:bartype; selection-filter=\"(attr1=value1)\","); - required.append("test.types:testtype; selection-filter=\"(&(aVersion>=2.0.0)(aLong>=5555)(aDouble>=1.00)(aUri=file:/test)(aSet=c)(aString=someString))\","); + required.append( + "test.types:testtype; selection-filter=\"(&(aVersion>=2.0.0)(aLong>=5555)(aDouble>=1.00)(aUri=file:/test)(aSet=c)(aString=someString))\","); required.append("test.optional:thisisoptional; optional=true,"); required.append("test.real.optional:thisisoptional; optional=true,"); required.append("test.real.multiple:thisismultiple; multiple=true"); manifest.put(GENERIC_REQUIRE, required.toString()); - BundleDescription genReq = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); + BundleDescription genReq = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); state.addBundle(genCap); state.addBundle(genReq); @@ -488,7 +515,8 @@ public void testGenericsCycles() throws BundleException { StringBuilder required = new StringBuilder(); required.append("foo:cycle; selection-filter=\"(version>=1.3.0)\""); manifest.put(GENERIC_REQUIRE, required.toString()); - BundleDescription genCap = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); + BundleDescription genCap = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); manifest.put(Constants.BUNDLE_SYMBOLICNAME, "genericCapability.frag1"); @@ -497,7 +525,8 @@ public void testGenericsCycles() throws BundleException { capabililty = new StringBuilder(); capabililty.append("fragmentStuff"); manifest.put(GENERIC_CAPABILITY, capabililty.toString()); - BundleDescription genCapFrag = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); + BundleDescription genCapFrag = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); manifest = new Hashtable(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); @@ -509,10 +538,12 @@ public void testGenericsCycles() throws BundleException { required = new StringBuilder(); required.append("foo; selection-filter=\"(version>=1.3.0)\","); required.append("bar:bartype; selection-filter=\"(attr1=value1)\","); - required.append("test.types:testtype; selection-filter=\"(&(aVersion>=2.0.0)(aLong>=5555)(aDouble>=1.00)(aUri=file:/test)(aSet=c)(aString=someString))\","); + required.append( + "test.types:testtype; selection-filter=\"(&(aVersion>=2.0.0)(aLong>=5555)(aDouble>=1.00)(aUri=file:/test)(aSet=c)(aString=someString))\","); required.append("fragmentStuff"); manifest.put(GENERIC_REQUIRE, required.toString()); - BundleDescription genReq = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); + BundleDescription genReq = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); state.addBundle(genCap); state.addBundle(genCapFrag); diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/resolver/NewResolverTest.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/resolver/NewResolverTest.java index 3f2534896d9..9ba835a4ad2 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/resolver/NewResolverTest.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/resolver/NewResolverTest.java @@ -31,16 +31,14 @@ public void testSkeleton() { public void testBasicScenario1() throws BundleException { State state = buildEmptyState(); - final String MAN_A = "Bundle-SymbolicName: A\n" + - "Export-Package: servlet; specification-version=2.1"; - BundleDescription bA = state.getFactory().createBundleDescription(parseManifest(MAN_A), - "org.eclipse.basic1A", 0); + final String MAN_A = "Bundle-SymbolicName: A\n" + "Export-Package: servlet; specification-version=2.1"; + BundleDescription bA = state.getFactory().createBundleDescription(parseManifest(MAN_A), "org.eclipse.basic1A", + 0); state.addBundle(bA); - final String MAN_B = "Bundle-SymbolicName: B\n" + - "Import-Package: servlet; specification-version=2.1"; - BundleDescription bB = state.getFactory().createBundleDescription(parseManifest(MAN_B), - "org.eclipse.basic1B", 1); + final String MAN_B = "Bundle-SymbolicName: B\n" + "Import-Package: servlet; specification-version=2.1"; + BundleDescription bB = state.getFactory().createBundleDescription(parseManifest(MAN_B), "org.eclipse.basic1B", + 1); state.addBundle(bB); state.resolve(); @@ -54,5 +52,3 @@ public void testBasicScenario1() throws BundleException { assertFullyResolved("0.4", b1); } } - - diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/resolver/OSGiCapabilityTest.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/resolver/OSGiCapabilityTest.java index 112900c3508..73c52a39104 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/resolver/OSGiCapabilityTest.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/resolver/OSGiCapabilityTest.java @@ -61,46 +61,59 @@ public void testGenericsOSGiOSGi() throws BundleException { } public void testGenericsOSGiEquinox() throws BundleException { - doGenericBasicsTest("p1.osgi.MF", "p2.osgi.MF", "p3.osgi.MF", "c1.equinox.MF", "c2.equinox.MF", "c3.equinox.MF"); + doGenericBasicsTest("p1.osgi.MF", "p2.osgi.MF", "p3.osgi.MF", "c1.equinox.MF", "c2.equinox.MF", + "c3.equinox.MF"); } public void testGenericsOSGiNameEquinox() throws BundleException { - doGenericBasicsTest("p1.osgi.name.MF", "p2.osgi.name.MF", "p3.osgi.name.MF", "c1.equinox.MF", "c2.equinox.MF", "c3.equinox.MF"); + doGenericBasicsTest("p1.osgi.name.MF", "p2.osgi.name.MF", "p3.osgi.name.MF", "c1.equinox.MF", "c2.equinox.MF", + "c3.equinox.MF"); } public void testGenericsOSGiNameOSGi() throws BundleException { - doGenericBasicsTest("p1.osgi.name.MF", "p2.osgi.name.MF", "p3.osgi.name.MF", "c1.osgi.MF", "c2.osgi.MF", "c3.osgi.MF"); + doGenericBasicsTest("p1.osgi.name.MF", "p2.osgi.name.MF", "p3.osgi.name.MF", "c1.osgi.MF", "c2.osgi.MF", + "c3.osgi.MF"); } public void testGenericsOSGiNameEquinoxName() throws BundleException { - doGenericBasicsTest("p1.osgi.name.MF", "p2.osgi.name.MF", "p3.osgi.name.MF", "c1.equinox.name.MF", "c2.equinox.name.MF", "c3.equinox.name.MF"); + doGenericBasicsTest("p1.osgi.name.MF", "p2.osgi.name.MF", "p3.osgi.name.MF", "c1.equinox.name.MF", + "c2.equinox.name.MF", "c3.equinox.name.MF"); } public void testGenericsEquinoxOSGi() throws BundleException { - doGenericBasicsTest("p1.equinox.MF", "p2.equinox.MF", "p3.equinox.MF", "c1.osgi.MF", "c2.osgi.MF", "c3.osgi.MF"); + doGenericBasicsTest("p1.equinox.MF", "p2.equinox.MF", "p3.equinox.MF", "c1.osgi.MF", "c2.osgi.MF", + "c3.osgi.MF"); } public void testGenericsEquinoxEquinox() throws BundleException { - doGenericBasicsTest("p1.equinox.MF", "p2.equinox.MF", "p3.equinox.MF", "c1.equinox.MF", "c2.equinox.MF", "c3.equinox.MF"); + doGenericBasicsTest("p1.equinox.MF", "p2.equinox.MF", "p3.equinox.MF", "c1.equinox.MF", "c2.equinox.MF", + "c3.equinox.MF"); } - private void doGenericBasicsTest(String p1Manifest, String p2Manifest, String p3Manifest, String c1Manifest, String c2Manifest, String c3Manifest) throws BundleException { + private void doGenericBasicsTest(String p1Manifest, String p2Manifest, String p3Manifest, String c1Manifest, + String c2Manifest, String c3Manifest) throws BundleException { State state = buildEmptyState(); long bundleID = 0; Dictionary manifest; manifest = loadManifest(p1Manifest); - BundleDescription p1 = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); + BundleDescription p1 = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); manifest = loadManifest(p2Manifest); - BundleDescription p2 = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); + BundleDescription p2 = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); manifest = loadManifest(p3Manifest); - BundleDescription p3 = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); + BundleDescription p3 = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); manifest = loadManifest(c1Manifest); - BundleDescription c1 = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); + BundleDescription c1 = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); manifest = loadManifest(c2Manifest); - BundleDescription c2 = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); + BundleDescription c2 = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); manifest = loadManifest(c3Manifest); - BundleDescription c3 = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); + BundleDescription c3 = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); state.addBundle(p3); state.addBundle(p2); @@ -132,7 +145,7 @@ private void doGenericBasicsTest(String p1Manifest, String p2Manifest, String p3 checkForNonEffectiveRequirement(c3); } - File stateDir = getContext().getDataFile(getName()); //$NON-NLS-1$ + File stateDir = getContext().getDataFile(getName()); // $NON-NLS-1$ stateDir.mkdirs(); try { state.getFactory().writeState(state, stateDir); @@ -176,7 +189,8 @@ private void checkForNonEffectiveCapability(BundleDescription p1) { assertNotNull(nonEffectiveCaps); assertEquals("Wrong number of not.effective", 1, nonEffectiveCaps.size()); Capability c = (Capability) nonEffectiveCaps.get(0); - assertEquals("Wrong effective value", Constants.EFFECTIVE_ACTIVE, c.getDirectives().get(Constants.EFFECTIVE_DIRECTIVE)); + assertEquals("Wrong effective value", Constants.EFFECTIVE_ACTIVE, + c.getDirectives().get(Constants.EFFECTIVE_DIRECTIVE)); } private void checkForNonEffectiveRequirement(BundleDescription c1) { @@ -184,22 +198,28 @@ private void checkForNonEffectiveRequirement(BundleDescription c1) { assertNotNull(nonEffectiveReqs); assertEquals("Wrong number of not.effective", 1, nonEffectiveReqs.size()); Requirement r = (Requirement) nonEffectiveReqs.get(0); - assertEquals("Wrong effective value", Constants.EFFECTIVE_ACTIVE, r.getDirectives().get(Constants.EFFECTIVE_DIRECTIVE)); + assertEquals("Wrong effective value", Constants.EFFECTIVE_ACTIVE, + r.getDirectives().get(Constants.EFFECTIVE_DIRECTIVE)); } - private void checkGenericBasics(int expectedCnt, GenericDescription[] genRequired, GenericDescription[] genProvided) { + private void checkGenericBasics(int expectedCnt, GenericDescription[] genRequired, + GenericDescription[] genProvided) { checkGenericBasics(expectedCnt, genRequired, genProvided, null); } - private void checkGenericBasics(int expectedCnt, GenericDescription[] genRequired, GenericDescription[] genProvided, GenericDescription fragIdentity) { + private void checkGenericBasics(int expectedCnt, GenericDescription[] genRequired, GenericDescription[] genProvided, + GenericDescription fragIdentity) { assertEquals("Expected number of capabilities do not match", expectedCnt, genRequired.length); - assertEquals("Specs do not match Descs", genRequired.length, genProvided.length + (fragIdentity == null ? 0 : 1)); + assertEquals("Specs do not match Descs", genRequired.length, + genProvided.length + (fragIdentity == null ? 0 : 1)); Collection providedCollection = new ArrayList(Arrays.asList(genProvided)); for (GenericDescription requiredDescription : genRequired) { - if (IdentityNamespace.IDENTITY_NAMESPACE.equals(requiredDescription.getType()) && requiredDescription.getSupplier().getHost() != null) { + if (IdentityNamespace.IDENTITY_NAMESPACE.equals(requiredDescription.getType()) + && requiredDescription.getSupplier().getHost() != null) { assertEquals("Wrong fragment provider: " + requiredDescription, fragIdentity, requiredDescription); } else { - assertTrue("Wrong provider for requirement: " + requiredDescription, providedCollection.remove(requiredDescription)); + assertTrue("Wrong provider for requirement: " + requiredDescription, + providedCollection.remove(requiredDescription)); } } } @@ -210,15 +230,20 @@ public void testGenericFragments01() throws BundleException { Dictionary manifest; manifest = loadManifest("p1.osgi.MF"); - BundleDescription p1 = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); + BundleDescription p1 = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); manifest = loadManifest("p1.osgi.frag.MF"); - BundleDescription p1Frag = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); + BundleDescription p1Frag = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); manifest = loadManifest("c1.osgi.MF"); - BundleDescription c1 = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); + BundleDescription c1 = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); manifest = loadManifest("c1.osgi.frag.MF"); - BundleDescription c1Frag = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); + BundleDescription c1Frag = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); manifest = loadManifest("p4.osgi.MF"); - BundleDescription p4 = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); + BundleDescription p4 = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); state.addBundle(p1); state.addBundle(p1Frag); @@ -233,9 +258,10 @@ public void testGenericFragments01() throws BundleException { assertTrue("c1Frag", c1Frag.isResolved()); assertTrue("p4", p4.isResolved()); - checkGenericBasics(6, c1.getResolvedGenericRequires(), p1.getSelectedGenericCapabilities(), p1Frag.getSelectedGenericCapabilities()[0]); + checkGenericBasics(6, c1.getResolvedGenericRequires(), p1.getSelectedGenericCapabilities(), + p1Frag.getSelectedGenericCapabilities()[0]); - File stateDir = getContext().getDataFile(getName()); //$NON-NLS-1$ + File stateDir = getContext().getDataFile(getName()); // $NON-NLS-1$ stateDir.mkdirs(); try { state.getFactory().writeState(state, stateDir); @@ -255,10 +281,11 @@ public void testGenericFragments01() throws BundleException { assertTrue("c1Frag", c1Frag.isResolved()); assertTrue("p4", p4.isResolved()); - checkGenericBasics(6, c1.getResolvedGenericRequires(), p1.getSelectedGenericCapabilities(), p1Frag.getSelectedGenericCapabilities()[0]); + checkGenericBasics(6, c1.getResolvedGenericRequires(), p1.getSelectedGenericCapabilities(), + p1Frag.getSelectedGenericCapabilities()[0]); state.setResolver(platformAdminService.createResolver()); - state.resolve(new BundleDescription[] {p1}); + state.resolve(new BundleDescription[] { p1 }); assertTrue("p1", p1.isResolved()); assertTrue("p1Frag", p1Frag.isResolved()); @@ -266,7 +293,8 @@ public void testGenericFragments01() throws BundleException { assertTrue("c1Frag", c1Frag.isResolved()); assertTrue("p4", p4.isResolved()); - checkGenericBasics(6, c1.getResolvedGenericRequires(), p1.getSelectedGenericCapabilities(), p1Frag.getSelectedGenericCapabilities()[0]); + checkGenericBasics(6, c1.getResolvedGenericRequires(), p1.getSelectedGenericCapabilities(), + p1Frag.getSelectedGenericCapabilities()[0]); } public void testGenericFragments02() throws BundleException { @@ -275,13 +303,17 @@ public void testGenericFragments02() throws BundleException { Dictionary manifest; manifest = loadManifest("p1.osgi.MF"); - BundleDescription p1 = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); + BundleDescription p1 = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); manifest = loadManifest("p1.osgi.frag.MF"); - BundleDescription p1Frag = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); + BundleDescription p1Frag = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); manifest = loadManifest("c1.osgi.MF"); - BundleDescription c1 = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); + BundleDescription c1 = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); manifest = loadManifest("c1.osgi.frag.MF"); - BundleDescription c1Frag = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); + BundleDescription c1Frag = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); state.addBundle(p1); state.addBundle(p1Frag); @@ -296,7 +328,7 @@ public void testGenericFragments02() throws BundleException { checkGenericBasics(4, c1.getResolvedGenericRequires(), p1.getSelectedGenericCapabilities()); - File stateDir = getContext().getDataFile(getName() + 1); //$NON-NLS-1$ + File stateDir = getContext().getDataFile(getName() + 1); // $NON-NLS-1$ stateDir.mkdirs(); try { state.getFactory().writeState(state, stateDir); @@ -317,20 +349,22 @@ public void testGenericFragments02() throws BundleException { checkGenericBasics(4, c1.getResolvedGenericRequires(), p1.getSelectedGenericCapabilities()); manifest = loadManifest("p4.osgi.MF"); - BundleDescription p4 = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); + BundleDescription p4 = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); state.addBundle(p4); // have to force host to re-resolve because we are adding new constraints - state.resolve(new BundleDescription[] {p1}); + state.resolve(new BundleDescription[] { p1 }); assertTrue("p1", p1.isResolved()); assertTrue("p1Frag", p1Frag.isResolved()); assertTrue("c1", c1.isResolved()); assertTrue("c1Frag", c1Frag.isResolved()); assertTrue("p4", p4.isResolved()); - checkGenericBasics(6, c1.getResolvedGenericRequires(), p1.getSelectedGenericCapabilities(), p1Frag.getSelectedGenericCapabilities()[0]); + checkGenericBasics(6, c1.getResolvedGenericRequires(), p1.getSelectedGenericCapabilities(), + p1Frag.getSelectedGenericCapabilities()[0]); - stateDir = getContext().getDataFile(getName() + 2); //$NON-NLS-1$ + stateDir = getContext().getDataFile(getName() + 2); // $NON-NLS-1$ stateDir.mkdirs(); try { state.getFactory().writeState(state, stateDir); @@ -349,7 +383,8 @@ public void testGenericFragments02() throws BundleException { assertTrue("c1Frag", c1Frag.isResolved()); assertTrue("p4", p4.isResolved()); - checkGenericBasics(6, c1.getResolvedGenericRequires(), p1.getSelectedGenericCapabilities(), p1Frag.getSelectedGenericCapabilities()[0]); + checkGenericBasics(6, c1.getResolvedGenericRequires(), p1.getSelectedGenericCapabilities(), + p1Frag.getSelectedGenericCapabilities()[0]); } public void testGenericUses() throws BundleException { @@ -358,25 +393,35 @@ public void testGenericUses() throws BundleException { Dictionary manifest; manifest = loadManifest("p5.v100.osgi.MF"); - BundleDescription p5v100 = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); + BundleDescription p5v100 = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); manifest = loadManifest("p5.v110.osgi.MF"); - BundleDescription p5v110 = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); + BundleDescription p5v110 = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); manifest = loadManifest("p6.v100.osgi.MF"); - BundleDescription p6v100 = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); + BundleDescription p6v100 = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); manifest = loadManifest("p6.v110.osgi.MF"); - BundleDescription p6v110 = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); + BundleDescription p6v110 = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); manifest = loadManifest("p7.v100.osgi.MF"); - BundleDescription p7v100 = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); + BundleDescription p7v100 = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); manifest = loadManifest("p7.v110.osgi.MF"); - BundleDescription p7v110 = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); + BundleDescription p7v110 = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); manifest = loadManifest("c4.v100.osgi.MF"); - BundleDescription c4v100 = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); + BundleDescription c4v100 = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); manifest = loadManifest("c4.v110.osgi.MF"); - BundleDescription c4v110 = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); + BundleDescription c4v110 = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); manifest = loadManifest("c4.v120.osgi.MF"); - BundleDescription c4v120 = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); + BundleDescription c4v120 = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); manifest = loadManifest("c4.v130.osgi.MF"); - BundleDescription c4v130 = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); + BundleDescription c4v130 = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); state.addBundle(p5v100); state.addBundle(p5v110); @@ -408,13 +453,14 @@ public void testGenericUses() throws BundleException { GenericDescription[] p5v100Capability = p5v100.getSelectedGenericCapabilities(); ExportPackageDescription[] p6v100Exports = p6v100.getSelectedExports(); ExportPackageDescription[] p7v100Exports = p7v100.getSelectedExports(); - ExportPackageDescription[] expectedPackages = new ExportPackageDescription[] {p6v100Exports[0], p7v100Exports[0]}; + ExportPackageDescription[] expectedPackages = new ExportPackageDescription[] { p6v100Exports[0], + p7v100Exports[0] }; checkUsedImports(c4v100, expectedPackages); checkUsedImports(c4v110, expectedPackages); checkUsedImports(c4v120, expectedPackages); - BundleDescription[] expectedRequired = new BundleDescription[] {p6v100, p7v100}; + BundleDescription[] expectedRequired = new BundleDescription[] { p6v100, p7v100 }; checkUsedRequires(c4v130, expectedRequired); checkUsedCapability(c4v100, p5v100Capability); @@ -429,29 +475,41 @@ public void testOSGiCardinalityUses() throws BundleException { Dictionary manifest; manifest = loadManifest("p5.v100.osgi.MF"); - BundleDescription p5v100 = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); + BundleDescription p5v100 = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); manifest = loadManifest("p5.v101.osgi.MF"); - BundleDescription p5v101 = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); + BundleDescription p5v101 = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); manifest = loadManifest("p5.v110.osgi.MF"); - BundleDescription p5v110 = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); + BundleDescription p5v110 = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); manifest = loadManifest("p6.v100.osgi.MF"); - BundleDescription p6v100 = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); + BundleDescription p6v100 = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); manifest = loadManifest("p6.v110.osgi.MF"); - BundleDescription p6v110 = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); + BundleDescription p6v110 = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); manifest = loadManifest("p7.v100.osgi.MF"); - BundleDescription p7v100 = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); + BundleDescription p7v100 = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); manifest = loadManifest("p7.v110.osgi.MF"); - BundleDescription p7v110 = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); + BundleDescription p7v110 = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); manifest = loadManifest("c6.v100.osgi.MF"); - BundleDescription c6v100 = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); + BundleDescription c6v100 = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); manifest = loadManifest("c6.v110.osgi.MF"); - BundleDescription c6v110 = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); + BundleDescription c6v110 = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); manifest = loadManifest("c6.v120.osgi.MF"); - BundleDescription c6v120 = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); + BundleDescription c6v120 = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); manifest = loadManifest("c6.v130.osgi.MF"); - BundleDescription c6v130 = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); + BundleDescription c6v130 = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); manifest = loadManifest("c6.v140.osgi.MF"); - BundleDescription c6v140 = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); + BundleDescription c6v140 = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); state.addBundle(p5v100); state.addBundle(p5v101); @@ -497,17 +555,19 @@ public void testOSGiCardinalityUses() throws BundleException { ExportPackageDescription[] p6v100Exports = p6v100.getSelectedExports(); ExportPackageDescription[] p7v100Exports = p7v100.getSelectedExports(); - ExportPackageDescription[] expectedPackages = new ExportPackageDescription[] {p6v100Exports[0], p7v100Exports[0]}; + ExportPackageDescription[] expectedPackages = new ExportPackageDescription[] { p6v100Exports[0], + p7v100Exports[0] }; checkUsedImports(c6v100, expectedPackages); checkUsedImports(c6v110, expectedPackages); checkUsedImports(c6v120, expectedPackages); - BundleDescription[] expectedRequired = new BundleDescription[] {p6v100, p7v100}; + BundleDescription[] expectedRequired = new BundleDescription[] { p6v100, p7v100 }; checkUsedRequires(c6v130, expectedRequired); checkUsedRequires(c6v140, expectedRequired); - GenericDescription[] expectedCapabilities = (GenericDescription[]) expectedCapabilityList.toArray(new GenericDescription[expectedCapabilityList.size()]); + GenericDescription[] expectedCapabilities = (GenericDescription[]) expectedCapabilityList + .toArray(new GenericDescription[expectedCapabilityList.size()]); checkUsedCapability(c6v100, expectedCapabilities); checkUsedCapability(c6v110, expectedCapabilities); checkUsedCapability(c6v120, expectedCapabilities); @@ -515,9 +575,11 @@ public void testOSGiCardinalityUses() throws BundleException { checkUsedCapability(c6v140, expectedCapabilities); manifest = loadManifest("c6.v150.osgi.MF"); - BundleDescription c6v150 = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); + BundleDescription c6v150 = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); manifest = loadManifest("c6.v160.osgi.MF"); - BundleDescription c6v160 = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); + BundleDescription c6v160 = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); state.addBundle(c6v150); state.addBundle(c6v160); @@ -539,7 +601,8 @@ public void testDeclaringIdentityCapability() { manifest.put(GenericCapabilityTest.GENERIC_CAPABILITY, capabililty.toString()); try { - state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); + state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); fail("Expected failure to create description that specifies osgi.identity capability"); } catch (BundleException e) { // expected @@ -548,7 +611,8 @@ public void testDeclaringIdentityCapability() { manifest.remove(GenericCapabilityTest.GENERIC_CAPABILITY); manifest.put(Constants.PROVIDE_CAPABILITY, "osgi.identity; osgi.identity=testFailure; test=failure"); try { - state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); + state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); fail("Expected failure to create description that specifies osgi.identity capability"); } catch (BundleException e) { // expected @@ -561,13 +625,17 @@ public void testOSGiCardinality() throws BundleException { Dictionary manifest; manifest = loadManifest("p1.osgi.MF"); - BundleDescription p1 = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); + BundleDescription p1 = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); manifest = loadManifest("p2.osgi.MF"); - BundleDescription p2 = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); + BundleDescription p2 = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); manifest = loadManifest("p3.osgi.MF"); - BundleDescription p3 = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); + BundleDescription p3 = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); manifest = loadManifest("c5.osgi.MF"); - BundleDescription c5 = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); + BundleDescription c5 = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); state.addBundle(p1); state.addBundle(p2); @@ -613,10 +681,12 @@ private void checkUsedRequires(BundleDescription requirer, BundleDescription[] e private void checkUsedCapability(BundleDescription requirer, GenericDescription[] expectedCapabilities) { GenericDescription[] required = requirer.getResolvedGenericRequires(); - assertEquals("Wrong number of capabilities for bundle: " + requirer, expectedCapabilities.length, required.length); + assertEquals("Wrong number of capabilities for bundle: " + requirer, expectedCapabilities.length, + required.length); Collection providedCollection = new ArrayList(Arrays.asList(expectedCapabilities)); for (GenericDescription requiredDescription : required) { - assertTrue("Wrong provider for requirement: " + requiredDescription, providedCollection.remove(requiredDescription)); + assertTrue("Wrong provider for requirement: " + requiredDescription, + providedCollection.remove(requiredDescription)); } } } diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/resolver/PlatformAdminTest.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/resolver/PlatformAdminTest.java index 54cc0902f94..8086cc7d588 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/resolver/PlatformAdminTest.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/resolver/PlatformAdminTest.java @@ -69,8 +69,11 @@ public void testBug205270() throws BundleException { manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); manifest.put(Constants.BUNDLE_SYMBOLICNAME, "a"); manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); - manifest.put(Constants.BUNDLE_NATIVECODE, "libwrapper-linux-x86-32.so; wrapper-linux-x86-32; osname=linux; processor=x86"); - BundleDescription a = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + manifest.get(Constants.BUNDLE_VERSION), id++); + manifest.put(Constants.BUNDLE_NATIVECODE, + "libwrapper-linux-x86-32.so; wrapper-linux-x86-32; osname=linux; processor=x86"); + BundleDescription a = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + manifest.get(Constants.BUNDLE_VERSION), + id++); try { BundleDescription aPrime = state.getFactory().createBundleDescription(a); assertEquals("Copy is not equal", a, aPrime); @@ -93,7 +96,9 @@ public void testBug184127() throws BundleException { manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); manifest.put(Constants.BUNDLE_SYMBOLICNAME, "a"); manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); - BundleDescription a = systemState.getFactory().createBundleDescription(systemState, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + manifest.get(Constants.BUNDLE_VERSION), id++); + BundleDescription a = systemState.getFactory().createBundleDescription(systemState, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + manifest.get(Constants.BUNDLE_VERSION), + id++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); @@ -102,7 +107,9 @@ public void testBug184127() throws BundleException { manifest.put(Constants.EXPORT_PACKAGE, "b, c"); manifest.put(Constants.REQUIRE_BUNDLE, "a"); manifest.put(Constants.IMPORT_PACKAGE, "afrag2"); - BundleDescription b = systemState.getFactory().createBundleDescription(systemState, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + manifest.get(Constants.BUNDLE_VERSION), id++); + BundleDescription b = systemState.getFactory().createBundleDescription(systemState, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + manifest.get(Constants.BUNDLE_VERSION), + id++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); @@ -111,7 +118,9 @@ public void testBug184127() throws BundleException { manifest.put(Constants.EXPORT_PACKAGE, "afrag2"); manifest.put(Constants.FRAGMENT_HOST, "a"); manifest.put(Constants.IMPORT_PACKAGE, "c"); - BundleDescription afrag2 = systemState.getFactory().createBundleDescription(systemState, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + manifest.get(Constants.BUNDLE_VERSION), id++); + BundleDescription afrag2 = systemState.getFactory().createBundleDescription(systemState, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + manifest.get(Constants.BUNDLE_VERSION), + id++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); @@ -119,7 +128,9 @@ public void testBug184127() throws BundleException { manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); manifest.put(Constants.FRAGMENT_HOST, "a"); manifest.put(Constants.IMPORT_PACKAGE, "b"); - BundleDescription afrag1 = systemState.getFactory().createBundleDescription(systemState, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + manifest.get(Constants.BUNDLE_VERSION), id++); + BundleDescription afrag1 = systemState.getFactory().createBundleDescription(systemState, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + manifest.get(Constants.BUNDLE_VERSION), + id++); systemState.addBundle(afrag1); systemState.addBundle(afrag2); @@ -161,14 +172,18 @@ public void testBug241128_01() throws BundleException { manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); manifest.put(Constants.BUNDLE_SYMBOLICNAME, "a"); manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); - BundleDescription a1 = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + manifest.get(Constants.BUNDLE_VERSION), id++); + BundleDescription a1 = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + manifest.get(Constants.BUNDLE_VERSION), + id++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); manifest.put(Constants.BUNDLE_SYMBOLICNAME, "b"); manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); manifest.put(Constants.REQUIRE_BUNDLE, "a; bundle-version=\"[1.0.0, 2.0.0)\""); - BundleDescription b = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + manifest.get(Constants.BUNDLE_VERSION), id++); + BundleDescription b = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + manifest.get(Constants.BUNDLE_VERSION), + id++); state.addBundle(a1); state.addBundle(b); @@ -181,7 +196,9 @@ public void testBug241128_01() throws BundleException { manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); manifest.put(Constants.BUNDLE_SYMBOLICNAME, "a"); manifest.put(Constants.BUNDLE_VERSION, "2.0.0"); - BundleDescription a2 = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + manifest.get(Constants.BUNDLE_VERSION), a1.getBundleId()); + BundleDescription a2 = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + manifest.get(Constants.BUNDLE_VERSION), + a1.getBundleId()); state.updateBundle(a2); state.resolve(true); @@ -202,14 +219,18 @@ public void testBug241128_02() throws BundleException { manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); manifest.put(Constants.BUNDLE_SYMBOLICNAME, "a"); manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); - BundleDescription a1 = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + manifest.get(Constants.BUNDLE_VERSION), id++); + BundleDescription a1 = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + manifest.get(Constants.BUNDLE_VERSION), + id++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); manifest.put(Constants.BUNDLE_SYMBOLICNAME, "b"); manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); manifest.put(Constants.FRAGMENT_HOST, "a; bundle-version=\"[1.0.0, 2.0.0)\""); - BundleDescription b = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + manifest.get(Constants.BUNDLE_VERSION), id++); + BundleDescription b = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + manifest.get(Constants.BUNDLE_VERSION), + id++); state.addBundle(a1); state.addBundle(b); @@ -222,7 +243,9 @@ public void testBug241128_02() throws BundleException { manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); manifest.put(Constants.BUNDLE_SYMBOLICNAME, "a"); manifest.put(Constants.BUNDLE_VERSION, "2.0.0"); - BundleDescription a2 = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + manifest.get(Constants.BUNDLE_VERSION), a1.getBundleId()); + BundleDescription a2 = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + manifest.get(Constants.BUNDLE_VERSION), + a1.getBundleId()); state.updateBundle(a2); state.resolve(true); @@ -244,14 +267,18 @@ public void testBug241128_03() throws BundleException { manifest.put(Constants.BUNDLE_SYMBOLICNAME, "a"); manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); manifest.put(Constants.EXPORT_PACKAGE, "a; version=1.0"); - BundleDescription a1 = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + manifest.get(Constants.BUNDLE_VERSION), id++); + BundleDescription a1 = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + manifest.get(Constants.BUNDLE_VERSION), + id++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); manifest.put(Constants.BUNDLE_SYMBOLICNAME, "b"); manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); manifest.put(Constants.IMPORT_PACKAGE, "a; version=\"[1.0.0, 2.0.0)\""); - BundleDescription b = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + manifest.get(Constants.BUNDLE_VERSION), id++); + BundleDescription b = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + manifest.get(Constants.BUNDLE_VERSION), + id++); state.addBundle(a1); state.addBundle(b); @@ -265,7 +292,9 @@ public void testBug241128_03() throws BundleException { manifest.put(Constants.BUNDLE_SYMBOLICNAME, "a"); manifest.put(Constants.BUNDLE_VERSION, "2.0.0"); manifest.put(Constants.EXPORT_PACKAGE, "a; version=2.0"); - BundleDescription a2 = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + manifest.get(Constants.BUNDLE_VERSION), a1.getBundleId()); + BundleDescription a2 = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + manifest.get(Constants.BUNDLE_VERSION), + a1.getBundleId()); state.updateBundle(a2); state.resolve(true); @@ -279,7 +308,7 @@ public void testBug241128_03() throws BundleException { public void testBug241128_04() throws BundleException { State state = buildEmptyState(); - Dictionary[] props = new Dictionary[] {new Hashtable()}; + Dictionary[] props = new Dictionary[] { new Hashtable() }; props[0].put("osgi.os", "win32"); props[0].put("osgi.arch", "x86"); state.setPlatformProperties(props); @@ -292,7 +321,9 @@ public void testBug241128_04() throws BundleException { manifest.put(Constants.BUNDLE_SYMBOLICNAME, "a"); manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); manifest.put(Constants.BUNDLE_NATIVECODE, "Bundle-NativeCode: nativefile1.txt;processor=x86;osname=win32"); - BundleDescription a1 = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + manifest.get(Constants.BUNDLE_VERSION), id++); + BundleDescription a1 = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + manifest.get(Constants.BUNDLE_VERSION), + id++); state.addBundle(a1); state.resolve(true); @@ -304,7 +335,9 @@ public void testBug241128_04() throws BundleException { manifest.put(Constants.BUNDLE_SYMBOLICNAME, "a"); manifest.put(Constants.BUNDLE_VERSION, "2.0.0"); manifest.put(Constants.BUNDLE_NATIVECODE, "Bundle-NativeCode: nativefile1.txt;processor=linux;osname=gtk"); - BundleDescription a2 = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + manifest.get(Constants.BUNDLE_VERSION), a1.getBundleId()); + BundleDescription a2 = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + manifest.get(Constants.BUNDLE_VERSION), + a1.getBundleId()); state.updateBundle(a2); state.resolve(true); @@ -329,14 +362,16 @@ public void testGenericsBasics() throws BundleException { manifest.put(Constants.BUNDLE_SYMBOLICNAME, "genericCapablity"); manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); manifest.put(GENERIC_CAPABILITY, "foo; version=\"1.3.1\"; attr1=\"value1\"; attr2=\"value2\""); - BundleDescription genCap1 = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); + BundleDescription genCap1 = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); manifest.put(Constants.BUNDLE_SYMBOLICNAME, "genericRequire"); manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); manifest.put(GENERIC_REQUIRE, "foo; selection-filter=\"(version>=1.3.0)\""); - BundleDescription genReq = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); + BundleDescription genReq = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); state.addBundle(genCap1); state.addBundle(genReq); @@ -351,7 +386,8 @@ public void testGenericsBasics() throws BundleException { manifest.put(Constants.BUNDLE_SYMBOLICNAME, "genericCapablity"); manifest.put(Constants.BUNDLE_VERSION, "2.0.0"); manifest.put(GENERIC_CAPABILITY, "foo; version=\"1.0\"; attr1=\"value1\"; attr2=\"value2\""); - BundleDescription genCap2 = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), genCap1.getBundleId()); + BundleDescription genCap2 = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), genCap1.getBundleId()); state.updateBundle(genCap2); diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/resolver/StateComparisonTest.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/resolver/StateComparisonTest.java index a1d413976f4..8f1e8906162 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/resolver/StateComparisonTest.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/resolver/StateComparisonTest.java @@ -33,7 +33,8 @@ public void testAddition() throws BundleException { delta = state2.compare(state1); assertEquals("1.1", 0, delta.getChanges().length); String A_MANIFEST = "Bundle-SymbolicName: org.eclipse.a\nBundle-Version: 1.0\n"; - BundleDescription bundleA = state2.getFactory().createBundleDescription(parseManifest(A_MANIFEST), "org.eclipse.a", -1); + BundleDescription bundleA = state2.getFactory().createBundleDescription(parseManifest(A_MANIFEST), + "org.eclipse.a", -1); assertTrue("2.0", state2.addBundle(bundleA)); delta = state1.compare(state2); assertEquals("2.1", 1, delta.getChanges().length); @@ -78,7 +79,8 @@ public void testUpdate() throws BundleException { assertEquals("1.1", 0, delta.getChanges().length); assertNotNull("1.9", state1.getBundleByLocation("org.eclipse.b1")); String A_MANIFEST = "Bundle-SymbolicName: org.eclipse.b1\nBundle-Version: 2.0\n"; - BundleDescription bundle1 = state1.getFactory().createBundleDescription(parseManifest(A_MANIFEST), "org.eclipse.b1", 1); + BundleDescription bundle1 = state1.getFactory().createBundleDescription(parseManifest(A_MANIFEST), + "org.eclipse.b1", 1); assertTrue("2.0", state1.updateBundle(bundle1)); delta = state1.compare(state2); assertEquals("2.1", 1, delta.getChanges().length); diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/resolver/StateCycleTest.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/resolver/StateCycleTest.java index c366d1de343..0856d627286 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/resolver/StateCycleTest.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/resolver/StateCycleTest.java @@ -164,7 +164,8 @@ public void testCycle4() throws BundleException { } public void test185285() throws BundleException { - // if two versions of the same bundle export and import two different packages at the same version + // if two versions of the same bundle export and import two different packages + // at the same version // then we should resolve both sets of imports to the first bundle installed. State state = buildEmptyState(); Hashtable manifest = new Hashtable(); @@ -174,7 +175,8 @@ public void test185285() throws BundleException { manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); manifest.put(Constants.EXPORT_PACKAGE, "foo; version=\"1.0.0\", bar; version=\"1.0.0\""); manifest.put(Constants.IMPORT_PACKAGE, "foo, bar"); - BundleDescription a_100 = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); + BundleDescription a_100 = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); manifest = new Hashtable(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); @@ -182,7 +184,8 @@ public void test185285() throws BundleException { manifest.put(Constants.BUNDLE_VERSION, "1.0.1"); manifest.put(Constants.EXPORT_PACKAGE, "foo; version=\"1.0.0\", bar; version=\"1.0.0\""); manifest.put(Constants.IMPORT_PACKAGE, "foo, bar"); - BundleDescription a_101 = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); + BundleDescription a_101 = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); state.addBundle(a_100); state.addBundle(a_101); diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/resolver/StateResolverTest.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/resolver/StateResolverTest.java index 0a4e1a364b0..6909e04114e 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/resolver/StateResolverTest.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/resolver/StateResolverTest.java @@ -58,9 +58,9 @@ public StateResolverTest(String name) { } /** - * Tests adding 3 new bundles to an already resolved state and then - * resolving only one of the bundles. The result should be all 3 added - * bundles being resolved. + * Tests adding 3 new bundles to an already resolved state and then resolving + * only one of the bundles. The result should be all 3 added bundles being + * resolved. * */ public void testAdd3Resolve1() throws BundleException { @@ -109,7 +109,7 @@ public void testAdd3Resolve1() throws BundleException { } catch (BundleException e) { fail("Failed to create BundleDescription: " + e.getMessage()); //$NON-NLS-1$ } - delta = state.resolve(new BundleDescription[] {state.getBundle(1)}); + delta = state.resolve(new BundleDescription[] { state.getBundle(1) }); deltas = delta.getChanges(); assertEquals("1.0", 3, deltas.length); //$NON-NLS-1$ Map deltasMap = new HashMap(); @@ -119,9 +119,12 @@ public void testAdd3Resolve1() throws BundleException { assertNotNull("1.1", deltasMap.get(Long.valueOf(1))); //$NON-NLS-1$ assertNotNull("1.2", deltasMap.get(Long.valueOf(2))); //$NON-NLS-1$ assertNotNull("1.3", deltasMap.get(Long.valueOf(3))); //$NON-NLS-1$ - assertEquals("2.1", (BundleDelta.RESOLVED | BundleDelta.ADDED), ((BundleDelta) deltasMap.get(Long.valueOf(1))).getType()); //$NON-NLS-1$ - assertEquals("2.2", (BundleDelta.RESOLVED | BundleDelta.ADDED), ((BundleDelta) deltasMap.get(Long.valueOf(2))).getType()); //$NON-NLS-1$ - assertEquals("2.3", (BundleDelta.RESOLVED | BundleDelta.ADDED), ((BundleDelta) deltasMap.get(Long.valueOf(3))).getType()); //$NON-NLS-1$ + assertEquals("2.1", (BundleDelta.RESOLVED | BundleDelta.ADDED), //$NON-NLS-1$ + ((BundleDelta) deltasMap.get(Long.valueOf(1))).getType()); + assertEquals("2.2", (BundleDelta.RESOLVED | BundleDelta.ADDED), //$NON-NLS-1$ + ((BundleDelta) deltasMap.get(Long.valueOf(2))).getType()); + assertEquals("2.3", (BundleDelta.RESOLVED | BundleDelta.ADDED), //$NON-NLS-1$ + ((BundleDelta) deltasMap.get(Long.valueOf(3))).getType()); } public void testBasicResolution() throws BundleException { @@ -145,10 +148,12 @@ public void testBasicResolution() throws BundleException { } assertNotNull("3.1", deltasMap.get(b1.getSymbolicName())); //$NON-NLS-1$ assertNotNull("3.2", deltasMap.get(b2.getSymbolicName())); //$NON-NLS-1$ - // TODO why do we expect unresolved deltas here when the bundle was not resolved in the first place? - //BundleDelta[] unresolutions = delta.getChanges(BundleDelta.UNRESOLVED, false); - //assertEquals("4.0", 1, unresolutions.length); - //assertEquals("4.1", unresolutions[0].getBundle(), b3); + // TODO why do we expect unresolved deltas here when the bundle was not resolved + // in the first place? + // BundleDelta[] unresolutions = delta.getChanges(BundleDelta.UNRESOLVED, + // false); + // assertEquals("4.0", 1, unresolutions.length); + // assertEquals("4.1", unresolutions[0].getBundle(), b3); assertFullyResolved("5.1", b1); //$NON-NLS-1$ assertFullyResolved("5.2", b2); //$NON-NLS-1$ assertFullyUnresolved("5.3", b3); //$NON-NLS-1$ @@ -199,10 +204,10 @@ public void testDependentBundles() throws BundleException { State state = buildComplexState(); state.resolve(); BundleDescription[] dependent; - dependent = state.getStateHelper().getDependentBundles(new BundleDescription[] {state.getBundle(2)}); + dependent = state.getStateHelper().getDependentBundles(new BundleDescription[] { state.getBundle(2) }); assertEquals("1.0", 1, dependent.length); //$NON-NLS-1$ assertEquals("1.1", state.getBundle(2), dependent[0]); //$NON-NLS-1$ - dependent = state.getStateHelper().getDependentBundles(new BundleDescription[] {state.getBundle(1)}); + dependent = state.getStateHelper().getDependentBundles(new BundleDescription[] { state.getBundle(1) }); assertEquals("2.0", 4, dependent.length); //$NON-NLS-1$ assertContains("2.1", dependent, state.getBundle(1)); //$NON-NLS-1$ assertContains("2.2", dependent, state.getBundle(2)); //$NON-NLS-1$ @@ -216,28 +221,28 @@ public void testPrerequisiteBundle() throws BundleException { BundleDescription[] prereqs; prereqs = state.getStateHelper().getPrerequisites(state.getResolvedBundles()); assertEquals("1.0", 6, prereqs.length); //$NON-NLS-1$ - prereqs = state.getStateHelper().getPrerequisites(new BundleDescription[] {state.getBundle(1)}); + prereqs = state.getStateHelper().getPrerequisites(new BundleDescription[] { state.getBundle(1) }); assertEquals("2.0", 2, prereqs.length); //$NON-NLS-1$ assertContains("2.1", prereqs, state.getBundle(1)); //$NON-NLS-1$ assertContains("2.2", prereqs, state.getBundle(3)); //$NON-NLS-1$ - prereqs = state.getStateHelper().getPrerequisites(new BundleDescription[] {state.getBundle(2)}); + prereqs = state.getStateHelper().getPrerequisites(new BundleDescription[] { state.getBundle(2) }); assertEquals("3.0", 3, prereqs.length); //$NON-NLS-1$ assertContains("3.1", prereqs, state.getBundle(1)); //$NON-NLS-1$ assertContains("3.2", prereqs, state.getBundle(2)); //$NON-NLS-1$ assertContains("3.3", prereqs, state.getBundle(3)); //$NON-NLS-1$ - prereqs = state.getStateHelper().getPrerequisites(new BundleDescription[] {state.getBundle(3)}); + prereqs = state.getStateHelper().getPrerequisites(new BundleDescription[] { state.getBundle(3) }); assertEquals("4.0", 1, prereqs.length); //$NON-NLS-1$ assertContains("4.1", prereqs, state.getBundle(3)); //$NON-NLS-1$ - prereqs = state.getStateHelper().getPrerequisites(new BundleDescription[] {state.getBundle(4)}); + prereqs = state.getStateHelper().getPrerequisites(new BundleDescription[] { state.getBundle(4) }); assertEquals("5.0", 3, prereqs.length); //$NON-NLS-1$ assertContains("5.1", prereqs, state.getBundle(1)); //$NON-NLS-1$ assertContains("5.2", prereqs, state.getBundle(3)); //$NON-NLS-1$ assertContains("5.3", prereqs, state.getBundle(4)); //$NON-NLS-1$ - prereqs = state.getStateHelper().getPrerequisites(new BundleDescription[] {state.getBundle(5)}); + prereqs = state.getStateHelper().getPrerequisites(new BundleDescription[] { state.getBundle(5) }); assertEquals("6.0", 2, prereqs.length); //$NON-NLS-1$ assertContains("6.1", prereqs, state.getBundle(3)); //$NON-NLS-1$ assertContains("6.2", prereqs, state.getBundle(5)); //$NON-NLS-1$ - prereqs = state.getStateHelper().getPrerequisites(new BundleDescription[] {state.getBundle(6)}); + prereqs = state.getStateHelper().getPrerequisites(new BundleDescription[] { state.getBundle(6) }); assertEquals("6.0", 4, prereqs.length); //$NON-NLS-1$ assertContains("6.1", prereqs, state.getBundle(1)); //$NON-NLS-1$ assertContains("6.2", prereqs, state.getBundle(3)); //$NON-NLS-1$ @@ -251,15 +256,20 @@ public void testLinkageChange() throws BundleException { // don't add b1 for now String B1_LOCATION = "org.eclipse.b1"; //$NON-NLS-1$ final String B1_MANIFEST = "Bundle-SymbolicName: org.eclipse.b1\n" + "Bundle-Version: 1.0\n"; //$NON-NLS-1$ //$NON-NLS-2$ - BundleDescription b1 = state.getFactory().createBundleDescription(parseManifest(B1_MANIFEST), B1_LOCATION, (long) (Math.random() * Long.MAX_VALUE)); + BundleDescription b1 = state.getFactory().createBundleDescription(parseManifest(B1_MANIFEST), B1_LOCATION, + (long) (Math.random() * Long.MAX_VALUE)); // b2 requires b1 optionally, so should resolve String B2_LOCATION = "org.eclipse.b2"; //$NON-NLS-1$ - final String B2_MANIFEST = "Bundle-SymbolicName: org.eclipse.b2\n" + "Bundle-Version: 2.0\n" + "Require-Bundle: org.eclipse.b1;optional=true"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - BundleDescription b2 = state.getFactory().createBundleDescription(parseManifest(B2_MANIFEST), B2_LOCATION, (long) (Math.random() * Long.MAX_VALUE)); + final String B2_MANIFEST = "Bundle-SymbolicName: org.eclipse.b2\n" + "Bundle-Version: 2.0\n" //$NON-NLS-1$ //$NON-NLS-2$ + + "Require-Bundle: org.eclipse.b1;optional=true"; //$NON-NLS-1$ + BundleDescription b2 = state.getFactory().createBundleDescription(parseManifest(B2_MANIFEST), B2_LOCATION, + (long) (Math.random() * Long.MAX_VALUE)); // b3 requires b1, so should not resolve String B3_LOCATION = "org.eclipse.b3"; //$NON-NLS-1$ - final String B3_MANIFEST = "Bundle-SymbolicName: org.eclipse.b3\n" + "Bundle-Version: 2.0\n" + "Require-Bundle: org.eclipse.b1"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - BundleDescription b3 = state.getFactory().createBundleDescription(parseManifest(B3_MANIFEST), B3_LOCATION, (long) (Math.random() * Long.MAX_VALUE)); + final String B3_MANIFEST = "Bundle-SymbolicName: org.eclipse.b3\n" + "Bundle-Version: 2.0\n" //$NON-NLS-1$ //$NON-NLS-2$ + + "Require-Bundle: org.eclipse.b1"; //$NON-NLS-1$ + BundleDescription b3 = state.getFactory().createBundleDescription(parseManifest(B3_MANIFEST), B3_LOCATION, + (long) (Math.random() * Long.MAX_VALUE)); // add b2 and b3 state.addBundle(b2); state.addBundle(b3); @@ -289,10 +299,11 @@ public void testLinkageChange() throws BundleException { assertEquals("8.0", 1, existingResolved.length); //$NON-NLS-1$ assertEquals("8.1", b3, existingResolved[0].getBundle()); //$NON-NLS-1$ // TODO linkage changed types are no longer valid - //BundleDelta[] optionalLinkageChanged = delta.getChanges(BundleDelta.OPTIONAL_LINKAGE_CHANGED, true); - //assertEquals("9.0", 1, optionalLinkageChanged.length); - //assertEquals("9.1", b2, optionalLinkageChanged[0].getBundle()); - delta = state.resolve(new BundleDescription[] {b2}); + // BundleDelta[] optionalLinkageChanged = + // delta.getChanges(BundleDelta.OPTIONAL_LINKAGE_CHANGED, true); + // assertEquals("9.0", 1, optionalLinkageChanged.length); + // assertEquals("9.1", b2, optionalLinkageChanged[0].getBundle()); + delta = state.resolve(new BundleDescription[] { b2 }); changes = delta.getChanges(); assertEquals("9.0", 1, changes.length); //$NON-NLS-1$ resolutions = delta.getChanges(BundleDelta.RESOLVED, true); @@ -310,16 +321,22 @@ public void testReinstall() throws BundleException { // remove bundle 4 - should cause 6 to be unresolved state.removeBundle(4); delta = state.resolve(); - assertEquals("1.0", 1, delta.getChanges(BundleDelta.REMOVED | BundleDelta.UNRESOLVED | BundleDelta.REMOVAL_COMPLETE, true).length); //$NON-NLS-1$ - assertEquals("1.1", 4, delta.getChanges(BundleDelta.REMOVED | BundleDelta.UNRESOLVED | BundleDelta.REMOVAL_COMPLETE, true)[0].getBundle().getBundleId()); //$NON-NLS-1$ + assertEquals("1.0", 1, delta //$NON-NLS-1$ + .getChanges(BundleDelta.REMOVED | BundleDelta.UNRESOLVED | BundleDelta.REMOVAL_COMPLETE, true).length); + assertEquals("1.1", 4, //$NON-NLS-1$ + delta.getChanges(BundleDelta.REMOVED | BundleDelta.UNRESOLVED | BundleDelta.REMOVAL_COMPLETE, true)[0] + .getBundle().getBundleId()); assertEquals("2.0", 1, delta.getChanges(BundleDelta.UNRESOLVED, true).length); //$NON-NLS-1$ assertEquals("2.1", 6, delta.getChanges(BundleDelta.UNRESOLVED, true)[0].getBundle().getBundleId()); //$NON-NLS-1$ // reinstall bundle 4 - should cause 6 to be resolved again - BundleDescription b4 = delta.getChanges(BundleDelta.REMOVED | BundleDelta.UNRESOLVED | BundleDelta.REMOVAL_COMPLETE, true)[0].getBundle(); + BundleDescription b4 = delta + .getChanges(BundleDelta.REMOVED | BundleDelta.UNRESOLVED | BundleDelta.REMOVAL_COMPLETE, true)[0] + .getBundle(); state.addBundle(b4); delta = state.resolve(); assertEquals("3.0", 1, delta.getChanges(BundleDelta.ADDED | BundleDelta.RESOLVED, true).length); //$NON-NLS-1$ - assertEquals("3.1", 4, delta.getChanges(BundleDelta.ADDED | BundleDelta.RESOLVED, true)[0].getBundle().getBundleId()); //$NON-NLS-1$ + assertEquals("3.1", 4, //$NON-NLS-1$ + delta.getChanges(BundleDelta.ADDED | BundleDelta.RESOLVED, true)[0].getBundle().getBundleId()); assertEquals("4.0", 1, delta.getChanges(BundleDelta.RESOLVED, true).length); //$NON-NLS-1$ assertEquals("4.1", 6, delta.getChanges(BundleDelta.RESOLVED, true)[0].getBundle().getBundleId()); //$NON-NLS-1$ } @@ -339,8 +356,10 @@ public void testRemoval() throws BundleException { assertTrue("1.2", contains(state.getResolvedBundles(), b2)); //$NON-NLS-1$ BundleDelta[] changes = delta.getChanges(); assertEquals("1.3", 2, changes.length); //$NON-NLS-1$ - assertEquals("1.4 - " + changes[0].getBundle(), (BundleDelta.ADDED | BundleDelta.RESOLVED), changes[0].getType()); //$NON-NLS-1$ - assertEquals("1.5 - " + changes[1].getBundle(), (BundleDelta.ADDED | BundleDelta.RESOLVED), changes[1].getType()); //$NON-NLS-1$ + assertEquals("1.4 - " + changes[0].getBundle(), (BundleDelta.ADDED | BundleDelta.RESOLVED), //$NON-NLS-1$ + changes[0].getType()); + assertEquals("1.5 - " + changes[1].getBundle(), (BundleDelta.ADDED | BundleDelta.RESOLVED), //$NON-NLS-1$ + changes[1].getType()); assertFullyResolved("1.6", b1); //$NON-NLS-1$ assertFullyResolved("1.7", b2); //$NON-NLS-1$ // remove a resolved bundle @@ -433,9 +452,12 @@ public void testRemovalResolve() throws BundleException { assertNotNull("1.1", deltasMap.get(Long.valueOf(1))); //$NON-NLS-1$ assertNotNull("1.2", deltasMap.get(Long.valueOf(2))); //$NON-NLS-1$ assertNotNull("1.3", deltasMap.get(Long.valueOf(3))); //$NON-NLS-1$ - assertEquals("2.1", (BundleDelta.RESOLVED | BundleDelta.ADDED), ((BundleDelta) deltasMap.get(Long.valueOf(1))).getType()); //$NON-NLS-1$ - assertEquals("2.2", (BundleDelta.RESOLVED | BundleDelta.ADDED), ((BundleDelta) deltasMap.get(Long.valueOf(2))).getType()); //$NON-NLS-1$ - assertEquals("2.3", (BundleDelta.RESOLVED | BundleDelta.ADDED), ((BundleDelta) deltasMap.get(Long.valueOf(3))).getType()); //$NON-NLS-1$ + assertEquals("2.1", (BundleDelta.RESOLVED | BundleDelta.ADDED), //$NON-NLS-1$ + ((BundleDelta) deltasMap.get(Long.valueOf(1))).getType()); + assertEquals("2.2", (BundleDelta.RESOLVED | BundleDelta.ADDED), //$NON-NLS-1$ + ((BundleDelta) deltasMap.get(Long.valueOf(2))).getType()); + assertEquals("2.3", (BundleDelta.RESOLVED | BundleDelta.ADDED), //$NON-NLS-1$ + ((BundleDelta) deltasMap.get(Long.valueOf(3))).getType()); state.removeBundle(1); delta = state.resolve(false); deltas = delta.getChanges(); @@ -446,10 +468,10 @@ public void testRemovalResolve() throws BundleException { } /** - * Tests adding 3 new bundles to an already resolved state and then - * resolving only one of the bundles. The result should be all 3 added - * bundles being resolved. Then re-resolving the same bundle. The result - * should be only the one bundle being resolved. + * Tests adding 3 new bundles to an already resolved state and then resolving + * only one of the bundles. The result should be all 3 added bundles being + * resolved. Then re-resolving the same bundle. The result should be only the + * one bundle being resolved. * */ public void testReresolveBundle() throws BundleException { @@ -498,7 +520,7 @@ public void testReresolveBundle() throws BundleException { } catch (BundleException e) { fail("Failed to create BundleDescription: " + e.getMessage()); //$NON-NLS-1$ } - delta = state.resolve(new BundleDescription[] {state.getBundle(1)}); + delta = state.resolve(new BundleDescription[] { state.getBundle(1) }); deltas = delta.getChanges(); assertEquals("1.0", 3, deltas.length); //$NON-NLS-1$ Map deltasMap = new HashMap(); @@ -508,10 +530,13 @@ public void testReresolveBundle() throws BundleException { assertNotNull("1.1", deltasMap.get(Long.valueOf(1))); //$NON-NLS-1$ assertNotNull("1.2", deltasMap.get(Long.valueOf(2))); //$NON-NLS-1$ assertNotNull("1.3", deltasMap.get(Long.valueOf(3))); //$NON-NLS-1$ - assertEquals("2.1", (BundleDelta.RESOLVED | BundleDelta.ADDED), ((BundleDelta) deltasMap.get(Long.valueOf(1))).getType()); //$NON-NLS-1$ - assertEquals("2.2", (BundleDelta.RESOLVED | BundleDelta.ADDED), ((BundleDelta) deltasMap.get(Long.valueOf(2))).getType()); //$NON-NLS-1$ - assertEquals("2.3", (BundleDelta.RESOLVED | BundleDelta.ADDED), ((BundleDelta) deltasMap.get(Long.valueOf(3))).getType()); //$NON-NLS-1$ - delta = state.resolve(new BundleDescription[] {state.getBundle(1)}); + assertEquals("2.1", (BundleDelta.RESOLVED | BundleDelta.ADDED), //$NON-NLS-1$ + ((BundleDelta) deltasMap.get(Long.valueOf(1))).getType()); + assertEquals("2.2", (BundleDelta.RESOLVED | BundleDelta.ADDED), //$NON-NLS-1$ + ((BundleDelta) deltasMap.get(Long.valueOf(2))).getType()); + assertEquals("2.3", (BundleDelta.RESOLVED | BundleDelta.ADDED), //$NON-NLS-1$ + ((BundleDelta) deltasMap.get(Long.valueOf(3))).getType()); + delta = state.resolve(new BundleDescription[] { state.getBundle(1) }); deltas = delta.getChanges(); assertEquals("3.0", 3, deltas.length); //$NON-NLS-1$ deltasMap = new HashMap(); @@ -531,7 +556,8 @@ public void testUpdate() throws BundleException { State state = buildEmptyState(); String B1_LOCATION = "org.eclipse.b"; //$NON-NLS-1$ final String B1_RESOLVED = "Bundle-SymbolicName: org.eclipse.b1\n" + "Bundle-Version: 1.0\n"; //$NON-NLS-1$ //$NON-NLS-2$ - final String B1_UNRESOLVED = "Bundle-SymbolicName: org.eclipse.b1\n" + "Bundle-Version: 2.0\nRequire-Bundle: non.existant.bundle\n"; //$NON-NLS-1$ //$NON-NLS-2$ + final String B1_UNRESOLVED = "Bundle-SymbolicName: org.eclipse.b1\n" //$NON-NLS-1$ + + "Bundle-Version: 2.0\nRequire-Bundle: non.existant.bundle\n"; //$NON-NLS-1$ BundleDescription b1 = state.getFactory().createBundleDescription(parseManifest(B1_RESOLVED), B1_LOCATION, 1); assertTrue("0.9", state.addBundle(b1)); //$NON-NLS-1$ StateDelta delta = state.resolve(); @@ -542,7 +568,8 @@ public void testUpdate() throws BundleException { assertEquals("1.2", (BundleDelta.ADDED | BundleDelta.RESOLVED), changes[0].getType()); //$NON-NLS-1$ assertFullyResolved("1.3", b1); //$NON-NLS-1$ assertTrue("1.8", contains(state.getResolvedBundles(), b1)); //$NON-NLS-1$ - BundleDescription b11 = state.getFactory().createBundleDescription(parseManifest(B1_UNRESOLVED), B1_LOCATION, 1); + BundleDescription b11 = state.getFactory().createBundleDescription(parseManifest(B1_UNRESOLVED), B1_LOCATION, + 1); assertTrue("1.8b", state.updateBundle(b11)); //$NON-NLS-1$ b11 = state.getBundle(b11.getBundleId()); assertTrue("1.9", !contains(state.getResolvedBundles(), b11)); //$NON-NLS-1$ @@ -602,7 +629,8 @@ public void testSingletons() throws BundleException { manifest.put(Constants.BUNDLE_SYMBOLICNAME, "test.dependent; singleton:=true"); //$NON-NLS-1$ manifest.put(Constants.REQUIRE_BUNDLE, "test.host; bundle-version=\"[1.0.1,2.0.0)\""); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ - BundleDescription testDependent = state.getFactory().createBundleDescription(state, manifest, "test.frag101", 4); //$NON-NLS-1$ + BundleDescription testDependent = state.getFactory().createBundleDescription(state, manifest, "test.frag101", //$NON-NLS-1$ + 4); state.addBundle(testHost100); state.addBundle(testFrag100); @@ -662,7 +690,8 @@ public void testSingletonsSameVersion() throws BundleException { public void testSingletonsSelection1() throws BundleException { State state = buildEmptyState(); - // test the selection algorithm of the resolver to pick the bundles with the largest version + // test the selection algorithm of the resolver to pick the bundles with the + // largest version Hashtable manifest = new Hashtable(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "sdk; " + Constants.SINGLETON_DIRECTIVE + ":=true"); //$NON-NLS-1$ //$NON-NLS-2$ @@ -738,7 +767,8 @@ public void testSingletonsSelection1() throws BundleException { public void testSingletonsSelection2() throws BundleException { State state = buildEmptyState(); - // test the selection algorithm of the resolver to pick the bundles with the largest version; test with cycle added + // test the selection algorithm of the resolver to pick the bundles with the + // largest version; test with cycle added Hashtable manifest = new Hashtable(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "sdk; " + Constants.SINGLETON_DIRECTIVE + ":=true"); //$NON-NLS-1$ //$NON-NLS-2$ @@ -824,7 +854,8 @@ public void testSingletonsSelection2() throws BundleException { public void testSingletonsSelection3() throws BundleException { State state = buildEmptyState(); int bundleID = 0; - // test the selection algorithm of the resolver to pick the bundles with the largest version; with fragments + // test the selection algorithm of the resolver to pick the bundles with the + // largest version; with fragments Hashtable manifest = new Hashtable(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "sdk; " + Constants.SINGLETON_DIRECTIVE + ":=true"); //$NON-NLS-1$ //$NON-NLS-2$ @@ -837,35 +868,40 @@ public void testSingletonsSelection3() throws BundleException { manifest.put(Constants.BUNDLE_SYMBOLICNAME, "sdk.frag; " + Constants.SINGLETON_DIRECTIVE + ":=true"); //$NON-NLS-1$ //$NON-NLS-2$ manifest.put(Constants.BUNDLE_VERSION, "1.0"); //$NON-NLS-1$ manifest.put(Constants.FRAGMENT_HOST, "sdk"); //$NON-NLS-1$ - BundleDescription sdk_frag10 = state.getFactory().createBundleDescription(state, manifest, "sdk.frag10", bundleID++); //$NON-NLS-1$ + BundleDescription sdk_frag10 = state.getFactory().createBundleDescription(state, manifest, "sdk.frag10", //$NON-NLS-1$ + bundleID++); manifest = new Hashtable(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "sdk.frag2; " + Constants.SINGLETON_DIRECTIVE + ":=true"); //$NON-NLS-1$ //$NON-NLS-2$ manifest.put(Constants.BUNDLE_VERSION, "1.0"); //$NON-NLS-1$ manifest.put(Constants.FRAGMENT_HOST, "sdk; bundle-version=2.0"); //$NON-NLS-1$ - BundleDescription sdk_frag210 = state.getFactory().createBundleDescription(state, manifest, "sdk.frag210", bundleID++); //$NON-NLS-1$ + BundleDescription sdk_frag210 = state.getFactory().createBundleDescription(state, manifest, "sdk.frag210", //$NON-NLS-1$ + bundleID++); manifest = new Hashtable(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "platform; " + Constants.SINGLETON_DIRECTIVE + ":=true"); //$NON-NLS-1$ //$NON-NLS-2$ manifest.put(Constants.BUNDLE_VERSION, "1.0"); //$NON-NLS-1$ manifest.put(Constants.REQUIRE_BUNDLE, "rcp; bundle-version=\"[1.0,2.0]\""); //$NON-NLS-1$ - BundleDescription platform10 = state.getFactory().createBundleDescription(state, manifest, "platform10", bundleID++); //$NON-NLS-1$ + BundleDescription platform10 = state.getFactory().createBundleDescription(state, manifest, "platform10", //$NON-NLS-1$ + bundleID++); manifest = new Hashtable(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "platform.frag; " + Constants.SINGLETON_DIRECTIVE + ":=true"); //$NON-NLS-1$ //$NON-NLS-2$ manifest.put(Constants.BUNDLE_VERSION, "1.0"); //$NON-NLS-1$ manifest.put(Constants.FRAGMENT_HOST, "platform"); //$NON-NLS-1$ - BundleDescription platform_frag10 = state.getFactory().createBundleDescription(state, manifest, "platform.frag10", bundleID++); //$NON-NLS-1$ + BundleDescription platform_frag10 = state.getFactory().createBundleDescription(state, manifest, + "platform.frag10", bundleID++); //$NON-NLS-1$ manifest = new Hashtable(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "platform.frag2; " + Constants.SINGLETON_DIRECTIVE + ":=true"); //$NON-NLS-1$ //$NON-NLS-2$ manifest.put(Constants.BUNDLE_VERSION, "1.0"); //$NON-NLS-1$ manifest.put(Constants.FRAGMENT_HOST, "platform; bundle-version=2.0"); //$NON-NLS-1$ - BundleDescription platform_frag210 = state.getFactory().createBundleDescription(state, manifest, "platform.frag210", bundleID++); //$NON-NLS-1$ + BundleDescription platform_frag210 = state.getFactory().createBundleDescription(state, manifest, + "platform.frag210", bundleID++); //$NON-NLS-1$ manifest = new Hashtable(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ @@ -878,14 +914,16 @@ public void testSingletonsSelection3() throws BundleException { manifest.put(Constants.BUNDLE_SYMBOLICNAME, "rcp.frag; " + Constants.SINGLETON_DIRECTIVE + ":=true"); //$NON-NLS-1$ //$NON-NLS-2$ manifest.put(Constants.BUNDLE_VERSION, "1.0"); //$NON-NLS-1$ manifest.put(Constants.FRAGMENT_HOST, "rcp"); //$NON-NLS-1$ - BundleDescription rcp_frag10 = state.getFactory().createBundleDescription(state, manifest, "rcp.frag10", bundleID++); //$NON-NLS-1$ + BundleDescription rcp_frag10 = state.getFactory().createBundleDescription(state, manifest, "rcp.frag10", //$NON-NLS-1$ + bundleID++); manifest = new Hashtable(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "rcp.frag2; " + Constants.SINGLETON_DIRECTIVE + ":=true"); //$NON-NLS-1$ //$NON-NLS-2$ manifest.put(Constants.BUNDLE_VERSION, "1.0"); //$NON-NLS-1$ manifest.put(Constants.FRAGMENT_HOST, "rcp; bundle-version=2.0"); //$NON-NLS-1$ - BundleDescription rcp_frag210 = state.getFactory().createBundleDescription(state, manifest, "rcp.frag210", bundleID++); //$NON-NLS-1$ + BundleDescription rcp_frag210 = state.getFactory().createBundleDescription(state, manifest, "rcp.frag210", //$NON-NLS-1$ + bundleID++); manifest = new Hashtable(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ @@ -929,7 +967,8 @@ public void testSingletonsSelection3() throws BundleException { manifest.put(Constants.BUNDLE_SYMBOLICNAME, "platform; " + Constants.SINGLETON_DIRECTIVE + ":=true"); //$NON-NLS-1$ //$NON-NLS-2$ manifest.put(Constants.BUNDLE_VERSION, "2.0"); //$NON-NLS-1$ manifest.put(Constants.REQUIRE_BUNDLE, "rcp; bundle-version=\"[1.0,2.0]\""); //$NON-NLS-1$ - BundleDescription platform20 = state.getFactory().createBundleDescription(state, manifest, "platform20", bundleID++); //$NON-NLS-1$ + BundleDescription platform20 = state.getFactory().createBundleDescription(state, manifest, "platform20", //$NON-NLS-1$ + bundleID++); manifest = new Hashtable(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ @@ -961,7 +1000,8 @@ public void testSingletonsSelection3() throws BundleException { public void testSingletonsSelection4() throws BundleException { State state = buildEmptyState(); int bundleID = 0; - // test the selection algorithm of the resolver to pick the bundles with the largest version; with fragments using Import-Package + // test the selection algorithm of the resolver to pick the bundles with the + // largest version; with fragments using Import-Package Hashtable manifest = new Hashtable(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "sdk; " + Constants.SINGLETON_DIRECTIVE + ":=true"); //$NON-NLS-1$ //$NON-NLS-2$ @@ -975,14 +1015,16 @@ public void testSingletonsSelection4() throws BundleException { manifest.put(Constants.BUNDLE_SYMBOLICNAME, "sdk.frag; " + Constants.SINGLETON_DIRECTIVE + ":=true"); //$NON-NLS-1$ //$NON-NLS-2$ manifest.put(Constants.BUNDLE_VERSION, "1.0"); //$NON-NLS-1$ manifest.put(Constants.FRAGMENT_HOST, "sdk"); //$NON-NLS-1$ - BundleDescription sdk_frag10 = state.getFactory().createBundleDescription(state, manifest, "sdk.frag10", bundleID++); //$NON-NLS-1$ + BundleDescription sdk_frag10 = state.getFactory().createBundleDescription(state, manifest, "sdk.frag10", //$NON-NLS-1$ + bundleID++); manifest = new Hashtable(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "sdk.frag2; " + Constants.SINGLETON_DIRECTIVE + ":=true"); //$NON-NLS-1$ //$NON-NLS-2$ manifest.put(Constants.BUNDLE_VERSION, "1.0"); //$NON-NLS-1$ manifest.put(Constants.FRAGMENT_HOST, "sdk; bundle-version=2.0"); //$NON-NLS-1$ - BundleDescription sdk_frag210 = state.getFactory().createBundleDescription(state, manifest, "sdk.frag210", bundleID++); //$NON-NLS-1$ + BundleDescription sdk_frag210 = state.getFactory().createBundleDescription(state, manifest, "sdk.frag210", //$NON-NLS-1$ + bundleID++); manifest = new Hashtable(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ @@ -990,21 +1032,24 @@ public void testSingletonsSelection4() throws BundleException { manifest.put(Constants.BUNDLE_VERSION, "1.0"); //$NON-NLS-1$ manifest.put(Constants.EXPORT_PACKAGE, "platform; version=1.0"); //$NON-NLS-1$ manifest.put(Constants.IMPORT_PACKAGE, "rcp; version=\"[1.0,2.0]\""); //$NON-NLS-1$ - BundleDescription platform10 = state.getFactory().createBundleDescription(state, manifest, "platform10", bundleID++); //$NON-NLS-1$ + BundleDescription platform10 = state.getFactory().createBundleDescription(state, manifest, "platform10", //$NON-NLS-1$ + bundleID++); manifest = new Hashtable(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "platform.frag; " + Constants.SINGLETON_DIRECTIVE + ":=true"); //$NON-NLS-1$ //$NON-NLS-2$ manifest.put(Constants.BUNDLE_VERSION, "1.0"); //$NON-NLS-1$ manifest.put(Constants.FRAGMENT_HOST, "platform"); //$NON-NLS-1$ - BundleDescription platform_frag10 = state.getFactory().createBundleDescription(state, manifest, "platform.frag10", bundleID++); //$NON-NLS-1$ + BundleDescription platform_frag10 = state.getFactory().createBundleDescription(state, manifest, + "platform.frag10", bundleID++); //$NON-NLS-1$ manifest = new Hashtable(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "platform.frag2; " + Constants.SINGLETON_DIRECTIVE + ":=true"); //$NON-NLS-1$ //$NON-NLS-2$ manifest.put(Constants.BUNDLE_VERSION, "1.0"); //$NON-NLS-1$ manifest.put(Constants.FRAGMENT_HOST, "platform; bundle-version=2.0"); //$NON-NLS-1$ - BundleDescription platform_frag210 = state.getFactory().createBundleDescription(state, manifest, "platform.frag210", bundleID++); //$NON-NLS-1$ + BundleDescription platform_frag210 = state.getFactory().createBundleDescription(state, manifest, + "platform.frag210", bundleID++); //$NON-NLS-1$ manifest = new Hashtable(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ @@ -1018,14 +1063,16 @@ public void testSingletonsSelection4() throws BundleException { manifest.put(Constants.BUNDLE_SYMBOLICNAME, "rcp.frag; " + Constants.SINGLETON_DIRECTIVE + ":=true"); //$NON-NLS-1$ //$NON-NLS-2$ manifest.put(Constants.BUNDLE_VERSION, "1.0"); //$NON-NLS-1$ manifest.put(Constants.FRAGMENT_HOST, "rcp"); //$NON-NLS-1$ - BundleDescription rcp_frag10 = state.getFactory().createBundleDescription(state, manifest, "rcp.frag10", bundleID++); //$NON-NLS-1$ + BundleDescription rcp_frag10 = state.getFactory().createBundleDescription(state, manifest, "rcp.frag10", //$NON-NLS-1$ + bundleID++); manifest = new Hashtable(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "rcp.frag2; " + Constants.SINGLETON_DIRECTIVE + ":=true"); //$NON-NLS-1$ //$NON-NLS-2$ manifest.put(Constants.BUNDLE_VERSION, "1.0"); //$NON-NLS-1$ manifest.put(Constants.FRAGMENT_HOST, "rcp; bundle-version=2.0"); //$NON-NLS-1$ - BundleDescription rcp_frag210 = state.getFactory().createBundleDescription(state, manifest, "rcp.frag210", bundleID++); //$NON-NLS-1$ + BundleDescription rcp_frag210 = state.getFactory().createBundleDescription(state, manifest, "rcp.frag210", //$NON-NLS-1$ + bundleID++); manifest = new Hashtable(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ @@ -1071,7 +1118,8 @@ public void testSingletonsSelection4() throws BundleException { manifest.put(Constants.BUNDLE_VERSION, "2.0"); //$NON-NLS-1$ manifest.put(Constants.EXPORT_PACKAGE, "platform; version=2.0"); //$NON-NLS-1$ manifest.put(Constants.IMPORT_PACKAGE, "rcp; version=\"[1.0,2.0]\""); //$NON-NLS-1$ - BundleDescription platform20 = state.getFactory().createBundleDescription(state, manifest, "platform20", bundleID++); //$NON-NLS-1$ + BundleDescription platform20 = state.getFactory().createBundleDescription(state, manifest, "platform20", //$NON-NLS-1$ + bundleID++); manifest = new Hashtable(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ @@ -1103,7 +1151,8 @@ public void testSingletonsSelection4() throws BundleException { public void testSingletonsSelection5() throws BundleException { State state = buildEmptyState(); - // test the selection algorithm of the resolver to pick the bundles with the largest version + // test the selection algorithm of the resolver to pick the bundles with the + // largest version long id = 0; Hashtable manifest = new Hashtable(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ @@ -1202,7 +1251,8 @@ public void testSingletonsSelection5() throws BundleException { public void testSingletonsSelection6() throws BundleException { State state = buildEmptyState(); - // test the selection algorithm of the resolver to pick the bundles with the largest version + // test the selection algorithm of the resolver to pick the bundles with the + // largest version Hashtable manifest = new Hashtable(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "sdk; " + Constants.SINGLETON_DIRECTIVE + ":=true"); //$NON-NLS-1$ //$NON-NLS-2$ @@ -1266,7 +1316,8 @@ public void testSingletonsSelection6() throws BundleException { state.removeBundle(rcp10); state.removeBundle(gef10); - // reorder the bundles to test that order of bundles does not effect resolution outcome + // reorder the bundles to test that order of bundles does not effect resolution + // outcome state.addBundle(sdk20); state.addBundle(platform20); state.addBundle(rcp20); @@ -1288,7 +1339,8 @@ public void testSingletonsSelection6() throws BundleException { public void testSingletonsSelection7() throws BundleException { State state = buildEmptyState(); long id = 0; - // test the selection algorithm of the resolver to pick the bundles with the largest version + // test the selection algorithm of the resolver to pick the bundles with the + // largest version Hashtable manifest = new Hashtable(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "singleton; " + Constants.SINGLETON_DIRECTIVE + ":=true"); //$NON-NLS-1$ //$NON-NLS-2$ @@ -1337,7 +1389,7 @@ public void testSingletonsSelection7() throws BundleException { state.addBundle(singleton2); state.addBundle(a2); - state.resolve(new BundleDescription[] {singleton1, singleton2, a1, a2}); + state.resolve(new BundleDescription[] { singleton1, singleton2, a1, a2 }); assertFalse("2.0", singleton1.isResolved()); //$NON-NLS-1$ assertTrue("2.1", singleton2.isResolved()); //$NON-NLS-1$ @@ -1576,7 +1628,8 @@ public void testRequireBundleUses() throws BundleException { ExportPackageDescription[] c1ResolvedImports = state.getStateHelper().getVisiblePackages(c_100); assertTrue("2.1", c1ResolvedImports.length == 2); //$NON-NLS-1$ - int index = c1ResolvedImports[0].getName().equals("a") ? 0 : c1ResolvedImports[1].getName().equals("a") ? 1 : -1; //$NON-NLS-1$ //$NON-NLS-2$ + int index = c1ResolvedImports[0].getName().equals("a") ? 0 //$NON-NLS-1$ + : c1ResolvedImports[1].getName().equals("a") ? 1 : -1; //$NON-NLS-1$ assertTrue("2.2", index >= 0); //$NON-NLS-1$ assertEquals("2.2", c1ResolvedImports[index].getExporter(), a_100); //$NON-NLS-1$ } @@ -1765,7 +1818,8 @@ public void testFragmentUses01() throws BundleException { manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.EXPORT_PACKAGE, "a"); //$NON-NLS-1$ manifest.put(Constants.REQUIRE_BUNDLE, "C2"); //$NON-NLS-1$ - BundleDescription a1 = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + manifest.get(Constants.BUNDLE_VERSION), id++); //$NON-NLS-1$ + BundleDescription a1 = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + manifest.get(Constants.BUNDLE_VERSION), id++); // $NON-NLS-1$ manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ @@ -1773,7 +1827,8 @@ public void testFragmentUses01() throws BundleException { manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.FRAGMENT_HOST, "A1"); //$NON-NLS-1$ manifest.put(Constants.IMPORT_PACKAGE, "b; good=true"); //$NON-NLS-1$ - BundleDescription a1frag = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + manifest.get(Constants.BUNDLE_VERSION), id++); //$NON-NLS-1$ + BundleDescription a1frag = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + manifest.get(Constants.BUNDLE_VERSION), id++); // $NON-NLS-1$ manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ @@ -1781,21 +1836,24 @@ public void testFragmentUses01() throws BundleException { manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.EXPORT_PACKAGE, "b; good=true; uses:=c"); //$NON-NLS-1$ manifest.put(Constants.IMPORT_PACKAGE, "c; good=true"); //$NON-NLS-1$ - BundleDescription b1 = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + manifest.get(Constants.BUNDLE_VERSION), id++); //$NON-NLS-1$ + BundleDescription b1 = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + manifest.get(Constants.BUNDLE_VERSION), id++); // $NON-NLS-1$ manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "C1"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.EXPORT_PACKAGE, "c; good=true"); //$NON-NLS-1$ - BundleDescription c1 = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + manifest.get(Constants.BUNDLE_VERSION), id++); //$NON-NLS-1$ + BundleDescription c1 = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + manifest.get(Constants.BUNDLE_VERSION), id++); // $NON-NLS-1$ manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "C2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.EXPORT_PACKAGE, "c; bad=true"); //$NON-NLS-1$ - BundleDescription c2 = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + manifest.get(Constants.BUNDLE_VERSION), id++); //$NON-NLS-1$ + BundleDescription c2 = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + manifest.get(Constants.BUNDLE_VERSION), id++); // $NON-NLS-1$ state.addBundle(a1); state.addBundle(a1frag); @@ -1814,7 +1872,7 @@ public void testFragmentUses01() throws BundleException { public void testFragmentUses02() throws BundleException { long id = 0; State state = buildEmptyState(); - Dictionary[] props = new Dictionary[] {new Hashtable()}; + Dictionary[] props = new Dictionary[] { new Hashtable() }; props[0].put("osgi.resolverMode", "development"); //$NON-NLS-1$ //$NON-NLS-2$ state.setPlatformProperties(props); @@ -1825,7 +1883,8 @@ public void testFragmentUses02() throws BundleException { manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.EXPORT_PACKAGE, "a"); //$NON-NLS-1$ manifest.put(Constants.REQUIRE_BUNDLE, "C2"); //$NON-NLS-1$ - BundleDescription a1 = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + manifest.get(Constants.BUNDLE_VERSION), id++); //$NON-NLS-1$ + BundleDescription a1 = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + manifest.get(Constants.BUNDLE_VERSION), id++); // $NON-NLS-1$ manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ @@ -1833,7 +1892,8 @@ public void testFragmentUses02() throws BundleException { manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.FRAGMENT_HOST, "A1"); //$NON-NLS-1$ manifest.put(Constants.IMPORT_PACKAGE, "b; good=true"); //$NON-NLS-1$ - BundleDescription a1frag = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + manifest.get(Constants.BUNDLE_VERSION), id++); //$NON-NLS-1$ + BundleDescription a1frag = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + manifest.get(Constants.BUNDLE_VERSION), id++); // $NON-NLS-1$ manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ @@ -1841,21 +1901,24 @@ public void testFragmentUses02() throws BundleException { manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.EXPORT_PACKAGE, "b; good=true; uses:=c"); //$NON-NLS-1$ manifest.put(Constants.IMPORT_PACKAGE, "c; good=true"); //$NON-NLS-1$ - BundleDescription b1 = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + manifest.get(Constants.BUNDLE_VERSION), id++); //$NON-NLS-1$ + BundleDescription b1 = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + manifest.get(Constants.BUNDLE_VERSION), id++); // $NON-NLS-1$ manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "C1"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.EXPORT_PACKAGE, "c; good=true"); //$NON-NLS-1$ - BundleDescription c1 = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + manifest.get(Constants.BUNDLE_VERSION), id++); //$NON-NLS-1$ + BundleDescription c1 = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + manifest.get(Constants.BUNDLE_VERSION), id++); // $NON-NLS-1$ manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "C2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.EXPORT_PACKAGE, "c; bad=true"); //$NON-NLS-1$ - BundleDescription c2 = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + manifest.get(Constants.BUNDLE_VERSION), id++); //$NON-NLS-1$ + BundleDescription c2 = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + manifest.get(Constants.BUNDLE_VERSION), id++); // $NON-NLS-1$ state.addBundle(a1); state.addBundle(a1frag); @@ -1967,7 +2030,7 @@ public void testRemovalPending() throws BundleException { ExportPackageDescription[] isConsistent = isConsistent(exports_w1_100, imports_w1_100_prime); assertNull("2.1 Packages are not consistent: " + isConsistent, isConsistent); //$NON-NLS-1$ - state.resolve(new BundleDescription[] {w1_100}); + state.resolve(new BundleDescription[] { w1_100 }); assertTrue("3.1", w1_100_prime.isResolved()); //$NON-NLS-1$ assertTrue("3.2", x1_100.isResolved()); //$NON-NLS-1$ assertTrue("3.3", y1_100.isResolved()); //$NON-NLS-1$ @@ -2044,9 +2107,10 @@ public void testFragmentConstraints01() throws BundleException { manifest.put(Constants.EXPORT_PACKAGE, "a.frag"); //$NON-NLS-1$ manifest.put(Constants.IMPORT_PACKAGE, "b; version=2.1"); //$NON-NLS-1$ manifest.put(Constants.REQUIRE_BUNDLE, "C1; bundle-version=\"[2.5, 4.0)\""); //$NON-NLS-1$ - a1frag_100 = state.getFactory().createBundleDescription(state, manifest, "a1frag_100", a1frag_100.getBundleId()); //$NON-NLS-1$ + a1frag_100 = state.getFactory().createBundleDescription(state, manifest, "a1frag_100", //$NON-NLS-1$ + a1frag_100.getBundleId()); state.updateBundle(a1frag_100); - state.resolve(new BundleDescription[] {a1frag_100}); + state.resolve(new BundleDescription[] { a1frag_100 }); assertTrue("1.1", a1_100.isResolved()); //$NON-NLS-1$ assertFalse("1.2", a1frag_100.isResolved()); //$NON-NLS-1$ @@ -2061,9 +2125,10 @@ public void testFragmentConstraints01() throws BundleException { manifest.put(Constants.FRAGMENT_HOST, "A1"); //$NON-NLS-1$ manifest.put(Constants.EXPORT_PACKAGE, "a.frag"); //$NON-NLS-1$ manifest.put(Constants.IMPORT_PACKAGE, "b; version=\"[1.0,2.0)\""); //$NON-NLS-1$ - a1frag_100 = state.getFactory().createBundleDescription(state, manifest, "a1frag_100", a1frag_100.getBundleId()); //$NON-NLS-1$ + a1frag_100 = state.getFactory().createBundleDescription(state, manifest, "a1frag_100", //$NON-NLS-1$ + a1frag_100.getBundleId()); state.updateBundle(a1frag_100); - state.resolve(new BundleDescription[] {a1frag_100}); + state.resolve(new BundleDescription[] { a1frag_100 }); assertTrue("2.1", a1_100.isResolved()); //$NON-NLS-1$ assertFalse("2.2", a1frag_100.isResolved()); //$NON-NLS-1$ @@ -2079,9 +2144,10 @@ public void testFragmentConstraints01() throws BundleException { manifest.put(Constants.FRAGMENT_HOST, "A1"); //$NON-NLS-1$ manifest.put(Constants.EXPORT_PACKAGE, "a.frag"); //$NON-NLS-1$ manifest.put(Constants.REQUIRE_BUNDLE, "C1; bundle-version=\"[1.0, 1.5)\""); //$NON-NLS-1$ - a1frag_100 = state.getFactory().createBundleDescription(state, manifest, "a1frag_100", a1frag_100.getBundleId()); //$NON-NLS-1$ + a1frag_100 = state.getFactory().createBundleDescription(state, manifest, "a1frag_100", //$NON-NLS-1$ + a1frag_100.getBundleId()); state.updateBundle(a1frag_100); - state.resolve(new BundleDescription[] {a1frag_100}); + state.resolve(new BundleDescription[] { a1frag_100 }); assertTrue("3.1", a1_100.isResolved()); //$NON-NLS-1$ assertFalse("3.2", a1frag_100.isResolved()); //$NON-NLS-1$ @@ -2100,7 +2166,9 @@ public void testFragmentConstraints02() throws BundleException { manifest.put(Constants.BUNDLE_SYMBOLICNAME, "a"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.IMPORT_PACKAGE, "a"); //$NON-NLS-1$ - BundleDescription a = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + manifest.get(Constants.BUNDLE_VERSION), id++); //$NON-NLS-1$ + BundleDescription a = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + manifest.get(Constants.BUNDLE_VERSION), //$NON-NLS-1$ + id++); manifest = new Hashtable(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ @@ -2108,7 +2176,9 @@ public void testFragmentConstraints02() throws BundleException { manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.FRAGMENT_HOST, "a"); //$NON-NLS-1$ manifest.put(Constants.IMPORT_PACKAGE, "b, c, d"); //$NON-NLS-1$ - BundleDescription aFrag1 = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + manifest.get(Constants.BUNDLE_VERSION), id++); //$NON-NLS-1$ + BundleDescription aFrag1 = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + manifest.get(Constants.BUNDLE_VERSION), //$NON-NLS-1$ + id++); manifest = new Hashtable(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ @@ -2116,7 +2186,9 @@ public void testFragmentConstraints02() throws BundleException { manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.FRAGMENT_HOST, "a"); //$NON-NLS-1$ manifest.put(Constants.IMPORT_PACKAGE, "b, c, e"); //$NON-NLS-1$ - BundleDescription aFrag2 = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + manifest.get(Constants.BUNDLE_VERSION), id++); //$NON-NLS-1$ + BundleDescription aFrag2 = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + manifest.get(Constants.BUNDLE_VERSION), //$NON-NLS-1$ + id++); manifest = new Hashtable(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ @@ -2124,23 +2196,30 @@ public void testFragmentConstraints02() throws BundleException { manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.FRAGMENT_HOST, "a"); //$NON-NLS-1$ manifest.put(Constants.IMPORT_PACKAGE, "b, c"); //$NON-NLS-1$ - BundleDescription aFrag3 = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + manifest.get(Constants.BUNDLE_VERSION), id++); //$NON-NLS-1$ + BundleDescription aFrag3 = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + manifest.get(Constants.BUNDLE_VERSION), //$NON-NLS-1$ + id++); - // Bug 353103 need to create a bundle that has the same unresolved imports as other bundles + // Bug 353103 need to create a bundle that has the same unresolved imports as + // other bundles manifest = new Hashtable(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "aFrag4"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.FRAGMENT_HOST, "a"); //$NON-NLS-1$ manifest.put(Constants.IMPORT_PACKAGE, "b, c, d, e"); //$NON-NLS-1$ - BundleDescription aFrag4 = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + manifest.get(Constants.BUNDLE_VERSION), id++); //$NON-NLS-1$ + BundleDescription aFrag4 = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + manifest.get(Constants.BUNDLE_VERSION), //$NON-NLS-1$ + id++); manifest = new Hashtable(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "b"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.EXPORT_PACKAGE, "a, b, c"); //$NON-NLS-1$ - BundleDescription b = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + manifest.get(Constants.BUNDLE_VERSION), id++); //$NON-NLS-1$ + BundleDescription b = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + manifest.get(Constants.BUNDLE_VERSION), //$NON-NLS-1$ + id++); state.addBundle(a); state.addBundle(aFrag1); @@ -2179,7 +2258,9 @@ public void testFragmentConstraints03() throws BundleException { manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.EXPORT_PACKAGE, "x"); //$NON-NLS-1$ manifest.put(Constants.IMPORT_PACKAGE, "a"); //$NON-NLS-1$ - BundleDescription a = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + manifest.get(Constants.BUNDLE_VERSION), id++); //$NON-NLS-1$ + BundleDescription a = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + manifest.get(Constants.BUNDLE_VERSION), //$NON-NLS-1$ + id++); manifest = new Hashtable(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ @@ -2187,7 +2268,9 @@ public void testFragmentConstraints03() throws BundleException { manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.FRAGMENT_HOST, "a"); //$NON-NLS-1$ manifest.put(Constants.IMPORT_PACKAGE, "b, c, d"); //$NON-NLS-1$ - BundleDescription aFrag1 = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + manifest.get(Constants.BUNDLE_VERSION), id++); //$NON-NLS-1$ + BundleDescription aFrag1 = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + manifest.get(Constants.BUNDLE_VERSION), //$NON-NLS-1$ + id++); manifest = new Hashtable(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ @@ -2195,7 +2278,9 @@ public void testFragmentConstraints03() throws BundleException { manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.FRAGMENT_HOST, "a"); //$NON-NLS-1$ manifest.put(Constants.IMPORT_PACKAGE, "b, c, e"); //$NON-NLS-1$ - BundleDescription aFrag2 = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + manifest.get(Constants.BUNDLE_VERSION), id++); //$NON-NLS-1$ + BundleDescription aFrag2 = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + manifest.get(Constants.BUNDLE_VERSION), //$NON-NLS-1$ + id++); manifest = new Hashtable(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ @@ -2203,16 +2288,21 @@ public void testFragmentConstraints03() throws BundleException { manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.FRAGMENT_HOST, "a"); //$NON-NLS-1$ manifest.put(Constants.IMPORT_PACKAGE, "b, c"); //$NON-NLS-1$ - BundleDescription aFrag3 = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + manifest.get(Constants.BUNDLE_VERSION), id++); //$NON-NLS-1$ + BundleDescription aFrag3 = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + manifest.get(Constants.BUNDLE_VERSION), //$NON-NLS-1$ + id++); - // Bug 353103 need to create a bundle that has the same unresolved imports as other bundles + // Bug 353103 need to create a bundle that has the same unresolved imports as + // other bundles manifest = new Hashtable(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "aFrag4"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.FRAGMENT_HOST, "a"); //$NON-NLS-1$ manifest.put(Constants.IMPORT_PACKAGE, "b, c, d, e"); //$NON-NLS-1$ - BundleDescription aFrag4 = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + manifest.get(Constants.BUNDLE_VERSION), id++); //$NON-NLS-1$ + BundleDescription aFrag4 = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + manifest.get(Constants.BUNDLE_VERSION), //$NON-NLS-1$ + id++); manifest = new Hashtable(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ @@ -2220,7 +2310,9 @@ public void testFragmentConstraints03() throws BundleException { manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.EXPORT_PACKAGE, "a, b, c"); //$NON-NLS-1$ manifest.put(Constants.IMPORT_PACKAGE, "x"); //$NON-NLS-1$ - BundleDescription b = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + manifest.get(Constants.BUNDLE_VERSION), id++); //$NON-NLS-1$ + BundleDescription b = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + manifest.get(Constants.BUNDLE_VERSION), //$NON-NLS-1$ + id++); state.addBundle(a); state.addBundle(aFrag1); @@ -2261,7 +2353,9 @@ public void testFragmentConstraints04() throws BundleException { manifest.put(Constants.BUNDLE_SYMBOLICNAME, "a"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.REQUIRE_BUNDLE, "b"); //$NON-NLS-1$ - BundleDescription a = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + manifest.get(Constants.BUNDLE_VERSION), id++); //$NON-NLS-1$ + BundleDescription a = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + manifest.get(Constants.BUNDLE_VERSION), //$NON-NLS-1$ + id++); manifest = new Hashtable(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ @@ -2269,7 +2363,9 @@ public void testFragmentConstraints04() throws BundleException { manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.FRAGMENT_HOST, "a"); //$NON-NLS-1$ manifest.put(Constants.REQUIRE_BUNDLE, "c, d, e"); //$NON-NLS-1$ - BundleDescription aFrag1 = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + manifest.get(Constants.BUNDLE_VERSION), id++); //$NON-NLS-1$ + BundleDescription aFrag1 = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + manifest.get(Constants.BUNDLE_VERSION), //$NON-NLS-1$ + id++); manifest = new Hashtable(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ @@ -2277,7 +2373,9 @@ public void testFragmentConstraints04() throws BundleException { manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.FRAGMENT_HOST, "a"); //$NON-NLS-1$ manifest.put(Constants.REQUIRE_BUNDLE, "c, d, f"); //$NON-NLS-1$ - BundleDescription aFrag2 = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + manifest.get(Constants.BUNDLE_VERSION), id++); //$NON-NLS-1$ + BundleDescription aFrag2 = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + manifest.get(Constants.BUNDLE_VERSION), //$NON-NLS-1$ + id++); manifest = new Hashtable(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ @@ -2285,28 +2383,36 @@ public void testFragmentConstraints04() throws BundleException { manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.FRAGMENT_HOST, "a"); //$NON-NLS-1$ manifest.put(Constants.REQUIRE_BUNDLE, "c, d"); //$NON-NLS-1$ - BundleDescription aFrag3 = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + manifest.get(Constants.BUNDLE_VERSION), id++); //$NON-NLS-1$ + BundleDescription aFrag3 = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + manifest.get(Constants.BUNDLE_VERSION), //$NON-NLS-1$ + id++); manifest = new Hashtable(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "b"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.EXPORT_PACKAGE, "b1, b2, b3"); //$NON-NLS-1$ - BundleDescription b = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + manifest.get(Constants.BUNDLE_VERSION), id++); //$NON-NLS-1$ + BundleDescription b = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + manifest.get(Constants.BUNDLE_VERSION), //$NON-NLS-1$ + id++); manifest = new Hashtable(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "c"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.EXPORT_PACKAGE, "c1, c2, c3"); //$NON-NLS-1$ - BundleDescription c = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + manifest.get(Constants.BUNDLE_VERSION), id++); //$NON-NLS-1$ + BundleDescription c = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + manifest.get(Constants.BUNDLE_VERSION), //$NON-NLS-1$ + id++); manifest = new Hashtable(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "d"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.EXPORT_PACKAGE, "d1, d2, d3"); //$NON-NLS-1$ - BundleDescription d = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + manifest.get(Constants.BUNDLE_VERSION), id++); //$NON-NLS-1$ + BundleDescription d = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + manifest.get(Constants.BUNDLE_VERSION), //$NON-NLS-1$ + id++); state.addBundle(a); state.addBundle(aFrag1); @@ -2343,7 +2449,9 @@ public void testFragmentConstraints05() throws BundleException { manifest.put(Constants.BUNDLE_SYMBOLICNAME, "a"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.REQUIRE_BUNDLE, "b"); //$NON-NLS-1$ - BundleDescription a = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + manifest.get(Constants.BUNDLE_VERSION), id++); //$NON-NLS-1$ + BundleDescription a = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + manifest.get(Constants.BUNDLE_VERSION), //$NON-NLS-1$ + id++); manifest = new Hashtable(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ @@ -2351,7 +2459,9 @@ public void testFragmentConstraints05() throws BundleException { manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.FRAGMENT_HOST, "a"); //$NON-NLS-1$ manifest.put(Constants.REQUIRE_BUNDLE, "c, d, e"); //$NON-NLS-1$ - BundleDescription aFrag1 = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + manifest.get(Constants.BUNDLE_VERSION), id++); //$NON-NLS-1$ + BundleDescription aFrag1 = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + manifest.get(Constants.BUNDLE_VERSION), //$NON-NLS-1$ + id++); manifest = new Hashtable(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ @@ -2359,7 +2469,9 @@ public void testFragmentConstraints05() throws BundleException { manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.FRAGMENT_HOST, "a"); //$NON-NLS-1$ manifest.put(Constants.REQUIRE_BUNDLE, "c, d, f"); //$NON-NLS-1$ - BundleDescription aFrag2 = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + manifest.get(Constants.BUNDLE_VERSION), id++); //$NON-NLS-1$ + BundleDescription aFrag2 = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + manifest.get(Constants.BUNDLE_VERSION), //$NON-NLS-1$ + id++); manifest = new Hashtable(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ @@ -2367,21 +2479,27 @@ public void testFragmentConstraints05() throws BundleException { manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.FRAGMENT_HOST, "a"); //$NON-NLS-1$ manifest.put(Constants.REQUIRE_BUNDLE, "c, d"); //$NON-NLS-1$ - BundleDescription aFrag3 = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + manifest.get(Constants.BUNDLE_VERSION), id++); //$NON-NLS-1$ + BundleDescription aFrag3 = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + manifest.get(Constants.BUNDLE_VERSION), //$NON-NLS-1$ + id++); manifest = new Hashtable(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "b"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.EXPORT_PACKAGE, "b1, b2, b3"); //$NON-NLS-1$ - BundleDescription b = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + manifest.get(Constants.BUNDLE_VERSION), id++); //$NON-NLS-1$ + BundleDescription b = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + manifest.get(Constants.BUNDLE_VERSION), //$NON-NLS-1$ + id++); manifest = new Hashtable(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "c"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.EXPORT_PACKAGE, "c1, c2, c3"); //$NON-NLS-1$ - BundleDescription c = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + manifest.get(Constants.BUNDLE_VERSION), id++); //$NON-NLS-1$ + BundleDescription c = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + manifest.get(Constants.BUNDLE_VERSION), //$NON-NLS-1$ + id++); manifest = new Hashtable(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ @@ -2389,7 +2507,9 @@ public void testFragmentConstraints05() throws BundleException { manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.REQUIRE_BUNDLE, "a"); //$NON-NLS-1$ manifest.put(Constants.EXPORT_PACKAGE, "d1, d2, d3"); //$NON-NLS-1$ - BundleDescription d = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + manifest.get(Constants.BUNDLE_VERSION), id++); //$NON-NLS-1$ + BundleDescription d = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + manifest.get(Constants.BUNDLE_VERSION), //$NON-NLS-1$ + id++); state.addBundle(a); state.addBundle(aFrag1); @@ -2429,7 +2549,9 @@ public void testFragmentConstraints06() throws BundleException { manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.IMPORT_PACKAGE, "a"); //$NON-NLS-1$ manifest.put(Constants.REQUIRE_BUNDLE, "b"); //$NON-NLS-1$ - BundleDescription a = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + manifest.get(Constants.BUNDLE_VERSION), id++); //$NON-NLS-1$ + BundleDescription a = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + manifest.get(Constants.BUNDLE_VERSION), //$NON-NLS-1$ + id++); manifest = new Hashtable(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ @@ -2438,7 +2560,9 @@ public void testFragmentConstraints06() throws BundleException { manifest.put(Constants.FRAGMENT_HOST, "a"); //$NON-NLS-1$ manifest.put(Constants.IMPORT_PACKAGE, "b, c, d"); //$NON-NLS-1$ manifest.put(Constants.REQUIRE_BUNDLE, "c, d, e"); //$NON-NLS-1$ - BundleDescription aFrag1 = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + manifest.get(Constants.BUNDLE_VERSION), id++); //$NON-NLS-1$ + BundleDescription aFrag1 = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + manifest.get(Constants.BUNDLE_VERSION), //$NON-NLS-1$ + id++); manifest = new Hashtable(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ @@ -2447,7 +2571,9 @@ public void testFragmentConstraints06() throws BundleException { manifest.put(Constants.FRAGMENT_HOST, "a"); //$NON-NLS-1$ manifest.put(Constants.IMPORT_PACKAGE, "b, c, e"); //$NON-NLS-1$ manifest.put(Constants.REQUIRE_BUNDLE, "c, d, f"); //$NON-NLS-1$ - BundleDescription aFrag2 = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + manifest.get(Constants.BUNDLE_VERSION), id++); //$NON-NLS-1$ + BundleDescription aFrag2 = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + manifest.get(Constants.BUNDLE_VERSION), //$NON-NLS-1$ + id++); manifest = new Hashtable(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ @@ -2456,28 +2582,36 @@ public void testFragmentConstraints06() throws BundleException { manifest.put(Constants.FRAGMENT_HOST, "a"); //$NON-NLS-1$ manifest.put(Constants.IMPORT_PACKAGE, "b, c"); //$NON-NLS-1$ manifest.put(Constants.REQUIRE_BUNDLE, "c, d"); //$NON-NLS-1$ - BundleDescription aFrag3 = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + manifest.get(Constants.BUNDLE_VERSION), id++); //$NON-NLS-1$ + BundleDescription aFrag3 = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + manifest.get(Constants.BUNDLE_VERSION), //$NON-NLS-1$ + id++); manifest = new Hashtable(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "b"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.EXPORT_PACKAGE, "a, b, c"); //$NON-NLS-1$ - BundleDescription b = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + manifest.get(Constants.BUNDLE_VERSION), id++); //$NON-NLS-1$ + BundleDescription b = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + manifest.get(Constants.BUNDLE_VERSION), //$NON-NLS-1$ + id++); manifest = new Hashtable(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "c"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.EXPORT_PACKAGE, "c1, c2, c3"); //$NON-NLS-1$ - BundleDescription c = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + manifest.get(Constants.BUNDLE_VERSION), id++); //$NON-NLS-1$ + BundleDescription c = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + manifest.get(Constants.BUNDLE_VERSION), //$NON-NLS-1$ + id++); manifest = new Hashtable(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "d"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.EXPORT_PACKAGE, "d1, d2, d3"); //$NON-NLS-1$ - BundleDescription d = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + manifest.get(Constants.BUNDLE_VERSION), id++); //$NON-NLS-1$ + BundleDescription d = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + manifest.get(Constants.BUNDLE_VERSION), //$NON-NLS-1$ + id++); state.addBundle(a); state.addBundle(aFrag1); @@ -2525,7 +2659,9 @@ public void testFragmentConstraints07() throws BundleException { manifest.put(Constants.EXPORT_PACKAGE, "x"); //$NON-NLS-1$ manifest.put(Constants.IMPORT_PACKAGE, "a"); //$NON-NLS-1$ manifest.put(Constants.REQUIRE_BUNDLE, "b"); //$NON-NLS-1$ - BundleDescription a = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + manifest.get(Constants.BUNDLE_VERSION), id++); //$NON-NLS-1$ + BundleDescription a = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + manifest.get(Constants.BUNDLE_VERSION), //$NON-NLS-1$ + id++); manifest = new Hashtable(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ @@ -2534,7 +2670,9 @@ public void testFragmentConstraints07() throws BundleException { manifest.put(Constants.FRAGMENT_HOST, "a"); //$NON-NLS-1$ manifest.put(Constants.IMPORT_PACKAGE, "b, c, d"); //$NON-NLS-1$ manifest.put(Constants.REQUIRE_BUNDLE, "c, d, e"); //$NON-NLS-1$ - BundleDescription aFrag1 = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + manifest.get(Constants.BUNDLE_VERSION), id++); //$NON-NLS-1$ + BundleDescription aFrag1 = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + manifest.get(Constants.BUNDLE_VERSION), //$NON-NLS-1$ + id++); manifest = new Hashtable(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ @@ -2543,7 +2681,9 @@ public void testFragmentConstraints07() throws BundleException { manifest.put(Constants.FRAGMENT_HOST, "a"); //$NON-NLS-1$ manifest.put(Constants.IMPORT_PACKAGE, "b, c, e"); //$NON-NLS-1$ manifest.put(Constants.REQUIRE_BUNDLE, "c, d, f"); //$NON-NLS-1$ - BundleDescription aFrag2 = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + manifest.get(Constants.BUNDLE_VERSION), id++); //$NON-NLS-1$ + BundleDescription aFrag2 = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + manifest.get(Constants.BUNDLE_VERSION), //$NON-NLS-1$ + id++); manifest = new Hashtable(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ @@ -2552,21 +2692,27 @@ public void testFragmentConstraints07() throws BundleException { manifest.put(Constants.FRAGMENT_HOST, "a"); //$NON-NLS-1$ manifest.put(Constants.IMPORT_PACKAGE, "b, c"); //$NON-NLS-1$ manifest.put(Constants.REQUIRE_BUNDLE, "c, d"); //$NON-NLS-1$ - BundleDescription aFrag3 = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + manifest.get(Constants.BUNDLE_VERSION), id++); //$NON-NLS-1$ + BundleDescription aFrag3 = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + manifest.get(Constants.BUNDLE_VERSION), //$NON-NLS-1$ + id++); manifest = new Hashtable(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "b"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.EXPORT_PACKAGE, "a, b, c"); //$NON-NLS-1$ - BundleDescription b = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + manifest.get(Constants.BUNDLE_VERSION), id++); //$NON-NLS-1$ + BundleDescription b = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + manifest.get(Constants.BUNDLE_VERSION), //$NON-NLS-1$ + id++); manifest = new Hashtable(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "c"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.EXPORT_PACKAGE, "c1, c2, c3"); //$NON-NLS-1$ - BundleDescription c = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + manifest.get(Constants.BUNDLE_VERSION), id++); //$NON-NLS-1$ + BundleDescription c = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + manifest.get(Constants.BUNDLE_VERSION), //$NON-NLS-1$ + id++); manifest = new Hashtable(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ @@ -2575,7 +2721,9 @@ public void testFragmentConstraints07() throws BundleException { manifest.put(Constants.EXPORT_PACKAGE, "d1, d2, d3"); //$NON-NLS-1$ manifest.put(Constants.IMPORT_PACKAGE, "x"); //$NON-NLS-1$ manifest.put(Constants.REQUIRE_BUNDLE, "a"); //$NON-NLS-1$ - BundleDescription d = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + manifest.get(Constants.BUNDLE_VERSION), id++); //$NON-NLS-1$ + BundleDescription d = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + "_" + manifest.get(Constants.BUNDLE_VERSION), //$NON-NLS-1$ + id++); state.addBundle(a); state.addBundle(aFrag1); @@ -2692,27 +2840,39 @@ public void testFragmentsMultipleVersion() throws BundleException { manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "A"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0"); //$NON-NLS-1$ - BundleDescription a1 = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + '_' + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription a1 = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + '_' + + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "AFrag"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0"); //$NON-NLS-1$ manifest.put(Constants.FRAGMENT_HOST, "A"); //$NON-NLS-1$ - BundleDescription aFrag1 = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + '_' + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription aFrag1 = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + '_' + + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "A"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "2.0"); //$NON-NLS-1$ - BundleDescription a2 = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + '_' + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription a2 = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + '_' + + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "AFrag"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "2.0"); //$NON-NLS-1$ manifest.put(Constants.FRAGMENT_HOST, "A"); //$NON-NLS-1$ - BundleDescription aFrag2 = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + '_' + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription aFrag2 = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + '_' + + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); state.addBundle(a1); state.addBundle(aFrag1); @@ -2741,7 +2901,8 @@ public void testPlatformProperties01() throws BundleException { manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "org.eclipse.osgi"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0"); //$NON-NLS-1$ - BundleDescription systemBundle = state.getFactory().createBundleDescription(state, manifest, "org.eclipse.osgi", bundleID++); //$NON-NLS-1$ + BundleDescription systemBundle = state.getFactory().createBundleDescription(state, manifest, "org.eclipse.osgi", //$NON-NLS-1$ + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ @@ -2785,13 +2946,14 @@ public void testPlatformProperties01() throws BundleException { manifest.put(Constants.BUNDLE_REQUIREDEXECUTIONENVIRONMENT, "J2SE-1.2"); //$NON-NLS-1$ BundleDescription systemB = state.getFactory().createBundleDescription(state, manifest, "system.b", bundleID++); //$NON-NLS-1$ - Dictionary[] props = new Dictionary[] {new Hashtable(), new Hashtable()}; + Dictionary[] props = new Dictionary[] { new Hashtable(), new Hashtable() }; props[0].put("org.osgi.framework.system.packages", "pkg.system.a, pkg.system.c"); //$NON-NLS-1$ //$NON-NLS-2$ props[0].put("org.osgi.framework.executionenvironment", "J2SE-1.2"); //$NON-NLS-1$ //$NON-NLS-2$ props[0].put("org.osgi.framework.system.capabilities", "osgi.ee; osgi.ee=\"JavaSE\"; version:Version=\"1.2\""); props[1].put("org.osgi.framework.system.packages", "pkg.system.a, pkg.system.b, pkg.system.c"); //$NON-NLS-1$ //$NON-NLS-2$ props[1].put("org.osgi.framework.executionenvironment", "J2SE-1.4"); //$NON-NLS-1$ //$NON-NLS-2$ - props[1].put("org.osgi.framework.system.capabilities", "osgi.ee; osgi.ee=\"JavaSE\"; version:List=\"1.2, 1.3, 1.4\""); + props[1].put("org.osgi.framework.system.capabilities", + "osgi.ee; osgi.ee=\"JavaSE\"; version:List=\"1.2, 1.3, 1.4\""); state.setPlatformProperties(props); state.addBundle(systemBundle); @@ -2818,7 +2980,8 @@ public void testPlatformProperties01() throws BundleException { assertTrue("2.2", c.getResolvedImports()[1].getExporter() == systemBundle); //$NON-NLS-1$ assertTrue("2.3", d.getResolvedImports()[0].getExporter() == systemB); //$NON-NLS-1$ - // now test the uses clause for pkg.b such that bundle 'A' will be forced to used + // now test the uses clause for pkg.b such that bundle 'A' will be forced to + // used // pkg.system.b from bundle 'system.b' manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "B"); //$NON-NLS-1$ @@ -2829,7 +2992,8 @@ public void testPlatformProperties01() throws BundleException { BundleDescription b_updated = state.getFactory().createBundleDescription(state, manifest, "B", b.getBundleId()); //$NON-NLS-1$ state.updateBundle(b_updated); - // now test the uses clause for pkg.d such that bundle 'C' will be forced to used + // now test the uses clause for pkg.d such that bundle 'C' will be forced to + // used // pkg.system.b from bundle 'system.b' manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "D"); //$NON-NLS-1$ @@ -2839,7 +3003,7 @@ public void testPlatformProperties01() throws BundleException { manifest.put(Constants.BUNDLE_REQUIREDEXECUTIONENVIRONMENT, "J2SE-1.2"); //$NON-NLS-1$ BundleDescription d_updated = state.getFactory().createBundleDescription(state, manifest, "D", d.getBundleId()); //$NON-NLS-1$ state.updateBundle(d_updated); - state.resolve(new BundleDescription[] {b_updated, d_updated}); + state.resolve(new BundleDescription[] { b_updated, d_updated }); assertTrue("3.0", systemBundle.isResolved()); //$NON-NLS-1$ assertTrue("3.1", a.isResolved()); //$NON-NLS-1$ @@ -2852,7 +3016,8 @@ public void testPlatformProperties01() throws BundleException { } public void testPlatformProperties02() throws BundleException { - // same as 01 except use alias system.bundle to another name "test.system.bundle" + // same as 01 except use alias system.bundle to another name + // "test.system.bundle" State state = buildEmptyState(); int bundleID = 0; // test the selection algorithm of the resolver to pick the bundles which @@ -2861,7 +3026,8 @@ public void testPlatformProperties02() throws BundleException { manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "test.system.bundle"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0"); //$NON-NLS-1$ - BundleDescription systemBundle = state.getFactory().createBundleDescription(state, manifest, "test.system.bundle", bundleID++); //$NON-NLS-1$ + BundleDescription systemBundle = state.getFactory().createBundleDescription(state, manifest, + "test.system.bundle", bundleID++); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "A"); //$NON-NLS-1$ @@ -2885,10 +3051,12 @@ public void testPlatformProperties02() throws BundleException { manifest.put(Constants.BUNDLE_REQUIREDEXECUTIONENVIRONMENT, "J2SE-1.2"); //$NON-NLS-1$ BundleDescription systemB = state.getFactory().createBundleDescription(state, manifest, "system.b", bundleID++); //$NON-NLS-1$ - Dictionary[] props = new Dictionary[] {new Hashtable(), new Hashtable()}; + Dictionary[] props = new Dictionary[] { new Hashtable(), new Hashtable() }; props[0].put("org.osgi.framework.system.packages", "pkg.system.a, pkg.system.c"); //$NON-NLS-1$ //$NON-NLS-2$ props[0].put("org.osgi.framework.executionenvironment", "J2SE-1.2"); //$NON-NLS-1$ //$NON-NLS-2$ - props[0].put("osgi.system.bundle", "test.system.bundle"); // set the system.bundle to another system bundle (other than org.eclipse.osgi) //$NON-NLS-1$ //$NON-NLS-2$ + props[0].put("osgi.system.bundle", "test.system.bundle"); // set the system.bundle //$NON-NLS-1$ //$NON-NLS-2$ + // to another system bundle (other than + // org.eclipse.osgi) props[1].put("org.osgi.framework.system.packages", "pkg.system.a, pkg.system.b, pkg.system.c"); //$NON-NLS-1$ //$NON-NLS-2$ props[1].put("org.osgi.framework.executionenvironment", "J2SE-1.4"); //$NON-NLS-1$ //$NON-NLS-2$ @@ -2907,7 +3075,8 @@ public void testPlatformProperties02() throws BundleException { assertTrue("2.0", a.getResolvedImports()[1].getExporter() == systemBundle); //$NON-NLS-1$ assertTrue("2.1", b.getResolvedImports()[0].getExporter() == systemB); //$NON-NLS-1$ - // now test the uses clause for pkg.b such that bundle 'A' will be forced to used + // now test the uses clause for pkg.b such that bundle 'A' will be forced to + // used // pkg.system from bundle 'system.b' manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "B"); //$NON-NLS-1$ @@ -2917,7 +3086,7 @@ public void testPlatformProperties02() throws BundleException { manifest.put(Constants.BUNDLE_REQUIREDEXECUTIONENVIRONMENT, "J2SE-1.2"); //$NON-NLS-1$ BundleDescription b_updated = state.getFactory().createBundleDescription(state, manifest, "B", b.getBundleId()); //$NON-NLS-1$ state.updateBundle(b_updated); - state.resolve(new BundleDescription[] {b_updated}); + state.resolve(new BundleDescription[] { b_updated }); assertTrue("3.0", systemBundle.isResolved()); //$NON-NLS-1$ assertTrue("3.1", a.isResolved()); //$NON-NLS-1$ @@ -2929,7 +3098,8 @@ public void testPlatformProperties02() throws BundleException { } public void testPlatformProperties03() throws BundleException { - // test that require-bundle, fragment-host, and import-package of system.bundle can be aliased properly + // test that require-bundle, fragment-host, and import-package of system.bundle + // can be aliased properly State state = buildEmptyState(); int bundleID = 0; String configuredSystemBundle = "org.eclipse.osgi"; //$NON-NLS-1$ @@ -2940,7 +3110,8 @@ public void testPlatformProperties03() throws BundleException { manifest.put(Constants.BUNDLE_SYMBOLICNAME, configuredSystemBundle); manifest.put(Constants.EXPORT_PACKAGE, "system.bundle.exported.pkg"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0"); //$NON-NLS-1$ - BundleDescription systemBundle = state.getFactory().createBundleDescription(state, manifest, configuredSystemBundle, bundleID++); + BundleDescription systemBundle = state.getFactory().createBundleDescription(state, manifest, + configuredSystemBundle, bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ @@ -2967,7 +3138,8 @@ public void testPlatformProperties03() throws BundleException { manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "D"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0"); //$NON-NLS-1$ - manifest.put(Constants.IMPORT_PACKAGE, "system.bundle.exported.pkg; bundle-symbolic-name=\"" + configuredSystemBundle + "\""); //$NON-NLS-1$ //$NON-NLS-2$ + manifest.put(Constants.IMPORT_PACKAGE, + "system.bundle.exported.pkg; bundle-symbolic-name=\"" + configuredSystemBundle + "\""); //$NON-NLS-1$ //$NON-NLS-2$ BundleDescription d = state.getFactory().createBundleDescription(state, manifest, "D", bundleID++); //$NON-NLS-1$ manifest.clear(); @@ -2998,7 +3170,7 @@ public void testPlatformProperties03() throws BundleException { manifest.put(Constants.FRAGMENT_HOST, configuredSystemBundle); BundleDescription h = state.getFactory().createBundleDescription(state, manifest, "H", bundleID++); //$NON-NLS-1$ - Dictionary[] props = new Dictionary[] {new Hashtable(), new Hashtable()}; + Dictionary[] props = new Dictionary[] { new Hashtable(), new Hashtable() }; props[0].put("org.osgi.framework.system.packages", "pkg.system.a, pkg.system.b"); //$NON-NLS-1$ //$NON-NLS-2$ state.setPlatformProperties(props); @@ -3034,8 +3206,10 @@ public void testPlatformProperties03() throws BundleException { } public void testPlatformProperties04() throws BundleException { - // same as 03 except use a different system.bundle alias other than org.eclipse.osgi - // test that require-bundle, fragment-host, and import-package of system.bundle can be aliased properly + // same as 03 except use a different system.bundle alias other than + // org.eclipse.osgi + // test that require-bundle, fragment-host, and import-package of system.bundle + // can be aliased properly State state = buildEmptyState(); int bundleID = 0; String configuredSystemBundle = "test.system.bundle"; //$NON-NLS-1$ @@ -3046,7 +3220,8 @@ public void testPlatformProperties04() throws BundleException { manifest.put(Constants.BUNDLE_SYMBOLICNAME, configuredSystemBundle); manifest.put(Constants.EXPORT_PACKAGE, "system.bundle.exported.pkg"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0"); //$NON-NLS-1$ - BundleDescription systemBundle = state.getFactory().createBundleDescription(state, manifest, configuredSystemBundle, bundleID++); + BundleDescription systemBundle = state.getFactory().createBundleDescription(state, manifest, + configuredSystemBundle, bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ @@ -3073,7 +3248,8 @@ public void testPlatformProperties04() throws BundleException { manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "D"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0"); //$NON-NLS-1$ - manifest.put(Constants.IMPORT_PACKAGE, "system.bundle.exported.pkg; bundle-symbolic-name=\"" + configuredSystemBundle + "\""); //$NON-NLS-1$ //$NON-NLS-2$ + manifest.put(Constants.IMPORT_PACKAGE, + "system.bundle.exported.pkg; bundle-symbolic-name=\"" + configuredSystemBundle + "\""); //$NON-NLS-1$ //$NON-NLS-2$ BundleDescription d = state.getFactory().createBundleDescription(state, manifest, "D", bundleID++); //$NON-NLS-1$ manifest.clear(); @@ -3104,9 +3280,10 @@ public void testPlatformProperties04() throws BundleException { manifest.put(Constants.FRAGMENT_HOST, configuredSystemBundle); BundleDescription h = state.getFactory().createBundleDescription(state, manifest, "H", bundleID++); //$NON-NLS-1$ - Dictionary[] props = new Dictionary[] {new Hashtable(), new Hashtable()}; + Dictionary[] props = new Dictionary[] { new Hashtable(), new Hashtable() }; props[0].put("org.osgi.framework.system.packages", "pkg.system.a, pkg.system.b"); //$NON-NLS-1$ //$NON-NLS-2$ - props[0].put("osgi.system.bundle", configuredSystemBundle); // set the system.bundle to another system bundle (other than org.eclipse.osgi) //$NON-NLS-1$ + props[0].put("osgi.system.bundle", configuredSystemBundle); // set the system.bundle to another //$NON-NLS-1$ + // system bundle (other than org.eclipse.osgi) state.setPlatformProperties(props); state.addBundle(systemBundle); @@ -3241,7 +3418,8 @@ public void testPlatformPropertiesBug207500b() throws BundleException { manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "a"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ - manifest.put(Constants.BUNDLE_NATIVECODE, "libwrapper-linux-x86-32.so; wrapper-linux-x86-32; osname=linux; processor=x86"); //$NON-NLS-1$ + manifest.put(Constants.BUNDLE_NATIVECODE, + "libwrapper-linux-x86-32.so; wrapper-linux-x86-32; osname=linux; processor=x86"); //$NON-NLS-1$ BundleDescription a = state.getFactory().createBundleDescription(state, manifest, "A", bundleID++); //$NON-NLS-1$ Dictionary props = new Hashtable(); @@ -3268,13 +3446,15 @@ public void testPlatformPropertiesBug246640a() throws BundleException { manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, configuredSystemBundle); manifest.put(Constants.BUNDLE_VERSION, "1.0"); //$NON-NLS-1$ - BundleDescription systemBundle1 = state.getFactory().createBundleDescription(state, manifest, configuredSystemBundle + manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription systemBundle1 = state.getFactory().createBundleDescription(state, manifest, + configuredSystemBundle + manifest.get(Constants.BUNDLE_VERSION), bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, configuredSystemBundle); manifest.put(Constants.BUNDLE_VERSION, "2.0"); //$NON-NLS-1$ - BundleDescription systemBundle2 = state.getFactory().createBundleDescription(state, manifest, configuredSystemBundle + manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription systemBundle2 = state.getFactory().createBundleDescription(state, manifest, + configuredSystemBundle + manifest.get(Constants.BUNDLE_VERSION), bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ @@ -3289,9 +3469,10 @@ public void testPlatformPropertiesBug246640a() throws BundleException { manifest.put(Constants.BUNDLE_VERSION, "1.0"); //$NON-NLS-1$ manifest.put(Constants.REQUIRE_BUNDLE, "org.eclipse.osgi; bundle-version=2.0"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_REQUIREDEXECUTIONENVIRONMENT, "J2SE-1.2"); //$NON-NLS-1$ - BundleDescription requireSystemBundle = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); + BundleDescription requireSystemBundle = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); - Dictionary[] props = new Dictionary[] {new Hashtable(), new Hashtable()}; + Dictionary[] props = new Dictionary[] { new Hashtable(), new Hashtable() }; props[0].put("org.osgi.framework.system.packages", "pkg.system.a, pkg.system.c"); //$NON-NLS-1$ //$NON-NLS-2$ props[0].put("org.osgi.framework.executionenvironment", "J2SE-1.2"); //$NON-NLS-1$ //$NON-NLS-2$ props[1].put("org.osgi.framework.system.packages", "pkg.system.a, pkg.system.b, pkg.system.c"); //$NON-NLS-1$ //$NON-NLS-2$ @@ -3322,13 +3503,15 @@ public void testPlatformPropertiesBug246640b() throws BundleException { manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, configuredSystemBundle); manifest.put(Constants.BUNDLE_VERSION, "1.0"); //$NON-NLS-1$ - BundleDescription systemBundle1 = state.getFactory().createBundleDescription(state, manifest, configuredSystemBundle + manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription systemBundle1 = state.getFactory().createBundleDescription(state, manifest, + configuredSystemBundle + manifest.get(Constants.BUNDLE_VERSION), bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, configuredSystemBundle); manifest.put(Constants.BUNDLE_VERSION, "2.0"); //$NON-NLS-1$ - BundleDescription systemBundle2 = state.getFactory().createBundleDescription(state, manifest, configuredSystemBundle + manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription systemBundle2 = state.getFactory().createBundleDescription(state, manifest, + configuredSystemBundle + manifest.get(Constants.BUNDLE_VERSION), bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ @@ -3343,10 +3526,13 @@ public void testPlatformPropertiesBug246640b() throws BundleException { manifest.put(Constants.BUNDLE_VERSION, "1.0"); //$NON-NLS-1$ manifest.put(Constants.REQUIRE_BUNDLE, "test.system.bundle; bundle-version=2.0"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_REQUIREDEXECUTIONENVIRONMENT, "J2SE-1.2"); //$NON-NLS-1$ - BundleDescription requireSystemBundle = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); + BundleDescription requireSystemBundle = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); - Dictionary[] props = new Dictionary[] {new Hashtable(), new Hashtable()}; - props[0].put("osgi.system.bundle", "test.system.bundle"); // set the system.bundle to another system bundle (other than org.eclipse.osgi) //$NON-NLS-1$ //$NON-NLS-2$ + Dictionary[] props = new Dictionary[] { new Hashtable(), new Hashtable() }; + props[0].put("osgi.system.bundle", "test.system.bundle"); // set the system.bundle //$NON-NLS-1$ //$NON-NLS-2$ + // to another system bundle (other than + // org.eclipse.osgi) props[0].put("org.osgi.framework.system.packages", "pkg.system.a, pkg.system.c"); //$NON-NLS-1$ //$NON-NLS-2$ props[0].put("org.osgi.framework.executionenvironment", "J2SE-1.2"); //$NON-NLS-1$ //$NON-NLS-2$ props[1].put("org.osgi.framework.system.packages", "pkg.system.a, pkg.system.b, pkg.system.c"); //$NON-NLS-1$ //$NON-NLS-2$ @@ -3374,7 +3560,8 @@ public void testEECapabilityRequirement() throws BundleException { manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "org.eclipse.osgi"); //$NON-NLS-1$ - BundleDescription systemBundle = state.getFactory().createBundleDescription(state, manifest, "org.eclipse.osgi", bundleID++); //$NON-NLS-1$ + BundleDescription systemBundle = state.getFactory().createBundleDescription(state, manifest, "org.eclipse.osgi", //$NON-NLS-1$ + bundleID++); state.addBundle(systemBundle); List bundles = new ArrayList(); @@ -3442,7 +3629,8 @@ public void testEECapabilityRequirement() throws BundleException { bundles.add(h); state.addBundle(h); - Dictionary[] props = new Dictionary[] {new Hashtable(), new Hashtable(), new Hashtable(), new Hashtable(), new Hashtable(), new Hashtable(), new Hashtable(), new Hashtable()}; + Dictionary[] props = new Dictionary[] { new Hashtable(), new Hashtable(), new Hashtable(), new Hashtable(), + new Hashtable(), new Hashtable(), new Hashtable(), new Hashtable() }; props[0].put("org.osgi.framework.executionenvironment", "OSGi/Minimum-1.0, OSGi/Minimum-1.1, OSGi/Minimum-1.2"); //$NON-NLS-1$ //$NON-NLS-2$ props[1].put("org.osgi.framework.executionenvironment", "CDC-1.0/Foundation-1.0, CDC-1.1/Foundation-1.1"); //$NON-NLS-1$ //$NON-NLS-2$ props[2].put("org.osgi.framework.executionenvironment", "J2SE-1.2, J2SE-1.3, J2SE-1.4, J2SE-1.5, JavaSE-1.6"); //$NON-NLS-1$ //$NON-NLS-2$ @@ -3477,13 +3665,18 @@ public void testEECapabilityRequirement() throws BundleException { props[5].put("org.osgi.framework.executionenvironment", "EE-2.0/FF-YY"); props[6].put("org.osgi.framework.executionenvironment", "GG-XX/HH-1.0"); props[7].put("org.osgi.framework.executionenvironment", "II-1.0/JJ-2.0"); - props[0].put("org.osgi.framework.system.capabilities", "osgi.ee; osgi.ee=\"OSGi/Minimum\"; version:List=\"1.0, 1.1, 1.2\""); //$NON-NLS-1$ //$NON-NLS-2$ - props[1].put("org.osgi.framework.system.capabilities", "osgi.ee; osgi.ee=\"CDC/Foundation\"; version:List=\"1.0, 1.1\""); //$NON-NLS-1$ //$NON-NLS-2$ - props[2].put("org.osgi.framework.system.capabilities", "osgi.ee; osgi.ee=\"JavaSE\"; version:List=\"1.2, 1.3, 1.4, 1.5, 1.6\""); //$NON-NLS-1$ //$NON-NLS-2$ + props[0].put("org.osgi.framework.system.capabilities", //$NON-NLS-1$ + "osgi.ee; osgi.ee=\"OSGi/Minimum\"; version:List=\"1.0, 1.1, 1.2\""); //$NON-NLS-1$ + props[1].put("org.osgi.framework.system.capabilities", //$NON-NLS-1$ + "osgi.ee; osgi.ee=\"CDC/Foundation\"; version:List=\"1.0, 1.1\""); //$NON-NLS-1$ + props[2].put("org.osgi.framework.system.capabilities", //$NON-NLS-1$ + "osgi.ee; osgi.ee=\"JavaSE\"; version:List=\"1.2, 1.3, 1.4, 1.5, 1.6\""); //$NON-NLS-1$ props[3].put("org.osgi.framework.system.capabilities", "osgi.ee; osgi.ee=\"AA/BB\""); //$NON-NLS-1$ //$NON-NLS-2$ props[4].put("org.osgi.framework.system.capabilities", "osgi.ee; osgi.ee=\"CC-XX/DD-YY\""); //$NON-NLS-1$ //$NON-NLS-2$ - props[5].put("org.osgi.framework.system.capabilities", "osgi.ee; osgi.ee=\"EE/FF-YY\"; version:List=\"1.0, 2.0\""); //$NON-NLS-1$ //$NON-NLS-2$ - props[6].put("org.osgi.framework.system.capabilities", "osgi.ee; osgi.ee=\"GG-XX/HH\"; version:List=\"1.0, 2.0\""); //$NON-NLS-1$ //$NON-NLS-2$ + props[5].put("org.osgi.framework.system.capabilities", //$NON-NLS-1$ + "osgi.ee; osgi.ee=\"EE/FF-YY\"; version:List=\"1.0, 2.0\""); //$NON-NLS-1$ + props[6].put("org.osgi.framework.system.capabilities", //$NON-NLS-1$ + "osgi.ee; osgi.ee=\"GG-XX/HH\"; version:List=\"1.0, 2.0\""); //$NON-NLS-1$ props[7].put("org.osgi.framework.system.capabilities", "osgi.ee; osgi.ee=\"II-1.0/JJ-2.0\""); //$NON-NLS-1$ //$NON-NLS-2$ state.setPlatformProperties(props); @@ -3499,62 +3692,62 @@ private void checkEECapabilities(List eeCapabilities, List bundles) { assertEquals("Wrong namespace: " + eeCap, "osgi.ee", eeCap.getNamespace()); Map attrs = eeCap.getAttributes(); switch (i) { - case 0 : - assertEquals("Wrong ee name: " + i, "OSGi/Minimum", attrs.get("osgi.ee")); - List v0 = (List) attrs.get("version"); - assertEquals("Wrong number of versions: " + i, 3, v0.size()); - assertTrue("Does not contain 1.0.", v0.contains(new Version("1.0"))); - assertTrue("Does not contain 1.1.", v0.contains(new Version("1.1"))); - assertTrue("Does not contain 1.2.", v0.contains(new Version("1.2"))); - break; - case 1 : - assertEquals("Wrong ee name: " + i, "CDC/Foundation", attrs.get("osgi.ee")); - List v1 = (List) attrs.get("version"); - assertEquals("Wrong number of versions: " + i, 2, v1.size()); - assertTrue("Does not contain 1.0.", v1.contains(new Version("1.0"))); - assertTrue("Does not contain 1.1.", v1.contains(new Version("1.1"))); - break; - case 2 : - assertEquals("Wrong ee name: " + i, "JavaSE", attrs.get("osgi.ee")); - List v2 = (List) attrs.get("version"); - assertEquals("Wrong number of versions: " + i, 5, v2.size()); - assertTrue("Does not contain 1.2.", v2.contains(new Version("1.2"))); - assertTrue("Does not contain 1.3.", v2.contains(new Version("1.3"))); - assertTrue("Does not contain 1.4.", v2.contains(new Version("1.4"))); - assertTrue("Does not contain 1.5.", v2.contains(new Version("1.5"))); - assertTrue("Does not contain 1.6.", v2.contains(new Version("1.6"))); - break; - case 3 : - assertEquals("Wrong ee name: " + i, "AA/BB", attrs.get("osgi.ee")); - List v3 = (List) attrs.get("version"); - assertNull("versions is not null", v3); - break; - case 4 : - assertEquals("Wrong ee name: " + i, "CC-XX/DD-YY", attrs.get("osgi.ee")); - List v4 = (List) attrs.get("version"); - assertNull("versions is not null", v4); - break; - case 5 : - assertEquals("Wrong ee name: " + i, "EE/FF-YY", attrs.get("osgi.ee")); - List v5 = (List) attrs.get("version"); - assertEquals("Wrong number of versions: " + i, 2, v5.size()); - assertTrue("Does not contain 1.0.", v5.contains(new Version("1.0"))); - assertTrue("Does not contain 2.0.", v5.contains(new Version("2.0"))); - break; - case 6 : - assertEquals("Wrong ee name: " + i, "GG-XX/HH", attrs.get("osgi.ee")); - List v6 = (List) attrs.get("version"); - assertEquals("Wrong number of versions: " + i, 2, v6.size()); - assertTrue("Does not contain 1.0.", v6.contains(new Version("1.0"))); - assertTrue("Does not contain 2.0.", v6.contains(new Version("2.0"))); - break; - case 7 : - assertEquals("Wrong ee name: " + i, "II-1.0/JJ-2.0", attrs.get("osgi.ee")); - List v7 = (List) attrs.get("version"); - assertNull("versions is not null", v7); - break; - default : - break; + case 0: + assertEquals("Wrong ee name: " + i, "OSGi/Minimum", attrs.get("osgi.ee")); + List v0 = (List) attrs.get("version"); + assertEquals("Wrong number of versions: " + i, 3, v0.size()); + assertTrue("Does not contain 1.0.", v0.contains(new Version("1.0"))); + assertTrue("Does not contain 1.1.", v0.contains(new Version("1.1"))); + assertTrue("Does not contain 1.2.", v0.contains(new Version("1.2"))); + break; + case 1: + assertEquals("Wrong ee name: " + i, "CDC/Foundation", attrs.get("osgi.ee")); + List v1 = (List) attrs.get("version"); + assertEquals("Wrong number of versions: " + i, 2, v1.size()); + assertTrue("Does not contain 1.0.", v1.contains(new Version("1.0"))); + assertTrue("Does not contain 1.1.", v1.contains(new Version("1.1"))); + break; + case 2: + assertEquals("Wrong ee name: " + i, "JavaSE", attrs.get("osgi.ee")); + List v2 = (List) attrs.get("version"); + assertEquals("Wrong number of versions: " + i, 5, v2.size()); + assertTrue("Does not contain 1.2.", v2.contains(new Version("1.2"))); + assertTrue("Does not contain 1.3.", v2.contains(new Version("1.3"))); + assertTrue("Does not contain 1.4.", v2.contains(new Version("1.4"))); + assertTrue("Does not contain 1.5.", v2.contains(new Version("1.5"))); + assertTrue("Does not contain 1.6.", v2.contains(new Version("1.6"))); + break; + case 3: + assertEquals("Wrong ee name: " + i, "AA/BB", attrs.get("osgi.ee")); + List v3 = (List) attrs.get("version"); + assertNull("versions is not null", v3); + break; + case 4: + assertEquals("Wrong ee name: " + i, "CC-XX/DD-YY", attrs.get("osgi.ee")); + List v4 = (List) attrs.get("version"); + assertNull("versions is not null", v4); + break; + case 5: + assertEquals("Wrong ee name: " + i, "EE/FF-YY", attrs.get("osgi.ee")); + List v5 = (List) attrs.get("version"); + assertEquals("Wrong number of versions: " + i, 2, v5.size()); + assertTrue("Does not contain 1.0.", v5.contains(new Version("1.0"))); + assertTrue("Does not contain 2.0.", v5.contains(new Version("2.0"))); + break; + case 6: + assertEquals("Wrong ee name: " + i, "GG-XX/HH", attrs.get("osgi.ee")); + List v6 = (List) attrs.get("version"); + assertEquals("Wrong number of versions: " + i, 2, v6.size()); + assertTrue("Does not contain 1.0.", v6.contains(new Version("1.0"))); + assertTrue("Does not contain 2.0.", v6.contains(new Version("2.0"))); + break; + case 7: + assertEquals("Wrong ee name: " + i, "II-1.0/JJ-2.0", attrs.get("osgi.ee")); + List v7 = (List) attrs.get("version"); + assertNull("versions is not null", v7); + break; + default: + break; } } @@ -3579,7 +3772,8 @@ public void testEECapabilityRequirement1() throws BundleException { manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "org.eclipse.osgi"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0"); //$NON-NLS-1$ - BundleDescription systemBundle = state.getFactory().createBundleDescription(state, manifest, "org.eclipse.osgi", bundleID++); //$NON-NLS-1$ + BundleDescription systemBundle = state.getFactory().createBundleDescription(state, manifest, "org.eclipse.osgi", //$NON-NLS-1$ + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ @@ -3611,10 +3805,13 @@ public void testEECapabilityRequirement1() throws BundleException { manifest.put(Constants.BUNDLE_REQUIREDEXECUTIONENVIRONMENT, "AA-BB"); //$NON-NLS-1$ BundleDescription e = state.getFactory().createBundleDescription(state, manifest, "D", bundleID++); //$NON-NLS-1$ - Dictionary[] props = new Dictionary[] {new Hashtable(), new Hashtable(), new Hashtable()}; - props[0].put("org.osgi.framework.executionenvironment", "OSGi/Minimum-1.0, OSGi/Minimum-1.1, OSGi/Minimum-1.2, CDC-1.0/Foundation-1.0, CDC-1.1/Foundation-1.1, AA-BB"); //$NON-NLS-1$ //$NON-NLS-2$ - props[1].put("org.osgi.framework.executionenvironment", "OSGi/Minimum-1.0, OSGi/Minimum-1.1, OSGi/Minimum-1.2, JRE-1.1, J2SE-1.2, J2SE-1.3, J2SE-1.4"); //$NON-NLS-1$ //$NON-NLS-2$ - props[2].put("org.osgi.framework.executionenvironment", "OSGi/Minimum-1.0, OSGi/Minimum-1.1, JRE-1.1, J2SE-1.2, J2SE-1.3"); //$NON-NLS-1$ //$NON-NLS-2$ + Dictionary[] props = new Dictionary[] { new Hashtable(), new Hashtable(), new Hashtable() }; + props[0].put("org.osgi.framework.executionenvironment", //$NON-NLS-1$ + "OSGi/Minimum-1.0, OSGi/Minimum-1.1, OSGi/Minimum-1.2, CDC-1.0/Foundation-1.0, CDC-1.1/Foundation-1.1, AA-BB"); //$NON-NLS-1$ + props[1].put("org.osgi.framework.executionenvironment", //$NON-NLS-1$ + "OSGi/Minimum-1.0, OSGi/Minimum-1.1, OSGi/Minimum-1.2, JRE-1.1, J2SE-1.2, J2SE-1.3, J2SE-1.4"); //$NON-NLS-1$ + props[2].put("org.osgi.framework.executionenvironment", //$NON-NLS-1$ + "OSGi/Minimum-1.0, OSGi/Minimum-1.1, JRE-1.1, J2SE-1.2, J2SE-1.3"); //$NON-NLS-1$ state.setPlatformProperties(props); state.addBundle(systemBundle); @@ -3650,9 +3847,12 @@ public void testEECapabilityRequirement1() throws BundleException { List wiresE = wiringE.getRequiredWires("osgi.ee"); assertEquals("2.4", 1, wiresE.size()); - props[0].put("org.osgi.framework.system.capabilities", "osgi.ee; osgi.ee=\"OSGi/Minimum\"; version:List=\"1.0, 1.1, 1.2\", osgi.ee; osgi.ee=\"CDC/Foundation\"; version:List=\"1.0, 1.1\", osgi.ee; osgi.ee=\"AA-BB\""); //$NON-NLS-1$ //$NON-NLS-2$ - props[1].put("org.osgi.framework.system.capabilities", "osgi.ee; osgi.ee=\"OSGi/Minimum\"; version:List=\"1.0, 1.1, 1.2\", osgi.ee; osgi.ee=\"JavaSE\"; version:List=\"1.0, 1.1, 1.2, 1.3, 1.4\""); //$NON-NLS-1$ //$NON-NLS-2$ - props[2].put("org.osgi.framework.system.capabilities", "osgi.ee; osgi.ee=\"OSGi/Minimum\"; version:List=\"1.0, 1.1\", osgi.ee; osgi.ee=\"JavaSE\"; version:List=\"1.0, 1.1, 1.2, 1.3\""); //$NON-NLS-1$ //$NON-NLS-2$ + props[0].put("org.osgi.framework.system.capabilities", //$NON-NLS-1$ + "osgi.ee; osgi.ee=\"OSGi/Minimum\"; version:List=\"1.0, 1.1, 1.2\", osgi.ee; osgi.ee=\"CDC/Foundation\"; version:List=\"1.0, 1.1\", osgi.ee; osgi.ee=\"AA-BB\""); //$NON-NLS-1$ + props[1].put("org.osgi.framework.system.capabilities", //$NON-NLS-1$ + "osgi.ee; osgi.ee=\"OSGi/Minimum\"; version:List=\"1.0, 1.1, 1.2\", osgi.ee; osgi.ee=\"JavaSE\"; version:List=\"1.0, 1.1, 1.2, 1.3, 1.4\""); //$NON-NLS-1$ + props[2].put("org.osgi.framework.system.capabilities", //$NON-NLS-1$ + "osgi.ee; osgi.ee=\"OSGi/Minimum\"; version:List=\"1.0, 1.1\", osgi.ee; osgi.ee=\"JavaSE\"; version:List=\"1.0, 1.1, 1.2, 1.3\""); //$NON-NLS-1$ state.setPlatformProperties(props); state.resolve(false); @@ -3689,7 +3889,8 @@ public void testEEBug377510() throws BundleException { manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "org.eclipse.osgi"); //$NON-NLS-1$ - BundleDescription systemBundle = state.getFactory().createBundleDescription(state, manifest, "org.eclipse.osgi", bundleID++); //$NON-NLS-1$ + BundleDescription systemBundle = state.getFactory().createBundleDescription(state, manifest, "org.eclipse.osgi", //$NON-NLS-1$ + bundleID++); state.addBundle(systemBundle); List bundles = new ArrayList(); @@ -3712,7 +3913,8 @@ public void testEEBug377510() throws BundleException { bundles.add(aFrag); state.addBundle(aFrag); - Dictionary[] props = new Dictionary[] {new Hashtable(), new Hashtable(), new Hashtable(), new Hashtable(), new Hashtable(), new Hashtable(), new Hashtable(), new Hashtable()}; + Dictionary[] props = new Dictionary[] { new Hashtable(), new Hashtable(), new Hashtable(), new Hashtable(), + new Hashtable(), new Hashtable(), new Hashtable(), new Hashtable() }; props[0].put("org.osgi.framework.executionenvironment", "J2SE-1.5"); props[0].put(Constants.FRAMEWORK_SYSTEMPACKAGES_EXTRA, "test"); props[1].put("org.osgi.framework.executionenvironment", "J2SE-1.5, JavaSE-1.6"); @@ -3729,14 +3931,15 @@ public void testImportJavaPackages() throws Exception { State state = buildEmptyState(); int bundleID = 0; Hashtable manifest = new Hashtable(); - Dictionary[] props = new Dictionary[] {new Hashtable()}; + Dictionary[] props = new Dictionary[] { new Hashtable() }; props[0].put("org.osgi.framework.executionenvironment", "J2SE-1.5, JavaSE-1.6"); props[0].put(Constants.FRAMEWORK_SYSTEMPACKAGES, "java.lang,java.util"); state.setPlatformProperties(props); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); manifest.put(Constants.BUNDLE_SYMBOLICNAME, "org.eclipse.osgi"); - BundleDescription systemBundle = state.getFactory().createBundleDescription(state, manifest, "org.eclipse.osgi", bundleID++); + BundleDescription systemBundle = state.getFactory().createBundleDescription(state, manifest, "org.eclipse.osgi", + bundleID++); state.addBundle(systemBundle); List bundles = new ArrayList(); @@ -3776,11 +3979,12 @@ public void testImportJavaPackages() throws Exception { } - private ExportPackageDescription[] isConsistent(ExportPackageDescription[] pkgs1, ExportPackageDescription[] pkgs2) { + private ExportPackageDescription[] isConsistent(ExportPackageDescription[] pkgs1, + ExportPackageDescription[] pkgs2) { for (ExportPackageDescription pkg1 : pkgs1) { for (ExportPackageDescription pkg2 : pkgs2) { if (pkg1.getName().equals(pkg2.getName()) && pkg1 != pkg2) { - return new ExportPackageDescription[]{pkg1, pkg2}; + return new ExportPackageDescription[] { pkg1, pkg2 }; } } } @@ -3820,34 +4024,39 @@ public void testSelectionPolicy() throws BundleException { manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "test.host; singleton:=true"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ - BundleDescription testHost100 = state.getFactory().createBundleDescription(state, manifest, "test.host100", bundleID++); //$NON-NLS-1$ + BundleDescription testHost100 = state.getFactory().createBundleDescription(state, manifest, "test.host100", //$NON-NLS-1$ + bundleID++); manifest = new Hashtable(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "test.host; singleton:=true"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.1"); //$NON-NLS-1$ - BundleDescription testHost101 = state.getFactory().createBundleDescription(state, manifest, "test.host101", bundleID++); //$NON-NLS-1$ + BundleDescription testHost101 = state.getFactory().createBundleDescription(state, manifest, "test.host101", //$NON-NLS-1$ + bundleID++); manifest = new Hashtable(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "test.frag; singleton:=true"); //$NON-NLS-1$ manifest.put(Constants.FRAGMENT_HOST, "test.host; bundle-version=\"[1.0.0,2.0.0)\""); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ - BundleDescription testFrag100 = state.getFactory().createBundleDescription(state, manifest, "test.frag100", bundleID++); //$NON-NLS-1$ + BundleDescription testFrag100 = state.getFactory().createBundleDescription(state, manifest, "test.frag100", //$NON-NLS-1$ + bundleID++); manifest = new Hashtable(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "test.frag; singleton:=true"); //$NON-NLS-1$ manifest.put(Constants.FRAGMENT_HOST, "test.host; bundle-version=\"[1.0.0,2.0.0)\""); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.1"); //$NON-NLS-1$ - BundleDescription testFrag101 = state.getFactory().createBundleDescription(state, manifest, "test.frag101", bundleID++); //$NON-NLS-1$ + BundleDescription testFrag101 = state.getFactory().createBundleDescription(state, manifest, "test.frag101", //$NON-NLS-1$ + bundleID++); manifest = new Hashtable(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "test.dependent; singleton:=true"); //$NON-NLS-1$ manifest.put(Constants.REQUIRE_BUNDLE, "test.host; bundle-version=\"[1.0.0,2.0.0)\""); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ - BundleDescription testDependent = state.getFactory().createBundleDescription(state, manifest, "test.frag101", bundleID++); //$NON-NLS-1$ + BundleDescription testDependent = state.getFactory().createBundleDescription(state, manifest, "test.frag101", //$NON-NLS-1$ + bundleID++); state.addBundle(testHost100); state.addBundle(testFrag100); @@ -3869,34 +4078,39 @@ public void testBug187616() throws BundleException { manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "test.host; singleton:=true"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ - BundleDescription testHost100 = state.getFactory().createBundleDescription(state, manifest, "test.host100", bundleID++); //$NON-NLS-1$ + BundleDescription testHost100 = state.getFactory().createBundleDescription(state, manifest, "test.host100", //$NON-NLS-1$ + bundleID++); manifest = new Hashtable(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "test.host; singleton:=true"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.1"); //$NON-NLS-1$ - BundleDescription testHost101 = state.getFactory().createBundleDescription(state, manifest, "test.host101", bundleID++); //$NON-NLS-1$ + BundleDescription testHost101 = state.getFactory().createBundleDescription(state, manifest, "test.host101", //$NON-NLS-1$ + bundleID++); manifest = new Hashtable(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "test.frag; singleton:=true"); //$NON-NLS-1$ manifest.put(Constants.FRAGMENT_HOST, "test.host; bundle-version=\"[1.0.0,2.0.0)\""); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ - BundleDescription testFrag100 = state.getFactory().createBundleDescription(state, manifest, "test.frag100", bundleID++); //$NON-NLS-1$ + BundleDescription testFrag100 = state.getFactory().createBundleDescription(state, manifest, "test.frag100", //$NON-NLS-1$ + bundleID++); manifest = new Hashtable(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "test.frag; singleton:=true"); //$NON-NLS-1$ manifest.put(Constants.FRAGMENT_HOST, "test.host; bundle-version=\"[1.0.0,2.0.0)\""); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.1"); //$NON-NLS-1$ - BundleDescription testFrag101 = state.getFactory().createBundleDescription(state, manifest, "test.frag101", bundleID++); //$NON-NLS-1$ + BundleDescription testFrag101 = state.getFactory().createBundleDescription(state, manifest, "test.frag101", //$NON-NLS-1$ + bundleID++); manifest = new Hashtable(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "test.dependent; singleton:=true"); //$NON-NLS-1$ manifest.put(Constants.REQUIRE_BUNDLE, "test.host; bundle-version=\"[1.0.0,2.0.0)\""); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ - BundleDescription testDependent = state.getFactory().createBundleDescription(state, manifest, "test.frag101", bundleID++); //$NON-NLS-1$ + BundleDescription testDependent = state.getFactory().createBundleDescription(state, manifest, "test.frag101", //$NON-NLS-1$ + bundleID++); state.addBundle(testHost100); state.addBundle(testFrag100); @@ -3920,7 +4134,8 @@ public void testBug217150() throws BundleException { manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "test.host; singleton:=true"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ - BundleDescription testHost100 = state.getFactory().createBundleDescription(state, manifest, "test.host100", bundleID++); //$NON-NLS-1$ + BundleDescription testHost100 = state.getFactory().createBundleDescription(state, manifest, "test.host100", //$NON-NLS-1$ + bundleID++); try { testHost100.getFragments(); @@ -3934,7 +4149,8 @@ public void testBug217150() throws BundleException { manifest.put(Constants.BUNDLE_SYMBOLICNAME, "test.frag; singleton:=true"); //$NON-NLS-1$ manifest.put(Constants.FRAGMENT_HOST, "test.host; bundle-version=\"[1.0.0,2.0.0)\""); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ - BundleDescription testFrag100 = state.getFactory().createBundleDescription(state, manifest, "test.frag100", bundleID++); //$NON-NLS-1$ + BundleDescription testFrag100 = state.getFactory().createBundleDescription(state, manifest, "test.frag100", //$NON-NLS-1$ + bundleID++); BundleDescription[] hosts = testFrag100.getHost().getHosts(); assertNotNull("hosts is null", hosts); //$NON-NLS-1$ assertEquals("Unexpected number of hosts", 0, hosts.length); //$NON-NLS-1$ @@ -3942,7 +4158,7 @@ public void testBug217150() throws BundleException { public void testNativeCodeResolution01() throws BundleException { State state = buildEmptyState(); - Dictionary[] props = new Dictionary[] {new Hashtable()}; + Dictionary[] props = new Dictionary[] { new Hashtable() }; props[0].put("osgi.ws", "win32"); //$NON-NLS-1$ //$NON-NLS-2$ props[0].put("osgi.os", "win32"); //$NON-NLS-1$ //$NON-NLS-2$ props[0].put("osgi.arch", "x86"); //$NON-NLS-1$ //$NON-NLS-2$ @@ -3954,8 +4170,10 @@ public void testNativeCodeResolution01() throws BundleException { manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "NativeBundle"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ - manifest.put(Constants.BUNDLE_NATIVECODE, "Bundle-NativeCode: nativefile1.txt;processor=x86;osname=Windows2000;osname=\"Windows 2003\";osname=Windows95;osname=Windows98;osname=WindowsNT;osname=WindowsXP;osname=\"Windows NT (unknown)\";osname=\"Windows Vista\"; language=en"); //$NON-NLS-1$ - BundleDescription testNativeBundle = state.getFactory().createBundleDescription(state, manifest, "NativeBundle", bundleID++); //$NON-NLS-1$ + manifest.put(Constants.BUNDLE_NATIVECODE, + "Bundle-NativeCode: nativefile1.txt;processor=x86;osname=Windows2000;osname=\"Windows 2003\";osname=Windows95;osname=Windows98;osname=WindowsNT;osname=WindowsXP;osname=\"Windows NT (unknown)\";osname=\"Windows Vista\"; language=en"); //$NON-NLS-1$ + BundleDescription testNativeBundle = state.getFactory().createBundleDescription(state, manifest, "NativeBundle", //$NON-NLS-1$ + bundleID++); state.addBundle(testNativeBundle); state.resolve(); assertTrue("1.0", testNativeBundle.isResolved()); //$NON-NLS-1$ @@ -3964,7 +4182,7 @@ public void testNativeCodeResolution01() throws BundleException { public void testNativeCodeResolution02() throws BundleException { State state = buildEmptyState(); - Dictionary[] props = new Dictionary[] {new Hashtable()}; + Dictionary[] props = new Dictionary[] { new Hashtable() }; props[0].put(Constants.FRAMEWORK_OS_NAME, "WIN32"); // Use different case for osname //$NON-NLS-1$ props[0].put(Constants.FRAMEWORK_PROCESSOR, "x86"); //$NON-NLS-1$ state.setPlatformProperties(props); @@ -3974,8 +4192,10 @@ public void testNativeCodeResolution02() throws BundleException { manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "NativeBundle"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ - manifest.put(Constants.BUNDLE_NATIVECODE, "Bundle-NativeCode: nativefile1.txt;processor=x86;osname=Windows2000;osname=\"Windows 2003\";osname=Windows95;osname=Windows98;osname=WindowsNT;osname=WindowsXP;osname=\"Windows NT (unknown)\";osname=\"Windows Vista\""); //$NON-NLS-1$ - BundleDescription testNativeBundle = state.getFactory().createBundleDescription(state, manifest, "NativeBundle", bundleID++); //$NON-NLS-1$ + manifest.put(Constants.BUNDLE_NATIVECODE, + "Bundle-NativeCode: nativefile1.txt;processor=x86;osname=Windows2000;osname=\"Windows 2003\";osname=Windows95;osname=Windows98;osname=WindowsNT;osname=WindowsXP;osname=\"Windows NT (unknown)\";osname=\"Windows Vista\""); //$NON-NLS-1$ + BundleDescription testNativeBundle = state.getFactory().createBundleDescription(state, manifest, "NativeBundle", //$NON-NLS-1$ + bundleID++); state.addBundle(testNativeBundle); state.resolve(); assertTrue("1.0", testNativeBundle.isResolved()); //$NON-NLS-1$ @@ -3983,7 +4203,7 @@ public void testNativeCodeResolution02() throws BundleException { public void testNativeCodeResolution03() throws BundleException { State state = buildEmptyState(); - Dictionary[] props = new Dictionary[] {new Hashtable()}; + Dictionary[] props = new Dictionary[] { new Hashtable() }; props[0].put(Constants.FRAMEWORK_OS_NAME, "win32"); //$NON-NLS-1$ props[0].put(Constants.FRAMEWORK_PROCESSOR, "X86"); // Use different case for processor //$NON-NLS-1$ state.setPlatformProperties(props); @@ -3993,8 +4213,10 @@ public void testNativeCodeResolution03() throws BundleException { manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "NativeBundle"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ - manifest.put(Constants.BUNDLE_NATIVECODE, "Bundle-NativeCode: nativefile1.txt;processor=x86;osname=Windows2000;osname=\"Windows 2003\";osname=Windows95;osname=Windows98;osname=WindowsNT;osname=WindowsXP;osname=\"Windows NT (unknown)\";osname=\"Windows Vista\""); //$NON-NLS-1$ - BundleDescription testNativeBundle = state.getFactory().createBundleDescription(state, manifest, "NativeBundle", bundleID++); //$NON-NLS-1$ + manifest.put(Constants.BUNDLE_NATIVECODE, + "Bundle-NativeCode: nativefile1.txt;processor=x86;osname=Windows2000;osname=\"Windows 2003\";osname=Windows95;osname=Windows98;osname=WindowsNT;osname=WindowsXP;osname=\"Windows NT (unknown)\";osname=\"Windows Vista\""); //$NON-NLS-1$ + BundleDescription testNativeBundle = state.getFactory().createBundleDescription(state, manifest, "NativeBundle", //$NON-NLS-1$ + bundleID++); state.addBundle(testNativeBundle); state.resolve(); assertTrue("1.0", testNativeBundle.isResolved()); //$NON-NLS-1$ @@ -4002,7 +4224,7 @@ public void testNativeCodeResolution03() throws BundleException { public void testNativeCodeResolution04() throws BundleException { State state = buildEmptyState(); - Dictionary[] props = new Dictionary[] {new Hashtable()}; + Dictionary[] props = new Dictionary[] { new Hashtable() }; props[0].put(Constants.FRAMEWORK_OS_NAME, "DoesNotExist"); // Use different case for osname //$NON-NLS-1$ props[0].put(Constants.FRAMEWORK_PROCESSOR, "InVaLid"); // Use different case for processor //$NON-NLS-1$ state.setPlatformProperties(props); @@ -4012,8 +4234,10 @@ public void testNativeCodeResolution04() throws BundleException { manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "NativeBundle"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ - manifest.put(Constants.BUNDLE_NATIVECODE, "Bundle-NativeCode: nativefile1.txt;processor=iNvAlid;osname=doeSnoTexist"); //$NON-NLS-1$ - BundleDescription testNativeBundle = state.getFactory().createBundleDescription(state, manifest, "NativeBundle", bundleID++); //$NON-NLS-1$ + manifest.put(Constants.BUNDLE_NATIVECODE, + "Bundle-NativeCode: nativefile1.txt;processor=iNvAlid;osname=doeSnoTexist"); //$NON-NLS-1$ + BundleDescription testNativeBundle = state.getFactory().createBundleDescription(state, manifest, "NativeBundle", //$NON-NLS-1$ + bundleID++); state.addBundle(testNativeBundle); state.resolve(); assertTrue("1.0", testNativeBundle.isResolved()); //$NON-NLS-1$ @@ -4021,7 +4245,7 @@ public void testNativeCodeResolution04() throws BundleException { public void testNativeCodeResolution05() throws BundleException { State state = buildEmptyState(); - Dictionary[] props = new Dictionary[] {new Hashtable(), new Hashtable(), new Hashtable()}; + Dictionary[] props = new Dictionary[] { new Hashtable(), new Hashtable(), new Hashtable() }; props[0].put("osgi.ws", "win32"); //$NON-NLS-1$ //$NON-NLS-2$ props[0].put("osgi.os", "win32"); //$NON-NLS-1$ //$NON-NLS-2$ @@ -4047,22 +4271,28 @@ public void testNativeCodeResolution05() throws BundleException { manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "NativeBundle1"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ - manifest.put(Constants.BUNDLE_NATIVECODE, "Bundle-NativeCode: nativefile1.txt;processor=x86;osname=win32; language=en"); //$NON-NLS-1$ - BundleDescription testNativeBundle1 = state.getFactory().createBundleDescription(state, manifest, "NativeBundle", bundleID++); //$NON-NLS-1$ + manifest.put(Constants.BUNDLE_NATIVECODE, + "Bundle-NativeCode: nativefile1.txt;processor=x86;osname=win32; language=en"); //$NON-NLS-1$ + BundleDescription testNativeBundle1 = state.getFactory().createBundleDescription(state, manifest, + "NativeBundle", bundleID++); //$NON-NLS-1$ manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "NativeBundle2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ - manifest.put(Constants.BUNDLE_NATIVECODE, "Bundle-NativeCode: nativefile1.txt;processor=x86_64;osname=win32; language=en"); //$NON-NLS-1$ - BundleDescription testNativeBundle2 = state.getFactory().createBundleDescription(state, manifest, "NativeBundle", bundleID++); //$NON-NLS-1$ + manifest.put(Constants.BUNDLE_NATIVECODE, + "Bundle-NativeCode: nativefile1.txt;processor=x86_64;osname=win32; language=en"); //$NON-NLS-1$ + BundleDescription testNativeBundle2 = state.getFactory().createBundleDescription(state, manifest, + "NativeBundle", bundleID++); //$NON-NLS-1$ manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "NativeBundle3"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ - manifest.put(Constants.BUNDLE_NATIVECODE, "Bundle-NativeCode: nativefile1.txt;processor=x86;osname=win32; language=fr"); //$NON-NLS-1$ - BundleDescription testNativeBundle3 = state.getFactory().createBundleDescription(state, manifest, "NativeBundle", bundleID++); //$NON-NLS-1$ + manifest.put(Constants.BUNDLE_NATIVECODE, + "Bundle-NativeCode: nativefile1.txt;processor=x86;osname=win32; language=fr"); //$NON-NLS-1$ + BundleDescription testNativeBundle3 = state.getFactory().createBundleDescription(state, manifest, + "NativeBundle", bundleID++); //$NON-NLS-1$ state.addBundle(testNativeBundle1); state.addBundle(testNativeBundle2); @@ -4075,7 +4305,7 @@ public void testNativeCodeResolution05() throws BundleException { public void testNativeCodeResolution06() throws BundleException { State state = buildEmptyState(); - Dictionary[] props = new Dictionary[] {new Hashtable(), new Hashtable(), new Hashtable()}; + Dictionary[] props = new Dictionary[] { new Hashtable(), new Hashtable(), new Hashtable() }; // empty props[0] @@ -4097,7 +4327,8 @@ public void testNativeCodeResolution06() throws BundleException { manifest.put(Constants.BUNDLE_SYMBOLICNAME, "NativeBundle1"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_NATIVECODE, "Bundle-NativeCode: nativefile1.txt;processor=x86;osname=win32"); //$NON-NLS-1$ - BundleDescription testNativeBundle1 = state.getFactory().createBundleDescription(state, manifest, "NativeBundle", bundleID++); //$NON-NLS-1$ + BundleDescription testNativeBundle1 = state.getFactory().createBundleDescription(state, manifest, + "NativeBundle", bundleID++); //$NON-NLS-1$ state.addBundle(testNativeBundle1); state.resolve(); @@ -4197,7 +4428,7 @@ public void testMultiStateAdd02() throws BundleException { assertTrue("1.2", rcp10.isResolved()); //$NON-NLS-1$ assertTrue("1.3", gef10.isResolved()); //$NON-NLS-1$ - // remove the rcp10 bundle. The bundle will be removal pending + // remove the rcp10 bundle. The bundle will be removal pending // this should still throw an exception until the removal is no longer pending state1.removeBundle(rcp10); State state2 = buildEmptyState(); @@ -4251,10 +4482,10 @@ public void testMultiStateAdd03() throws BundleException { assertTrue("1.2", rcp10.isResolved()); //$NON-NLS-1$ assertTrue("1.3", gef10.isResolved()); //$NON-NLS-1$ - // remove the rcp10 bundle. The bundle will be removal pending + // remove the rcp10 bundle. The bundle will be removal pending // this should still throw an exception until the removal is no longer pending state1.removeBundle(rcp10); - state1.resolve(new BundleDescription[] {rcp10}); + state1.resolve(new BundleDescription[] { rcp10 }); State state2 = buildEmptyState(); try { @@ -4274,14 +4505,18 @@ private State createBug266935State() throws BundleException { manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "a"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ - BundleDescription a = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription a = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "b"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.REQUIRE_BUNDLE, "a"); //$NON-NLS-1$ - BundleDescription b = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription b = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + manifest.get(Constants.BUNDLE_VERSION), + bundleID++); state.addBundle(a); state.addBundle(b); @@ -4297,7 +4532,9 @@ private BundleDescription updateStateBug266935(State state, BundleDescription a) manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, a.getSymbolicName()); manifest.put(Constants.BUNDLE_VERSION, a.getVersion().toString()); - BundleDescription newA = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + manifest.get(Constants.BUNDLE_VERSION), a.getBundleId()); + BundleDescription newA = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + manifest.get(Constants.BUNDLE_VERSION), + a.getBundleId()); state.updateBundle(newA); return newA; } @@ -4307,7 +4544,7 @@ public void testBug266935_01() throws BundleException { BundleDescription a = state.getBundle("a", new Version("1.0")); //$NON-NLS-1$ //$NON-NLS-2$ BundleDescription newA = updateStateBug266935(state, a); state.removeBundle(a); - state.resolve(new BundleDescription[] {newA}); + state.resolve(new BundleDescription[] { newA }); } public void testBug266935_02() throws BundleException { @@ -4315,7 +4552,7 @@ public void testBug266935_02() throws BundleException { BundleDescription a = state.getBundle("a", new Version("1.0")); //$NON-NLS-1$ //$NON-NLS-2$ updateStateBug266935(state, a); state.removeBundle(a); - state.resolve(new BundleDescription[] {a}); + state.resolve(new BundleDescription[] { a }); } public void testBug266935_03() throws BundleException { @@ -4323,7 +4560,7 @@ public void testBug266935_03() throws BundleException { BundleDescription a = state.getBundle("a", new Version("1.0")); //$NON-NLS-1$ //$NON-NLS-2$ BundleDescription newA = updateStateBug266935(state, a); state.removeBundle(newA); - state.resolve(new BundleDescription[] {newA}); + state.resolve(new BundleDescription[] { newA }); } public void testBug266935_04() throws BundleException { @@ -4331,7 +4568,7 @@ public void testBug266935_04() throws BundleException { BundleDescription a = state.getBundle("a", new Version("1.0")); //$NON-NLS-1$ //$NON-NLS-2$ BundleDescription newA = updateStateBug266935(state, a); state.removeBundle(newA); - state.resolve(new BundleDescription[] {a}); + state.resolve(new BundleDescription[] { a }); } public void testBug320124() throws BundleException { @@ -4343,7 +4580,9 @@ public void testBug320124() throws BundleException { manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "a"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ - BundleDescription a = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription a = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ @@ -4351,7 +4590,9 @@ public void testBug320124() throws BundleException { manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.FRAGMENT_HOST, "a"); //$NON-NLS-1$ manifest.put(Constants.REQUIRE_BUNDLE, "d"); //$NON-NLS-1$ - BundleDescription b = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription b = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ @@ -4359,21 +4600,27 @@ public void testBug320124() throws BundleException { manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.FRAGMENT_HOST, "a"); //$NON-NLS-1$ manifest.put(Constants.REQUIRE_BUNDLE, "e"); //$NON-NLS-1$ - BundleDescription c = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription c = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "d"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.EXPORT_PACKAGE, "d"); //$NON-NLS-1$ - BundleDescription d = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription d = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "e"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.EXPORT_PACKAGE, "e"); //$NON-NLS-1$ - BundleDescription e = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription e = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + manifest.get(Constants.BUNDLE_VERSION), + bundleID++); state.addBundle(a); state.addBundle(b); @@ -4387,7 +4634,8 @@ public void testBug320124() throws BundleException { assertTrue("C is not resolved", c.isResolved()); //$NON-NLS-1$ assertTrue("D is not resolved", d.isResolved()); //$NON-NLS-1$ - ExportPackageDescription[] visible = state.getStateHelper().getVisiblePackages(a, StateHelper.VISIBLE_INCLUDE_EE_PACKAGES | StateHelper.VISIBLE_INCLUDE_ALL_HOST_WIRES); + ExportPackageDescription[] visible = state.getStateHelper().getVisiblePackages(a, + StateHelper.VISIBLE_INCLUDE_EE_PACKAGES | StateHelper.VISIBLE_INCLUDE_ALL_HOST_WIRES); assertEquals("Wrong number of visible", 2, visible.length); } @@ -4442,7 +4690,7 @@ public void testCycleBug570984() throws BundleException { public static class CatchAllValue { public CatchAllValue(String s) { - //do nothing + // do nothing } @Override @@ -4457,11 +4705,14 @@ public void testBug324618() throws BundleException { Dictionary manifest; manifest = loadManifest("p1.MF"); - BundleDescription p1 = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); + BundleDescription p1 = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); manifest = loadManifest("p2.MF"); - BundleDescription p2 = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); + BundleDescription p2 = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); manifest = loadManifest("c1.MF"); - BundleDescription c1 = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); + BundleDescription c1 = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); state.addBundle(p1); state.addBundle(p2); @@ -4485,10 +4736,12 @@ public void testRequirements() throws BundleException, InvalidSyntaxException, I Dictionary manifest; manifest = loadManifest("r1.MF"); - BundleDescription hostDescription = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); + BundleDescription hostDescription = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); state.addBundle(hostDescription); manifest = loadManifest("r2.MF"); - BundleDescription fragDescription = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); + BundleDescription fragDescription = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); state.addBundle(fragDescription); doTestRequirements(hostDescription, fragDescription); @@ -4504,7 +4757,8 @@ public void testRequirements() throws BundleException, InvalidSyntaxException, I doTestRequirements(hostDescription, fragDescription); } - private void doTestRequirements(BundleRevision hostRevision, BundleRevision fragRevision) throws InvalidSyntaxException { + private void doTestRequirements(BundleRevision hostRevision, BundleRevision fragRevision) + throws InvalidSyntaxException { List pReqs = hostRevision.getDeclaredRequirements(BundleRevision.PACKAGE_NAMESPACE); assertEquals("Wrong number of reqs: " + BundleRevision.PACKAGE_NAMESPACE, 8, pReqs.size()); @@ -4535,7 +4789,8 @@ private void doTestRequirements(BundleRevision hostRevision, BundleRevision frag matchingAttrs.put(BundleRevision.PACKAGE_NAMESPACE, "importer.pkg8"); matchingAttrs.put("a1", "v1"); matchingAttrs.put("a2", "v2"); - checkRequirement((BundleRequirement) pReqs.get(7), matchingAttrs, null, "(&(resolution=optional)(d1=v1)(d2=v2))", true); + checkRequirement((BundleRequirement) pReqs.get(7), matchingAttrs, null, + "(&(resolution=optional)(d1=v1)(d2=v2))", true); matchingAttrs.clear(); List bReqs = hostRevision.getDeclaredRequirements(BundleRevision.BUNDLE_NAMESPACE); @@ -4543,10 +4798,12 @@ private void doTestRequirements(BundleRevision hostRevision, BundleRevision frag matchingAttrs.put(BundleRevision.BUNDLE_NAMESPACE, "requirer.b1"); matchingAttrs.put(Constants.BUNDLE_VERSION_ATTRIBUTE, new Version("1.1")); - checkRequirement((BundleRequirement) bReqs.get(0), matchingAttrs, null, "(&(visibility=reexport)(resolution=optional))", true); + checkRequirement((BundleRequirement) bReqs.get(0), matchingAttrs, null, + "(&(visibility=reexport)(resolution=optional))", true); matchingAttrs.put(BundleRevision.BUNDLE_NAMESPACE, "requirer.b2"); - checkRequirement((BundleRequirement) bReqs.get(1), matchingAttrs, null, "(&(|(visibility=private)(!(visibility=*)))(|(resolution=mandatory)(!(resolution=*))))", true); + checkRequirement((BundleRequirement) bReqs.get(1), matchingAttrs, null, + "(&(|(visibility=private)(!(visibility=*)))(|(resolution=mandatory)(!(resolution=*))))", true); matchingAttrs.put(BundleRevision.BUNDLE_NAMESPACE, "requirer.b3"); checkRequirement((BundleRequirement) bReqs.get(2), matchingAttrs, null, null, true); @@ -4566,24 +4823,28 @@ private void doTestRequirements(BundleRevision hostRevision, BundleRevision frag matchingAttrs.put(BundleRevision.BUNDLE_NAMESPACE, "requirer.b8"); matchingAttrs.put("a1", "v1"); matchingAttrs.put("a2", "v2"); - checkRequirement((BundleRequirement) bReqs.get(7), matchingAttrs, null, "(&(resolution=optional)(d1=v1)(d2=v2))", true); + checkRequirement((BundleRequirement) bReqs.get(7), matchingAttrs, null, + "(&(resolution=optional)(d1=v1)(d2=v2))", true); matchingAttrs.clear(); List cReqs = hostRevision.getDeclaredRequirements("require.c1"); assertEquals("Wrong number of reqs: require.c1", 1, cReqs.size()); matchingAttrs.put("a1", "v1"); - checkRequirement((BundleRequirement) cReqs.get(0), matchingAttrs, null, "(&(|(effective=resolve)(!(effective=*)))(resolution=optional)(filter=\\(a1=v1\\)))", true); + checkRequirement((BundleRequirement) cReqs.get(0), matchingAttrs, null, + "(&(|(effective=resolve)(!(effective=*)))(resolution=optional)(filter=\\(a1=v1\\)))", true); cReqs = hostRevision.getDeclaredRequirements("require.c2"); assertEquals("Wrong number of reqs: require.c2", 1, cReqs.size()); matchingAttrs.clear(); - checkRequirement((BundleRequirement) cReqs.get(0), matchingAttrs, null, "(&(|(effective=resolve)(!(effective=*)))(|(resolution=mandatory)(!(resolution=*))))", false); + checkRequirement((BundleRequirement) cReqs.get(0), matchingAttrs, null, + "(&(|(effective=resolve)(!(effective=*)))(|(resolution=mandatory)(!(resolution=*))))", false); cReqs = hostRevision.getDeclaredRequirements("require.c3"); assertEquals("Wrong number of reqs: require.c3", 1, cReqs.size()); matchingAttrs.clear(); - checkRequirement((BundleRequirement) cReqs.get(0), matchingAttrs, "(&(a1=v1)(a2=v2))", "(&(resolution=optional)(d1=v1)(d2=v2))", false); + checkRequirement((BundleRequirement) cReqs.get(0), matchingAttrs, "(&(a1=v1)(a2=v2))", + "(&(resolution=optional)(d1=v1)(d2=v2))", false); List fReqs = fragRevision.getDeclaredRequirements(BundleRevision.HOST_NAMESPACE); assertEquals("Wrong number of host reqs: " + BundleRevision.HOST_NAMESPACE, 1, fReqs.size()); @@ -4595,7 +4856,8 @@ private void doTestRequirements(BundleRevision hostRevision, BundleRevision frag checkRequirement((BundleRequirement) fReqs.get(0), matchingAttrs, null, "(&(d1=v1)(d2=v2))", true); } - private void checkRequirement(BundleRequirement req, Map matchingAttrs, String attributesFilterSpec, String directivesFilterSpec, boolean reqFilter) throws InvalidSyntaxException { + private void checkRequirement(BundleRequirement req, Map matchingAttrs, String attributesFilterSpec, + String directivesFilterSpec, boolean reqFilter) throws InvalidSyntaxException { if (attributesFilterSpec == null) { assertTrue("Requirement attrs is not empty: " + req, req.getAttributes().isEmpty()); } else { @@ -4613,7 +4875,8 @@ private void checkRequirement(BundleRequirement req, Map matchingAttrs, String a } if (directivesFilterSpec != null) { Filter directivesFilter = FrameworkUtil.createFilter(directivesFilterSpec); - assertTrue("Cannot match directive filter: " + directivesFilterSpec, directivesFilter.matches(req.getDirectives())); + assertTrue("Cannot match directive filter: " + directivesFilterSpec, + directivesFilter.matches(req.getDirectives())); } } @@ -4623,7 +4886,8 @@ public void testCapabilities() throws InvalidSyntaxException, BundleException, I Dictionary manifest; manifest = loadManifest("r1.MF"); - BundleDescription hostDescription = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); + BundleDescription hostDescription = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); state.addBundle(hostDescription); doTestCapabilities(hostDescription); @@ -4639,35 +4903,47 @@ public void testCapabilities() throws InvalidSyntaxException, BundleException, I private void doTestCapabilities(BundleRevision hostRevision) throws InvalidSyntaxException { List bundleCaps = hostRevision.getDeclaredCapabilities(BundleRevision.BUNDLE_NAMESPACE); assertEquals("Wrong number of: " + BundleRevision.BUNDLE_NAMESPACE, 1, bundleCaps.size()); - checkCapability((BundleCapability) bundleCaps.get(0), "(&(osgi.wiring.bundle=r1)(a1=v1)(a2=v2))", "(&(d1=v1)(d2=v2)(singleton=true)(fragment-attachment=resolve-time))"); + checkCapability((BundleCapability) bundleCaps.get(0), "(&(osgi.wiring.bundle=r1)(a1=v1)(a2=v2))", + "(&(d1=v1)(d2=v2)(singleton=true)(fragment-attachment=resolve-time))"); List hostCaps = hostRevision.getDeclaredCapabilities(BundleRevision.HOST_NAMESPACE); assertEquals("Wrong number of: " + BundleRevision.HOST_NAMESPACE, 1, hostCaps.size()); - checkCapability((BundleCapability) hostCaps.get(0), "(&(osgi.wiring.host=r1)(a1=v1)(a2=v2))", "(&(d1=v1)(d2=v2)(singleton=true)(fragment-attachment=resolve-time))"); + checkCapability((BundleCapability) hostCaps.get(0), "(&(osgi.wiring.host=r1)(a1=v1)(a2=v2))", + "(&(d1=v1)(d2=v2)(singleton=true)(fragment-attachment=resolve-time))"); List pkgCaps = hostRevision.getDeclaredCapabilities(BundleRevision.PACKAGE_NAMESPACE); assertEquals("Wrong number of: " + BundleRevision.PACKAGE_NAMESPACE, 3, pkgCaps.size()); - checkCapability((BundleCapability) pkgCaps.get(0), "(&(osgi.wiring.package=exporter.pkg1)(bundle-symbolic-name=r1)(bundle-version=1.0)(version=1.0))", null); - checkCapability((BundleCapability) pkgCaps.get(1), "(&(osgi.wiring.package=exporter.pkg2)(bundle-symbolic-name=r1)(bundle-version=1.0)(a1=v1)(a2=v2))", "(&(include=C1,C2)(exclude=C3,C4)(mandatory=a1,a2)(uses=importer.pkg1,importer.pkg2))"); - checkCapability((BundleCapability) pkgCaps.get(2), "(&(osgi.wiring.package=exporter.pkg3)(bundle-symbolic-name=r1)(bundle-version=1.0)(a1=v1)(a2=v2))", "(&(mandatory=a1,a2)(d1=v1)(d2=v2))"); + checkCapability((BundleCapability) pkgCaps.get(0), + "(&(osgi.wiring.package=exporter.pkg1)(bundle-symbolic-name=r1)(bundle-version=1.0)(version=1.0))", + null); + checkCapability((BundleCapability) pkgCaps.get(1), + "(&(osgi.wiring.package=exporter.pkg2)(bundle-symbolic-name=r1)(bundle-version=1.0)(a1=v1)(a2=v2))", + "(&(include=C1,C2)(exclude=C3,C4)(mandatory=a1,a2)(uses=importer.pkg1,importer.pkg2))"); + checkCapability((BundleCapability) pkgCaps.get(2), + "(&(osgi.wiring.package=exporter.pkg3)(bundle-symbolic-name=r1)(bundle-version=1.0)(a1=v1)(a2=v2))", + "(&(mandatory=a1,a2)(d1=v1)(d2=v2))"); List gCaps = hostRevision.getDeclaredCapabilities("provide.c1"); assertEquals("Wrong number of: provide.c1", 1, gCaps.size()); - checkCapability((BundleCapability) gCaps.get(0), "(&(a1=v1)(a2=v2))", "(&(|(effective=resolve)(!(effective=*)))(uses=importer.pkg1,importer.pkg2))"); + checkCapability((BundleCapability) gCaps.get(0), "(&(a1=v1)(a2=v2))", + "(&(|(effective=resolve)(!(effective=*)))(uses=importer.pkg1,importer.pkg2))"); gCaps = hostRevision.getDeclaredCapabilities("provide.c2"); assertEquals("Wrong number of: provide.c1", 1, gCaps.size()); - checkCapability((BundleCapability) gCaps.get(0), "(&(a1=v1)(a2=v2))", "(&(|(effective=resolve)(!(effective=*)))(uses=importer.pkg1,importer.pkg2)(d1=v1)(d2=v2))"); + checkCapability((BundleCapability) gCaps.get(0), "(&(a1=v1)(a2=v2))", + "(&(|(effective=resolve)(!(effective=*)))(uses=importer.pkg1,importer.pkg2)(d1=v1)(d2=v2))"); } - private void checkCapability(BundleCapability cap, String attributeFilterSpec, String directiveFilterSpec) throws InvalidSyntaxException { + private void checkCapability(BundleCapability cap, String attributeFilterSpec, String directiveFilterSpec) + throws InvalidSyntaxException { Filter attributesFilter = FrameworkUtil.createFilter(attributeFilterSpec); assertTrue("Cannot match attribute filter: " + attributesFilter, attributesFilter.matches(cap.getAttributes())); if (directiveFilterSpec != null) { Filter directivesFilter = FrameworkUtil.createFilter(directiveFilterSpec); - assertTrue("Cannot match directive filter: " + directivesFilter, directivesFilter.matches(cap.getDirectives())); + assertTrue("Cannot match directive filter: " + directivesFilter, + directivesFilter.matches(cap.getDirectives())); } } @@ -4682,35 +4958,45 @@ public void testRanges() throws BundleException { manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.EXPORT_PACKAGE, "a; version=1.0.0"); manifest.put(Constants.PROVIDE_CAPABILITY, "test.a; version:Version=1.0.0"); - BundleDescription a = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription a = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "b"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.FRAGMENT_HOST, "a; bundle-version=\"[1.0, 1.1)\""); //$NON-NLS-1$ - BundleDescription b = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription b = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "c"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.IMPORT_PACKAGE, "a; version=\"[1.0,2.0)\""); //$NON-NLS-1$ - BundleDescription c = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription c = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "d"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.REQUIRE_BUNDLE, "a; bundle-version=\"[1.0,2.0)\""); //$NON-NLS-1$ - BundleDescription d = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription d = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "e"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.REQUIRE_CAPABILITY, "test.a; filter:=\"(version>=1.0.0)\""); //$NON-NLS-1$ - BundleDescription e = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription e = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + manifest.get(Constants.BUNDLE_VERSION), + bundleID++); state.addBundle(a); state.addBundle(b); @@ -4728,7 +5014,7 @@ public void testRanges() throws BundleException { public void testBug369880() throws BundleException { State state = buildEmptyState(); - Dictionary[] props = new Dictionary[] {new Hashtable()}; + Dictionary[] props = new Dictionary[] { new Hashtable() }; props[0].put("org.osgi.framework.executionenvironment", "test"); //$NON-NLS-1$ //$NON-NLS-2$ state.setPlatformProperties(props); int bundleID = 0; @@ -4739,7 +5025,9 @@ public void testBug369880() throws BundleException { manifest.put(Constants.BUNDLE_SYMBOLICNAME, "org.eclipse.osgi"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_REQUIREDEXECUTIONENVIRONMENT, "test"); - BundleDescription a = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription a = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ @@ -4747,7 +5035,9 @@ public void testBug369880() throws BundleException { manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.FRAGMENT_HOST, "org.eclipse.osgi; bundle-version=\"[1.0, 1.1)\""); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_REQUIREDEXECUTIONENVIRONMENT, "test"); - BundleDescription b = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription b = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + manifest.get(Constants.BUNDLE_VERSION), + bundleID++); state.addBundle(a); state.resolve(); @@ -4772,7 +5062,7 @@ public void testBug369880() throws BundleException { public void testResolveFragmentEE01() throws BundleException { State state = buildEmptyState(); - Dictionary[] props = new Dictionary[] {new Hashtable()}; + Dictionary[] props = new Dictionary[] { new Hashtable() }; props[0].put("org.osgi.framework.executionenvironment", "test"); //$NON-NLS-1$ //$NON-NLS-2$ state.setPlatformProperties(props); int bundleID = 0; @@ -4783,7 +5073,9 @@ public void testResolveFragmentEE01() throws BundleException { manifest.put(Constants.BUNDLE_SYMBOLICNAME, "org.eclipse.osgi"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_REQUIREDEXECUTIONENVIRONMENT, "test"); - BundleDescription a = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription a = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ @@ -4791,14 +5083,18 @@ public void testResolveFragmentEE01() throws BundleException { manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.FRAGMENT_HOST, "org.eclipse.osgi; bundle-version=\"[1.0, 1.1)\""); //$NON-NLS-1$ manifest.put(Constants.REQUIRE_CAPABILITY, "osgi.ee; filter:=\"(osgi.ee=test)\""); - BundleDescription b = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription b = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "c"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.REQUIRE_CAPABILITY, "osgi.identity; filter:=\"(osgi.identity=b)\""); //$NON-NLS-1$ - BundleDescription c = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription c = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + manifest.get(Constants.BUNDLE_VERSION), + bundleID++); state.addBundle(b); state.addBundle(a); @@ -4832,7 +5128,9 @@ public void testResolveFragmentEE01() throws BundleException { manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.FRAGMENT_HOST, "org.eclipse.osgi; bundle-version=\"[1.0, 1.1)\""); //$NON-NLS-1$ manifest.put(Constants.REQUIRE_CAPABILITY, "osgi.ee; filter:=\"(osgi.ee=fail)\""); - b = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + manifest.get(Constants.BUNDLE_VERSION), b.getBundleId()); + b = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + manifest.get(Constants.BUNDLE_VERSION), + b.getBundleId()); state.updateBundle(b); state.resolve(false); assertTrue("A is not resolved", a.isResolved()); //$NON-NLS-1$ @@ -4842,7 +5140,7 @@ public void testResolveFragmentEE01() throws BundleException { public void testResolveFragmentEE02() throws BundleException, IOException { State state = buildEmptyState(); - Dictionary[] props = new Dictionary[] {new Hashtable()}; + Dictionary[] props = new Dictionary[] { new Hashtable() }; props[0].put("org.osgi.framework.executionenvironment", "test"); //$NON-NLS-1$ //$NON-NLS-2$ state.setPlatformProperties(props); int bundleID = 0; @@ -4853,14 +5151,18 @@ public void testResolveFragmentEE02() throws BundleException, IOException { manifest.put(Constants.BUNDLE_SYMBOLICNAME, "org.eclipse.osgi"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_REQUIREDEXECUTIONENVIRONMENT, "test"); - BundleDescription a = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription a = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "b"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_REQUIREDEXECUTIONENVIRONMENT, "test"); - BundleDescription b = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription b = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ @@ -4869,7 +5171,9 @@ public void testResolveFragmentEE02() throws BundleException, IOException { manifest.put(Constants.IMPORT_PACKAGE, "d"); manifest.put(Constants.FRAGMENT_HOST, "b"); manifest.put(Constants.BUNDLE_REQUIREDEXECUTIONENVIRONMENT, "test"); - BundleDescription c = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription c = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + manifest.get(Constants.BUNDLE_VERSION), + bundleID++); state.addBundle(b); state.addBundle(a); @@ -4885,7 +5189,9 @@ public void testResolveFragmentEE02() throws BundleException, IOException { manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.EXPORT_PACKAGE, "d"); manifest.put(Constants.BUNDLE_REQUIREDEXECUTIONENVIRONMENT, "test"); - BundleDescription d = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription d = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + manifest.get(Constants.BUNDLE_VERSION), + bundleID++); state.addBundle(d); state.resolve(); @@ -4894,7 +5200,7 @@ public void testResolveFragmentEE02() throws BundleException, IOException { assertFalse("C is resolved", c.isResolved()); //$NON-NLS-1$ assertTrue("D is not resolved", d.isResolved()); //$NON-NLS-1$ - state.resolve(new BundleDescription[] {b}); + state.resolve(new BundleDescription[] { b }); assertTrue("A is not resolved", a.isResolved()); //$NON-NLS-1$ assertTrue("B is not resolved", b.isResolved()); //$NON-NLS-1$ assertTrue("C is not resolved", c.isResolved()); //$NON-NLS-1$ @@ -4956,11 +5262,13 @@ public void testBug376322() throws BundleException, IOException { manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "org.eclipse.osgi"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ - BundleDescription a = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription a = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + manifest.get(Constants.BUNDLE_VERSION), + bundleID++); state.addBundle(a); String longExport = "aQute.libg.header,aQute.libg.version,com.liferay.alloy.util,com.liferay.counter.model.impl;version=\"6.2.0\",com.liferay.counter.model;version=\"6.2.0\",com.liferay.counter.service.base;version=\"6.2.0\",com.liferay.counter.service.impl;version=\"6.2.0\",com.liferay.counter.service.persistence;version=\"6.2.0\",com.liferay.counter.service;version=\"6.2.0\",com.liferay.counter;version=\"6.2.0\",com.liferay.mail.dependencies.fedora.cyrus;version=\"6.2.0\",com.liferay.mail.dependencies.fedora.ksh;version=\"6.2.0\",com.liferay.mail.dependencies.fedora.sendmail;version=\"6.2.0\",com.liferay.mail.dependencies.fedora;version=\"6.2.0\",com.liferay.mail.dependencies;version=\"6.2.0\",com.liferay.mail.messaging;version=\"6.2.0\",com.liferay.mail.model;version=\"6.2.0\",com.liferay.mail.service.impl;version=\"6.2.0\",com.liferay.mail.service.persistence;version=\"6.2.0\",com.liferay.mail.service;version=\"6.2.0\",com.liferay.mail.util;version=\"6.2.0\",com.liferay.mail;version=\"6.2.0\",com.liferay.portal.action;version=\"6.2.0\",com.liferay.portal.apache.bridges.struts;version=\"6.2.0\",com.liferay.portal.apache.bridges;version=\"6.2.0\",com.liferay.portal.apache;version=\"6.2.0\",com.liferay.portal.asset;version=\"6.2.0\",com.liferay.portal.atom;version=\"6.2.0\",com.liferay.portal.audit;version=\"6.2.0\",com.liferay.portal.bean;version=\"6.2.0\",com.liferay.portal.bi.rules;version=\"6.2.0\",com.liferay.portal.bi;version=\"6.2.0\",com.liferay.portal.cache.cluster.clusterlink.messaging;version=\"6.2.0\",com.liferay.portal.cache.cluster.clusterlink;version=\"6.2.0\",com.liferay.portal.cache.cluster;version=\"6.2.0\",com.liferay.portal.cache.ehcache;version=\"6.2.0\",com.liferay.portal.cache.key;version=\"6.2.0\",com.liferay.portal.cache.keypool;version=\"6.2.0\",com.liferay.portal.cache.memcached;version=\"6.2.0\",com.liferay.portal.cache.memory;version=\"6.2.0\",com.liferay.portal.cache.transactional;version=\"6.2.0\",com.liferay.portal.cache;version=\"6.2.0\",com.liferay.portal.captcha.recaptcha;version=\"6.2.0\",com.liferay.portal.captcha.simplecaptcha;version=\"6.2.0\",com.liferay.portal.captcha;version=\"6.2.0\",com.liferay.portal.ccpp;version=\"6.2.0\",com.liferay.portal.cluster;version=\"6.2.0\",com.liferay.portal.configuration.easyconf;version=\"6.2.0\",com.liferay.portal.configuration;version=\"6.2.0\",com.liferay.portal.convert.action;version=\"6.2.0\",com.liferay.portal.convert.messaging;version=\"6.2.0\",com.liferay.portal.convert;version=\"6.2.0\",com.liferay.portal.dao.db;version=\"6.2.0\",com.liferay.portal.dao.jdbc.aop;version=\"6.2.0\",com.liferay.portal.dao.jdbc.pool.c3p0;version=\"6.2.0\",com.liferay.portal.dao.jdbc.pool;version=\"6.2.0\",com.liferay.portal.dao.jdbc.spring;version=\"6.2.0\",com.liferay.portal.dao.jdbc.util;version=\"6.2.0\",com.liferay.portal.dao.jdbc;version=\"6.2.0\",com.liferay.portal.dao.orm.common;version=\"6.2.0\",com.liferay.portal.dao.orm.hibernate.jmx;version=\"6.2.0\",com.liferay.portal.dao.orm.hibernate.region;version=\"6.2.0\",com.liferay.portal.dao.orm.hibernate;version=\"6.2.0\",com.liferay.portal.dao.orm.jpa;version=\"6.2.0\",com.liferay.portal.dao.orm;version=\"6.2.0\",com.liferay.portal.dao.shard.advice;version=\"6.2.0\",com.liferay.portal.dao.shard;version=\"6.2.0\",com.liferay.portal.dao;version=\"6.2.0\",com.liferay.portal.definitions;version=\"6.2.0\",com.liferay.portal.dependencies;version=\"6.2.0\",com.liferay.portal.deploy.auto.exploded.tomcat;version=\"6.2.0\",com.liferay.portal.deploy.auto.exploded;version=\"6.2.0\",com.liferay.portal.deploy.auto;version=\"6.2.0\",com.liferay.portal.deploy.dependencies;version=\"6.2.0\",com.liferay.portal.deploy.hot.messaging;version=\"6.2.0\",com.liferay.portal.deploy.hot;version=\"6.2.0\",com.liferay.portal.deploy.sandbox;version=\"6.2.0\",com.liferay.portal.deploy;version=\"6.2.0\",com.liferay.portal.editor.fckeditor.command.impl;version=\"6.2.0\",com.liferay.portal.editor.fckeditor.command;version=\"6.2.0\",com.liferay.portal.editor.fckeditor.exception;version=\"6.2.0\",com.liferay.portal.editor.fckeditor.receiver.impl;version=\"6.2.0\",com.liferay.portal.editor.fckeditor.receiver;version=\"6.2.0\",com.liferay.portal.editor.fckeditor;version=\"6.2.0\",com.liferay.portal.editor;version=\"6.2.0\",com.liferay.portal.events.dependencies;version=\"6.2.0\",com.liferay.portal.events;version=\"6.2.0\",com.liferay.portal.executor;version=\"6.2.0\",com.liferay.portal.facebook;version=\"6.2.0\",com.liferay.portal.format;version=\"6.2.0\",com.liferay.portal.freemarker;version=\"6.2.0\",com.liferay.portal.googleapps;version=\"6.2.0\",com.liferay.portal.im;version=\"6.2.0\",com.liferay.portal.image;version=\"6.2.0\",com.liferay.portal.increment;version=\"6.2.0\",com.liferay.portal.javadoc;version=\"6.2.0\",com.liferay.portal.jcr.jackrabbit.dependencies;version=\"6.2.0\",com.liferay.portal.jcr.jackrabbit;version=\"6.2.0\",com.liferay.portal.jcr;version=\"6.2.0\",com.liferay.portal.jericho;version=\"6.2.0\",com.liferay.portal.json.jabsorb.serializer;version=\"6.2.0\",com.liferay.portal.json.jabsorb;version=\"6.2.0\",com.liferay.portal.json.transformer;version=\"6.2.0\",com.liferay.portal.json;version=\"6.2.0\",com.liferay.portal.jsonwebservice.action;version=\"6.2.0\",com.liferay.portal.jsonwebservice;version=\"6.2.0\",com.liferay.portal.kernel.annotation;version=\"6.2.0\",com.liferay.portal.kernel.atom;version=\"6.2.0\",com.liferay.portal.kernel.audit;version=\"6.2.0\",com.liferay.portal.kernel.bean;version=\"6.2.0\",com.liferay.portal.kernel.bi.reporting.messaging;version=\"6.2.0\",com.liferay.portal.kernel.bi.reporting.servlet;version=\"6.2.0\",com.liferay.portal.kernel.bi.reporting;version=\"6.2.0\",com.liferay.portal.kernel.bi.rules;version=\"6.2.0\",com.liferay.portal.kernel.bi;version=\"6.2.0\",com.liferay.portal.kernel.cache.cluster;version=\"6.2.0\",com.liferay.portal.kernel.cache.key;version=\"6.2.0\",com.liferay.portal.kernel.cache;version=\"6.2.0\",com.liferay.portal.kernel.cal;version=\"6.2.0\",com.liferay.portal.kernel.captcha;version=\"6.2.0\",com.liferay.portal.kernel.cluster.messaging;version=\"6.2.0\",com.liferay.portal.kernel.cluster;version=\"6.2.0\",com.liferay.portal.kernel.concurrent;version=\"6.2.0\",com.liferay.portal.kernel.configuration;version=\"6.2.0\",com.liferay.portal.kernel.dao.db;version=\"6.2.0\",com.liferay.portal.kernel.dao.jdbc;version=\"6.2.0\",com.liferay.portal.kernel.dao.orm;version=\"6.2.0\",com.liferay.portal.kernel.dao.search;version=\"6.2.0\",com.liferay.portal.kernel.dao.shard;version=\"6.2.0\",com.liferay.portal.kernel.dao;version=\"6.2.0\",com.liferay.portal.kernel.deploy.auto;version=\"6.2.0\",com.liferay.portal.kernel.deploy.hot;version=\"6.2.0\",com.liferay.portal.kernel.deploy.sandbox;version=\"6.2.0\",com.liferay.portal.kernel.deploy;version=\"6.2.0\",com.liferay.portal.kernel.editor;version=\"6.2.0\",com.liferay.portal.kernel.events;version=\"6.2.0\",com.liferay.portal.kernel.exception,com.liferay.portal.kernel.exception;version=\"6.2.0\",com.liferay.portal.kernel.executor;version=\"6.2.0\",com.liferay.portal.kernel.facebook;version=\"6.2.0\",com.liferay.portal.kernel.format;version=\"6.2.0\",com.liferay.portal.kernel.freemarker;version=\"6.2.0\",com.liferay.portal.kernel.googleapps.comparator;version=\"6.2.0\",com.liferay.portal.kernel.googleapps;version=\"6.2.0\",com.liferay.portal.kernel.image;version=\"6.2.0\",com.liferay.portal.kernel.increment;version=\"6.2.0\",com.liferay.portal.kernel.io.delta;version=\"6.2.0\",com.liferay.portal.kernel.io.unsync;version=\"6.2.0\",com.liferay.portal.kernel.io;version=\"6.2.0\",com.liferay.portal.kernel.javadoc;version=\"6.2.0\",com.liferay.portal.kernel.jmx.model;version=\"6.2.0\",com.liferay.portal.kernel.jmx;version=\"6.2.0\",com.liferay.portal.kernel.jndi;version=\"6.2.0\",com.liferay.portal.kernel.json;version=\"6.2.0\",com.liferay.portal.kernel.jsonwebservice;version=\"6.2.0\",com.liferay.portal.kernel.language;version=\"6.2.0\",com.liferay.portal.kernel.lar;version=\"6.2.0\",com.liferay.portal.kernel.ldap;version=\"6.2.0\",com.liferay.portal.kernel.log;version=\"6.2.0\",com.liferay.portal.kernel.mail;version=\"6.2.0\",com.liferay.portal.kernel.management.jmx;version=\"6.2.0\",com.liferay.portal.kernel.management;version=\"6.2.0\",com.liferay.portal.kernel.memory;version=\"6.2.0\",com.liferay.portal.kernel.messaging.async;version=\"6.2.0\",com.liferay.portal.kernel.messaging.config;version=\"6.2.0\",com.liferay.portal.kernel.messaging.jmx;version=\"6.2.0\",com.liferay.portal.kernel.messaging.proxy;version=\"6.2.0\",com.liferay.portal.kernel.messaging.sender;version=\"6.2.0\",com.liferay.portal.kernel.messaging;version=\"6.2.0\",com.liferay.portal.kernel.metadata;version=\"6.2.0\",com.liferay.portal.kernel.mobile.device.rulegroup.action;version=\"6.2.0\",com.liferay.portal.kernel.mobile.device.rulegroup.rule;version=\"6.2.0\",com.liferay.portal.kernel.mobile.device.rulegroup;version=\"6.2.0\",com.liferay.portal.kernel.mobile.device;version=\"6.2.0\",com.liferay.portal.kernel.mobile;version=\"6.2.0\",com.liferay.portal.kernel.monitoring.statistics;version=\"6.2.0\",com.liferay.portal.kernel.monitoring;version=\"6.2.0\",com.liferay.portal.kernel.nio.charset;version=\"6.2.0\",com.liferay.portal.kernel.nio;version=\"6.2.0\",com.liferay.portal.kernel.notifications;version=\"6.2.0\",com.liferay.portal.kernel.oauth;version=\"6.2.0\",com.liferay.portal.kernel.parsers.bbcode;version=\"6.2.0\",com.liferay.portal.kernel.parsers;version=\"6.2.0\",com.liferay.portal.kernel.plugin;version=\"6.2.0\",com.liferay.portal.kernel.poller.comet;version=\"6.2.0\",com.liferay.portal.kernel.poller;version=\"6.2.0\",com.liferay.portal.kernel.pop;version=\"6.2.0\",com.liferay.portal.kernel.portlet;version=\"6.2.0\",com.liferay.portal.kernel.process.log;version=\"6.2.0\",com.liferay.portal.kernel.process;version=\"6.2.0\",com.liferay.portal.kernel.repository.cmis.search;version=\"6.2.0\",com.liferay.portal.kernel.repository.cmis;version=\"6.2.0\",com.liferay.portal.kernel.repository.model;version=\"6.2.0\",com.liferay.portal.kernel.repository.search;version=\"6.2.0\",com.liferay.portal.kernel.repository;version=\"6.2.0\",com.liferay.portal.kernel.resource;version=\"6.2.0\",com.liferay.portal.kernel.sanitizer;version=\"6.2.0\",com.liferay.portal.kernel.scheduler.config;version=\"6.2.0\",com.liferay.portal.kernel.scheduler.messaging;version=\"6.2.0\",com.liferay.portal.kernel.scheduler;version=\"6.2.0\",com.liferay.portal.kernel.scripting;version=\"6.2.0\",com.liferay.portal.kernel.search.facet.collector;version=\"6.2.0\",com.liferay.portal.kernel.search.facet.config;version=\"6.2.0\",com.liferay.portal.kernel.search.facet.util;version=\"6.2.0\",com.liferay.portal.kernel.search.facet;version=\"6.2.0\",com.liferay.portal.kernel.search.messaging;version=\"6.2.0\",com.liferay.portal.kernel.search;version=\"6.2.0\",com.liferay.portal.kernel.security.jaas;version=\"6.2.0\",com.liferay.portal.kernel.security;version=\"6.2.0\",com.liferay.portal.kernel.servlet.filters.compoundsessionid;version=\"6.2.0\",com.liferay.portal.kernel.servlet.filters.invoker;version=\"6.2.0\",com.liferay.portal.kernel.servlet.filters;version=\"6.2.0\",com.liferay.portal.kernel.servlet.taglib.aui;version=\"6.2.0\",com.liferay.portal.kernel.servlet.taglib.ui;version=\"6.2.0\",com.liferay.portal.kernel.servlet.taglib;version=\"6.2.0\",com.liferay.portal.kernel.servlet;version=\"6.2.0\",com.liferay.portal.kernel.spring.aop;version=\"6.2.0\",com.liferay.portal.kernel.spring.context;version=\"6.2.0\",com.liferay.portal.kernel.spring;version=\"6.2.0\",com.liferay.portal.kernel.staging.permission;version=\"6.2.0\",com.liferay.portal.kernel.staging;version=\"6.2.0\",com.liferay.portal.kernel.struts;version=\"6.2.0\",com.liferay.portal.kernel.templateparser;version=\"6.2.0\",com.liferay.portal.kernel.test;version=\"6.2.0\",com.liferay.portal.kernel.transaction;version=\"6.2.0\",com.liferay.portal.kernel.upgrade.util;version=\"6.2.0\",com.liferay.portal.kernel.upgrade;version=\"6.2.0\",com.liferay.portal.kernel.upload;version=\"6.2.0\",com.liferay.portal.kernel.util;version=\"6.2.0\",com.liferay.portal.kernel.uuid;version=\"6.2.0\",com.liferay.portal.kernel.velocity;version=\"6.2.0\",com.liferay.portal.kernel.webcache;version=\"6.2.0\",com.liferay.portal.kernel.webdav;version=\"6.2.0\",com.liferay.portal.kernel.workflow.comparator;version=\"6.2.0\",com.liferay.portal.kernel.workflow.messaging;version=\"6.2.0\",com.liferay.portal.kernel.workflow.permission;version=\"6.2.0\",com.liferay.portal.kernel.workflow;version=\"6.2.0\",com.liferay.portal.kernel.xml.simple;version=\"6.2.0\",com.liferay.portal.kernel.xml;version=\"6.2.0\",com.liferay.portal.kernel.xmlrpc;version=\"6.2.0\",com.liferay.portal.kernel.zip;version=\"6.2.0\",com.liferay.portal.kernel;version=\"6.2.0\",com.liferay.portal.language;version=\"6.2.0\",com.liferay.portal.lar;version=\"6.2.0\",com.liferay.portal.license.util;version=\"6.2.0\",com.liferay.portal.license;version=\"6.2.0\",com.liferay.portal.liveusers.messaging;version=\"6.2.0\",com.liferay.portal.liveusers;version=\"6.2.0\",com.liferay.portal.log;version=\"6.2.0\",com.liferay.portal.management;version=\"6.2.0\",com.liferay.portal.messaging.async;version=\"6.2.0\",com.liferay.portal.messaging.proxy;version=\"6.2.0\",com.liferay.portal.messaging;version=\"6.2.0\",com.liferay.portal.metadata;version=\"6.2.0\",com.liferay.portal.mobile.device.messaging;version=\"6.2.0\",com.liferay.portal.mobile.device.rulegroup.action.impl;version=\"6.2.0\",com.liferay.portal.mobile.device.rulegroup.action;version=\"6.2.0\",com.liferay.portal.mobile.device.rulegroup.rule.impl;version=\"6.2.0\",com.liferay.portal.mobile.device.rulegroup.rule;version=\"6.2.0\",com.liferay.portal.mobile.device.rulegroup;version=\"6.2.0\",com.liferay.portal.mobile.device;version=\"6.2.0\",com.liferay.portal.mobile;version=\"6.2.0\",com.liferay.portal.model.impl;version=\"6.2.0\",com.liferay.portal.model;version=\"6.2.0\",com.liferay.portal.monitoring.jmx;version=\"6.2.0\",com.liferay.portal.monitoring.messaging;version=\"6.2.0\",com.liferay.portal.monitoring.statistics.portal;version=\"6.2.0\",com.liferay.portal.monitoring.statistics.portlet;version=\"6.2.0\",com.liferay.portal.monitoring.statistics.service;version=\"6.2.0\",com.liferay.portal.monitoring.statistics;version=\"6.2.0\",com.liferay.portal.monitoring;version=\"6.2.0\",com.liferay.portal.notifications;version=\"6.2.0\",com.liferay.portal.oauth;version=\"6.2.0\",com.liferay.portal.osgi.service;version=\"6.2.0\",com.liferay.portal.osgi;version=\"6.2.0\",com.liferay.portal.parsers.bbcode;version=\"6.2.0\",com.liferay.portal.parsers.creole.ast.extension;version=\"6.2.0\",com.liferay.portal.parsers.creole.ast.link;version=\"6.2.0\",com.liferay.portal.parsers.creole.ast.table;version=\"6.2.0\",com.liferay.portal.parsers.creole.ast;version=\"6.2.0\",com.liferay.portal.parsers.creole.grammar;version=\"6.2.0\",com.liferay.portal.parsers.creole.parser;version=\"6.2.0\",com.liferay.portal.parsers.creole.visitor.impl;version=\"6.2.0\",com.liferay.portal.parsers.creole.visitor;version=\"6.2.0\",com.liferay.portal.parsers.creole;version=\"6.2.0\",com.liferay.portal.parsers;version=\"6.2.0\",com.liferay.portal.plugin;version=\"6.2.0\",com.liferay.portal.poller.comet;version=\"6.2.0\",com.liferay.portal.poller.messaging;version=\"6.2.0\",com.liferay.portal.poller;version=\"6.2.0\",com.liferay.portal.pop.messaging;version=\"6.2.0\",com.liferay.portal.pop;version=\"6.2.0\",com.liferay.portal.repository.cmis.model;version=\"6.2.0\",com.liferay.portal.repository.cmis;version=\"6.2.0\",com.liferay.portal.repository.liferayrepository.model;version=\"6.2.0\",com.liferay.portal.repository.liferayrepository.util;version=\"6.2.0\",com.liferay.portal.repository.liferayrepository;version=\"6.2.0\",com.liferay.portal.repository.proxy;version=\"6.2.0\",com.liferay.portal.repository.search;version=\"6.2.0\",com.liferay.portal.repository.util;version=\"6.2.0\",com.liferay.portal.repository;version=\"6.2.0\",com.liferay.portal.sanitizer;version=\"6.2.0\",com.liferay.portal.scheduler.job;version=\"6.2.0\",com.liferay.portal.scheduler.messaging;version=\"6.2.0\",com.liferay.portal.scheduler.quartz;version=\"6.2.0\",com.liferay.portal.scheduler;version=\"6.2.0\",com.liferay.portal.scripting.beanshell;version=\"6.2.0\",com.liferay.portal.scripting.groovy;version=\"6.2.0\",com.liferay.portal.scripting.javascript;version=\"6.2.0\",com.liferay.portal.scripting.python;version=\"6.2.0\",com.liferay.portal.scripting.ruby;version=\"6.2.0\",com.liferay.portal.scripting;version=\"6.2.0\",com.liferay.portal.search.generic;version=\"6.2.0\",com.liferay.portal.search.lucene.cluster;version=\"6.2.0\",com.liferay.portal.search.lucene.dump;version=\"6.2.0\",com.liferay.portal.search.lucene.highlight;version=\"6.2.0\",com.liferay.portal.search.lucene.messaging;version=\"6.2.0\",com.liferay.portal.search.lucene;version=\"6.2.0\",com.liferay.portal.search;version=\"6.2.0\",com.liferay.portal.security.auth;version=\"6.2.0\",com.liferay.portal.security.jaas.ext.jboss;version=\"6.2.0\",com.liferay.portal.security.jaas.ext.jetty;version=\"6.2.0\",com.liferay.portal.security.jaas.ext.jonas;version=\"6.2.0\",com.liferay.portal.security.jaas.ext.resin;version=\"6.2.0\",com.liferay.portal.security.jaas.ext.tomcat;version=\"6.2.0\",com.liferay.portal.security.jaas.ext.weblogic;version=\"6.2.0\",com.liferay.portal.security.jaas.ext;version=\"6.2.0\",com.liferay.portal.security.jaas;version=\"6.2.0\",com.liferay.portal.security.lang;version=\"6.2.0\",com.liferay.portal.security.ldap;version=\"6.2.0\",com.liferay.portal.security.ntlm.msrpc;version=\"6.2.0\",com.liferay.portal.security.ntlm;version=\"6.2.0\",com.liferay.portal.security.permission.comparator;version=\"6.2.0\",com.liferay.portal.security.permission;version=\"6.2.0\",com.liferay.portal.security.pwd;version=\"6.2.0\",com.liferay.portal.security;version=\"6.2.0\",com.liferay.portal.service,com.liferay.portal.service.base;version=\"6.2.0\",com.liferay.portal.service.http;version=\"6.2.0\",com.liferay.portal.service.impl;version=\"6.2.0\",com.liferay.portal.service.permission;version=\"6.2.0\",com.liferay.portal.service.persistence.impl;version=\"6.2.0\",com.liferay.portal.service.persistence;version=\"6.2.0\",com.liferay.portal.service;version=\"6.2.0\",com.liferay.portal.servlet.filters.absoluteredirects;version=\"6.2.0\",com.liferay.portal.servlet.filters.audit;version=\"6.2.0\",com.liferay.portal.servlet.filters.autologin;version=\"6.2.0\",com.liferay.portal.servlet.filters.cache;version=\"6.2.0\",com.liferay.portal.servlet.filters.charbufferpool;version=\"6.2.0\",com.liferay.portal.servlet.filters.compoundsessionid;version=\"6.2.0\",com.liferay.portal.servlet.filters.doubleclick;version=\"6.2.0\",com.liferay.portal.servlet.filters.dynamiccss;version=\"6.2.0\",com.liferay.portal.servlet.filters.etag;version=\"6.2.0\",com.liferay.portal.servlet.filters.fragment;version=\"6.2.0\",com.liferay.portal.servlet.filters.gzip;version=\"6.2.0\",com.liferay.portal.servlet.filters.header;version=\"6.2.0\",com.liferay.portal.servlet.filters.i18n;version=\"6.2.0\",com.liferay.portal.servlet.filters.ignore;version=\"6.2.0\",com.liferay.portal.servlet.filters.language;version=\"6.2.0\",com.liferay.portal.servlet.filters.minifier;version=\"6.2.0\",com.liferay.portal.servlet.filters.monitoring.jmx;version=\"6.2.0\",com.liferay.portal.servlet.filters.monitoring;version=\"6.2.0\",com.liferay.portal.servlet.filters.secure;version=\"6.2.0\",com.liferay.portal.servlet.filters.servletauthorizing;version=\"6.2.0\",com.liferay.portal.servlet.filters.servletcontextinclude;version=\"6.2.0\",com.liferay.portal.servlet.filters.sessionid;version=\"6.2.0\",com.liferay.portal.servlet.filters.sessionmaxallowed;version=\"6.2.0\",com.liferay.portal.servlet.filters.sso.cas;version=\"6.2.0\",com.liferay.portal.servlet.filters.sso.ntlm;version=\"6.2.0\",com.liferay.portal.servlet.filters.sso.opensso;version=\"6.2.0\",com.liferay.portal.servlet.filters.sso;version=\"6.2.0\",com.liferay.portal.servlet.filters.strip;version=\"6.2.0\",com.liferay.portal.servlet.filters.themepreview;version=\"6.2.0\",com.liferay.portal.servlet.filters.threaddump;version=\"6.2.0\",com.liferay.portal.servlet.filters.threadlocal;version=\"6.2.0\",com.liferay.portal.servlet.filters.unsyncprintwriterpool;version=\"6.2.0\",com.liferay.portal.servlet.filters.validhostname;version=\"6.2.0\",com.liferay.portal.servlet.filters.validhtml;version=\"6.2.0\",com.liferay.portal.servlet.filters.virtualhost;version=\"6.2.0\",com.liferay.portal.servlet.filters;version=\"6.2.0\",com.liferay.portal.servlet.taglib.ui;version=\"6.2.0\",com.liferay.portal.servlet.taglib;version=\"6.2.0\",com.liferay.portal.servlet;version=\"6.2.0\",com.liferay.portal.setup;version=\"6.2.0\",com.liferay.portal.sharepoint.dws;version=\"6.2.0\",com.liferay.portal.sharepoint.methods;version=\"6.2.0\",com.liferay.portal.sharepoint;version=\"6.2.0\",com.liferay.portal.spring.annotation;version=\"6.2.0\",com.liferay.portal.spring.aop;version=\"6.2.0\",com.liferay.portal.spring.bean;version=\"6.2.0\",com.liferay.portal.spring.context;version=\"6.2.0\",com.liferay.portal.spring.hibernate;version=\"6.2.0\",com.liferay.portal.spring.jndi;version=\"6.2.0\",com.liferay.portal.spring.jpa;version=\"6.2.0\",com.liferay.portal.spring.remoting;version=\"6.2.0\",com.liferay.portal.spring.servlet;version=\"6.2.0\",com.liferay.portal.spring.transaction;version=\"6.2.0\",com.liferay.portal.spring.util;version=\"6.2.0\",com.liferay.portal.spring;version=\"6.2.0\",com.liferay.portal.staging.permission;version=\"6.2.0\",com.liferay.portal.staging;version=\"6.2.0\",com.liferay.portal.struts;version=\"6.2.0\",com.liferay.portal.theme;version=\"6.2.0\",com.liferay.portal.tools.comparator;version=\"6.2.0\",com.liferay.portal.tools.dependencies;version=\"6.2.0\",com.liferay.portal.tools.deploy;version=\"6.2.0\",com.liferay.portal.tools.jspc.common;version=\"6.2.0\",com.liferay.portal.tools.jspc.resin;version=\"6.2.0\",com.liferay.portal.tools.jspc;version=\"6.2.0\",com.liferay.portal.tools.samplesqlbuilder.dependencies;version=\"6.2.0\",com.liferay.portal.tools.samplesqlbuilder;version=\"6.2.0\",com.liferay.portal.tools.servicebuilder.dependencies;version=\"6.2.0\",com.liferay.portal.tools.servicebuilder;version=\"6.2.0\",com.liferay.portal.tools.sql.dependencies;version=\"6.2.0\",com.liferay.portal.tools.sql;version=\"6.2.0\",com.liferay.portal.tools;version=\"6.2.0\",com.liferay.portal.upgrade.util;version=\"6.2.0\",com.liferay.portal.upgrade.v5_2_5_to_6_0_0.util;version=\"6.2.0\",com.liferay.portal.upgrade.v5_2_5_to_6_0_0;version=\"6.2.0\",com.liferay.portal.upgrade.v5_2_7_to_6_0_0;version=\"6.2.0\",com.liferay.portal.upgrade.v5_2_8_to_6_0_5.util;version=\"6.2.0\",com.liferay.portal.upgrade.v5_2_8_to_6_0_5;version=\"6.2.0\",com.liferay.portal.upgrade.v6_0_0.util;version=\"6.2.0\",com.liferay.portal.upgrade.v6_0_0;version=\"6.2.0\",com.liferay.portal.upgrade.v6_0_1.util;version=\"6.2.0\",com.liferay.portal.upgrade.v6_0_12_to_6_1_0;version=\"6.2.0\",com.liferay.portal.upgrade.v6_0_1;version=\"6.2.0\",com.liferay.portal.upgrade.v6_0_2;version=\"6.2.0\",com.liferay.portal.upgrade.v6_0_3;version=\"6.2.0\",com.liferay.portal.upgrade.v6_0_5.util;version=\"6.2.0\",com.liferay.portal.upgrade.v6_0_5;version=\"6.2.0\",com.liferay.portal.upgrade.v6_0_6;version=\"6.2.0\",com.liferay.portal.upgrade.v6_1_0.util;version=\"6.2.0\",com.liferay.portal.upgrade.v6_1_0;version=\"6.2.0\",com.liferay.portal.upgrade.v6_1_1;version=\"6.2.0\",com.liferay.portal.upgrade.v6_2_0;version=\"6.2.0\",com.liferay.portal.upgrade;version=\"6.2.0\",com.liferay.portal.upload;version=\"6.2.0\",com.liferay.portal.util.comparator;version=\"6.2.0\",com.liferay.portal.util.dependencies;version=\"6.2.0\",com.liferay.portal.util;version=\"6.2.0\",com.liferay.portal.uuid;version=\"6.2.0\",com.liferay.portal.velocity;version=\"6.2.0\",com.liferay.portal.verify;version=\"6.2.0\",com.liferay.portal.webcache;version=\"6.2.0\",com.liferay.portal.webdav.methods;version=\"6.2.0\",com.liferay.portal.webdav;version=\"6.2.0\",com.liferay.portal.webserver.dependencies;version=\"6.2.0\",com.liferay.portal.webserver;version=\"6.2.0\",com.liferay.portal.words.dependencies;version=\"6.2.0\",com.liferay.portal.words;version=\"6.2.0\",com.liferay.portal.workflow.permission;version=\"6.2.0\",com.liferay.portal.workflow;version=\"6.2.0\",com.liferay.portal.xml.xpath;version=\"6.2.0\",com.liferay.portal.xml;version=\"6.2.0\",com.liferay.portal.xmlrpc;version=\"6.2.0\",com.liferay.portal.zip;version=\"6.2.0\",com.liferay.portal;version=\"6.2.0\",com.liferay.portlet.activities.action;version=\"6.2.0\",com.liferay.portlet.activities;version=\"6.2.0\",com.liferay.portlet.addressbook;version=\"6.2.0\",com.liferay.portlet.admin.action;version=\"6.2.0\",com.liferay.portlet.admin.dependencies;version=\"6.2.0\",com.liferay.portlet.admin.messaging;version=\"6.2.0\",com.liferay.portlet.admin.util;version=\"6.2.0\",com.liferay.portlet.admin;version=\"6.2.0\",com.liferay.portlet.amazonrankings.action;version=\"6.2.0\",com.liferay.portlet.amazonrankings.model;version=\"6.2.0\",com.liferay.portlet.amazonrankings.util;version=\"6.2.0\",com.liferay.portlet.amazonrankings;version=\"6.2.0\",com.liferay.portlet.announcements.action;version=\"6.2.0\",com.liferay.portlet.announcements.dependencies;version=\"6.2.0\",com.liferay.portlet.announcements.messaging;version=\"6.2.0\",com.liferay.portlet.announcements.model.impl;version=\"6.2.0\",com.liferay.portlet.announcements.model;version=\"6.2.0\",com.liferay.portlet.announcements.service.base;version=\"6.2.0\",com.liferay.portlet.announcements.service.http;version=\"6.2.0\",com.liferay.portlet.announcements.service.impl;version=\"6.2.0\",com.liferay.portlet.announcements.service.permission;version=\"6.2.0\",com.liferay.portlet.announcements.service.persistence;version=\"6.2.0\",com.liferay.portlet.announcements.service;version=\"6.2.0\",com.liferay.portlet.announcements.util;version=\"6.2.0\",com.liferay.portlet.announcements;version=\"6.2.0\",com.liferay.portlet.asset.action;version=\"6.2.0\",com.liferay.portlet.asset.model.impl;version=\"6.2.0\",com.liferay.portlet.asset.model;version=\"6.2.0\",com.liferay.portlet.asset.service.base;version=\"6.2.0\",com.liferay.portlet.asset.service.http;version=\"6.2.0\",com.liferay.portlet.asset.service.impl;version=\"6.2.0\",com.liferay.portlet.asset.service.permission;version=\"6.2.0\",com.liferay.portlet.asset.service.persistence;version=\"6.2.0\",com.liferay.portlet.asset.service;version=\"6.2.0\",com.liferay.portlet.asset.util.comparator;version=\"6.2.0\",com.liferay.portlet.asset.util;version=\"6.2.0\",com.liferay.portlet.asset;version=\"6.2.0\",com.liferay.portlet.assetcategoryadmin.action;version=\"6.2.0\",com.liferay.portlet.assetcategoryadmin;version=\"6.2.0\",com.liferay.portlet.assetpublisher.action;version=\"6.2.0\",com.liferay.portlet.assetpublisher.search;version=\"6.2.0\",com.liferay.portlet.assetpublisher.util;version=\"6.2.0\",com.liferay.portlet.assetpublisher;version=\"6.2.0\",com.liferay.portlet.assettagadmin.action;version=\"6.2.0\",com.liferay.portlet.assettagadmin;version=\"6.2.0\",com.liferay.portlet.blogs.action;version=\"6.2.0\",com.liferay.portlet.blogs.asset;version=\"6.2.0\",com.liferay.portlet.blogs.atom;version=\"6.2.0\",com.liferay.portlet.blogs.dependencies;version=\"6.2.0\",com.liferay.portlet.blogs.lar;version=\"6.2.0\",com.liferay.portlet.blogs.messaging;version=\"6.2.0\",com.liferay.portlet.blogs.model.impl;version=\"6.2.0\",com.liferay.portlet.blogs.model;version=\"6.2.0\",com.liferay.portlet.blogs.service.base;version=\"6.2.0\",com.liferay.portlet.blogs.service.http;version=\"6.2.0\",com.liferay.portlet.blogs.service.impl;version=\"6.2.0\",com.liferay.portlet.blogs.service.permission;version=\"6.2.0\",com.liferay.portlet.blogs.service.persistence;version=\"6.2.0\",com.liferay.portlet.blogs.service;version=\"6.2.0\",com.liferay.portlet.blogs.social;version=\"6.2.0\",com.liferay.portlet.blogs.util.comparator;version=\"6.2.0\",com.liferay.portlet.blogs.util;version=\"6.2.0\",com.liferay.portlet.blogs.workflow;version=\"6.2.0\",com.liferay.portlet.blogs;version=\"6.2.0\",com.liferay.portlet.blogsadmin.search;version=\"6.2.0\",com.liferay.portlet.blogsadmin;version=\"6.2.0\",com.liferay.portlet.bookmarks.action;version=\"6.2.0\",com.liferay.portlet.bookmarks.asset;version=\"6.2.0\",com.liferay.portlet.bookmarks.lar;version=\"6.2.0\",com.liferay.portlet.bookmarks.model.impl;version=\"6.2.0\",com.liferay.portlet.bookmarks.model;version=\"6.2.0\",com.liferay.portlet.bookmarks.service.base;version=\"6.2.0\",com.liferay.portlet.bookmarks.service.http;version=\"6.2.0\",com.liferay.portlet.bookmarks.service.impl;version=\"6.2.0\",com.liferay.portlet.bookmarks.service.permission;version=\"6.2.0\",com.liferay.portlet.bookmarks.service.persistence;version=\"6.2.0\",com.liferay.portlet.bookmarks.service;version=\"6.2.0\",com.liferay.portlet.bookmarks.social;version=\"6.2.0\",com.liferay.portlet.bookmarks.util.comparator;version=\"6.2.0\",com.liferay.portlet.bookmarks.util;version=\"6.2.0\",com.liferay.portlet.bookmarks;version=\"6.2.0\",com.liferay.portlet.calendar.action;version=\"6.2.0\",com.liferay.portlet.calendar.asset;version=\"6.2.0\",com.liferay.portlet.calendar.dependencies;version=\"6.2.0\",com.liferay.portlet.calendar.lar;version=\"6.2.0\",com.liferay.portlet.calendar.messaging;version=\"6.2.0\",com.liferay.portlet.calendar.model.impl;version=\"6.2.0\",com.liferay.portlet.calendar.model;version=\"6.2.0\",com.liferay.portlet.calendar.service.base;version=\"6.2.0\",com.liferay.portlet.calendar.service.http;version=\"6.2.0\",com.liferay.portlet.calendar.service.impl;version=\"6.2.0\",com.liferay.portlet.calendar.service.permission;version=\"6.2.0\",com.liferay.portlet.calendar.service.persistence;version=\"6.2.0\",com.liferay.portlet.calendar.service;version=\"6.2.0\",com.liferay.portlet.calendar.social;version=\"6.2.0\",com.liferay.portlet.calendar.util.comparator;version=\"6.2.0\",com.liferay.portlet.calendar.util;version=\"6.2.0\",com.liferay.portlet.calendar;version=\"6.2.0\",com.liferay.portlet.communities.messaging;version=\"6.2.0\",com.liferay.portlet.communities;version=\"6.2.0\",com.liferay.portlet.currencyconverter.action;version=\"6.2.0\",com.liferay.portlet.currencyconverter.model;version=\"6.2.0\",com.liferay.portlet.currencyconverter.util;version=\"6.2.0\",com.liferay.portlet.currencyconverter;version=\"6.2.0\",com.liferay.portlet.directory.asset;version=\"6.2.0\",com.liferay.portlet.directory.util;version=\"6.2.0\",com.liferay.portlet.directory.workflow;version=\"6.2.0\",com.liferay.portlet.directory;version=\"6.2.0\",com.liferay.portlet.documentlibrary.action;version=\"6.2.0\",com.liferay.portlet.documentlibrary.antivirus;version=\"6.2.0\",com.liferay.portlet.documentlibrary.asset;version=\"6.2.0\",com.liferay.portlet.documentlibrary.atom;version=\"6.2.0\",com.liferay.portlet.documentlibrary.lar;version=\"6.2.0\",com.liferay.portlet.documentlibrary.messaging;version=\"6.2.0\",com.liferay.portlet.documentlibrary.model.impl;version=\"6.2.0\",com.liferay.portlet.documentlibrary.model;version=\"6.2.0\",com.liferay.portlet.documentlibrary.search;version=\"6.2.0\",com.liferay.portlet.documentlibrary.service.base;version=\"6.2.0\",com.liferay.portlet.documentlibrary.service.http;version=\"6.2.0\",com.liferay.portlet.documentlibrary.service.impl;version=\"6.2.0\",com.liferay.portlet.documentlibrary.service.permission;version=\"6.2.0\",com.liferay.portlet.documentlibrary.service.persistence;version=\"6.2.0\",com.liferay.portlet.documentlibrary.service;version=\"6.2.0\",com.liferay.portlet.documentlibrary.sharepoint;version=\"6.2.0\",com.liferay.portlet.documentlibrary.social;version=\"6.2.0\",com.liferay.portlet.documentlibrary.store;version=\"6.2.0\",com.liferay.portlet.documentlibrary.util.comparator;version=\"6.2.0\",com.liferay.portlet.documentlibrary.util;version=\"6.2.0\",com.liferay.portlet.documentlibrary.webdav;version=\"6.2.0\",com.liferay.portlet.documentlibrary.workflow;version=\"6.2.0\",com.liferay.portlet.documentlibrary;version=\"6.2.0\",com.liferay.portlet.dynamicdatalists.action;version=\"6.2.0\",com.liferay.portlet.dynamicdatalists.asset;version=\"6.2.0\",com.liferay.portlet.dynamicdatalists.dependencies;version=\"6.2.0\",com.liferay.portlet.dynamicdatalists.model.impl;version=\"6.2.0\",com.liferay.portlet.dynamicdatalists.model;version=\"6.2.0\",com.liferay.portlet.dynamicdatalists.search;version=\"6.2.0\",com.liferay.portlet.dynamicdatalists.service.base;version=\"6.2.0\",com.liferay.portlet.dynamicdatalists.service.http;version=\"6.2.0\",com.liferay.portlet.dynamicdatalists.service.impl;version=\"6.2.0\",com.liferay.portlet.dynamicdatalists.service.permission;version=\"6.2.0\",com.liferay.portlet.dynamicdatalists.service.persistence;version=\"6.2.0\",com.liferay.portlet.dynamicdatalists.service;version=\"6.2.0\",com.liferay.portlet.dynamicdatalists.util.comparator;version=\"6.2.0\",com.liferay.portlet.dynamicdatalists.util;version=\"6.2.0\",com.liferay.portlet.dynamicdatalists.workflow;version=\"6.2.0\",com.liferay.portlet.dynamicdatalists;version=\"6.2.0\",com.liferay.portlet.dynamicdatamapping.action;version=\"6.2.0\",com.liferay.portlet.dynamicdatamapping.dependencies.alloy;version=\"6.2.0\",com.liferay.portlet.dynamicdatamapping.dependencies.ddm;version=\"6.2.0\",com.liferay.portlet.dynamicdatamapping.dependencies.readonly;version=\"6.2.0\",com.liferay.portlet.dynamicdatamapping.dependencies;version=\"6.2.0\",com.liferay.portlet.dynamicdatamapping.lar;version=\"6.2.0\",com.liferay.portlet.dynamicdatamapping.model.impl;version=\"6.2.0\",com.liferay.portlet.dynamicdatamapping.model;version=\"6.2.0\",com.liferay.portlet.dynamicdatamapping.search;version=\"6.2.0\",com.liferay.portlet.dynamicdatamapping.service.base;version=\"6.2.0\",com.liferay.portlet.dynamicdatamapping.service.http;version=\"6.2.0\",com.liferay.portlet.dynamicdatamapping.service.impl;version=\"6.2.0\",com.liferay.portlet.dynamicdatamapping.service.permission;version=\"6.2.0\",com.liferay.portlet.dynamicdatamapping.service.persistence;version=\"6.2.0\",com.liferay.portlet.dynamicdatamapping.service;version=\"6.2.0\",com.liferay.portlet.dynamicdatamapping.storage.query;version=\"6.2.0\",com.liferay.portlet.dynamicdatamapping.storage;version=\"6.2.0\",com.liferay.portlet.dynamicdatamapping.util.comparator;version=\"6.2.0\",com.liferay.portlet.dynamicdatamapping.util;version=\"6.2.0\",com.liferay.portlet.dynamicdatamapping;version=\"6.2.0\",com.liferay.portlet.expando.action;version=\"6.2.0\",com.liferay.portlet.expando.model.impl;version=\"6.2.0\",com.liferay.portlet.expando.model;version=\"6.2.0\",com.liferay.portlet.expando.service.base;version=\"6.2.0\",com.liferay.portlet.expando.service.http;version=\"6.2.0\",com.liferay.portlet.expando.service.impl;version=\"6.2.0\",com.liferay.portlet.expando.service.permission;version=\"6.2.0\",com.liferay.portlet.expando.service.persistence;version=\"6.2.0\",com.liferay.portlet.expando.service;version=\"6.2.0\",com.liferay.portlet.expando.util.comparator;version=\"6.2.0\",com.liferay.portlet.expando.util;version=\"6.2.0\",com.liferay.portlet.expando;version=\"6.2.0\",com.liferay.portlet.flags.action;version=\"6.2.0\",com.liferay.portlet.flags.dependencies;version=\"6.2.0\",com.liferay.portlet.flags.messaging;version=\"6.2.0\",com.liferay.portlet.flags.service.base;version=\"6.2.0\",com.liferay.portlet.flags.service.http;version=\"6.2.0\",com.liferay.portlet.flags.service.impl;version=\"6.2.0\",com.liferay.portlet.flags.service;version=\"6.2.0\",com.liferay.portlet.flags;version=\"6.2.0\",com.liferay.portlet.grouppages.action;version=\"6.2.0\",com.liferay.portlet.grouppages;version=\"6.2.0\",com.liferay.portlet.helloworld;version=\"6.2.0\",com.liferay.portlet.iframe.action;version=\"6.2.0\",com.liferay.portlet.iframe.util;version=\"6.2.0\",com.liferay.portlet.iframe;version=\"6.2.0\",com.liferay.portlet.imagegallerydisplay.action;version=\"6.2.0\",com.liferay.portlet.imagegallerydisplay.util;version=\"6.2.0\",com.liferay.portlet.imagegallerydisplay;version=\"6.2.0\",com.liferay.portlet.invitation.action;version=\"6.2.0\",com.liferay.portlet.invitation.dependencies;version=\"6.2.0\",com.liferay.portlet.invitation.util;version=\"6.2.0\",com.liferay.portlet.invitation;version=\"6.2.0\",com.liferay.portlet.journal.action;version=\"6.2.0\",com.liferay.portlet.journal.asset;version=\"6.2.0\",com.liferay.portlet.journal.atom;version=\"6.2.0\",com.liferay.portlet.journal.dependencies;version=\"6.2.0\",com.liferay.portlet.journal.lar;version=\"6.2.0\",com.liferay.portlet.journal.messaging;version=\"6.2.0\",com.liferay.portlet.journal.model.impl;version=\"6.2.0\",com.liferay.portlet.journal.model;version=\"6.2.0\",com.liferay.portlet.journal.search;version=\"6.2.0\",com.liferay.portlet.journal.service.base;version=\"6.2.0\",com.liferay.portlet.journal.service.http;version=\"6.2.0\",com.liferay.portlet.journal.service.impl;version=\"6.2.0\",com.liferay.portlet.journal.service.permission;version=\"6.2.0\",com.liferay.portlet.journal.service.persistence;version=\"6.2.0\",com.liferay.portlet.journal.service;version=\"6.2.0\",com.liferay.portlet.journal.util.comparator;version=\"6.2.0\",com.liferay.portlet.journal.util;version=\"6.2.0\",com.liferay.portlet.journal.webdav;version=\"6.2.0\",com.liferay.portlet.journal.workflow;version=\"6.2.0\",com.liferay.portlet.journal;version=\"6.2.0\",com.liferay.portlet.journalarticles.action;version=\"6.2.0\",com.liferay.portlet.journalarticles;version=\"6.2.0\",com.liferay.portlet.journalcontent.action;version=\"6.2.0\",com.liferay.portlet.journalcontent.util;version=\"6.2.0\",com.liferay.portlet.journalcontent;version=\"6.2.0\",com.liferay.portlet.journalcontentsearch.action;version=\"6.2.0\",com.liferay.portlet.journalcontentsearch.util;version=\"6.2.0\",com.liferay.portlet.journalcontentsearch;version=\"6.2.0\",com.liferay.portlet.language.action;version=\"6.2.0\",com.liferay.portlet.language;version=\"6.2.0\",com.liferay.portlet.layoutconfiguration.util.velocity;version=\"6.2.0\",com.liferay.portlet.layoutconfiguration.util.xml;version=\"6.2.0\",com.liferay.portlet.layoutconfiguration.util;version=\"6.2.0\",com.liferay.portlet.layoutconfiguration;version=\"6.2.0\",com.liferay.portlet.layoutprototypes.action;version=\"6.2.0\",com.liferay.portlet.layoutprototypes;version=\"6.2.0\",com.liferay.portlet.layoutsadmin.action;version=\"6.2.0\",com.liferay.portlet.layoutsadmin.util;version=\"6.2.0\",com.liferay.portlet.layoutsadmin;version=\"6.2.0\",com.liferay.portlet.layoutsetprototypes.action;version=\"6.2.0\",com.liferay.portlet.layoutsetprototypes;version=\"6.2.0\",com.liferay.portlet.login.action;version=\"6.2.0\",com.liferay.portlet.login.util;version=\"6.2.0\",com.liferay.portlet.login;version=\"6.2.0\",com.liferay.portlet.messageboards.action;version=\"6.2.0\",com.liferay.portlet.messageboards.asset;version=\"6.2.0\",com.liferay.portlet.messageboards.dependencies;version=\"6.2.0\",com.liferay.portlet.messageboards.lar;version=\"6.2.0\",com.liferay.portlet.messageboards.messaging;version=\"6.2.0\",com.liferay.portlet.messageboards.model.impl;version=\"6.2.0\",com.liferay.portlet.messageboards.model;version=\"6.2.0\",com.liferay.portlet.messageboards.pop;version=\"6.2.0\",com.liferay.portlet.messageboards.service.base;version=\"6.2.0\",com.liferay.portlet.messageboards.service.http;version=\"6.2.0\",com.liferay.portlet.messageboards.service.impl;version=\"6.2.0\",com.liferay.portlet.messageboards.service.permission;version=\"6.2.0\",com.liferay.portlet.messageboards.service.persistence;version=\"6.2.0\",com.liferay.portlet.messageboards.service;version=\"6.2.0\",com.liferay.portlet.messageboards.social;version=\"6.2.0\",com.liferay.portlet.messageboards.util.comparator;version=\"6.2.0\",com.liferay.portlet.messageboards.util;version=\"6.2.0\",com.liferay.portlet.messageboards.workflow;version=\"6.2.0\",com.liferay.portlet.messageboards;version=\"6.2.0\",com.liferay.portlet.mobiledevicerules.action;version=\"6.2.0\",com.liferay.portlet.mobiledevicerules.model.impl;version=\"6.2.0\",com.liferay.portlet.mobiledevicerules.model;version=\"6.2.0\",com.liferay.portlet.mobiledevicerules.search;version=\"6.2.0\",com.liferay.portlet.mobiledevicerules.service.base;version=\"6.2.0\",com.liferay.portlet.mobiledevicerules.service.http;version=\"6.2.0\",com.liferay.portlet.mobiledevicerules.service.impl;version=\"6.2.0\",com.liferay.portlet.mobiledevicerules.service.permission;version=\"6.2.0\",com.liferay.portlet.mobiledevicerules.service.persistence;version=\"6.2.0\",com.liferay.portlet.mobiledevicerules.service;version=\"6.2.0\",com.liferay.portlet.mobiledevicerules.util;version=\"6.2.0\",com.liferay.portlet.mobiledevicerules;version=\"6.2.0\",com.liferay.portlet.monitoring.action;version=\"6.2.0\",com.liferay.portlet.monitoring;version=\"6.2.0\",com.liferay.portlet.myaccount.action;version=\"6.2.0\",com.liferay.portlet.myaccount;version=\"6.2.0\",com.liferay.portlet.mypages.action;version=\"6.2.0\",com.liferay.portlet.mypages;version=\"6.2.0\",com.liferay.portlet.myplaces.action;version=\"6.2.0\",com.liferay.portlet.myplaces;version=\"6.2.0\",com.liferay.portlet.nestedportlets.action;version=\"6.2.0\",com.liferay.portlet.nestedportlets;version=\"6.2.0\",com.liferay.portlet.network.model;version=\"6.2.0\",com.liferay.portlet.network.util;version=\"6.2.0\",com.liferay.portlet.network;version=\"6.2.0\",com.liferay.portlet.pagecomments.lar;version=\"6.2.0\",com.liferay.portlet.pagecomments;version=\"6.2.0\",com.liferay.portlet.pageratings.lar;version=\"6.2.0\",com.liferay.portlet.pageratings;version=\"6.2.0\",com.liferay.portlet.passwordpoliciesadmin.action;version=\"6.2.0\",com.liferay.portlet.passwordpoliciesadmin.search;version=\"6.2.0\",com.liferay.portlet.passwordpoliciesadmin.util;version=\"6.2.0\",com.liferay.portlet.passwordpoliciesadmin;version=\"6.2.0\",com.liferay.portlet.plugininstaller.action;version=\"6.2.0\",com.liferay.portlet.plugininstaller;version=\"6.2.0\",com.liferay.portlet.pluginsadmin.action;version=\"6.2.0\",com.liferay.portlet.pluginsadmin;version=\"6.2.0\",com.liferay.portlet.polls.action;version=\"6.2.0\",com.liferay.portlet.polls.lar;version=\"6.2.0\",com.liferay.portlet.polls.model.impl;version=\"6.2.0\",com.liferay.portlet.polls.model;version=\"6.2.0\",com.liferay.portlet.polls.service.base;version=\"6.2.0\",com.liferay.portlet.polls.service.http;version=\"6.2.0\",com.liferay.portlet.polls.service.impl;version=\"6.2.0\",com.liferay.portlet.polls.service.permission;version=\"6.2.0\",com.liferay.portlet.polls.service.persistence;version=\"6.2.0\",com.liferay.portlet.polls.service;version=\"6.2.0\",com.liferay.portlet.polls.util;version=\"6.2.0\",com.liferay.portlet.polls;version=\"6.2.0\",com.liferay.portlet.pollsdisplay.action;version=\"6.2.0\",com.liferay.portlet.pollsdisplay;version=\"6.2.0\",com.liferay.portlet.portalsettings.action;version=\"6.2.0\",com.liferay.portlet.portalsettings;version=\"6.2.0\",com.liferay.portlet.portletconfiguration.action;version=\"6.2.0\",com.liferay.portlet.portletconfiguration.util;version=\"6.2.0\",com.liferay.portlet.portletconfiguration;version=\"6.2.0\",com.liferay.portlet.portletsharing.action;version=\"6.2.0\",com.liferay.portlet.portletsharing;version=\"6.2.0\",com.liferay.portlet.quicknote.action;version=\"6.2.0\",com.liferay.portlet.quicknote;version=\"6.2.0\",com.liferay.portlet.ratings.action;version=\"6.2.0\",com.liferay.portlet.ratings.model.impl;version=\"6.2.0\",com.liferay.portlet.ratings.model;version=\"6.2.0\",com.liferay.portlet.ratings.service.base;version=\"6.2.0\",com.liferay.portlet.ratings.service.http;version=\"6.2.0\",com.liferay.portlet.ratings.service.impl;version=\"6.2.0\",com.liferay.portlet.ratings.service.persistence;version=\"6.2.0\",com.liferay.portlet.ratings.service;version=\"6.2.0\",com.liferay.portlet.ratings;version=\"6.2.0\",com.liferay.portlet.requests.action;version=\"6.2.0\",com.liferay.portlet.requests;version=\"6.2.0\",com.liferay.portlet.rolesadmin.action;version=\"6.2.0\",com.liferay.portlet.rolesadmin.search;version=\"6.2.0\",com.liferay.portlet.rolesadmin.util;version=\"6.2.0\",com.liferay.portlet.rolesadmin;version=\"6.2.0\",com.liferay.portlet.rss.action;version=\"6.2.0\",com.liferay.portlet.rss.lar;version=\"6.2.0\",com.liferay.portlet.rss.util;version=\"6.2.0\",com.liferay.portlet.rss;version=\"6.2.0\",com.liferay.portlet.search.action;version=\"6.2.0\",com.liferay.portlet.search;version=\"6.2.0\",com.liferay.portlet.shopping.action;version=\"6.2.0\",com.liferay.portlet.shopping.dependencies;version=\"6.2.0\",com.liferay.portlet.shopping.model.impl;version=\"6.2.0\",com.liferay.portlet.shopping.model;version=\"6.2.0\",com.liferay.portlet.shopping.search;version=\"6.2.0\",com.liferay.portlet.shopping.service.base;version=\"6.2.0\",com.liferay.portlet.shopping.service.http;version=\"6.2.0\",com.liferay.portlet.shopping.service.impl;version=\"6.2.0\",com.liferay.portlet.shopping.service.permission;version=\"6.2.0\",com.liferay.portlet.shopping.service.persistence;version=\"6.2.0\",com.liferay.portlet.shopping.service;version=\"6.2.0\",com.liferay.portlet.shopping.util.comparator;version=\"6.2.0\",com.liferay.portlet.shopping.util;version=\"6.2.0\",com.liferay.portlet.shopping;version=\"6.2.0\",com.liferay.portlet.sites.action;version=\"6.2.0\",com.liferay.portlet.sites.dependencies;version=\"6.2.0\",com.liferay.portlet.sites.search;version=\"6.2.0\",com.liferay.portlet.sites.util;version=\"6.2.0\",com.liferay.portlet.sites;version=\"6.2.0\",com.liferay.portlet.sitesadmin.search;version=\"6.2.0\",com.liferay.portlet.sitesadmin;version=\"6.2.0\",com.liferay.portlet.social.model.impl;version=\"6.2.0\",com.liferay.portlet.social.model;version=\"6.2.0\",com.liferay.portlet.social.service.base;version=\"6.2.0\",com.liferay.portlet.social.service.http;version=\"6.2.0\",com.liferay.portlet.social.service.impl;version=\"6.2.0\",com.liferay.portlet.social.service.persistence;version=\"6.2.0\",com.liferay.portlet.social.service;version=\"6.2.0\",com.liferay.portlet.social.util.comparator;version=\"6.2.0\",com.liferay.portlet.social.util;version=\"6.2.0\",com.liferay.portlet.social;version=\"6.2.0\",com.liferay.portlet.socialactivity.action;version=\"6.2.0\",com.liferay.portlet.socialactivity;version=\"6.2.0\",com.liferay.portlet.softwarecatalog.action;version=\"6.2.0\",com.liferay.portlet.softwarecatalog.model.impl;version=\"6.2.0\",com.liferay.portlet.softwarecatalog.model;version=\"6.2.0\",com.liferay.portlet.softwarecatalog.service.base;version=\"6.2.0\",com.liferay.portlet.softwarecatalog.service.http;version=\"6.2.0\",com.liferay.portlet.softwarecatalog.service.impl;version=\"6.2.0\",com.liferay.portlet.softwarecatalog.service.permission;version=\"6.2.0\",com.liferay.portlet.softwarecatalog.service.persistence;version=\"6.2.0\",com.liferay.portlet.softwarecatalog.service;version=\"6.2.0\",com.liferay.portlet.softwarecatalog.util.comparator;version=\"6.2.0\",com.liferay.portlet.softwarecatalog.util;version=\"6.2.0\",com.liferay.portlet.softwarecatalog;version=\"6.2.0\",com.liferay.portlet.stagingbar.action;version=\"6.2.0\",com.liferay.portlet.stagingbar;version=\"6.2.0\",com.liferay.portlet.tagscompiler.util;version=\"6.2.0\",com.liferay.portlet.tagscompiler;version=\"6.2.0\",com.liferay.portlet.translator.model;version=\"6.2.0\",com.liferay.portlet.translator.util;version=\"6.2.0\",com.liferay.portlet.translator;version=\"6.2.0\",com.liferay.portlet.unitconverter.model;version=\"6.2.0\",com.liferay.portlet.unitconverter.util;version=\"6.2.0\",com.liferay.portlet.unitconverter;version=\"6.2.0\",com.liferay.portlet.usergroupsadmin.action;version=\"6.2.0\",com.liferay.portlet.usergroupsadmin.search;version=\"6.2.0\",com.liferay.portlet.usergroupsadmin;version=\"6.2.0\",com.liferay.portlet.usersadmin.action;version=\"6.2.0\",com.liferay.portlet.usersadmin.atom;version=\"6.2.0\",com.liferay.portlet.usersadmin.search;version=\"6.2.0\",com.liferay.portlet.usersadmin.util;version=\"6.2.0\",com.liferay.portlet.usersadmin;version=\"6.2.0\",com.liferay.portlet.webproxy.action;version=\"6.2.0\",com.liferay.portlet.webproxy;version=\"6.2.0\",com.liferay.portlet.wiki.action;version=\"6.2.0\",com.liferay.portlet.wiki.asset;version=\"6.2.0\",com.liferay.portlet.wiki.dependencies;version=\"6.2.0\",com.liferay.portlet.wiki.engines.antlrwiki.translator.internal;version=\"6.2.0\",com.liferay.portlet.wiki.engines.antlrwiki.translator;version=\"6.2.0\",com.liferay.portlet.wiki.engines.antlrwiki;version=\"6.2.0\",com.liferay.portlet.wiki.engines.jspwiki.filters;version=\"6.2.0\",com.liferay.portlet.wiki.engines.jspwiki.plugin;version=\"6.2.0\",com.liferay.portlet.wiki.engines.jspwiki;version=\"6.2.0\",com.liferay.portlet.wiki.engines.mediawiki.matchers;version=\"6.2.0\",com.liferay.portlet.wiki.engines.mediawiki;version=\"6.2.0\",com.liferay.portlet.wiki.engines;version=\"6.2.0\",com.liferay.portlet.wiki.importers.mediawiki;version=\"6.2.0\",com.liferay.portlet.wiki.importers;version=\"6.2.0\",com.liferay.portlet.wiki.lar;version=\"6.2.0\",com.liferay.portlet.wiki.model.impl;version=\"6.2.0\",com.liferay.portlet.wiki.model;version=\"6.2.0\",com.liferay.portlet.wiki.security.permission;version=\"6.2.0\",com.liferay.portlet.wiki.security;version=\"6.2.0\",com.liferay.portlet.wiki.service.base;version=\"6.2.0\",com.liferay.portlet.wiki.service.http;version=\"6.2.0\",com.liferay.portlet.wiki.service.impl;version=\"6.2.0\",com.liferay.portlet.wiki.service.permission;version=\"6.2.0\",com.liferay.portlet.wiki.service.persistence;version=\"6.2.0\",com.liferay.portlet.wiki.service;version=\"6.2.0\",com.liferay.portlet.wiki.social;version=\"6.2.0\",com.liferay.portlet.wiki.translators;version=\"6.2.0\",com.liferay.portlet.wiki.util.comparator;version=\"6.2.0\",com.liferay.portlet.wiki.util;version=\"6.2.0\",com.liferay.portlet.wiki.workflow;version=\"6.2.0\",com.liferay.portlet.wiki;version=\"6.2.0\",com.liferay.portlet.wikidisplay.action;version=\"6.2.0\",com.liferay.portlet.wikidisplay;version=\"6.2.0\",com.liferay.portlet.workflowdefinitionlinks.action;version=\"6.2.0\",com.liferay.portlet.workflowdefinitionlinks;version=\"6.2.0\",com.liferay.portlet.workflowdefinitions.action;version=\"6.2.0\",com.liferay.portlet.workflowdefinitions;version=\"6.2.0\",com.liferay.portlet.workflowinstances.action;version=\"6.2.0\",com.liferay.portlet.workflowinstances;version=\"6.2.0\",com.liferay.portlet.workflowtasks.action;version=\"6.2.0\",com.liferay.portlet.workflowtasks.search;version=\"6.2.0\",com.liferay.portlet.workflowtasks;version=\"6.2.0\",com.liferay.portlet.xslcontent.action;version=\"6.2.0\",com.liferay.portlet.xslcontent.util;version=\"6.2.0\",com.liferay.portlet.xslcontent;version=\"6.2.0\",com.liferay.portlet;version=\"6.2.0\",com.liferay.taglib.aui.base;version=\"6.2.0\",com.liferay.taglib.aui;version=\"6.2.0\",com.liferay.taglib.core;version=\"6.2.0\",com.liferay.taglib.faces.converter;version=\"6.2.0\",com.liferay.taglib.faces.util;version=\"6.2.0\",com.liferay.taglib.faces.validator;version=\"6.2.0\",com.liferay.taglib.faces;version=\"6.2.0\",com.liferay.taglib.portlet;version=\"6.2.0\",com.liferay.taglib.portletext;version=\"6.2.0\",com.liferay.taglib.security;version=\"6.2.0\",com.liferay.taglib.theme;version=\"6.2.0\",com.liferay.taglib.ui;version=\"6.2.0\",com.liferay.taglib.util;version=\"6.2.0\",com.liferay.taglib;version=\"6.2.0\",com.liferay.util.ant;version=\"6.2.0\",com.liferay.util.aspectj;version=\"6.2.0\",com.liferay.util.axis;version=\"6.2.0\",com.liferay.util.bean,com.liferay.util.bean;version=\"6.2.0\",com.liferay.util.bridges.alloy;version=\"6.2.0\",com.liferay.util.bridges.bsf;version=\"6.2.0\",com.liferay.util.bridges.common;version=\"6.2.0\",com.liferay.util.bridges.groovy;version=\"6.2.0\",com.liferay.util.bridges.javascript;version=\"6.2.0\",com.liferay.util.bridges.jsf.common.comparator;version=\"6.2.0\",com.liferay.util.bridges.jsf.common;version=\"6.2.0\",com.liferay.util.bridges.jsf.icefaces;version=\"6.2.0\",com.liferay.util.bridges.jsf.myfaces;version=\"6.2.0\",com.liferay.util.bridges.jsf.sun;version=\"6.2.0\",com.liferay.util.bridges.jsf;version=\"6.2.0\",com.liferay.util.bridges.jsp;version=\"6.2.0\",com.liferay.util.bridges.mvc;version=\"6.2.0\",com.liferay.util.bridges.php;version=\"6.2.0\",com.liferay.util.bridges.python;version=\"6.2.0\",com.liferay.util.bridges.ruby;version=\"6.2.0\",com.liferay.util.bridges.scripting;version=\"6.2.0\",com.liferay.util.bridges.struts;version=\"6.2.0\",com.liferay.util.bridges.wai;version=\"6.2.0\",com.liferay.util.bridges;version=\"6.2.0\",com.liferay.util.cal;version=\"6.2.0\",com.liferay.util.dao.orm.hibernate;version=\"6.2.0\",com.liferay.util.dao.orm;version=\"6.2.0\",com.liferay.util.dao;version=\"6.2.0\",com.liferay.util.derby;version=\"6.2.0\",com.liferay.util.diff;version=\"6.2.0\",com.liferay.util.format;version=\"6.2.0\",com.liferay.util.freemarker;version=\"6.2.0\",com.liferay.util.jazzy;version=\"6.2.0\",com.liferay.util.json;version=\"6.2.0\",com.liferay.util.ldap;version=\"6.2.0\",com.liferay.util.log4j;version=\"6.2.0\",com.liferay.util.lucene;version=\"6.2.0\",com.liferay.util.mail;version=\"6.2.0\",com.liferay.util.poi;version=\"6.2.0\",com.liferay.util.portlet;version=\"6.2.0\",com.liferay.util.service;version=\"6.2.0\",com.liferay.util.servlet.filters;version=\"6.2.0\",com.liferay.util.servlet;version=\"6.2.0\",com.liferay.util.sl4fj;version=\"6.2.0\",com.liferay.util.spring.transaction;version=\"6.2.0\",com.liferay.util.spring;version=\"6.2.0\",com.liferay.util.transport;version=\"6.2.0\",com.liferay.util.xml.descriptor;version=\"6.2.0\",com.liferay.util.xml;version=\"6.2.0\",com.liferay.util;version=\"6.2.0\",com.liferay;version=\"6.2.0\",freemarker.ext.servlet,freemarker.template,javax.annotation.security;version=\"1.1.0\",javax.annotation;version=\"1.1.0\",javax.el;version=\"2.2.0\",javax.faces.convert,javax.faces.webapp,javax.mail.event;version=\"1.4\",javax.mail.internet;version=\"1.4\",javax.mail.search;version=\"1.4\",javax.mail.util;version=\"1.4\",javax.mail;version=\"1.4\",javax.portlet.filter;version=\"2.0.0\",javax.portlet;version=\"2.0.0\",javax.servlet.annotation;version=\"3.0.0\",javax.servlet.descriptor;version=\"3.0.0\",javax.servlet.http;version=\"3.0.0\",javax.servlet.jsp.el;version=\"2.2\",javax.servlet.jsp.jstl.core;version=\"1.2\",javax.servlet.jsp.jstl.fmt;version=\"1.2\",javax.servlet.jsp.jstl.sql;version=\"1.2\",javax.servlet.jsp.jstl.tlv;version=\"1.2\",javax.servlet.jsp.resources;version=\"2.2\",javax.servlet.jsp.tagext;version=\"2.2\",javax.servlet.jsp;version=\"2.2\",javax.servlet.resources;version=\"3.0.0\",javax.servlet;version=\"3.0.0\",org.aopalliance.aop,org.aopalliance.intercept,org.apache.commons.codec,org.apache.commons.codec.binary,org.apache.commons.codec.digest,org.apache.commons.codec.languages,org.apache.commons.codec.net,org.apache.commons.fileupload,org.apache.commons.fileupload.disk,org.apache.commons.fileupload.portlet,org.apache.commons.fileupload.servlet,org.apache.commons.fileupload.util,org.apache.commons.io,org.apache.commons.io.comparator,org.apache.commons.io.filefilter,org.apache.commons.io.input,org.apache.commons.io.output,org.apache.commons.lang,org.apache.commons.lang.builder,org.apache.commons.lang.enums,org.apache.commons.lang.exception,org.apache.commons.lang.math,org.apache.commons.lang.mutable,org.apache.commons.lang.reflect,org.apache.commons.lang.text,org.apache.commons.lang.time,org.apache.commons.logging;version=\"1.1.1\",org.apache.el,org.apache.jasper,org.apache.jasper.runtime,org.apache.jasper.servlet,org.apache.log4j,org.apache.log4j.chainsaw,org.apache.log4j.config,org.apache.log4j.helpers,org.apache.log4j.jdbc,org.apache.log4j.jmx,org.apache.log4j.lf5,org.apache.log4j.lf5.util,org.apache.log4j.lf5.viewer,org.apache.log4j.net,org.apache.log4j.nt,org.apache.log4j.or,org.apache.log4j.or.jms,org.apache.log4j.or.sax,org.apache.log4j.pattern,org.apache.log4j.spi,org.apache.log4j.varia,org.apache.log4j.xml,org.apache.naming,org.apache.naming.factory,org.apache.naming.java,org.apache.naming.resources,org.apache.naming.resources.jndi,org.apache.taglibs.standard.functions,org.apache.taglibs.standard.resources,org.apache.taglibs.standard.tag.common.core,org.apache.taglibs.standard.tag.rt.core,org.apache.taglibs.standard.tei,org.apache.taglibs.standard.tlv,org.apache.tomcat,org.eclipse.jdt.core.compiler;version=\"3.7.0.I20110613-1736\",org.eclipse.jdt.core;version=\"3.7.0.I20110613-1736\",org.eclipse.jdt.internal.antadapter;version=\"3.7.0.I20110613-1736\",org.eclipse.jdt.internal.compiler.apt.dispatch;version=\"3.7.0.I20110613-1736\",org.eclipse.jdt.internal.compiler.apt.model;version=\"3.7.0.I20110613-1736\",org.eclipse.jdt.internal.compiler.apt.util;version=\"3.7.0.I20110613-1736\",org.eclipse.jdt.internal.compiler.ast;version=\"3.7.0.I20110613-1736\",org.eclipse.jdt.internal.compiler.batch;version=\"3.7.0.I20110613-1736\",org.eclipse.jdt.internal.compiler.classfmt;version=\"3.7.0.I20110613-1736\",org.eclipse.jdt.internal.compiler.codegen;version=\"3.7.0.I20110613-1736\",org.eclipse.jdt.internal.compiler.env;version=\"3.7.0.I20110613-1736\",org.eclipse.jdt.internal.compiler.flow;version=\"3.7.0.I20110613-1736\",org.eclipse.jdt.internal.compiler.impl;version=\"3.7.0.I20110613-1736\",org.eclipse.jdt.internal.compiler.lookup;version=\"3.7.0.I20110613-1736\",org.eclipse.jdt.internal.compiler.parser.diagnose;version=\"3.7.0.I20110613-1736\",org.eclipse.jdt.internal.compiler.parser;version=\"3.7.0.I20110613-1736\",org.eclipse.jdt.internal.compiler.problem;version=\"3.7.0.I20110613-1736\",org.eclipse.jdt.internal.compiler.tool;version=\"3.7.0.I20110613-1736\",org.eclipse.jdt.internal.compiler.util;version=\"3.7.0.I20110613-1736\",org.eclipse.jdt.internal.compiler;version=\"3.7.0.I20110613-1736\",org.objectweb.asm,org.objectweb.asm.commons,org.objectweb.asm.signature,org.slf4j.impl;version=\"6.2.0\",org.slf4j;version=\"6.2.0\",org.springframework.aop.aspectj.annotation;version=\"3.0.6.RELEASE\",org.springframework.aop.aspectj.autoproxy;version=\"3.0.6.RELEASE\",org.springframework.aop.aspectj;version=\"3.0.6.RELEASE\",org.springframework.aop.config;version=\"3.0.6.RELEASE\",org.springframework.aop.framework.adapter;version=\"3.0.6.RELEASE\",org.springframework.aop.framework.autoproxy.target;version=\"3.0.6.RELEASE\",org.springframework.aop.framework.autoproxy;version=\"3.0.6.RELEASE\",org.springframework.aop.framework;version=\"3.0.6.RELEASE\",org.springframework.aop.interceptor;version=\"3.0.6.RELEASE\",org.springframework.aop.scope;version=\"3.0.6.RELEASE\",org.springframework.aop.support.annotation;version=\"3.0.6.RELEASE\",org.springframework.aop.support;version=\"3.0.6.RELEASE\",org.springframework.aop.target.dynamic;version=\"3.0.6.RELEASE\",org.springframework.aop.target;version=\"3.0.6.RELEASE\",org.springframework.aop;version=\"3.0.6.RELEASE\",org.springframework.asm.commons;version=\"3.0.6.RELEASE\",org.springframework.asm.signature;version=\"3.0.6.RELEASE\",org.springframework.asm;version=\"3.0.6.RELEASE\",org.springframework.beans.annotation;version=\"3.0.6.RELEASE\",org.springframework.beans.factory.access.el;version=\"3.0.6.RELEASE\",org.springframework.beans.factory.access;version=\"3.0.6.RELEASE\",org.springframework.beans.factory.annotation;version=\"3.0.6.RELEASE\",org.springframework.beans.factory.aspectj;version=\"3.0.6.RELEASE\",org.springframework.beans.factory.config;version=\"3.0.6.RELEASE\",org.springframework.beans.factory.parsing;version=\"3.0.6.RELEASE\",org.springframework.beans.factory.serviceloader;version=\"3.0.6.RELEASE\",org.springframework.beans.factory.support;version=\"3.0.6.RELEASE\",org.springframework.beans.factory.wiring;version=\"3.0.6.RELEASE\",org.springframework.beans.factory.xml;version=\"3.0.6.RELEASE\",org.springframework.beans.factory;version=\"3.0.6.RELEASE\",org.springframework.beans.propertyeditors;version=\"3.0.6.RELEASE\",org.springframework.beans.support;version=\"3.0.6.RELEASE\",org.springframework.beans;version=\"3.0.6.RELEASE\",org.springframework.cache.ehcache;version=\"3.0.6.RELEASE\",org.springframework.context.access;version=\"3.0.6.RELEASE\",org.springframework.context.annotation;version=\"3.0.6.RELEASE\",org.springframework.context.config;version=\"3.0.6.RELEASE\",org.springframework.context.event;version=\"3.0.6.RELEASE\",org.springframework.context.expression;version=\"3.0.6.RELEASE\",org.springframework.context.i18n;version=\"3.0.6.RELEASE\",org.springframework.context.support;version=\"3.0.6.RELEASE\",org.springframework.context.weaving;version=\"3.0.6.RELEASE\",org.springframework.context;version=\"3.0.6.RELEASE\",org.springframework.core.annotation;version=\"3.0.6.RELEASE\",org.springframework.core.convert.converter;version=\"3.0.6.RELEASE\",org.springframework.core.convert.support;version=\"3.0.6.RELEASE\",org.springframework.core.convert;version=\"3.0.6.RELEASE\",org.springframework.core.enums;version=\"3.0.6.RELEASE\",org.springframework.core.io.support;version=\"3.0.6.RELEASE\",org.springframework.core.io;version=\"3.0.6.RELEASE\",org.springframework.core.serializer.support;version=\"3.0.6.RELEASE\",org.springframework.core.serializer;version=\"3.0.6.RELEASE\",org.springframework.core.style;version=\"3.0.6.RELEASE\",org.springframework.core.task.support;version=\"3.0.6.RELEASE\",org.springframework.core.task;version=\"3.0.6.RELEASE\",org.springframework.core.type.classreading;version=\"3.0.6.RELEASE\",org.springframework.core.type.filter;version=\"3.0.6.RELEASE\",org.springframework.core.type;version=\"3.0.6.RELEASE\",org.springframework.core;version=\"3.0.6.RELEASE\",org.springframework.dao.annotation;version=\"3.0.6.RELEASE\",org.springframework.dao.support;version=\"3.0.6.RELEASE\",org.springframework.dao;version=\"3.0.6.RELEASE\",org.springframework.ejb.access;version=\"3.0.6.RELEASE\",org.springframework.ejb.config;version=\"3.0.6.RELEASE\",org.springframework.ejb.interceptor;version=\"3.0.6.RELEASE\",org.springframework.ejb.support;version=\"3.0.6.RELEASE\",org.springframework.expression.common;version=\"3.0.6.RELEASE\",org.springframework.expression.spel.ast;version=\"3.0.6.RELEASE\",org.springframework.expression.spel.generated;version=\"3.0.6.RELEASE\",org.springframework.expression.spel.standard;version=\"3.0.6.RELEASE\",org.springframework.expression.spel.support;version=\"3.0.6.RELEASE\",org.springframework.expression.spel;version=\"3.0.6.RELEASE\",org.springframework.expression;version=\"3.0.6.RELEASE\",org.springframework.format.annotation;version=\"3.0.6.RELEASE\",org.springframework.format.datetime.joda;version=\"3.0.6.RELEASE\",org.springframework.format.datetime;version=\"3.0.6.RELEASE\",org.springframework.format.number;version=\"3.0.6.RELEASE\",org.springframework.format.support;version=\"3.0.6.RELEASE\",org.springframework.format;version=\"3.0.6.RELEASE\",org.springframework.http.client.support;version=\"3.0.6.RELEASE\",org.springframework.http.client;version=\"3.0.6.RELEASE\",org.springframework.http.converter.feed;version=\"3.0.6.RELEASE\",org.springframework.http.converter.json;version=\"3.0.6.RELEASE\",org.springframework.http.converter.xml;version=\"3.0.6.RELEASE\",org.springframework.http.converter;version=\"3.0.6.RELEASE\",org.springframework.http.server;version=\"3.0.6.RELEASE\",org.springframework.http;version=\"3.0.6.RELEASE\",org.springframework.instrument.classloading.glassfish;version=\"3.0.6.RELEASE\",org.springframework.instrument.classloading.jboss;version=\"3.0.6.RELEASE\",org.springframework.instrument.classloading.oc4j;version=\"3.0.6.RELEASE\",org.springframework.instrument.classloading.weblogic;version=\"3.0.6.RELEASE\",org.springframework.instrument.classloading;version=\"3.0.6.RELEASE\",org.springframework.jca.cci.connection;version=\"3.0.6.RELEASE\",org.springframework.jca.cci.core.support;version=\"3.0.6.RELEASE\",org.springframework.jca.cci.core;version=\"3.0.6.RELEASE\",org.springframework.jca.cci.object;version=\"3.0.6.RELEASE\",org.springframework.jca.cci;version=\"3.0.6.RELEASE\",org.springframework.jca.context;version=\"3.0.6.RELEASE\",org.springframework.jca.endpoint;version=\"3.0.6.RELEASE\",org.springframework.jca.support;version=\"3.0.6.RELEASE\",org.springframework.jca.work.glassfish;version=\"3.0.6.RELEASE\",org.springframework.jca.work.jboss;version=\"3.0.6.RELEASE\",org.springframework.jca.work;version=\"3.0.6.RELEASE\",org.springframework.jdbc.config;version=\"3.0.6.RELEASE\",org.springframework.jdbc.core.metadata;version=\"3.0.6.RELEASE\",org.springframework.jdbc.core.namedparam;version=\"3.0.6.RELEASE\",org.springframework.jdbc.core.simple;version=\"3.0.6.RELEASE\",org.springframework.jdbc.core.support;version=\"3.0.6.RELEASE\",org.springframework.jdbc.core;version=\"3.0.6.RELEASE\",org.springframework.jdbc.datasource.embedded;version=\"3.0.6.RELEASE\",org.springframework.jdbc.datasource.init;version=\"3.0.6.RELEASE\",org.springframework.jdbc.datasource.lookup;version=\"3.0.6.RELEASE\",org.springframework.jdbc.datasource;version=\"3.0.6.RELEASE\",org.springframework.jdbc.object;version=\"3.0.6.RELEASE\",org.springframework.jdbc.support.incrementer;version=\"3.0.6.RELEASE\",org.springframework.jdbc.support.lob;version=\"3.0.6.RELEASE\",org.springframework.jdbc.support.nativejdbc;version=\"3.0.6.RELEASE\",org.springframework.jdbc.support.rowset;version=\"3.0.6.RELEASE\",org.springframework.jdbc.support.xml;version=\"3.0.6.RELEASE\",org.springframework.jdbc.support;version=\"3.0.6.RELEASE\",org.springframework.jdbc;version=\"3.0.6.RELEASE\",org.springframework.jms.config;version=\"3.0.6.RELEASE\",org.springframework.jms.connection;version=\"3.0.6.RELEASE\",org.springframework.jms.core.support;version=\"3.0.6.RELEASE\",org.springframework.jms.core;version=\"3.0.6.RELEASE\",org.springframework.jms.listener.adapter;version=\"3.0.6.RELEASE\",org.springframework.jms.listener.endpoint;version=\"3.0.6.RELEASE\",org.springframework.jms.listener;version=\"3.0.6.RELEASE\",org.springframework.jms.remoting;version=\"3.0.6.RELEASE\",org.springframework.jms.support.converter;version=\"3.0.6.RELEASE\",org.springframework.jms.support.destination;version=\"3.0.6.RELEASE\",org.springframework.jms.support;version=\"3.0.6.RELEASE\",org.springframework.jms;version=\"3.0.6.RELEASE\",org.springframework.jmx.access;version=\"3.0.6.RELEASE\",org.springframework.jmx.export.annotation;version=\"3.0.6.RELEASE\",org.springframework.jmx.export.assembler;version=\"3.0.6.RELEASE\",org.springframework.jmx.export.metadata;version=\"3.0.6.RELEASE\",org.springframework.jmx.export.naming;version=\"3.0.6.RELEASE\",org.springframework.jmx.export.notification;version=\"3.0.6.RELEASE\",org.springframework.jmx.export;version=\"3.0.6.RELEASE\",org.springframework.jmx.support;version=\"3.0.6.RELEASE\",org.springframework.jmx;version=\"3.0.6.RELEASE\",org.springframework.jndi.support;version=\"3.0.6.RELEASE\",org.springframework.jndi;version=\"3.0.6.RELEASE\",org.springframework.mail.javamail;version=\"3.0.6.RELEASE\",org.springframework.mail;version=\"3.0.6.RELEASE\",org.springframework.mock.staticmock;version=\"3.0.6.RELEASE\",org.springframework.orm.hibernate3.annotation;version=\"3.0.6.RELEASE\",org.springframework.orm.hibernate3.support;version=\"3.0.6.RELEASE\",org.springframework.orm.hibernate3;version=\"3.0.6.RELEASE\",org.springframework.orm.ibatis.support;version=\"3.0.6.RELEASE\",org.springframework.orm.ibatis;version=\"3.0.6.RELEASE\",org.springframework.orm.jdo.support;version=\"3.0.6.RELEASE\",org.springframework.orm.jdo;version=\"3.0.6.RELEASE\",org.springframework.orm.jpa.aspectj;version=\"3.0.6.RELEASE\",org.springframework.orm.jpa.persistenceunit;version=\"3.0.6.RELEASE\",org.springframework.orm.jpa.support;version=\"3.0.6.RELEASE\",org.springframework.orm.jpa.vendor;version=\"3.0.6.RELEASE\",org.springframework.orm.jpa;version=\"3.0.6.RELEASE\",org.springframework.orm;version=\"3.0.6.RELEASE\",org.springframework.oxm.castor;version=\"3.0.6.RELEASE\",org.springframework.oxm.config;version=\"3.0.6.RELEASE\",org.springframework.oxm.jaxb;version=\"3.0.6.RELEASE\",org.springframework.oxm.jibx;version=\"3.0.6.RELEASE\",org.springframework.oxm.mime;version=\"3.0.6.RELEASE\",org.springframework.oxm.support;version=\"3.0.6.RELEASE\",org.springframework.oxm.xmlbeans;version=\"3.0.6.RELEASE\",org.springframework.oxm.xstream;version=\"3.0.6.RELEASE\",org.springframework.oxm;version=\"3.0.6.RELEASE\",org.springframework.remoting.caucho;version=\"3.0.6.RELEASE\",org.springframework.remoting.httpinvoker;version=\"3.0.6.RELEASE\",org.springframework.remoting.jaxrpc;version=\"3.0.6.RELEASE\",org.springframework.remoting.jaxws;version=\"3.0.6.RELEASE\",org.springframework.remoting.rmi;version=\"3.0.6.RELEASE\",org.springframework.remoting.soap;version=\"3.0.6.RELEASE\",org.springframework.remoting.support;version=\"3.0.6.RELEASE\",org.springframework.remoting;version=\"3.0.6.RELEASE\",org.springframework.scheduling.annotation;version=\"3.0.6.RELEASE\",org.springframework.scheduling.aspectj;version=\"3.0.6.RELEASE\",org.springframework.scheduling.backportconcurrent;version=\"3.0.6.RELEASE\",org.springframework.scheduling.commonj;version=\"3.0.6.RELEASE\",org.springframework.scheduling.concurrent;version=\"3.0.6.RELEASE\",org.springframework.scheduling.config;version=\"3.0.6.RELEASE\",org.springframework.scheduling.quartz;version=\"3.0.6.RELEASE\",org.springframework.scheduling.support;version=\"3.0.6.RELEASE\",org.springframework.scheduling.timer;version=\"3.0.6.RELEASE\",org.springframework.scheduling;version=\"3.0.6.RELEASE\",org.springframework.scripting.bsh;version=\"3.0.6.RELEASE\",org.springframework.scripting.config;version=\"3.0.6.RELEASE\",org.springframework.scripting.groovy;version=\"3.0.6.RELEASE\",org.springframework.scripting.jruby;version=\"3.0.6.RELEASE\",org.springframework.scripting.support;version=\"3.0.6.RELEASE\",org.springframework.scripting;version=\"3.0.6.RELEASE\",org.springframework.stereotype;version=\"3.0.6.RELEASE\",org.springframework.transaction.annotation;version=\"3.0.6.RELEASE\",org.springframework.transaction.aspectj;version=\"3.0.6.RELEASE\",org.springframework.transaction.config;version=\"3.0.6.RELEASE\",org.springframework.transaction.interceptor;version=\"3.0.6.RELEASE\",org.springframework.transaction.jta;version=\"3.0.6.RELEASE\",org.springframework.transaction.support;version=\"3.0.6.RELEASE\",org.springframework.transaction;version=\"3.0.6.RELEASE\",org.springframework.ui.context.support;version=\"3.0.6.RELEASE\",org.springframework.ui.context;version=\"3.0.6.RELEASE\",org.springframework.ui.freemarker;version=\"3.0.6.RELEASE\",org.springframework.ui.jasperreports;version=\"3.0.6.RELEASE\",org.springframework.ui.velocity;version=\"3.0.6.RELEASE\",org.springframework.ui;version=\"3.0.6.RELEASE\",org.springframework.util.comparator;version=\"3.0.6.RELEASE\",org.springframework.util.xml;version=\"3.0.6.RELEASE\",org.springframework.util;version=\"3.0.6.RELEASE\",org.springframework.validation.beanvalidation;version=\"3.0.6.RELEASE\",org.springframework.validation.support;version=\"3.0.6.RELEASE\",org.springframework.validation;version=\"3.0.6.RELEASE\",org.springframework.web.bind.annotation.support;version=\"3.0.6.RELEASE\",org.springframework.web.bind.annotation;version=\"3.0.6.RELEASE\",org.springframework.web.bind.support;version=\"3.0.6.RELEASE\",org.springframework.web.bind;version=\"3.0.6.RELEASE\",org.springframework.web.client.support;version=\"3.0.6.RELEASE\",org.springframework.web.client;version=\"3.0.6.RELEASE\",org.springframework.web.context.request;version=\"3.0.6.RELEASE\",org.springframework.web.context.support;version=\"3.0.6.RELEASE\",org.springframework.web.context;version=\"3.0.6.RELEASE\",org.springframework.web.filter;version=\"3.0.6.RELEASE\",org.springframework.web.jsf.el;version=\"3.0.6.RELEASE\",org.springframework.web.jsf;version=\"3.0.6.RELEASE\",org.springframework.web.multipart.commons;version=\"3.0.6.RELEASE\",org.springframework.web.multipart.support;version=\"3.0.6.RELEASE\",org.springframework.web.multipart;version=\"3.0.6.RELEASE\",org.springframework.web.portlet.bind.annotation;version=\"3.0.6.RELEASE\",org.springframework.web.portlet.bind;version=\"3.0.6.RELEASE\",org.springframework.web.portlet.context;version=\"3.0.6.RELEASE\",org.springframework.web.portlet.handler;version=\"3.0.6.RELEASE\",org.springframework.web.portlet.multipart;version=\"3.0.6.RELEASE\",org.springframework.web.portlet.mvc.annotation;version=\"3.0.6.RELEASE\",org.springframework.web.portlet.mvc;version=\"3.0.6.RELEASE\",org.springframework.web.portlet.util;version=\"3.0.6.RELEASE\",org.springframework.web.portlet;version=\"3.0.6.RELEASE\",org.springframework.web.servlet.config;version=\"3.0.6.RELEASE\",org.springframework.web.servlet.handler;version=\"3.0.6.RELEASE\",org.springframework.web.servlet.i18n;version=\"3.0.6.RELEASE\",org.springframework.web.servlet.mvc.annotation;version=\"3.0.6.RELEASE\",org.springframework.web.servlet.mvc.multiaction;version=\"3.0.6.RELEASE\",org.springframework.web.servlet.mvc.support;version=\"3.0.6.RELEASE\",org.springframework.web.servlet.mvc;version=\"3.0.6.RELEASE\",org.springframework.web.servlet.resource;version=\"3.0.6.RELEASE\",org.springframework.web.servlet.support;version=\"3.0.6.RELEASE\",org.springframework.web.servlet.tags.form;version=\"3.0.6.RELEASE\",org.springframework.web.servlet.tags;version=\"3.0.6.RELEASE\",org.springframework.web.servlet.theme;version=\"3.0.6.RELEASE\",org.springframework.web.servlet.view.document;version=\"3.0.6.RELEASE\",org.springframework.web.servlet.view.feed;version=\"3.0.6.RELEASE\",org.springframework.web.servlet.view.freemarker;version=\"3.0.6.RELEASE\",org.springframework.web.servlet.view.jasperreports;version=\"3.0.6.RELEASE\",org.springframework.web.servlet.view.json;version=\"3.0.6.RELEASE\",org.springframework.web.servlet.view.tiles2;version=\"3.0.6.RELEASE\",org.springframework.web.servlet.view.tiles;version=\"3.0.6.RELEASE\",org.springframework.web.servlet.view.velocity;version=\"3.0.6.RELEASE\",org.springframework.web.servlet.view.xml;version=\"3.0.6.RELEASE\",org.springframework.web.servlet.view.xslt;version=\"3.0.6.RELEASE\",org.springframework.web.servlet.view;version=\"3.0.6.RELEASE\",org.springframework.web.servlet;version=\"3.0.6.RELEASE\",org.springframework.web.struts;version=\"3.0.6.RELEASE\",org.springframework.web.util;version=\"3.0.6.RELEASE\",org.springframework.web;version=\"3.0.6.RELEASE\""; - Dictionary[] props = new Dictionary[] {new Hashtable()}; + Dictionary[] props = new Dictionary[] { new Hashtable() }; props[0].put(Constants.FRAMEWORK_SYSTEMPACKAGES_EXTRA, longExport); state.setPlatformProperties(props); @@ -4971,12 +5279,12 @@ public void testBug376322() throws BundleException, IOException { } /** - * Test for provoking a flaw in VersionHashMap.compare(...) when sorting the VersionSupplier: - * Comparison method violates its general contracts. - * Not easy to preproduce, as it depends heavily on the internal sort algorithm, TimSort, and - * therefore trimmed real life data is used for this test. + * Test for provoking a flaw in VersionHashMap.compare(...) when sorting the + * VersionSupplier: Comparison method violates its general contracts. Not easy + * to preproduce, as it depends heavily on the internal sort algorithm, TimSort, + * and therefore trimmed real life data is used for this test. */ - public void testIssue156() throws BundleException, IOException, Exception { + public void testIssue156() throws BundleException, IOException, Exception { State state = buildEmptyState(); int bundleID = 0; Hashtable manifest = new Hashtable(); @@ -4985,78 +5293,106 @@ public void testIssue156() throws BundleException, IOException, Exception { manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "b1"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ - manifest.put(Constants.PROVIDE_CAPABILITY, "osgi.service;objectClass=\"jsS,ovbphRSS\",osgi.service;objectClass=\"dnveaAFP\",osgi.service;objectClass=\"dnvmaCU\",osgi.service;objectClass=\"dnvmaVSUU\",osgi.service;objectClass=\"dnvnaaN,ovbnINL\",osgi.service;objectClass=\"dnvnaaR,ovbcgscIJS\",osgi.service;objectClass=\"dnvtaTBSP\",osgi.service;objectClass=\"dnvwaIWS,ovbcgscIJS\",osgi.service;objectClass=\"jsS,ovbphRSS\",osgi.service;objectClass=\"ooseEH\",osgi.service;objectClass=\"dngdaDDS,ovbpIDDS\",osgi.service;objectClass=\"dnggaGF,dnggaIM\",osgi.service;objectClass=\"jsS,ovbphRSS\""); - BundleDescription b1 = state.getFactory().createBundleDescription( state, manifest, (String) manifest.get( Constants.BUNDLE_SYMBOLICNAME ) + manifest.get( Constants.BUNDLE_VERSION ), bundleID++ ); + manifest.put(Constants.PROVIDE_CAPABILITY, + "osgi.service;objectClass=\"jsS,ovbphRSS\",osgi.service;objectClass=\"dnveaAFP\",osgi.service;objectClass=\"dnvmaCU\",osgi.service;objectClass=\"dnvmaVSUU\",osgi.service;objectClass=\"dnvnaaN,ovbnINL\",osgi.service;objectClass=\"dnvnaaR,ovbcgscIJS\",osgi.service;objectClass=\"dnvtaTBSP\",osgi.service;objectClass=\"dnvwaIWS,ovbcgscIJS\",osgi.service;objectClass=\"jsS,ovbphRSS\",osgi.service;objectClass=\"ooseEH\",osgi.service;objectClass=\"dngdaDDS,ovbpIDDS\",osgi.service;objectClass=\"dnggaGF,dnggaIM\",osgi.service;objectClass=\"jsS,ovbphRSS\""); + BundleDescription b1 = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + manifest.get(Constants.BUNDLE_VERSION), + bundleID++); state.addBundle(b1); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "b2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ - manifest.put(Constants.PROVIDE_CAPABILITY,"osgi.service;objectClass=\"dnvsidDPUS,ovbsISISDP\",osgi.service;objectClass=\"dnvsidHDPUS,ovbsISISDP\",osgi.service;objectClass=\"dnggaIM,dnggarGRF\",osgi.service;objectClass=\"dnvecaCFSS\""); - BundleDescription b2 = state.getFactory().createBundleDescription( state, manifest, (String) manifest.get( Constants.BUNDLE_SYMBOLICNAME ) + manifest.get( Constants.BUNDLE_VERSION ), bundleID++ ); - state.addBundle( b2 ); + manifest.put(Constants.PROVIDE_CAPABILITY, + "osgi.service;objectClass=\"dnvsidDPUS,ovbsISISDP\",osgi.service;objectClass=\"dnvsidHDPUS,ovbsISISDP\",osgi.service;objectClass=\"dnggaIM,dnggarGRF\",osgi.service;objectClass=\"dnvecaCFSS\""); + BundleDescription b2 = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + manifest.get(Constants.BUNDLE_VERSION), + bundleID++); + state.addBundle(b2); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "b3"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ - manifest.put(Constants.PROVIDE_CAPABILITY, "osgi.service;objectClass=\"dnggaAUB,ovbaIUL\",osgi.service;objectClass=\"dnggvinEP\",osgi.service;objectClass=\"dnggvinFP\",osgi.service;objectClass=\"dngsaNS\",osgi.service;objectClass=\"dnveaAFP\",osgi.service;objectClass=\"dnvmaCU\",osgi.service;objectClass=\"dnvnaaN,ovbnINL\",osgi.service;objectClass=\"dnvnaaR,ovbcgscIJS\",osgi.service;objectClass=\"dnvtaTBSP\",osgi.service;objectClass=\"jsS,ovbphRSS\",osgi.service;objectClass=\"ooseEH\",osgi.service;objectClass=\"ovbppIFF\",osgi.service;objectClass=\"ovbppIPF\",osgi.service;objectClass=\"ovbppIRHF\",osgi.service;objectClass=\"ovbunINP\",osgi.service;objectClass=\"ovesev1sIBP\",osgi.service;objectClass=\"ovesgv3sIGS\",osgi.service;objectClass=\"ovesgv4sIGS\""); - BundleDescription b3 = state.getFactory().createBundleDescription( state, manifest, (String) manifest.get( Constants.BUNDLE_SYMBOLICNAME ) + manifest.get( Constants.BUNDLE_VERSION ), bundleID++ ); - state.addBundle( b3 ); + manifest.put(Constants.PROVIDE_CAPABILITY, + "osgi.service;objectClass=\"dnggaAUB,ovbaIUL\",osgi.service;objectClass=\"dnggvinEP\",osgi.service;objectClass=\"dnggvinFP\",osgi.service;objectClass=\"dngsaNS\",osgi.service;objectClass=\"dnveaAFP\",osgi.service;objectClass=\"dnvmaCU\",osgi.service;objectClass=\"dnvnaaN,ovbnINL\",osgi.service;objectClass=\"dnvnaaR,ovbcgscIJS\",osgi.service;objectClass=\"dnvtaTBSP\",osgi.service;objectClass=\"jsS,ovbphRSS\",osgi.service;objectClass=\"ooseEH\",osgi.service;objectClass=\"ovbppIFF\",osgi.service;objectClass=\"ovbppIPF\",osgi.service;objectClass=\"ovbppIRHF\",osgi.service;objectClass=\"ovbunINP\",osgi.service;objectClass=\"ovesev1sIBP\",osgi.service;objectClass=\"ovesgv3sIGS\",osgi.service;objectClass=\"ovesgv4sIGS\""); + BundleDescription b3 = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + manifest.get(Constants.BUNDLE_VERSION), + bundleID++); + state.addBundle(b3); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "b4"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ - manifest.put(Constants.PROVIDE_CAPABILITY, "osgi.service;objectClass=\"dngpaEP\",osgi.service;objectClass=\"dngpaGOS\",osgi.service;objectClass=\"dngpaOJS\",osgi.service;objectClass=\"dngpaPDS\",osgi.service;objectClass=\"ovbcgIPISI\",osgi.service;objectClass=\"ovbcgIPISO\",osgi.service;objectClass=\"ovbciIMA\",osgi.service;objectClass=\"ovbciIMR\",osgi.service;objectClass=\"ovbjIEF\",osgi.service;objectClass=\"ovbrIRL\""); + manifest.put(Constants.PROVIDE_CAPABILITY, + "osgi.service;objectClass=\"dngpaEP\",osgi.service;objectClass=\"dngpaGOS\",osgi.service;objectClass=\"dngpaOJS\",osgi.service;objectClass=\"dngpaPDS\",osgi.service;objectClass=\"ovbcgIPISI\",osgi.service;objectClass=\"ovbcgIPISO\",osgi.service;objectClass=\"ovbciIMA\",osgi.service;objectClass=\"ovbciIMR\",osgi.service;objectClass=\"ovbjIEF\",osgi.service;objectClass=\"ovbrIRL\""); manifest.put(Constants.REQUIRE_CAPABILITY, "osgi.service;filter:=\"(objectClass=dngsarRS)\""); - BundleDescription b4 = state.getFactory().createBundleDescription( state, manifest, (String) manifest.get( Constants.BUNDLE_SYMBOLICNAME ) + manifest.get( Constants.BUNDLE_VERSION ), bundleID++ ); - state.addBundle( b4 ); + BundleDescription b4 = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + manifest.get(Constants.BUNDLE_VERSION), + bundleID++); + state.addBundle(b4); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "b5"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ - manifest.put(Constants.PROVIDE_CAPABILITY, "osgi.service;objectClass=\"dngpaXGAIDG\",osgi.service;objectClass=\"ovbcsIAS,ovbcICL\",osgi.service;objectClass=\"ovbppIRHF\",osgi.service;objectClass=\"dngpraRF\",osgi.service;objectClass=\"ovbrIRL\",osgi.service;objectClass=\"jsS,ovbphRSS\",osgi.service;objectClass=\"ovbcIM2PCF\",osgi.service;objectClass=\"ovbcsITS\""); - BundleDescription b5 = state.getFactory().createBundleDescription( state, manifest, (String) manifest.get( Constants.BUNDLE_SYMBOLICNAME ) + manifest.get( Constants.BUNDLE_VERSION ), bundleID++ ); - state.addBundle( b5 ); + manifest.put(Constants.PROVIDE_CAPABILITY, + "osgi.service;objectClass=\"dngpaXGAIDG\",osgi.service;objectClass=\"ovbcsIAS,ovbcICL\",osgi.service;objectClass=\"ovbppIRHF\",osgi.service;objectClass=\"dngpraRF\",osgi.service;objectClass=\"ovbrIRL\",osgi.service;objectClass=\"jsS,ovbphRSS\",osgi.service;objectClass=\"ovbcIM2PCF\",osgi.service;objectClass=\"ovbcsITS\""); + BundleDescription b5 = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + manifest.get(Constants.BUNDLE_VERSION), + bundleID++); + state.addBundle(b5); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "b6"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ - manifest.put(Constants.PROVIDE_CAPABILITY, "osgi.service;objectClass=\"dngpsaPSGSIDS\",osgi.service;objectClass=\"dngpsiPSGSDS\",osgi.service;objectClass=\"dngpsidWEV,dnvsidDPUS,ovbsISISDP\",osgi.service;objectClass=\"dngpsgsrdtWAOSVU,dnvsrdEDP\",osgi.service;objectClass=\"dnvsSP,ovbsIASWP,ovbsISP\",osgi.service;objectClass=\"dnvsidDPUS,ovbsISISDP\",osgi.service;objectClass=\"dnvsrRDP,ovbrsusIRDP\",osgi.service;objectClass=\"dnvsrRTP,ovbrsusIRTP\",osgi.service;objectClass=\"dnvsrRWP,ovbrsusIRWP\",osgi.service;objectClass=\"dnvsrdTP\",osgi.service;objectClass=\"dnvsrdWDP\",osgi.service;objectClass=\"jsS,ovbphRSS\""); - BundleDescription b6 = state.getFactory().createBundleDescription( state, manifest, (String) manifest.get( Constants.BUNDLE_SYMBOLICNAME ) + manifest.get( Constants.BUNDLE_VERSION ), bundleID++ ); - state.addBundle( b6 ); + manifest.put(Constants.PROVIDE_CAPABILITY, + "osgi.service;objectClass=\"dngpsaPSGSIDS\",osgi.service;objectClass=\"dngpsiPSGSDS\",osgi.service;objectClass=\"dngpsidWEV,dnvsidDPUS,ovbsISISDP\",osgi.service;objectClass=\"dngpsgsrdtWAOSVU,dnvsrdEDP\",osgi.service;objectClass=\"dnvsSP,ovbsIASWP,ovbsISP\",osgi.service;objectClass=\"dnvsidDPUS,ovbsISISDP\",osgi.service;objectClass=\"dnvsrRDP,ovbrsusIRDP\",osgi.service;objectClass=\"dnvsrRTP,ovbrsusIRTP\",osgi.service;objectClass=\"dnvsrRWP,ovbrsusIRWP\",osgi.service;objectClass=\"dnvsrdTP\",osgi.service;objectClass=\"dnvsrdWDP\",osgi.service;objectClass=\"jsS,ovbphRSS\""); + BundleDescription b6 = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + manifest.get(Constants.BUNDLE_VERSION), + bundleID++); + state.addBundle(b6); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "b7"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ - manifest.put(Constants.PROVIDE_CAPABILITY, "osgi.service;objectClass=\"dncrRD\",osgi.service;objectClass=\"dnvmaEARU\",osgi.service;objectClass=\"dnpsgvEP\",osgi.service;objectClass=\"dnpsgvsPSGPDPr\",osgi.service;objectClass=\"dnpsgvsSC,dnvsaIIP\",osgi.service;objectClass=\"dnveaAFP\",osgi.service;objectClass=\"dnvmaCU\",osgi.service;objectClass=\"dnvmaVSUU\",osgi.service;objectClass=\"dnvnaaN,ovbnINL\",osgi.service;objectClass=\"dnvnaaR,ovbcgscIJS\",osgi.service;objectClass=\"dnvtaTBSP\""); - manifest.put( Constants.REQUIRE_CAPABILITY, "osgi.service;filter:=\"(objectClass=ovbesIEAS)\"" ); - BundleDescription b7 = state.getFactory().createBundleDescription( state, manifest, (String) manifest.get( Constants.BUNDLE_SYMBOLICNAME ) + manifest.get( Constants.BUNDLE_VERSION ), bundleID++ ); - state.addBundle( b7 ); + manifest.put(Constants.PROVIDE_CAPABILITY, + "osgi.service;objectClass=\"dncrRD\",osgi.service;objectClass=\"dnvmaEARU\",osgi.service;objectClass=\"dnpsgvEP\",osgi.service;objectClass=\"dnpsgvsPSGPDPr\",osgi.service;objectClass=\"dnpsgvsSC,dnvsaIIP\",osgi.service;objectClass=\"dnveaAFP\",osgi.service;objectClass=\"dnvmaCU\",osgi.service;objectClass=\"dnvmaVSUU\",osgi.service;objectClass=\"dnvnaaN,ovbnINL\",osgi.service;objectClass=\"dnvnaaR,ovbcgscIJS\",osgi.service;objectClass=\"dnvtaTBSP\""); + manifest.put(Constants.REQUIRE_CAPABILITY, "osgi.service;filter:=\"(objectClass=ovbesIEAS)\""); + BundleDescription b7 = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + manifest.get(Constants.BUNDLE_VERSION), + bundleID++); + state.addBundle(b7); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "b8"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ - manifest.put(Constants.PROVIDE_CAPABILITY, "osgi.service;objectClass=\"jsS\",osgi.service;objectClass=\"ovbcICL,ovbea.IEN\",osgi.service;objectClass=\"ovbeaIEF,ovbrIRM\",osgi.service;objectClass=\"ovbeaIIP\",osgi.service;objectClass=\"ovbeiECDS\""); - BundleDescription b8 = state.getFactory().createBundleDescription( state, manifest, (String) manifest.get( Constants.BUNDLE_SYMBOLICNAME ) + manifest.get( Constants.BUNDLE_VERSION ), bundleID++ ); - state.addBundle( b8 ); + manifest.put(Constants.PROVIDE_CAPABILITY, + "osgi.service;objectClass=\"jsS\",osgi.service;objectClass=\"ovbcICL,ovbea.IEN\",osgi.service;objectClass=\"ovbeaIEF,ovbrIRM\",osgi.service;objectClass=\"ovbeaIIP\",osgi.service;objectClass=\"ovbeiECDS\""); + BundleDescription b8 = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + manifest.get(Constants.BUNDLE_VERSION), + bundleID++); + state.addBundle(b8); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "org.eclipse.osgi"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "3.17.100.v20211104-173"); //$NON-NLS-1$ - manifest.put(Constants.PROVIDE_CAPABILITY, "osgi.service;objectClass=\"ooslLRS,oeelELRS\",osgi.service;objectClass=\"ooslLF,ooslLS,oeelELS\",osgi.service;objectClass=\"ooslaLA\",osgi.service;objectClass=\"oeoflFL\",osgi.service;objectClass=\"oeosdL\",osgi.service;objectClass=\"oeosdL\",osgi.service;objectClass=\"oeosdL\",osgi.service;objectClass=\"oeosdL\",osgi.service;objectClass=\"oeosdL\",osgi.service;objectClass=\"oeoseEI\",osgi.service;objectClass=\"oospPA\",osgi.service;objectClass=\"oossSL\",osgi.service;objectClass=\"oospPA\",osgi.service;objectClass=\"ooscCPA\",osgi.service;objectClass=\"oosrR\",osgi.service;objectClass=\"oeosdDO\",osgi.service;objectClass=\"oeosuURLC\",osgi.service;objectClass=\"oeoslBL\",osgi.service;objectClass=\"oeossTE\",osgi.service;objectClass=\"oeosSCF\""); - BundleDescription b9 = state.getFactory().createBundleDescription( state, manifest, (String) manifest.get( Constants.BUNDLE_SYMBOLICNAME ) + manifest.get( Constants.BUNDLE_VERSION ), bundleID++ ); - state.addBundle( b9 ); - - // throws an IllegalArgumentException("Comparison method violates its general contract!") - state.resolve( false ); + manifest.put(Constants.PROVIDE_CAPABILITY, + "osgi.service;objectClass=\"ooslLRS,oeelELRS\",osgi.service;objectClass=\"ooslLF,ooslLS,oeelELS\",osgi.service;objectClass=\"ooslaLA\",osgi.service;objectClass=\"oeoflFL\",osgi.service;objectClass=\"oeosdL\",osgi.service;objectClass=\"oeosdL\",osgi.service;objectClass=\"oeosdL\",osgi.service;objectClass=\"oeosdL\",osgi.service;objectClass=\"oeosdL\",osgi.service;objectClass=\"oeoseEI\",osgi.service;objectClass=\"oospPA\",osgi.service;objectClass=\"oossSL\",osgi.service;objectClass=\"oospPA\",osgi.service;objectClass=\"ooscCPA\",osgi.service;objectClass=\"oosrR\",osgi.service;objectClass=\"oeosdDO\",osgi.service;objectClass=\"oeosuURLC\",osgi.service;objectClass=\"oeoslBL\",osgi.service;objectClass=\"oeossTE\",osgi.service;objectClass=\"oeosSCF\""); + BundleDescription b9 = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + manifest.get(Constants.BUNDLE_VERSION), + bundleID++); + state.addBundle(b9); + + // throws an IllegalArgumentException("Comparison method violates its general + // contract!") + state.resolve(false); } } diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/resolver/SubstitutableExportsTest.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/resolver/SubstitutableExportsTest.java index ae559a9a6dd..a079b76e795 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/resolver/SubstitutableExportsTest.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/resolver/SubstitutableExportsTest.java @@ -33,7 +33,8 @@ public SubstitutableExportsTest(String name) { } private State getSubstituteBasicState() throws BundleException { - // Basic substitutable export test with A, B, C all exporting and importing x,y packages + // Basic substitutable export test with A, B, C all exporting and importing x,y + // packages // D, E, F all requiring A, B, C respectively to access x, y packages // all should get packages x and y from A State state = buildEmptyState(); @@ -46,7 +47,9 @@ private State getSubstituteBasicState() throws BundleException { manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.EXPORT_PACKAGE, "x; y; z; version=1.0"); //$NON-NLS-1$ manifest.put(Constants.IMPORT_PACKAGE, "x; y; version=1.0"); //$NON-NLS-1$ - BundleDescription a = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription a = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ @@ -54,7 +57,9 @@ private State getSubstituteBasicState() throws BundleException { manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.EXPORT_PACKAGE, "x; y; version=1.0"); //$NON-NLS-1$ manifest.put(Constants.IMPORT_PACKAGE, "x; y; version=1.0"); //$NON-NLS-1$ - BundleDescription b = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription b = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ @@ -62,28 +67,36 @@ private State getSubstituteBasicState() throws BundleException { manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.EXPORT_PACKAGE, "x; y; version=1.0"); //$NON-NLS-1$ manifest.put(Constants.IMPORT_PACKAGE, "x; y; version=1.0"); //$NON-NLS-1$ - BundleDescription c = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription c = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "D"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.REQUIRE_BUNDLE, "A"); //$NON-NLS-1$ - BundleDescription d = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription d = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "E"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.REQUIRE_BUNDLE, "B"); //$NON-NLS-1$ - BundleDescription e = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription e = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "F"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.REQUIRE_BUNDLE, "C"); //$NON-NLS-1$ - BundleDescription f = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription f = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); state.addBundle(a); state.addBundle(b); @@ -95,7 +108,8 @@ private State getSubstituteBasicState() throws BundleException { } private State getSubstituteUsesState() throws BundleException { - // Same as basic substitutable export test with A, B, C all exporting and importing x,y packages + "uses" clause + // Same as basic substitutable export test with A, B, C all exporting and + // importing x,y packages + "uses" clause // D, E, F all requiring A, B, C respectively to access x, y packages // all should get packages x and y from A // bundle G cannot resolve because of uses conflict with x package from Z @@ -108,7 +122,9 @@ private State getSubstituteUsesState() throws BundleException { manifest.put(Constants.BUNDLE_SYMBOLICNAME, "Z"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.EXPORT_PACKAGE, "x; version=0.5; bundle=Z, z; uses:=x; version=1.0"); //$NON-NLS-1$ - BundleDescription z = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription z = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ @@ -116,7 +132,9 @@ private State getSubstituteUsesState() throws BundleException { manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.EXPORT_PACKAGE, "x; y; version=1.0; uses:=\"x,y\""); //$NON-NLS-1$ manifest.put(Constants.IMPORT_PACKAGE, "x; y; version=1.0"); //$NON-NLS-1$ - BundleDescription a = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription a = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ @@ -124,7 +142,9 @@ private State getSubstituteUsesState() throws BundleException { manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.EXPORT_PACKAGE, "x; y; version=1.0; uses:=\"x,y\""); //$NON-NLS-1$ manifest.put(Constants.IMPORT_PACKAGE, "x; y; version=1.0"); //$NON-NLS-1$ - BundleDescription b = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription b = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ @@ -132,28 +152,36 @@ private State getSubstituteUsesState() throws BundleException { manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.EXPORT_PACKAGE, "x; y; version=1.0; uses:=\"x,y\""); //$NON-NLS-1$ manifest.put(Constants.IMPORT_PACKAGE, "x; y; version=1.0"); //$NON-NLS-1$ - BundleDescription c = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription c = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "D"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.REQUIRE_BUNDLE, "A"); //$NON-NLS-1$ - BundleDescription d = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription d = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "E"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.REQUIRE_BUNDLE, "B"); //$NON-NLS-1$ - BundleDescription e = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription e = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "F"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.REQUIRE_BUNDLE, "C"); //$NON-NLS-1$ - BundleDescription f = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription f = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ @@ -161,7 +189,9 @@ private State getSubstituteUsesState() throws BundleException { manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.REQUIRE_BUNDLE, "C"); //$NON-NLS-1$ manifest.put(Constants.IMPORT_PACKAGE, "x; bundle=Z"); //$NON-NLS-1$ - BundleDescription g = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription g = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); state.addBundle(z); state.addBundle(a); @@ -175,7 +205,8 @@ private State getSubstituteUsesState() throws BundleException { } private State getSubstituteUsesCycleState() throws BundleException { - // Same as basic substitutable export test with A, B, C all exporting and importing x,y packages + "uses" clause + cycle + // Same as basic substitutable export test with A, B, C all exporting and + // importing x,y packages + "uses" clause + cycle // D, E, F all requiring A, B, C respectively to access x, y packages // all should get packages x and y from A and package z from G State state = buildEmptyState(); @@ -187,7 +218,9 @@ private State getSubstituteUsesCycleState() throws BundleException { manifest.put(Constants.BUNDLE_SYMBOLICNAME, "Z"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.EXPORT_PACKAGE, "x; y; z; version=0.5"); //$NON-NLS-1$ - BundleDescription z = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription z = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ @@ -195,7 +228,9 @@ private State getSubstituteUsesCycleState() throws BundleException { manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.EXPORT_PACKAGE, "x; y; version=1.0; uses:=\"x,y,z\""); //$NON-NLS-1$ manifest.put(Constants.IMPORT_PACKAGE, "x; y; z; version=1.0"); //$NON-NLS-1$ - BundleDescription a = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription a = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ @@ -203,7 +238,9 @@ private State getSubstituteUsesCycleState() throws BundleException { manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.EXPORT_PACKAGE, "x; y; version=1.0; uses:=\"x,y,z\""); //$NON-NLS-1$ manifest.put(Constants.IMPORT_PACKAGE, "x; y; z; version=1.0"); //$NON-NLS-1$ - BundleDescription b = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription b = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ @@ -211,7 +248,9 @@ private State getSubstituteUsesCycleState() throws BundleException { manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.EXPORT_PACKAGE, "x; y; version=1.0; uses:=\"x,y,z\""); //$NON-NLS-1$ manifest.put(Constants.IMPORT_PACKAGE, "x; y; z; version=1.0"); //$NON-NLS-1$ - BundleDescription c = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription c = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ @@ -219,7 +258,9 @@ private State getSubstituteUsesCycleState() throws BundleException { manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.REQUIRE_BUNDLE, "A"); //$NON-NLS-1$ manifest.put(Constants.IMPORT_PACKAGE, "z"); //$NON-NLS-1$ - BundleDescription d = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription d = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ @@ -227,7 +268,9 @@ private State getSubstituteUsesCycleState() throws BundleException { manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.REQUIRE_BUNDLE, "B"); //$NON-NLS-1$ manifest.put(Constants.IMPORT_PACKAGE, "z"); //$NON-NLS-1$ - BundleDescription e = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription e = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ @@ -235,7 +278,9 @@ private State getSubstituteUsesCycleState() throws BundleException { manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.REQUIRE_BUNDLE, "C"); //$NON-NLS-1$ manifest.put(Constants.IMPORT_PACKAGE, "z"); //$NON-NLS-1$ - BundleDescription f = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription f = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ @@ -244,7 +289,9 @@ private State getSubstituteUsesCycleState() throws BundleException { manifest.put(Constants.REQUIRE_BUNDLE, "C"); //$NON-NLS-1$ manifest.put(Constants.EXPORT_PACKAGE, "z; version=1.0; uses:=x"); //$NON-NLS-1$ manifest.put(Constants.IMPORT_PACKAGE, "z; version=1.0"); //$NON-NLS-1$ - BundleDescription g = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription g = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ @@ -253,7 +300,9 @@ private State getSubstituteUsesCycleState() throws BundleException { manifest.put(Constants.REQUIRE_BUNDLE, "C"); //$NON-NLS-1$ manifest.put(Constants.EXPORT_PACKAGE, "z; version=1.0; uses:=x"); //$NON-NLS-1$ manifest.put(Constants.IMPORT_PACKAGE, "z; version=1.0"); //$NON-NLS-1$ - BundleDescription h = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription h = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); state.addBundle(z); state.addBundle(a); @@ -268,7 +317,8 @@ private State getSubstituteUsesCycleState() throws BundleException { } private State getSubstituteBasicFragState() throws BundleException { - // Basic substitutable export test with A, B, C all exporting and importing x,y packages + // Basic substitutable export test with A, B, C all exporting and importing x,y + // packages // Each have a fragment that exports and imports z package // D, E, F all requiring A, B, C respectively to access x, y, z packages // all should get packages x, y and z from A + fragment @@ -282,7 +332,9 @@ private State getSubstituteBasicFragState() throws BundleException { manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.EXPORT_PACKAGE, "x; y; version=1.0"); //$NON-NLS-1$ manifest.put(Constants.IMPORT_PACKAGE, "x; y; version=1.0"); //$NON-NLS-1$ - BundleDescription a = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription a = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ @@ -291,7 +343,9 @@ private State getSubstituteBasicFragState() throws BundleException { manifest.put(Constants.FRAGMENT_HOST, "A"); //$NON-NLS-1$ manifest.put(Constants.EXPORT_PACKAGE, "z; version=1.0"); //$NON-NLS-1$ manifest.put(Constants.IMPORT_PACKAGE, "z; version=1.0"); //$NON-NLS-1$ - BundleDescription aFrag = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription aFrag = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ @@ -299,7 +353,9 @@ private State getSubstituteBasicFragState() throws BundleException { manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.EXPORT_PACKAGE, "x; y; version=1.0"); //$NON-NLS-1$ manifest.put(Constants.IMPORT_PACKAGE, "x; y; version=1.0"); //$NON-NLS-1$ - BundleDescription b = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription b = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ @@ -308,7 +364,9 @@ private State getSubstituteBasicFragState() throws BundleException { manifest.put(Constants.FRAGMENT_HOST, "B"); //$NON-NLS-1$ manifest.put(Constants.EXPORT_PACKAGE, "z; version=1.0"); //$NON-NLS-1$ manifest.put(Constants.IMPORT_PACKAGE, "z; version=1.0"); //$NON-NLS-1$ - BundleDescription bFrag = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription bFrag = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ @@ -316,7 +374,9 @@ private State getSubstituteBasicFragState() throws BundleException { manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.EXPORT_PACKAGE, "x; y; version=1.0"); //$NON-NLS-1$ manifest.put(Constants.IMPORT_PACKAGE, "x; y; version=1.0"); //$NON-NLS-1$ - BundleDescription c = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription c = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ @@ -325,28 +385,36 @@ private State getSubstituteBasicFragState() throws BundleException { manifest.put(Constants.FRAGMENT_HOST, "C"); //$NON-NLS-1$ manifest.put(Constants.EXPORT_PACKAGE, "z; version=1.0"); //$NON-NLS-1$ manifest.put(Constants.IMPORT_PACKAGE, "z; version=1.0"); //$NON-NLS-1$ - BundleDescription cFrag = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription cFrag = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "D"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.REQUIRE_BUNDLE, "A"); //$NON-NLS-1$ - BundleDescription d = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription d = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "E"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.REQUIRE_BUNDLE, "B"); //$NON-NLS-1$ - BundleDescription e = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription e = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "F"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.REQUIRE_BUNDLE, "C"); //$NON-NLS-1$ - BundleDescription f = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription f = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); state.addBundle(a); state.addBundle(aFrag); @@ -361,7 +429,8 @@ private State getSubstituteBasicFragState() throws BundleException { } private State getSubstituteUsesFragState() throws BundleException { - // Basic substitutable export test with A, B, C all exporting and importing x,y packages + "uses" clause + // Basic substitutable export test with A, B, C all exporting and importing x,y + // packages + "uses" clause // Each have a fragment that exports and imports z package // D, E, F all requiring A, B, C respectively to access x, y, z packages // all should get packages x, y and z from A + fragment @@ -374,7 +443,9 @@ private State getSubstituteUsesFragState() throws BundleException { manifest.put(Constants.BUNDLE_SYMBOLICNAME, "Z"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.EXPORT_PACKAGE, "x; version=0.5; bundle=Z"); //$NON-NLS-1$ - BundleDescription z = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription z = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ @@ -382,7 +453,9 @@ private State getSubstituteUsesFragState() throws BundleException { manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.EXPORT_PACKAGE, "x; y; version=1.0; uses:=\"x,y\""); //$NON-NLS-1$ manifest.put(Constants.IMPORT_PACKAGE, "x; y; version=1.0"); //$NON-NLS-1$ - BundleDescription a = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription a = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ @@ -391,7 +464,9 @@ private State getSubstituteUsesFragState() throws BundleException { manifest.put(Constants.FRAGMENT_HOST, "A"); //$NON-NLS-1$ manifest.put(Constants.EXPORT_PACKAGE, "z; version=1.0; uses:=\"x,y\""); //$NON-NLS-1$ manifest.put(Constants.IMPORT_PACKAGE, "z; version=1.0"); //$NON-NLS-1$ - BundleDescription aFrag = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription aFrag = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ @@ -399,7 +474,9 @@ private State getSubstituteUsesFragState() throws BundleException { manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.EXPORT_PACKAGE, "x; y; version=1.0; uses:=\"x,y\""); //$NON-NLS-1$ manifest.put(Constants.IMPORT_PACKAGE, "x; y; version=1.0"); //$NON-NLS-1$ - BundleDescription b = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription b = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ @@ -408,7 +485,9 @@ private State getSubstituteUsesFragState() throws BundleException { manifest.put(Constants.FRAGMENT_HOST, "B"); //$NON-NLS-1$ manifest.put(Constants.EXPORT_PACKAGE, "z; version=1.0; uses:=\"x,y\""); //$NON-NLS-1$ manifest.put(Constants.IMPORT_PACKAGE, "z; version=1.0"); //$NON-NLS-1$ - BundleDescription bFrag = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription bFrag = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ @@ -416,7 +495,9 @@ private State getSubstituteUsesFragState() throws BundleException { manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.EXPORT_PACKAGE, "x; y; version=1.0; uses:=\"x,y\""); //$NON-NLS-1$ manifest.put(Constants.IMPORT_PACKAGE, "x; y; version=1.0"); //$NON-NLS-1$ - BundleDescription c = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription c = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ @@ -425,28 +506,36 @@ private State getSubstituteUsesFragState() throws BundleException { manifest.put(Constants.FRAGMENT_HOST, "C"); //$NON-NLS-1$ manifest.put(Constants.EXPORT_PACKAGE, "z; version=1.0; uses:=\"x,y\""); //$NON-NLS-1$ manifest.put(Constants.IMPORT_PACKAGE, "z; version=1.0"); //$NON-NLS-1$ - BundleDescription cFrag = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription cFrag = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "D"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.REQUIRE_BUNDLE, "A"); //$NON-NLS-1$ - BundleDescription d = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription d = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "E"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.REQUIRE_BUNDLE, "B"); //$NON-NLS-1$ - BundleDescription e = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription e = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "F"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.REQUIRE_BUNDLE, "C"); //$NON-NLS-1$ - BundleDescription f = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription f = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ @@ -454,7 +543,9 @@ private State getSubstituteUsesFragState() throws BundleException { manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.REQUIRE_BUNDLE, "C"); //$NON-NLS-1$ manifest.put(Constants.IMPORT_PACKAGE, "x; bundle=Z"); //$NON-NLS-1$ - BundleDescription g = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription g = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); state.addBundle(z); state.addBundle(a); @@ -471,7 +562,8 @@ private State getSubstituteUsesFragState() throws BundleException { } private State getSubstituteUsesFragCycleState() throws BundleException { - // Same as basic substitutable export test with A, B, C all exporting and importing x,y packages + "uses" clause + cycle + frags + // Same as basic substitutable export test with A, B, C all exporting and + // importing x,y packages + "uses" clause + cycle + frags // D, E, F all requiring A, B, C respectively to access x, y packages // all should get packages x and y from A and package z from G State state = buildEmptyState(); @@ -483,7 +575,9 @@ private State getSubstituteUsesFragCycleState() throws BundleException { manifest.put(Constants.BUNDLE_SYMBOLICNAME, "Z"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.EXPORT_PACKAGE, "x; y; z; version=2.0"); //$NON-NLS-1$ - BundleDescription z = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription z = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ @@ -491,7 +585,9 @@ private State getSubstituteUsesFragCycleState() throws BundleException { manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.EXPORT_PACKAGE, "x; y; version=1.0; uses:=\"x,y,q\""); //$NON-NLS-1$ manifest.put(Constants.IMPORT_PACKAGE, "x; y; version=\"[1.0,2.0)\", q"); //$NON-NLS-1$ - BundleDescription a = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription a = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ @@ -500,7 +596,9 @@ private State getSubstituteUsesFragCycleState() throws BundleException { manifest.put(Constants.FRAGMENT_HOST, "A"); //$NON-NLS-1$ manifest.put(Constants.EXPORT_PACKAGE, "z; version=1.0; uses:=\"x,y\""); //$NON-NLS-1$ manifest.put(Constants.IMPORT_PACKAGE, "z; version=\"[1.0,2.0)\""); //$NON-NLS-1$ - BundleDescription aFrag = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription aFrag = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ @@ -508,7 +606,9 @@ private State getSubstituteUsesFragCycleState() throws BundleException { manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.EXPORT_PACKAGE, "x; y; version=1.0; uses:=\"x,y,q\""); //$NON-NLS-1$ manifest.put(Constants.IMPORT_PACKAGE, "x; y; version=\"[1.0,2.0)\", q"); //$NON-NLS-1$ - BundleDescription b = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription b = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ @@ -517,7 +617,9 @@ private State getSubstituteUsesFragCycleState() throws BundleException { manifest.put(Constants.FRAGMENT_HOST, "B"); //$NON-NLS-1$ manifest.put(Constants.EXPORT_PACKAGE, "z; version=1.0; uses:=\"x,y\""); //$NON-NLS-1$ manifest.put(Constants.IMPORT_PACKAGE, "z; version=\"[1.0,2.0)\""); //$NON-NLS-1$ - BundleDescription bFrag = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription bFrag = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ @@ -525,7 +627,9 @@ private State getSubstituteUsesFragCycleState() throws BundleException { manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.EXPORT_PACKAGE, "x; y; version=1.0; uses:=\"x,y,q\""); //$NON-NLS-1$ manifest.put(Constants.IMPORT_PACKAGE, "x; y; version=\"[1.0,2.0)\", q"); //$NON-NLS-1$ - BundleDescription c = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription c = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ @@ -534,28 +638,36 @@ private State getSubstituteUsesFragCycleState() throws BundleException { manifest.put(Constants.FRAGMENT_HOST, "C"); //$NON-NLS-1$ manifest.put(Constants.EXPORT_PACKAGE, "z; version=1.0; uses:=\"x,y\""); //$NON-NLS-1$ manifest.put(Constants.IMPORT_PACKAGE, "z; version=\"[1.0,2.0)\""); //$NON-NLS-1$ - BundleDescription cFrag = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription cFrag = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "D"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.REQUIRE_BUNDLE, "A"); //$NON-NLS-1$ - BundleDescription d = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription d = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "E"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.REQUIRE_BUNDLE, "B"); //$NON-NLS-1$ - BundleDescription e = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription e = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "F"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.REQUIRE_BUNDLE, "C"); //$NON-NLS-1$ - BundleDescription f = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription f = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ @@ -564,7 +676,9 @@ private State getSubstituteUsesFragCycleState() throws BundleException { manifest.put(Constants.REQUIRE_BUNDLE, "C"); //$NON-NLS-1$ manifest.put(Constants.EXPORT_PACKAGE, "q; version=1.0; uses:=x"); //$NON-NLS-1$ manifest.put(Constants.IMPORT_PACKAGE, "q; version=1.0"); //$NON-NLS-1$ - BundleDescription g = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription g = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ @@ -573,7 +687,9 @@ private State getSubstituteUsesFragCycleState() throws BundleException { manifest.put(Constants.REQUIRE_BUNDLE, "C"); //$NON-NLS-1$ manifest.put(Constants.EXPORT_PACKAGE, "q; version=1.0; uses:=x"); //$NON-NLS-1$ manifest.put(Constants.IMPORT_PACKAGE, "q; version=1.0"); //$NON-NLS-1$ - BundleDescription h = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription h = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ @@ -581,7 +697,9 @@ private State getSubstituteUsesFragCycleState() throws BundleException { manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.REQUIRE_BUNDLE, "C"); //$NON-NLS-1$ manifest.put(Constants.IMPORT_PACKAGE, "q; x; version=1.0"); //$NON-NLS-1$ - BundleDescription i = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription i = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); state.addBundle(z); state.addBundle(a); @@ -600,8 +718,10 @@ private State getSubstituteUsesFragCycleState() throws BundleException { } private State getSubstituteBasicReexportState() throws BundleException { - // Basic substitutable export test with A, B, C all exporting and importing x,y packages - // D, E, F all requiring A, B, C respectively to access x, y packages are reexporting + // Basic substitutable export test with A, B, C all exporting and importing x,y + // packages + // D, E, F all requiring A, B, C respectively to access x, y packages are + // reexporting // G, H, I all requiring D, E, F repectively to access x, y packages // all should get packages x and y from A State state = buildEmptyState(); @@ -614,7 +734,9 @@ private State getSubstituteBasicReexportState() throws BundleException { manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.EXPORT_PACKAGE, "x; y; version=1.0"); //$NON-NLS-1$ manifest.put(Constants.IMPORT_PACKAGE, "x; y; version=1.0"); //$NON-NLS-1$ - BundleDescription a = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription a = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ @@ -622,7 +744,9 @@ private State getSubstituteBasicReexportState() throws BundleException { manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.EXPORT_PACKAGE, "x; y; version=1.0"); //$NON-NLS-1$ manifest.put(Constants.IMPORT_PACKAGE, "x; y; version=1.0"); //$NON-NLS-1$ - BundleDescription b = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription b = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ @@ -630,49 +754,63 @@ private State getSubstituteBasicReexportState() throws BundleException { manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.EXPORT_PACKAGE, "x; y; version=1.0"); //$NON-NLS-1$ manifest.put(Constants.IMPORT_PACKAGE, "x; y; version=1.0"); //$NON-NLS-1$ - BundleDescription c = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription c = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "D"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.REQUIRE_BUNDLE, "A; visibility:=reexport"); //$NON-NLS-1$ - BundleDescription d = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription d = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "E"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.REQUIRE_BUNDLE, "B; visibility:=reexport"); //$NON-NLS-1$ - BundleDescription e = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription e = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "F"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.REQUIRE_BUNDLE, "C; visibility:=reexport"); //$NON-NLS-1$ - BundleDescription f = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription f = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "G"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.REQUIRE_BUNDLE, "D"); //$NON-NLS-1$ - BundleDescription g = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription g = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "H"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.REQUIRE_BUNDLE, "E"); //$NON-NLS-1$ - BundleDescription h = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription h = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "I"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.REQUIRE_BUNDLE, "F"); //$NON-NLS-1$ - BundleDescription i = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription i = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); state.addBundle(a); state.addBundle(b); @@ -687,8 +825,10 @@ private State getSubstituteBasicReexportState() throws BundleException { } private State getSubstituteUsesReexportState() throws BundleException { - // Basic substitutable export test with A, B, C all exporting and importing x,y packages + "uses" clause - // D, E, F all requiring A, B, C respectively to access x, y packages are reexporting + // Basic substitutable export test with A, B, C all exporting and importing x,y + // packages + "uses" clause + // D, E, F all requiring A, B, C respectively to access x, y packages are + // reexporting // G, H, I all requiring D, E, F repectively to access x, y packages // all should get packages x and y from A // J cannot resolve because of uses conflicy with package x from Z @@ -701,7 +841,9 @@ private State getSubstituteUsesReexportState() throws BundleException { manifest.put(Constants.BUNDLE_SYMBOLICNAME, "Z"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.EXPORT_PACKAGE, "x; version=0.5; bundle=Z"); //$NON-NLS-1$ - BundleDescription z = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription z = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ @@ -709,7 +851,9 @@ private State getSubstituteUsesReexportState() throws BundleException { manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.EXPORT_PACKAGE, "x; y; version=1.0; uses:=\"x,y\""); //$NON-NLS-1$ manifest.put(Constants.IMPORT_PACKAGE, "x; y; version=1.0"); //$NON-NLS-1$ - BundleDescription a = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription a = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ @@ -717,7 +861,9 @@ private State getSubstituteUsesReexportState() throws BundleException { manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.EXPORT_PACKAGE, "x; y; version=1.0; uses:=\"x,y\""); //$NON-NLS-1$ manifest.put(Constants.IMPORT_PACKAGE, "x; y; version=1.0"); //$NON-NLS-1$ - BundleDescription b = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription b = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ @@ -725,49 +871,63 @@ private State getSubstituteUsesReexportState() throws BundleException { manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.EXPORT_PACKAGE, "x; y; version=1.0; uses:=\"x,y\""); //$NON-NLS-1$ manifest.put(Constants.IMPORT_PACKAGE, "x; y; version=1.0"); //$NON-NLS-1$ - BundleDescription c = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription c = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "D"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.REQUIRE_BUNDLE, "A; visibility:=reexport"); //$NON-NLS-1$ - BundleDescription d = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription d = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "E"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.REQUIRE_BUNDLE, "B; visibility:=reexport"); //$NON-NLS-1$ - BundleDescription e = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription e = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "F"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.REQUIRE_BUNDLE, "C; visibility:=reexport"); //$NON-NLS-1$ - BundleDescription f = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription f = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "G"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.REQUIRE_BUNDLE, "D"); //$NON-NLS-1$ - BundleDescription g = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription g = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "H"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.REQUIRE_BUNDLE, "E"); //$NON-NLS-1$ - BundleDescription h = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription h = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "I"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.REQUIRE_BUNDLE, "F"); //$NON-NLS-1$ - BundleDescription i = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription i = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ @@ -775,7 +935,9 @@ private State getSubstituteUsesReexportState() throws BundleException { manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.REQUIRE_BUNDLE, "F"); //$NON-NLS-1$ manifest.put(Constants.IMPORT_PACKAGE, "x; bundle=Z"); //$NON-NLS-1$ - BundleDescription j = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription j = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); state.addBundle(z); state.addBundle(a); @@ -792,8 +954,10 @@ private State getSubstituteUsesReexportState() throws BundleException { } private State getSubstituteUsesReexportCycleState() throws BundleException { - // Basic substitutable export test with A, B, C all exporting and importing x,y packages + uses clause + cycle - // D, E, F all requiring A, B, C respectively to access x, y packages are reexporting + // Basic substitutable export test with A, B, C all exporting and importing x,y + // packages + uses clause + cycle + // D, E, F all requiring A, B, C respectively to access x, y packages are + // reexporting // G, H, I all requiring D, E, F repectively to access x, y packages // all should get packages x and y from A // J cannot resolve because of uses conflicy with package x from Z @@ -806,7 +970,9 @@ private State getSubstituteUsesReexportCycleState() throws BundleException { manifest.put(Constants.BUNDLE_SYMBOLICNAME, "Z"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.EXPORT_PACKAGE, "x; y; z; version=2.0"); //$NON-NLS-1$ - BundleDescription z = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription z = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ @@ -814,7 +980,9 @@ private State getSubstituteUsesReexportCycleState() throws BundleException { manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.EXPORT_PACKAGE, "x; y; version=1.0; uses:=\"x,y,z\""); //$NON-NLS-1$ manifest.put(Constants.IMPORT_PACKAGE, "x; y; z; version=\"[1.0,2.0)\""); //$NON-NLS-1$ - BundleDescription a = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription a = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ @@ -822,7 +990,9 @@ private State getSubstituteUsesReexportCycleState() throws BundleException { manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.EXPORT_PACKAGE, "x; y; version=1.0; uses:=\"x,y,z\""); //$NON-NLS-1$ manifest.put(Constants.IMPORT_PACKAGE, "x; y; z; version=\"[1.0,2.0)\""); //$NON-NLS-1$ - BundleDescription b = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription b = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ @@ -830,49 +1000,63 @@ private State getSubstituteUsesReexportCycleState() throws BundleException { manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.EXPORT_PACKAGE, "x; y; version=1.0; uses:=\"x,y,z\""); //$NON-NLS-1$ manifest.put(Constants.IMPORT_PACKAGE, "x; y; z; version=\"[1.0,2.0)\""); //$NON-NLS-1$ - BundleDescription c = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription c = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "D"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.REQUIRE_BUNDLE, "A; visibility:=reexport"); //$NON-NLS-1$ - BundleDescription d = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription d = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "E"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.REQUIRE_BUNDLE, "B; visibility:=reexport"); //$NON-NLS-1$ - BundleDescription e = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription e = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "F"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.REQUIRE_BUNDLE, "C; visibility:=reexport"); //$NON-NLS-1$ - BundleDescription f = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription f = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "G"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.REQUIRE_BUNDLE, "D"); //$NON-NLS-1$ - BundleDescription g = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription g = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "H"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.REQUIRE_BUNDLE, "E"); //$NON-NLS-1$ - BundleDescription h = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription h = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "I"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.REQUIRE_BUNDLE, "F"); //$NON-NLS-1$ - BundleDescription i = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription i = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ @@ -881,7 +1065,9 @@ private State getSubstituteUsesReexportCycleState() throws BundleException { manifest.put(Constants.REQUIRE_BUNDLE, "F"); //$NON-NLS-1$ manifest.put(Constants.EXPORT_PACKAGE, "z; version=1.0; uses=\"x,y\""); //$NON-NLS-1$ manifest.put(Constants.IMPORT_PACKAGE, "z; version=\"[1.0,2.0)\""); //$NON-NLS-1$ - BundleDescription j = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription j = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); state.addBundle(z); state.addBundle(a); @@ -898,9 +1084,12 @@ private State getSubstituteUsesReexportCycleState() throws BundleException { } private State getSubstituteUnresolvedFragState() throws BundleException { - // Basic substitutable export test with A, B, C all exporting and importing x,y packages - // Each have a fragment that exports and imports z package and an extra unresolved import of q - // D, E, F all requiring A, B, C respectively to access x, y. z should not be accessible + // Basic substitutable export test with A, B, C all exporting and importing x,y + // packages + // Each have a fragment that exports and imports z package and an extra + // unresolved import of q + // D, E, F all requiring A, B, C respectively to access x, y. z should not be + // accessible // all should get packages x, y. State state = buildEmptyState(); Hashtable manifest = new Hashtable(); @@ -912,7 +1101,9 @@ private State getSubstituteUnresolvedFragState() throws BundleException { manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.EXPORT_PACKAGE, "x; y; version=1.0"); //$NON-NLS-1$ manifest.put(Constants.IMPORT_PACKAGE, "x; y; version=1.0"); //$NON-NLS-1$ - BundleDescription a = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription a = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ @@ -921,7 +1112,9 @@ private State getSubstituteUnresolvedFragState() throws BundleException { manifest.put(Constants.FRAGMENT_HOST, "A"); //$NON-NLS-1$ manifest.put(Constants.EXPORT_PACKAGE, "z; version=1.0"); //$NON-NLS-1$ manifest.put(Constants.IMPORT_PACKAGE, "z; q; version=1.0"); //$NON-NLS-1$ - BundleDescription aFrag = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription aFrag = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ @@ -929,7 +1122,9 @@ private State getSubstituteUnresolvedFragState() throws BundleException { manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.EXPORT_PACKAGE, "x; y; version=1.0"); //$NON-NLS-1$ manifest.put(Constants.IMPORT_PACKAGE, "x; y; version=1.0"); //$NON-NLS-1$ - BundleDescription b = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription b = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ @@ -938,7 +1133,9 @@ private State getSubstituteUnresolvedFragState() throws BundleException { manifest.put(Constants.FRAGMENT_HOST, "B"); //$NON-NLS-1$ manifest.put(Constants.EXPORT_PACKAGE, "z; version=1.0"); //$NON-NLS-1$ manifest.put(Constants.IMPORT_PACKAGE, "z; q; version=1.0"); //$NON-NLS-1$ - BundleDescription bFrag = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription bFrag = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ @@ -946,7 +1143,9 @@ private State getSubstituteUnresolvedFragState() throws BundleException { manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.EXPORT_PACKAGE, "x; y; version=1.0"); //$NON-NLS-1$ manifest.put(Constants.IMPORT_PACKAGE, "x; y; version=1.0"); //$NON-NLS-1$ - BundleDescription c = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription c = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ @@ -955,28 +1154,36 @@ private State getSubstituteUnresolvedFragState() throws BundleException { manifest.put(Constants.FRAGMENT_HOST, "C"); //$NON-NLS-1$ manifest.put(Constants.EXPORT_PACKAGE, "z; version=1.0"); //$NON-NLS-1$ manifest.put(Constants.IMPORT_PACKAGE, "z, q; version=1.0"); //$NON-NLS-1$ - BundleDescription cFrag = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription cFrag = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "D"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.REQUIRE_BUNDLE, "A"); //$NON-NLS-1$ - BundleDescription d = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription d = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "E"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.REQUIRE_BUNDLE, "B"); //$NON-NLS-1$ - BundleDescription e = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription e = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "F"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.REQUIRE_BUNDLE, "C"); //$NON-NLS-1$ - BundleDescription f = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription f = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); state.addBundle(a); state.addBundle(aFrag); @@ -991,8 +1198,10 @@ private State getSubstituteUnresolvedFragState() throws BundleException { } private State getSubstituteSplitState() throws BundleException { - // Basic substitutable export test with A, B, C all exporting and importing x,y packages - // D, E, F all requiring A, B, C respectively to access x, y packages and export more content (split) + // Basic substitutable export test with A, B, C all exporting and importing x,y + // packages + // D, E, F all requiring A, B, C respectively to access x, y packages and export + // more content (split) // all should get packages x and y from A State state = buildEmptyState(); Hashtable manifest = new Hashtable(); @@ -1004,7 +1213,9 @@ private State getSubstituteSplitState() throws BundleException { manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.EXPORT_PACKAGE, "x; y; version=1.0; split=split; mandatory:=split"); //$NON-NLS-1$ manifest.put(Constants.IMPORT_PACKAGE, "x; y; version=1.0; split=split"); //$NON-NLS-1$ - BundleDescription a = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription a = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ @@ -1012,7 +1223,9 @@ private State getSubstituteSplitState() throws BundleException { manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.EXPORT_PACKAGE, "x; y; version=1.0; split=split; mandatory:=split"); //$NON-NLS-1$ manifest.put(Constants.IMPORT_PACKAGE, "x; y; version=1.0; split=split"); //$NON-NLS-1$ - BundleDescription b = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription b = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ @@ -1020,7 +1233,9 @@ private State getSubstituteSplitState() throws BundleException { manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.EXPORT_PACKAGE, "x; y; version=1.0; split=split; mandatory:=split"); //$NON-NLS-1$ manifest.put(Constants.IMPORT_PACKAGE, "x; y; version=1.0; split=split"); //$NON-NLS-1$ - BundleDescription c = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription c = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ @@ -1029,7 +1244,9 @@ private State getSubstituteSplitState() throws BundleException { manifest.put(Constants.EXPORT_PACKAGE, "x; y; version=1.0"); //$NON-NLS-1$ manifest.put(Constants.IMPORT_PACKAGE, "x; y; version=1.0"); //$NON-NLS-1$ manifest.put(Constants.REQUIRE_BUNDLE, "A"); //$NON-NLS-1$ - BundleDescription d = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription d = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ @@ -1038,7 +1255,9 @@ private State getSubstituteSplitState() throws BundleException { manifest.put(Constants.EXPORT_PACKAGE, "x; y; version=1.0"); //$NON-NLS-1$ manifest.put(Constants.IMPORT_PACKAGE, "x; y; version=1.0"); //$NON-NLS-1$ manifest.put(Constants.REQUIRE_BUNDLE, "B"); //$NON-NLS-1$ - BundleDescription e = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription e = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ @@ -1047,35 +1266,45 @@ private State getSubstituteSplitState() throws BundleException { manifest.put(Constants.EXPORT_PACKAGE, "x; y; version=1.0"); //$NON-NLS-1$ manifest.put(Constants.IMPORT_PACKAGE, "x; y; version=1.0"); //$NON-NLS-1$ manifest.put(Constants.REQUIRE_BUNDLE, "C"); //$NON-NLS-1$ - BundleDescription f = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription f = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "G"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.IMPORT_PACKAGE, "x; y; version=1.0"); //$NON-NLS-1$ - BundleDescription g = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription g = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "H"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.REQUIRE_BUNDLE, "D"); //$NON-NLS-1$ - BundleDescription h = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription h = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "I"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.REQUIRE_BUNDLE, "E"); //$NON-NLS-1$ - BundleDescription i = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription i = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "J"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.REQUIRE_BUNDLE, "F"); //$NON-NLS-1$ - BundleDescription j = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription j = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); state.addBundle(a); state.addBundle(b); @@ -1091,8 +1320,10 @@ private State getSubstituteSplitState() throws BundleException { } private State getSubstituteSplitUsesState() throws BundleException { - // Basic substitutable export test with A, B, C all exporting and importing x,y packages + uses - // D, E, F all requiring A, B, C respectively to access x, y packages and add more content (split) + // Basic substitutable export test with A, B, C all exporting and importing x,y + // packages + uses + // D, E, F all requiring A, B, C respectively to access x, y packages and add + // more content (split) // all should get packages x and y from A State state = buildEmptyState(); Hashtable manifest = new Hashtable(); @@ -1104,7 +1335,9 @@ private State getSubstituteSplitUsesState() throws BundleException { manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.EXPORT_PACKAGE, "x; y; version=1.0; split=split; mandatory:=split; uses:=\"x,y,q\""); //$NON-NLS-1$ manifest.put(Constants.IMPORT_PACKAGE, "x; y; version=1.0; split=split, q; version=\"[1.0,2.0)\""); //$NON-NLS-1$ - BundleDescription a = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription a = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ @@ -1112,7 +1345,9 @@ private State getSubstituteSplitUsesState() throws BundleException { manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.EXPORT_PACKAGE, "x; y; version=1.0; split=split; mandatory:=split; uses:=\"x,y,q\""); //$NON-NLS-1$ manifest.put(Constants.IMPORT_PACKAGE, "x; y; version=1.0; split=split, q; version=\"[1.0,2.0)\""); //$NON-NLS-1$ - BundleDescription b = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription b = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ @@ -1120,7 +1355,9 @@ private State getSubstituteSplitUsesState() throws BundleException { manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.EXPORT_PACKAGE, "x; y; version=1.0; split=split; mandatory:=split; uses:=\"x,y,q\""); //$NON-NLS-1$ manifest.put(Constants.IMPORT_PACKAGE, "x; y; version=1.0; split=split, q; version=\"[1.0,2.0)\""); //$NON-NLS-1$ - BundleDescription c = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription c = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ @@ -1129,7 +1366,9 @@ private State getSubstituteSplitUsesState() throws BundleException { manifest.put(Constants.EXPORT_PACKAGE, "x; y; version=1.0; uses:=\"x,y,r\""); //$NON-NLS-1$ manifest.put(Constants.IMPORT_PACKAGE, "x; y; version=1.0, r; version=\"[1.0,2.0)\""); //$NON-NLS-1$ manifest.put(Constants.REQUIRE_BUNDLE, "A"); //$NON-NLS-1$ - BundleDescription d = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription d = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ @@ -1138,7 +1377,9 @@ private State getSubstituteSplitUsesState() throws BundleException { manifest.put(Constants.EXPORT_PACKAGE, "x; y; version=1.0; uses:=\"x,y,r\""); //$NON-NLS-1$ manifest.put(Constants.IMPORT_PACKAGE, "x; y; version=1.0, r; version=\"[1.0,2.0)\""); //$NON-NLS-1$ manifest.put(Constants.REQUIRE_BUNDLE, "B"); //$NON-NLS-1$ - BundleDescription e = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription e = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ @@ -1147,56 +1388,72 @@ private State getSubstituteSplitUsesState() throws BundleException { manifest.put(Constants.EXPORT_PACKAGE, "x; y; version=1.0; uses:=\"x,y,r\""); //$NON-NLS-1$ manifest.put(Constants.IMPORT_PACKAGE, "x; y; version=1.0, r; version=\"[1.0,2.0)\""); //$NON-NLS-1$ manifest.put(Constants.REQUIRE_BUNDLE, "C"); //$NON-NLS-1$ - BundleDescription f = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription f = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "G"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.IMPORT_PACKAGE, "x; y; version=1.0"); //$NON-NLS-1$ - BundleDescription g = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription g = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "H"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.REQUIRE_BUNDLE, "D"); //$NON-NLS-1$ - BundleDescription h = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription h = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "I"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.REQUIRE_BUNDLE, "E"); //$NON-NLS-1$ - BundleDescription i = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription i = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "J"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.REQUIRE_BUNDLE, "F"); //$NON-NLS-1$ - BundleDescription j = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription j = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "K"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.EXPORT_PACKAGE, "q; r; version=2.0"); //$NON-NLS-1$ - BundleDescription k = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription k = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "L"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.EXPORT_PACKAGE, "q; r; version=1.0"); //$NON-NLS-1$ - BundleDescription l = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription l = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "M"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.IMPORT_PACKAGE, "x, y, q, r"); //$NON-NLS-1$ - BundleDescription m = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription m = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ @@ -1204,7 +1461,9 @@ private State getSubstituteSplitUsesState() throws BundleException { manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.IMPORT_PACKAGE, "q, r"); //$NON-NLS-1$ manifest.put(Constants.REQUIRE_BUNDLE, "F"); //$NON-NLS-1$ - BundleDescription n = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription n = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); state.addBundle(a); state.addBundle(b); @@ -1224,7 +1483,8 @@ private State getSubstituteSplitUsesState() throws BundleException { } private State getNonOverlapingSubstituteBasicState() throws BundleException { - // Basic substitutable export test with A, B, C all exporting and importing x,y packages + // Basic substitutable export test with A, B, C all exporting and importing x,y + // packages // D, E, F all requiring A, B, C respectively to access x, y packages // all should get packages x and y from A State state = buildEmptyState(); @@ -1237,7 +1497,9 @@ private State getNonOverlapingSubstituteBasicState() throws BundleException { manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.EXPORT_PACKAGE, "x; y; version=1.0"); //$NON-NLS-1$ manifest.put(Constants.IMPORT_PACKAGE, "x; y; version=1.0; nomatch=nomatch"); //$NON-NLS-1$ - BundleDescription a = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription a = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ @@ -1245,7 +1507,9 @@ private State getNonOverlapingSubstituteBasicState() throws BundleException { manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.EXPORT_PACKAGE, "x; y; version=1.0"); //$NON-NLS-1$ manifest.put(Constants.IMPORT_PACKAGE, "x; y; version=1.0"); //$NON-NLS-1$ - BundleDescription b = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription b = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ @@ -1253,28 +1517,36 @@ private State getNonOverlapingSubstituteBasicState() throws BundleException { manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.EXPORT_PACKAGE, "x; y; version=1.0"); //$NON-NLS-1$ manifest.put(Constants.IMPORT_PACKAGE, "x; y; version=1.0"); //$NON-NLS-1$ - BundleDescription c = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription c = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "D"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.REQUIRE_BUNDLE, "A"); //$NON-NLS-1$ - BundleDescription d = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription d = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "E"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.REQUIRE_BUNDLE, "B"); //$NON-NLS-1$ - BundleDescription e = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription e = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "F"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.REQUIRE_BUNDLE, "C"); //$NON-NLS-1$ - BundleDescription f = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++); + BundleDescription f = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + bundleID++); state.addBundle(a); state.addBundle(b); @@ -1324,7 +1596,7 @@ public void testSubstitutableExports001() throws BundleException { assertEquals("fVisible wrong number", 2, fVisible.length); //$NON-NLS-1$ ExportPackageDescription[] aExports = a.getSelectedExports(); - ExportPackageDescription[] aSubtitutes = new ExportPackageDescription[] {aExports[0], aExports[1]}; + ExportPackageDescription[] aSubtitutes = new ExportPackageDescription[] { aExports[0], aExports[1] }; assertArrayEquals("aVisible not correct", aExports, a.getExportPackages()); //$NON-NLS-1$ assertArrayEquals("bVisible not correct", aSubtitutes, bVisible); //$NON-NLS-1$ assertArrayEquals("cVisible not correct", aSubtitutes, cVisible); //$NON-NLS-1$ @@ -1508,7 +1780,7 @@ public void testSubstitutableExports004() throws BundleException { ExportPackageDescription[] aExports = a.getSelectedExports(); assertEquals("a has wrong number of exports", 3, aExports.length); //$NON-NLS-1$ ExportPackageDescription[] aDeclaredExports = a.getExportPackages(); - ExportPackageDescription[] aFragExports = new ExportPackageDescription[] {aExports[2]}; + ExportPackageDescription[] aFragExports = new ExportPackageDescription[] { aExports[2] }; assertArrayEquals("bVisible not correct", aDeclaredExports, bVisible); //$NON-NLS-1$ assertArrayEquals("bFragVisible not correct", aFragExports, bFragVisible); //$NON-NLS-1$ assertArrayEquals("cVisible not correct", aDeclaredExports, cVisible); //$NON-NLS-1$ @@ -1523,7 +1795,7 @@ public void testSubstitutableExports005() throws BundleException { State state = getSubstituteUsesFragState(); state.resolve(); - // BundleDescription z = state.getBundle(0); + // BundleDescription z = state.getBundle(0); BundleDescription a = state.getBundle(1); BundleDescription aFrag = state.getBundle(2); BundleDescription b = state.getBundle(3); @@ -1582,7 +1854,7 @@ public void testSubstitutableExports005() throws BundleException { ExportPackageDescription[] aExports = a.getSelectedExports(); assertEquals("a has wrong number of exports", 3, aExports.length); //$NON-NLS-1$ ExportPackageDescription[] aDeclaredExports = a.getExportPackages(); - ExportPackageDescription[] aFragExports = new ExportPackageDescription[] {aExports[2]}; + ExportPackageDescription[] aFragExports = new ExportPackageDescription[] { aExports[2] }; assertArrayEquals("bVisible not correct", aDeclaredExports, bVisible); //$NON-NLS-1$ assertArrayEquals("bFragVisible not correct", aFragExports, bFragVisible); //$NON-NLS-1$ assertArrayEquals("cVisible not correct", aDeclaredExports, cVisible); //$NON-NLS-1$ @@ -1597,7 +1869,7 @@ public void testSubstitutableExports006() throws BundleException { State state = getSubstituteUsesFragCycleState(); state.resolve(); - // BundleDescription z = state.getBundle(0); + // BundleDescription z = state.getBundle(0); BundleDescription a = state.getBundle(1); BundleDescription aFrag = state.getBundle(2); BundleDescription b = state.getBundle(3); @@ -1670,7 +1942,7 @@ public void testSubstitutableExports006() throws BundleException { ExportPackageDescription[] bcExpectedVisible = new ExportPackageDescription[aDeclaredExports.length + 1]; System.arraycopy(aDeclaredExports, 0, bcExpectedVisible, 0, aDeclaredExports.length); bcExpectedVisible[2] = g.getSelectedExports()[0]; - ExportPackageDescription[] aFragExports = new ExportPackageDescription[] {aExports[2]}; + ExportPackageDescription[] aFragExports = new ExportPackageDescription[] { aExports[2] }; assertArrayEquals("aVisible not correct", g.getSelectedExports(), aVisible); //$NON-NLS-1$ assertArrayEquals("bVisible not correct", bcExpectedVisible, bVisible); //$NON-NLS-1$ assertArrayEquals("bFragVisible not correct", aFragExports, bFragVisible); //$NON-NLS-1$ @@ -1683,7 +1955,8 @@ public void testSubstitutableExports006() throws BundleException { ExportPackageDescription[] gExports = g.getSelectedExports(); assertEquals("g has wrong number of exports", 1, gExports.length); //$NON-NLS-1$ - ExportPackageDescription[] expectedHIVisible = new ExportPackageDescription[] {gExports[0], aExports[0], aExports[1], aExports[2]}; + ExportPackageDescription[] expectedHIVisible = new ExportPackageDescription[] { gExports[0], aExports[0], + aExports[1], aExports[2] }; assertArrayEquals("gVisible not correct", aExports, gVisible); //$NON-NLS-1$ assertArrayEquals("hVisible not correct", expectedHIVisible, hVisible); //$NON-NLS-1$ assertArrayEquals("iVisible not correct", expectedHIVisible, iVisible); //$NON-NLS-1$ @@ -1886,7 +2159,8 @@ public void testSubstitutableExports009() throws BundleException { assertEquals("aExports count wrong", 2, aExports.length); //$NON-NLS-1$ ExportPackageDescription[] jExports = j.getSelectedExports(); assertEquals("aExports count wrong", 1, jExports.length); //$NON-NLS-1$ - ExportPackageDescription[] bcExpected = new ExportPackageDescription[] {aExports[0], aExports[1], jExports[0]}; + ExportPackageDescription[] bcExpected = new ExportPackageDescription[] { aExports[0], aExports[1], + jExports[0] }; assertArrayEquals("aVisible not correct", jExports, aVisible); //$NON-NLS-1$ assertArrayEquals("bVisible not correct", bcExpected, bVisible); //$NON-NLS-1$ assertArrayEquals("cVisible not correct", bcExpected, cVisible); //$NON-NLS-1$ @@ -1909,22 +2183,23 @@ public void testSubstitutableExports010() throws BundleException { BundleDescription e = state.getBundle(4); BundleDescription f = state.getBundle(5); - BundleDescription[] allBundles = new BundleDescription[] {a, b, c, d, e, f}; - StateDelta stateDelta = state.resolve(new BundleDescription[] {a}); + BundleDescription[] allBundles = new BundleDescription[] { a, b, c, d, e, f }; + StateDelta stateDelta = state.resolve(new BundleDescription[] { a }); BundleDelta[] bundleDeltas = stateDelta.getChanges(); assertNotNull("bundleDeltas is null", bundleDeltas); //$NON-NLS-1$ assertEquals("bunldeDeltas wrong number", 6, bundleDeltas.length); //$NON-NLS-1$ for (BundleDescription description : allBundles) { boolean found = false; for (int j = 0; j < bundleDeltas.length && !found; j++) { - assertEquals("unexpected delta type " + bundleDeltas[j], BundleDelta.RESOLVED, bundleDeltas[j].getType()); //$NON-NLS-1$ + assertEquals("unexpected delta type " + bundleDeltas[j], BundleDelta.RESOLVED, //$NON-NLS-1$ + bundleDeltas[j].getType()); found = bundleDeltas[j].getBundle() == description; } if (!found) { fail("Did not find RESOLVED BundleDelta for " + description); //$NON-NLS-1$ } } - stateDelta = state.resolve(new BundleDescription[] {f}); + stateDelta = state.resolve(new BundleDescription[] { f }); bundleDeltas = stateDelta.getChanges(); assertNotNull("bundleDeltas is null", bundleDeltas); //$NON-NLS-1$ assertEquals("bunldeDeltas wrong number", 1, bundleDeltas.length); //$NON-NLS-1$ @@ -1941,27 +2216,28 @@ public void testSubstitutableExports011() throws BundleException { BundleDescription e = state.getBundle(5); BundleDescription f = state.getBundle(6); - BundleDescription[] allRefreshBundles = new BundleDescription[] {a, b, c, d, e, f}; - StateDelta stateDelta = state.resolve(new BundleDescription[] {a}); + BundleDescription[] allRefreshBundles = new BundleDescription[] { a, b, c, d, e, f }; + StateDelta stateDelta = state.resolve(new BundleDescription[] { a }); BundleDelta[] bundleDeltas = stateDelta.getChanges(); assertNotNull("bundleDeltas is null", bundleDeltas); //$NON-NLS-1$ assertEquals("bunldeDeltas wrong number", 6, bundleDeltas.length); //$NON-NLS-1$ for (BundleDescription description : allRefreshBundles) { boolean found = false; for (int j = 0; j < bundleDeltas.length && !found; j++) { - assertEquals("unexpected delta type " + bundleDeltas[j], BundleDelta.RESOLVED, bundleDeltas[j].getType()); //$NON-NLS-1$ + assertEquals("unexpected delta type " + bundleDeltas[j], BundleDelta.RESOLVED, //$NON-NLS-1$ + bundleDeltas[j].getType()); found = bundleDeltas[j].getBundle() == description; } if (!found) { fail("Did not find RESOLVED BundleDelta for " + description); //$NON-NLS-1$ } } - stateDelta = state.resolve(new BundleDescription[] {f}); + stateDelta = state.resolve(new BundleDescription[] { f }); bundleDeltas = stateDelta.getChanges(); assertNotNull("bundleDeltas is null", bundleDeltas); //$NON-NLS-1$ assertEquals("bunldeDeltas wrong number", 1, bundleDeltas.length); //$NON-NLS-1$ - stateDelta = state.resolve(new BundleDescription[] {z}); + stateDelta = state.resolve(new BundleDescription[] { z }); bundleDeltas = stateDelta.getChanges(); assertNotNull("bundleDeltas is null", bundleDeltas); //$NON-NLS-1$ assertEquals("bunldeDeltas wrong number", 1, bundleDeltas.length); //$NON-NLS-1$ @@ -1979,34 +2255,36 @@ public void testSubstitutableExports012() throws BundleException { BundleDescription g = state.getBundle(7); BundleDescription h = state.getBundle(8); - BundleDescription[] allRefreshBundles = new BundleDescription[] {a, b, c, d, e, f, g, h}; - StateDelta stateDelta = state.resolve(new BundleDescription[] {a}); + BundleDescription[] allRefreshBundles = new BundleDescription[] { a, b, c, d, e, f, g, h }; + StateDelta stateDelta = state.resolve(new BundleDescription[] { a }); BundleDelta[] bundleDeltas = stateDelta.getChanges(); assertNotNull("bundleDeltas is null", bundleDeltas); //$NON-NLS-1$ assertEquals("bunldeDeltas wrong number", 8, bundleDeltas.length); //$NON-NLS-1$ for (BundleDescription description : allRefreshBundles) { boolean found = false; for (int j = 0; j < bundleDeltas.length && !found; j++) { - assertEquals("unexpected delta type " + bundleDeltas[j], BundleDelta.RESOLVED, bundleDeltas[j].getType()); //$NON-NLS-1$ + assertEquals("unexpected delta type " + bundleDeltas[j], BundleDelta.RESOLVED, //$NON-NLS-1$ + bundleDeltas[j].getType()); found = bundleDeltas[j].getBundle() == description; } if (!found) { fail("Did not find RESOLVED BundleDelta for " + description); //$NON-NLS-1$ } } - stateDelta = state.resolve(new BundleDescription[] {f}); + stateDelta = state.resolve(new BundleDescription[] { f }); bundleDeltas = stateDelta.getChanges(); assertNotNull("bundleDeltas is null", bundleDeltas); //$NON-NLS-1$ assertEquals("bunldeDeltas wrong number", 1, bundleDeltas.length); //$NON-NLS-1$ - stateDelta = state.resolve(new BundleDescription[] {c}); + stateDelta = state.resolve(new BundleDescription[] { c }); bundleDeltas = stateDelta.getChanges(); assertNotNull("bundleDeltas is null", bundleDeltas); //$NON-NLS-1$ assertEquals("bunldeDeltas wrong number", 8, bundleDeltas.length); //$NON-NLS-1$ for (BundleDescription description : allRefreshBundles) { boolean found = false; for (int j = 0; j < bundleDeltas.length && !found; j++) { - assertEquals("unexpected delta type " + bundleDeltas[j], BundleDelta.RESOLVED, bundleDeltas[j].getType()); //$NON-NLS-1$ + assertEquals("unexpected delta type " + bundleDeltas[j], BundleDelta.RESOLVED, //$NON-NLS-1$ + bundleDeltas[j].getType()); found = bundleDeltas[j].getBundle() == description; } if (!found) { @@ -2029,35 +2307,37 @@ public void testSubstitutableExports013() throws BundleException { BundleDescription e = state.getBundle(7); BundleDescription f = state.getBundle(8); - BundleDescription[] allBundles = new BundleDescription[] {a, aFrag, b, bFrag, c, cFrag, d, e, f}; - StateDelta stateDelta = state.resolve(new BundleDescription[] {a}); + BundleDescription[] allBundles = new BundleDescription[] { a, aFrag, b, bFrag, c, cFrag, d, e, f }; + StateDelta stateDelta = state.resolve(new BundleDescription[] { a }); BundleDelta[] bundleDeltas = stateDelta.getChanges(); assertNotNull("bundleDeltas is null", bundleDeltas); //$NON-NLS-1$ assertEquals("bunldeDeltas wrong number", 9, bundleDeltas.length); //$NON-NLS-1$ for (BundleDescription description : allBundles) { boolean found = false; for (int j = 0; j < bundleDeltas.length && !found; j++) { - assertEquals("unexpected delta type " + bundleDeltas[j], BundleDelta.RESOLVED, bundleDeltas[j].getType()); //$NON-NLS-1$ + assertEquals("unexpected delta type " + bundleDeltas[j], BundleDelta.RESOLVED, //$NON-NLS-1$ + bundleDeltas[j].getType()); found = bundleDeltas[j].getBundle() == description; } if (!found) { fail("Did not find RESOLVED BundleDelta for " + description); //$NON-NLS-1$ } } - stateDelta = state.resolve(new BundleDescription[] {f}); + stateDelta = state.resolve(new BundleDescription[] { f }); bundleDeltas = stateDelta.getChanges(); assertNotNull("bundleDeltas is null", bundleDeltas); //$NON-NLS-1$ assertEquals("bunldeDeltas wrong number", 1, bundleDeltas.length); //$NON-NLS-1$ - stateDelta = state.resolve(new BundleDescription[] {c}); + stateDelta = state.resolve(new BundleDescription[] { c }); bundleDeltas = stateDelta.getChanges(); - BundleDescription[] expectedRefresh = new BundleDescription[] {c, cFrag, f}; + BundleDescription[] expectedRefresh = new BundleDescription[] { c, cFrag, f }; assertNotNull("bundleDeltas is null", bundleDeltas); //$NON-NLS-1$ assertEquals("bunldeDeltas wrong number", 3, bundleDeltas.length); //$NON-NLS-1$ for (BundleDescription description : expectedRefresh) { boolean found = false; for (int j = 0; j < bundleDeltas.length && !found; j++) { - assertEquals("unexpected delta type " + bundleDeltas[j], BundleDelta.RESOLVED, bundleDeltas[j].getType()); //$NON-NLS-1$ + assertEquals("unexpected delta type " + bundleDeltas[j], BundleDelta.RESOLVED, //$NON-NLS-1$ + bundleDeltas[j].getType()); found = bundleDeltas[j].getBundle() == description; } if (!found) { @@ -2080,42 +2360,44 @@ public void testSubstitutableExports014() throws BundleException { BundleDescription d = state.getBundle(7); BundleDescription e = state.getBundle(8); BundleDescription f = state.getBundle(9); - //BundleDescription g = state.getBundle(10); + // BundleDescription g = state.getBundle(10); - BundleDescription[] allRefreshBundles = new BundleDescription[] {a, aFrag, b, bFrag, c, cFrag, d, e, f}; - StateDelta stateDelta = state.resolve(new BundleDescription[] {a}); + BundleDescription[] allRefreshBundles = new BundleDescription[] { a, aFrag, b, bFrag, c, cFrag, d, e, f }; + StateDelta stateDelta = state.resolve(new BundleDescription[] { a }); BundleDelta[] bundleDeltas = stateDelta.getChanges(); assertNotNull("bundleDeltas is null", bundleDeltas); //$NON-NLS-1$ assertEquals("bunldeDeltas wrong number", allRefreshBundles.length, bundleDeltas.length); //$NON-NLS-1$ for (BundleDescription description : allRefreshBundles) { boolean found = false; for (int j = 0; j < bundleDeltas.length && !found; j++) { - assertEquals("unexpected delta type " + bundleDeltas[j], BundleDelta.RESOLVED, bundleDeltas[j].getType()); //$NON-NLS-1$ + assertEquals("unexpected delta type " + bundleDeltas[j], BundleDelta.RESOLVED, //$NON-NLS-1$ + bundleDeltas[j].getType()); found = bundleDeltas[j].getBundle() == description; } if (!found) { fail("Did not find RESOLVED BundleDelta for " + description); //$NON-NLS-1$ } } - stateDelta = state.resolve(new BundleDescription[] {f}); + stateDelta = state.resolve(new BundleDescription[] { f }); bundleDeltas = stateDelta.getChanges(); assertNotNull("bundleDeltas is null", bundleDeltas); //$NON-NLS-1$ assertEquals("bunldeDeltas wrong number", 1, bundleDeltas.length); //$NON-NLS-1$ - stateDelta = state.resolve(new BundleDescription[] {z}); + stateDelta = state.resolve(new BundleDescription[] { z }); bundleDeltas = stateDelta.getChanges(); assertNotNull("bundleDeltas is null", bundleDeltas); //$NON-NLS-1$ assertEquals("bunldeDeltas wrong number", 1, bundleDeltas.length); //$NON-NLS-1$ - stateDelta = state.resolve(new BundleDescription[] {c}); + stateDelta = state.resolve(new BundleDescription[] { c }); bundleDeltas = stateDelta.getChanges(); - BundleDescription[] expectedRefresh = new BundleDescription[] {c, cFrag, f}; + BundleDescription[] expectedRefresh = new BundleDescription[] { c, cFrag, f }; assertNotNull("bundleDeltas is null", bundleDeltas); //$NON-NLS-1$ assertEquals("bunldeDeltas wrong number", 3, bundleDeltas.length); //$NON-NLS-1$ for (BundleDescription description : expectedRefresh) { boolean found = false; for (int j = 0; j < bundleDeltas.length && !found; j++) { - assertEquals("unexpected delta type " + bundleDeltas[j], BundleDelta.RESOLVED, bundleDeltas[j].getType()); //$NON-NLS-1$ + assertEquals("unexpected delta type " + bundleDeltas[j], BundleDelta.RESOLVED, //$NON-NLS-1$ + bundleDeltas[j].getType()); found = bundleDeltas[j].getBundle() == description; } if (!found) { @@ -2127,7 +2409,7 @@ public void testSubstitutableExports014() throws BundleException { public void testSubstitutableExports015() throws BundleException { State state = getSubstituteUsesFragCycleState(); state.resolve(); - // BundleDescription z = state.getBundle(0); + // BundleDescription z = state.getBundle(0); BundleDescription a = state.getBundle(1); BundleDescription aFrag = state.getBundle(2); BundleDescription b = state.getBundle(3); @@ -2141,34 +2423,37 @@ public void testSubstitutableExports015() throws BundleException { BundleDescription h = state.getBundle(11); BundleDescription i = state.getBundle(12); - BundleDescription[] allRefreshBundles = new BundleDescription[] {a, aFrag, b, bFrag, c, cFrag, d, e, f, g, h, i}; - StateDelta stateDelta = state.resolve(new BundleDescription[] {a}); + BundleDescription[] allRefreshBundles = new BundleDescription[] { a, aFrag, b, bFrag, c, cFrag, d, e, f, g, h, + i }; + StateDelta stateDelta = state.resolve(new BundleDescription[] { a }); BundleDelta[] bundleDeltas = stateDelta.getChanges(); assertNotNull("bundleDeltas is null", bundleDeltas); //$NON-NLS-1$ assertEquals("bunldeDeltas wrong number", allRefreshBundles.length, bundleDeltas.length); //$NON-NLS-1$ for (BundleDescription description : allRefreshBundles) { boolean found = false; for (int k = 0; k < bundleDeltas.length && !found; k++) { - assertEquals("unexpected delta type " + bundleDeltas[k], BundleDelta.RESOLVED, bundleDeltas[k].getType()); //$NON-NLS-1$ + assertEquals("unexpected delta type " + bundleDeltas[k], BundleDelta.RESOLVED, //$NON-NLS-1$ + bundleDeltas[k].getType()); found = bundleDeltas[k].getBundle() == description; } if (!found) { fail("Did not find RESOLVED BundleDelta for " + description); //$NON-NLS-1$ } } - stateDelta = state.resolve(new BundleDescription[] {f}); + stateDelta = state.resolve(new BundleDescription[] { f }); bundleDeltas = stateDelta.getChanges(); assertNotNull("bundleDeltas is null", bundleDeltas); //$NON-NLS-1$ assertEquals("bunldeDeltas wrong number", 1, bundleDeltas.length); //$NON-NLS-1$ - stateDelta = state.resolve(new BundleDescription[] {c}); + stateDelta = state.resolve(new BundleDescription[] { c }); bundleDeltas = stateDelta.getChanges(); assertNotNull("bundleDeltas is null", bundleDeltas); //$NON-NLS-1$ assertEquals("bunldeDeltas wrong number", allRefreshBundles.length, bundleDeltas.length); //$NON-NLS-1$ for (BundleDescription description : allRefreshBundles) { boolean found = false; for (int k = 0; k < bundleDeltas.length && !found; k++) { - assertEquals("unexpected delta type " + bundleDeltas[k], BundleDelta.RESOLVED, bundleDeltas[k].getType()); //$NON-NLS-1$ + assertEquals("unexpected delta type " + bundleDeltas[k], BundleDelta.RESOLVED, //$NON-NLS-1$ + bundleDeltas[k].getType()); found = bundleDeltas[k].getBundle() == description; } if (!found) { @@ -2190,15 +2475,16 @@ public void testSubstitutableExports016() throws BundleException { BundleDescription h = state.getBundle(7); BundleDescription i = state.getBundle(8); - BundleDescription[] allBundles = new BundleDescription[] {a, b, c, d, e, f, g, h, i}; - StateDelta stateDelta = state.resolve(new BundleDescription[] {a}); + BundleDescription[] allBundles = new BundleDescription[] { a, b, c, d, e, f, g, h, i }; + StateDelta stateDelta = state.resolve(new BundleDescription[] { a }); BundleDelta[] bundleDeltas = stateDelta.getChanges(); assertNotNull("bundleDeltas is null", bundleDeltas); //$NON-NLS-1$ assertEquals("bunldeDeltas wrong number", allBundles.length, bundleDeltas.length); //$NON-NLS-1$ for (BundleDescription description : allBundles) { boolean found = false; for (int k = 0; k < bundleDeltas.length && !found; k++) { - assertEquals("unexpected delta type " + bundleDeltas[k], BundleDelta.RESOLVED, bundleDeltas[k].getType()); //$NON-NLS-1$ + assertEquals("unexpected delta type " + bundleDeltas[k], BundleDelta.RESOLVED, //$NON-NLS-1$ + bundleDeltas[k].getType()); found = bundleDeltas[k].getBundle() == description; } if (!found) { @@ -2206,22 +2492,23 @@ public void testSubstitutableExports016() throws BundleException { } } - stateDelta = state.resolve(new BundleDescription[] {f}); + stateDelta = state.resolve(new BundleDescription[] { f }); bundleDeltas = stateDelta.getChanges(); - BundleDescription[] expectedRefresh = new BundleDescription[] {f, i}; + BundleDescription[] expectedRefresh = new BundleDescription[] { f, i }; assertNotNull("bundleDeltas is null", bundleDeltas); //$NON-NLS-1$ assertEquals("bunldeDeltas wrong number", expectedRefresh.length, bundleDeltas.length); //$NON-NLS-1$ for (BundleDescription description : expectedRefresh) { boolean found = false; for (int k = 0; k < bundleDeltas.length && !found; k++) { - assertEquals("unexpected delta type " + bundleDeltas[k], BundleDelta.RESOLVED, bundleDeltas[k].getType()); //$NON-NLS-1$ + assertEquals("unexpected delta type " + bundleDeltas[k], BundleDelta.RESOLVED, //$NON-NLS-1$ + bundleDeltas[k].getType()); found = bundleDeltas[k].getBundle() == description; } if (!found) { fail("Did not find RESOLVED BundleDelta for " + description); //$NON-NLS-1$ } } - stateDelta = state.resolve(new BundleDescription[] {i}); + stateDelta = state.resolve(new BundleDescription[] { i }); bundleDeltas = stateDelta.getChanges(); assertNotNull("bundleDeltas is null", bundleDeltas); //$NON-NLS-1$ assertEquals("bunldeDeltas wrong number", 1, bundleDeltas.length); //$NON-NLS-1$ @@ -2240,17 +2527,18 @@ public void testSubstitutableExports017() throws BundleException { BundleDescription g = state.getBundle(7); BundleDescription h = state.getBundle(8); BundleDescription i = state.getBundle(9); - //BundleDescription j = state.getBundle(10); + // BundleDescription j = state.getBundle(10); - BundleDescription[] allRefreshBundles = new BundleDescription[] {a, b, c, d, e, f, g, h, i}; - StateDelta stateDelta = state.resolve(new BundleDescription[] {a}); + BundleDescription[] allRefreshBundles = new BundleDescription[] { a, b, c, d, e, f, g, h, i }; + StateDelta stateDelta = state.resolve(new BundleDescription[] { a }); BundleDelta[] bundleDeltas = stateDelta.getChanges(); assertNotNull("bundleDeltas is null", bundleDeltas); //$NON-NLS-1$ assertEquals("bunldeDeltas wrong number", allRefreshBundles.length, bundleDeltas.length); //$NON-NLS-1$ for (BundleDescription description : allRefreshBundles) { boolean found = false; for (int m = 0; m < bundleDeltas.length && !found; m++) { - assertEquals("unexpected delta type " + bundleDeltas[m], BundleDelta.RESOLVED, bundleDeltas[m].getType()); //$NON-NLS-1$ + assertEquals("unexpected delta type " + bundleDeltas[m], BundleDelta.RESOLVED, //$NON-NLS-1$ + bundleDeltas[m].getType()); found = bundleDeltas[m].getBundle() == description; } if (!found) { @@ -2258,27 +2546,28 @@ public void testSubstitutableExports017() throws BundleException { } } - stateDelta = state.resolve(new BundleDescription[] {f}); + stateDelta = state.resolve(new BundleDescription[] { f }); bundleDeltas = stateDelta.getChanges(); - BundleDescription[] expectedRefresh = new BundleDescription[] {f, i}; + BundleDescription[] expectedRefresh = new BundleDescription[] { f, i }; assertNotNull("bundleDeltas is null", bundleDeltas); //$NON-NLS-1$ assertEquals("bunldeDeltas wrong number", expectedRefresh.length, bundleDeltas.length); //$NON-NLS-1$ for (BundleDescription description : expectedRefresh) { boolean found = false; for (int m = 0; m < bundleDeltas.length && !found; m++) { - assertEquals("unexpected delta type " + bundleDeltas[m], BundleDelta.RESOLVED, bundleDeltas[m].getType()); //$NON-NLS-1$ + assertEquals("unexpected delta type " + bundleDeltas[m], BundleDelta.RESOLVED, //$NON-NLS-1$ + bundleDeltas[m].getType()); found = bundleDeltas[m].getBundle() == description; } if (!found) { fail("Did not find RESOLVED BundleDelta for " + description); //$NON-NLS-1$ } } - stateDelta = state.resolve(new BundleDescription[] {i}); + stateDelta = state.resolve(new BundleDescription[] { i }); bundleDeltas = stateDelta.getChanges(); assertNotNull("bundleDeltas is null", bundleDeltas); //$NON-NLS-1$ assertEquals("bunldeDeltas wrong number", 1, bundleDeltas.length); //$NON-NLS-1$ - stateDelta = state.resolve(new BundleDescription[] {z}); + stateDelta = state.resolve(new BundleDescription[] { z }); bundleDeltas = stateDelta.getChanges(); assertNotNull("bundleDeltas is null", bundleDeltas); //$NON-NLS-1$ assertEquals("bunldeDeltas wrong number", 1, bundleDeltas.length); //$NON-NLS-1$ @@ -2298,34 +2587,36 @@ public void testSubstitutableExports018() throws BundleException { BundleDescription i = state.getBundle(9); BundleDescription j = state.getBundle(10); - BundleDescription[] allRefreshBundles = new BundleDescription[] {a, b, c, d, e, f, g, h, i, j}; - StateDelta stateDelta = state.resolve(new BundleDescription[] {a}); + BundleDescription[] allRefreshBundles = new BundleDescription[] { a, b, c, d, e, f, g, h, i, j }; + StateDelta stateDelta = state.resolve(new BundleDescription[] { a }); BundleDelta[] bundleDeltas = stateDelta.getChanges(); assertNotNull("bundleDeltas is null", bundleDeltas); //$NON-NLS-1$ assertEquals("bunldeDeltas wrong number", allRefreshBundles.length, bundleDeltas.length); //$NON-NLS-1$ for (BundleDescription description : allRefreshBundles) { boolean found = false; for (int l = 0; l < bundleDeltas.length && !found; l++) { - assertEquals("unexpected delta type " + bundleDeltas[l], BundleDelta.RESOLVED, bundleDeltas[l].getType()); //$NON-NLS-1$ + assertEquals("unexpected delta type " + bundleDeltas[l], BundleDelta.RESOLVED, //$NON-NLS-1$ + bundleDeltas[l].getType()); found = bundleDeltas[l].getBundle() == description; } if (!found) { fail("Did not find RESOLVED BundleDelta for " + description); //$NON-NLS-1$ } } - stateDelta = state.resolve(new BundleDescription[] {i}); + stateDelta = state.resolve(new BundleDescription[] { i }); bundleDeltas = stateDelta.getChanges(); assertNotNull("bundleDeltas is null", bundleDeltas); //$NON-NLS-1$ assertEquals("bunldeDeltas wrong number", 1, bundleDeltas.length); //$NON-NLS-1$ - stateDelta = state.resolve(new BundleDescription[] {c}); + stateDelta = state.resolve(new BundleDescription[] { c }); bundleDeltas = stateDelta.getChanges(); assertNotNull("bundleDeltas is null", bundleDeltas); //$NON-NLS-1$ assertEquals("bunldeDeltas wrong number", allRefreshBundles.length, bundleDeltas.length); //$NON-NLS-1$ for (BundleDescription description : allRefreshBundles) { boolean found = false; for (int l = 0; l < bundleDeltas.length && !found; l++) { - assertEquals("unexpected delta type " + bundleDeltas[l], BundleDelta.RESOLVED, bundleDeltas[l].getType()); //$NON-NLS-1$ + assertEquals("unexpected delta type " + bundleDeltas[l], BundleDelta.RESOLVED, //$NON-NLS-1$ + bundleDeltas[l].getType()); found = bundleDeltas[l].getBundle() == description; } if (!found) { @@ -2419,9 +2710,11 @@ public void testSubstitutableExports020() throws BundleException { manifest.put(Constants.BUNDLE_SYMBOLICNAME, "Q"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ manifest.put(Constants.EXPORT_PACKAGE, "q; version=1.0"); //$NON-NLS-1$ - BundleDescription q = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), f.getBundleId() + 1); + BundleDescription q = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + f.getBundleId() + 1); state.addBundle(q); - state.resolve(new BundleDescription[] {a}); + state.resolve(new BundleDescription[] { a }); assertTrue("1.0", a.isResolved()); //$NON-NLS-1$ assertTrue("1.0.1", aFrag.isResolved()); //$NON-NLS-1$ @@ -2467,7 +2760,8 @@ public void testSubstitutableExports020() throws BundleException { assertEquals("a has wrong number of exports", 3, aExports.length); //$NON-NLS-1$ ExportPackageDescription[] aDeclaredExports = a.getExportPackages(); - ExportPackageDescription[] aFragExpected = new ExportPackageDescription[] {aExports[2], q.getExportPackages()[0]}; + ExportPackageDescription[] aFragExpected = new ExportPackageDescription[] { aExports[2], + q.getExportPackages()[0] }; assertArrayEquals("aFragVisible not correct", q.getSelectedExports(), aFragVisible); //$NON-NLS-1$ assertArrayEquals("bVisible not correct", aDeclaredExports, bVisible); //$NON-NLS-1$ assertArrayEquals("bFragVisible not correct", aFragExpected, bFragVisible); //$NON-NLS-1$ @@ -2490,7 +2784,7 @@ public void testSubstitutableExports021() throws BundleException { BundleDescription f = state.getBundle(5); state.removeBundle(a); - state.resolve(new BundleDescription[] {a}); + state.resolve(new BundleDescription[] { a }); assertFalse("1.0", a.isResolved()); //$NON-NLS-1$ assertTrue("1.1", b.isResolved()); //$NON-NLS-1$ assertTrue("1.2", c.isResolved()); //$NON-NLS-1$ @@ -2681,13 +2975,15 @@ public void testSubstitutableExports023() throws BundleException { ExportPackageDescription[] aExports = a.getSelectedExports(); assertEquals("aExports wrong number", 2, aExports.length); //$NON-NLS-1$ - ExportPackageDescription[] bcExpected = new ExportPackageDescription[] {aExports[0], aExports[1], l.getSelectedExports()[0]}; - ExportPackageDescription[] aExpected = new ExportPackageDescription[] {l.getSelectedExports()[0]}; + ExportPackageDescription[] bcExpected = new ExportPackageDescription[] { aExports[0], aExports[1], + l.getSelectedExports()[0] }; + ExportPackageDescription[] aExpected = new ExportPackageDescription[] { l.getSelectedExports()[0] }; assertArrayEquals("aVisible not correct", aExpected, aVisible); //$NON-NLS-1$ assertArrayEquals("bVisible not correct", bcExpected, bVisible); //$NON-NLS-1$ assertArrayEquals("cVisible not correct", bcExpected, cVisible); //$NON-NLS-1$ - ExportPackageDescription[] dExpected = new ExportPackageDescription[] {l.getSelectedExports()[1], aExports[0], aExports[1]}; + ExportPackageDescription[] dExpected = new ExportPackageDescription[] { l.getSelectedExports()[1], aExports[0], + aExports[1] }; assertArrayEquals("dVisible not correct", dExpected, dVisible); //$NON-NLS-1$ ExportPackageDescription[] aExported = a.getSelectedExports(); @@ -2712,7 +3008,8 @@ public void testSubstitutableExports023() throws BundleException { } ExportPackageDescription[] lExported = l.getSelectedExports(); - ExportPackageDescription[] mnExpected = new ExportPackageDescription[aExported.length + dExported.length + lExported.length]; + ExportPackageDescription[] mnExpected = new ExportPackageDescription[aExported.length + dExported.length + + lExported.length]; System.arraycopy(aExported, 0, mnExpected, 0, aExported.length); System.arraycopy(dExported, 0, mnExpected, aExported.length, dExported.length); System.arraycopy(lExported, 0, mnExpected, aExported.length + dExported.length, lExported.length); @@ -2789,7 +3086,9 @@ public void testSubstitutableExports025() throws BundleException { manifest.put(Constants.REQUIRE_BUNDLE, "C"); //$NON-NLS-1$ manifest.put(Constants.EXPORT_PACKAGE, "z; version=0.5"); //$NON-NLS-1$ manifest.put(Constants.IMPORT_PACKAGE, "z"); //$NON-NLS-1$ - BundleDescription h = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), g.getBundleId() + 1); + BundleDescription h = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), + g.getBundleId() + 1); state.addBundle(h); state.resolve(); diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/resolver/XFriendsInternalResolverTest.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/resolver/XFriendsInternalResolverTest.java index 39c6f032c27..b4062279afe 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/resolver/XFriendsInternalResolverTest.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/resolver/XFriendsInternalResolverTest.java @@ -29,10 +29,12 @@ public XFriendsInternalResolverTest(String name) { } /** - * Tests the x-friends directive. A bundle should not be allowed to import a package which - * declares an x-friends directive and the importer is not a friend. When a bundle requires - * anther bundle which exports packages which declare an x-friends directive it should not - * have access to the packages unless the requiring bundle is a friend. + * Tests the x-friends directive. A bundle should not be allowed to import a + * package which declares an x-friends directive and the importer is not a + * friend. When a bundle requires anther bundle which exports packages which + * declare an x-friends directive it should not have access to the packages + * unless the requiring bundle is a friend. + * * @throws BundleException */ public void testXFriends() throws BundleException { @@ -45,60 +47,57 @@ public void testXFriends() throws BundleException { manifest.put(Constants.BUNDLE_SYMBOLICNAME, "test.exporter"); manifest.put(Constants.BUNDLE_VERSION, "1.0"); manifest.put(Constants.EXPORT_PACKAGE, - "test.exporter.foo1; x-friends:=\"test.importer1, test.requirer1\"," + - "test.exporter.foo2; x-friends:=\"test.importer2, test.requirer2\"," + - "test.exporter.bar1; x-friends:=\"test.importer1, test.requirer1\"," + - "test.exporter.bar2; x-friends:=\"test.importer2, test.requirer2\""); - BundleDescription testExporter = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); + "test.exporter.foo1; x-friends:=\"test.importer1, test.requirer1\"," + + "test.exporter.foo2; x-friends:=\"test.importer2, test.requirer2\"," + + "test.exporter.bar1; x-friends:=\"test.importer1, test.requirer1\"," + + "test.exporter.bar2; x-friends:=\"test.importer2, test.requirer2\""); + BundleDescription testExporter = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); manifest.put(Constants.BUNDLE_SYMBOLICNAME, "test.importer1"); manifest.put(Constants.BUNDLE_VERSION, "1.0"); - manifest.put(Constants.IMPORT_PACKAGE, - "test.exporter.foo1," + - "test.exporter.bar1," + - "test.exporter.foo2; resolution:=optional," + - "test.exporter.bar2; resolution:=optional"); - BundleDescription testImporter1 = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); + manifest.put(Constants.IMPORT_PACKAGE, "test.exporter.foo1," + "test.exporter.bar1," + + "test.exporter.foo2; resolution:=optional," + "test.exporter.bar2; resolution:=optional"); + BundleDescription testImporter1 = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); manifest.put(Constants.BUNDLE_SYMBOLICNAME, "test.importer2"); manifest.put(Constants.BUNDLE_VERSION, "1.0"); - manifest.put(Constants.IMPORT_PACKAGE, - "test.exporter.foo1; resolution:=optional," + - "test.exporter.bar1; resolution:=optional," + - "test.exporter.foo2," + - "test.exporter.bar2"); - BundleDescription testImporter2 = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); + manifest.put(Constants.IMPORT_PACKAGE, "test.exporter.foo1; resolution:=optional," + + "test.exporter.bar1; resolution:=optional," + "test.exporter.foo2," + "test.exporter.bar2"); + BundleDescription testImporter2 = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); manifest.put(Constants.BUNDLE_SYMBOLICNAME, "test.importer3"); manifest.put(Constants.BUNDLE_VERSION, "1.0"); - manifest.put(Constants.IMPORT_PACKAGE, - "test.exporter.foo1," + - "test.exporter.bar1," + - "test.exporter.foo2; resolution:=optional," + - "test.exporter.bar2; resolution:=optional"); - BundleDescription testImporter3 = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); + manifest.put(Constants.IMPORT_PACKAGE, "test.exporter.foo1," + "test.exporter.bar1," + + "test.exporter.foo2; resolution:=optional," + "test.exporter.bar2; resolution:=optional"); + BundleDescription testImporter3 = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); manifest.put(Constants.BUNDLE_SYMBOLICNAME, "test.requirer1"); manifest.put(Constants.BUNDLE_VERSION, "1.0"); manifest.put(Constants.REQUIRE_BUNDLE, "test.exporter"); - BundleDescription testRequirer1 = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); + BundleDescription testRequirer1 = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); manifest.put(Constants.BUNDLE_SYMBOLICNAME, "test.requirer2"); manifest.put(Constants.BUNDLE_VERSION, "1.0"); manifest.put(Constants.REQUIRE_BUNDLE, "test.exporter"); - BundleDescription testRequirer2 = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); + BundleDescription testRequirer2 = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); - Dictionary[] props = new Dictionary[] {new Hashtable()}; + Dictionary[] props = new Dictionary[] { new Hashtable() }; props[0].put("osgi.resolverMode", "strict"); state.setPlatformProperties(props); @@ -118,8 +117,8 @@ public void testXFriends() throws BundleException { assertTrue("1.4", testRequirer1.isResolved()); assertTrue("1.5", testRequirer2.isResolved()); - String[] validPackages1 = {"test.exporter.foo1", "test.exporter.bar1"}; - String[] validPackages2 = {"test.exporter.foo2", "test.exporter.bar2"}; + String[] validPackages1 = { "test.exporter.foo1", "test.exporter.bar1" }; + String[] validPackages2 = { "test.exporter.foo2", "test.exporter.bar2" }; // make sure the importers only got the packages they are really friends to ExportPackageDescription[] imported1 = testImporter1.getResolvedImports(); assertTrue("2.0", imported1 != null && imported1.length == 2); // should only have 2 resolved imports @@ -152,7 +151,8 @@ public void testVisiblePackages001() throws BundleException { manifest.put(Constants.BUNDLE_SYMBOLICNAME, "a.base"); manifest.put(Constants.BUNDLE_VERSION, "1.0"); manifest.put(Constants.EXPORT_PACKAGE, "a.split.pkg; a.base=split; mandatory:=a.base"); - BundleDescription aBase = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); + BundleDescription aBase = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); @@ -160,7 +160,8 @@ public void testVisiblePackages001() throws BundleException { manifest.put(Constants.BUNDLE_VERSION, "1.0"); manifest.put(Constants.REQUIRE_BUNDLE, "a.base"); manifest.put(Constants.EXPORT_PACKAGE, "a.split.pkg"); - BundleDescription aExtra = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); + BundleDescription aExtra = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); @@ -168,7 +169,8 @@ public void testVisiblePackages001() throws BundleException { manifest.put(Constants.BUNDLE_VERSION, "1.0"); manifest.put(Constants.REQUIRE_BUNDLE, "a.extra"); manifest.put(Constants.EXPORT_PACKAGE, "test.base.exporter.require"); - BundleDescription b= state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); + BundleDescription b = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); state.addBundle(aBase); state.addBundle(aExtra); @@ -200,9 +202,9 @@ public void testVisiblePackages002() throws BundleException { manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); manifest.put(Constants.BUNDLE_SYMBOLICNAME, "test.base.exporter"); manifest.put(Constants.BUNDLE_VERSION, "1.0"); - manifest.put(Constants.EXPORT_PACKAGE, - "test.base; base.exporter=split; mandatory:=base.exporter"); - BundleDescription baseExporter = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); + manifest.put(Constants.EXPORT_PACKAGE, "test.base; base.exporter=split; mandatory:=base.exporter"); + BundleDescription baseExporter = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); @@ -211,25 +213,25 @@ public void testVisiblePackages002() throws BundleException { manifest.put(Constants.REQUIRE_BUNDLE, "test.base.exporter"); manifest.put(Constants.EXPORT_PACKAGE, "test.base; base.exporter.require=split; mandatory:=base.exporter.require"); - BundleDescription baseExporterRequire = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); + BundleDescription baseExporterRequire = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); manifest.put(Constants.BUNDLE_SYMBOLICNAME, "test.base.exporter.require2"); manifest.put(Constants.BUNDLE_VERSION, "1.0"); - manifest.put(Constants.REQUIRE_BUNDLE, - "test.base.exporter.require"); + manifest.put(Constants.REQUIRE_BUNDLE, "test.base.exporter.require"); manifest.put(Constants.EXPORT_PACKAGE, "test.base.exporter.require"); - BundleDescription baseExporterRequire2 = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); - + BundleDescription baseExporterRequire2 = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); manifest.put(Constants.BUNDLE_SYMBOLICNAME, "test.base.importer"); manifest.put(Constants.BUNDLE_VERSION, "1.0"); - manifest.put(Constants.REQUIRE_BUNDLE, - "test.base.exporter.require"); - BundleDescription baseImporter = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); + manifest.put(Constants.REQUIRE_BUNDLE, "test.base.exporter.require"); + BundleDescription baseImporter = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); @@ -237,16 +239,18 @@ public void testVisiblePackages002() throws BundleException { manifest.put(Constants.BUNDLE_VERSION, "1.0"); manifest.put(Constants.REQUIRE_BUNDLE, "test.base.exporter.require2"); manifest.put(Constants.EXPORT_PACKAGE, "test.base"); - BundleDescription baseImporter2 = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); + BundleDescription baseImporter2 = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); manifest.put(Constants.BUNDLE_SYMBOLICNAME, "test.base.importer3"); manifest.put(Constants.BUNDLE_VERSION, "1.0"); manifest.put(Constants.IMPORT_PACKAGE, "test.base; bundle-symbolic-name=test.base.importer2"); - BundleDescription baseImporter3 = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); + BundleDescription baseImporter3 = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); - Dictionary[] props = new Dictionary[] {new Hashtable()}; + Dictionary[] props = new Dictionary[] { new Hashtable() }; props[0].put("osgi.resolverMode", "strict"); state.setPlatformProperties(props); @@ -297,14 +301,16 @@ public void testVisiblePackages003() throws BundleException { manifest.put(Constants.BUNDLE_SYMBOLICNAME, "E"); manifest.put(Constants.BUNDLE_VERSION, "1.0"); manifest.put(Constants.EXPORT_PACKAGE, "test.base; E=split; mandatory:=E"); - BundleDescription e = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); + BundleDescription e = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); manifest.put(Constants.BUNDLE_SYMBOLICNAME, "D"); manifest.put(Constants.BUNDLE_VERSION, "1.0"); manifest.put(Constants.REQUIRE_BUNDLE, "E"); - BundleDescription d = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); + BundleDescription d = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); @@ -312,31 +318,36 @@ public void testVisiblePackages003() throws BundleException { manifest.put(Constants.BUNDLE_VERSION, "1.0"); manifest.put(Constants.REQUIRE_BUNDLE, "D"); manifest.put(Constants.EXPORT_PACKAGE, "test.base; D=split; mandatory:=D"); - BundleDescription c = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); + BundleDescription c = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); manifest.put(Constants.BUNDLE_SYMBOLICNAME, "B"); manifest.put(Constants.BUNDLE_VERSION, "1.0"); - manifest.put(Constants.REQUIRE_BUNDLE, "F; " + Constants.VISIBILITY_DIRECTIVE + ":=" + Constants.VISIBILITY_REEXPORT ); - BundleDescription b = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); + manifest.put(Constants.REQUIRE_BUNDLE, + "F; " + Constants.VISIBILITY_DIRECTIVE + ":=" + Constants.VISIBILITY_REEXPORT); + BundleDescription b = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); manifest.put(Constants.BUNDLE_SYMBOLICNAME, "F"); manifest.put(Constants.BUNDLE_VERSION, "1.0"); manifest.put(Constants.EXPORT_PACKAGE, "test.base; F=split; mandatory:=F"); - BundleDescription f = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); + BundleDescription f = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); manifest.put(Constants.BUNDLE_SYMBOLICNAME, "A"); manifest.put(Constants.BUNDLE_VERSION, "1.0"); - manifest.put(Constants.REQUIRE_BUNDLE, "B; " + Constants.VISIBILITY_DIRECTIVE + ":=" + Constants.VISIBILITY_REEXPORT + - ",C"); - BundleDescription a = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); + manifest.put(Constants.REQUIRE_BUNDLE, + "B; " + Constants.VISIBILITY_DIRECTIVE + ":=" + Constants.VISIBILITY_REEXPORT + ",C"); + BundleDescription a = state.getFactory().createBundleDescription(state, manifest, + (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); - Dictionary[] props = new Dictionary[] {new Hashtable()}; + Dictionary[] props = new Dictionary[] { new Hashtable() }; props[0].put("osgi.resolverMode", "strict"); state.setPlatformProperties(props); @@ -378,4 +389,3 @@ private boolean contains(Object[] array, Object element) { return false; } } - diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/util/BidiTextProcessorTestCase.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/util/BidiTextProcessorTestCase.java index a36a8de521c..9e996e7f629 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/util/BidiTextProcessorTestCase.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/util/BidiTextProcessorTestCase.java @@ -20,8 +20,8 @@ /** * Tests for strings that use the TextProcessor and are run in a bidi locale. * - * NOTE: Run these tests as a session test in order to have the correct - * locale set. Run class AllTests. + * NOTE: Run these tests as a session test in order to have the correct locale + * set. Run class AllTests. */ public class BidiTextProcessorTestCase extends TextProcessorTestCase { @@ -40,9 +40,13 @@ public static Test suite() { private static String PATH_2_RESULT = LRE + PATH_2 + PDF; private static String PATH_3_RESULT = LRE + PATH_3 + PDF; private static String PATH_4_RESULT = LRE + PATH_4 + PDF; - private static String PATH_5_RESULT = LRE + "d" + ":" + "\\" + HEBREW_STRING_2 + " abcdef-" + HEBREW_STRING_3 + "\\" + "xyz" + "\\" + "abcdef" + "\\" + HEBREW_STRING_4 + LRM + "\\" + HEBREW_STRING_5 + "." + "java" + PDF; - private static String PATH_6_RESULT = LRE + "d" + ":" + "\\" + HEBREW_STRING_2 + " abcdef-" + HEBREW_STRING_3 + "\\" + "xyz" + "\\" + "abcdef" + "\\" + HEBREW_STRING_4 + LRM + "\\" + HEBREW_STRING_5 + LRM + "." + HEBREW_STRING_6 + PDF; - private static String PATH_7_RESULT = LRE + "d" + ":" + "\\" + HEBREW_STRING_2 + " abcdef-" + HEBREW_STRING_3 + "\\" + "xyz" + "\\" + "abcdef" + "\\" + HEBREW_STRING_4 + "\\" + "Test" + "." + "java" + PDF; + private static String PATH_5_RESULT = LRE + "d" + ":" + "\\" + HEBREW_STRING_2 + " abcdef-" + HEBREW_STRING_3 + "\\" + + "xyz" + "\\" + "abcdef" + "\\" + HEBREW_STRING_4 + LRM + "\\" + HEBREW_STRING_5 + "." + "java" + PDF; + private static String PATH_6_RESULT = LRE + "d" + ":" + "\\" + HEBREW_STRING_2 + " abcdef-" + HEBREW_STRING_3 + "\\" + + "xyz" + "\\" + "abcdef" + "\\" + HEBREW_STRING_4 + LRM + "\\" + HEBREW_STRING_5 + LRM + "." + + HEBREW_STRING_6 + PDF; + private static String PATH_7_RESULT = LRE + "d" + ":" + "\\" + HEBREW_STRING_2 + " abcdef-" + HEBREW_STRING_3 + "\\" + + "xyz" + "\\" + "abcdef" + "\\" + HEBREW_STRING_4 + "\\" + "Test" + "." + "java" + PDF; private static String PATH_8_RESULT = LRE + PATH_8 + PDF; private static String PATH_9_RESULT = LRE + PATH_9 + PDF; private static String PATH_10_RESULT = LRE + PATH_10 + PDF; @@ -59,45 +63,65 @@ public static Test suite() { private static String STRING_6_RESULT = LRE + STRING_6 + PDF; private static String STRING_7_RESULT = STRING_7; private static String STRING_8_RESULT = LRE + STRING_8 + PDF; - private static String STRING_9_RESULT = LRE + "d:\\myFolder\\" + HEBREW_STRING_5 + LRM + "\\" + HEBREW_STRING_6 + ".java" + PDF; - private static String STRING_10_RESULT = LRE + "d:\\myFolder\\" + HEBREW_STRING_2 + LRM + "\\123/" + HEBREW_STRING_3 + ".java" + PDF; - private static String STRING_11_RESULT = LRE + "d:\\myFolder\\" + HEBREW_STRING_2 + LRM + "\\123/" + HEBREW_STRING_3 + LRM + "." + HEBREW_STRING_5 + PDF; - private static String STRING_12_RESULT = LRE + "d:\\myFolder\\" + HEBREW_STRING_2 + LRM + "\\123" + HEBREW_STRING_3 + LRM + "." + HEBREW_STRING_6 + PDF; - private static String STRING_13_RESULT = LRE + "d:\\myFolder\\" + HEBREW_STRING_2 + LRM + "\\123/myfile." + HEBREW_STRING_6 + PDF; - private static String STRING_14_RESULT = LRE + "d:\\myFolder\\" + HEBREW_STRING_2 + LRM + "\\123myfile." + HEBREW_STRING_6 + PDF; - private static String STRING_15_RESULT = LRE + "d:\\myFolder\\" + HEBREW_STRING_2 + "12-=" + LRM + "\\<>?34" + HEBREW_STRING_6 + ".java" + PDF; - private static String STRING_16_RESULT = LRE + HEBREW_STRING_2 + LRM + "/" + HEBREW_STRING_6 + LRM + "/" + HEBREW_STRING_4 + LRM + "." + HEBREW_STRING_5 + PDF; - private static String STRING_17_RESULT = LRE + HEBREW_STRING_7 + LRM + "/" + HEBREW_STRING_8 + LRM + "/" + HEBREW_STRING_9 + LRM + "/" + HEBREW_STRING_10 + LRM + "/" + HEBREW_STRING_11 + LRM + "/" + HEBREW_STRING_12 + LRM + "/" + HEBREW_STRING_13 + PDF; - private static String STRING_18_RESULT = LRE + "_" + HEBREW_STRING_2 + " mixed text starts and ends with neutral." + PDF; - private static String STRING_19_RESULT = LRE + "english and " + HEBREW_STRING_2 + " text starts with LTR ends with neutral _" + PDF; - - private static String OTHER_STRING_NO_DELIM = LRE + "\u05ea\u05e9\u05e8\u05e7\u05e6 abcdef-\u05e5\u05e4\u05e3" + PDF; + private static String STRING_9_RESULT = LRE + "d:\\myFolder\\" + HEBREW_STRING_5 + LRM + "\\" + HEBREW_STRING_6 + + ".java" + PDF; + private static String STRING_10_RESULT = LRE + "d:\\myFolder\\" + HEBREW_STRING_2 + LRM + "\\123/" + HEBREW_STRING_3 + + ".java" + PDF; + private static String STRING_11_RESULT = LRE + "d:\\myFolder\\" + HEBREW_STRING_2 + LRM + "\\123/" + HEBREW_STRING_3 + + LRM + "." + HEBREW_STRING_5 + PDF; + private static String STRING_12_RESULT = LRE + "d:\\myFolder\\" + HEBREW_STRING_2 + LRM + "\\123" + HEBREW_STRING_3 + + LRM + "." + HEBREW_STRING_6 + PDF; + private static String STRING_13_RESULT = LRE + "d:\\myFolder\\" + HEBREW_STRING_2 + LRM + "\\123/myfile." + + HEBREW_STRING_6 + PDF; + private static String STRING_14_RESULT = LRE + "d:\\myFolder\\" + HEBREW_STRING_2 + LRM + "\\123myfile." + + HEBREW_STRING_6 + PDF; + private static String STRING_15_RESULT = LRE + "d:\\myFolder\\" + HEBREW_STRING_2 + "12-=" + LRM + "\\<>?34" + + HEBREW_STRING_6 + ".java" + PDF; + private static String STRING_16_RESULT = LRE + HEBREW_STRING_2 + LRM + "/" + HEBREW_STRING_6 + LRM + "/" + + HEBREW_STRING_4 + LRM + "." + HEBREW_STRING_5 + PDF; + private static String STRING_17_RESULT = LRE + HEBREW_STRING_7 + LRM + "/" + HEBREW_STRING_8 + LRM + "/" + + HEBREW_STRING_9 + LRM + "/" + HEBREW_STRING_10 + LRM + "/" + HEBREW_STRING_11 + LRM + "/" + + HEBREW_STRING_12 + LRM + "/" + HEBREW_STRING_13 + PDF; + private static String STRING_18_RESULT = LRE + "_" + HEBREW_STRING_2 + " mixed text starts and ends with neutral." + + PDF; + private static String STRING_19_RESULT = LRE + "english and " + HEBREW_STRING_2 + + " text starts with LTR ends with neutral _" + PDF; + + private static String OTHER_STRING_NO_DELIM = LRE + "\u05ea\u05e9\u05e8\u05e7\u05e6 abcdef-\u05e5\u05e4\u05e3" + + PDF; private static String OTHER_STRING_1_RESULT = LRE + "*" + "." + "java" + PDF; private static String OTHER_STRING_2_RESULT = LRE + "*" + "." + "\u05d0\u05d1\u05d2" + PDF; - private static String OTHER_STRING_3_RESULT = LRE + "\u05d0\u05d1\u05d2 " + LRM + "=" + " \u05ea\u05e9\u05e8\u05e7\u05e6" + PDF; + private static String OTHER_STRING_3_RESULT = LRE + "\u05d0\u05d1\u05d2 " + LRM + "=" + + " \u05ea\u05e9\u05e8\u05e7\u05e6" + PDF; // result strings if null delimiter is passed private static String OTHER_STRING_1_ND_RESULT = LRE + "*" + "." + "java" + PDF; private static String OTHER_STRING_2_ND_RESULT = LRE + "*" + "." + "\u05d0\u05d1\u05d2" + PDF; - private static String OTHER_STRING_3_ND_RESULT = LRE + "\u05d0\u05d1\u05d2 " + "=" + " \u05ea\u05e9\u05e8\u05e7\u05e6" + PDF; + private static String OTHER_STRING_3_ND_RESULT = LRE + "\u05d0\u05d1\u05d2 " + "=" + + " \u05ea\u05e9\u05e8\u05e7\u05e6" + PDF; - private static String[] RESULT_DEFAULT_PATHS = {PATH_1_RESULT, PATH_2_RESULT, PATH_3_RESULT, PATH_4_RESULT, PATH_5_RESULT, PATH_6_RESULT, PATH_7_RESULT, PATH_8_RESULT, PATH_9_RESULT, PATH_10_RESULT, PATH_11_RESULT, PATH_12_RESULT, PATH_13_RESULT}; + private static String[] RESULT_DEFAULT_PATHS = { PATH_1_RESULT, PATH_2_RESULT, PATH_3_RESULT, PATH_4_RESULT, + PATH_5_RESULT, PATH_6_RESULT, PATH_7_RESULT, PATH_8_RESULT, PATH_9_RESULT, PATH_10_RESULT, PATH_11_RESULT, + PATH_12_RESULT, PATH_13_RESULT }; - private static String[] RESULT_ADDITIONAL_STRINGS = {STRING_1_RESULT, STRING_2_RESULT, STRING_3_RESULT, STRING_4_RESULT, STRING_5_RESULT, STRING_6_RESULT, STRING_7_RESULT, STRING_8_RESULT, STRING_9_RESULT, STRING_10_RESULT, STRING_11_RESULT, STRING_12_RESULT, STRING_13_RESULT, STRING_14_RESULT, STRING_15_RESULT, STRING_16_RESULT, STRING_17_RESULT, STRING_18_RESULT, STRING_19_RESULT}; + private static String[] RESULT_ADDITIONAL_STRINGS = { STRING_1_RESULT, STRING_2_RESULT, STRING_3_RESULT, + STRING_4_RESULT, STRING_5_RESULT, STRING_6_RESULT, STRING_7_RESULT, STRING_8_RESULT, STRING_9_RESULT, + STRING_10_RESULT, STRING_11_RESULT, STRING_12_RESULT, STRING_13_RESULT, STRING_14_RESULT, STRING_15_RESULT, + STRING_16_RESULT, STRING_17_RESULT, STRING_18_RESULT, STRING_19_RESULT }; - private static String[] RESULT_STAR_PATHS = {OTHER_STRING_1_RESULT, OTHER_STRING_2_RESULT}; + private static String[] RESULT_STAR_PATHS = { OTHER_STRING_1_RESULT, OTHER_STRING_2_RESULT }; - private static String[] RESULT_EQUALS_PATHS = {OTHER_STRING_3_RESULT}; + private static String[] RESULT_EQUALS_PATHS = { OTHER_STRING_3_RESULT }; - private static String[] RESULT_STAR_PATHS_ND = {OTHER_STRING_1_ND_RESULT, OTHER_STRING_2_ND_RESULT}; + private static String[] RESULT_STAR_PATHS_ND = { OTHER_STRING_1_ND_RESULT, OTHER_STRING_2_ND_RESULT }; - private static String[] RESULT_EQUALS_PATHS_ND = {OTHER_STRING_3_ND_RESULT}; + private static String[] RESULT_EQUALS_PATHS_ND = { OTHER_STRING_3_ND_RESULT }; // whether or not the current platform supports directional characters private static boolean isSupportedPlatform = false; static { String osName = System.getProperty("os.name").toLowerCase(); //$NON-NLS-1$ - if (osName.startsWith("windows") || osName.startsWith("linux") || osName.startsWith("mac")) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + if (osName.startsWith("windows") || osName.startsWith("linux") || osName.startsWith("mac")) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ // Only consider platforms that can support control characters isSupportedPlatform = true; @@ -216,8 +240,8 @@ public void testOtherStringsWithNullDelimiter() { } /* - * Test the result to ensure markers aren't added more than once if the - * string is processed multiple times. + * Test the result to ensure markers aren't added more than once if the string + * is processed multiple times. */ public void testDoubleProcessPaths() { for (int i = 0; i < TEST_DEFAULT_PATHS.length; i++) { @@ -231,8 +255,8 @@ public void testDoubleProcessPaths() { } /* - * Test the result to ensure markers aren't added more than once if the - * string is processed multiple times. + * Test the result to ensure markers aren't added more than once if the string + * is processed multiple times. */ public void testDoubleProcessOtherStrings() { int testNum = 1; @@ -277,11 +301,13 @@ public void testAdditionalStringsDeprocess() { public void testEmptyStringParams() { verifyBidiResult("TextProcessor.process(String) for empty string ", TextProcessor.process(""), EMPTY_STRING); - verifyBidiResult("TextProcessor.process(String, String) for empty strings ", TextProcessor.process("", ""), EMPTY_STRING); + verifyBidiResult("TextProcessor.process(String, String) for empty strings ", TextProcessor.process("", ""), + EMPTY_STRING); } public void testEmptyStringParamsDeprocess() { - verifyBidiResult("TextProcessor.deprocess(String) for empty string ", TextProcessor.deprocess(""), EMPTY_STRING); + verifyBidiResult("TextProcessor.deprocess(String) for empty string ", TextProcessor.deprocess(""), + EMPTY_STRING); } public void testNullParams() { diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/util/LatinTextProcessorTestCase.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/util/LatinTextProcessorTestCase.java index 5edae24c5b6..8d75af9f99e 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/util/LatinTextProcessorTestCase.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/util/LatinTextProcessorTestCase.java @@ -30,7 +30,8 @@ public static Test suite() { protected static String[] ALL_PATHS; static { // merge all test strings into one array for Latin locales - int size = TEST_DEFAULT_PATHS.length + TEST_STAR_PATHS.length + TEST_EQUALS_PATHS.length + TEST_ADDITIONAL_STRINGS.length; + int size = TEST_DEFAULT_PATHS.length + TEST_STAR_PATHS.length + TEST_EQUALS_PATHS.length + + TEST_ADDITIONAL_STRINGS.length; ALL_PATHS = new String[size]; int idx = 0; for (String testDefaultPath : TEST_DEFAULT_PATHS) { @@ -68,7 +69,7 @@ public void testLatinPaths() { } } - public void testLatinPathsDeprocess(){ + public void testLatinPathsDeprocess() { // test all strings using process(String) method for (int i = 0; i < ALL_PATHS.length; i++) { String result = TextProcessor.process(ALL_PATHS[i]); @@ -127,7 +128,8 @@ public void testLatinOtherStringsWithNoDelimiter() { public void testEmptyStringParams() { verifyResult("TextProcessor.process(String) for empty string ", TextProcessor.process(""), EMPTY_STRING); - verifyResult("TextProcessor.process(String, String) for empty strings ", TextProcessor.process("", ""), EMPTY_STRING); + verifyResult("TextProcessor.process(String, String) for empty strings ", TextProcessor.process("", ""), + EMPTY_STRING); } public void testEmptyStringParamsDeprocess() { diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/util/ObjectPoolTestCase.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/util/ObjectPoolTestCase.java index ea90207633b..4c9a6947d18 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/util/ObjectPoolTestCase.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/util/ObjectPoolTestCase.java @@ -25,7 +25,8 @@ public void testObjectPool01() { // Tests ObjectPool with strings only List objects = new ArrayList(); int num = 2000; - // new objects are added to the object pool; interning should add the object to the pool and return the same object + // new objects are added to the object pool; interning should add the object to + // the pool and return the same object for (int i = 0; i < num; i++) { String test1 = getName() + "_" + i; //$NON-NLS-1$ String test2 = ObjectPool.intern(test1); @@ -33,7 +34,8 @@ public void testObjectPool01() { objects.add(test2); } doGC(); - // after doing a GC the interned objects should still be in the pool; interning a duplicate should return the objects that were added above + // after doing a GC the interned objects should still be in the pool; interning + // a duplicate should return the objects that were added above for (int i = 0; i < num; i++) { String test1 = getName() + "_" + i; //$NON-NLS-1$ String test2 = ObjectPool.intern(test1); @@ -43,7 +45,8 @@ public void testObjectPool01() { // clear the hard references to the interned objects objects.clear(); doGC(); - // after doing a GC the interned objects should have been removed from the object pool + // after doing a GC the interned objects should have been removed from the + // object pool for (int i = 0; i < num; i++) { String test1 = getName() + "_" + i; //$NON-NLS-1$ String test2 = ObjectPool.intern(test1); @@ -60,7 +63,8 @@ public void testObjectPool02() { List strings = new ArrayList(); List versions = new ArrayList(); int num = 2000; - // new objects are added to the object pool; interning should add the object to the pool and return the same object + // new objects are added to the object pool; interning should add the object to + // the pool and return the same object for (int i = 0; i < num; i++) { String testString1 = getName() + "_" + i; //$NON-NLS-1$ String testString2 = ObjectPool.intern(testString1); @@ -72,7 +76,8 @@ public void testObjectPool02() { versions.add(testVersion2); } doGC(); - // after doing a GC the interned objects should still be in the pool; interning a duplicate should return the objects that were added above + // after doing a GC the interned objects should still be in the pool; interning + // a duplicate should return the objects that were added above for (int i = 0; i < num; i++) { String testString1 = getName() + "_" + i; //$NON-NLS-1$ String testString2 = ObjectPool.intern(testString1); @@ -86,7 +91,8 @@ public void testObjectPool02() { // clear the hard references to the interned objects strings.clear(); versions.clear(); - // after doing a GC the interned objects should have been removed from the object pool + // after doing a GC the interned objects should have been removed from the + // object pool doGC(); for (int i = 0; i < num; i++) { String testString1 = getName() + "_" + i; //$NON-NLS-1$ @@ -105,7 +111,8 @@ public void testObjectPool02() { } private static void doGC() { - // We go through great effort to force the VM to throw our weakly referenced objects away. + // We go through great effort to force the VM to throw our weakly referenced + // objects away. System.gc(); System.runFinalization(); System.gc(); diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/util/TestCaseinsensitiveMap.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/util/TestCaseinsensitiveMap.java index 72891a41dcd..35d7a3669a3 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/util/TestCaseinsensitiveMap.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/util/TestCaseinsensitiveMap.java @@ -62,7 +62,7 @@ public class TestCaseinsensitiveMap extends CoreTest { Constants.PROVIDE_CAPABILITY // }; - String[] OTHER_KEY_NAMES = new String[] {"test.key0", // + String[] OTHER_KEY_NAMES = new String[] { "test.key0", // "test.key1", // "test.key2", // "test.key3", // diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/util/TextProcessorSessionTest.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/util/TextProcessorSessionTest.java index eddb4d1efa5..2eec44bc6de 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/util/TextProcessorSessionTest.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/util/TextProcessorSessionTest.java @@ -23,8 +23,9 @@ public class TextProcessorSessionTest extends ConfigurationSessionTestSuite { /** * Create a session test for the given class. + * * @param pluginId tests plugin id - * @param clazz the test class to run + * @param clazz the test class to run * @param language the language to run the tests under (the -nl parameter value) */ public TextProcessorSessionTest(String pluginId, Class clazz, String language) { @@ -33,7 +34,9 @@ public TextProcessorSessionTest(String pluginId, Class clazz, String language) { OSGiTest.addRequiredOSGiTestsBundles(this); } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see org.eclipse.core.tests.session.SessionTestSuite#newSetup() */ protected Setup newSetup() throws SetupException { diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/util/TextProcessorTestCase.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/util/TextProcessorTestCase.java index 685b5376712..56de6ed7d22 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/util/TextProcessorTestCase.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/util/TextProcessorTestCase.java @@ -40,11 +40,16 @@ public abstract class TextProcessorTestCase extends TestCase { // paths protected static String PATH_1 = "d:\\test\\" + HEBREW_STRING_1 + "\\segment"; protected static String PATH_2 = "\\test\\" + HEBREW_STRING_1 + "\\segment"; - protected static String PATH_3 = "d:\\" + HEBREW_STRING_2 + " abcdef-" + HEBREW_STRING_3 + "\\xyz\\abcdef\\" + HEBREW_STRING_4; - protected static String PATH_4 = "\\" + HEBREW_STRING_2 + " abcdef-" + HEBREW_STRING_3 + "\\xyz\\abcdef\\" + HEBREW_STRING_4; - protected static String PATH_5 = "d:\\" + HEBREW_STRING_2 + " abcdef-" + HEBREW_STRING_3 + "\\xyz\\abcdef\\" + HEBREW_STRING_4 + "\\" + HEBREW_STRING_5 + ".java"; - protected static String PATH_6 = "d:\\" + HEBREW_STRING_2 + " abcdef-" + HEBREW_STRING_3 + "\\xyz\\abcdef\\" + HEBREW_STRING_4 + "\\" + HEBREW_STRING_5 + "." + HEBREW_STRING_6; - protected static String PATH_7 = "d:\\" + HEBREW_STRING_2 + " abcdef-" + HEBREW_STRING_3 + "\\xyz\\abcdef\\" + HEBREW_STRING_4 + "\\Test.java"; + protected static String PATH_3 = "d:\\" + HEBREW_STRING_2 + " abcdef-" + HEBREW_STRING_3 + "\\xyz\\abcdef\\" + + HEBREW_STRING_4; + protected static String PATH_4 = "\\" + HEBREW_STRING_2 + " abcdef-" + HEBREW_STRING_3 + "\\xyz\\abcdef\\" + + HEBREW_STRING_4; + protected static String PATH_5 = "d:\\" + HEBREW_STRING_2 + " abcdef-" + HEBREW_STRING_3 + "\\xyz\\abcdef\\" + + HEBREW_STRING_4 + "\\" + HEBREW_STRING_5 + ".java"; + protected static String PATH_6 = "d:\\" + HEBREW_STRING_2 + " abcdef-" + HEBREW_STRING_3 + "\\xyz\\abcdef\\" + + HEBREW_STRING_4 + "\\" + HEBREW_STRING_5 + "." + HEBREW_STRING_6; + protected static String PATH_7 = "d:\\" + HEBREW_STRING_2 + " abcdef-" + HEBREW_STRING_3 + "\\xyz\\abcdef\\" + + HEBREW_STRING_4 + "\\Test.java"; protected static String PATH_8 = "\\test\\jkl" + HEBREW_STRING_1 + "\\segment"; protected static String PATH_9 = "\\test\\" + HEBREW_STRING_1 + "jkl\\segment"; protected static String PATH_10 = "d:\\t\\" + HEBREW_STRING_7 + "\\segment"; @@ -62,13 +67,17 @@ public abstract class TextProcessorTestCase extends TestCase { protected static String STRING_8 = "==>"; protected static String STRING_9 = "d:\\myFolder\\" + HEBREW_STRING_5 + "\\" + HEBREW_STRING_6 + ".java"; protected static String STRING_10 = "d:\\myFolder\\" + HEBREW_STRING_2 + "\\123/" + HEBREW_STRING_3 + ".java"; - protected static String STRING_11 = "d:\\myFolder\\" + HEBREW_STRING_2 + "\\123/" + HEBREW_STRING_3 + "." + HEBREW_STRING_5; - protected static String STRING_12 = "d:\\myFolder\\" + HEBREW_STRING_2 + "\\123" + HEBREW_STRING_3 + "." + HEBREW_STRING_6; + protected static String STRING_11 = "d:\\myFolder\\" + HEBREW_STRING_2 + "\\123/" + HEBREW_STRING_3 + "." + + HEBREW_STRING_5; + protected static String STRING_12 = "d:\\myFolder\\" + HEBREW_STRING_2 + "\\123" + HEBREW_STRING_3 + "." + + HEBREW_STRING_6; protected static String STRING_13 = "d:\\myFolder\\" + HEBREW_STRING_2 + "\\123/myfile." + HEBREW_STRING_6; protected static String STRING_14 = "d:\\myFolder\\" + HEBREW_STRING_2 + "\\123myfile." + HEBREW_STRING_6; - protected static String STRING_15= "d:\\myFolder\\" + HEBREW_STRING_2 + "12-=\\<>?34" + HEBREW_STRING_6 + ".java"; - protected static String STRING_16 = HEBREW_STRING_2 + "/" + HEBREW_STRING_6 + "/" + HEBREW_STRING_4 + "." + HEBREW_STRING_5; - protected static String STRING_17 = HEBREW_STRING_7 + "/" + HEBREW_STRING_8 + "/" + HEBREW_STRING_9 + "/" + HEBREW_STRING_10 + "/" +HEBREW_STRING_11 + "/" + HEBREW_STRING_12 + "/" + HEBREW_STRING_13; + protected static String STRING_15 = "d:\\myFolder\\" + HEBREW_STRING_2 + "12-=\\<>?34" + HEBREW_STRING_6 + ".java"; + protected static String STRING_16 = HEBREW_STRING_2 + "/" + HEBREW_STRING_6 + "/" + HEBREW_STRING_4 + "." + + HEBREW_STRING_5; + protected static String STRING_17 = HEBREW_STRING_7 + "/" + HEBREW_STRING_8 + "/" + HEBREW_STRING_9 + "/" + + HEBREW_STRING_10 + "/" + HEBREW_STRING_11 + "/" + HEBREW_STRING_12 + "/" + HEBREW_STRING_13; protected static String STRING_18 = "_" + HEBREW_STRING_2 + " mixed text starts and ends with neutral."; protected static String STRING_19 = "english and " + HEBREW_STRING_2 + " text starts with LTR ends with neutral _"; @@ -79,16 +88,14 @@ public abstract class TextProcessorTestCase extends TestCase { protected static String EMPTY_STRING = ""; - protected static String[] TEST_DEFAULT_PATHS = { PATH_1, PATH_2, PATH_3, - PATH_4, PATH_5, PATH_6, PATH_7, PATH_8, PATH_9 }; + protected static String[] TEST_DEFAULT_PATHS = { PATH_1, PATH_2, PATH_3, PATH_4, PATH_5, PATH_6, PATH_7, PATH_8, + PATH_9 }; - protected static String[] TEST_ADDITIONAL_STRINGS = { STRING_1, STRING_2, - STRING_3, STRING_4, STRING_5, STRING_6, STRING_7, STRING_8, - STRING_9, STRING_10, STRING_11, STRING_12, STRING_13, STRING_14, - STRING_15, STRING_16, STRING_17, STRING_18, STRING_19 }; + protected static String[] TEST_ADDITIONAL_STRINGS = { STRING_1, STRING_2, STRING_3, STRING_4, STRING_5, STRING_6, + STRING_7, STRING_8, STRING_9, STRING_10, STRING_11, STRING_12, STRING_13, STRING_14, STRING_15, STRING_16, + STRING_17, STRING_18, STRING_19 }; - protected static String[] TEST_STAR_PATHS = { OTHER_STRING_1, - OTHER_STRING_2 }; + protected static String[] TEST_STAR_PATHS = { OTHER_STRING_1, OTHER_STRING_2 }; protected static String[] TEST_EQUALS_PATHS = { OTHER_STRING_3 }; @@ -101,7 +108,7 @@ public TextProcessorTestCase(String name) { super(name); } - protected void verifyResult(String testName, String expected, String result){ + protected void verifyResult(String testName, String expected, String result) { assertTrue(testName + " result string is not the same as string passed in.", result.equals(expected)); }