Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 383361

Summary: Framework does not wire multiple providers for namespace w/ cardinality:=multiple
Product: [Eclipse Project] Equinox Reporter: Tim Diekmann <tdiekman>
Component: FrameworkAssignee: equinox.framework-inbox <equinox.framework-inbox>
Status: CLOSED DUPLICATE QA Contact:
Severity: major    
Priority: P3 CC: tjwatson
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:

Description Tim Diekmann CLA 2012-06-22 19:36:57 EDT
Build Identifier: 3.8.0.v20120529-1548

The Equinox RI for R5 core does not properly wire client and provider bundles for namespaces using the cardinality:=multiple directive.

In the CT for ServiceLoader (ServiceLoaderServiceClientTest) two provider bundles of the osgi.serviceloader namespace are installed and wired to the ServiceLoader mediator implementation.

Provider 1:
Provide-Capability: \
 osgi.serviceloader;\
 uses:="org.osgi.test.cases.serviceloader.spi";\
 provider="CT";\
 type="one";\
 osgi.serviceloader="org.osgi.test.cases.serviceloader.spi.ColorProvider"

Provider 2:
Provide-Capability: \
 osgi.serviceloader;\
 uses:="org.osgi.test.cases.serviceloader.spi";\
 provider="CT";\
 type="two";\
 osgi.serviceloader="org.osgi.test.cases.serviceloader.spi.ColorProvider"

The client bundle declares a filter according to section 133.3.3 of the spec:
Require-Capability: \
 osgi.extender;filter:="(osgi.extender=osgi.serviceloader.processor)",\
 osgi.serviceloader; filter:="(osgi.serviceloader=org.osgi.test.cases.serviceloader.spi.ColorProvider)";cardinality:=multiple

The expectation is that the client bundle is wired to both providers at runtime, but the test case shows that it is only wired to the first provider:

    				BundleRevision rev = client.adapt(BundleRevision.class);
    				List<BundleWire> wires = rev.getWiring().getRequiredWires("osgi.extender");
    				assertNotNull(wires);
    				assertEquals("expecting exactly one mediator wired", 1, wires.size());
    				
    				wires = rev.getWiring().getRequiredWires("osgi.serviceloader");
    				assertNotNull(wires);
    				assertEquals("expecting 2 providers to be wired", 2, wires.size());

Maybe my declaration is wrong, but I don't see how.

Reproducible: Always

Steps to Reproduce:
1. Obtain eeg/serviceloader branch from OSGi build
2. run ServiceLoaderServiceClientTest
3. take a look at result of testServiceClientWithFilter
Comment 1 Thomas Watson CLA 2012-06-25 08:25:47 EDT

*** This bug has been marked as a duplicate of bug 358923 ***