Search in sources :

Example 86 with Processor

use of aQute.bnd.osgi.Processor in project bnd by bndtools.

the class PomRepositoryTest method testBndPomRepoURI.

public void testBndPomRepoURI() throws Exception {
    final BndPomRepository bpr = new BndPomRepository();
    Workspace w = Workspace.createStandaloneWorkspace(new Processor(), tmp.toURI());
    w.setBase(tmp);
    bpr.setRegistry(w);
    Map<String, String> config = new HashMap<>();
    config.put("pom", "https://repo1.maven.org/maven2/org/apache/felix/org.apache.felix.gogo.shell/0.12.0/org.apache.felix.gogo.shell-0.12.0.pom");
    config.put("snapshotUrls", "https://repo1.maven.org/maven2/");
    config.put("releaseUrls", "https://repo1.maven.org/maven2/");
    config.put("name", "test");
    bpr.setProperties(config);
    List<String> list = bpr.list(null);
    assertNotNull(list);
    assertEquals(1, list.size());
    RequirementBuilder builder = bpr.newRequirementBuilder("osgi.identity");
    builder.addDirective("filter", "(osgi.identity=org.apache.felix.gogo.runtime)");
    Promise<Collection<Resource>> providers = bpr.findProviders(builder.buildExpression());
    Collection<Resource> resources = providers.getValue();
    assertFalse(resources.isEmpty());
    assertEquals(1, resources.size());
}
Also used : Processor(aQute.bnd.osgi.Processor) HashMap(java.util.HashMap) Resource(org.osgi.resource.Resource) Collection(java.util.Collection) RequirementBuilder(org.osgi.service.repository.RequirementBuilder) Workspace(aQute.bnd.build.Workspace)

Example 87 with Processor

use of aQute.bnd.osgi.Processor in project bnd by bndtools.

the class PomRepositoryTest method testBndPomRepoFileExistingParent.

public void testBndPomRepoFileExistingParent() throws Exception {
    BndPomRepository bpr = new BndPomRepository();
    Workspace w = Workspace.createStandaloneWorkspace(new Processor(), tmp.toURI());
    w.setBase(tmp);
    bpr.setRegistry(w);
    Map<String, String> config = new HashMap<>();
    config.put("pom", "testdata/pomrepo/existing-parent.xml");
    config.put("snapshotUrls", "https://repo1.maven.org/maven2/");
    config.put("releaseUrls", "https://repo1.maven.org/maven2/");
    config.put("name", "test");
    bpr.setProperties(config);
    List<String> list = bpr.list(null);
    assertNotNull(list);
    assertEquals(1, list.size());
}
Also used : Processor(aQute.bnd.osgi.Processor) HashMap(java.util.HashMap) Workspace(aQute.bnd.build.Workspace)

Example 88 with Processor

use of aQute.bnd.osgi.Processor in project bnd by bndtools.

the class PomRepositoryTest method testNonStandardClassifierDependencies.

public void testNonStandardClassifierDependencies() throws Exception {
    BndPomRepository mcsr = new BndPomRepository();
    Workspace w = Workspace.createStandaloneWorkspace(new Processor(), tmp.toURI());
    w.setBase(tmp);
    mcsr.setRegistry(w);
    File local = new File(tmp, "m2-repository");
    local.mkdirs();
    Map<String, String> config = new HashMap<>();
    config.put("name", "pmd");
    config.put("revision", "net.sourceforge.pmd:pmd-java:5.2.3");
    config.put("snapshotUrls", "https://repo1.maven.org/maven2/");
    config.put("releaseUrls", "https://repo1.maven.org/maven2/");
    config.put("local", local.getAbsolutePath());
    mcsr.setProperties(config);
    List<String> list = mcsr.list(null);
    assertNotNull(list);
    URL url = new URL(tmp.toURI().toURL(), "m2-repository/net/sourceforge/saxon/saxon/9.1.0.8/saxon-9.1.0.8-dom.jar");
    File dom = new File(url.getFile());
    assertTrue(dom.exists());
// I'm assuming because we don't have a way of currently "getting" such
// a classified artifact from the repo that we'd have to encode the
// classifier in the bsn of the classified jar if it's not a bundle.
// Something like:
// File file = mcsr.get("net.sourceforge.pmd:pmd-java:dom", new
// Version("5.2.3"), null);
// assertNotNull(file);
}
Also used : Processor(aQute.bnd.osgi.Processor) HashMap(java.util.HashMap) File(java.io.File) URL(java.net.URL) Workspace(aQute.bnd.build.Workspace)

Example 89 with Processor

use of aQute.bnd.osgi.Processor in project bnd by bndtools.

the class PomRepositoryTest method testSearchRepoFailNoName.

public void testSearchRepoFailNoName() throws Exception {
    BndPomRepository mcsr = new BndPomRepository();
    Workspace w = Workspace.createStandaloneWorkspace(new Processor(), tmp.toURI());
    w.setBase(tmp);
    mcsr.setRegistry(w);
    Map<String, String> config = new HashMap<>();
    config.put("query", "q=g:biz.aQute.bnd+a:biz.aQute.bnd+AND+v:3.2.0");
    try {
        mcsr.setProperties(config);
        fail();
    } catch (Exception e) {
        assertEquals("Must get a name", e.getMessage());
    }
}
Also used : Processor(aQute.bnd.osgi.Processor) HashMap(java.util.HashMap) Workspace(aQute.bnd.build.Workspace)

Example 90 with Processor

use of aQute.bnd.osgi.Processor in project bnd by bndtools.

the class PomRepositoryTest method testSearchRepoNoUrls.

public void testSearchRepoNoUrls() throws Exception {
    BndPomRepository mcsr = new BndPomRepository();
    Workspace w = Workspace.createStandaloneWorkspace(new Processor(), tmp.toURI());
    w.setBase(tmp);
    mcsr.setRegistry(w);
    Map<String, String> config = new HashMap<>();
    config.put("query", "q=g:biz.aQute.bnd+a:biz.aQute.bnd+AND+v:3.2.0");
    config.put("name", "test");
    mcsr.setProperties(config);
    List<String> list = mcsr.list(null);
    assertNotNull(list);
    assertEquals(1, list.size());
}
Also used : Processor(aQute.bnd.osgi.Processor) HashMap(java.util.HashMap) Workspace(aQute.bnd.build.Workspace)

Aggregations

Processor (aQute.bnd.osgi.Processor)185 HashMap (java.util.HashMap)43 File (java.io.File)37 Macro (aQute.bnd.osgi.Macro)29 Workspace (aQute.bnd.build.Workspace)27 Jar (aQute.bnd.osgi.Jar)17 HttpClient (aQute.bnd.http.HttpClient)14 Baseline (aQute.bnd.differ.Baseline)12 DiffPluginImpl (aQute.bnd.differ.DiffPluginImpl)12 BundleInfo (aQute.bnd.differ.Baseline.BundleInfo)10 IOException (java.io.IOException)10 Resource (org.osgi.resource.Resource)10 Info (aQute.bnd.differ.Baseline.Info)8 Version (aQute.bnd.version.Version)8 ArrayList (java.util.ArrayList)8 List (java.util.List)7 ProgressPlugin (aQute.bnd.service.progress.ProgressPlugin)6 Collection (java.util.Collection)6 Properties (java.util.Properties)6 Parameters (aQute.bnd.header.Parameters)5