// Path: api/src/main/java/org/jboss/osgi/resolver/XPackageCapability.java
// public interface XPackageCapability extends XCapability {
// 
//     /**
//      * The package name
//      */
//     String getPackageName();
// 
//     /**
//      * The package version.
//      */
//     Version getVersion();
// }
// 
// Path: api/src/main/java/org/jboss/osgi/resolver/XPackageRequirement.java
// public interface XPackageRequirement extends XRequirement {
// 
//     /**
//      * The package name
//      */
//     String getPackageName();
// 
//     /**
//      * A flag indicating that this is a dynamic package requirement
//      */
//     boolean isDynamic();
// }
// 
// Path: api/src/main/java/org/jboss/osgi/resolver/XResource.java
// public interface XResource extends XElement, XAttributeSupport, Resource {
// 
//     /** The id attachment key */
//     AttachmentKey<Long> RESOURCE_IDENTIFIER_KEY = AttachmentKey.create(Long.class);
// 
//     /**
//      * Artifact coordinates may be defined by the simple groupId:artifactId:version form,
//      * or the fully qualified form groupId:artifactId:type:version[:classifier]
//      */
//     String MAVEN_IDENTITY_NAMESPACE = "maven.identity";
// 
//     /**
//      * Artifact coordinates are defined by {@link org.jboss.modules.ModuleIdentifier}
//      */
//     String MODULE_IDENTITY_NAMESPACE = "module.identity";
// 
//     /**
//      * The attribute on the {@link XIdentityCapability} for the below types
//      */
//     String CAPABILITY_TYPE_ATTRIBUTE = IdentityNamespace.CAPABILITY_TYPE_ATTRIBUTE;
// 
//     /**
//      * Some predefined resource types
//      */
//     String TYPE_BUNDLE = IdentityNamespace.TYPE_BUNDLE;
//     String TYPE_FRAGMENT = IdentityNamespace.TYPE_FRAGMENT;
//     String TYPE_UNKNOWN = IdentityNamespace.TYPE_UNKNOWN;
//     String TYPE_ABSTRACT = "abstract";
//     String TYPE_MODULE = "module";
//     String TYPE_MAVEN = "maven";
// 
//     /**
//      * Get the identity capability for this resource
//      */
//     XIdentityCapability getIdentityCapability();
// 
//     /**
//      * Validate the resource
//      */
//     void validate();
// 
//     /**
//      * Get the current resource state
//      */
//     State getState();
// 
//     /**
//      * True if the resource is mutable
//      */
//     boolean isMutable();
// 
//     /**
//      * True if the resource is abstract
//      */
//     boolean isAbstract();
// 
//     /**
//      * Make the resource immutable
//      */
//     void setMutable(boolean mutable);
// 
//     /**
//      * Get the {@link XWiringSupport} associated with this resource
//      */
//     XWiringSupport getWiringSupport();
// 
//     /**
//      * Get the {@link XWiring} associated with this resource
//      */
//     XWiring getWiring(boolean checkEffective);
// 
//     /**
//      * The resource state in the {@link XEnvironment}
//      */
//     enum State {
//         INSTALLED, UNINSTALLED
//     }
// }


