use of org.apache.felix.resolver.test.util.PackageRequirement in project felix by apache.
the class ResolverTest method populateScenario3.
private static List<Resource> populateScenario3(Map<Resource, Wiring> wirings, Map<Requirement, List<Capability>> candMap) {
List<Capability> dResourcesCands = new ArrayList<Capability>();
List<Capability> eBundleDCands = new ArrayList<Capability>();
List<Capability> eResourcesCands = new ArrayList<Capability>();
// B
ResourceImpl b = new ResourceImpl("B");
PackageCapability pc = new PackageCapability(b, "resources");
b.addCapability(pc);
eResourcesCands.add(pc);
// C
ResourceImpl c = new ResourceImpl("C");
pc = new PackageCapability(c, "resources");
c.addCapability(pc);
eResourcesCands.add(pc);
dResourcesCands.add(pc);
// D
ResourceImpl d = new ResourceImpl("D");
pc = new PackageCapability(d, "export");
pc.addDirective(Namespace.CAPABILITY_USES_DIRECTIVE, "resources");
d.addCapability(pc);
BundleCapability bc = new BundleCapability(d, "D");
bc.addDirective(Namespace.CAPABILITY_USES_DIRECTIVE, "resources");
d.addCapability(bc);
eBundleDCands.add(bc);
Requirement r = new PackageRequirement(d, "resources");
d.addRequirement(r);
candMap.put(r, dResourcesCands);
// E
ResourceImpl e = new ResourceImpl("E");
r = new BundleRequirement(e, "D");
e.addRequirement(r);
candMap.put(r, eBundleDCands);
r = new PackageRequirement(e, "resources");
e.addRequirement(r);
candMap.put(r, eResourcesCands);
// Mandatory resources
List<Resource> resources = new ArrayList<Resource>();
resources.add(e);
return resources;
}
use of org.apache.felix.resolver.test.util.PackageRequirement in project felix by apache.
the class ResolverTest method populateScenario2.
private static List<Resource> populateScenario2(Map<Resource, Wiring> wirings, Map<Requirement, List<Capability>> candMap) {
List<Capability> fooCands = new ArrayList<Capability>();
List<Capability> barCands = new ArrayList<Capability>();
// A
ResourceImpl a = new ResourceImpl("A");
PackageCapability p = new PackageCapability(a, "foo");
a.addCapability(p);
fooCands.add(p);
// B
ResourceImpl b = new ResourceImpl("B");
p = new PackageCapability(b, "foo");
b.addCapability(p);
fooCands.add(p);
p = new PackageCapability(b, "bar");
p.addDirective(PackageNamespace.CAPABILITY_USES_DIRECTIVE, "foo");
b.addCapability(p);
barCands.add(p);
// C
ResourceImpl c = new ResourceImpl("C");
Requirement r = new PackageRequirement(c, "foo");
c.addRequirement(r);
candMap.put(r, fooCands);
r = new PackageRequirement(c, "bar");
c.addRequirement(r);
candMap.put(r, barCands);
// Mandatory resources
List<Resource> resources = new ArrayList<Resource>();
resources.add(c);
return resources;
}
use of org.apache.felix.resolver.test.util.PackageRequirement in project felix by apache.
the class ResolverTest method populateScenario1.
private static List<Resource> populateScenario1(Map<Resource, Wiring> wirings, Map<Requirement, List<Capability>> candMap) {
ResourceImpl exporter = new ResourceImpl("A");
exporter.addCapability(new PackageCapability(exporter, "foo"));
ResourceImpl importer = new ResourceImpl("B");
importer.addRequirement(new PackageRequirement(importer, "foo"));
candMap.put(importer.getRequirements(null).get(0), exporter.getCapabilities(PackageNamespace.PACKAGE_NAMESPACE));
List<Resource> resources = new ArrayList<Resource>();
resources.add(importer);
return resources;
}
Aggregations