Search in sources :

Example 41 with Processor

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

the class MacroTest method testFilter.

public static void testFilter() {
    Processor p = new Processor();
    p.setProperty("a", "aaaa");
    Macro m = new Macro(p);
    assertEquals("aa,cc,ee", m.process("${filter;aa,bb,cc,dd,ee,ff;[ace]+}"));
    assertEquals("aaaa,cc,ee", m.process("${filter;${a},bb,cc,dd,ee,ff;[ace]+}"));
    assertEquals("bb,dd,ff", m.process("${filter;${a},bb,cc,dd,ee,ff;[^ace]+}"));
}
Also used : Processor(aQute.bnd.osgi.Processor) Macro(aQute.bnd.osgi.Macro)

Example 42 with Processor

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

the class MavenRepository method get.

private File[] get(String bsn, String version) throws Exception {
    VersionRange range = new VersionRange("0");
    if (version != null)
        range = new VersionRange(version);
    List<BsnToMavenPath> plugins = ((Processor) reporter).getPlugins(BsnToMavenPath.class);
    if (plugins.isEmpty())
        plugins.add(this);
    for (BsnToMavenPath cvr : plugins) {
        String[] paths = cvr.getGroupAndArtifact(bsn);
        if (paths != null) {
            File[] files = find(paths[0], paths[1], range);
            if (files != null)
                return files;
        }
    }
    logger.debug("Cannot find in maven: {}-{}", bsn, version);
    return null;
}
Also used : Processor(aQute.bnd.osgi.Processor) VersionRange(aQute.bnd.version.VersionRange) File(java.io.File)

Example 43 with Processor

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

the class TestLocalIndexedRepo method testLocalIndexLocation.

public void testLocalIndexLocation() throws Exception {
    Processor reporter = new Processor();
    LocalIndexedRepo repo = new LocalIndexedRepo();
    Map<String, String> config = new HashMap<String, String>();
    config.put("local", outputDir.getAbsolutePath());
    repo.setProperties(config);
    repo.setReporter(reporter);
    assertEquals(1, repo.getIndexLocations().size());
    assertEquals(new File(outputDir, "index.xml.gz").toURI(), repo.getIndexLocations().get(0));
    assertEquals(0, reporter.getErrors().size());
    assertEquals(0, reporter.getWarnings().size());
}
Also used : Processor(aQute.bnd.osgi.Processor) HashMap(java.util.HashMap) File(java.io.File)

Example 44 with Processor

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

the class TestLocalIndexedRepo method testLocalAndRemoteIndexLocations.

public void testLocalAndRemoteIndexLocations() throws Exception {
    Processor reporter = new Processor();
    LocalIndexedRepo repo = new LocalIndexedRepo();
    Map<String, String> config = new HashMap<String, String>();
    config.put("local", outputDir.getAbsolutePath());
    config.put("locations", "http://localhost:" + httpdPort + "/index1.xml,http://localhost:" + httpdPort + "/index2.xml");
    repo.setProperties(config);
    repo.setReporter(reporter);
    assertEquals(3, repo.getIndexLocations().size());
    assertEquals(new File(outputDir, "index.xml.gz").toURI(), repo.getIndexLocations().get(0));
    assertEquals(new URI("http://localhost:" + httpdPort + "/index1.xml"), repo.getIndexLocations().get(1));
    assertEquals(new URI("http://localhost:" + httpdPort + "/index2.xml"), repo.getIndexLocations().get(2));
    assertEquals(0, reporter.getErrors().size());
    assertEquals(0, reporter.getWarnings().size());
}
Also used : Processor(aQute.bnd.osgi.Processor) HashMap(java.util.HashMap) File(java.io.File) URI(java.net.URI)

Example 45 with Processor

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

the class TestFixedIndexedRepo method testIndex2.

public void testIndex2() throws Exception {
    Processor reporter = new Processor();
    FixedIndexedRepo repo = new FixedIndexedRepo();
    Map<String, String> props = new HashMap<String, String>();
    props.put("name", "index2");
    props.put("locations", IO.getFile("testdata/index2.xml").toURI().toString());
    props.put(FixedIndexedRepo.PROP_CACHE, tmp.getAbsolutePath());
    repo.setProperties(props);
    repo.setReporter(reporter);
    assertEquals(56, countBundles(repo));
    assertEquals(0, reporter.getErrors().size());
    assertEquals(0, reporter.getWarnings().size());
}
Also used : Processor(aQute.bnd.osgi.Processor) HashMap(java.util.HashMap)

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