Search in sources :

Example 1 with Repository

use of aQute.bnd.jpm.Repository in project bnd by bndtools.

the class TestWrapper method getRepo.

private InfoRepositoryWrapper getRepo() throws Exception {
    Repository repo = getJpmRepo();
    InfoRepositoryWrapper iw = new InfoRepositoryWrapper(tmp, Collections.singleton(repo));
    return iw;
}
Also used : InfoRepository(aQute.bnd.service.repository.InfoRepository) Repository(aQute.bnd.jpm.Repository)

Example 2 with Repository

use of aQute.bnd.jpm.Repository in project bnd by bndtools.

the class TestWrapper method testAugment.

/**
	 * Test the augments facility. This allows us to add caps/reqs to bundles
	 * with a file from the workspace.
	 */
public void testAugment() throws Exception {
    Repository repo = getJpmRepo();
    augmentTest(repo);
}
Also used : InfoRepository(aQute.bnd.service.repository.InfoRepository) Repository(aQute.bnd.jpm.Repository)

Example 3 with Repository

use of aQute.bnd.jpm.Repository in project bnd by bndtools.

the class IndexedReposWithComms method testJpmRepoQuery.

public void testJpmRepoQuery() throws Exception {
    try (HttpTestServer ht = http()) {
        createSecureSocks5();
        Workspace ws = Workspace.getWorkspace(aQute.lib.io.IO.getFile("workspaces/jpm"));
        assertNotNull(ws);
        ws.setProperty("repo", ht.getBaseURI().toASCIIString());
        ws.setProperty("tmp", tmp.toURI().getPath());
        ws.setProperty("-fixupmessages.jpmdeprecated", "aQute.bnd.jpm.Repository is deprecated");
        Repository plugin = ws.getPlugin(Repository.class);
        assertTrue(ws.check());
        assertNotNull(plugin);
        Set<ResourceDescriptor> query = plugin.query("bla");
        assertTrue(ws.check());
        assertTrue(query.size() > 0);
    }
}
Also used : Repository(aQute.bnd.jpm.Repository) HttpTestServer(aQute.http.testservers.HttpTestServer) Workspace(aQute.bnd.build.Workspace) ResourceDescriptor(aQute.bnd.service.repository.SearchableRepository.ResourceDescriptor)

Example 4 with Repository

use of aQute.bnd.jpm.Repository in project bnd by bndtools.

the class IndexedReposWithComms method testJpmRepoDownload.

public void testJpmRepoDownload() throws Exception {
    try (HttpTestServer ht = http()) {
        createSecureSocks5();
        Workspace ws = Workspace.getWorkspace(aQute.lib.io.IO.getFile("workspaces/jpm"));
        assertNotNull(ws);
        ws.setProperty("repo", ht.getBaseURI().toASCIIString());
        ws.setProperty("tmp", tmp.toURI().getPath());
        Repository plugin = ws.getPlugin(Repository.class);
        ResourceDescriptor descriptor = plugin.getDescriptor("slf4j.simple", new Version("1.7.13"));
        assertNotNull(descriptor);
        File file = plugin.get("slf4j.simple", new Version("1.7.13"), null);
        assertTrue(file.isFile());
        byte[] digest = SHA256.digest(file).digest();
        assertTrue(Arrays.equals(descriptor.sha256, digest));
    }
}
Also used : Repository(aQute.bnd.jpm.Repository) Version(aQute.bnd.version.Version) HttpTestServer(aQute.http.testservers.HttpTestServer) File(java.io.File) Workspace(aQute.bnd.build.Workspace) ResourceDescriptor(aQute.bnd.service.repository.SearchableRepository.ResourceDescriptor)

Example 5 with Repository

use of aQute.bnd.jpm.Repository in project bnd by bndtools.

the class TestWrapper method testAugment2.

/**
	 * Test the augments facility. This allows us to add caps/reqs to bundles
	 * with a file from the workspace.
	 */
public void testAugment2() throws Exception {
    File cache = new File("generated/tmp/test/cache");
    IO.deleteWithException(cache);
    Workspace ws = Workspace.getWorkspace(IO.getFile("testdata/ws"));
    assertNotNull(ws);
    Repository repo = ws.getPlugin(Repository.class);
    assertNotNull(repo);
    assertNotNull(repo.get("biz.aQute.jpm.daemon", new Version("1.1.0"), null));
    org.osgi.service.repository.Repository osgi = ws.getPlugin(org.osgi.service.repository.Repository.class);
    //
    // Get the test and identity capability
    //
    Requirement testreq = new CapReqBuilder("test").filter("(test=1)").buildSyntheticRequirement();
    Requirement identity = new CapReqBuilder("osgi.identity").filter("(osgi.identity=biz.aQute.jpm.daemon)").buildSyntheticRequirement();
    Map<Requirement, Collection<Capability>> result = osgi.findProviders(Arrays.asList(testreq, identity));
    assertNotNull(result);
    assertEquals(2, result.size());
    //
    // Test if they come from the same resource
    //
    Capability testcap = result.get(testreq).iterator().next();
    Capability identitycap = result.get(identity).iterator().next();
    assertNotNull(testcap);
    assertNotNull(identitycap);
    assertEquals(testcap.getResource(), identitycap.getResource());
}
Also used : CapReqBuilder(aQute.bnd.osgi.resource.CapReqBuilder) Requirement(org.osgi.resource.Requirement) InfoRepository(aQute.bnd.service.repository.InfoRepository) Repository(aQute.bnd.jpm.Repository) Capability(org.osgi.resource.Capability) Version(aQute.bnd.version.Version) Collection(java.util.Collection) File(java.io.File) Workspace(aQute.bnd.build.Workspace)

Aggregations

Repository (aQute.bnd.jpm.Repository)6 InfoRepository (aQute.bnd.service.repository.InfoRepository)4 Workspace (aQute.bnd.build.Workspace)3 ResourceDescriptor (aQute.bnd.service.repository.SearchableRepository.ResourceDescriptor)2 Version (aQute.bnd.version.Version)2 HttpTestServer (aQute.http.testservers.HttpTestServer)2 File (java.io.File)2 CapReqBuilder (aQute.bnd.osgi.resource.CapReqBuilder)1 Collection (java.util.Collection)1 Capability (org.osgi.resource.Capability)1 Requirement (org.osgi.resource.Requirement)1