aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbono...@apache.org
Subject svn commit: r1602442 [2/4] - in /aries/trunk/application/application-itests: ./ src/test/java/org/apache/aries/application/runtime/itests/ src/test/java/org/apache/aries/isolated/config/ src/test/java/org/ops4j/pax/runner/platform/equinox/internal/ src...
Date Fri, 13 Jun 2014 14:26:32 GMT
Modified: aries/trunk/application/application-itests/src/test/java/org/apache/aries/application/runtime/itests/IsolatedRuntimeTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/application/application-itests/src/test/java/org/apache/aries/application/runtime/itests/IsolatedRuntimeTest.java?rev=1602442&r1=1602441&r2=1602442&view=diff
==============================================================================
--- aries/trunk/application/application-itests/src/test/java/org/apache/aries/application/runtime/itests/IsolatedRuntimeTest.java (original)
+++ aries/trunk/application/application-itests/src/test/java/org/apache/aries/application/runtime/itests/IsolatedRuntimeTest.java Fri Jun 13 14:26:31 2014
@@ -18,15 +18,11 @@
  */
 package org.apache.aries.application.runtime.itests;
 
-import static org.apache.aries.itest.ExtraOptions.flatOptions;
-import static org.apache.aries.itest.ExtraOptions.mavenBundle;
-import static org.apache.aries.itest.ExtraOptions.paxLogging;
-import static org.apache.aries.itest.ExtraOptions.testOptions;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
-import static org.ops4j.pax.exam.container.def.PaxRunnerOptions.repository;
+import static org.ops4j.pax.exam.CoreOptions.*;
 
 import java.io.File;
 import java.io.FileOutputStream;
@@ -48,312 +44,310 @@ import org.apache.aries.util.filesystem.
 import org.apache.aries.util.manifest.ManifestHeaderProcessor;
 import org.apache.felix.bundlerepository.RepositoryAdmin;
 import org.junit.Before;
+import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.Configuration;
 import org.ops4j.pax.exam.Option;
-import org.ops4j.pax.exam.container.def.PaxRunnerOptions;
-import org.ops4j.pax.exam.junit.MavenConfiguredJUnit4TestRunner;
+import org.ops4j.pax.exam.junit.PaxExam;
+import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
+import org.ops4j.pax.exam.spi.reactors.PerClass;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleEvent;
 import org.osgi.framework.SynchronousBundleListener;
 import org.osgi.service.framework.CompositeBundle;
 
