use of aQute.bnd.osgi.Builder in project bnd by bndtools.
the class ClasspathTest method testBundleClasspath.
/**
* Test if we can refer to the jars on the classpath by their file name (
* ignoring the path)
*
* @throws Exception
*/
public static void testBundleClasspath() throws Exception {
Builder b = new Builder();
b.setProperty("Include-Resource", "bin=bin");
b.setProperty("Bundle-Classpath", "bin");
Jar jar = b.build();
// from
assertNotNull(jar.getResource("bin/test/activator/Activator.class"));
// test.jar
}
use of aQute.bnd.osgi.Builder in project bnd by bndtools.
the class BuilderTest method setup.
public static Manifest setup(Properties p, File f) throws Exception {
File[] cp = { IO.getFile("jar/asm.jar") };
Builder bmaker = new Builder();
if (f != null)
bmaker.setProperties(f);
else
bmaker.setProperties(p);
bmaker.setClasspath(cp);
Jar jar = bmaker.build();
assertTrue(bmaker.check());
Manifest m = jar.getManifest();
return m;
}
use of aQute.bnd.osgi.Builder in project bnd by bndtools.
the class BuilderTest method testConditionalBaseSuper.
/**
* Check Conditional package. First import a subpackage then let the
* subpackage import a super package. This went wrong in the OSGi build. We
* see such a pattern in the Spring jar. The package
* org.springframework.beans.factory.access refers to
* org.springframework.beans.factory and org.springframework.beans. The
*/
public static void testConditionalBaseSuper() throws Exception {
Builder b = new Builder();
try {
b.setProperty(Constants.CONDITIONALPACKAGE, "test.top.*");
b.setProperty(Constants.PRIVATEPACKAGE, "test.top.middle.bottom");
b.addClasspath(new File("bin"));
Jar dot = b.build();
assertTrue(b.check());
assertNotNull(dot.getResource("test/top/middle/bottom/Bottom.class"));
assertNotNull(dot.getResource("test/top/middle/Middle.class"));
assertNotNull(dot.getResource("test/top/Top.class"));
assertFalse(b.getImports().getByFQN("test.top") != null);
assertFalse(b.getImports().getByFQN("test.top.middle") != null);
assertFalse(b.getImports().getByFQN("test.top.middle.bottom") != null);
} finally {
b.close();
}
}
use of aQute.bnd.osgi.Builder in project bnd by bndtools.
the class BuilderTest method testEasymock.
public static void testEasymock() throws Exception {
File[] cp = { IO.getFile("jar/easymock.jar") };
Builder bmaker = new Builder();
try {
Properties p = new Properties();
p.put("Import-Package", "*");
p.put("Export-Package", "*");
p.put("Bundle-SymbolicName", "easymock");
p.put("Bundle-Version", "2.2");
bmaker.setProperties(p);
bmaker.setClasspath(cp);
Jar jar = bmaker.build();
assertTrue(bmaker.check());
jar.getManifest().write(System.err);
} finally {
bmaker.close();
}
}
use of aQute.bnd.osgi.Builder in project bnd by bndtools.
the class BuilderTest method testUpperCasePackage.
/**
* https://github.com/bndtools/bnd/issues/315 Turns out bnd doesn't seem to
* support a class in a capitalized package name. I accidentally called a
* package with a capital letter and I get the strange error message and a
* refusal to build it. (See title for error message) My package could be
* named "Coffee" and the package named "CoffeeClient", The bnd.bnd file
* could have: Private-Package: Coffee I'm running 2.0.0REL with Eclipse
* Juno.
*/
public static void testUpperCasePackage() throws Exception {
Builder b = new Builder();
try {
b.addClasspath(IO.getFile("bin"));
b.setExportPackage("UPPERCASEPACKAGE");
b.build();
assertTrue(b.check());
b.getExports().containsFQN("UPPERCASEPACKAGE");
} finally {
b.close();
}
}
Aggregations