use of org.eclipse.osgi.service.resolver.StateDelta in project rt.equinox.framework by eclipse.
the class StateResolverTest method testBug187616.
public void testBug187616() throws BundleException {
State state = buildEmptyState();
Hashtable manifest = new Hashtable();
long bundleID = 0;
// $NON-NLS-1$
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++);
manifest = new Hashtable();
// $NON-NLS-1$
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++);
manifest = new Hashtable();
// $NON-NLS-1$
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++);
manifest = new Hashtable();
// $NON-NLS-1$
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++);
manifest = new Hashtable();
// $NON-NLS-1$
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++);
state.addBundle(testHost100);
state.addBundle(testFrag100);
state.addBundle(testHost101);
state.addBundle(testFrag101);
state.addBundle(testDependent);
StateDelta stateDelta = state.resolve();
// $NON-NLS-1$
assertFalse("1.0", testHost100.isResolved());
// $NON-NLS-1$
assertTrue("1.1", testHost101.isResolved());
// $NON-NLS-1$
assertFalse("1.2", testFrag100.isResolved());
// $NON-NLS-1$
assertTrue("1.3", testFrag101.isResolved());
// $NON-NLS-1$
assertTrue("1.4", testDependent.isResolved());
BundleDelta[] bDelta = stateDelta.getChanges(BundleDelta.ADDED | BundleDelta.RESOLVED, false);
// $NON-NLS-1$
assertTrue("2.0", bDelta.length == 5);
}
Aggregations