import static org.junit.Assert.assertEquals;
import static org.osgi.framework.namespace.PackageNamespace.PACKAGE_NAMESPACE;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import org.junit.Assert;
import org.jboss.osgi.metadata.OSGiManifestBuilder;
import org.jboss.osgi.resolver.XPackageCapability;
import org.jboss.osgi.resolver.XPackageRequirement;
import org.jboss.osgi.resolver.XResource;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.asset.Asset;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.junit.Test;
import org.osgi.resource.Capability;
import org.osgi.resource.Requirement;
import org.osgi.resource.Resource;
import org.osgi.resource.Wire;
import org.osgi.resource.Wiring;
        Assert.assertEquals(0, wiringA.getResourceRequirements(PACKAGE_NAMESPACE).size());
        List<Capability> caps = wiringA.getResourceCapabilities(PACKAGE_NAMESPACE);
        Assert.assertEquals(1, caps.size());
        Assert.assertEquals("javax.servlet", getPackageName(caps.get(0)));

        // Verify wiring of B
        Wiring wiringB = getWiring(resourceB);
        wires = wiringB.getRequiredResourceWires(null);
        Assert.assertEquals(1, wires.size());
        Assert.assertEquals("javax.servlet", getPackageName(wires.get(0).getCapability()));
        Assert.assertSame(resourceA, wires.get(0).getProvider());
        Assert.assertEquals(0, wiringB.getProvidedResourceWires(null).size());
        List<Requirement> reqs = wiringB.getResourceRequirements(PACKAGE_NAMESPACE);
        Assert.assertEquals(1, reqs.size());
        caps = wiringB.getResourceCapabilities(PACKAGE_NAMESPACE);
        Assert.assertEquals(1, caps.size());
        Assert.assertEquals("org.osgi.service.http", getPackageName(caps.get(0)));

        // Verify wiring of C
        Wiring wiringC = getWiring(resourceC);
        wires = wiringC.getRequiredResourceWires(null);
        Assert.assertEquals(1, wires.size());
        Assert.assertEquals("javax.servlet", getPackageName(wires.get(0).getCapability()));
        Assert.assertSame(resourceA, wires.get(0).getProvider());
        wires = wiringC.getProvidedResourceWires(null);
        Assert.assertEquals(1, wires.size());
        Assert.assertEquals("org.ops4j.pax.web.service", getPackageName(wires.get(0).getCapability()));
        Assert.assertSame(resourceD, wires.get(0).getRequirer());
        reqs = wiringC.getResourceRequirements(PACKAGE_NAMESPACE);
        Assert.assertEquals(1, reqs.size());
// Path: api/src/main/java/org/jboss/osgi/resolver/XPackageCapability.java
// public interface XPackageCapability extends XCapability {
// 
//     /**
//      * The package name
//      */
//     String getPackageName();
// 
//     /**
//      * The package version.
//      */
//     Version getVersion();
// }
// 
// Path: api/src/main/java/org/jboss/osgi/resolver/XPackageRequirement.java
// public interface XPackageRequirement extends XRequirement {
// 
//     /**
//      * The package name
//      */
//     String getPackageName();
// 
//     /**
//      * A flag indicating that this is a dynamic package requirement
//      */
//     boolean isDynamic();
// }
// 
// Path: api/src/main/java/org/jboss/osgi/resolver/XResource.java
// public interface XResource extends XElement, XAttributeSupport, Resource {
// 
//     /** The id attachment key */
//     AttachmentKey<Long> RESOURCE_IDENTIFIER_KEY = AttachmentKey.create(Long.class);
// 
//     /**
//      * Artifact coordinates may be defined by the simple groupId:artifactId:version form,
//      * or the fully qualified form groupId:artifactId:type:version[:classifier]
//      */
//     String MAVEN_IDENTITY_NAMESPACE = "maven.identity";
// 
//     /**
//      * Artifact coordinates are defined by {@link org.jboss.modules.ModuleIdentifier}
//      */
//     String MODULE_IDENTITY_NAMESPACE = "module.identity";
// 
//     /**
//      * The attribute on the {@link XIdentityCapability} for the below types
//      */
//     String CAPABILITY_TYPE_ATTRIBUTE = IdentityNamespace.CAPABILITY_TYPE_ATTRIBUTE;
// 
//     /**
//      * Some predefined resource types
//      */
//     String TYPE_BUNDLE = IdentityNamespace.TYPE_BUNDLE;
//     String TYPE_FRAGMENT = IdentityNamespace.TYPE_FRAGMENT;
//     String TYPE_UNKNOWN = IdentityNamespace.TYPE_UNKNOWN;
//     String TYPE_ABSTRACT = "abstract";
//     String TYPE_MODULE = "module";
//     String TYPE_MAVEN = "maven";
// 
//     /**
//      * Get the identity capability for this resource
//      */
//     XIdentityCapability getIdentityCapability();
// 
//     /**
//      * Validate the resource
//      */
//     void validate();
// 
//     /**
//      * Get the current resource state
//      */
//     State getState();
// 
//     /**
//      * True if the resource is mutable
//      */
//     boolean isMutable();
// 
//     /**
//      * True if the resource is abstract
//      */
//     boolean isAbstract();
// 
//     /**
//      * Make the resource immutable
//      */
//     void setMutable(boolean mutable);
// 
//     /**
//      * Get the {@link XWiringSupport} associated with this resource
//      */
//     XWiringSupport getWiringSupport();
// 
//     /**
//      * Get the {@link XWiring} associated with this resource
//      */
//     XWiring getWiring(boolean checkEffective);
// 
//     /**
//      * The resource state in the {@link XEnvironment}
//      */
//     enum State {
//         INSTALLED, UNINSTALLED
//     }
// }


