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;
}
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);
}
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);
}
}
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));
}
}
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());
}
Aggregations