aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mnutt...@apache.org
Subject svn commit: r1358119 - in /aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem: ctt/itests/ itests/
Date Fri, 06 Jul 2012 11:05:48 GMT
Author: mnuttall
Date: Fri Jul  6 11:05:47 2012
New Revision: 1358119

URL: http://svn.apache.org/viewvc?rev=1358119&view=rev
Log:
Aries-865: Code tidy

Added:
    aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/ctt/itests/SubsystemDependency_4CTest.java
Modified:
    aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/ctt/itests/SubsystemDependencyTestBase.java
    aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/ctt/itests/SubsystemDependency_4ATest.java
    aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/ctt/itests/SubsystemDependency_4BTest.java
    aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/ApplicationTest.java
    aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/BasicTest.java
    aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/FeatureTest.java
    aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/HelloWorldTest.java
    aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/InstallTest.java
    aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/SubsystemTest.java

Modified: aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/ctt/itests/SubsystemDependencyTestBase.java
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/ctt/itests/SubsystemDependencyTestBase.java?rev=1358119&r1=1358118&r2=1358119&view=diff
==============================================================================
--- aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/ctt/itests/SubsystemDependencyTestBase.java
(original)
+++ aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/ctt/itests/SubsystemDependencyTestBase.java
Fri Jul  6 11:05:47 2012
@@ -13,6 +13,8 @@ import org.apache.aries.subsystem.itests
 import org.junit.After;
 import org.junit.Before;
 import org.junit.BeforeClass;
+import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.junit.JUnit4TestRunner;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.Constants;
 import org.osgi.framework.wiring.BundleWire;
@@ -49,6 +51,7 @@ import org.osgi.service.subsystem.Subsys
 	  - Bundle E
  */
 
+@RunWith(JUnit4TestRunner.class)
 public abstract class SubsystemDependencyTestBase extends SubsystemTest 
 {
 	protected static String BUNDLE_A = "sdt_bundle.a.jar";
@@ -59,22 +62,25 @@ public abstract class SubsystemDependenc
 	protected static String BUNDLE_F = "sdt_bundle.f.jar";
 	protected static String BUNDLE_G = "sdt_bundle.g.jar";
 
-	@BeforeClass
-	public static void createStaticResources() throws Exception
-	{ 
-		createBundleA();
-		createBundleB();
-		createBundleC();
-		createBundleD();
-		createBundleE();
-		createBundleF();
-		createBundleG();
-	}
-	
+	private static boolean _staticResourcesCreated = false;
 	@Before
 	public void setUp() throws Exception
 	{
 		super.setUp();
+		
+		// We'd like to do this in an @BeforeClass method, but files written in @BeforeClass
+		// go into the project's target/ directory whereas those written in @Before go into 
+		// paxexam's temp directory, which is where they're needed. 
+		if (!_staticResourcesCreated) { 
+			createBundleA();
+			createBundleB();
+			createBundleC();
+			createBundleD();
+			createBundleE();
+			createBundleF();
+			createBundleG();
+			_staticResourcesCreated = true;
+		}
 	}
 	
 	@After

Modified: aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/ctt/itests/SubsystemDependency_4ATest.java
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/ctt/itests/SubsystemDependency_4ATest.java?rev=1358119&r1=1358118&r2=1358119&view=diff
==============================================================================
--- aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/ctt/itests/SubsystemDependency_4ATest.java
(original)
+++ aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/ctt/itests/SubsystemDependency_4ATest.java
Fri Jul  6 11:05:47 2012
@@ -1,23 +1,14 @@
 package org.apache.aries.subsystem.ctt.itests;
 
 import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
-import static org.osgi.framework.namespace.BundleNamespace.BUNDLE_NAMESPACE;
-import static org.osgi.framework.namespace.PackageNamespace.PACKAGE_NAMESPACE;
 
 import java.util.HashMap;
-import java.util.List;
 import java.util.Map;
 
 import org.junit.Before;
-import org.junit.BeforeClass;
 import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.ops4j.pax.exam.junit.JUnit4TestRunner;
 import org.osgi.framework.Bundle;
-import org.osgi.framework.wiring.BundleWire;
-import org.osgi.framework.wiring.BundleWiring;
 import org.osgi.service.subsystem.Subsystem;
 import org.osgi.service.subsystem.SubsystemConstants;
 
@@ -37,22 +28,19 @@ A) Test a transitively closed subsystem 
  
 */
 
