Search in sources :

Example 81 with Processor

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

the class MacroTest method testNesting2.

/**
	 * Testing an example with nesting that was supposd not to work
	 */
public static void testNesting2() {
    Processor p = new Processor();
    p.setProperty("groupId", "com.trivadis.tomas");
    p.setProperty("artifactId", "common");
    p.setProperty("bsn", "${if;${symbolicName};${symbolicName};${groupId}.${artifactId}}");
    p.setProperty("Bundle-SymbolicName", "${bsn}");
    p.setProperty("symbolicName", "");
    // Not set, so get the maven name
    assertEquals("com.trivadis.tomas.common", p.getProperty("Bundle-SymbolicName"));
    // Set it
    p.setProperty("symbolicName", "testing");
    assertEquals("testing", p.getProperty("Bundle-SymbolicName"));
    // And remove it
    p.setProperty("symbolicName", "");
    assertEquals("com.trivadis.tomas.common", p.getProperty("Bundle-SymbolicName"));
}
Also used : Processor(aQute.bnd.osgi.Processor)

Example 82 with Processor

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

the class MacroTest method testParentFile.

public static void testParentFile() {
    Processor p = new Processor();
    Macro m = new Macro(p);
    assertTrue(m.process("${dir;.project}").endsWith("biz.aQute.bndlib.tests"));
}
Also used : Processor(aQute.bnd.osgi.Processor) Macro(aQute.bnd.osgi.Macro)

Example 83 with Processor

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

the class DiffTest method testAPIStaticSuperClassChange.

public void testAPIStaticSuperClassChange() throws Exception {
    Jar older = new Jar(IO.getFile("../demo/generated/demo.jar"));
    Builder b = new Builder();
    b.addClasspath(IO.getFile("bin"));
    b.setExportPackage("test.api");
    b.build();
    assertTrue(b.check());
    Jar newer = b.getJar();
    Processor processor = new Processor();
    DiffPluginImpl differ = new DiffPluginImpl();
    Baseline baseline = new Baseline(processor, differ);
    Info info = baseline.baseline(newer, older, null).iterator().next();
    Diff field = info.packageDiff.get("test.api.B");
    show(field, 2);
    assertEquals(Delta.UNCHANGED, field.getDelta());
    b.close();
}
Also used : DiffPluginImpl(aQute.bnd.differ.DiffPluginImpl) Processor(aQute.bnd.osgi.Processor) Diff(aQute.bnd.service.diff.Diff) Builder(aQute.bnd.osgi.Builder) Jar(aQute.bnd.osgi.Jar) Baseline(aQute.bnd.differ.Baseline) Info(aQute.bnd.differ.Baseline.Info)

Example 84 with Processor

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

the class PomRepositoryTest method testMultipleRevisions.

public void testMultipleRevisions() 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", "test-dependencies");
    String revisions = Strings.join(new String[] { "biz.aQute.bnd:biz.aQute.junit:3.3.0", "biz.aQute.bnd:biz.aQute.launcher:3.3.0", "biz.aQute.bnd:biz.aQute.remote.launcher:3.3.0", "biz.aQute.bnd:biz.aQute.tester:3.3.0" });
    config.put("revision", revisions);
    config.put("snapshotUrls", "https://repo1.maven.org/maven2/");
    config.put("releaseUrls", "https://repo1.maven.org/maven2/");
    config.put("local", local.getAbsolutePath());
    config.put("transitive", "true");
    mcsr.setProperties(config);
    List<String> list = mcsr.list(null);
    assertNotNull(list);
    assertEquals(4, list.size());
    RequirementBuilder builder = mcsr.newRequirementBuilder("osgi.identity");
    builder.addAttribute("filter", "(osgi.identity=biz.aQute.tester)");
    Promise<Collection<Resource>> providers = mcsr.findProviders(builder.buildExpression());
    Collection<Resource> resources = providers.getValue();
    assertFalse(resources.isEmpty());
}
Also used : Processor(aQute.bnd.osgi.Processor) HashMap(java.util.HashMap) Resource(org.osgi.resource.Resource) RequirementBuilder(org.osgi.service.repository.RequirementBuilder) Collection(java.util.Collection) File(java.io.File) Workspace(aQute.bnd.build.Workspace)

Example 85 with Processor

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

the class TestMultipleLocalIndexGeneration method setUp.

protected void setUp() throws Exception {
    // Ensure output directory exists and is empty
    outputDir = IO.getFile("generated/tmp/test/" + getName());
    IO.deleteWithException(outputDir);
    if (!outputDir.exists() && !outputDir.mkdirs()) {
        throw new IOException("Could not create directory " + outputDir);
    }
    // Setup the repo
    reporter = new Processor();
    repo = new LocalIndexedRepo();
    Map<String, String> config = new HashMap<String, String>();
    config.put("local", outputDir.getAbsolutePath());
    config.put("type", "OBR|R5");
    repo.setProperties(config);
    // Add the BundleIndexer plugin
    registry = new MockRegistry();
    BundleIndexerImpl obrIndexer = new BundleIndexerImpl();
    registry.addPlugin(obrIndexer);
    repo.setRegistry(registry);
    repo.setReporter(reporter);
}
Also used : Processor(aQute.bnd.osgi.Processor) HashMap(java.util.HashMap) MockRegistry(test.lib.MockRegistry) IOException(java.io.IOException) BundleIndexerImpl(org.osgi.impl.bundle.bindex.BundleIndexerImpl)

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