aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jwr...@apache.org
Subject svn commit: r1501273 - in /aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests: ModelledResourceManagerTest.java SubsystemTest.java
Date Tue, 09 Jul 2013 14:03:23 GMT
Author: jwross
Date: Tue Jul  9 14:03:23 2013
New Revision: 1501273

URL: http://svn.apache.org/r1501273
Log:
[aries-952] New itest for optional ModelledResourceManager dependency.

Added:
    aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/ModelledResourceManagerTest.java
Modified:
    aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/SubsystemTest.java

Added: aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/ModelledResourceManagerTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/ModelledResourceManagerTest.java?rev=1501273&view=auto
==============================================================================
--- aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/ModelledResourceManagerTest.java
(added)
+++ aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/ModelledResourceManagerTest.java
Tue Jul  9 14:03:23 2013
@@ -0,0 +1,73 @@
+package org.apache.aries.subsystem.itests;
+
+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.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;
+	}
+	
+	@Before
+	public static void createApplications() throws Exception {
+		if (createdApplications) {
+			return;
+		}
+		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"));
+	}
+
+	@Test
+	public void testNoModelledResourceManagerService() throws Exception {
+		Subsystem feature3 = installSubsystemFromFile("feature3.esa");
+		try {
+			Subsystem application1 = installSubsystemFromFile("application1.esa");
+			try {
+				startSubsystem(application1);
+			}
+			finally {
+				stopAndUninstallSubsystemSilently(application1);
+			}
+		}
+		finally {
+			uninstallSubsystemSilently(feature3);
+		}
+	}
+}

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=1501273&r1=1501272&r2=1501273&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
Tue Jul  9 14:03:23 2013
@@ -20,7 +20,6 @@ import static org.junit.Assert.assertNul
 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.options;
 import static org.ops4j.pax.exam.CoreOptions.systemProperty;
 
 import java.io.File;
@@ -179,9 +178,8 @@ public abstract class SubsystemTest exte
 		}
 	}
 	
-	@org.ops4j.pax.exam.junit.Configuration
-	public static Option[] configuration() {
-		Option[] options = options(
+	protected static Option[] defineOptions() {
+		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"),
@@ -212,7 +210,13 @@ public abstract class SubsystemTest exte
 				mavenBundle("org.easymock",					"easymock").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.8.0.V20120529-1548"));
+				equinox().version("3.8.0.V20120529-1548")
+		};
+	}
+	
+	@org.ops4j.pax.exam.junit.Configuration
+	public static Option[] configuration() {
+		Option[] options = defineOptions();
 		options = updateOptions(options);
 		return options;
 	}



Mime
View raw message