use of aQute.bnd.osgi.Analyzer in project bnd by bndtools.
the class ClazzTest method testNoClassBound.
public void testNoClassBound() throws Exception {
try (Analyzer a = new Analyzer()) {
Clazz c = new Clazz(a, "", null);
// From aQute.lib.collections.SortedList.fromIterator()
c.parseDescriptor("<T::Ljava/lang/Comparable<*>;>(Ljava/util/Iterator<TT;>;)LaQute/lib/collections/SortedList<TT;>;", Modifier.PUBLIC);
}
}
use of aQute.bnd.osgi.Analyzer in project bnd by bndtools.
the class ClazzTest method testCaughtExceptions.
public void testCaughtExceptions() throws Exception {
try (Analyzer a = new Analyzer()) {
Clazz c = new Clazz(a, "", null);
c.parseClassFile(new FileInputStream("bin/test/ClazzTest$Catching.class"), new ClassDataCollector() {
});
assertTrue(c.getReferred().toString().contains("org.xml.sax"));
}
}
use of aQute.bnd.osgi.Analyzer in project bnd by bndtools.
the class ClazzTest method testRecursiveAnnotation.
public void testRecursiveAnnotation() throws Exception {
File file = IO.getFile("bin/test/ClazzTest$RecursiveAnno.class");
try (Analyzer analyzer = new Analyzer()) {
Clazz clazz = new Clazz(analyzer, file.getPath(), new FileResource(file));
clazz.parseClassFile();
analyzer.getClassspace().put(clazz.getClassName(), clazz);
AnnotationReader.getDefinition(clazz, analyzer, EnumSet.noneOf(DSAnnotations.Options.class), new XMLAttributeFinder(analyzer), AnnotationReader.V1_3);
}
}
use of aQute.bnd.osgi.Analyzer in project bnd by bndtools.
the class PropertiesTest method testProperties.
public static void testProperties() throws Exception {
Analyzer analyzer = new Analyzer();
analyzer.setProperties(IO.getFile("src/test/variables.mf"));
assertEquals("aQute.test", analyzer.getProperty("Header"));
System.err.println("property " + analyzer.getProperty("Header"));
}
use of aQute.bnd.osgi.Analyzer 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());
}
Aggregations