use of aQute.bnd.osgi.AbstractResource in project felix by apache.
the class JpaPluginTest method assertTransformation.
private void assertTransformation(final String xmlStr, String expectedReqs) throws Exception {
Analyzer analyzer = new Analyzer();
Jar jar = new Jar("the-jar");
Resource xml = new AbstractResource(0) {
@Override
protected byte[] getBytes() throws Exception {
return xmlStr.getBytes();
}
};
JpaPlugin plugin = new JpaPlugin();
jar.putResource("the-persistence-xml", xml);
analyzer.setJar(jar);
analyzer.setProperty("Meta-Persistence", "the-persistence-xml");
plugin.analyzeJar(analyzer);
assertEquals(expectedReqs, analyzer.getProperty("Require-Capability"));
}
use of aQute.bnd.osgi.AbstractResource in project bnd by bndtools.
the class MD5 method make.
@Override
public Resource make(Builder builder, String source, Map<String, String> arguments) throws Exception {
if (!arguments.get("type").equals("md5"))
return null;
source = source.substring(0, source.length() - 4);
final File f = builder.getFile(source);
if (f.isFile()) {
return new AbstractResource(f.lastModified()) {
@Override
public byte[] getBytes() throws Exception {
return md5(f);
}
};
}
throw new FileNotFoundException("No such file: " + source);
}
Aggregations