Search in sources :

Example 11 with IdentityCapability

use of aQute.bnd.osgi.resource.ResourceUtils.IdentityCapability in project bnd by bndtools.

the class MavenBndRepoTest method testPutLocalTwiceNoSnapshot.

public void testPutLocalTwiceNoSnapshot() throws Exception {
    Map<String, String> map = new HashMap<>();
    map.put("releaseUrl", remote.toURI().toString());
    config(map);
    File jar = IO.getFile("testresources/release.jar");
    PutResult put = repo.put(new FileInputStream(jar), null);
    assertIsFile(local, "biz/aQute/bnd/biz.aQute.bnd.maven/3.2.0/biz.aQute.bnd.maven-3.2.0.jar");
    assertIsFile(local, "biz/aQute/bnd/biz.aQute.bnd.maven/3.2.0/biz.aQute.bnd.maven-3.2.0.pom");
    put = repo.put(new FileInputStream(jar), null);
    Requirement wc = ResourceUtils.createWildcardRequirement();
    Collection<Capability> caps = repo.findProviders(Collections.singleton(wc)).get(wc);
    Set<Resource> resources = ResourceUtils.getResources(caps);
    assertEquals(2, resources.size());
    IdentityCapability bc = ResourceUtils.getIdentityCapability(resources.iterator().next());
    assertEquals("biz.aQute.bnd.maven", bc.osgi_identity());
}
Also used : Requirement(org.osgi.resource.Requirement) Capability(org.osgi.resource.Capability) IdentityCapability(aQute.bnd.osgi.resource.ResourceUtils.IdentityCapability) HashMap(java.util.HashMap) Resource(org.osgi.resource.Resource) File(java.io.File) PutResult(aQute.bnd.service.RepositoryPlugin.PutResult) FileInputStream(java.io.FileInputStream) IdentityCapability(aQute.bnd.osgi.resource.ResourceUtils.IdentityCapability)

Aggregations

IdentityCapability (aQute.bnd.osgi.resource.ResourceUtils.IdentityCapability)11 Capability (org.osgi.resource.Capability)7 Requirement (org.osgi.resource.Requirement)7 Resource (org.osgi.resource.Resource)5 HashMap (java.util.HashMap)4 CapReqBuilder (aQute.bnd.osgi.resource.CapReqBuilder)3 Version (aQute.bnd.version.Version)3 File (java.io.File)3 ArrayList (java.util.ArrayList)3 List (java.util.List)3 IOException (java.io.IOException)2 Collection (java.util.Collection)2 Map (java.util.Map)2 Repository (org.osgi.service.repository.Repository)2 Promise (org.osgi.util.promise.Promise)2 Container (aQute.bnd.build.Container)1 BndEditModel (aQute.bnd.build.model.BndEditModel)1 ResourcesRepository (aQute.bnd.osgi.repository.ResourcesRepository)1 CapabilityBuilder (aQute.bnd.osgi.resource.CapabilityBuilder)1 FilterParser (aQute.bnd.osgi.resource.FilterParser)1