Search in sources :

Example 1 with AriesApplicationResolver

use of org.apache.aries.application.management.spi.resolve.AriesApplicationResolver 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")));
}
Also used : FileOutputStream(java.io.FileOutputStream) AriesApplicationResolver(org.apache.aries.application.management.spi.resolve.AriesApplicationResolver) File(java.io.File) ModelledResourceManager(org.apache.aries.application.modelling.ModelledResourceManager) ModelledResource(org.apache.aries.application.modelling.ModelledResource)

Aggregations

File (java.io.File)1 FileOutputStream (java.io.FileOutputStream)1 AriesApplicationResolver (org.apache.aries.application.management.spi.resolve.AriesApplicationResolver)1 ModelledResource (org.apache.aries.application.modelling.ModelledResource)1 ModelledResourceManager (org.apache.aries.application.modelling.ModelledResourceManager)1