* are created in the paxweb temp directory, and not in the svn tree
*/
@Before
public static void createApplications() throws Exception
{
ZipFixture bundle = ArchiveFixture.newJar().manifest()
.attribute(Constants.BUNDLE_SYMBOLICNAME, CORE_BUNDLE_BY_VALUE)
.attribute(Constants.BUNDLE_MANIFESTVERSION, "2")
.attribute(Constants.IMPORT_PACKAGE, "a.b.c, p.q.r, x.y.z, javax.naming")
.attribute(Constants.BUNDLE_VERSION, "1.0.0").end();
FileOutputStream fout = new FileOutputStream(CORE_BUNDLE_BY_VALUE + ".jar");
bundle.writeOut(fout);
fout.close();
bundle = ArchiveFixture.newJar().manifest()
.attribute(Constants.BUNDLE_SYMBOLICNAME, TRANSITIVE_BUNDLE_BY_VALUE)
.attribute(Constants.BUNDLE_MANIFESTVERSION, "2")
.attribute(Constants.EXPORT_PACKAGE, "p.q.r")
.attribute(Constants.BUNDLE_VERSION, "1.0.0").end();
fout = new FileOutputStream(TRANSITIVE_BUNDLE_BY_VALUE + ".jar");
bundle.writeOut(fout);
fout.close();
bundle = ArchiveFixture.newJar().manifest()
.attribute(Constants.BUNDLE_SYMBOLICNAME, TRANSITIVE_BUNDLE_BY_REFERENCE)
.attribute(Constants.BUNDLE_MANIFESTVERSION, "2")
.attribute(Constants.EXPORT_PACKAGE, "x.y.z")
.attribute(Constants.BUNDLE_VERSION, "1.0.0").end();
fout = new FileOutputStream(TRANSITIVE_BUNDLE_BY_REFERENCE + ".jar");
bundle.writeOut(fout);
fout.close();
bundle = ArchiveFixture.newJar().manifest()
.attribute(Constants.BUNDLE_SYMBOLICNAME, CORE_BUNDLE_BY_REFERENCE)
.attribute(Constants.BUNDLE_MANIFESTVERSION, "2")
.attribute(Constants.EXPORT_PACKAGE, "d.e.f")
.attribute(Constants.BUNDLE_VERSION, "1.0.0").end();
fout = new FileOutputStream(CORE_BUNDLE_BY_REFERENCE + ".jar");
bundle.writeOut(fout);
fout.close();
bundle = ArchiveFixture.newJar().manifest()
.attribute(Constants.BUNDLE_SYMBOLICNAME, CORE_BUNDLE_BY_REFERENCE)
.attribute(Constants.BUNDLE_MANIFESTVERSION, "2")
.attribute(Constants.EXPORT_PACKAGE, "d.e.f").end();
fout = new FileOutputStream(CORE_BUNDLE_BY_REFERENCE + "_0.0.0.jar");
bundle.writeOut(fout);
fout.close();
// jar up a use bundle
bundle = ArchiveFixture.newJar().manifest()
.attribute(Constants.BUNDLE_SYMBOLICNAME, USE_BUNDLE_BY_REFERENCE)
.attribute(Constants.BUNDLE_MANIFESTVERSION, "2")
.attribute(Constants.EXPORT_PACKAGE, "a.b.c")
.attribute(Constants.BUNDLE_VERSION, "1.0.0").end();
fout = new FileOutputStream(USE_BUNDLE_BY_REFERENCE + ".jar");
bundle.writeOut(fout);
fout.close();
// Create the EBA application
ZipFixture testEba = ArchiveFixture.newZip()
.binary("META-INF/APPLICATION.MF",
OBRResolverAdvancedTest.class.getClassLoader().getResourceAsStream("obr/APPLICATION-UseBundle.MF"))
.end()
.binary(CORE_BUNDLE_BY_VALUE + ".jar", new FileInputStream(CORE_BUNDLE_BY_VALUE + ".jar")).end()
.binary(TRANSITIVE_BUNDLE_BY_VALUE + ".jar", new FileInputStream(TRANSITIVE_BUNDLE_BY_VALUE + ".jar")).end();
fout = new FileOutputStream("demo.eba");
testEba.writeOut(fout);
fout.close();
//create the bundle
bundle = ArchiveFixture.newJar()
.binary("META-INF/MANIFEST.MF", OBRResolverAdvancedTest.class.getClassLoader().getResourceAsStream("obr/aries.bundle1/META-INF/MANIFEST.MF")).end()
.binary("OSGI-INF/blueprint/blueprint.xml", OBRResolverAdvancedTest.class.getClassLoader().getResourceAsStream("obr/hello-world-client.xml")).end()
.binary("OSGI-INF/blueprint/anotherBlueprint.xml", OBRResolverAdvancedTest.class.getClassLoader().getResourceAsStream("obr/aries.bundle1/OSGI-INF/blueprint/sample-blueprint.xml")).end();
fout = new FileOutputStream(REPO_BUNDLE + ".jar");
bundle.writeOut(fout);
fout.close();
///////////////////////////////////////////////
//create an eba with a helloworld client, which get all 'HelloWorld' services
//create a helloworld client
bundle = ArchiveFixture.newJar().manifest()
.attribute(Constants.BUNDLE_SYMBOLICNAME, HELLO_WORLD_CLIENT_BUNDLE)
.attribute(Constants.BUNDLE_MANIFESTVERSION, "2")
.attribute("Import-Package", "org.apache.aries.sample")
.attribute(Constants.BUNDLE_VERSION, "1.0.0").end()
.binary("org/apache/aries/application/helloworld/client/HelloWorldClientImpl.class",
BasicAppManagerTest.class.getClassLoader().getResourceAsStream("org/apache/aries/application/helloworld/client/HelloWorldClientImpl.class"))
.binary("OSGI-INF/blueprint/helloClient.xml",
BasicAppManagerTest.class.getClassLoader().getResourceAsStream("obr/hello-world-client.xml"))
.end();
fout = new FileOutputStream(HELLO_WORLD_CLIENT_BUNDLE + ".jar");
bundle.writeOut(fout);
fout.close();
//create two helloworld services
// create the 1st helloworld service
bundle = ArchiveFixture.newJar().manifest()
.attribute(Constants.BUNDLE_SYMBOLICNAME, HELLO_WORLD_SERVICE_BUNDLE1)
.attribute(Constants.BUNDLE_MANIFESTVERSION, "2")
.attribute("Import-Package", "org.apache.aries.sample")
.attribute(Constants.BUNDLE_VERSION, "1.0.0").end()
.binary("org/apache/aries/sample/impl/HelloWorldImpl.class",
BasicAppManagerTest.class.getClassLoader().getResourceAsStream("org/apache/aries/sample/impl/HelloWorldImpl.class"))
.binary("OSGI-INF/blueprint/sample-blueprint.xml",
BasicAppManagerTest.class.getClassLoader().getResourceAsStream("basic/sample-blueprint.xml"))
.end();
//create the 2nd helloworld service
fout = new FileOutputStream(HELLO_WORLD_SERVICE_BUNDLE1 + ".jar");
bundle.writeOut(fout);
fout.close();
bundle = ArchiveFixture.newJar().manifest()
.attribute(Constants.BUNDLE_SYMBOLICNAME, HELLO_WORLD_SERVICE_BUNDLE2)
.attribute(Constants.BUNDLE_MANIFESTVERSION, "2")
.attribute("Import-Package", "org.apache.aries.sample")
.attribute(Constants.BUNDLE_VERSION, "1.0.0").end()
.binary("org/apache/aries/sample/impl/HelloWorldImpl.class",
BasicAppManagerTest.class.getClassLoader().getResourceAsStream("org/apache/aries/sample/impl/HelloWorldImpl.class"))
.binary("OSGI-INF/blueprint/sample-blueprint.xml",
BasicAppManagerTest.class.getClassLoader().getResourceAsStream("basic/sample-blueprint.xml"))
.end();
fout = new FileOutputStream(HELLO_WORLD_SERVICE_BUNDLE2 + ".jar");
bundle.writeOut(fout);
fout.close();
//Create a helloworld eba with the client included
ZipFixture multiServiceHelloEba = ArchiveFixture.newZip()
.binary(HELLO_WORLD_CLIENT_BUNDLE + ".jar", new FileInputStream(HELLO_WORLD_CLIENT_BUNDLE + ".jar")).end();
fout = new FileOutputStream("hello.eba");
multiServiceHelloEba.writeOut(fout);
fout.close();
}