use of aQute.bnd.osgi.Builder in project bnd by bndtools.
the class VerifierPluginTest method testNoVerifierPluginExecution.
public static void testNoVerifierPluginExecution() throws Exception {
final AtomicBoolean executedCheck = new AtomicBoolean(false);
AnalyzerPlugin analyzerPlugin = new AnalyzerPlugin() {
@Override
public boolean analyzeJar(Analyzer analyzer) throws Exception {
// The following is null when AnalyzerPlugins execute
Packages exports = analyzer.getExports();
if (exports == null) {
executedCheck.set(true);
}
return false;
}
};
try (Builder b = new Builder()) {
b.setProperty("Bundle-SymbolicName", "p1");
b.setProperty("Bundle-Version", "1.2.3");
b.setExportPackage("test.activator");
b.addClasspath(new File("bin"));
b.getPlugins().add(analyzerPlugin);
Jar jar = b.build();
}
assertTrue(executedCheck.get());
}
use of aQute.bnd.osgi.Builder in project bnd by bndtools.
the class VerifierPluginTest method testVerifierPluginExecution.
public static void testVerifierPluginExecution() throws Exception {
final AtomicBoolean executedCheck = new AtomicBoolean(false);
VerifierPlugin verifier = new VerifierPlugin() {
@Override
public void verify(Analyzer analyzer) throws Exception {
// the following is true only after the jar and manifest have
// been analyzed
Packages exports = analyzer.getExports();
PackageRef packageRef = analyzer.getPackageRef("test/activator");
if (exports.containsKey(packageRef)) {
executedCheck.set(true);
}
}
};
try (Builder b = new Builder()) {
b.setProperty("Bundle-SymbolicName", "p1");
b.setProperty("Bundle-Version", "1.2.3");
b.setExportPackage("test.activator");
b.addClasspath(new File("bin"));
b.getPlugins().add(verifier);
Jar jar = b.build();
}
assertTrue(executedCheck.get());
}
use of aQute.bnd.osgi.Builder in project bnd by bndtools.
the class VerifierTest method testBundleActivationPolicyMultiple.
public static void testBundleActivationPolicyMultiple() throws Exception {
Builder v = new Builder();
v.setProperty("Private-Package", "test.activator");
v.addClasspath(new File("bin"));
v.setProperty(Constants.BUNDLE_ACTIVATIONPOLICY, "lazy;hello:=1,2");
v.build();
assertTrue(v.check("Bundle-ActivationPolicy has too many arguments lazy;hello:=1,2"));
}
use of aQute.bnd.osgi.Builder in project bnd by bndtools.
the class VerifierTest method testFilePath.
private void testFilePath(String path, String pattern, boolean good) throws Exception {
Builder b = new Builder();
try {
b.setProperty("-includeresource", path + ";literal='x'");
if (pattern != null)
b.setProperty(Constants.INVALIDFILENAMES, pattern);
b.build();
if (good)
assertTrue(b.check());
else
assertTrue(b.check("Invalid file/directory"));
} finally {
b.close();
}
}
use of aQute.bnd.osgi.Builder in project bnd by bndtools.
the class VerifierTest method testBundleActivationPolicyNone.
public static void testBundleActivationPolicyNone() throws Exception {
Builder v = new Builder();
v.setProperty("Private-Package", "test.activator");
v.addClasspath(new File("bin"));
v.build();
assertTrue(v.check());
}
Aggregations