Search in sources :

Example 21 with HttpTestServer

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);
    }
}
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 22 with HttpTestServer

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

Aggregations

HttpTestServer (aQute.http.testservers.HttpTestServer)22 URL (java.net.URL)10 HttpURLConnection (java.net.HttpURLConnection)7 Workspace (aQute.bnd.build.Workspace)5 FixedIndexedRepo (aQute.bnd.deployer.repository.FixedIndexedRepo)2 Repository (aQute.bnd.jpm.Repository)2 ResourceDescriptor (aQute.bnd.service.repository.SearchableRepository.ResourceDescriptor)2 Config (aQute.http.testservers.HttpTestServer.Config)2 ByteArrayInputStream (java.io.ByteArrayInputStream)2 URI (java.net.URI)2 HttpClient (aQute.bnd.http.HttpClient)1 URLConnector (aQute.bnd.service.url.URLConnector)1 Version (aQute.bnd.version.Version)1 Httpbin (aQute.http.testservers.Httpbin)1 File (java.io.File)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 X509Certificate (java.security.cert.X509Certificate)1 Matcher (java.util.regex.Matcher)1 GZIPInputStream (java.util.zip.GZIPInputStream)1