aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tjwat...@apache.org
Subject svn commit: r1606837 [22/27] - in /aries/branches/subsystemsR6: ./ application/ application/application-api/ application/application-bundle/ application/application-converters/ application/application-default-local-platform/ application/application-dep...
Date Mon, 30 Jun 2014 16:55:06 GMT
Modified: aries/branches/subsystemsR6/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/BundleStartLevelTest.java
URL: http://svn.apache.org/viewvc/aries/branches/subsystemsR6/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/BundleStartLevelTest.java?rev=1606837&r1=1606836&r2=1606837&view=diff
==============================================================================
--- aries/branches/subsystemsR6/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/BundleStartLevelTest.java (original)
+++ aries/branches/subsystemsR6/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/BundleStartLevelTest.java Mon Jun 30 16:54:57 2014
@@ -22,17 +22,11 @@ import java.io.IOException;
 import java.util.HashMap;
 import java.util.Map;
 
-import org.junit.Before;
 import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.ops4j.pax.exam.junit.MavenConfiguredJUnit4TestRunner;
 import org.osgi.framework.Bundle;
 import org.osgi.service.subsystem.Subsystem;
 import org.osgi.service.subsystem.SubsystemConstants;
 
-import aQute.lib.osgi.Constants;
-
-@RunWith(MavenConfiguredJUnit4TestRunner.class)
 public class BundleStartLevelTest extends SubsystemTest {
 	/*
 	 * Subsystem-SymbolicName: application.a.esa
@@ -54,51 +48,39 @@ public class BundleStartLevelTest extend
 	 */
 	private static final String BUNDLE_C = "bundle.c.jar";
 	
-	@Before
-	public static void createApplications() throws Exception {
-		if (createdApplications) {
-			return;
-		}
+	@Override
+	public void createApplications() throws Exception {
 		createBundleA();
 		createBundleB();
 		createBundleC();
 		createApplicationA();
-		createdApplications = true;
+		registerRepositoryService(BUNDLE_A, BUNDLE_B);
 	}
 	
-	private static void createApplicationA() throws IOException {
+	private void createApplicationA() throws IOException {
 		createApplicationAManifest();
 		createSubsystem(APPLICATION_A);
 	}
 	
-	private static void createApplicationAManifest() throws IOException {
+	private void createApplicationAManifest() throws IOException {
 		Map<String, String> attributes = new HashMap<String, String>();
 		attributes.put(SubsystemConstants.SUBSYSTEM_SYMBOLICNAME, APPLICATION_A);
 		attributes.put(SubsystemConstants.SUBSYSTEM_CONTENT, BUNDLE_B);
 		createManifest(APPLICATION_A + ".mf", attributes);
 	}
 	
-	private static void createBundleA() throws IOException {
-		Map<String, String> headers = new HashMap<String, String>();
-		headers.put(Constants.EXPORT_PACKAGE, "x");
-		createBundle(BUNDLE_A, headers);
-	}
-	
-	private static void createBundleB() throws IOException {
-		Map<String, String> headers = new HashMap<String, String>();
-		headers.put(Constants.IMPORT_PACKAGE, "x");
-		createBundle(BUNDLE_B, headers);
+	private void createBundleA() throws IOException {
+		createBundle(name(BUNDLE_A), exportPackage("x"));
 	}
 	
-	private static void createBundleC() throws IOException {
-		createBundle(BUNDLE_C);
+	private void createBundleB() throws IOException {
+		createBundle(name(BUNDLE_B), importPackage("x"));
 	}
 	
-	public void setUp() throws Exception {
-		super.setUp();
-		registerRepositoryService(BUNDLE_A, BUNDLE_B);
+	private void createBundleC() throws IOException {
+		createBundle(name(BUNDLE_C));
 	}
-    
+
     /*
      * Tests the start level of bundle constituents.
      * 
@@ -125,9 +107,9 @@ public class BundleStartLevelTest extend
     		startSubsystem(a);
     		try {
     			// Test managed bundles.
-    			assertStartLevel(getBundle(a, BUNDLE_B), 1);
+    			assertStartLevel(context(a).getBundleByName(BUNDLE_B), 1);
     			assertStartLevel(getRegionContextBundle(a), 1);
-    			assertStartLevel(getBundle(getRootSubsystem(), BUNDLE_A), 1);
+    			assertStartLevel(context(getRootSubsystem()).getBundleByName(BUNDLE_A), 1);
     			// Test unmanaged bundle.
     			Bundle c = installBundleFromFile(BUNDLE_C, a);
     			try {

Modified: aries/branches/subsystemsR6/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/CompositeTest.java
URL: http://svn.apache.org/viewvc/aries/branches/subsystemsR6/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/CompositeTest.java?rev=1606837&r1=1606836&r2=1606837&view=diff
==============================================================================
--- aries/branches/subsystemsR6/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/CompositeTest.java (original)
+++ aries/branches/subsystemsR6/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/CompositeTest.java Mon Jun 30 16:54:57 2014
@@ -17,16 +17,12 @@ import java.io.IOException;
 import java.util.HashMap;
 import java.util.Map;
 
-import org.junit.Before;
 import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.ops4j.pax.exam.junit.MavenConfiguredJUnit4TestRunner;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.Constants;
 import org.osgi.service.subsystem.Subsystem;
 import org.osgi.service.subsystem.SubsystemConstants;
 
-@RunWith(MavenConfiguredJUnit4TestRunner.class)
 public class CompositeTest extends SubsystemTest {
 	private static final String BUNDLE_A = "bundle.a";
 	private static final String BUNDLE_B = "bundle.b";
@@ -39,12 +35,8 @@ public class CompositeTest extends Subsy
 	private static final String COMPOSITE_D = "composite.d";
 	private static final String PACKAGE_X = "x";
 	
-	private static boolean createdTestFiles;
-	
-	@Before
-	public static void createTestFiles() throws Exception {
-		if (createdTestFiles)
-			return;
+	@Override
+	public void createApplications() throws Exception {
 		createBundleA();
 		createBundleB();
 		createBundleC();
@@ -54,37 +46,27 @@ public class CompositeTest extends Subsy
 		createCompositeB();
 		createCompositeC();
 		createCompositeD();
-		createdTestFiles = true;
 	}
 	
-	private static void createBundleA() throws IOException {
-		Map<String, String> headers = new HashMap<String, String>();
-		headers.put(Constants.EXPORT_PACKAGE, PACKAGE_X + ";version=1.0");
-		createBundle(BUNDLE_A, "1.0.0", headers);
+	private void createBundleA() throws IOException {
+		createBundle(name(BUNDLE_A), version("1.0.0"), exportPackage(PACKAGE_X + ";version=1.0"));
 	}
 	
-	private static void createBundleB() throws IOException {
-		Map<String, String> headers = new HashMap<String, String>();
-		headers.put(Constants.PROVIDE_CAPABILITY, "y; y=test; version:Version=1.0");
-		createBundle(BUNDLE_B, "1.0.0", headers);
+	private void createBundleB() throws IOException {
+		createBundle(name(BUNDLE_B), version("1.0.0"), 
+				new Header(Constants.PROVIDE_CAPABILITY, "y; y=test; version:Version=1.0"));
 	}
 	
-	private static void createBundleC() throws IOException {
-		Map<String, String> headers = new HashMap<String, String>();
-		headers.put(Constants.IMPORT_PACKAGE, PACKAGE_X + ";version=\"[1.0,2.0)\"");
-		createBundle(BUNDLE_C, "1.0.0", headers);
+	private void createBundleC() throws IOException {
+		createBundle(name(BUNDLE_C), version("1.0.0"), importPackage(PACKAGE_X + ";version=\"[1.0,2.0)\""));
 	}
 	
-	private static void createBundleD() throws IOException {
-		Map<String, String> headers = new HashMap<String, String>();
-		headers.put(Constants.REQUIRE_BUNDLE, BUNDLE_A);
-		createBundle(BUNDLE_D, headers);
+	private void createBundleD() throws IOException {
+		createBundle(name(BUNDLE_D), requireBundle(BUNDLE_A));
 	}
 	
-	private static void createBundleE() throws IOException {
-		Map<String, String> headers = new HashMap<String, String>();
-		headers.put(Constants.REQUIRE_CAPABILITY, "y; filter:=(y=test)");
-		createBundle(BUNDLE_E, headers);
+	private void createBundleE() throws IOException {
+		createBundle(name(BUNDLE_E), new Header(Constants.REQUIRE_CAPABILITY, "y; filter:=(y=test)"));
 	}
 	
 	private static void createCompositeA() throws IOException {

Modified: aries/branches/subsystemsR6/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/DependencyLifeCycleTest.java
URL: http://svn.apache.org/viewvc/aries/branches/subsystemsR6/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/DependencyLifeCycleTest.java?rev=1606837&r1=1606836&r2=1606837&view=diff
==============================================================================
--- aries/branches/subsystemsR6/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/DependencyLifeCycleTest.java (original)
+++ aries/branches/subsystemsR6/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/DependencyLifeCycleTest.java Mon Jun 30 16:54:57 2014
@@ -18,16 +18,11 @@ import java.util.EnumSet;
 import java.util.HashMap;
 import java.util.Map;
 
-import org.junit.Before;
 import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.ops4j.pax.exam.junit.MavenConfiguredJUnit4TestRunner;
 import org.osgi.framework.Bundle;
-import org.osgi.framework.Constants;
 import org.osgi.service.subsystem.Subsystem;
 import org.osgi.service.subsystem.SubsystemConstants;
 
-@RunWith(MavenConfiguredJUnit4TestRunner.class)
 public class DependencyLifeCycleTest extends SubsystemTest {
 	/*
 	 * Subsystem-SymbolicName: application.a.esa
@@ -57,27 +52,19 @@ public class DependencyLifeCycleTest ext
 		createManifest(APPLICATION_A + ".mf", attributes);
 	}
 	
-	private static void createBundleA() throws IOException {
-		Map<String, String> headers = new HashMap<String, String>();
-		headers.put(Constants.IMPORT_PACKAGE, "x");
-		createBundle(BUNDLE_A, headers);
-	}
-	
-	private static void createBundleB() throws IOException {
-		Map<String, String> headers = new HashMap<String, String>();
-		headers.put(Constants.EXPORT_PACKAGE, "x");
-		createBundle(BUNDLE_B, headers);
-	}
-	
-	private static boolean createdTestFiles;
-	@Before
-	public static void createTestFiles() throws Exception {
-		if (createdTestFiles)
-			return;
+	private void createBundleA() throws IOException {
+		createBundle(name(BUNDLE_A), importPackage("x"));
+	}
+	
+	private void createBundleB() throws IOException {
+		createBundle(name(BUNDLE_B), exportPackage("x"));
+	}
+	
+	@Override
+	public void createApplications() throws Exception {
 		createBundleA();
 		createBundleB();
 		createApplicationA();
-		createdTestFiles = true;
 	}
 	
 	public void setUp() throws Exception {
@@ -132,7 +119,7 @@ public class DependencyLifeCycleTest ext
 		Subsystem subsystem = installSubsystemFromFile(APPLICATION_A);
 		try {
 			assertConstituent(root, BUNDLE_B);
-			Bundle bundle = getBundle(root, BUNDLE_B);
+			Bundle bundle = context(root).getBundleByName(BUNDLE_B);
 			subsystem.uninstall();
 			assertBundleState(bundle, Bundle.UNINSTALLED);
 			assertNotConstituent(root, BUNDLE_B);

Modified: aries/branches/subsystemsR6/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/DynamicImportTest.java
URL: http://svn.apache.org/viewvc/aries/branches/subsystemsR6/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/DynamicImportTest.java?rev=1606837&r1=1606836&r2=1606837&view=diff
==============================================================================
--- aries/branches/subsystemsR6/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/DynamicImportTest.java (original)
+++ aries/branches/subsystemsR6/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/DynamicImportTest.java Mon Jun 30 16:54:57 2014
@@ -4,7 +4,6 @@ import static org.junit.Assert.assertEqu
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
-import static org.ops4j.pax.exam.CoreOptions.options;
 
 import java.io.FileInputStream;
 import java.io.IOException;
@@ -12,19 +11,18 @@ import java.util.HashMap;
 import java.util.Map;
 import java.util.concurrent.atomic.AtomicBoolean;
 
+import org.apache.aries.itest.RichBundleContext;
 import org.apache.aries.subsystem.itests.hello.api.Hello;
 import org.apache.aries.unittest.fixture.ArchiveFixture;
 import org.apache.aries.unittest.fixture.ArchiveFixture.JarFixture;
 import org.apache.aries.unittest.fixture.ArchiveFixture.ManifestFixture;
-import org.junit.Before;
 import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.ops4j.pax.exam.Option;
-import org.ops4j.pax.exam.junit.Configuration;
-import org.ops4j.pax.exam.junit.MavenConfiguredJUnit4TestRunner;
+import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
+import org.ops4j.pax.exam.spi.reactors.PerMethod;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.BundleException;
+import org.osgi.framework.Constants;
 import org.osgi.framework.ServiceRegistration;
 import org.osgi.framework.hooks.weaving.WeavingHook;
 import org.osgi.framework.hooks.weaving.WovenClass;
@@ -32,30 +30,21 @@ import org.osgi.service.subsystem.Subsys
 import org.osgi.service.subsystem.SubsystemConstants;
 import org.osgi.service.subsystem.SubsystemException;
 
-import aQute.lib.osgi.Constants;
-
 /*
  * Simple iTest for dynamic imports. In the first instance we'll use a 
  * DynamicImport-Package header because it's the simplest to set up. 
  * _Hopefully_ if this works, then packages added by WeavingProxy services
  * will also work. If not, we'll need extra tests :-/ 
  */
-@RunWith(MavenConfiguredJUnit4TestRunner.class)
+@ExamReactorStrategy(PerMethod.class)
 public class DynamicImportTest extends SubsystemTest 
 {
-	private static boolean _testAppCreated = false;
-	
-	@Before
-	public void setUp() throws Exception 
-	{
-		super.setUp();
-		if (!_testAppCreated) { 
-			createApplication("dynamicImport", new String[]{"dynamicImport.jar"});
-			createEmptyClass();
-			createBundleA();
-			createApplicationA();
-			_testAppCreated = true;
-		}
+	@Override
+	protected void createApplications() throws Exception {
+		createApplication("dynamicImport", "dynamicImport.jar");
+		createEmptyClass();
+		createBundleA();
+		createApplicationA();
 	}
 
 	/*
@@ -99,7 +88,7 @@ public class DynamicImportTest extends S
 			startSubsystem(subsystem);
 		
 			BundleContext bc = subsystem.getBundleContext();
-			Hello h = getOsgiService(bc, Hello.class, null, DEFAULT_TIMEOUT);
+			Hello h = new RichBundleContext(bc).getService(Hello.class);
 			String message = h.saySomething();
 			assertEquals ("Wrong message back", "Hello, this is something", message); // DynamicImportHelloImpl.java
 		
@@ -110,15 +99,6 @@ public class DynamicImportTest extends S
 		}
 	}
 	
-	@Configuration
-	public static Option[] extraBundles() 
-	{
-		return options(
-				mavenBundle("org.apache.aries.subsystem", "org.apache.aries.subsystem.itest.interfaces")
-//				org.ops4j.pax.exam.container.def.PaxRunnerOptions.vmOption("-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=7777")
-		);
-	}
-	
 	/*
 	 * Subsystem-SymbolicName: application.a.esa
 	 * Subsystem-Content: bundle.a.jar
@@ -156,7 +136,7 @@ public class DynamicImportTest extends S
 	@Test
 	public void testDynamicPackageImportsAddedToSharingPolicyWhenNoImportPackageHeader() throws Exception {
 		final AtomicBoolean weavingHookCalled = new AtomicBoolean(false);
-		ServiceRegistration<WeavingHook> reg = bundleContext.registerService(
+		ServiceRegistration reg = bundleContext.registerService(
 				WeavingHook.class, 
 				new WeavingHook() {
 					@Override

Modified: aries/branches/subsystemsR6/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/FeatureTest.java
URL: http://svn.apache.org/viewvc/aries/branches/subsystemsR6/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/FeatureTest.java?rev=1606837&r1=1606836&r2=1606837&view=diff
==============================================================================
--- aries/branches/subsystemsR6/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/FeatureTest.java (original)
+++ aries/branches/subsystemsR6/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/FeatureTest.java Mon Jun 30 16:54:57 2014
@@ -24,28 +24,23 @@ import junit.framework.AssertionFailedEr
 
 import org.apache.aries.subsystem.core.internal.ResourceHelper;
 import org.junit.Assert;
-import org.junit.Before;
 import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.ops4j.pax.exam.junit.MavenConfiguredJUnit4TestRunner;
+import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
+import org.ops4j.pax.exam.spi.reactors.PerMethod;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.Version;
 import org.osgi.framework.namespace.IdentityNamespace;
 import org.osgi.resource.Resource;
 import org.osgi.service.subsystem.Subsystem;
 
-@RunWith(MavenConfiguredJUnit4TestRunner.class)
+@ExamReactorStrategy(PerMethod.class)
 public class FeatureTest extends SubsystemTest {
 	
-	@Before
-	public static void createApplications() throws Exception {
-		if (createdApplications) {
-			return;
-		}
+	@Override
+	public void createApplications() throws Exception {
 		createApplication("feature2", new String[]{"tb2.jar", "tb3.jar"});
 		createApplication("feature1", new String[]{"tb1.jar", "feature2.esa", "tb3.jar"});
 		createApplication("feature3", new String[]{"tb3.jar"});
-		createdApplications = true;
 	}
 
 	@Test

Modified: aries/branches/subsystemsR6/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/HelloWorldTest.java
URL: http://svn.apache.org/viewvc/aries/branches/subsystemsR6/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/HelloWorldTest.java?rev=1606837&r1=1606836&r2=1606837&view=diff
==============================================================================
--- aries/branches/subsystemsR6/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/HelloWorldTest.java (original)
+++ aries/branches/subsystemsR6/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/HelloWorldTest.java Mon Jun 30 16:54:57 2014
@@ -8,29 +8,20 @@ import java.net.URI;
 import java.util.Dictionary;
 import java.util.Hashtable;
 
+import org.apache.aries.itest.RichBundleContext;
 import org.apache.aries.subsystem.itests.hello.api.Hello;
 import org.apache.aries.util.filesystem.FileSystem;
 import org.apache.aries.util.filesystem.IDirectory;
 import org.apache.aries.util.filesystem.IDirectoryFinder;
-import org.junit.Before;
 import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.ops4j.pax.exam.Inject;
-import org.ops4j.pax.exam.junit.MavenConfiguredJUnit4TestRunner;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceRegistration;
 import org.osgi.service.subsystem.Subsystem;
 import org.osgi.service.subsystem.SubsystemException;
 
-@RunWith(MavenConfiguredJUnit4TestRunner.class)
 public class HelloWorldTest extends SubsystemTest 
 {
-  // Get the root subsystem bundle context.
-  @Inject
-  protected BundleContext bundleContext;
 
-	private static boolean _testAppCreated = false;
-	
 	/*
 	 * An implementation of the IDirectoryFinder interface that provides the
 	 * IDirectory that corresponds to some id URI. In practice this could come 
@@ -56,20 +47,16 @@ public class HelloWorldTest extends Subs
     }
   }
 
-	@Before
-	public void installTestApp() throws Exception 
-	{
-		if (!_testAppCreated) { 
-			createApplication("hello", new String[]{"helloImpl.jar"});
-			_testAppCreated = true;
-		}
+	@Override
+	public void createApplications() throws Exception {
+		createApplication("hello", "helloImpl.jar");
 	}
 
 	void checkHelloSubsystem(Subsystem helloSubsystem) throws Exception
 	{
     helloSubsystem.start();
     BundleContext bc = helloSubsystem.getBundleContext();
-    Hello h = getOsgiService(bc, Hello.class, null, DEFAULT_TIMEOUT);
+    Hello h = new RichBundleContext(bc).getService(Hello.class);
     String message = h.saySomething();
     assertEquals ("Wrong message back", "something", message);
     helloSubsystem.stop();
@@ -102,7 +89,7 @@ public class HelloWorldTest extends Subs
     // IDirectoryFinder services, so it will be notified on service registration. 
     Dictionary<String, String> properties = new Hashtable<String, String>();
     properties.put(IDirectoryFinder.IDIR_FINDERID_KEY, TestIDirectoryFinder.IDIR_FINDERID_VALUE);
-    ServiceRegistration<IDirectoryFinder> serviceRegistration = 
+    ServiceRegistration serviceRegistration =
      bundleContext.registerService(IDirectoryFinder.class, new TestIDirectoryFinder(), properties);
     
     // Call the SubsystemTest.installSubsystem method that does not create a URL

Modified: aries/branches/subsystemsR6/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/InstallTest.java
URL: http://svn.apache.org/viewvc/aries/branches/subsystemsR6/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/InstallTest.java?rev=1606837&r1=1606836&r2=1606837&view=diff
==============================================================================
--- aries/branches/subsystemsR6/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/InstallTest.java (original)
+++ aries/branches/subsystemsR6/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/InstallTest.java Mon Jun 30 16:54:57 2014
@@ -23,8 +23,10 @@ import static org.junit.Assert.assertTru
 import static org.junit.Assert.fail;
 
 import java.io.File;
+import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
 import java.io.IOException;
+import java.io.InputStream;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -34,57 +36,50 @@ import org.apache.aries.unittest.fixture
 import org.apache.aries.util.filesystem.FileSystem;
 import org.apache.aries.util.filesystem.IDirectory;
 import org.apache.aries.util.io.IOUtils;
-import org.junit.Before;
 import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.ops4j.pax.exam.junit.MavenConfiguredJUnit4TestRunner;
+import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
+import org.ops4j.pax.exam.spi.reactors.PerMethod;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.Version;
 import org.osgi.service.subsystem.Subsystem;
 import org.osgi.service.subsystem.SubsystemConstants;
 
-@RunWith(MavenConfiguredJUnit4TestRunner.class)
+@ExamReactorStrategy(PerMethod.class)
 public class InstallTest extends SubsystemTest {
-	@Before
-	public static void createApplications() throws Exception {
-		if (createdApplications) {
-			return;
-		}
+	public InputStream getResourceAsStream(String path) {
+		return SubsystemTest.class.getClassLoader().getResourceAsStream(path);
+	}
+	
+	@Override
+	public void createApplications() throws Exception {
+		createCompositeDirEsa();
+		createApplication("feature3", "tb3.jar");
+		createApplication("feature2", "tb3.jar", "tb2.jar");
+		createBundleA();
+		createBundleB();
+		createApplicationA();
+		createCompositeA();
+		createFeatureA();
+	}
+
+	private void createCompositeDirEsa() throws IOException,
+			FileNotFoundException {
 		ZipFixture feature = ArchiveFixture
 				.newZip()
-				.binary("OSGI-INF/SUBSYSTEM.MF",
-						SubsystemTest.class.getClassLoader().getResourceAsStream(
-								"compositeDir" + "/OSGI-INF/SUBSYSTEM.MF"))
-				.binary("a.jar/META-INF/MANIFEST.MF", 
-						SubsystemTest.class.getClassLoader().getResourceAsStream(
-								"compositeDir" + "/a.jar/META-INF/MANIFEST.MF"))
-				.binary("a.jar/a/A.class", 
-						SubsystemTest.class.getClassLoader().getResourceAsStream(
-								"a/A.class"))
-				.binary("applicationDir.esa/OSGI-INF/SUBSYSTEM.MF",
-						SubsystemTest.class.getClassLoader().getResourceAsStream(
-								"compositeDir" + "/applicationDir/OSGI-INF/SUBSYSTEM.MF"))
-				.binary("applicationDir.esa/b.jar/META-INF/MANIFEST.MF", 
-						SubsystemTest.class.getClassLoader().getResourceAsStream(
-								"compositeDir" + "/applicationDir/b.jar/META-INF/MANIFEST.MF"))
-				.binary("applicationDir.esa/b.jar/b/B.class", 
-						SubsystemTest.class.getClassLoader().getResourceAsStream(
-								"b/B.class"))
-				.binary("applicationDir.esa/featureDir.esa/OSGI-INF/SUBSYSTEM.MF",
-						SubsystemTest.class.getClassLoader().getResourceAsStream(
+				.binary("OSGI-INF/SUBSYSTEM.MF", getResourceAsStream("compositeDir" + "/OSGI-INF/SUBSYSTEM.MF"))
+				.binary("a.jar/META-INF/MANIFEST.MF", getResourceAsStream("compositeDir" + "/a.jar/META-INF/MANIFEST.MF"))
+				.binary("a.jar/a/A.class", getResourceAsStream("a/A.class"))
+				.binary("applicationDir.esa/OSGI-INF/SUBSYSTEM.MF", getResourceAsStream("compositeDir" + "/applicationDir/OSGI-INF/SUBSYSTEM.MF"))
+				.binary("applicationDir.esa/b.jar/META-INF/MANIFEST.MF", getResourceAsStream("compositeDir" + "/applicationDir/b.jar/META-INF/MANIFEST.MF"))
+				.binary("applicationDir.esa/b.jar/b/B.class", getResourceAsStream("b/B.class"))
+				.binary("applicationDir.esa/featureDir.esa/OSGI-INF/SUBSYSTEM.MF", getResourceAsStream(
 								"compositeDir" + "/applicationDir/featureDir/OSGI-INF/SUBSYSTEM.MF"))
-				.binary("applicationDir.esa/featureDir.esa/a.jar/META-INF/MANIFEST.MF", 
-						SubsystemTest.class.getClassLoader().getResourceAsStream(
+				.binary("applicationDir.esa/featureDir.esa/a.jar/META-INF/MANIFEST.MF", getResourceAsStream(
 								"compositeDir" + "/applicationDir/featureDir/a.jar/META-INF/MANIFEST.MF"))
-				.binary("applicationDir.esa/featureDir.esa/a.jar/a/A.class", 
-						SubsystemTest.class.getClassLoader().getResourceAsStream(
-								"a/A.class"))
-				.binary("applicationDir.esa/featureDir.esa/b.jar/META-INF/MANIFEST.MF", 
-						SubsystemTest.class.getClassLoader().getResourceAsStream(
+				.binary("applicationDir.esa/featureDir.esa/a.jar/a/A.class", getResourceAsStream("a/A.class"))
+				.binary("applicationDir.esa/featureDir.esa/b.jar/META-INF/MANIFEST.MF", getResourceAsStream(
 								"compositeDir" + "/applicationDir/featureDir/b.jar/META-INF/MANIFEST.MF"))
-				.binary("applicationDir.esa/featureDir.esa/b.jar/b/B.class", 
-						SubsystemTest.class.getClassLoader().getResourceAsStream(
-								"b/B.class"));
+				.binary("applicationDir.esa/featureDir.esa/b.jar/b/B.class", getResourceAsStream("b/B.class"));
 		feature.end();
 		FileOutputStream fos = new FileOutputStream("compositeDir" + ".esa");
 		try {
@@ -92,25 +87,14 @@ public class InstallTest extends Subsyst
 		} finally {
 			Utils.closeQuietly(fos);
 		}
-		createApplication("feature3", new String[]{"tb3.jar"});
-		createApplication("feature2", new String[]{"tb3.jar", "tb2.jar"});
-		createBundleA();
-		createBundleB();
-		createApplicationA();
-		createCompositeA();
-		createFeatureA();
-		createdApplications = true;
-	}
-	
-	public void setUp() throws Exception {
-		super.setUp();
+
 		File userDir = new File(System.getProperty("user.dir"));
     	IDirectory idir = FileSystem.getFSRoot(userDir);
     	File compositeDir = new File(userDir, "compositeDir");
     	compositeDir.mkdir();
     	IOUtils.unpackZip(idir.getFile("compositeDir.esa"), compositeDir);
 	}
-
+	
 	@Test
 	public void testReturnExistingSubsystemWithSameLocation() throws Exception {
 		Subsystem subsystem1 = installSubsystemFromFile("feature3.esa");
@@ -191,8 +175,8 @@ public class InstallTest extends Subsyst
 	 */
 	private static final String BUNDLE_A = "bundle.a.jar";
 	
-	private static void createBundleA() throws IOException {
-		createBundle(BUNDLE_A);
+	private void createBundleA() throws IOException {
+		createBundle(name(BUNDLE_A));
 	}
     
     /*
@@ -200,12 +184,12 @@ public class InstallTest extends Subsyst
 	 */
 	private static final String APPLICATION_A = "application.a.esa";
 	
-	private static void createApplicationA() throws IOException {
+	private void createApplicationA() throws IOException {
 		createApplicationAManifest();
 		createSubsystem(APPLICATION_A, BUNDLE_A);
 	}
 	
-	private static void createApplicationAManifest() throws IOException {
+	private void createApplicationAManifest() throws IOException {
 		File manifest = new File(APPLICATION_A + ".mf");
 		if (manifest.exists())
 			assertTrue("Could not delete manifest", manifest.delete());
@@ -260,8 +244,8 @@ public class InstallTest extends Subsyst
 	 */
 	private static final String BUNDLE_B = "bundle.b.war";
 	
-	private static void createBundleB() throws IOException {
-		createBundle(BUNDLE_B);
+	private void createBundleB() throws IOException {
+		createBundle(name(BUNDLE_B));
 	}
 	
 	/*

Modified: aries/branches/subsystemsR6/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/ModelledResourceManagerTest.java
URL: http://svn.apache.org/viewvc/aries/branches/subsystemsR6/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/ModelledResourceManagerTest.java?rev=1606837&r1=1606836&r2=1606837&view=diff
==============================================================================
--- aries/branches/subsystemsR6/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/ModelledResourceManagerTest.java (original)
+++ aries/branches/subsystemsR6/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/ModelledResourceManagerTest.java Mon Jun 30 16:54:57 2014
@@ -2,56 +2,28 @@ package org.apache.aries.subsystem.itest
 
 import static org.junit.Assert.assertNull;
 
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.List;
-
-import org.junit.Before;
+import org.apache.aries.itest.RichBundleContext;
 import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.ops4j.pax.exam.Option;
-import org.ops4j.pax.exam.junit.MavenConfiguredJUnit4TestRunner;
-import org.ops4j.pax.exam.options.MavenArtifactProvisionOption;
 import org.osgi.service.subsystem.Subsystem;
 
-@RunWith(MavenConfiguredJUnit4TestRunner.class)
 public class ModelledResourceManagerTest extends SubsystemTest {
-	@org.ops4j.pax.exam.junit.Configuration
-	public static Option[] configuration() {
-		List<Option> options = new ArrayList<Option>(Arrays.asList(defineOptions()));
-		for (Iterator<Option> i = options.iterator(); i.hasNext();) {
-			Option option = i.next();
-			if (option instanceof MavenArtifactProvisionOption) {
-				MavenArtifactProvisionOption mapo = (MavenArtifactProvisionOption)option;
-				String url = mapo.getURL();
-				if (url.contains("org.apache.aries.application.modeller")
-						|| url.contains("org.apache.aries.blueprint")
-						|| url.contains("org.apache.aries.proxy")) {
-					i.remove();
-				}
-			}
-		}
-		Option[] result = options.toArray(new Option[options.size()]);
-		result = updateOptions(result);
-		return result;
+	
+	public ModelledResourceManagerTest() {
+		super(false);
 	}
 	
-	@Before
-	public static void createApplications() throws Exception {
-		if (createdApplications) {
-			return;
-		}
+	@Override
+	public void createApplications() throws Exception {
 		createApplication("feature3", new String[]{"tb3.jar"});
 		createApplication("application1", new String[]{"tb1.jar"});
-		createdApplications = true;
 	}
 	
 	public void setUp() throws Exception {
 		super.setUp();
-		assertNull("Modeller is installed", getBundle(getRootSubsystem(), "org.apache.aries.application.modeller"));
-		assertNull("Blueprint is installed", getBundle(getRootSubsystem(), "org.apache.aries.blueprint"));
-		assertNull("Proxy is installed", getBundle(getRootSubsystem(), "org.apache.aries.proxy"));
+		RichBundleContext rootContext = context(getRootSubsystem());
+		assertNull("Modeller is installed", rootContext.getBundleByName("org.apache.aries.application.modeller"));
+		assertNull("Blueprint is installed", rootContext.getBundleByName("org.apache.aries.blueprint"));
+		assertNull("Proxy is installed", rootContext.getBundleByName("org.apache.aries.proxy"));
 	}
 
 	@Test

Modified: aries/branches/subsystemsR6/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/NoRequirementFilterTest.java
URL: http://svn.apache.org/viewvc/aries/branches/subsystemsR6/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/NoRequirementFilterTest.java?rev=1606837&r1=1606836&r2=1606837&view=diff
==============================================================================
--- aries/branches/subsystemsR6/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/NoRequirementFilterTest.java (original)
+++ aries/branches/subsystemsR6/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/NoRequirementFilterTest.java Mon Jun 30 16:54:57 2014
@@ -17,10 +17,7 @@ import java.io.IOException;
 import java.util.HashMap;
 import java.util.Map;
 
-import org.junit.Before;
 import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.ops4j.pax.exam.junit.MavenConfiguredJUnit4TestRunner;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.Constants;
 import org.osgi.service.subsystem.Subsystem;
@@ -32,7 +29,6 @@ import org.osgi.service.subsystem.Subsys
  * 
  * Generic capabilities are not required to use the namespace as an attribute.
  */
-@RunWith(MavenConfiguredJUnit4TestRunner.class)
 public class NoRequirementFilterTest extends SubsystemTest {
 	/*
 	 * Subsystem-SymbolicName: application.a.esa
@@ -62,27 +58,19 @@ public class NoRequirementFilterTest ext
 		createManifest(APPLICATION_A + ".mf", attributes);
 	}
 	
-	private static void createBundleA() throws IOException {
-		Map<String, String> headers = new HashMap<String, String>();
-		headers.put(Constants.REQUIRE_CAPABILITY, "y");
-		createBundle(BUNDLE_A, headers);
-	}
-	
-	private static void createBundleB() throws IOException {
-		Map<String, String> headers = new HashMap<String, String>();
-		headers.put(Constants.PROVIDE_CAPABILITY, "y");
-		createBundle(BUNDLE_B, headers);
-	}
-	
-	private static boolean createdTestFiles;
-	@Before
-	public static void createTestFiles() throws Exception {
-		if (createdTestFiles)
-			return;
+	private void createBundleA() throws IOException {
+		createBundle(name(BUNDLE_A), new Header(Constants.REQUIRE_CAPABILITY, "y"));
+	}
+	
+	private void createBundleB() throws IOException {
+		createBundle(name(BUNDLE_B), new Header(Constants.PROVIDE_CAPABILITY, "y"));
+	}
+	
+	@Override
+	protected void createApplications() throws Exception {
 		createBundleA();
 		createBundleB();
 		createApplicationA();
-		createdTestFiles = true;
 	}
 	
 	public void setUp() throws Exception {

Modified: aries/branches/subsystemsR6/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/OptionalDependenciesTest.java
URL: http://svn.apache.org/viewvc/aries/branches/subsystemsR6/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/OptionalDependenciesTest.java?rev=1606837&r1=1606836&r2=1606837&view=diff
==============================================================================
--- aries/branches/subsystemsR6/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/OptionalDependenciesTest.java (original)
+++ aries/branches/subsystemsR6/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/OptionalDependenciesTest.java Mon Jun 30 16:54:57 2014
@@ -19,15 +19,11 @@ import java.io.IOException;
 import java.util.HashMap;
 import java.util.Map;
 
-import org.junit.Before;
 import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.ops4j.pax.exam.junit.MavenConfiguredJUnit4TestRunner;
 import org.osgi.framework.Constants;
 import org.osgi.service.subsystem.Subsystem;
 import org.osgi.service.subsystem.SubsystemConstants;
 
-@RunWith(MavenConfiguredJUnit4TestRunner.class)
 public class OptionalDependenciesTest extends SubsystemTest {
 	/*
 	 * Subsystem-SymbolicName: application.a.esa
@@ -54,22 +50,16 @@ public class OptionalDependenciesTest ex
 		createManifest(APPLICATION_A + ".mf", attributes);
 	}
 	
-	private static void createBundleA() throws IOException {
-		Map<String, String> headers = new HashMap<String, String>();
-		headers.put(Constants.IMPORT_PACKAGE, "x;resolution:=optional");
-		headers.put(Constants.REQUIRE_BUNDLE, "x;resolution:=optional");
-		headers.put(Constants.REQUIRE_CAPABILITY, "x;resolution:=optional");
-		createBundle(BUNDLE_A, headers);
+	private void createBundleA() throws IOException {
+		createBundle(name(BUNDLE_A), importPackage("x;resolution:=optional"), 
+				requireBundle("x;resolution:=optional"),
+				new Header(Constants.REQUIRE_CAPABILITY, "x;resolution:=optional"));
 	}
 	
-	private static boolean createdTestFiles;
-	@Before
-	public static void createTestFiles() throws Exception {
-		if (createdTestFiles)
-			return;
+	@Override
+	public void createApplications() throws Exception {
 		createBundleA();
 		createApplicationA();
-		createdTestFiles = true;
 	}
 	
 	@Test

Modified: aries/branches/subsystemsR6/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/ProvisionPolicyTest.java
URL: http://svn.apache.org/viewvc/aries/branches/subsystemsR6/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/ProvisionPolicyTest.java?rev=1606837&r1=1606836&r2=1606837&view=diff
==============================================================================
--- aries/branches/subsystemsR6/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/ProvisionPolicyTest.java (original)
+++ aries/branches/subsystemsR6/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/ProvisionPolicyTest.java Mon Jun 30 16:54:57 2014
@@ -20,16 +20,12 @@ import java.io.IOException;
 import java.util.HashMap;
 import java.util.Map;
 
-import org.junit.Before;
 import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.ops4j.pax.exam.junit.MavenConfiguredJUnit4TestRunner;
 import org.osgi.framework.Constants;
 import org.osgi.service.subsystem.Subsystem;
 import org.osgi.service.subsystem.SubsystemConstants;
 import org.osgi.service.subsystem.SubsystemException;
 
-@RunWith(MavenConfiguredJUnit4TestRunner.class)
 public class ProvisionPolicyTest extends SubsystemTest {
 	/*
 	 * Subsystem-SymbolicName: application.a.esa
@@ -82,24 +78,20 @@ public class ProvisionPolicyTest extends
 		createManifest(APPLICATION_A + ".mf", attributes);
 	}
 	
-	private static void createBundleA() throws IOException {
-		Map<String, String> headers = new HashMap<String, String>();
-		headers.put(Constants.IMPORT_PACKAGE, "x");
-		createBundle(BUNDLE_A, headers);
+	private void createBundleA() throws IOException {
+		createBundle(name(BUNDLE_A), importPackage("x"));
 	}
 	
-	private static void createBundleB() throws IOException {
-		Map<String, String> headers = new HashMap<String, String>();
-		headers.put(Constants.EXPORT_PACKAGE, "x");
-		createBundle(BUNDLE_B, headers);
+	private void createBundleB() throws IOException {
+		createBundle(name(BUNDLE_B), exportPackage("x"));
 	}
 	
-	private static void createCompositeA() throws IOException {
+	private void createCompositeA() throws IOException {
 		createCompositeAManifest();
 		createSubsystem(COMPOSITE_A);
 	}
 	
-	private static void createCompositeAManifest() throws IOException {
+	private void createCompositeAManifest() throws IOException {
 		Map<String, String> attributes = new HashMap<String, String>();
 		attributes.put(SubsystemConstants.SUBSYSTEM_SYMBOLICNAME, COMPOSITE_A);
 		attributes.put(SubsystemConstants.SUBSYSTEM_TYPE, SubsystemConstants.SUBSYSTEM_TYPE_COMPOSITE);
@@ -107,12 +99,12 @@ public class ProvisionPolicyTest extends
 		createManifest(COMPOSITE_A + ".mf", attributes);
 	}
 	
-	private static void createFeatureA() throws IOException {
+	private void createFeatureA() throws IOException {
 		createFeatureAManifest();
 		createSubsystem(FEATURE_A);
 	}
 	
-	private static void createFeatureAManifest() throws IOException {
+	private void createFeatureAManifest() throws IOException {
 		Map<String, String> attributes = new HashMap<String, String>();
 		attributes.put(SubsystemConstants.SUBSYSTEM_SYMBOLICNAME, FEATURE_A);
 		attributes
@@ -138,18 +130,14 @@ public class ProvisionPolicyTest extends
 		createManifest(FEATURE_B + ".mf", attributes);
 	}
 	
-	private static boolean createdTestFiles;
-	@Before
-	public static void createTestFiles() throws Exception {
-		if (createdTestFiles)
-			return;
+	@Override
+	public void createApplications() throws Exception {
 		createBundleA();
 		createBundleB();
 		createApplicationA();
 		createCompositeA();
 		createFeatureA();
 		createFeatureB();
-		createdTestFiles = true;
 	}
 	
 	public void setUp() throws Exception {

Modified: aries/branches/subsystemsR6/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/ResolutionTest.java
URL: http://svn.apache.org/viewvc/aries/branches/subsystemsR6/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/ResolutionTest.java?rev=1606837&r1=1606836&r2=1606837&view=diff
==============================================================================
--- aries/branches/subsystemsR6/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/ResolutionTest.java (original)
+++ aries/branches/subsystemsR6/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/ResolutionTest.java Mon Jun 30 16:54:57 2014
@@ -30,8 +30,6 @@ import org.apache.aries.subsystem.core.a
 import org.apache.aries.subsystem.core.archive.RequireCapabilityHeader;
 import org.junit.Before;
 import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.ops4j.pax.exam.junit.MavenConfiguredJUnit4TestRunner;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.Constants;
 import org.osgi.service.resolver.ResolutionException;
@@ -42,7 +40,6 @@ import org.osgi.service.subsystem.Subsys
 /*
  * Contains a series of tests related to resolution.
  */
-@RunWith(MavenConfiguredJUnit4TestRunner.class)
 public class ResolutionTest extends SubsystemTest {
 	/*
 	 * Subsystem-SymbolicName: application.a.esa
@@ -87,7 +84,7 @@ public class ResolutionTest extends Subs
 	private static final String BUNDLE_E = "bundle.e.jar";
 	
 	@Before
-	public static void createApplications() throws Exception {
+	public void createApplications() throws Exception {
 		if (createdApplications) {
 			return;
 		};
@@ -135,37 +132,28 @@ public class ResolutionTest extends Subs
 		createManifest(APPLICATION_C + ".mf", attributes);
 	}
 	
-	private static void createBundleA() throws IOException {
-		Map<String, String> headers = new HashMap<String, String>();
-		headers.put(Constants.REQUIRE_CAPABILITY, "a");
-		createBundle(BUNDLE_A, headers);
-	}
-	
-	private static void createBundleB() throws IOException {
-		Map<String, String> headers = new HashMap<String, String>();
-		headers.put(Constants.PROVIDE_CAPABILITY, "a");
-		headers.put(Constants.REQUIRE_CAPABILITY, "b");
-		createBundle(BUNDLE_B, headers);
-	}
-	
-	private static void createBundleC() throws IOException {
-		Map<String, String> headers = new HashMap<String, String>();
-		headers.put(Constants.PROVIDE_CAPABILITY, "b");
-		createBundle(BUNDLE_C, headers);
+	private void createBundleA() throws IOException {
+		createBundle(name(BUNDLE_A), new Header(Constants.REQUIRE_CAPABILITY, "a"));
+	}
+	
+	private void createBundleB() throws IOException {
+		createBundle(name(BUNDLE_B), 
+				provideCapability("a"),
+				requireCapability("b"));
+	}
+	
+	private void createBundleC() throws IOException {
+		createBundle(name(BUNDLE_C), provideCapability("b"));
 	}
 	
 	@SuppressWarnings("deprecation")
-	private static void createBundleD() throws IOException {
-		Map<String, String> headers = new HashMap<String, String>();
-		headers.put(Constants.BUNDLE_REQUIREDEXECUTIONENVIRONMENT, "JavaSE-100.100");
-		createBundle(BUNDLE_D, headers);
+	private void createBundleD() throws IOException {
+		createBundle(name(BUNDLE_D), new Header(Constants.BUNDLE_REQUIREDEXECUTIONENVIRONMENT, "JavaSE-100.100"));
 	}
 	
 	@SuppressWarnings("deprecation")
-	private static void createBundleE() throws IOException {
-		Map<String, String> headers = new HashMap<String, String>();
-		headers.put(Constants.BUNDLE_REQUIREDEXECUTIONENVIRONMENT, "J2SE-1.4, J2SE-1.5,		J2SE-1.6,JavaSE-1.7");
-		createBundle(BUNDLE_E, headers);
+	private void createBundleE() throws IOException {
+		createBundle(name(BUNDLE_E), new Header(Constants.BUNDLE_REQUIREDEXECUTIONENVIRONMENT, "J2SE-1.4, J2SE-1.5,		J2SE-1.6,JavaSE-1.7"));
 	}
 	
 	/*
@@ -214,7 +202,7 @@ public class ResolutionTest extends Subs
 			}
 		}
 		catch (SubsystemException e) {
-			fail("Application A should have installed");
+			fail("Application A should have installed." + e.getMessage());
 		}
 		finally {
 			uninstallSilently(bundleC);

Modified: aries/branches/subsystemsR6/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/RootSubsystemTest.java
URL: http://svn.apache.org/viewvc/aries/branches/subsystemsR6/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/RootSubsystemTest.java?rev=1606837&r1=1606836&r2=1606837&view=diff
==============================================================================
--- aries/branches/subsystemsR6/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/RootSubsystemTest.java (original)
+++ aries/branches/subsystemsR6/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/RootSubsystemTest.java Mon Jun 30 16:54:57 2014
@@ -24,19 +24,14 @@ import java.util.Map;
 import org.eclipse.equinox.region.Region;
 import org.eclipse.equinox.region.RegionDigraph;
 import org.eclipse.equinox.region.RegionFilter;
-import org.junit.Before;
 import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.ops4j.pax.exam.junit.MavenConfiguredJUnit4TestRunner;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleException;
-import org.osgi.framework.Constants;
 import org.osgi.framework.ServiceEvent;
 import org.osgi.framework.Version;
 import org.osgi.service.subsystem.Subsystem;
 import org.osgi.service.subsystem.SubsystemConstants;
 
-@RunWith(MavenConfiguredJUnit4TestRunner.class)
 public class RootSubsystemTest extends SubsystemTest {
 	/*
 	 * Subsystem-SymbolicName: application.a.esa
@@ -49,14 +44,10 @@ public class RootSubsystemTest extends S
 	 */
 	private static final String BUNDLE_A = "bundle.a.jar";
 	
-	private static boolean createdTestFiles;
-	@Before
-	public static void createTestFiles() throws Exception {
-		if (createdTestFiles)
-			return;
+	@Override
+	public void createApplications() throws Exception {
 		createBundleA();
 		createApplicationA();
-		createdTestFiles = true;
 	}
 	
 	private static void createApplicationA() throws IOException {
@@ -70,10 +61,8 @@ public class RootSubsystemTest extends S
 		createManifest(APPLICATION_A + ".mf", attributes);
 	}
 	
-	private static void createBundleA() throws IOException {
-		Map<String, String> headers = new HashMap<String, String>();
-		headers.put(Constants.IMPORT_PACKAGE, "org.osgi.framework");
-		createBundle(BUNDLE_A, headers);
+	private void createBundleA() throws IOException {
+		createBundle(name(BUNDLE_A), importPackage("org.osgi.framework"));
 	}
 	
 	// TODO Test root subsystem headers.
@@ -83,7 +72,7 @@ public class RootSubsystemTest extends S
 		bundleContext.installBundle(new File(BUNDLE_A).toURI().toURL().toString());
 		getSubsystemCoreBundle().stop();
 		getSubsystemCoreBundle().start();
-		Bundle bundleA = findBundleBySymbolicName(BUNDLE_A);
+		Bundle bundleA = context().getBundleByName(BUNDLE_A);
 		assertEquals("Extraneous root region bundle should not be started", Bundle.INSTALLED, bundleA.getState());
 	}
 	
@@ -177,7 +166,7 @@ public class RootSubsystemTest extends S
 	 */
 	@Test
 	public void testRegion() throws Exception {
-		RegionDigraph digraph = getOsgiService(RegionDigraph.class);
+		RegionDigraph digraph = context().getService(RegionDigraph.class);
 		Bundle core = getSubsystemCoreBundle();
 		Region kernel = digraph.getRegion(core);
 		Subsystem root = getRootSubsystem();

Modified: aries/branches/subsystemsR6/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/ServiceDependencyTest.java
URL: http://svn.apache.org/viewvc/aries/branches/subsystemsR6/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/ServiceDependencyTest.java?rev=1606837&r1=1606836&r2=1606837&view=diff
==============================================================================
--- aries/branches/subsystemsR6/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/ServiceDependencyTest.java (original)
+++ aries/branches/subsystemsR6/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/ServiceDependencyTest.java Mon Jun 30 16:54:57 2014
@@ -23,21 +23,16 @@ import java.util.List;
 import java.util.Map;
 
 import org.apache.aries.subsystem.itests.util.GenericMetadataWrapper;
-import org.apache.aries.unittest.fixture.ArchiveFixture;
 import org.apache.aries.util.manifest.ManifestHeaderProcessor;
 import org.apache.aries.util.manifest.ManifestHeaderProcessor.GenericMetadata;
 import org.junit.Assert;
-import org.junit.Before;
 import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.ops4j.pax.exam.junit.MavenConfiguredJUnit4TestRunner;
 import org.osgi.framework.InvalidSyntaxException;
 import org.osgi.framework.Version;
 import org.osgi.service.subsystem.Subsystem;
 import org.osgi.service.subsystem.SubsystemConstants;
 import org.osgi.service.subsystem.SubsystemException;
 
-@RunWith(MavenConfiguredJUnit4TestRunner.class)
 public class ServiceDependencyTest extends SubsystemTest {
 	/*
 	 * Subsystem-SymbolicName: application.a.esa
@@ -147,15 +142,10 @@ public class ServiceDependencyTest exten
 		createManifest(symbolicName + ".mf", attributes);
 	}
 	
-	private static void createBundle(String symbolicName, String blueprintXml)
-			throws IOException {
-		write(symbolicName,
-				ArchiveFixture.newJar().manifest().symbolicName(symbolicName)
-						.end().file("OSGI-INF/blueprint/blueprint.xml", blueprintXml));
-	}
+
 	
 	private static void createBundleA() throws IOException {
-		createBundle(
+		createBlueprintBundle(
 				BUNDLE_A, 
 				new StringBuilder()
 					.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>")
@@ -173,7 +163,7 @@ public class ServiceDependencyTest exten
 	}
 	
 	private static void createBundleB() throws IOException {
-		createBundle(
+		createBlueprintBundle(
 				BUNDLE_B, 
 				new StringBuilder()
 					.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>")
@@ -214,11 +204,8 @@ public class ServiceDependencyTest exten
 		createManifest(COMPOSITE_A + ".mf", attributes);
 	}
 	
-	private static boolean createdTestFiles;
-	@Before
-	public static void createTestFiles() throws Exception {
-		if (createdTestFiles)
-			return;
+	@Override
+	public void createApplications() throws Exception {
 		createBundleA();
 		createBundleB();
 		createApplicationA();
@@ -226,7 +213,6 @@ public class ServiceDependencyTest exten
 		createApplicationC();
 		createCompositeA();
 		createApplicationD();
-		createdTestFiles = true;
 	}
 	
 	//@Test
@@ -277,7 +263,7 @@ public class ServiceDependencyTest exten
 			try {
 				Subsystem child = installSubsystemFromFile(parent, APPLICATION_A);
 				try {
-					assertSubsystemImportServiceHeader(child, "osgi.service;filter:=\"(&(objectClass=bundle.b))\";resolution:=mandatory;cardinality:=single");
+					assertSubsystemImportServiceHeader(child, "osgi.service;filter:=\"(objectClass=bundle.b)\";resolution:=mandatory;cardinality:=single");
 				}
 				finally {
 					uninstallSubsystemSilently(child);
@@ -314,7 +300,7 @@ public class ServiceDependencyTest exten
 		try {
 			Subsystem subsystem = installSubsystemFromFile(APPLICATION_B);
 			try {
-				assertSubsystemImportServiceHeader(subsystem, "osgi.service;filter:=\"(&(objectClass=bundle.a))\";resolution:=optional;cardinality:=single");
+				assertSubsystemImportServiceHeader(subsystem, "osgi.service;filter:=\"(objectClass=bundle.a)\";resolution:=optional;cardinality:=single");
 			}
 			finally {
 				uninstallSubsystemSilently(subsystem);

Modified: aries/branches/subsystemsR6/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/SubsystemTest.java
URL: http://svn.apache.org/viewvc/aries/branches/subsystemsR6/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/SubsystemTest.java?rev=1606837&r1=1606836&r2=1606837&view=diff
==============================================================================
--- aries/branches/subsystemsR6/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/SubsystemTest.java (original)
+++ aries/branches/subsystemsR6/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/SubsystemTest.java Mon Jun 30 16:54:57 2014
@@ -19,8 +19,13 @@ import static org.junit.Assert.assertNot
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
-import static org.ops4j.pax.exam.CoreOptions.equinox;
+import static org.ops4j.pax.exam.CoreOptions.composite;
+import static org.ops4j.pax.exam.CoreOptions.junitBundles;
+import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
+import static org.ops4j.pax.exam.CoreOptions.streamBundle;
 import static org.ops4j.pax.exam.CoreOptions.systemProperty;
+import static org.ops4j.pax.exam.CoreOptions.vmOption;
+import static org.ops4j.pax.exam.CoreOptions.when;
 
 import java.io.File;
 import java.io.FileInputStream;
@@ -39,6 +44,8 @@ import java.util.Map;
 import java.util.Map.Entry;
 import java.util.concurrent.atomic.AtomicBoolean;
 
+import org.apache.aries.itest.AbstractIntegrationTest;
+import org.apache.aries.itest.RichBundleContext;
 import org.apache.aries.subsystem.AriesSubsystem;
 import org.apache.aries.subsystem.core.archive.ProvisionPolicyDirective;
 import org.apache.aries.subsystem.core.archive.SubsystemTypeHeader;
@@ -54,9 +61,14 @@ import org.apache.aries.unittest.fixture
 import org.apache.aries.util.filesystem.FileSystem;
 import org.eclipse.equinox.region.Region;
 import org.eclipse.equinox.region.RegionDigraph;
-import org.ops4j.pax.exam.CoreOptions;
+import org.junit.After;
+import org.junit.Before;
+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.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.BundleContext;
 import org.osgi.framework.BundleException;
@@ -79,7 +91,19 @@ import org.osgi.service.subsystem.Subsys
 import org.osgi.service.subsystem.Subsystem.State;
 import org.osgi.service.subsystem.SubsystemConstants;
 
-public abstract class SubsystemTest extends IntegrationTest {
+@RunWith(PaxExam.class)
+@ExamReactorStrategy(PerClass.class)
+public abstract class SubsystemTest extends AbstractIntegrationTest {
+	protected static boolean createdApplications = false;
+	boolean installModeler = true;
+	
+	public SubsystemTest() {
+	}
+	
+	public SubsystemTest(boolean installModeller) {
+		this.installModeler = installModeller;
+	}
+	
 	protected static class SubsystemEventHandler implements ServiceListener {
 		private static class ServiceEventInfo {
 			private final ServiceEvent event;
@@ -177,55 +201,59 @@ public abstract class SubsystemTest exte
 		}
 	}
 	
-	protected static Option[] defineOptions() {
+	public Option baseOptions() {
+        String localRepo = getLocalRepo();
+        return composite(
+                junitBundles(),
+                // this is how you set the default log level when using pax
+                // logging (logProfile)
+                systemProperty("org.ops4j.pax.logging.DefaultServiceLog.level").value("INFO"),
+                when(localRepo != null).useOptions(vmOption("-Dorg.ops4j.pax.url.mvn.localRepository=" + localRepo))
+         );
+    }
+	
+	@Configuration
+	public Option[] configuration() throws Exception {
+		// The itests need private packages from the core subsystems bundle.
+		InputStream fragment = SubsystemTest.class.getClassLoader().getResourceAsStream("core.fragment/core.fragment.jar");
 		return new Option[] {
-				// this is how you set the default log level when using pax
-				// logging (logProfile)
-				systemProperty("org.ops4j.pax.logging.DefaultServiceLog.level").value("INFO"),
+				baseOptions(),
 				systemProperty("org.osgi.framework.bsnversion").value("multiple"),
-				// Log
-				mavenBundle("org.ops4j.pax.logging", "pax-logging-api"),
-				mavenBundle("org.ops4j.pax.logging", "pax-logging-service"),
-				// Felix mvn url handler
-				mavenBundle("org.ops4j.pax.url", "pax-url-mvn"),
 				// Bundles
 				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.modeller").versionAsInProject(),
 				mavenBundle("org.apache.aries.application", "org.apache.aries.application.utils").versionAsInProject(),
-				mavenBundle("org.apache.aries.blueprint",   "org.apache.aries.blueprint").versionAsInProject(),
-				mavenBundle("org.apache.aries.proxy",       "org.apache.aries.proxy").versionAsInProject(),
+				mavenBundle("org.apache.aries.application", "org.apache.aries.application.api").versionAsInProject(),
+				when(installModeler).useOptions(
+						mavenBundle("org.apache.aries.application", "org.apache.aries.application.modeller").versionAsInProject(),
+						mavenBundle("org.apache.aries.blueprint",   "org.apache.aries.blueprint").versionAsInProject(),
+						mavenBundle("org.apache.aries.proxy",       "org.apache.aries.proxy").versionAsInProject()),
 				mavenBundle("org.apache.aries.subsystem",   "org.apache.aries.subsystem.api").versionAsInProject(),
-				// The itests need private packages from the core subsystems bundle.
-				CoreOptions.provision(SubsystemTest.class.getClassLoader().getResourceAsStream("core.fragment/core.fragment.jar")),
+				streamBundle(fragment).noStart(),
 				mavenBundle("org.apache.aries.subsystem",   "org.apache.aries.subsystem.core").versionAsInProject(),
 				mavenBundle("org.apache.aries.subsystem",   "org.apache.aries.subsystem.itest.interfaces").versionAsInProject(),
 				mavenBundle("org.apache.aries.testsupport", "org.apache.aries.testsupport.unit").versionAsInProject(),
-				mavenBundle("org.apache.felix",             "org.apache.felix.resolver"),
+				//mavenBundle("org.apache.felix",             "org.apache.felix.resolver").versionAsInProject(),
 				mavenBundle("org.eclipse.equinox",          "org.eclipse.equinox.coordinator").version("1.1.0.v20120522-1841"),
-				mavenBundle("org.eclipse.equinox",          "org.eclipse.equinox.event").version("1.2.200.v20120522-2049"),
+				mavenBundle("org.eclipse.equinox",          "org.eclipse.equinox.event").versionAsInProject(),
 				mavenBundle("org.eclipse.equinox",          "org.eclipse.equinox.region").version("1.1.0.v20120522-1841"),
 				mavenBundle("org.osgi",                     "org.osgi.enterprise").versionAsInProject(),
 				mavenBundle("org.easymock",					"easymock").versionAsInProject(),
+                mavenBundle("org.ops4j.pax.logging",        "pax-logging-api").versionAsInProject(),
+                mavenBundle("org.ops4j.pax.logging",        "pax-logging-service").versionAsInProject(),
 //				org.ops4j.pax.exam.container.def.PaxRunnerOptions.vmOption("-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=7777"),
-				PaxRunnerOptions.rawPaxRunnerOption("config", "classpath:ss-runner.properties"),
-				equinox().version("3.10.0.V20131210-2136")
 		};
 	}
 	
-	@org.ops4j.pax.exam.junit.Configuration
-	public static Option[] configuration() {
-		Option[] options = defineOptions();
-		options = updateOptions(options);
-		return options;
-	}
-	
 	protected final SubsystemEventHandler subsystemEvents = new SubsystemEventHandler();
 	
-	protected Collection<ServiceRegistration<?>> serviceRegistrations = new ArrayList<ServiceRegistration<?>>();
+	protected Collection<ServiceRegistration> serviceRegistrations = new ArrayList<ServiceRegistration>();
 	
+	@Before
 	public void setUp() throws Exception {
-		super.setUp();
+		if (!createdApplications) {
+			createApplications();
+			createdApplications = true;
+		}
 		try {
 			bundleContext.getBundle(0).getBundleContext().addServiceListener(subsystemEvents, '(' + Constants.OBJECTCLASS + '=' + Subsystem.class.getName() + ')');
 		}
@@ -235,13 +263,19 @@ public abstract class SubsystemTest exte
 		assertSubsystemNotNull(getRootSubsystem());
 	}
 	
+	protected abstract void createApplications() throws Exception;
+
+	@After
 	public void tearDown() throws Exception 
 	{
 		bundleContext.removeServiceListener(subsystemEvents);
-		for (ServiceRegistration<?> registration : serviceRegistrations)
+		for (ServiceRegistration registration : serviceRegistrations)
 			Utils.unregisterQuietly(registration);
 		serviceRegistrations.clear();
-		super.tearDown();
+	}
+	
+	protected RichBundleContext context(Subsystem subsystem) {
+		return new RichBundleContext(subsystem.getBundleContext());
 	}
 	
 	protected void assertEmptySubsystem(Subsystem subsystem) {
@@ -251,12 +285,12 @@ public abstract class SubsystemTest exte
     }
 	
 	protected void assertBundleState(int state, String symbolicName, Subsystem subsystem) {
-    	Bundle bundle = getBundle(subsystem, symbolicName);
+    	Bundle bundle = context(subsystem).getBundleByName(symbolicName);
+    	assertNotNull("Bundle not found: " + symbolicName, bundle);
     	assertBundleState(bundle, state);
     }
 	
 	protected void assertBundleState(Bundle bundle, int state) {
-		assertNotNull("Bundle not found: " + bundle, bundle);
 		assertTrue("Wrong state: " + bundle + " [expected " + state + " but was " + bundle.getState() + "]", (bundle.getState() & state) != 0);
 	}
 	
@@ -430,7 +464,7 @@ public abstract class SubsystemTest exte
 	protected void assertRefresh(Collection<Bundle> bundles) throws InterruptedException {
 		FrameworkWiring wiring = getSystemBundleAsFrameworkWiring();
 		final AtomicBoolean refreshed = new AtomicBoolean(false);
-		wiring.refreshBundles(bundles, new FrameworkListener() {
+		wiring.refreshBundles(bundles, new FrameworkListener[]{ new FrameworkListener() {
 			@Override
 			public void frameworkEvent(FrameworkEvent event) {
 				if (FrameworkEvent.PACKAGES_REFRESHED == event.getType()) {
@@ -440,7 +474,7 @@ public abstract class SubsystemTest exte
 					}
 				}
 			}
-		});
+		}});
 		synchronized (refreshed) {
 			refreshed.wait(5000);
 		}
@@ -493,7 +527,8 @@ public abstract class SubsystemTest exte
 	}
 	
 	protected void assertStartLevel(Bundle bundle, int expected) {
-		assertEquals("Wrong start level", expected, bundle.adapt(BundleStartLevel.class).getStartLevel());
+		assertNotNull("Bundle is null", bundle);
+		assertEquals("Wrong start level", expected, ((BundleStartLevel) bundle.adapt(BundleStartLevel.class)).getStartLevel());
 	}
 	
 	protected void assertState(State expected, State actual) {
@@ -513,7 +548,7 @@ public abstract class SubsystemTest exte
 	}
 	
 	protected Subsystem assertSubsystemLifeCycle(File file) throws Exception {
-		Subsystem rootSubsystem = getOsgiService(Subsystem.class);
+		Subsystem rootSubsystem = context().getService(Subsystem.class);
         assertNotNull("Root subsystem was null", rootSubsystem);
         Subsystem subsystem = rootSubsystem.install(file.toURI().toURL().toExternalForm());
         assertNotNull("The subsystem was null", subsystem);
@@ -567,24 +602,43 @@ public abstract class SubsystemTest exte
 		assertEquals("Wrong version", expected, actual);
 	}
 	
-	protected static void createBundle(String symbolicName) throws IOException {
-		createBundle(symbolicName, null);
+	protected Header version(String version) {
+		return new Header(Constants.BUNDLE_VERSION, version);
 	}
 	
-	protected static void createBundle(String symbolicName, Map<String, String> headers) throws IOException {
-		createBundle(symbolicName, null, headers);
+	protected Header name(String name) {
+		return new Header(Constants.BUNDLE_SYMBOLICNAME, name);
 	}
 	
-	protected static void createBundle(String symbolicName, String version, Map<String, String> headers) throws IOException {
-		if (headers == null)
-			headers = new HashMap<String, String>();
-		headers.put(Constants.BUNDLE_SYMBOLICNAME, symbolicName);
-		if (version != null)
-			headers.put(Constants.BUNDLE_VERSION, version);
-		createBundle(headers);
+	protected Header exportPackage(String exportPackage) {
+		return new Header(Constants.EXPORT_PACKAGE, exportPackage);
+	}
+	
+	protected Header importPackage(String importPackage) {
+		return new Header(Constants.IMPORT_PACKAGE, importPackage);
+	}
+
+	protected Header requireBundle(String bundleName) {
+		return new Header(Constants.REQUIRE_BUNDLE, bundleName);
 	}
 	
-	protected static void createBundle(Map<String, String> headers) throws IOException 
+	protected Header requireCapability(String capability) {
+		return new Header(Constants.REQUIRE_CAPABILITY, capability);
+	}
+
+	protected Header provideCapability(String capability) {
+		return new Header(Constants.PROVIDE_CAPABILITY, capability);
+	}
+	
+	protected static void createBundle(Header...  headers) throws IOException {
+		HashMap<String, String> headerMap = new HashMap<String, String>();
+		for (Header header : headers) {
+			headerMap.put(header.key, header.value);
+		}
+		createBundle(headerMap);
+	}
+	
+	private static void createBundle(Map<String, String> headers) throws IOException 
 	{
 		String symbolicName = headers.get(Constants.BUNDLE_SYMBOLICNAME);
 		JarFixture bundle = ArchiveFixture.newJar();
@@ -595,6 +649,13 @@ public abstract class SubsystemTest exte
 		write(symbolicName, bundle);
 	}
 	
+	protected static void createBlueprintBundle(String symbolicName, String blueprintXml)
+			throws IOException {
+		write(symbolicName,
+				ArchiveFixture.newJar().manifest().symbolicName(symbolicName)
+						.end().file("OSGI-INF/blueprint/blueprint.xml", blueprintXml));
+	}
+	
 	protected Resource createBundleRepositoryContent(String file) throws Exception {
 		return createBundleRepositoryContent(new File(file));
 	}
@@ -611,10 +672,6 @@ public abstract class SubsystemTest exte
 		write(name, manifest);
 	}
 	
-	protected static void createSubsystem(String name) throws IOException {
-		createSubsystem(name, new String[0]);
-	}
-	
 	protected static void createSubsystem(String name, String...contents) throws IOException {
 		File manifest = new File(name + ".mf");
 		ZipFixture fixture = ArchiveFixture.newZip();
@@ -632,16 +689,7 @@ public abstract class SubsystemTest exte
 	
 	protected Subsystem findSubsystemService(long id) throws InvalidSyntaxException {
 		String filter = "(" + SubsystemConstants.SUBSYSTEM_ID_PROPERTY + "=" + id + ")";
-		return getOsgiService(Subsystem.class, filter, 5000);
-	}
-	
-	protected Bundle getBundle(Subsystem subsystem, String symbolicName) {
-		for (Bundle bundle : subsystem.getBundleContext().getBundles()) {
-			if (symbolicName.equals(bundle.getSymbolicName())) { 
-				return bundle;
-			}
-		}
-		return null;
+		return context().getService(Subsystem.class, filter, 5000);
 	}
 	
 	protected Subsystem getChild(Subsystem parent, String symbolicName) {
@@ -706,7 +754,7 @@ public abstract class SubsystemTest exte
 	}
 	
 	protected Region getRegion(Subsystem subsystem) {
-		RegionDigraph digraph = getOsgiService(RegionDigraph.class);
+		RegionDigraph digraph = context().getService(RegionDigraph.class);
 		String name = getRegionName(subsystem);
 		Region region = digraph.getRegion(name);
 		assertNotNull("Region not found: " + name, region);
@@ -726,11 +774,11 @@ public abstract class SubsystemTest exte
 	}
 	
 	protected AriesSubsystem getRootAriesSubsystem() {
-		return getOsgiService(AriesSubsystem.class);
+		return context().getService(AriesSubsystem.class);
 	}
 	
 	protected Subsystem getRootSubsystem() {
-		return getOsgiService(Subsystem.class, "(&(objectClass=org.osgi.service.subsystem.Subsystem)(subsystem.id=0))", DEFAULT_TIMEOUT);
+		return context().getService(Subsystem.class, "(subsystem.id=0)");
 	}
 	
 	protected Subsystem getRootSubsystemInState(Subsystem.State state, long timeout) throws InterruptedException {
@@ -749,36 +797,32 @@ public abstract class SubsystemTest exte
 	}
 	
 	protected FrameworkStartLevel getSystemBundleAsFrameworkStartLevel() {
-		return getSystemBundle().adapt(FrameworkStartLevel.class);
+		return (FrameworkStartLevel) getSystemBundle().adapt(FrameworkStartLevel.class);
 	}
 	
 	protected FrameworkWiring getSystemBundleAsFrameworkWiring() {
-		return getSystemBundle().adapt(FrameworkWiring.class);
+		return (FrameworkWiring) getSystemBundle().adapt(FrameworkWiring.class);
 	}
 	
 	protected Bundle getSubsystemCoreBundle() {
-		return findBundleBySymbolicName("org.apache.aries.subsystem.core");
+		return context().getBundleByName("org.apache.aries.subsystem.core");
 	}
 	
 	protected Bundle installBundleFromFile(String fileName) throws FileNotFoundException, BundleException {
-		return installBundleFromFile(new File(fileName));
-	}
-	
-	protected Bundle installBundleFromFile(File file) throws FileNotFoundException, BundleException {
-		return installBundleFromFile(file, getRootSubsystem());
+		return installBundleFromFile(new File(fileName), getRootSubsystem());
 	}
 	
-	protected Bundle installBundleFromFile(String file, Subsystem subsystem) throws FileNotFoundException, BundleException {
-		return installBundleFromFile(new File(file), subsystem);
+	protected Bundle installBundleFromFile(String fileName, Subsystem subsystem) throws FileNotFoundException, BundleException {
+		return installBundleFromFile(new File(fileName), subsystem);
 	}
 	
-	protected Bundle installBundleFromFile(File file, Subsystem subsystem) throws FileNotFoundException, BundleException {
+	private Bundle installBundleFromFile(File file, Subsystem subsystem) throws FileNotFoundException, BundleException {
 		Bundle bundle = installBundleFromFile(file, subsystem.getBundleContext());
 		assertBundleState(Bundle.INSTALLED|Bundle.RESOLVED, bundle.getSymbolicName(), subsystem);
 		return bundle;
 	}
 	
-	protected Bundle installBundleFromFile(File file, BundleContext bundleContext) throws FileNotFoundException, BundleException {
+	private Bundle installBundleFromFile(File file, BundleContext bundleContext) throws FileNotFoundException, BundleException {
 		// The following input stream is closed by the bundle context.
 		return bundleContext.installBundle(file.toURI().toString(), new FileInputStream(file));
 	}
@@ -795,7 +839,7 @@ public abstract class SubsystemTest exte
 		return installSubsystem(parent, file.toURI().toURL().toExternalForm());
 	}
 	
-	protected Subsystem installSubsystemFromFile(File file) throws Exception {
+	private Subsystem installSubsystemFromFile(File file) throws Exception {
 		return installSubsystem(getRootSubsystem(), file.toURI().toURL().toExternalForm());
 	}
 	
@@ -928,7 +972,7 @@ public abstract class SubsystemTest exte
 		Collection<Subsystem> parents = subsystem.getParents();
 		Bundle b = null;
 		Region region = null;
-		RegionDigraph digraph = getOsgiService(RegionDigraph.class);
+		RegionDigraph digraph = context().getService(RegionDigraph.class);
 		if (subsystem.getType().equals(SubsystemConstants.SUBSYSTEM_TYPE_APPLICATION)
 				|| subsystem.getType().equals(SubsystemConstants.SUBSYSTEM_TYPE_COMPOSITE)) {
 			b = getRegionContextBundle(subsystem);
@@ -967,7 +1011,7 @@ public abstract class SubsystemTest exte
 		write(new File(file), fixture);
 	}
 	
-	protected static void write(File file, ArchiveFixture.AbstractFixture fixture) throws IOException {
+	private static void write(File file, ArchiveFixture.AbstractFixture fixture) throws IOException {
 		FileOutputStream fos = new FileOutputStream(file);
     	try {
     		fixture.writeOut(fos);
@@ -977,7 +1021,7 @@ public abstract class SubsystemTest exte
     	}
 	}
 	
-	static void createApplication(String name, String[] content) throws Exception 
+	static void createApplication(String name, String ... content) throws Exception 
 	{
 		ZipFixture feature = ArchiveFixture
 				.newZip()

Modified: aries/branches/subsystemsR6/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/UnmanagedBundleTest.java
URL: http://svn.apache.org/viewvc/aries/branches/subsystemsR6/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/UnmanagedBundleTest.java?rev=1606837&r1=1606836&r2=1606837&view=diff
==============================================================================
--- aries/branches/subsystemsR6/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/UnmanagedBundleTest.java (original)
+++ aries/branches/subsystemsR6/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/UnmanagedBundleTest.java Mon Jun 30 16:54:57 2014
@@ -21,10 +21,7 @@ package org.apache.aries.subsystem.itest
 import java.io.FileInputStream;
 import java.io.IOException;
 
-import org.junit.Before;
 import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.ops4j.pax.exam.junit.MavenConfiguredJUnit4TestRunner;
 import org.osgi.framework.Bundle;
 import org.osgi.service.subsystem.Subsystem;
 
@@ -32,24 +29,19 @@ import org.osgi.service.subsystem.Subsys
  * Contains a series of tests for unmanaged bundles. An unmanaged bundle is a
  * bundle that was installed outside of the Subsystems API.
  */
-@RunWith(MavenConfiguredJUnit4TestRunner.class)
 public class UnmanagedBundleTest extends SubsystemTest {
 	/*
 	 * Bundle-SymbolicName: bundle.a.jar
 	 */
 	private static final String BUNDLE_A = "bundle.a.jar";
 	
-	@Before
-	public static void createApplications() throws Exception {
-		if (createdApplications) {
-			return;
-		};
+	@Override
+	public void createApplications() throws Exception {
 		createBundleA();
-		createdApplications = true;
 	}
 	
-	private static void createBundleA() throws IOException {
-		createBundle(BUNDLE_A);
+	private void createBundleA() throws IOException {
+		createBundle(name(BUNDLE_A));
 	}
 	
 	/*

Modified: aries/branches/subsystemsR6/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/obr/felix/FelixCapabilityAdapter.java
URL: http://svn.apache.org/viewvc/aries/branches/subsystemsR6/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/obr/felix/FelixCapabilityAdapter.java?rev=1606837&r1=1606836&r2=1606837&view=diff
==============================================================================
--- aries/branches/subsystemsR6/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/obr/felix/FelixCapabilityAdapter.java (original)
+++ aries/branches/subsystemsR6/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/obr/felix/FelixCapabilityAdapter.java Mon Jun 30 16:54:57 2014
@@ -31,6 +31,7 @@ public class FelixCapabilityAdapter exte
 		this.resource = resource;
 	}
 
+	@SuppressWarnings("unchecked")
 	public Map<String, Object> getAttributes() {
 		Map<String, Object> result = capability.getPropertiesAsMap();
 		result.put(getNamespace(), result.get(capability.getName()));

Modified: aries/branches/subsystemsR6/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/obr/felix/OsgiResourceAdapter.java
URL: http://svn.apache.org/viewvc/aries/branches/subsystemsR6/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/obr/felix/OsgiResourceAdapter.java?rev=1606837&r1=1606836&r2=1606837&view=diff
==============================================================================
--- aries/branches/subsystemsR6/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/obr/felix/OsgiResourceAdapter.java (original)
+++ aries/branches/subsystemsR6/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/obr/felix/OsgiResourceAdapter.java Mon Jun 30 16:54:57 2014
@@ -56,6 +56,7 @@ public class OsgiResourceAdapter impleme
 		return ResourceHelper.getSymbolicNameAttribute(resource);
 	}
 
+	@SuppressWarnings("rawtypes")
 	public Map getProperties() {
 		return Collections.emptyMap();
 	}

Modified: aries/branches/subsystemsR6/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/util/GenericMetadataWrapper.java
URL: http://svn.apache.org/viewvc/aries/branches/subsystemsR6/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/util/GenericMetadataWrapper.java?rev=1606837&r1=1606836&r2=1606837&view=diff
==============================================================================
--- aries/branches/subsystemsR6/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/util/GenericMetadataWrapper.java (original)
+++ aries/branches/subsystemsR6/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/util/GenericMetadataWrapper.java Mon Jun 30 16:54:57 2014
@@ -48,4 +48,13 @@ public class GenericMetadataWrapper {
 		result = 31 * result + metadata.getDirectives().hashCode();
 		return result;
 	}
+
+    @Override
+    public String toString() {
+        return "GenericMetadata[" +
+                "namespace=" + metadata.getNamespace() + ", " +
+                "directives=" + metadata.getDirectives() + "," +
+                "attributes=" + metadata.getAttributes() + "," +
+                "]";
+    }
 }

Modified: aries/branches/subsystemsR6/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/util/RepositoryGenerator.java
URL: http://svn.apache.org/viewvc/aries/branches/subsystemsR6/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/util/RepositoryGenerator.java?rev=1606837&r1=1606836&r2=1606837&view=diff
==============================================================================
--- aries/branches/subsystemsR6/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/util/RepositoryGenerator.java (original)
+++ aries/branches/subsystemsR6/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/util/RepositoryGenerator.java Mon Jun 30 16:54:57 2014
@@ -16,8 +16,6 @@ package org.apache.aries.subsystem.itest
 import java.io.File;
 import java.io.FileOutputStream;
 import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
@@ -30,15 +28,11 @@ import javax.xml.transform.stream.Stream
 
 import org.apache.aries.application.Content;
 import org.apache.aries.application.management.BundleInfo;
-import org.apache.aries.subsystem.core.internal.ResourceHelper;
 import org.apache.aries.subsystem.itests.obr.felix.FelixResourceAdapter;
 import org.apache.aries.subsystem.itests.obr.felix.OsgiResourceAdapter;
-import org.apache.felix.bundlerepository.Capability;
-import org.apache.felix.bundlerepository.Property;
 import org.apache.felix.bundlerepository.Reason;
 import org.apache.felix.bundlerepository.Repository;
 import org.apache.felix.bundlerepository.RepositoryAdmin;
-import org.apache.felix.bundlerepository.Requirement;
 import org.apache.felix.bundlerepository.Resolver;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceReference;
@@ -133,10 +127,9 @@ public class RepositoryGenerator {
 
     }
 
-    private void registerOBR() {
+	private void registerOBR() {
         // set repositoryAdmin
-        ServiceReference ref = context
-                .getServiceReference(RepositoryAdmin.class.getName());
+        ServiceReference ref = context.getServiceReference(RepositoryAdmin.class);
         
         if (ref != null) {
             this.repositoryAdmin = (RepositoryAdmin) context.getService(ref);
@@ -159,7 +152,8 @@ public class RepositoryGenerator {
     /**
      * the format of resource is like bundlesymbolicname;version=1.0.0, for example com.ibm.ws.eba.example.blog.api;version=1.0.0,
      */
-    public Resource find(String resource) throws SubsystemException {
+    @SuppressWarnings({ "rawtypes", "unused" })
+	public Resource find(String resource) throws SubsystemException {
         generateOBR();
         
         Content content = new ContentImpl(resource);
@@ -197,47 +191,7 @@ public class RepositoryGenerator {
 
         return new FelixResourceAdapter(res);
     }
-    
-    /**
-     * the format of resource is like bundlesymbolicname;version=1.0.0, for example com.ibm.ws.eba.example.blog.api;version=1.0.0,
-     */
-    private org.apache.felix.bundlerepository.Resource findOBRResource(Resource resource) throws SubsystemException {
-        String symbolicName = ResourceHelper.getSymbolicNameAttribute(resource);
-        // this version could possibly be a range
-        Version version = ResourceHelper.getVersionAttribute(resource);
 
-        //org.apache.felix.bundlerepository.Resource[] res = this.repositoryAdmin.discoverResources(filterString.toString());
-        Repository[] repos = this.repositoryAdmin.listRepositories();
-        org.apache.felix.bundlerepository.Resource res = null;
-        for (Repository repo : repos) {
-            org.apache.felix.bundlerepository.Resource[] resources = repo.getResources();
-            for (int i = 0; i < resources.length; i++) {
-                if (resources[i].getSymbolicName().equals(symbolicName)) {
-                    if (resources[i].getVersion().compareTo(version) == 0) {
-                        res = resources[i];
-                    }
-                }
-            }
-        }
-        return res;
-    }
-
-    /**
-     * convert to the resource from the obr resource
-     */
-    private Resource toResource(org.apache.felix.bundlerepository.Resource resource) throws SubsystemException {
-        if (resource == null) {
-            throw new SubsystemException("unable to find the resource " + resource);
-        }
-        
-        Map props = resource.getProperties();
-        
-
-        Object type = props.get(IdentityNamespace.CAPABILITY_TYPE_ATTRIBUTE);
-
-        return new FelixResourceAdapter(resource);
-    }
-    
     public List<Resource> resolve(List<Resource> subsystemContent,
             List<Resource> subsystemResources) throws SubsystemException {
         generateOBR();
@@ -291,73 +245,5 @@ public class RepositoryGenerator {
         }
         return resources;
     }
-    
-    private org.apache.felix.bundlerepository.Resource convert(final Resource resource) {
-    	return new org.apache.felix.bundlerepository.Resource() {
-			public Capability[] getCapabilities() {
-				Collection<Capability> result = new ArrayList<Capability>(resource.getCapabilities(null).size());
-				for (org.osgi.resource.Capability capability : resource.getCapabilities(null)) {
-					result.add(new Capability() {
-						public String getName() {
-							// TODO Auto-generated method stub
-							return null;
-						}
-
-						public Property[] getProperties() {
-							// TODO Auto-generated method stub
-							return null;
-						}
-
-						public Map getPropertiesAsMap() {
-							// TODO Auto-generated method stub
-							return null;
-						}
-					});
-				}
-				return null;
-			}
-
-			public String[] getCategories() {
-				return new String[0];
-			}
-
-			public String getId() {
-				return getSymbolicName() + ";version=" + getVersion();
-			}
-
-			public String getPresentationName() {
-				return getSymbolicName();
-			}
-
-			public Map getProperties() {
-				return Collections.EMPTY_MAP;
-			}
-
-			public Requirement[] getRequirements() {
-				// TODO Auto-generated method stub
-				return null;
-			}
-
-			public Long getSize() {
-				return 0L;
-			}
-
-			public String getSymbolicName() {
-				return ResourceHelper.getSymbolicNameAttribute(resource);
-			}
-
-			public String getURI() {
-				return ResourceHelper.getContentAttribute(resource);
-			}
-
-			public Version getVersion() {
-				return ResourceHelper.getVersionAttribute(resource);
-			}
-
-			public boolean isLocal() {
-				return false;
-			}
-    	};
-    }
 
 }

Modified: aries/branches/subsystemsR6/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/util/Utils.java
URL: http://svn.apache.org/viewvc/aries/branches/subsystemsR6/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/util/Utils.java?rev=1606837&r1=1606836&r2=1606837&view=diff
==============================================================================
--- aries/branches/subsystemsR6/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/util/Utils.java (original)
+++ aries/branches/subsystemsR6/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/util/Utils.java Mon Jun 30 16:54:57 2014
@@ -26,7 +26,7 @@ public class Utils {
 		catch (Exception e) {}
 	}
 	
-	public static void unregisterQuietly(ServiceRegistration<?> reg) {
+	public static void unregisterQuietly(ServiceRegistration reg) {
 		if (reg == null) return;
 		try {
 			reg.unregister();

Modified: aries/branches/subsystemsR6/subsystem/subsystem-itests/src/test/resources/ss-runner.properties
URL: http://svn.apache.org/viewvc/aries/branches/subsystemsR6/subsystem/subsystem-itests/src/test/resources/ss-runner.properties?rev=1606837&r1=1606836&r2=1606837&view=diff
==============================================================================
--- aries/branches/subsystemsR6/subsystem/subsystem-itests/src/test/resources/ss-runner.properties (original)
+++ aries/branches/subsystemsR6/subsystem/subsystem-itests/src/test/resources/ss-runner.properties Mon Jun 30 16:54:57 2014
@@ -68,7 +68,7 @@ platform.equinox.3.7.0.V20110221=org.ops
 platform.equinox.3.8.0.V20110621=org.ops4j.pax.runner.platform.equinox.internal.SsActivator
 platform.equinox.3.8.0-SNAPSHOT=org.ops4j.pax.runner.platform.equinox.internal.SsActivator
 platform.equinox.3.8.0.V20120529-1548=org.ops4j.pax.runner.platform.equinox.internal.SsActivator
-platform.equinox.3.10.0.V20131210-2136=org.ops4j.pax.runner.platform.equinox.internal.SsActivator
+platform.equinox.3.10.0.V20140606-1445=org.ops4j.pax.runner.platform.equinox.internal.SsActivator
 # Felix
 platform.felix.1.0.0=org.ops4j.pax.runner.platform.felix.internal.Activator
 platform.felix.1.0.1=org.ops4j.pax.runner.platform.felix.internal.Activator



Mime
View raw message