use of aQute.bnd.osgi.Builder in project bnd by bndtools.
the class VerifierTest method testBundleActivationPolicyGood.
public static void testBundleActivationPolicyGood() 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");
v.build();
assertTrue(v.check());
}
use of aQute.bnd.osgi.Builder in project bnd by bndtools.
the class VerifierTest method testStrict.
/**
* Test the strict flag
*/
public void testStrict() throws Exception {
Builder bmaker = new Builder();
bmaker.addClasspath(IO.getFile("jar/osgi.jar"));
bmaker.addClasspath(new File("bin"));
bmaker.setProperty("Export-Package", "org.osgi.service.eventadmin;version='[1,2)',org.osgi.framework;version=x13,test;-remove-attribute:=version,test.lib;specification-version=12,test.split");
bmaker.setProperty("Import-Package", "foo;version=1,bar;version='[1,x2)',baz;version='[2,1)',baz2;version='(1,1)',*");
bmaker.setProperty("-strict", "true");
bmaker.setProperty("-fixupmessages", "^Exception: ");
Jar jar = bmaker.build();
assertTrue(bmaker.check("\\QInvalid syntax for version: x13, for cmd: range, arguments; [range, [==,+)]\\E", "\\QImport Package org.osgi.framework has an invalid version range syntax ${range;[==,+)}\\E", "\\QNo translation found for macro: range;[==,+)\\E", "\\QExport-Package or -exportcontents refers to missing package 'org.osgi.service.eventadmin'\\E", "Import Package clauses without version range \\(excluding javax\\.\\*\\):", "Import Package bar has an invalid version range syntax \\[1,x2\\)", "Import Package baz2 has an empty version range syntax \\(1,1\\), likely want to use \\[1.0.0,1.0.0\\]", "Import Package baz has an invalid version range syntax \\[2,1\\): java.lang.IllegalArgumentException: Low Range is higher than High Range: 2.0.0-1.0.0", "Import Package clauses which use a version instead of a version range. This imports EVERY later package and not as many expect until the next major number: \\[foo\\]", "Export Package org.osgi.framework version has invalid syntax: x13", "Export Package test.lib uses deprecated specification-version instead of version", "Export Package org.osgi.service.eventadmin version is a range: \\[1,2\\); Exports do not allow for ranges."));
}
use of aQute.bnd.osgi.Builder in project bnd by bndtools.
the class VerifierTest method verifyNamespace.
/**
* Verify that an invalid namespace error is actually an error
*/
public void verifyNamespace() throws Exception {
Builder b = new Builder();
b.setProperty("Require-Capability", "+++,bla.bla");
b.setProperty("Provide-Capability", "===,bla.bla");
b.setIncludeResource("foo;literal='foo'");
Jar inner = b.build();
assertTrue(b.check("The Require-Capability with namespace \\+\\+\\+ is not a symbolic name", "The Provide-Capability with namespace === is not a symbolic name"));
}
use of aQute.bnd.osgi.Builder in project bnd by bndtools.
the class VerifierTest method testnativeCode.
public static void testnativeCode() throws Exception {
Builder b = new Builder();
b.addClasspath(new File("bin"));
b.setProperty("-resourceonly", "true");
b.setProperty("Include-Resource", "native/win32/NTEventLogAppender-1.2.dll;literal='abc'");
b.setProperty("Bundle-NativeCode", "native/win32/NTEventLogAppender-1.2.dll; osname=Win32; processor=x86");
b.build();
Verifier v = new Verifier(b);
v.verifyNative();
System.err.println(v.getErrors());
assertEquals(0, v.getErrors().size());
v.close();
b.close();
}
use of aQute.bnd.osgi.Builder in project bnd by bndtools.
the class ResourcesTest method testCopyToRoot.
public static void testCopyToRoot() throws Exception {
Builder bmaker = new Builder();
Properties p = new Properties();
p.setProperty("-resourceonly", "true");
p.setProperty("Include-Resource", "/=src/test/activator");
bmaker.setProperties(p);
Jar jar = bmaker.build();
for (String s : jar.getResources().keySet()) System.err.println(s);
assertNotNull(jar.getResource("Activator.java"));
assertEquals(0, bmaker.getErrors().size());
assertEquals(0, bmaker.getWarnings().size());
}
Aggregations