aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jwr...@apache.org
Subject svn commit: r1718940 - in /aries/trunk/subsystem: subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/ResolveContext.java subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/defect/Aries1383Test.java
Date Wed, 09 Dec 2015 19:16:41 GMT
Author: jwross
Date: Wed Dec  9 19:16:41 2015
New Revision: 1718940

URL: http://svn.apache.org/viewvc?rev=1718940&view=rev
Log:
[ARIES-1383] Provide option to disable the provisioning of dependencies at install time.

Matching capabilities from the system repository that are in a region with an incompatible
sharing policy should not be valid for resolution.

Modified:
    aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/ResolveContext.java
    aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/defect/Aries1383Test.java

Modified: aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/ResolveContext.java
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/ResolveContext.java?rev=1718940&r1=1718939&r2=1718940&view=diff
==============================================================================
--- aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/ResolveContext.java
(original)
+++ aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/ResolveContext.java
Wed Dec  9 19:16:41 2015
@@ -263,11 +263,12 @@ public class ResolveContext extends org.
 		else {
 			// This is an already installed resource from the system repository.
 			if (Utils.isBundle(resource)) {
-				if (this.resource.getSubsystemManifest().getSubsystemTypeHeader().getAriesProvisionDependenciesDirective().isResolve())
{
+				if (isContent(resource) 
+						&& this.resource.getSubsystemManifest().getSubsystemTypeHeader().getAriesProvisionDependenciesDirective().isResolve())
{
 					// If we get here with a subsystem that is 
 					// apache-aries-provision-dependencies:=resolve, it means
 					// that a restart has occurred with the subsystem in the
-					// INSTALLING state. It's content has already been installed.
+					// INSTALLING state. Its content has already been installed.
 					// However, because the sharing policy has not yet been set,
 					// we must treat it similarly to the installable content case
 					// above.

Modified: aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/defect/Aries1383Test.java
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/defect/Aries1383Test.java?rev=1718940&r1=1718939&r2=1718940&view=diff
==============================================================================
--- aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/defect/Aries1383Test.java
(original)
+++ aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/defect/Aries1383Test.java
Wed Dec  9 19:16:41 2015
@@ -37,6 +37,7 @@ import org.easymock.internal.matchers.Nu
 import org.junit.Test;
 import org.ops4j.pax.tinybundles.core.InnerClassStrategy;
 import org.ops4j.pax.tinybundles.core.TinyBundles;
+import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleActivator;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.Constants;
@@ -2141,4 +2142,68 @@ public class Aries1383Test extends Subsy
 			e.printStackTrace();
 		}
 	}
+	
+	@Test
+	public void testMatchingCapabilityInDisconnectedRegion() throws Exception {
+		Subsystem root = getRootSubsystem();
+		BundleArchiveBuilder b1Builder = new BundleArchiveBuilder()
+				.symbolicName("b1")
+				.exportPackage("b1");
+		Bundle b1 = root.getBundleContext().installBundle("b1", b1Builder.build());
+		try {
+			Subsystem a1 = installSubsystem(
+					root,
+					"a1",
+					new SubsystemArchiveBuilder()
+							.symbolicName("a1")
+							.type(SubsystemConstants.SUBSYSTEM_TYPE_APPLICATION
+									+ ';'
+									+ AriesProvisionDependenciesDirective.RESOLVE.toString()
+									+ ';'
+									+ SubsystemConstants.PROVISION_POLICY_DIRECTIVE
+									+ ":="
+									+ SubsystemConstants.PROVISION_POLICY_ACCEPT_DEPENDENCIES)
+							.build(),
+					false
+			);
+			uninstallableSubsystems.add(a1);
+			startSubsystem(a1, false);
+			stoppableSubsystems.add(a1);
+			removeConnectionWithParent(a1);
+			Subsystem a2 = installSubsystem(
+					a1,
+					"a2",
+					new SubsystemArchiveBuilder()
+							.symbolicName("a2")
+							.type(SubsystemConstants.SUBSYSTEM_TYPE_APPLICATION)
+							.content("b2")
+							.bundle(
+									"b2", 
+									new BundleArchiveBuilder()
+											.symbolicName("b2")
+											.importPackage("b1")
+											.build())
+							.bundle(
+									"b1",
+									b1Builder.build())
+							.build(),
+					false
+			);
+			uninstallableSubsystems.add(a2);
+			assertState(State.INSTALLING, a2);
+			assertNotConstituent(a1, "b1");
+			try {
+				startSubsystem(a2, false);
+				stoppableSubsystems.add(a2);
+				assertConstituent(a1, "b1");
+			}
+			catch (SubsystemException e) {
+				e.printStackTrace();
+				fail("Subsystem should have started");
+			}
+		}
+		finally {
+			uninstallSilently(b1);
+		}
+	}
 }



Mime
View raw message