-
-@RunWith(JUnit4TestRunner.class)
 public class SubsystemDependency_4ATest extends SubsystemDependencyTestBase 
 {
 	protected static String APPLICATION_A="sdt_application.a.esa";
-
-	@BeforeClass
-	public static void createTestApplication() throws Exception
-	{ 
-		createTestApplicationA();
-	}
+	private static boolean _testAppCreated = false;
 	
 	@Before
 	public void setUp() throws Exception
 	{
 		super.setUp();
+		if (!_testAppCreated) { 
+			createTestApplicationA();
+			_testAppCreated = true;
+		}
 		registerRepositoryR1();
 	}
 	

Modified: aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/ctt/itests/SubsystemDependency_4BTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/ctt/itests/SubsystemDependency_4BTest.java?rev=1358119&r1=1358118&r2=1358119&view=diff
==============================================================================
--- aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/ctt/itests/SubsystemDependency_4BTest.java
(original)
+++ aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/ctt/itests/SubsystemDependency_4BTest.java
Fri Jul  6 11:05:47 2012
@@ -8,10 +8,7 @@ import java.util.HashMap;
 import java.util.Map;
 
 import org.junit.Before;
-import org.junit.BeforeClass;
 import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.ops4j.pax.exam.junit.JUnit4TestRunner;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.Constants;
 import org.osgi.service.subsystem.Subsystem;
@@ -28,22 +25,21 @@ import org.osgi.service.subsystem.Subsys
      - Verify the wiring of C, D and E wire to A->x, A, B->y respectively
  */
 
-@RunWith(JUnit4TestRunner.class)
 public class SubsystemDependency_4BTest extends SubsystemDependencyTestBase 
 {
 
-	protected static String APPLICATION_B="sdt_application.a.esa";
+	protected static String APPLICATION_B="sdt_application.b.esa";
 	
-	@BeforeClass
-	public static void createTestApp() throws Exception
-	{ 
-		createTestApplicationB();
-	}
+	private static boolean appCreated = false;
 	
 	@Before
 	public void setUp() throws Exception
 	{ 
 		super.setUp();
+		if (!appCreated) { 
+			createTestApplicationB();
+			appCreated = true;
+		}
 		registerRepositoryR2();
 	}
 	

Added: aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/ctt/itests/SubsystemDependency_4CTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/ctt/itests/SubsystemDependency_4CTest.java?rev=1358119&view=auto
==============================================================================
--- aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/ctt/itests/SubsystemDependency_4CTest.java
(added)
+++ aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/ctt/itests/SubsystemDependency_4CTest.java
Fri Jul  6 11:05:47 2012
@@ -0,0 +1,58 @@
+package org.apache.aries.subsystem.ctt.itests;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.osgi.framework.Constants;
+import org.osgi.service.subsystem.SubsystemConstants;
+
+public class SubsystemDependency_4CTest extends SubsystemDependencyTestBase 
+{
+	/*
+	 C) Test with pre-installed transitive resources
+     - Register repository R1
+     - Using the Root subsystem, install a composite subsystem S1 with the following content
bundles (with no import/export policy)
+       - Bundle A
+       - Bundle B
+     - Using the subsystem S1, install a composite S2 that imports package x, requires bundle
A and required capability y
+     - Verify the wiring of C, D and E wire to A->x, A, B->y respectively 
+     - Verify no new bundles are installed into the Root or S1 subsystems
+	 */
+	private static final String SUBSYSTEM_S1 = "sdt_composite.s1.esa";
+	
+	private static boolean _testSubsystemCreated = false;
+	@Before
+	public void setUp() throws Exception
+	{ 
+		super.setUp();
+		if (!_testSubsystemCreated) { 
+			createSubsystemS1();
+			_testSubsystemCreated = true;
+		}
+	}
+	
+	@Test
+	public void verifyCinS1WiresToAxInS2() 
+	{
+		
+	}
+	
+	private static void createSubsystemS1() throws Exception
+	{
+		Map<String, String> attributes = new HashMap<String, String>();
+		attributes.put(SubsystemConstants.SUBSYSTEM_SYMBOLICNAME, SUBSYSTEM_S1);
+		attributes.put(SubsystemConstants.SUBSYSTEM_TYPE, SubsystemConstants.SUBSYSTEM_TYPE_COMPOSITE);
+		String appContent = BUNDLE_C + ";" + Constants.VERSION_ATTRIBUTE + "=\"[1.0.0,1.0.0]\""
+			+ ", " + BUNDLE_D + ";" + Constants.VERSION_ATTRIBUTE + "=\"[1.0.0,1.0.0]\""
+			+ ", " + BUNDLE_E + ";" + Constants.VERSION_ATTRIBUTE + "=\"[1.0.0,1.0.0]\"";
+		attributes.put(SubsystemConstants.SUBSYSTEM_CONTENT, appContent);
+		attributes.put(Constants.IMPORT_PACKAGE, "x");
+		attributes.put(Constants.REQUIRE_BUNDLE, BUNDLE_A);
+		attributes.put(Constants.REQUIRE_CAPABILITY, "y;filter:=\"(bug=true)\"");
+		createManifest(SUBSYSTEM_S1 + ".mf", attributes);
+		createSubsystem(SUBSYSTEM_S1);
+	}
+
+}

Modified: aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/ApplicationTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/ApplicationTest.java?rev=1358119&r1=1358118&r2=1358119&view=diff
==============================================================================
--- aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/ApplicationTest.java
(original)
+++ aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/ApplicationTest.java
Fri Jul  6 11:05:47 2012
@@ -21,7 +21,6 @@ package org.apache.aries.subsystem.itest
 import java.io.ByteArrayOutputStream;
 import java.io.File;
 import java.io.FileInputStream;
-import java.io.FileOutputStream;
 import java.io.IOException;
 import java.util.HashMap;
 import java.util.Map;
@@ -32,9 +31,6 @@ import java.util.jar.Manifest;
 import org.apache.aries.subsystem.itests.util.TestCapability;
 import org.apache.aries.subsystem.itests.util.TestRepository;
 import org.apache.aries.subsystem.itests.util.TestRepositoryContent;
-import org.apache.aries.subsystem.itests.util.Utils;
-import org.apache.aries.unittest.fixture.ArchiveFixture;
-import org.apache.aries.unittest.fixture.ArchiveFixture.ZipFixture;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -133,31 +129,6 @@ public class ApplicationTest extends Sub
 		createManifest(APPLICATION_B + ".mf", attributes);
 	}
 	
-	private static void createApplication(String name, String[] content) throws Exception {
-		ZipFixture feature = ArchiveFixture
-				.newZip()
-				.binary("OSGI-INF/SUBSYSTEM.MF",
-						ApplicationTest.class.getClassLoader().getResourceAsStream(
-								name + "/OSGI-INF/SUBSYSTEM.MF"));
-		for (String s : content) {
-			try {
-				feature.binary(s,
-						ApplicationTest.class.getClassLoader().getResourceAsStream(
-								name + '/' + s));
-			}
-			catch (Exception e) {
-				feature.binary(s, new FileInputStream(new File(s)));
-			}
-		}
-		feature.end();
-		FileOutputStream fos = new FileOutputStream(name + ".esa");
-		try {
-			feature.writeOut(fos);
-		} finally {
-			Utils.closeQuietly(fos);
-		}
-	}
-	
 	@Before
 	public static void createApplications() throws Exception {
 		if (createdApplications) {

Modified: aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/BasicTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/BasicTest.java?rev=1358119&r1=1358118&r2=1358119&view=diff
==============================================================================
--- aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/BasicTest.java
(original)
+++ aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/BasicTest.java
Fri Jul  6 11:05:47 2012
@@ -21,13 +21,6 @@ package org.apache.aries.subsystem.itest
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-
-import org.apache.aries.subsystem.itests.util.Utils;
-import org.apache.aries.unittest.fixture.ArchiveFixture;
-import org.apache.aries.unittest.fixture.ArchiveFixture.ZipFixture;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -40,30 +33,6 @@ import org.osgi.service.subsystem.Subsys
 
 @RunWith(JUnit4TestRunner.class)
 public class BasicTest extends SubsystemTest {
-	private static void createApplication(String name, String[] content) throws Exception {
-		ZipFixture feature = ArchiveFixture
-				.newZip()
-				.binary("OSGI-INF/SUBSYSTEM.MF",
-						FeatureTest.class.getClassLoader().getResourceAsStream(
-								name + "/OSGI-INF/SUBSYSTEM.MF"));
-		for (String s : content) {
-			try {
-				feature.binary(s,
-						FeatureTest.class.getClassLoader().getResourceAsStream(
-								name + '/' + s));
-			}
-			catch (Exception e) {
-				feature.binary(s, new FileInputStream(new File(s)));
-			}
-		}
-		feature.end();
-		FileOutputStream fos = new FileOutputStream(name + ".esa");
-		try {
-			feature.writeOut(fos);
-		} finally {
-			Utils.closeQuietly(fos);
-		}
-	}
 	
 	@Before
 	public static void createApplications() throws Exception {

Modified: aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/FeatureTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/FeatureTest.java?rev=1358119&r1=1358118&r2=1358119&view=diff
==============================================================================
--- aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/FeatureTest.java
(original)
+++ aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/FeatureTest.java
Fri Jul  6 11:05:47 2012
@@ -18,17 +18,11 @@
  */
 package org.apache.aries.subsystem.itests;
 
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
 import java.util.Collection;
 
 import junit.framework.AssertionFailedError;
 
 import org.apache.aries.subsystem.core.internal.ResourceHelper;
-import org.apache.aries.subsystem.itests.util.Utils;
-import org.apache.aries.unittest.fixture.ArchiveFixture;
-import org.apache.aries.unittest.fixture.ArchiveFixture.ZipFixture;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
@@ -42,30 +36,6 @@ import org.osgi.service.subsystem.Subsys
 
 @RunWith(JUnit4TestRunner.class)
 public class FeatureTest extends SubsystemTest {
-	private static void createApplication(String name, String[] content) throws Exception {
-		ZipFixture feature = ArchiveFixture
-				.newZip()
-				.binary("OSGI-INF/SUBSYSTEM.MF",
-						FeatureTest.class.getClassLoader().getResourceAsStream(
-								name + "/OSGI-INF/SUBSYSTEM.MF"));
-		for (String s : content) {
-			try {
-				feature.binary(s,
-						FeatureTest.class.getClassLoader().getResourceAsStream(
-								name + '/' + s));
-			}
-			catch (Exception e) {
-				feature.binary(s, new FileInputStream(new File(s)));
-			}
-		}
-		feature.end();
-		FileOutputStream fos = new FileOutputStream(name + ".esa");
-		try {
-			feature.writeOut(fos);
-		} finally {
-			Utils.closeQuietly(fos);
-		}
-	}
 	
 	@Before
 	public static void createApplications() throws Exception {

Modified: aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/HelloWorldTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/HelloWorldTest.java?rev=1358119&r1=1358118&r2=1358119&view=diff
==============================================================================
--- aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/HelloWorldTest.java
(original)
+++ aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/HelloWorldTest.java
Fri Jul  6 11:05:47 2012
@@ -14,12 +14,17 @@ import org.osgi.framework.BundleContext;
 import org.osgi.service.subsystem.Subsystem;
 
 @RunWith(JUnit4TestRunner.class)
-public class HelloWorldTest extends InstallTest {
+public class HelloWorldTest extends SubsystemTest 
+{
+	private static boolean _testAppCreated = false;
 	
 	@Before
 	public void installTestApp() throws Exception 
 	{
-		createApplication("hello", new String[]{"helloImpl.jar"});
+		if (!_testAppCreated) { 
+			createApplication("hello", new String[]{"helloImpl.jar"});
+			_testAppCreated = true;
+		}
 	}
 
 	@Test

Modified: aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/InstallTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/InstallTest.java?rev=1358119&r1=1358118&r2=1358119&view=diff
==============================================================================
--- aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/InstallTest.java
(original)
+++ aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/InstallTest.java
Fri Jul  6 11:05:47 2012
@@ -20,13 +20,6 @@ package org.apache.aries.subsystem.itest
 
 import static org.junit.Assert.assertSame;
 
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-
-import org.apache.aries.subsystem.itests.util.Utils;
-import org.apache.aries.unittest.fixture.ArchiveFixture;
-import org.apache.aries.unittest.fixture.ArchiveFixture.ZipFixture;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -35,30 +28,6 @@ import org.osgi.service.subsystem.Subsys
 
 @RunWith(JUnit4TestRunner.class)
 public class InstallTest extends SubsystemTest {
-	static void createApplication(String name, String[] content) throws Exception {
-		ZipFixture feature = ArchiveFixture
-				.newZip()
-				.binary("OSGI-INF/SUBSYSTEM.MF",
-						FeatureTest.class.getClassLoader().getResourceAsStream(
-								name + "/OSGI-INF/SUBSYSTEM.MF"));
-		for (String s : content) {
-			try {
-				feature.binary(s,
-						FeatureTest.class.getClassLoader().getResourceAsStream(
-								name + '/' + s));
-			}
-			catch (Exception e) {
-				feature.binary(s, new FileInputStream(new File(s)));
-			}
-		}
-		feature.end();
-		FileOutputStream fos = new FileOutputStream(name + ".esa");
-		try {
-			feature.writeOut(fos);
-		} finally {
-			Utils.closeQuietly(fos);
-		}
-	}
 	
 	@Before
 	public static void createApplications() throws Exception {

Modified: aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/SubsystemTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/SubsystemTest.java?rev=1358119&r1=1358118&r2=1358119&view=diff
==============================================================================
--- aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/SubsystemTest.java
(original)
+++ aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/SubsystemTest.java
Fri Jul  6 11:05:47 2012
@@ -197,7 +197,7 @@ public abstract class SubsystemTest exte
 				mavenBundle("org.eclipse.equinox", "org.eclipse.equinox.event").version("3.8.0-SNAPSHOT"),
 				mavenBundle("org.apache.aries.subsystem", "org.apache.aries.subsystem.api"),
 				mavenBundle("org.apache.aries.subsystem", "org.apache.aries.subsystem.core"),
-//				org.ops4j.pax.exam.container.def.PaxRunnerOptions.vmOption("-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005"),
+//				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.8.0-SNAPSHOT"));
 		options = updateOptions(options);
@@ -488,7 +488,8 @@ public abstract class SubsystemTest exte
 		createBundle(headers);
 	}
 	
-	protected static void createBundle(Map<String, String> headers) throws IOException
{
+	protected static void createBundle(Map<String, String> headers) throws IOException

+	{
 		String symbolicName = headers.get(Constants.BUNDLE_SYMBOLICNAME);
 		JarFixture bundle = ArchiveFixture.newJar();
 		ManifestFixture manifest = bundle.manifest();
@@ -742,7 +743,8 @@ public abstract class SubsystemTest exte
 		}
 	}
 	
-	protected static void write(String file, ArchiveFixture.AbstractFixture fixture) throws
IOException {
+	protected static void write(String file, ArchiveFixture.AbstractFixture fixture) throws
IOException 
+	{
 		write(new File(file), fixture);
 	}
 	
@@ -755,4 +757,30 @@ public abstract class SubsystemTest exte
     		fos.close();
     	}
 	}
+	
+	static void createApplication(String name, String[] content) throws Exception 
+	{
+		ZipFixture feature = ArchiveFixture
+				.newZip()
+				.binary("OSGI-INF/SUBSYSTEM.MF",
+						SubsystemTest.class.getClassLoader().getResourceAsStream(
+								name + "/OSGI-INF/SUBSYSTEM.MF"));
+		for (String s : content) {
+			try {
+				feature.binary(s,
+						SubsystemTest.class.getClassLoader().getResourceAsStream(
+								name + '/' + s));
+			}
+			catch (Exception e) {
+				feature.binary(s, new FileInputStream(new File(s)));
+			}
+		}
+		feature.end();
+		FileOutputStream fos = new FileOutputStream(name + ".esa");
+		try {
+			feature.writeOut(fos);
+		} finally {
+			Utils.closeQuietly(fos);
+		}
+	}
 }



Mime
View raw message