use of org.osgi.service.subsystem.SubsystemException in project aries by apache.
the class Aries1383Test method test8.
/*
* (8) Subsystem with apache-aries-provision-dependencies:=resolve is not
* available as a service after an unsuccessful installation.
*/
@Test
public void test8() throws Exception {
Subsystem root = getRootSubsystem();
try {
Subsystem subsystem = installSubsystem(root, APPLICATION_INSTALL_FAILED, applicationInstallFailed(), false);
uninstallSubsystemSilently(subsystem);
fail("Subsystem should not have installed");
} catch (SubsystemException e) {
e.printStackTrace();
assertEquals("Subsystem service should not exist", 0, bundleContext.getServiceReferences(Subsystem.class, "(" + SubsystemConstants.SUBSYSTEM_ID_PROPERTY + "=" + lastSubsystemId() + ")").size());
}
}
use of org.osgi.service.subsystem.SubsystemException in project aries by apache.
the class Aries1383Test method testImplicitlyInstalledChildOverridesProvisionDependencies.
@Test
public void testImplicitlyInstalledChildOverridesProvisionDependencies() throws Exception {
Subsystem root = getRootSubsystem();
subsystemEvents.clear();
try {
Subsystem subsystem = root.install("parent", new SubsystemArchiveBuilder().symbolicName("parent").type(SubsystemConstants.SUBSYSTEM_TYPE_APPLICATION + ';' + AriesProvisionDependenciesDirective.INSTALL.toString()).subsystem("child", new SubsystemArchiveBuilder().symbolicName("child").type(SubsystemConstants.SUBSYSTEM_TYPE_APPLICATION + ';' + AriesProvisionDependenciesDirective.RESOLVE.toString()).build()).build());
uninstallSubsystemSilently(subsystem);
fail("Subsystem should not have installed");
} catch (SubsystemException e) {
e.printStackTrace();
}
}
use of org.osgi.service.subsystem.SubsystemException in project aries by apache.
the class Aries1383Test method test7.
/*
* (7) Subsystem with apache-aries-provision-dependencies:=resolve is in the
* INSTALL_FAILED state after an unsuccessful installation.
*/
@Test
public void test7() throws Exception {
Subsystem root = getRootSubsystem();
subsystemEvents.clear();
try {
Subsystem subsystem = root.install(APPLICATION_INSTALL_FAILED, applicationInstallFailed());
uninstallSubsystemSilently(subsystem);
fail("Subsystem should not have installed");
} catch (SubsystemException e) {
e.printStackTrace();
long id = lastSubsystemId();
assertEvent(id, APPLICATION_INSTALL_FAILED, Version.emptyVersion, SubsystemConstants.SUBSYSTEM_TYPE_APPLICATION, State.INSTALLING, subsystemEvents.poll(id, 5000), ServiceEvent.REGISTERED);
assertEvent(id, APPLICATION_INSTALL_FAILED, Version.emptyVersion, SubsystemConstants.SUBSYSTEM_TYPE_APPLICATION, State.INSTALL_FAILED, subsystemEvents.poll(id, 5000), ServiceEvent.MODIFIED);
assertEvent(id, APPLICATION_INSTALL_FAILED, Version.emptyVersion, SubsystemConstants.SUBSYSTEM_TYPE_APPLICATION, State.UNINSTALLING, subsystemEvents.poll(id, 5000), ServiceEvent.MODIFIED);
assertEvent(id, APPLICATION_INSTALL_FAILED, Version.emptyVersion, SubsystemConstants.SUBSYSTEM_TYPE_APPLICATION, State.UNINSTALLED, subsystemEvents.poll(id, 5000), ServiceEvent.MODIFIED);
}
}
use of org.osgi.service.subsystem.SubsystemException in project aries by apache.
the class Aries1383Test method test15a.
/*
* (15) Unscoped subsystem with a value of apache-aries-provision-dependencies
* that is different than the scoped parent fails installation.
*/
@Test
public void test15a() throws Exception {
Subsystem root = getRootSubsystem();
try {
Subsystem subsystem = installSubsystem(root, FEATURE_PROVISION_DEPENDENCIES_RESOLVE, featureProvisionDependenciesResolve(), false);
uninstallSubsystemSilently(subsystem);
fail("Subsystem should not have installed");
} catch (SubsystemException e) {
e.printStackTrace();
}
}
use of org.osgi.service.subsystem.SubsystemException 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();
}
}
Aggregations