// Path: felix/src/test/java/org/jboss/test/osgi/resolver/UsesDirectiveResolverTest.java
import static org.junit.Assert.assertEquals;
import static org.osgi.framework.namespace.PackageNamespace.PACKAGE_NAMESPACE;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import org.junit.Assert;
import org.jboss.osgi.metadata.OSGiManifestBuilder;
import org.jboss.osgi.resolver.XPackageCapability;
import org.jboss.osgi.resolver.XPackageRequirement;
import org.jboss.osgi.resolver.XResource;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.asset.Asset;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.junit.Test;
import org.osgi.resource.Capability;
import org.osgi.resource.Requirement;
import org.osgi.resource.Resource;
import org.osgi.resource.Wire;
import org.osgi.resource.Wiring;

        Assert.assertEquals(0, wiringA.getResourceRequirements(PACKAGE_NAMESPACE).size());
        List<Capability> caps = wiringA.getResourceCapabilities(PACKAGE_NAMESPACE);
        Assert.assertEquals(1, caps.size());
        Assert.assertEquals("javax.servlet", getPackageName(caps.get(0)));

        // Verify wiring of B
        Wiring wiringB = getWiring(resourceB);
        wires = wiringB.getRequiredResourceWires(null);
        Assert.assertEquals(1, wires.size());
        Assert.assertEquals("javax.servlet", getPackageName(wires.get(0).getCapability()));
        Assert.assertSame(resourceA, wires.get(0).getProvider());
        Assert.assertEquals(0, wiringB.getProvidedResourceWires(null).size());
        List<Requirement> reqs = wiringB.getResourceRequirements(PACKAGE_NAMESPACE);
        Assert.assertEquals(1, reqs.size());
        caps = wiringB.getResourceCapabilities(PACKAGE_NAMESPACE);
        Assert.assertEquals(1, caps.size());
        Assert.assertEquals("org.osgi.service.http", getPackageName(caps.get(0)));

        // Verify wiring of C
        Wiring wiringC = getWiring(resourceC);
        wires = wiringC.getRequiredResourceWires(null);
        Assert.assertEquals(1, wires.size());
        Assert.assertEquals("javax.servlet", getPackageName(wires.get(0).getCapability()));
        Assert.assertSame(resourceA, wires.get(0).getProvider());
        wires = wiringC.getProvidedResourceWires(null);
        Assert.assertEquals(1, wires.size());
        Assert.assertEquals("org.ops4j.pax.web.service", getPackageName(wires.get(0).getCapability()));
        Assert.assertSame(resourceD, wires.get(0).getRequirer());
        reqs = wiringC.getResourceRequirements(PACKAGE_NAMESPACE);
        Assert.assertEquals(1, reqs.size());
        Assert.assertEquals("javax.servlet", getPackageName((XPackageRequirement) reqs.get(0)));