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"));
}
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"));
}
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();
}
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());
}
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);
}
Aggregations