// 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 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.Resource;
import org.osgi.resource.Wire;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import java.io.InputStream;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import org.jboss.osgi.metadata.OSGiManifestBuilder;
/*
 * #%L
 * JBossOSGi Resolver Felix
 * %%
 * Copyright (C) 2010 - 2012 JBoss by Red Hat
 * %%
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * #L%
 */

package org.jboss.test.osgi.resolver;




/**
 * Test the default resolver integration.
 * 
 * @author thomas.diesler@jboss.com
 * @since 25-Feb-2012
 */
public class DynamicPackageImportResolverTest extends AbstractResolverTest {

    @Test
    public void testBundleSymbolicNameDirective() throws Exception {

        final JavaArchive archiveA = ShrinkWrap.create(JavaArchive.class, "tb8a");
        archiveA.setManifest(new Asset() {
            public InputStream openStream() {
                OSGiManifestBuilder builder = OSGiManifestBuilder.newInstance();
                builder.addBundleManifestVersion(2);
                builder.addBundleSymbolicName(archiveA.getName());
                builder.addExportPackages("org.jboss.test.osgi.framework.classloader.support.a");
                return builder.openStream();
            }
        });
        XResource resourceA = createResource(archiveA);

        final JavaArchive archiveB = ShrinkWrap.create(JavaArchive.class, "tb8b");
        archiveB.setManifest(new Asset() {
            public InputStream openStream() {
                OSGiManifestBuilder builder = OSGiManifestBuilder.newInstance();
                builder.addBundleManifestVersion(2);
// 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/DynamicPackageImportResolverTest.java
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.Resource;
import org.osgi.resource.Wire;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import java.io.InputStream;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import org.jboss.osgi.metadata.OSGiManifestBuilder;

/*
 * #%L
 * JBossOSGi Resolver Felix
 * %%
 * Copyright (C) 2010 - 2012 JBoss by Red Hat
 * %%
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * #L%
 */

package org.jboss.test.osgi.resolver;




/**
 * Test the default resolver integration.
 * 
 * @author thomas.diesler@jboss.com
 * @since 25-Feb-2012
 */
public class DynamicPackageImportResolverTest extends AbstractResolverTest {

    @Test
    public void testBundleSymbolicNameDirective() throws Exception {

        final JavaArchive archiveA = ShrinkWrap.create(JavaArchive.class, "tb8a");
        archiveA.setManifest(new Asset() {
            public InputStream openStream() {
                OSGiManifestBuilder builder = OSGiManifestBuilder.newInstance();
                builder.addBundleManifestVersion(2);
                builder.addBundleSymbolicName(archiveA.getName());
                builder.addExportPackages("org.jboss.test.osgi.framework.classloader.support.a");
                return builder.openStream();
            }
        });
        XResource resourceA = createResource(archiveA);

        final JavaArchive archiveB = ShrinkWrap.create(JavaArchive.class, "tb8b");
        archiveB.setManifest(new Asset() {
            public InputStream openStream() {
                OSGiManifestBuilder builder = OSGiManifestBuilder.newInstance();
                builder.addBundleManifestVersion(2);
                builder.addBundleSymbolicName(archiveB.getName());