Search in sources :

Example 21 with Archive

use of aQute.maven.api.Archive in project bnd by bndtools.

the class PomGenerator method prune.

private void prune() {
    TreeSet<Archive> s = new TreeSet<>(dependencies);
    Archive prev = null;
    for (Iterator<Archive> i = s.iterator(); i.hasNext(); ) {
        Archive a = i.next();
        boolean sameProgram = prev != null && prev.revision.program.equals(a.revision.program);
        if (sameProgram) {
            System.out.println("Skipping " + a);
            i.remove();
        } else
            prev = a;
    }
    dependencies = s;
}
Also used : Archive(aQute.maven.api.Archive) TreeSet(java.util.TreeSet)

Example 22 with Archive

use of aQute.maven.api.Archive in project bnd by bndtools.

the class MavenRepoTest method testBasicSnapshotRelease.

public void testBasicSnapshotRelease() throws Exception {
    File fpom = IO.getFile(local, "commons-cli/commons-cli/1.4-SNAPSHOT/commons-cli-1.4-SNAPSHOT.pom");
    File rpom = IO.getFile(remote, "commons-cli/commons-cli/1.4-SNAPSHOT/commons-cli-1.4-19700101.000010-10.pom");
    Program program = Program.valueOf("commons-cli", "commons-cli");
    Revision revision = Program.valueOf("commons-cli", "commons-cli").version("1.4-SNAPSHOT");
    Archive apom = revision.archive("pom", null);
    assertFalse(fpom.exists());
    Release r = storage.release(revision, new Properties());
    r.setBuild(10000, null);
    r.add("pom", null, new ByteArrayInputStream(new byte[0]));
    r.close();
    assertTrue(fpom.isFile());
    assertTrue(rpom.isFile());
}
Also used : Program(aQute.maven.api.Program) Archive(aQute.maven.api.Archive) Revision(aQute.maven.api.Revision) ByteArrayInputStream(java.io.ByteArrayInputStream) Properties(java.util.Properties) File(java.io.File) Release(aQute.maven.api.Release)

Example 23 with Archive

use of aQute.maven.api.Archive in project bnd by bndtools.

the class MavenRepoTest method testImmutable.

public void testImmutable() throws Exception {
    File fpom = IO.getFile(local, "commons-cli/commons-cli/1.2/commons-cli-1.2.pom");
    Program program = Program.valueOf("commons-cli", "commons-cli");
    Revision revision = Program.valueOf("commons-cli", "commons-cli").version("1.2");
    Archive apom = revision.archive("pom", null);
    assertFalse(fpom.exists());
    Archive rapom = storage.resolveSnapshot(apom);
    assertTrue(rapom.isResolved());
    assertEquals(rapom, apom);
    File f = storage.get(rapom).getValue();
    assertEquals(fpom, f);
    assertRecent(f);
    f.setLastModified(10000);
    f = storage.get(rapom).getValue();
    assertEquals(fpom, f);
    assertEquals(10000L, f.lastModified());
}
Also used : Program(aQute.maven.api.Program) Archive(aQute.maven.api.Archive) Revision(aQute.maven.api.Revision) File(java.io.File)

Example 24 with Archive

use of aQute.maven.api.Archive in project bnd by bndtools.

the class PomRepositoryTest method testPomTransitive.

public void testPomTransitive() throws Exception {
    MavenRepository mr = getRepo();
    Revision revision = Program.valueOf("org.apache.aries.blueprint", "org.apache.aries.blueprint.cm").version("1.0.8");
    Traverser t = new Traverser(mr, new HttpClient(), Processor.getExecutor(), true).revision(revision);
    Map<Archive, Resource> value = t.getResources().getValue();
    assertEquals(8, value.size());
    assertAllBndCap(value);
}
Also used : Archive(aQute.maven.api.Archive) MavenRepository(aQute.maven.provider.MavenRepository) Revision(aQute.maven.api.Revision) HttpClient(aQute.bnd.http.HttpClient) Resource(org.osgi.resource.Resource)

Example 25 with Archive

use of aQute.maven.api.Archive in project bnd by bndtools.

the class PomRepositoryTest method testPomNotTransitive.

public void testPomNotTransitive() throws Exception {
    MavenRepository mr = getRepo();
    Revision revision = Program.valueOf("org.apache.aries.blueprint", "org.apache.aries.blueprint.cm").version("1.0.8");
    Traverser t = new Traverser(mr, new HttpClient(), Processor.getExecutor(), false).revision(revision);
    Map<Archive, Resource> value = t.getResources().getValue();
    assertEquals(1, value.size());
    assertAllBndCap(value);
}
Also used : Archive(aQute.maven.api.Archive) MavenRepository(aQute.maven.provider.MavenRepository) Revision(aQute.maven.api.Revision) HttpClient(aQute.bnd.http.HttpClient) Resource(org.osgi.resource.Resource)

Aggregations

Archive (aQute.maven.api.Archive)25 File (java.io.File)13 Revision (aQute.maven.api.Revision)6 Program (aQute.maven.api.Program)5 IOException (java.io.IOException)5 FileNotFoundException (java.io.FileNotFoundException)4 UnsupportedEncodingException (java.io.UnsupportedEncodingException)3 ArrayList (java.util.ArrayList)3 Resource (org.osgi.resource.Resource)3 HttpClient (aQute.bnd.http.HttpClient)2 Jar (aQute.bnd.osgi.Jar)2 IPom (aQute.maven.api.IPom)2 Release (aQute.maven.api.Release)2 MavenRepository (aQute.maven.provider.MavenRepository)2 SnapshotVersion (aQute.maven.provider.MetadataParser.SnapshotVersion)2 InputStream (java.io.InputStream)2 Failure (org.osgi.util.promise.Failure)2 Promise (org.osgi.util.promise.Promise)2 Workspace (aQute.bnd.build.Workspace)1 HttpRequestException (aQute.bnd.http.HttpRequestException)1