use of org.eclipse.osgi.service.resolver.State in project rt.equinox.framework by eclipse.
the class TestVersion_001 method testTest_001.
public void testTest_001() {
State state = buildEmptyState();
StateObjectFactory sof = StateObjectFactory.defaultFactory;
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());
return;
}
checkBundlesResolved_a();
checkWiring_a();
}
use of org.eclipse.osgi.service.resolver.State in project rt.equinox.framework by eclipse.
the class TestVersion_003 method testTest_003.
public void testTest_003() {
State state = buildEmptyState();
StateObjectFactory sof = StateObjectFactory.defaultFactory;
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());
return;
}
checkBundlesResolved_a();
checkWiring_a();
}
use of org.eclipse.osgi.service.resolver.State in project rt.equinox.framework by eclipse.
the class DevModeTest method buildDevModeState.
private State buildDevModeState() {
State state = buildEmptyState();
Dictionary[] props = new Dictionary[] { new Hashtable() };
props[0].put("osgi.resolverMode", "development");
state.setPlatformProperties(props);
return state;
}
use of org.eclipse.osgi.service.resolver.State in project rt.equinox.framework by eclipse.
the class DevModeTest method testDevModeGenericCapability.
public void testDevModeGenericCapability() throws BundleException {
State state = buildDevModeState();
int bundleID = 0;
Hashtable manifest = new Hashtable();
manifest.clear();
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++);
state.addBundle(a);
state.resolve();
// a can't be resolved since its required capability is not provided
assertFalse("0.1", a.isResolved());
manifest.clear();
manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2");
manifest.put(Constants.BUNDLE_SYMBOLICNAME, "B; singleton:=true");
manifest.put(Constants.BUNDLE_VERSION, "1.0");
manifest.put(Constants.PROVIDE_CAPABILITY, "osgi.service; objectClass:List<String>=\"foo.Bar\"");
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();
// with bundle B, A is resolvable now
assertTrue("0.2", a.isResolved());
}
use of org.eclipse.osgi.service.resolver.State in project rt.equinox.framework by eclipse.
the class StateResolverTest method testMultipleExportsUses01.
public void testMultipleExportsUses01() throws BundleException {
State state = buildEmptyState();
Hashtable manifest = new Hashtable();
// $NON-NLS-1$
manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2");
// $NON-NLS-1$
manifest.put(Constants.BUNDLE_SYMBOLICNAME, "A1");
// $NON-NLS-1$
manifest.put(Constants.BUNDLE_VERSION, "1.0.0");
// $NON-NLS-1$
manifest.put(Constants.EXPORT_PACKAGE, "a; version=2.0; uses:=d, d; version=2.0");
// $NON-NLS-1$
BundleDescription a1_100 = state.getFactory().createBundleDescription(state, manifest, "a1_100", 0);
manifest = new Hashtable();
// $NON-NLS-1$
manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2");
// $NON-NLS-1$
manifest.put(Constants.BUNDLE_SYMBOLICNAME, "A2");
// $NON-NLS-1$
manifest.put(Constants.BUNDLE_VERSION, "1.0.0");
// $NON-NLS-1$
manifest.put(Constants.EXPORT_PACKAGE, "a; version=1.0; uses:=d, d; version=1.0");
// $NON-NLS-1$
BundleDescription a2_100 = state.getFactory().createBundleDescription(state, manifest, "a2_100", 1);
manifest = new Hashtable();
// $NON-NLS-1$
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.EXPORT_PACKAGE, "b, b; mandatory:=\"test\"; test=value; uses:=d");
// $NON-NLS-1$
manifest.put(Constants.IMPORT_PACKAGE, "a;bundle-symbolic-name=A2, d");
// $NON-NLS-1$
BundleDescription b1_100 = state.getFactory().createBundleDescription(state, manifest, "b1_100", 2);
manifest = new Hashtable();
// $NON-NLS-1$
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; uses:=b");
// $NON-NLS-1$
manifest.put(Constants.IMPORT_PACKAGE, "b; test=value, d");
// $NON-NLS-1$
BundleDescription c1_100 = state.getFactory().createBundleDescription(state, manifest, "c1_100", 3);
manifest = new Hashtable();
// $NON-NLS-1$
manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2");
// $NON-NLS-1$
manifest.put(Constants.BUNDLE_SYMBOLICNAME, "D1");
// $NON-NLS-1$
manifest.put(Constants.BUNDLE_VERSION, "1.0.0");
// $NON-NLS-1$
manifest.put(Constants.IMPORT_PACKAGE, "a, c, d");
// $NON-NLS-1$
BundleDescription d1_100 = state.getFactory().createBundleDescription(state, manifest, "d1_100", 4);
state.addBundle(a1_100);
state.addBundle(a2_100);
state.addBundle(b1_100);
state.addBundle(c1_100);
state.addBundle(d1_100);
state.resolve();
ExportPackageDescription[] b1ResolvedImports = b1_100.getResolvedImports();
ExportPackageDescription[] d1ResolvedImports = d1_100.getResolvedImports();
ExportPackageDescription[] isConsistent = isConsistent(b1ResolvedImports, d1ResolvedImports);
// $NON-NLS-1$
assertNull("1.1 Packages are not consistent: " + isConsistent, isConsistent);
manifest = new Hashtable();
// $NON-NLS-1$
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.EXPORT_PACKAGE, "b; uses:=a");
// $NON-NLS-1$
manifest.put(Constants.IMPORT_PACKAGE, "a;bundle-symbolic-name=A1");
// $NON-NLS-1$
b1_100 = state.getFactory().createBundleDescription(state, manifest, "b1_100", 2);
state.updateBundle(b1_100);
state.resolve();
b1ResolvedImports = b1_100.getResolvedImports();
d1ResolvedImports = d1_100.getResolvedImports();
isConsistent = isConsistent(b1ResolvedImports, d1ResolvedImports);
// $NON-NLS-1$
assertNull("1.2 Packages are not consistent: " + isConsistent, isConsistent);
}
Aggregations