use of org.apache.aries.application.modelling.ModelledResourceManager in project aries by apache.
the class OBRResolverTest method generateOBRRepoXML.
private void generateOBRRepoXML(String... bundleFiles) throws Exception {
Set<ModelledResource> mrs = new HashSet<ModelledResource>();
FileOutputStream fout = new FileOutputStream("repository.xml");
RepositoryGenerator repositoryGenerator = context().getService(RepositoryGenerator.class);
ModelledResourceManager modelledResourceManager = context().getService(ModelledResourceManager.class);
for (String fileName : bundleFiles) {
File bundleFile = new File(fileName);
IDirectory jarDir = FileSystem.getFSRoot(bundleFile);
mrs.add(modelledResourceManager.getModelledResource(bundleFile.toURI().toString(), jarDir));
}
repositoryGenerator.generateRepository("Test repo description", mrs, fout);
fout.close();
}
use of org.apache.aries.application.modelling.ModelledResourceManager in project aries by apache.
the class OBRResolverAdvancedTest method generateOBRRepoXML.
private void generateOBRRepoXML(boolean nullURI, String... bundleFiles) throws Exception {
Set<ModelledResource> mrs = new HashSet<ModelledResource>();
FileOutputStream fout = new FileOutputStream("repository.xml");
RepositoryGenerator repositoryGenerator = context().getService(RepositoryGenerator.class);
ModelledResourceManager modelledResourceManager = context().getService(ModelledResourceManager.class);
for (String fileName : bundleFiles) {
File bundleFile = new File(fileName);
IDirectory jarDir = FileSystem.getFSRoot(bundleFile);
String uri = "";
if (!!!nullURI) {
uri = bundleFile.toURI().toString();
}
if ("delete.jar".equals(fileName)) {
jarDir = null;
}
mrs.add(modelledResourceManager.getModelledResource(uri, jarDir));
}
repositoryGenerator.generateRepository("Test repo description", mrs, fout);
fout.close();
}
use of org.apache.aries.application.modelling.ModelledResourceManager in project aries by apache.
the class OBRResolverTest method createAndResolveSelfContainedApp.
private Collection<ModelledResource> createAndResolveSelfContainedApp(String extraImport) throws Exception {
FileOutputStream fout = new FileOutputStream(new File("a.bundle.jar"));
ArchiveFixture.newJar().manifest().attribute(BUNDLE_SYMBOLICNAME, "a.bundle").attribute(BUNDLE_VERSION, "1.0.0").attribute(BUNDLE_MANIFESTVERSION, "2").attribute(IMPORT_PACKAGE, "a.pack.age").end().writeOut(fout);
fout.close();
fout = new FileOutputStream(new File("b.bundle.jar"));
ArchiveFixture.newJar().manifest().attribute(BUNDLE_SYMBOLICNAME, "b.bundle").attribute(BUNDLE_VERSION, "1.0.0").attribute(BUNDLE_MANIFESTVERSION, "2").attribute(IMPORT_PACKAGE, extraImport).attribute(EXPORT_PACKAGE, "a.pack.age").end().writeOut(fout);
fout.close();
ModelledResourceManager mrm = context().getService(ModelledResourceManager.class);
ModelledResource aBundle = mrm.getModelledResource(FileSystem.getFSRoot(new File("a.bundle.jar")));
ModelledResource bBundle = mrm.getModelledResource(FileSystem.getFSRoot(new File("b.bundle.jar")));
AriesApplicationResolver resolver = context().getService(AriesApplicationResolver.class);
return resolver.resolveInIsolation("test.app", "1.0.0", Arrays.asList(aBundle, bBundle), Arrays.<Content>asList(ContentFactory.parseContent("a.bundle", "1.0.0"), ContentFactory.parseContent("b.bundle", "1.0.0")));
}
Aggregations