use of org.apache.aries.subsystem.itests.util.SubsystemArchiveBuilder in project aries by apache.
the class Aries1383Test method testAutoInstallDependenciesComposite.
@Test
public void testAutoInstallDependenciesComposite() throws Exception {
Subsystem root = getRootSubsystem();
Subsystem b = installSubsystem(root, "b", new SubsystemArchiveBuilder().symbolicName("b").type(SubsystemConstants.SUBSYSTEM_TYPE_COMPOSITE + ';' + AriesProvisionDependenciesDirective.RESOLVE.toString()).content("a;version=\"[0,0]\"").exportPackage("a").importPackage("b").bundle("a", new BundleArchiveBuilder().symbolicName("a").importPackage("b").exportPackage("a").build()).bundle("b", new BundleArchiveBuilder().symbolicName("b").exportPackage("b").build()).build(), false);
uninstallableSubsystems.add(b);
try {
Subsystem a = installSubsystem(root, "a", new SubsystemArchiveBuilder().symbolicName("a").type(SubsystemConstants.SUBSYSTEM_TYPE_APPLICATION).bundle("a", new BundleArchiveBuilder().symbolicName("a").importPackage("a").build()).build(), true);
uninstallableSubsystems.add(a);
assertState(EnumSet.of(State.INSTALLED, State.RESOLVED), b);
} catch (Exception e) {
e.printStackTrace();
fail("Subsystem should have installed");
}
}
use of org.apache.aries.subsystem.itests.util.SubsystemArchiveBuilder in project aries by apache.
the class Aries1383Test method test16b.
/*
* (16) Unscoped subsystem with a value of apache-aries-provision-dependencies
* that is the same as the scoped parent installs successfully.
*/
@Test
public void test16b() throws Exception {
Subsystem root = getRootSubsystem();
Subsystem application = installSubsystem(root, "application", new SubsystemArchiveBuilder().symbolicName("application").type(SubsystemConstants.SUBSYSTEM_TYPE_APPLICATION + ';' + AriesProvisionDependenciesDirective.INSTALL.toString()).build(), true);
try {
Subsystem feature = installSubsystem(application, "feature", new SubsystemArchiveBuilder().symbolicName("feature").type(SubsystemConstants.SUBSYSTEM_TYPE_FEATURE + ';' + AriesProvisionDependenciesDirective.INSTALL.toString()).build(), true);
uninstallSubsystemSilently(feature);
} catch (SubsystemException e) {
e.printStackTrace();
fail("Subsystem should have installed");
} finally {
uninstallSubsystemSilently(application);
}
}
use of org.apache.aries.subsystem.itests.util.SubsystemArchiveBuilder in project aries by apache.
the class Aries1383Test method testProvideCapabilityNamespaceOnly.
@Test
public void testProvideCapabilityNamespaceOnly() throws Exception {
Subsystem root = getRootSubsystem();
Subsystem c1 = installSubsystem(root, "c1", new SubsystemArchiveBuilder().symbolicName("c1").type(SubsystemConstants.SUBSYSTEM_TYPE_COMPOSITE).provideCapability("y").build());
uninstallableSubsystems.add(c1);
try {
startSubsystem(c1);
stoppableSubsystems.add(c1);
} catch (SubsystemException e) {
e.printStackTrace();
fail("Subsystem should have started");
}
}
use of org.apache.aries.subsystem.itests.util.SubsystemArchiveBuilder in project aries by apache.
the class Aries1383Test method test4e3bCompliance.
@Test
public void test4e3bCompliance() throws Exception {
serviceRegistrations.add(bundleContext.registerService(Repository.class, new TestRepository.Builder().resource(new TestRepositoryContent.Builder().capability(new TestCapability.Builder().namespace(IdentityNamespace.IDENTITY_NAMESPACE).attribute(IdentityNamespace.IDENTITY_NAMESPACE, "a").attribute(IdentityNamespace.CAPABILITY_VERSION_ATTRIBUTE, Version.emptyVersion).attribute(IdentityNamespace.CAPABILITY_TYPE_ATTRIBUTE, IdentityNamespace.TYPE_BUNDLE)).capability(new TestCapability.Builder().namespace(PackageNamespace.PACKAGE_NAMESPACE).attribute(PackageNamespace.PACKAGE_NAMESPACE, "x").attribute(IdentityNamespace.CAPABILITY_VERSION_ATTRIBUTE, Version.emptyVersion)).capability(new TestCapability.Builder().namespace(BundleNamespace.BUNDLE_NAMESPACE).attribute(BundleNamespace.BUNDLE_NAMESPACE, "a").attribute(BundleNamespace.CAPABILITY_BUNDLE_VERSION_ATTRIBUTE, Version.emptyVersion)).content(new BundleArchiveBuilder().symbolicName("a").exportPackage("x").buildAsBytes()).build()).resource(new TestRepositoryContent.Builder().capability(new TestCapability.Builder().namespace(IdentityNamespace.IDENTITY_NAMESPACE).attribute(IdentityNamespace.IDENTITY_NAMESPACE, "b").attribute(IdentityNamespace.CAPABILITY_VERSION_ATTRIBUTE, Version.emptyVersion).attribute(IdentityNamespace.CAPABILITY_TYPE_ATTRIBUTE, IdentityNamespace.TYPE_BUNDLE)).capability(new TestCapability.Builder().namespace("y")).content(new BundleArchiveBuilder().symbolicName("b").header("Provide-Capability", "y").buildAsBytes()).build()).build(), null));
Subsystem root = getRootSubsystem();
try {
Subsystem s1 = installSubsystem(root, "s1", new SubsystemArchiveBuilder().symbolicName("s1").type(SubsystemConstants.SUBSYSTEM_TYPE_COMPOSITE).subsystem("s3", new SubsystemArchiveBuilder().symbolicName("s3").type(SubsystemConstants.SUBSYSTEM_TYPE_COMPOSITE).subsystem("s2", new SubsystemArchiveBuilder().symbolicName("s2").type(SubsystemConstants.SUBSYSTEM_TYPE_APPLICATION).bundle("c", new BundleArchiveBuilder().symbolicName("c").importPackage("x").build()).bundle("d", new BundleArchiveBuilder().symbolicName("d").header("Require-Bundle", "a").build()).bundle("e", new BundleArchiveBuilder().symbolicName("e").header("Require-Capability", "y").build()).build()).build()).build(), true);
uninstallableSubsystems.add(s1);
fail("Subsystem should not have installed");
} catch (SubsystemException e) {
e.printStackTrace();
}
}
use of org.apache.aries.subsystem.itests.util.SubsystemArchiveBuilder in project aries by apache.
the class Aries1383Test method test20.
/*
* (20) Install a scoped subsystem, S1, with
* apache-aries-provision-dependencies:=resolve. Install two features, F1 and
* F2, independently as children of S1. F1 has bundle B1 as content. F2 has
* bundle B2 as content. B2 has B1 as a dependency. B1 should be a
* constituent of F1 but not of the root subsystem.
*/
@Test
public void test20() throws Exception {
serviceRegistrations.add(bundleContext.registerService(Repository.class, new TestRepository.Builder().resource(new TestRepositoryContent.Builder().capability(new TestCapability.Builder().namespace(IdentityNamespace.IDENTITY_NAMESPACE).attribute(IdentityNamespace.IDENTITY_NAMESPACE, "b1").attribute(IdentityNamespace.CAPABILITY_VERSION_ATTRIBUTE, Version.emptyVersion).attribute(IdentityNamespace.CAPABILITY_TYPE_ATTRIBUTE, IdentityNamespace.TYPE_BUNDLE)).content(new BundleArchiveBuilder().symbolicName("b1").exportPackage("a").buildAsBytes()).build()).resource(new TestRepositoryContent.Builder().capability(new TestCapability.Builder().namespace(IdentityNamespace.IDENTITY_NAMESPACE).attribute(IdentityNamespace.IDENTITY_NAMESPACE, "b2").attribute(IdentityNamespace.CAPABILITY_VERSION_ATTRIBUTE, Version.emptyVersion).attribute(IdentityNamespace.CAPABILITY_TYPE_ATTRIBUTE, IdentityNamespace.TYPE_BUNDLE)).content(new BundleArchiveBuilder().symbolicName("b2").importPackage("a").buildAsBytes()).build()).build(), null));
Subsystem root = getRootSubsystem();
Subsystem s1 = installSubsystem(root, "s1", new SubsystemArchiveBuilder().symbolicName("s1").type(SubsystemConstants.SUBSYSTEM_TYPE_APPLICATION + ';' + AriesProvisionDependenciesDirective.RESOLVE.toString()).build(), false);
uninstallableSubsystems.add(s1);
startSubsystem(s1, false);
stoppableSubsystems.add(s1);
Subsystem f2 = installSubsystem(s1, "f2", new SubsystemArchiveBuilder().symbolicName("f2").type(SubsystemConstants.SUBSYSTEM_TYPE_FEATURE).content("b2").build(), false);
uninstallableSubsystems.add(f2);
assertChild(s1, "f2", null, SubsystemConstants.SUBSYSTEM_TYPE_FEATURE);
assertConstituent(f2, "b2");
Subsystem f1 = installSubsystem(s1, "f1", new SubsystemArchiveBuilder().symbolicName("f1").type(SubsystemConstants.SUBSYSTEM_TYPE_FEATURE).content("b1").build(), false);
uninstallableSubsystems.add(f1);
assertChild(s1, "f1", null, SubsystemConstants.SUBSYSTEM_TYPE_FEATURE);
assertConstituent(f1, "b1");
assertNotConstituent(root, "b1");
}
Aggregations