Hello,

I am trying to understand how the R5 resolver works with bundles which
export and import the same package
(e.g. as felix bundles that implement OSGi enterprise/compendium services do).

So I found the org.apache.felix.resolver.test.Main class and added a
couple of my own scenarios:

scenario 6:

    private static List<Resource> populateScenario6(
            Map<Resource, Wiring> wirings, Map<Requirement,
List<Capability>> candMap)
    {
        wirings.clear();
        candMap.clear();

        ResourceImpl a = new ResourceImpl("A");
        a.addCapability(new PackageCapability(a, "A"));
        a.addRequirement(new PackageRequirement(a, "A"));

        ResourceImpl b = new ResourceImpl("B");
        b.addCapability(new PackageCapability(b, "A"));

        List<Capability> capabilityList = new ArrayList<Capability>(2);
        
capabilityList.addAll(a.getCapabilities(PackageNamespace.PACKAGE_NAMESPACE));
        
capabilityList.addAll(b.getCapabilities(PackageNamespace.PACKAGE_NAMESPACE));

        candMap.put(a.getRequirements(null).get(0),
                        capabilityList);
        List<Resource> resources = new ArrayList<Resource>();
        resources.add(a);
        return resources;
    }

scenario 7 - same as scenario 6 but with the adds to the capability
list reversed. i.e.:

        
capabilityList.addAll(b.getCapabilities(PackageNamespace.PACKAGE_NAMESPACE));
        
capabilityList.addAll(a.getCapabilities(PackageNamespace.PACKAGE_NAMESPACE));

I would have expected that both scenario 6 and 7 would give me the
same result (i.e. only resource A
is required to satisfy the requirements). Instead it appears that the
result is dependent on the capability
list add order:

SCENARIO 6

RESULT {osgi.identity; A=[]}

SCENARIO 7

RESULT {osgi.identity; A=[osgi.wiring.package; (osgi.wiring.package=A)
-> [osgi.identity; B]], osgi.identity; B=[]}

This is not correct behaviour, is it? Let me know if I am missing
something obvious here. Note that I have opened a
corresponding issue on the bnd/bndtools project which uses the R5 resolver:

https://github.com/bndtools/bnd/issues/284

Just wanting to confirm that this is incorrect behaviour by the
resolver. If it is I will open a JIRA.

thanks in advance,
Gareth

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to