-@RunWith(MavenConfiguredJUnit4TestRunner.class)
+@RunWith(PaxExam.class)
+@ExamReactorStrategy(PerClass.class)
 public class IsolatedRuntimeTest extends AbstractIntegrationTest {
-  
-  /* Use @Before not @BeforeClass so as to ensure that these resources
-   * are created in the paxweb temp directory, and not in the svn tree 
-   */
-  static boolean createdApplications = false;
-  @Before
-  public static void createApplications() throws Exception {
-       
-    if (createdApplications) { 
-      return;
+
+    /* Use @Before not @BeforeClass so as to ensure that these resources
+     * are created in the paxweb temp directory, and not in the svn tree
+     */
+    static boolean createdApplications = false;
+
+    @Before
+    public void createApplications() throws Exception {
+
+        if (createdApplications) {
+            return;
+        }
+        ZipFixture testEba = ArchiveFixture.newZip()
+                .jar("sample.jar")
+                .manifest().symbolicName("org.apache.aries.isolated.sample")
+                .attribute("Bundle-Version", "1.0.0")
+                .attribute("Import-Package", "org.osgi.service.blueprint, org.apache.aries.isolated.shared")
+                        // needed for testFrameworkResolvedBeforeInnerBundlesStart()
+                .attribute("Bundle-ActivationPolicy", "lazy")
+                .end()
+                .binary("org/apache/aries/isolated/sample/HelloWorld.class",
+                        IsolatedRuntimeTest.class.getClassLoader().getResourceAsStream("org/apache/aries/isolated/sample/HelloWorld.class"))
+                .binary("org/apache/aries/isolated/sample/HelloWorldImpl.class",
+                        IsolatedRuntimeTest.class.getClassLoader().getResourceAsStream("org/apache/aries/isolated/sample/HelloWorldImpl.class"))
+                .binary("org/apache/aries/isolated/sample/SharedImpl.class",
+                        IsolatedRuntimeTest.class.getClassLoader().getResourceAsStream("org/apache/aries/isolated/sample/SharedImpl.class"))
+                .binary("OSGI-INF/blueprint/sample-blueprint.xml",
+                        IsolatedRuntimeTest.class.getClassLoader().getResourceAsStream("isolated/sample-blueprint.xml"))
+                .end()
+                .jar("shared.jar")
+                .manifest().symbolicName("org.apache.aries.isolated.shared")
+                .attribute("Bundle-Version", "1.0.0")
+                .attribute("Export-Package", "org.apache.aries.isolated.shared")
+                .end()
+                .binary("org/apache/aries/isolated/shared/Shared.class",
+                        IsolatedRuntimeTest.class.getClassLoader().getResourceAsStream("org/apache/aries/isolated/shared/Shared.class"))
+                .end();
+
+        FileOutputStream fout = new FileOutputStream("test.eba");
+        testEba.writeOut(fout);
+        fout.close();
+
+        ZipFixture testEba2 = testEba.binary("META-INF/APPLICATION.MF",
+                IsolatedRuntimeTest.class.getClassLoader().getResourceAsStream("isolated/APPLICATION.MF"))
+                .end();
+        fout = new FileOutputStream("test2.eba");
+        testEba2.writeOut(fout);
+        fout.close();
+
+        ZipFixture sampleJar2 = ArchiveFixture.newJar()
+                .manifest().symbolicName("org.apache.aries.isolated.sample")
+                .attribute("Bundle-Version", "2.0.0")
+                .end()
+                .binary("org/apache/aries/isolated/sample/HelloWorld.class",
+                        IsolatedRuntimeTest.class.getClassLoader().getResourceAsStream("org/apache/aries/isolated/sample/HelloWorld.class"))
+                .binary("org/apache/aries/isolated/sample/HelloWorldImpl.class",
+                        IsolatedRuntimeTest.class.getClassLoader().getResourceAsStream("org/apache/aries/isolated/sample/HelloWorldImpl.class"))
+                .binary("OSGI-INF/blueprint/aries.xml",
+                        IsolatedRuntimeTest.class.getClassLoader().getResourceAsStream("isolated/sample2-blueprint.xml"))
+                .end();
+
+        fout = new FileOutputStream("sample_2.0.0.jar");
+        sampleJar2.writeOut(fout);
+        fout.close();
+
+        ZipFixture ebaWithFragment = ArchiveFixture.newZip()
+                .jar("sample.jar")
+                .manifest().symbolicName("org.apache.aries.isolated.sample")
+                .attribute("Bundle-Version", "1.0.0")
+                .end()
+                .end()
+                .jar("fragment.jar")
+                .manifest().symbolicName("org.apache.aries.isolated.fragment")
+                .attribute("Bundle-Version", "1.0.0")
+                .attribute("Fragment-Host", "org.apache.aries.isolated.sample")
+                .end()
+                .binary("org/apache/aries/isolated/sample/HelloWorld.class",
+                        IsolatedRuntimeTest.class.getClassLoader().getResourceAsStream("org/apache/aries/isolated/sample/HelloWorld.class"))
+                .binary("org/apache/aries/isolated/sample/HelloWorldImpl.class",
+                        IsolatedRuntimeTest.class.getClassLoader().getResourceAsStream("org/apache/aries/isolated/sample/HelloWorldImpl.class"))
+                .binary("OSGI-INF/blueprint/sample-blueprint.xml",
+                        IsolatedRuntimeTest.class.getClassLoader().getResourceAsStream("isolated/sample-blueprint.xml"))
+                .end();
+
+        fout = new FileOutputStream("withFragment.eba");
+        ebaWithFragment.writeOut(fout);
+        fout.close();
+
+        createdApplications = true;
+    }
+
+    @Test
+    @Ignore
+    public void testAppWithoutApplicationManifest() throws Exception {
+
+        AriesApplicationManager manager = context().getService(AriesApplicationManager.class);
+        AriesApplication app = manager.createApplication(FileSystem.getFSRoot(new File("test.eba")));
+        AriesApplicationContext ctx = manager.install(app);
+
+        ctx.start();
+        assertHelloWorldService("test.eba");
+
+        manager.uninstall(ctx);
+    }
+
+    @Test
+    @Ignore
+    public void testAppWithApplicationManifest() throws Exception {
+
+        AriesApplicationManager manager = context().getService(AriesApplicationManager.class);
+        AriesApplication app = manager.createApplication(FileSystem.getFSRoot(new File("test2.eba")));
+        AriesApplicationContext ctx = manager.install(app);
+
+        ctx.start();
+        assertHelloWorldService("org.apache.aries.sample2");
+
+        manager.uninstall(ctx);
+    }
+
+    @Test
+    @Ignore
+    public void testUninstallReinstall() throws Exception {
+
+        AriesApplicationManager manager = context().getService(AriesApplicationManager.class);
+        AriesApplication app = manager.createApplication(FileSystem.getFSRoot(new File("test2.eba")));
+        AriesApplicationContext ctx = manager.install(app);
+
+        app = ctx.getApplication();
+
+        ctx.start();
+
+        assertHelloWorldService("org.apache.aries.sample2");
+
+        ctx.stop();
+        manager.uninstall(ctx);
+
+        assertNull(IsolationTestUtils.findIsolatedAppBundleContext(bundleContext, "org.apache.aries.sample2"));
+
+        ctx = manager.install(app);
+        ctx.start();
+
+        assertHelloWorldService("org.apache.aries.sample2");
+
+        manager.uninstall(ctx);
+    }
+
+    @Test
+    @Ignore
+    public void testAppWithFragment() throws Exception {
+        AriesApplicationManager manager = context().getService(AriesApplicationManager.class);
+        AriesApplication app = manager.createApplication(FileSystem.getFSRoot(new File("withFragment.eba")));
+        AriesApplicationContext ctx = manager.install(app);
+
+        ctx.start();
+
+        assertHelloWorldService("withFragment.eba");
+
+        manager.uninstall(ctx);
     }
-    ZipFixture testEba = ArchiveFixture.newZip()
-      .jar("sample.jar")
-        .manifest().symbolicName("org.apache.aries.isolated.sample")
-          .attribute("Bundle-Version", "1.0.0")
-          .attribute("Import-Package", "org.osgi.service.blueprint, org.apache.aries.isolated.shared")
-          // needed for testFrameworkResolvedBeforeInnerBundlesStart()
-          .attribute("Bundle-ActivationPolicy", "lazy")
-          .end()
-        .binary("org/apache/aries/isolated/sample/HelloWorld.class", 
-            IsolatedRuntimeTest.class.getClassLoader().getResourceAsStream("org/apache/aries/isolated/sample/HelloWorld.class"))
-        .binary("org/apache/aries/isolated/sample/HelloWorldImpl.class", 
-            IsolatedRuntimeTest.class.getClassLoader().getResourceAsStream("org/apache/aries/isolated/sample/HelloWorldImpl.class"))
-        .binary("org/apache/aries/isolated/sample/SharedImpl.class", 
-            IsolatedRuntimeTest.class.getClassLoader().getResourceAsStream("org/apache/aries/isolated/sample/SharedImpl.class"))
-        .binary("OSGI-INF/blueprint/sample-blueprint.xml", 
-            IsolatedRuntimeTest.class.getClassLoader().getResourceAsStream("isolated/sample-blueprint.xml"))
-        .end()
-      .jar("shared.jar")
-        .manifest().symbolicName("org.apache.aries.isolated.shared")
-          .attribute("Bundle-Version", "1.0.0")
-          .attribute("Export-Package", "org.apache.aries.isolated.shared")
-        .end()
-        .binary("org/apache/aries/isolated/shared/Shared.class",
-            IsolatedRuntimeTest.class.getClassLoader().getResourceAsStream("org/apache/aries/isolated/shared/Shared.class"))
-        .end();
-      
-    FileOutputStream fout = new FileOutputStream("test.eba");
-    testEba.writeOut(fout);
-    fout.close();
-    
-    ZipFixture testEba2 = testEba.binary("META-INF/APPLICATION.MF", 
-        IsolatedRuntimeTest.class.getClassLoader().getResourceAsStream("isolated/APPLICATION.MF"))
-        .end();
-    fout = new FileOutputStream("test2.eba");
-    testEba2.writeOut(fout);
-    fout.close();
-    
-    ZipFixture sampleJar2 = ArchiveFixture.newJar()
-      .manifest().symbolicName("org.apache.aries.isolated.sample")
-        .attribute("Bundle-Version", "2.0.0")
-      .end()
-      .binary("org/apache/aries/isolated/sample/HelloWorld.class", 
-          IsolatedRuntimeTest.class.getClassLoader().getResourceAsStream("org/apache/aries/isolated/sample/HelloWorld.class"))
-      .binary("org/apache/aries/isolated/sample/HelloWorldImpl.class", 
-          IsolatedRuntimeTest.class.getClassLoader().getResourceAsStream("org/apache/aries/isolated/sample/HelloWorldImpl.class"))
-      .binary("OSGI-INF/blueprint/aries.xml", 
-          IsolatedRuntimeTest.class.getClassLoader().getResourceAsStream("isolated/sample2-blueprint.xml"))
-      .end();
-  
-    fout = new FileOutputStream("sample_2.0.0.jar");
-    sampleJar2.writeOut(fout);
-    fout.close();
-    
-    ZipFixture ebaWithFragment = ArchiveFixture.newZip()
-      .jar("sample.jar")
-        .manifest().symbolicName("org.apache.aries.isolated.sample")
-          .attribute("Bundle-Version", "1.0.0")
-          .end()
-      .end()
-      .jar("fragment.jar")
-        .manifest().symbolicName("org.apache.aries.isolated.fragment")
-          .attribute("Bundle-Version", "1.0.0")
-          .attribute("Fragment-Host", "org.apache.aries.isolated.sample")
-        .end()
-        .binary("org/apache/aries/isolated/sample/HelloWorld.class", 
-            IsolatedRuntimeTest.class.getClassLoader().getResourceAsStream("org/apache/aries/isolated/sample/HelloWorld.class"))
-        .binary("org/apache/aries/isolated/sample/HelloWorldImpl.class", 
-            IsolatedRuntimeTest.class.getClassLoader().getResourceAsStream("org/apache/aries/isolated/sample/HelloWorldImpl.class"))
-        .binary("OSGI-INF/blueprint/sample-blueprint.xml", 
-            IsolatedRuntimeTest.class.getClassLoader().getResourceAsStream("isolated/sample-blueprint.xml"))
-        .end();
-    
-    fout = new FileOutputStream("withFragment.eba");
-    ebaWithFragment.writeOut(fout);
-    fout.close();
-    
-    createdApplications = true;
-  }
-  
-  @Test
-  public void testAppWithoutApplicationManifest() throws Exception {
-    
-    AriesApplicationManager manager = context().getService(AriesApplicationManager.class);
-    AriesApplication app = manager.createApplication(FileSystem.getFSRoot(new File("test.eba")));
-    AriesApplicationContext ctx = manager.install(app);
-    
-    ctx.start();
-    assertHelloWorldService("test.eba");
-    
-    manager.uninstall(ctx);
-  }
-  
-  @Test
-  public void testAppWithApplicationManifest() throws Exception {
-        
-    AriesApplicationManager manager = context().getService(AriesApplicationManager.class);
-    AriesApplication app = manager.createApplication(FileSystem.getFSRoot(new File("test2.eba")));
-    AriesApplicationContext ctx = manager.install(app);
-    
-    ctx.start();
-    assertHelloWorldService("org.apache.aries.sample2");
-    
-    manager.uninstall(ctx);
-  }
-  
-  @Test
-  public void testUninstallReinstall() throws Exception {
-    
-    AriesApplicationManager manager = context().getService(AriesApplicationManager.class);
-    AriesApplication app = manager.createApplication(FileSystem.getFSRoot(new File("test2.eba")));
-    AriesApplicationContext ctx = manager.install(app);
-    
-    app = ctx.getApplication();
-
-    ctx.start();
-
-    assertHelloWorldService("org.apache.aries.sample2");
-
-    ctx.stop();
-    manager.uninstall(ctx);
-    
-    assertNull(IsolationTestUtils.findIsolatedAppBundleContext(bundleContext, "org.apache.aries.sample2"));
-
-    ctx = manager.install(app);
-    ctx.start();
-
-    assertHelloWorldService("org.apache.aries.sample2");
-    
-    manager.uninstall(ctx);
-  }
-  
-  @Test
-  public void testAppWithFragment() throws Exception
-  {
-    AriesApplicationManager manager = context().getService(AriesApplicationManager.class);
-    AriesApplication app = manager.createApplication(FileSystem.getFSRoot(new File("withFragment.eba")));
-    AriesApplicationContext ctx = manager.install(app);
-
-    ctx.start();
-    
-    assertHelloWorldService("withFragment.eba");
-    
-    manager.uninstall(ctx);
-  }
-
-  @Test
-  public void testAppWithGlobalRepositoryBundle() throws Exception
-  {
-    AriesApplicationManager manager = context().getService(AriesApplicationManager.class);
-    AriesApplication app = manager.createApplication(FileSystem.getFSRoot(new File("test2.eba")));
-    
-    IsolationTestUtils.prepareSampleBundleV2(bundleContext, 
-        context().getService(RepositoryGenerator.class), 
-        context().getService(RepositoryAdmin.class), 
-        context().getService(ModellingManager.class));
-
-    AriesApplication newApp = manager.resolve(app, new ResolveConstraint() {
-      @Override
-	public String getBundleName() {
-        return "org.apache.aries.isolated.sample";
-      }
-
-      @Override
-	public VersionRange getVersionRange() {
-        return ManifestHeaderProcessor.parseVersionRange("[2.0.0,2.0.0]", true);
-      }
-    });
-    
-    AriesApplicationContext ctx = manager.install(newApp);
-    ctx.start();
-    
-    assertHelloWorldService("org.apache.aries.sample2", "hello brave new world");
-    
-    manager.uninstall(ctx);
-  }  
-  
-  @Test
-  public void testFrameworkResolvedBeforeInnerBundlesStart() throws Exception {
+
+    @Test
+    @Ignore
+    public void testAppWithGlobalRepositoryBundle() throws Exception {
+        AriesApplicationManager manager = context().getService(AriesApplicationManager.class);
+        AriesApplication app = manager.createApplication(FileSystem.getFSRoot(new File("test2.eba")));
+
+        IsolationTestUtils.prepareSampleBundleV2(bundleContext,
+                context().getService(RepositoryGenerator.class),
+                context().getService(RepositoryAdmin.class),
+                context().getService(ModellingManager.class));
+
+        AriesApplication newApp = manager.resolve(app, new ResolveConstraint() {
+            @Override
+            public String getBundleName() {
+                return "org.apache.aries.isolated.sample";
+            }
+
+            @Override
+            public VersionRange getVersionRange() {
+                return ManifestHeaderProcessor.parseVersionRange("[2.0.0,2.0.0]", true);
+            }
+        });
+
+        AriesApplicationContext ctx = manager.install(newApp);
+        ctx.start();
+
+        assertHelloWorldService("org.apache.aries.sample2", "hello brave new world");
+
+        manager.uninstall(ctx);
+    }
+
+    @Test
+    @Ignore
+    public void testFrameworkResolvedBeforeInnerBundlesStart() throws Exception {
       /*
        * Lazy bundles have in the past triggered recursive bundle trackers to handle them before
        * the composite bundle framework was even resolved. In such a case the below loadClass
        * operation on a class that depends on a class imported from the outside of the composite 
        * will fail with an NPE.
        */
-      
-      final AtomicBoolean loadedClass = new AtomicBoolean(false);
-      
-      context().addBundleListener(new SynchronousBundleListener() {
-        public void bundleChanged(BundleEvent event) {
-            Bundle b = event.getBundle();
-            if (event.getType() == BundleEvent.STARTING || event.getType() == BundleEvent.LAZY_ACTIVATION) {
-                if (b.getEntry("org/apache/aries/isolated/sample/SharedImpl.class") != null) {
-                    try {
-                        Class<?> cl = b.loadClass("org.apache.aries.isolated.sample.SharedImpl");
-                        cl.newInstance();
-                        loadedClass.set(true);
-                    } catch (Exception e) {
-                        e.printStackTrace();
-                        throw new RuntimeException(e);
+
+        final AtomicBoolean loadedClass = new AtomicBoolean(false);
+
+        context().addBundleListener(new SynchronousBundleListener() {
+            public void bundleChanged(BundleEvent event) {
+                Bundle b = event.getBundle();
+                if (event.getType() == BundleEvent.STARTING || event.getType() == BundleEvent.LAZY_ACTIVATION) {
+                    if (b.getEntry("org/apache/aries/isolated/sample/SharedImpl.class") != null) {
+                        try {
+                            Class<?> cl = b.loadClass("org.apache.aries.isolated.sample.SharedImpl");
+                            cl.newInstance();
+                            loadedClass.set(true);
+                        } catch (Exception e) {
+                            e.printStackTrace();
+                            throw new RuntimeException(e);
+                        }
                     }
+                } else if (event.getType() == BundleEvent.INSTALLED && b instanceof CompositeBundle) {
+                    ((CompositeBundle) b).getCompositeFramework().getBundleContext().addBundleListener(this);
                 }
-            } else if (event.getType() == BundleEvent.INSTALLED && b instanceof CompositeBundle) {
-                ((CompositeBundle) b).getCompositeFramework().getBundleContext().addBundleListener(this);
             }
+        });
+
+        AriesApplicationManager manager = context().getService(AriesApplicationManager.class);
+        AriesApplication app = manager.createApplication(FileSystem.getFSRoot(new File("test2.eba")));
+        AriesApplicationContext ctx = manager.install(app);
+
+        try {
+            ctx.start();
+
+            app = ctx.getApplication();
+            assertEquals(1, app.getDeploymentMetadata().getApplicationDeploymentContents().size());
+            assertEquals(1, app.getDeploymentMetadata().getApplicationProvisionBundles().size());
+            assertTrue(loadedClass.get());
+        } finally {
+            manager.uninstall(ctx);
         }
-    });
-      
-    AriesApplicationManager manager = context().getService(AriesApplicationManager.class);
-    AriesApplication app = manager.createApplication(FileSystem.getFSRoot(new File("test2.eba")));
-    AriesApplicationContext ctx = manager.install(app);      
-    
-    try {
-        ctx.start();
-        
-        app = ctx.getApplication();
-        assertEquals(1, app.getDeploymentMetadata().getApplicationDeploymentContents().size());
-        assertEquals(1, app.getDeploymentMetadata().getApplicationProvisionBundles().size());
-        assertTrue(loadedClass.get());
-    } finally {
-        manager.uninstall(ctx);
     }
-  }
-  
-  private void assertHelloWorldService(String appName) throws Exception
-  {
-    assertHelloWorldService(appName, "hello world");
-  }
-  
-  private void assertHelloWorldService(String appName, String message) throws Exception
-  {
-    HelloWorld hw = IsolationTestUtils.findHelloWorldService(bundleContext, appName);
-    assertNotNull("The Hello World service could not be found.", hw);
-    assertEquals(message, hw.getMessage());
-  }
-  
-  private static Option[] generalConfiguration() {
-    return flatOptions(
-        repository( "http://repository.ops4j.org/maven2" ),
-        
-        paxLogging("DEBUG"),
-
-        // do not provision against the local runtime
-        // Bundles
-        mavenBundle("org.apache.aries.blueprint", "org.apache.aries.blueprint"),
-        mavenBundle("org.ow2.asm", "asm-all"),
-        mavenBundle("org.apache.aries.proxy", "org.apache.aries.proxy"),
-        mavenBundle("org.apache.aries.transaction", "org.apache.aries.transaction.blueprint"),
-        mavenBundle("org.apache.aries", "org.apache.aries.util"),
-        mavenBundle("org.apache.aries.application", "org.apache.aries.application.api"),
-        mavenBundle("org.apache.aries.application", "org.apache.aries.application.utils"),
-        mavenBundle("org.apache.aries.application", "org.apache.aries.application.default.local.platform"),
-        mavenBundle("org.apache.aries.application", "org.apache.aries.application.modeller"),
-        mavenBundle("org.apache.felix", "org.apache.felix.bundlerepository"),
-        mavenBundle("org.apache.aries.application", "org.apache.aries.application.resolver.obr"),
-        mavenBundle("org.apache.aries.application", "org.apache.aries.application.deployment.management"),
-        mavenBundle("org.apache.aries.application", "org.apache.aries.application.management"),
-        mavenBundle("org.apache.aries.application", "org.apache.aries.application.runtime.isolated"),
-        mavenBundle("org.apache.aries.application", "org.apache.aries.application.runtime.framework"),
-        mavenBundle("org.apache.aries.application", "org.apache.aries.application.runtime.framework.management"),
-        mavenBundle("org.apache.aries.application", "org.apache.aries.application.runtime.repository"),
-        mavenBundle("org.osgi", "org.osgi.compendium"),
-        mavenBundle("org.apache.geronimo.specs","geronimo-jta_1.1_spec")
-
-        /* For debugging, uncommenting the following two lines and add the imports */
-        /*
-         * vmOption ("-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5011"),
-        waitForFrameworkStartup(),*/
-//        vmOption ("-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5011"),
-        /*
-         * and add these imports:
-        import static org.ops4j.pax.exam.CoreOptions.waitForFrameworkStartup;
-        import static org.ops4j.pax.exam.container.def.PaxRunnerOptions.vmOption;
-         */
-          );
-  }
-  
-  @org.ops4j.pax.exam.junit.Configuration
-  public static Option[] configuration()
-  {
-	  return testOptions(
-			  generalConfiguration(),
-			  PaxRunnerOptions.rawPaxRunnerOption("config", "classpath:ss-runner.properties")        
-	          );
-  }
+
+    private void assertHelloWorldService(String appName) throws Exception {
+        assertHelloWorldService(appName, "hello world");
+    }
+
+    private void assertHelloWorldService(String appName, String message) throws Exception {
+        HelloWorld hw = IsolationTestUtils.findHelloWorldService(bundleContext, appName);
+        assertNotNull("The Hello World service could not be found.", hw);
+        assertEquals(message, hw.getMessage());
+    }
+
+    @Configuration
+    public static Option[] configuration() {
+        return options(
+
+                // framework / core bundles
+                mavenBundle("org.osgi", "org.osgi.core").versionAsInProject(),
+                mavenBundle("org.osgi", "org.osgi.compendium").versionAsInProject(),
+                mavenBundle("org.ops4j.pax.logging", "pax-logging-api").versionAsInProject(),
+                mavenBundle("org.ops4j.pax.logging", "pax-logging-service").versionAsInProject(),
+
+                // Repository
+                repository("http://repository.ops4j.org/maven2"),
+
+                // Logging
+                systemProperty("org.ops4j.pax.logging.DefaultServiceLog.level").value("INFO"),
+
+                // Bundles
+                junitBundles(),
+                mavenBundle("org.apache.aries.testsupport", "org.apache.aries.testsupport.unit").versionAsInProject(),
+
+                // Bundles
+                mavenBundle("org.apache.aries.blueprint", "org.apache.aries.blueprint").versionAsInProject(),
+                mavenBundle("org.ow2.asm", "asm-all").versionAsInProject(),
+                mavenBundle("org.apache.aries.proxy", "org.apache.aries.proxy").versionAsInProject(),
+                mavenBundle("org.apache.aries.transaction", "org.apache.aries.transaction.blueprint").versionAsInProject(),
+                mavenBundle("org.apache.aries", "org.apache.aries.util").versionAsInProject(),
+                mavenBundle("org.apache.aries.application", "org.apache.aries.application.api").versionAsInProject(),
+                mavenBundle("org.apache.aries.application", "org.apache.aries.application.utils").versionAsInProject(),
+                mavenBundle("org.apache.aries.application", "org.apache.aries.application.default.local.platform").versionAsInProject(),
+                mavenBundle("org.apache.aries.application", "org.apache.aries.application.modeller").versionAsInProject(),
+                mavenBundle("org.apache.felix", "org.apache.felix.bundlerepository").versionAsInProject(),
+                mavenBundle("org.apache.aries.application", "org.apache.aries.application.resolver.obr").versionAsInProject(),
+                mavenBundle("org.apache.aries.application", "org.apache.aries.application.deployment.management").versionAsInProject(),
+                mavenBundle("org.apache.aries.application", "org.apache.aries.application.management").versionAsInProject(),
+                mavenBundle("org.apache.aries.application", "org.apache.aries.application.runtime.isolated").versionAsInProject(),
+                mavenBundle("org.apache.aries.application", "org.apache.aries.application.runtime.framework").versionAsInProject(),
+                mavenBundle("org.apache.aries.application", "org.apache.aries.application.runtime.framework.management").versionAsInProject(),
+                mavenBundle("org.apache.aries.application", "org.apache.aries.application.runtime.repository").versionAsInProject(),
+                mavenBundle("org.apache.geronimo.specs", "geronimo-jta_1.1_spec").versionAsInProject());
+    }
 
 }

Modified: aries/trunk/application/application-itests/src/test/java/org/apache/aries/application/runtime/itests/MinimumImportsTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/application/application-itests/src/test/java/org/apache/aries/application/runtime/itests/MinimumImportsTest.java?rev=1602442&r1=1602441&r2=1602442&view=diff
==============================================================================
--- aries/trunk/application/application-itests/src/test/java/org/apache/aries/application/runtime/itests/MinimumImportsTest.java (original)
+++ aries/trunk/application/application-itests/src/test/java/org/apache/aries/application/runtime/itests/MinimumImportsTest.java Fri Jun 13 14:26:31 2014
@@ -18,11 +18,9 @@
  */
 package org.apache.aries.application.runtime.itests;
 
-import static org.apache.aries.itest.ExtraOptions.mavenBundle;
-import static org.apache.aries.itest.ExtraOptions.paxLogging;
-import static org.apache.aries.itest.ExtraOptions.testOptions;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
+import static org.ops4j.pax.exam.CoreOptions.*;
 
 import java.io.BufferedReader;
 import java.io.File;
@@ -43,169 +41,165 @@ import org.apache.felix.bundlerepository
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.Configuration;
 import org.ops4j.pax.exam.Option;
-import org.ops4j.pax.exam.container.def.PaxRunnerOptions;
-import org.ops4j.pax.exam.junit.MavenConfiguredJUnit4TestRunner;
+import org.ops4j.pax.exam.junit.PaxExam;
+import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
+import org.ops4j.pax.exam.spi.reactors.PerClass;
 import org.osgi.framework.Constants;
 import org.osgi.framework.ServiceRegistration;
 import org.osgi.service.blueprint.container.BlueprintEvent;
 import org.osgi.service.blueprint.container.BlueprintListener;
 
-@RunWith(MavenConfiguredJUnit4TestRunner.class)
+@RunWith(PaxExam.class)
+@ExamReactorStrategy(PerClass.class)
 public class MinimumImportsTest extends AbstractIntegrationTest {
 
-  /* Use @Before not @BeforeClass so as to ensure that these resources
-   * are created in the paxweb temp directory, and not in the svn tree 
-   */
-  static boolean createdApplications = false;
-  static String fake_app_management = "application.management.fake";
-  @Before
-  public static void createApplications() throws Exception {
+    /* Use @Before not @BeforeClass so as to ensure that these resources
+     * are created in the paxweb temp directory, and not in the svn tree
+     */
+    static boolean createdApplications = false;
+    static String fake_app_management = "application.management.fake";
 
-    if (createdApplications) { 
-      return;
-    }
+    @Before
+    public void createApplications() throws Exception {
 
-    // need to fake a application manager to export the service in order to pass the resolving for the client
-    // In the real situation, we don't allow customers' bundles to explicitly import the runtime services.
-    ZipFixture bundle = ArchiveFixture.newJar().manifest()
-    .attribute(Constants.BUNDLE_SYMBOLICNAME, fake_app_management)
-    .attribute(Constants.BUNDLE_MANIFESTVERSION, "2")
-    .attribute(Constants.BUNDLE_VERSION, "1.0.0").end();
-
-    OutputStream out = new FileOutputStream(fake_app_management + ".jar");
-    bundle.writeOut(out);
-    out.close();
-
-
-    ZipFixture testEba = ArchiveFixture.newZip()
-    .jar("org.apache.aries.application.itests.minimports.jar")
-    .manifest().symbolicName("org.apache.aries.application.itests.minimports")
-    .attribute("Bundle-Version", "1.0.0")
-    .attribute("Import-Package", "org.apache.aries.application.management")
-    .end()
-    .binary("org/apache/aries/application/sample/appmgrclient/AppMgrClient.class", 
-        MinimumImportsTest.class.getClassLoader().getResourceAsStream("org/apache/aries/application/sample/appmgrclient/AppMgrClient.class"))
-        .binary("OSGI-INF/blueprint/app-mgr-client.xml", 
-            MinimumImportsTest.class.getClassLoader().getResourceAsStream("app-mgr-client.xml"))
-            .end();
-
-    FileOutputStream fout = new FileOutputStream("appmgrclienttest.eba");
-    testEba.writeOut(fout);
-    fout.close();
-
-    StringBuilder repositoryXML = new StringBuilder();
-
-    BufferedReader reader = new BufferedReader(new InputStreamReader(MinimumImportsTest.class.getResourceAsStream("/basic/fakeAppMgrServiceRepo.xml")));
-    String line;
-
-    while ((line = reader.readLine()) != null) {
-      repositoryXML.append(line);
-      repositoryXML.append("\r\n");
-    }
+        if (createdApplications) {
+            return;
+        }
 
-    String repo = repositoryXML.toString().replaceAll("bundle_location", new File(fake_app_management + ".jar").toURI().toString());
+        // need to fake a application manager to export the service in order to pass the resolving for the client
+        // In the real situation, we don't allow customers' bundles to explicitly import the runtime services.
+        ZipFixture bundle = ArchiveFixture.newJar().manifest()
+                .attribute(Constants.BUNDLE_SYMBOLICNAME, fake_app_management)
+                .attribute(Constants.BUNDLE_MANIFESTVERSION, "2")
+                .attribute(Constants.BUNDLE_VERSION, "1.0.0").end();
+
+        OutputStream out = new FileOutputStream(fake_app_management + ".jar");
+        bundle.writeOut(out);
+        out.close();
+
+
+        ZipFixture testEba = ArchiveFixture.newZip()
+                .jar("org.apache.aries.application.itests.minimports.jar")
+                .manifest().symbolicName("org.apache.aries.application.itests.minimports")
+                .attribute("Bundle-Version", "1.0.0")
+                .attribute("Import-Package", "org.apache.aries.application.management")
+                .end()
+                .binary("org/apache/aries/application/sample/appmgrclient/AppMgrClient.class",
+                        MinimumImportsTest.class.getClassLoader().getResourceAsStream("org/apache/aries/application/sample/appmgrclient/AppMgrClient.class"))
+                .binary("OSGI-INF/blueprint/app-mgr-client.xml",
+                        MinimumImportsTest.class.getClassLoader().getResourceAsStream("app-mgr-client.xml"))
+                .end();
+
+        FileOutputStream fout = new FileOutputStream("appmgrclienttest.eba");
+        testEba.writeOut(fout);
+        fout.close();
+
+        StringBuilder repositoryXML = new StringBuilder();
+
+        BufferedReader reader = new BufferedReader(new InputStreamReader(MinimumImportsTest.class.getResourceAsStream("/basic/fakeAppMgrServiceRepo.xml")));
+        String line;
+
+        while ((line = reader.readLine()) != null) {
+            repositoryXML.append(line);
+            repositoryXML.append("\r\n");
+        }
 
-    System.out.println(repo);
+        String repo = repositoryXML.toString().replaceAll("bundle_location", new File(fake_app_management + ".jar").toURI().toString());
 
-    FileWriter writer = new FileWriter("repository.xml");
-    writer.write(repo);
-    writer.close();
-    createdApplications = true;
-  }
+        System.out.println(repo);
 
-  public static class AppMgrClientBlueprintListener implements BlueprintListener {
+        FileWriter writer = new FileWriter("repository.xml");
+        writer.write(repo);
+        writer.close();
+        createdApplications = true;
+    }
 
-    Boolean success = null;
+    public static class AppMgrClientBlueprintListener implements BlueprintListener {
 
-    public void blueprintEvent(BlueprintEvent event) {
-      if (event.getBundle().getSymbolicName().equals(
-          "org.apache.aries.application.itests.minimports")) {
-        if (event.getType() == event.FAILURE) {
-          success = Boolean.FALSE;
-        }
-        if (event.getType() == event.CREATED) {
-          success = Boolean.TRUE;
+        Boolean success = null;
+
+        public void blueprintEvent(BlueprintEvent event) {
+            if (event.getBundle().getSymbolicName().equals(
+                    "org.apache.aries.application.itests.minimports")) {
+                if (event.getType() == event.FAILURE) {
+                    success = Boolean.FALSE;
+                }
+                if (event.getType() == event.CREATED) {
+                    success = Boolean.TRUE;
+                }
+            }
         }
-      }
     }
-  }
 
-  @Test
-  public void testAppUsingAriesApplicationManager() throws Exception {
+    @Test
+    public void testAppUsingAriesApplicationManager() throws Exception {
 
-    // Register a BlueprintListener to listen for the events from the BlueprintContainer for the bundle in the appmgrclienttest.eba
+        // Register a BlueprintListener to listen for the events from the BlueprintContainer for the bundle in the appmgrclienttest.eba
 
-    AppMgrClientBlueprintListener acbl = new AppMgrClientBlueprintListener();
-    ServiceRegistration sr = bundleContext.registerService("org.osgi.service.blueprint.container.BlueprintListener", acbl, null);
+        AppMgrClientBlueprintListener acbl = new AppMgrClientBlueprintListener();
+        ServiceRegistration sr = bundleContext.registerService("org.osgi.service.blueprint.container.BlueprintListener", acbl, null);
 
-    AriesApplicationManager manager = context().getService(AriesApplicationManager.class);
-    AriesApplication app = manager.createApplication(FileSystem.getFSRoot(new File("appmgrclienttest.eba")));
-    RepositoryAdmin repositoryAdmin = context().getService(RepositoryAdmin.class);
+        AriesApplicationManager manager = context().getService(AriesApplicationManager.class);
+        AriesApplication app = manager.createApplication(FileSystem.getFSRoot(new File("appmgrclienttest.eba")));
+        RepositoryAdmin repositoryAdmin = context().getService(RepositoryAdmin.class);
 
-    Repository[] repos = repositoryAdmin.listRepositories();
-    for (Repository repo : repos) {
-      repositoryAdmin.removeRepository(repo.getURI());
-    }
+        Repository[] repos = repositoryAdmin.listRepositories();
+        for (Repository repo : repos) {
+            repositoryAdmin.removeRepository(repo.getURI());
+        }
 
-    repositoryAdmin.addRepository(new File("repository.xml").toURI().toURL());
+        repositoryAdmin.addRepository(new File("repository.xml").toURI().toURL());
 
-    AriesApplicationContext ctx = manager.install(app);
-    ctx.start();
+        AriesApplicationContext ctx = manager.install(app);
+        ctx.start();
 
-    int sleepfor = 3000;
-    while ((acbl.success == null || acbl.success == false) && sleepfor > 0) {
-      Thread.sleep(100);
-      sleepfor-=100;
+        int sleepfor = 3000;
+        while ((acbl.success == null || acbl.success == false) && sleepfor > 0) {
+            Thread.sleep(100);
+            sleepfor -= 100;
+        }
+        assertNotNull("Timed out - didn't receive Blueprint CREATED or FAILURE event", acbl.success);
+        assertTrue("Received Blueprint FAILURE event", acbl.success);
+
+        ctx.stop();
+        manager.uninstall(ctx);
+        sr.unregister();
     }
-    assertNotNull("Timed out - didn't receive Blueprint CREATED or FAILURE event", acbl.success);
-    assertTrue("Received Blueprint FAILURE event", acbl.success);
 
-    ctx.stop();
-    manager.uninstall(ctx);
-    sr.unregister();
-  }
-
-  public static Option[] generalConfiguration() {
-    return testOptions(
-        paxLogging("DEBUG"),
-
-        // Bundles
-        mavenBundle("org.apache.aries.application", "org.apache.aries.application.api"),
-        mavenBundle("org.apache.aries.application", "org.apache.aries.application.utils"),
-        mavenBundle("org.apache.aries.application", "org.apache.aries.application.management"),
-        mavenBundle("org.apache.aries.application", "org.apache.aries.application.runtime"),
-        mavenBundle("org.apache.aries.application", "org.apache.aries.application.runtime.itest.interfaces"),
-        mavenBundle("org.apache.aries.application", "org.apache.aries.application.default.local.platform"),
-        mavenBundle("org.apache.aries", "org.apache.aries.util"),
-        mavenBundle("org.apache.felix", "org.apache.felix.bundlerepository"),
-        mavenBundle("org.apache.aries.application", "org.apache.aries.application.resolver.obr"),
-        mavenBundle("org.apache.aries.application", "org.apache.aries.application.modeller"),
-        mavenBundle("org.apache.aries.application", "org.apache.aries.application.deployment.management"),
-        mavenBundle("org.apache.aries.blueprint", "org.apache.aries.blueprint"), 
-        mavenBundle("org.ow2.asm", "asm-all"),
-        mavenBundle("org.apache.aries.proxy", "org.apache.aries.proxy"),
-        mavenBundle("org.osgi", "org.osgi.compendium")
-
-        /* For debugging, uncomment the next two lines*/
-        /*vmOption ("-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5007"),
-          waitForFrameworkStartup(),*/
-
-        /*and add these imports:
-          import static org.ops4j.pax.exam.CoreOptions.waitForFrameworkStartup;
-          import static org.ops4j.pax.exam.container.def.PaxRunnerOptions.vmOption;*/
-
-
-        );
-  }
-  
-  @org.ops4j.pax.exam.junit.Configuration
-  public static Option[] configuration()
-  {
-	  return testOptions(
-			  generalConfiguration(),
-			  PaxRunnerOptions.rawPaxRunnerOption("config", "classpath:ss-runner.properties")        
-	          );
-  }
+    @Configuration
+    public static Option[] configuration() {
+        return options(
+
+                // framework / core bundles
+                mavenBundle("org.osgi", "org.osgi.core").versionAsInProject(),
+                mavenBundle("org.osgi", "org.osgi.compendium").versionAsInProject(),
+                mavenBundle("org.ops4j.pax.logging", "pax-logging-api").versionAsInProject(),
+                mavenBundle("org.ops4j.pax.logging", "pax-logging-service").versionAsInProject(),
+
+                // Logging
+                systemProperty("org.ops4j.pax.logging.DefaultServiceLog.level").value("INFO"),
+
+                // Bundles
+                junitBundles(),
+                mavenBundle("org.apache.aries.testsupport", "org.apache.aries.testsupport.unit").versionAsInProject(),
+
+                // Bundles
+                mavenBundle("org.apache.aries.application", "org.apache.aries.application.api").versionAsInProject(),
+                mavenBundle("org.apache.aries.application", "org.apache.aries.application.utils").versionAsInProject(),
+                mavenBundle("org.apache.aries.application", "org.apache.aries.application.management").versionAsInProject(),
+                mavenBundle("org.apache.aries.application", "org.apache.aries.application.runtime").versionAsInProject(),
+                mavenBundle("org.apache.aries.application", "org.apache.aries.application.runtime.itest.interfaces").versionAsInProject(),
+                mavenBundle("org.apache.aries.application", "org.apache.aries.application.default.local.platform").versionAsInProject(),
+                mavenBundle("org.apache.aries", "org.apache.aries.util").versionAsInProject(),
+                mavenBundle("org.apache.felix", "org.apache.felix.bundlerepository").versionAsInProject(),
+                mavenBundle("org.apache.aries.application", "org.apache.aries.application.resolver.obr").versionAsInProject(),
+                mavenBundle("org.apache.aries.application", "org.apache.aries.application.modeller").versionAsInProject(),
+                mavenBundle("org.apache.aries.application", "org.apache.aries.application.deployment.management").versionAsInProject(),
+                mavenBundle("org.apache.aries.blueprint", "org.apache.aries.blueprint").versionAsInProject(),
+                mavenBundle("org.ow2.asm", "asm-all").versionAsInProject(),
+                mavenBundle("org.apache.aries.proxy", "org.apache.aries.proxy").versionAsInProject());
+    }
 
 }

Modified: aries/trunk/application/application-itests/src/test/java/org/apache/aries/application/runtime/itests/OBRAppManagerTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/application/application-itests/src/test/java/org/apache/aries/application/runtime/itests/OBRAppManagerTest.java?rev=1602442&r1=1602441&r2=1602442&view=diff
==============================================================================
--- aries/trunk/application/application-itests/src/test/java/org/apache/aries/application/runtime/itests/OBRAppManagerTest.java (original)
+++ aries/trunk/application/application-itests/src/test/java/org/apache/aries/application/runtime/itests/OBRAppManagerTest.java Fri Jun 13 14:26:31 2014
@@ -18,10 +18,8 @@
  */
 package org.apache.aries.application.runtime.itests;
 
-import static org.apache.aries.itest.ExtraOptions.mavenBundle;
-import static org.apache.aries.itest.ExtraOptions.paxLogging;
-import static org.apache.aries.itest.ExtraOptions.testOptions;
 import static org.junit.Assert.assertEquals;
+import static org.ops4j.pax.exam.CoreOptions.*;
 
 import java.io.BufferedReader;
 import java.io.File;
@@ -44,152 +42,145 @@ import org.apache.felix.bundlerepository
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.Configuration;
 import org.ops4j.pax.exam.Option;
-import org.ops4j.pax.exam.container.def.PaxRunnerOptions;
-import org.ops4j.pax.exam.junit.MavenConfiguredJUnit4TestRunner;
+import org.ops4j.pax.exam.junit.PaxExam;
+import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
+import org.ops4j.pax.exam.spi.reactors.PerClass;
 
-@RunWith(MavenConfiguredJUnit4TestRunner.class)
+@RunWith(PaxExam.class)
+@ExamReactorStrategy(PerClass.class)
 public class OBRAppManagerTest extends AbstractIntegrationTest {
 
-  /* Use @Before not @BeforeClass so as to ensure that these resources
-   * are created in the paxweb temp directory, and not in the svn tree
-   */
-  static boolean createdApplications = false;
-  
-  @Before
-  public static void createApplications() throws Exception {
-	    if (createdApplications) {
-	      return;
-	    }
-	    ZipFixture testBundle = ArchiveFixture.newZip()
-	        .manifest().symbolicName("org.apache.aries.sample.bundle")
-	          .attribute("Bundle-Version", "1.0.0")
-	          .attribute("Import-Package", "org.apache.aries.sample")
-	          .attribute("Export-Package", "org.apache.aries.sample.impl")
-	          .end()
-	        .binary("org/apache/aries/sample/impl/HelloWorldImpl.class",
-	            OBRAppManagerTest.class.getClassLoader().getResourceAsStream("org/apache/aries/sample/impl/HelloWorldImpl.class"))
-	        .end();
-
-	    FileOutputStream fout = new FileOutputStream("bundle.jar");
-	    testBundle.writeOut(fout);
-	    fout.close();
-
-	    ZipFixture testEba = ArchiveFixture.newZip()
-	      .jar("sample.jar")
-	        .manifest().symbolicName("org.apache.aries.sample")
-	          .attribute("Bundle-Version", "1.0.0")
-	          .attribute("Import-Package", "org.apache.aries.sample.impl,org.apache.aries.sample")
-	          .end()
-	        .binary("OSGI-INF/blueprint/sample-blueprint.xml",
-	            OBRAppManagerTest.class.getClassLoader().getResourceAsStream("basic/sample-blueprint.xml"))
-	        .end()
-	         .binary("META-INF/APPLICATION.MF",
-	        OBRAppManagerTest.class.getClassLoader().getResourceAsStream("basic/APPLICATION.MF"))
-	        .end();
-	    fout = new FileOutputStream("test.eba");
-	    testEba.writeOut(fout);
-	    fout.close();
-	    
-	    StringBuilder repositoryXML = new StringBuilder();
-	    
-	    BufferedReader reader = new BufferedReader(new InputStreamReader(OBRAppManagerTest.class.getResourceAsStream("/obr/repository.xml")));
-	    String line;
-	    
-	    while ((line = reader.readLine()) != null) {
-	      repositoryXML.append(line);
-	      repositoryXML.append("\r\n");
-	    }
-	    
-	    String repo = repositoryXML.toString().replaceAll("bundle_location", new File("bundle.jar").toURI().toString());
-	    
-	    System.out.println(repo);
-	    
-	    FileWriter writer = new FileWriter("repository.xml");
-	    writer.write(repo);
-	    writer.close();
-	    
-	    createdApplications = true;
-	  }
-
-	  @Test
-	  public void testAppWithApplicationManifest() throws Exception {
-	    
-	    RepositoryAdmin repositoryAdmin = context().getService(RepositoryAdmin.class);
-	    
-	    repositoryAdmin.addRepository(new File("repository.xml").toURI().toURL());
-
-	    Repository[] repos = repositoryAdmin.listRepositories();
-	    
-	    for (Repository repo : repos) {
-	      Resource[] resources = repo.getResources();
-	      
-	      for (Resource r : resources) {
-	        Capability[] cs = r.getCapabilities();
-	        
-	        for (Capability c : cs) {
-	          System.out.println(c.getName() + " : " + c.getProperties());
-	        }
-	      }
-	    }
-	    
-	    AriesApplicationManager manager = context().getService(AriesApplicationManager.class);
-	    AriesApplication app = manager.createApplication(FileSystem.getFSRoot(new File("test.eba")));
-	    app = manager.resolve(app);
-	    //installing requires a valid url for the bundle in repository.xml.
-	    AriesApplicationContext ctx = manager.install(app);
-	    ctx.start();
-
-	    HelloWorld hw = context().getService(HelloWorld.class);
-	    String result = hw.getMessage();
-	    assertEquals (result, "hello world");
-
-	    ctx.stop();
-	    manager.uninstall(ctx);
-	  }
-
-  public static Option[] generalConfiguration() {
-    return testOptions(
-        paxLogging("DEBUG"),
-
-        // Bundles
-        mavenBundle("org.apache.aries.blueprint", "org.apache.aries.blueprint"),
-        mavenBundle("org.ow2.asm", "asm-all"),
-        mavenBundle("org.apache.aries.proxy", "org.apache.aries.proxy"),
-        mavenBundle("org.apache.aries", "org.apache.aries.util"),
-        mavenBundle("org.apache.aries.application", "org.apache.aries.application.api"),
-        mavenBundle("org.apache.aries.application", "org.apache.aries.application.utils"),
-        mavenBundle("org.apache.aries.application", "org.apache.aries.application.modeller"),
-        mavenBundle("org.apache.aries.application", "org.apache.aries.application.default.local.platform"),
-        mavenBundle("org.apache.felix", "org.apache.felix.bundlerepository"),
-        mavenBundle("org.apache.aries.application", "org.apache.aries.application.resolver.obr"),
-        mavenBundle("org.apache.aries.application", "org.apache.aries.application.deployment.management"),
-        mavenBundle("org.apache.aries.application", "org.apache.aries.application.management"),
-        mavenBundle("org.apache.aries.application", "org.apache.aries.application.runtime"),
-        mavenBundle("org.apache.aries.application", "org.apache.aries.application.runtime.itest.interfaces"),
-
-        mavenBundle("org.osgi", "org.osgi.compendium")
-
-        //        /* For debugging, uncomment the next two lines
-        //        vmOption ("-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005"),
-        //        waitForFrameworkStartup(),
-
-        /* For debugging, uncomment the next two lines
-        and add these imports:
-        import static org.ops4j.pax.exam.CoreOptions.waitForFrameworkStartup;
-        import static org.ops4j.pax.exam.container.def.PaxRunnerOptions.vmOption;
-         */
-
-        );
-  }
-  
-  @org.ops4j.pax.exam.junit.Configuration
-  public static Option[] configuration()
-  {
-	  return testOptions(
-			  generalConfiguration(),
-			  PaxRunnerOptions.rawPaxRunnerOption("config", "classpath:ss-runner.properties")        
-	          );
-  }
+    /* Use @Before not @BeforeClass so as to ensure that these resources
+     * are created in the paxweb temp directory, and not in the svn tree
+     */
+    static boolean createdApplications = false;
+
+    @Before
+    public void createApplications() throws Exception {
+        if (createdApplications) {
+            return;
+        }
+        ZipFixture testBundle = ArchiveFixture.newZip()
+                .manifest().symbolicName("org.apache.aries.sample.bundle")
+                .attribute("Bundle-Version", "1.0.0")
+                .attribute("Import-Package", "org.apache.aries.sample")
+                .attribute("Export-Package", "org.apache.aries.sample.impl")
+                .end()
+                .binary("org/apache/aries/sample/impl/HelloWorldImpl.class",
+                        OBRAppManagerTest.class.getClassLoader().getResourceAsStream("org/apache/aries/sample/impl/HelloWorldImpl.class"))
+                .end();
+
+        FileOutputStream fout = new FileOutputStream("bundle.jar");
+        testBundle.writeOut(fout);
+        fout.close();
+
+        ZipFixture testEba = ArchiveFixture.newZip()
+                .jar("sample.jar")
+                .manifest().symbolicName("org.apache.aries.sample")
+                .attribute("Bundle-Version", "1.0.0")
+                .attribute("Import-Package", "org.apache.aries.sample.impl,org.apache.aries.sample")
+                .end()
+                .binary("OSGI-INF/blueprint/sample-blueprint.xml",
+                        OBRAppManagerTest.class.getClassLoader().getResourceAsStream("basic/sample-blueprint.xml"))
+                .end()
+                .binary("META-INF/APPLICATION.MF",
+                        OBRAppManagerTest.class.getClassLoader().getResourceAsStream("basic/APPLICATION.MF"))
+                .end();
+        fout = new FileOutputStream("test.eba");
+        testEba.writeOut(fout);
+        fout.close();
+
+        StringBuilder repositoryXML = new StringBuilder();
+
+        BufferedReader reader = new BufferedReader(new InputStreamReader(OBRAppManagerTest.class.getResourceAsStream("/obr/repository.xml")));
+        String line;
+
+        while ((line = reader.readLine()) != null) {
+            repositoryXML.append(line);
+            repositoryXML.append("\r\n");
+        }
+
+        String repo = repositoryXML.toString().replaceAll("bundle_location", new File("bundle.jar").toURI().toString());
+
+        System.out.println(repo);
+
+        FileWriter writer = new FileWriter("repository.xml");
+        writer.write(repo);
+        writer.close();
+
+        createdApplications = true;
+    }
+
+    @Test
+    public void testAppWithApplicationManifest() throws Exception {
+
+        RepositoryAdmin repositoryAdmin = context().getService(RepositoryAdmin.class);
+
+        repositoryAdmin.addRepository(new File("repository.xml").toURI().toURL());
+
+        Repository[] repos = repositoryAdmin.listRepositories();
+
+        for (Repository repo : repos) {
+            Resource[] resources = repo.getResources();
+
+            for (Resource r : resources) {
+                Capability[] cs = r.getCapabilities();
+
+                for (Capability c : cs) {
+                    System.out.println(c.getName() + " : " + c.getProperties());
+                }
+            }
+        }
+
+        AriesApplicationManager manager = context().getService(AriesApplicationManager.class);
+        AriesApplication app = manager.createApplication(FileSystem.getFSRoot(new File("test.eba")));
+        app = manager.resolve(app);
+        //installing requires a valid url for the bundle in repository.xml.
+        AriesApplicationContext ctx = manager.install(app);
+        ctx.start();
+
+        HelloWorld hw = context().getService(HelloWorld.class);
+        String result = hw.getMessage();
+        assertEquals(result, "hello world");
+
+        ctx.stop();
+        manager.uninstall(ctx);
+    }
+
+    @Configuration
+    public static Option[] configuration() {
+        return options(
+
+                // framework / core bundles
+                mavenBundle("org.osgi", "org.osgi.core").versionAsInProject(),
+                mavenBundle("org.osgi", "org.osgi.compendium").versionAsInProject(),
+                mavenBundle("org.ops4j.pax.logging", "pax-logging-api").versionAsInProject(),
+                mavenBundle("org.ops4j.pax.logging", "pax-logging-service").versionAsInProject(),
+
+                // Logging
+                systemProperty("org.ops4j.pax.logging.DefaultServiceLog.level").value("INFO"),
+
+                // Bundles
+                junitBundles(),
+                mavenBundle("org.apache.aries.testsupport", "org.apache.aries.testsupport.unit").versionAsInProject(),
+
+                // Bundles
+                mavenBundle("org.apache.aries.blueprint", "org.apache.aries.blueprint").versionAsInProject(),
+                mavenBundle("org.ow2.asm", "asm-all").versionAsInProject(),
+                mavenBundle("org.apache.aries.proxy", "org.apache.aries.proxy").versionAsInProject(),
+                mavenBundle("org.apache.aries", "org.apache.aries.util").versionAsInProject(),
+                mavenBundle("org.apache.aries.application", "org.apache.aries.application.api").versionAsInProject(),
+                mavenBundle("org.apache.aries.application", "org.apache.aries.application.utils").versionAsInProject(),
+                mavenBundle("org.apache.aries.application", "org.apache.aries.application.modeller").versionAsInProject(),
+                mavenBundle("org.apache.aries.application", "org.apache.aries.application.default.local.platform").versionAsInProject(),
+                mavenBundle("org.apache.felix", "org.apache.felix.bundlerepository").versionAsInProject(),
+                mavenBundle("org.apache.aries.application", "org.apache.aries.application.resolver.obr").versionAsInProject(),
+                mavenBundle("org.apache.aries.application", "org.apache.aries.application.deployment.management").versionAsInProject(),
+                mavenBundle("org.apache.aries.application", "org.apache.aries.application.management").versionAsInProject(),
+                mavenBundle("org.apache.aries.application", "org.apache.aries.application.runtime").versionAsInProject(),
+                mavenBundle("org.apache.aries.application", "org.apache.aries.application.runtime.itest.interfaces").versionAsInProject());
+    }
 
 }
\ No newline at end of file



Mime
View raw message