use of aQute.http.testservers.HttpTestServer 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.http.testservers.HttpTestServer 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));
}
}
Aggregations