use of aQute.bnd.osgi.Verifier in project bnd by bndtools.
the class BuilderTest method testMissingImportsWithoutDynamicImport.
/**
* #479 I have now tested this locally. Apparently the fix doesn't change
* the reported behavior. In my test bundle, I have removed all imports. Bnd
* builds this with no errors reported. I add: DynamicImport-Package: dummy
*/
public void testMissingImportsWithoutDynamicImport() throws Exception {
Builder b = new Builder();
try {
b.addClasspath(new File("bin"));
b.setPedantic(true);
b.setExportPackage("test.classreference;version=1");
b.setImportPackage("!*");
b.build();
assertTrue(b.check());
Verifier v = new Verifier(b.getJar());
try {
v.verify();
assertTrue(v.check("Unresolved references to \\[javax.swing\\] by class\\(es\\)"));
} finally {
v.close();
}
} finally {
b.close();
}
}
use of aQute.bnd.osgi.Verifier in project bnd by bndtools.
the class BuilderTest method testMissingImportWithRequireBundle.
/**
* A Require-Bundle should not fail on missing imports, just warn
*
* @throws Exception
*/
public void testMissingImportWithRequireBundle() throws Exception {
Builder b = new Builder();
try {
b.addClasspath(new File("bin"));
b.setPedantic(true);
b.setExportPackage("test.classreference;version=1");
b.setImportPackage("!*");
b.setProperty("Require-Bundle", "com.abc");
b.build();
assertTrue(b.check());
Verifier v = new Verifier(b.getJar());
v.verify();
assertTrue(v.check());
} finally {
b.close();
}
}
use of aQute.bnd.osgi.Verifier in project bnd by bndtools.
the class BuilderTest method testMissingImportsWithDynamicImport.
/**
* #479 I have now tested this locally. Apparently the fix doesn't change
* the reported behavior. In my test bundle, I have removed all imports. Bnd
* builds this with no errors reported. I add: DynamicImport-Package: dummy
*/
public void testMissingImportsWithDynamicImport() throws Exception {
Builder b = new Builder();
try {
b.addClasspath(new File("bin"));
b.setPedantic(true);
b.setExportPackage("test.classreference;version=1");
b.setImportPackage("!*");
b.setProperty(Constants.DYNAMICIMPORT_PACKAGE, "dummy");
b.build();
assertTrue(b.check());
Verifier v = new Verifier(b.getJar());
try {
v.verify();
assertTrue(v.check("Unresolved references to \\[javax.swing\\] by class\\(es\\)"));
} finally {
v.close();
}
} finally {
b.close();
}
}
use of aQute.bnd.osgi.Verifier 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.Verifier in project bnd by bndtools.
the class bnd method _verify.
/**
* Verify jars.
*
* @throws Exception
*/
@Description("Verify jars")
public void _verify(verifyOptions opts) throws Exception {
for (String path : opts._arguments()) {
File f = getFile(path);
if (!f.isFile()) {
error("No such file: %s", f);
} else {
Jar jar = new Jar(f);
if (jar.getManifest() == null || jar.getBsn() == null)
error("Not a bundle %s", f);
else {
Verifier v = new Verifier(jar);
getInfo(v, f.getName());
v.close();
}
jar.close();
}
}
}
Aggregations