use of org.eclipse.osgi.tests.container.dummys.DummyContainerAdaptor in project rt.equinox.framework by eclipse.
the class TestModuleContainer method testDynamicImport05.
@Test
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);
container.resolve(Arrays.asList(systemBundle), true);
Module c1 = installDummyModule("c1_v1.MF", "c1_v1", container);
Module c4 = installDummyModule("c4_v1.MF", "c4_v1", container);
Module dynamic3 = installDummyModule("dynamic3_v1.MF", "dynamic3_v1", container);
Module dynamic3Frag = installDummyModule("dynamic3.frag_v1.MF", "dynamic3.frag_v1", container);
container.resolve(Arrays.asList(c1, c4, dynamic3, dynamic3Frag), true);
ModuleWire dynamicWire = container.resolveDynamic("c4.a", dynamic3.getCurrentRevision());
Assert.assertNotNull("No dynamic wire found.", dynamicWire);
Assert.assertEquals("Wrong package found.", "c4.a", dynamicWire.getCapability().getAttributes().get(PackageNamespace.PACKAGE_NAMESPACE));
Assert.assertEquals("Wrong provider for the wire found.", c4.getCurrentRevision(), dynamicWire.getProvider());
dynamicWire = container.resolveDynamic("c4.b", dynamic3.getCurrentRevision());
Assert.assertNotNull("No dynamic wire found.", dynamicWire);
Assert.assertEquals("Wrong package found.", "c4.b", dynamicWire.getCapability().getAttributes().get(PackageNamespace.PACKAGE_NAMESPACE));
Assert.assertEquals("Wrong provider for the wire found.", c4.getCurrentRevision(), dynamicWire.getProvider());
}
use of org.eclipse.osgi.tests.container.dummys.DummyContainerAdaptor in project rt.equinox.framework by eclipse.
the class TestModuleContainer method testSubstitutionWithMoreThan2Providers.
@Test
public void testSubstitutionWithMoreThan2Providers() throws BundleException, IOException {
DummyContainerAdaptor adaptor = createDummyAdaptor();
ModuleContainer container = adaptor.getContainer();
Module systemBundle = installDummyModule(//
"system.bundle.MF", //
Constants.SYSTEM_BUNDLE_LOCATION, //
Constants.SYSTEM_BUNDLE_SYMBOLICNAME, //
"javax.crypto, javax.crypto.spec, javax.net, javax.net.ssl, javax.security.auth.x500, org.ietf.jgss", //
"osgi.ee; osgi.ee=JavaSE; version:List<Version>=\"1.3, 1.4, 1.5, 1.6, 1.7\"", container);
ResolutionReport report = container.resolve(Arrays.asList(systemBundle), true);
Assert.assertNull("Failed to resolve test.", report.getResolutionException());
List<Module> modules = new ArrayList<Module>();
for (String manifest : HTTPCOMPS_AND_EATHER) {
modules.add(installDummyModule(manifest, manifest, container));
}
report = container.resolve(modules, true);
Assert.assertNull("Failed to resolve test.", report.getResolutionException());
}
use of org.eclipse.osgi.tests.container.dummys.DummyContainerAdaptor in project rt.equinox.framework by eclipse.
the class TestModuleContainer method testResolveInstallBundles.
// Disabled @Test
public void testResolveInstallBundles() throws BundleException, IOException {
setupModuleDatabase();
DummyContainerAdaptor adaptor = createDummyAdaptor();
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
resolvedModuleDatabase.store(new DataOutputStream(bytes), false);
bytes.close();
adaptor.getDatabase().load(new DataInputStream(new ByteArrayInputStream(bytes.toByteArray())));
adaptor.getContainer().resolve(new ArrayList<Module>(), false);
}
use of org.eclipse.osgi.tests.container.dummys.DummyContainerAdaptor in project rt.equinox.framework by eclipse.
the class TestModuleContainer method testSubstitutableExports02.
@Test
public void testSubstitutableExports02() throws BundleException, IOException {
DummyContainerAdaptor adaptor = createDummyAdaptor();
ModuleContainer container = adaptor.getContainer();
Module a = installDummyModule("sub.a.MF", "a", container);
Module b = installDummyModule("sub.b.MF", "b", container);
Module c = installDummyModule("sub.c.MF", "c", container);
container.resolve(Arrays.asList(a, b, c), true);
ModuleWiring wiringA = a.getCurrentRevision().getWiring();
ModuleWiring wiringB = b.getCurrentRevision().getWiring();
ModuleWiring wiringC = c.getCurrentRevision().getWiring();
List<ModuleWire> providedWiresA = wiringA.getProvidedModuleWires(PackageNamespace.PACKAGE_NAMESPACE);
Assert.assertEquals("Wrong number of provided wires.", 2, providedWiresA.size());
Collection<ModuleRevision> requirers = new ArrayList<ModuleRevision>();
for (ModuleWire wire : providedWiresA) {
requirers.add(wire.getRequirer());
}
Assert.assertTrue("b does not require.", requirers.contains(b.getCurrentRevision()));
Assert.assertTrue("c does not require.", requirers.contains(c.getCurrentRevision()));
List<ModuleWire> requiredWiresB = wiringB.getRequiredModuleWires(PackageNamespace.PACKAGE_NAMESPACE);
Assert.assertEquals("Wrong number of required wires.", 1, requiredWiresB.size());
Assert.assertEquals("Unexpected package name.", "javax.servlet", requiredWiresB.iterator().next().getCapability().getAttributes().get(PackageNamespace.PACKAGE_NAMESPACE));
Assert.assertEquals("Wrong provider.", a.getCurrentRevision(), requiredWiresB.iterator().next().getProvider());
List<ModuleWire> requiredWiresC = wiringC.getRequiredModuleWires(PackageNamespace.PACKAGE_NAMESPACE);
Assert.assertEquals("Wrong number of required wires.", 1, requiredWiresC.size());
Assert.assertEquals("Wrong number of required wires.", 1, requiredWiresC.size());
Assert.assertEquals("Unexpected package name.", "javax.servlet", requiredWiresC.iterator().next().getCapability().getAttributes().get(PackageNamespace.PACKAGE_NAMESPACE));
Assert.assertEquals("Wrong provider.", a.getCurrentRevision(), requiredWiresC.iterator().next().getProvider());
Module d = installDummyModule("sub.d.MF", "d", container);
container.resolve(Arrays.asList(d), true);
ModuleWiring wiringD = d.getCurrentRevision().getWiring();
List<ModuleWire> requiredWiresD = wiringD.getRequiredModuleWires(PackageNamespace.PACKAGE_NAMESPACE);
Assert.assertEquals("Wrong number of required wires.", 2, requiredWiresD.size());
Assert.assertEquals("Unexpected package name.", "org.ops4j.pax.web.service", requiredWiresD.get(0).getCapability().getAttributes().get(PackageNamespace.PACKAGE_NAMESPACE));
Assert.assertEquals("Wrong provider.", c.getCurrentRevision(), requiredWiresD.get(0).getProvider());
Assert.assertEquals("Unexpected package name.", "javax.servlet", requiredWiresD.get(1).getCapability().getAttributes().get(PackageNamespace.PACKAGE_NAMESPACE));
Assert.assertEquals("Wrong provider.", a.getCurrentRevision(), requiredWiresD.get(1).getProvider());
}
use of org.eclipse.osgi.tests.container.dummys.DummyContainerAdaptor in project rt.equinox.framework by eclipse.
the class TestModuleContainer method testRequireBundleUses.
@Test
public void testRequireBundleUses() throws BundleException, IOException {
DummyContainerAdaptor adaptor = createDummyAdaptor();
ModuleContainer container = adaptor.getContainer();
Module systemBundle = installDummyModule("system.bundle.MF", Constants.SYSTEM_BUNDLE_LOCATION, container);
container.resolve(Arrays.asList(systemBundle), true);
Module b1 = installDummyModule("require.b1.MF", "b1", container);
installDummyModule("require.b2.MF", "b2", container);
installDummyModule("require.b3.MF", "b3", container);
installDummyModule("require.b4.MF", "b4", container);
container.resolve(null, false);
Assert.assertEquals("b1 should not resolve.", State.INSTALLED, b1.getState());
}
Aggregations