use of org.apache.felix.resolver.test.util.GenericRequirement in project felix by apache.
the class ResolverTest method populateScenario7.
private static List<Resource> populateScenario7(Map<Resource, Wiring> wirings, Map<Requirement, List<Capability>> candMap) {
ResourceImpl a1 = new ResourceImpl("A");
GenericCapability a1_hostCap = new GenericCapability(a1, HostNamespace.HOST_NAMESPACE);
a1_hostCap.addAttribute(HostNamespace.HOST_NAMESPACE, "A");
a1.addCapability(a1_hostCap);
ResourceImpl f1 = new ResourceImpl("F1", IdentityNamespace.TYPE_FRAGMENT, Version.emptyVersion);
GenericRequirement f1_hostReq = new GenericRequirement(f1, HostNamespace.HOST_NAMESPACE);
f1_hostReq.addDirective(Namespace.REQUIREMENT_FILTER_DIRECTIVE, "(" + HostNamespace.HOST_NAMESPACE + "=A)");
f1.addRequirement(f1_hostReq);
ResourceImpl f2 = new ResourceImpl("F2", IdentityNamespace.TYPE_FRAGMENT, Version.emptyVersion);
GenericRequirement f2_hostReq = new GenericRequirement(f2, HostNamespace.HOST_NAMESPACE);
f2_hostReq.addDirective(Namespace.REQUIREMENT_FILTER_DIRECTIVE, "(" + HostNamespace.HOST_NAMESPACE + "=A)");
f2.addRequirement(f2_hostReq);
ResourceImpl b1 = new ResourceImpl("B");
GenericRequirement b1_identityReq = new GenericRequirement(b1, IdentityNamespace.IDENTITY_NAMESPACE);
b1_identityReq.addDirective(Namespace.REQUIREMENT_FILTER_DIRECTIVE, "(" + IdentityNamespace.IDENTITY_NAMESPACE + "=F2)");
b1.addRequirement(b1_identityReq);
candMap.put(f1.getRequirements(null).get(0), a1.getCapabilities(HostNamespace.HOST_NAMESPACE));
candMap.put(f2.getRequirements(null).get(0), a1.getCapabilities(HostNamespace.HOST_NAMESPACE));
candMap.put(b1.getRequirements(null).get(0), f2.getCapabilities(IdentityNamespace.IDENTITY_NAMESPACE));
List<Resource> resources = new ArrayList<Resource>();
resources.add(a1);
resources.add(f1);
resources.add(f2);
resources.add(b1);
return resources;
}
Aggregations