use of org.apache.aries.subsystem.itests.util.SubsystemArchiveBuilder in project aries by apache.
the class Aries1338Test method test.
private void test(String importPackage, String exportPackage, boolean shouldFail) throws Exception {
Subsystem root = getRootSubsystem();
try {
Subsystem subsystem = installSubsystem(root, "subsystem", new SubsystemArchiveBuilder().symbolicName("subsystem").bundle("a", new BundleArchiveBuilder().symbolicName("a").importPackage(importPackage).build()).bundle("b", new BundleArchiveBuilder().symbolicName("b").exportPackage(exportPackage).build()).build());
uninstallableSubsystems.add(subsystem);
if (shouldFail) {
fail("Subsystem should not have installed");
}
} catch (SubsystemException e) {
e.printStackTrace();
if (!shouldFail) {
fail("Subsystem should have installed");
}
}
}
use of org.apache.aries.subsystem.itests.util.SubsystemArchiveBuilder in project aries by apache.
the class Aries1522Test method test.
private void test(AriesProvisionDependenciesDirective provisionDependencies) throws Exception {
boolean flag = AriesProvisionDependenciesDirective.INSTALL.equals(provisionDependencies);
Subsystem root = getRootSubsystem();
try {
Subsystem subsystem = installSubsystem(root, "subsystem", new SubsystemArchiveBuilder().symbolicName("subsystem").type(SubsystemConstants.SUBSYSTEM_TYPE_APPLICATION + ';' + provisionDependencies.toString()).content("org.apache.aries.subsystem.itests.aries1523host,org.apache.aries.subsystem.itests.aries1523fragment").bundle("aries1523host", getClass().getClassLoader().getResourceAsStream("aries1523/aries1523host.jar")).build(), flag);
try {
startSubsystem(subsystem, flag);
stopSubsystem(subsystem);
} catch (SubsystemException e) {
e.printStackTrace();
fail("Subsystem should have started");
} finally {
uninstallSubsystemSilently(subsystem);
}
} catch (SubsystemException e) {
e.printStackTrace();
fail("Subsystem should have installed");
}
}
use of org.apache.aries.subsystem.itests.util.SubsystemArchiveBuilder in project aries by apache.
the class Aries1523Test method test.
private void test(AriesProvisionDependenciesDirective provisionDependencies) throws Exception {
boolean flag = AriesProvisionDependenciesDirective.INSTALL.equals(provisionDependencies);
Subsystem root = getRootSubsystem();
try {
Subsystem subsystem = installSubsystem(root, "subsystem", new SubsystemArchiveBuilder().symbolicName("subsystem").type(SubsystemConstants.SUBSYSTEM_TYPE_APPLICATION + ';' + provisionDependencies.toString()).content("org.apache.aries.subsystem.itests.aries1523host,org.apache.aries.subsystem.itests.aries1523fragment").bundle("aries1523fragment", getClass().getClassLoader().getResourceAsStream("aries1523/aries1523fragment.jar")).build(), flag);
try {
startSubsystem(subsystem, flag);
stopSubsystem(subsystem);
} catch (SubsystemException e) {
e.printStackTrace();
fail("Subsystem should have started");
} finally {
uninstallSubsystemSilently(subsystem);
}
} catch (SubsystemException e) {
e.printStackTrace();
fail("Subsystem should have installed");
}
}
use of org.apache.aries.subsystem.itests.util.SubsystemArchiveBuilder in project aries by apache.
the class Aries1538Test method testHostFragmentCircularDependency.
private void testHostFragmentCircularDependency(AriesProvisionDependenciesDirective provisionDependencies) throws Exception {
boolean flag = AriesProvisionDependenciesDirective.INSTALL.equals(provisionDependencies);
BundleArchiveBuilder hostBuilder = new BundleArchiveBuilder();
hostBuilder.symbolicName("host");
hostBuilder.exportPackage("foo");
hostBuilder.importPackage("bar");
BundleArchiveBuilder fragmentBuilder = new BundleArchiveBuilder();
fragmentBuilder.symbolicName("fragment");
fragmentBuilder.exportPackage("bar");
fragmentBuilder.importPackage("foo");
fragmentBuilder.header("Fragment-Host", "host");
Subsystem root = getRootSubsystem();
Bundle host = root.getBundleContext().installBundle("host", hostBuilder.build());
uninstallableBundles.add(host);
Bundle fragment = root.getBundleContext().installBundle("fragment", fragmentBuilder.build());
uninstallableBundles.add(fragment);
startBundle(host);
try {
Subsystem subsystem = installSubsystem(root, "subsystem", new SubsystemArchiveBuilder().symbolicName("subsystem").type(SubsystemConstants.SUBSYSTEM_TYPE_APPLICATION + ';' + provisionDependencies.toString()).bundle("a", new BundleArchiveBuilder().symbolicName("a").importPackage("foo").build()).build(), flag);
uninstallableSubsystems.add(subsystem);
startSubsystem(subsystem, flag);
stoppableSubsystems.add(subsystem);
} catch (SubsystemException e) {
e.printStackTrace();
fail("Subsystem should have installed and started");
}
}
use of org.apache.aries.subsystem.itests.util.SubsystemArchiveBuilder in project aries by apache.
the class Aries1538Test method testSubstitutableExport.
private void testSubstitutableExport(AriesProvisionDependenciesDirective provisionDependencies) throws Exception {
boolean flag = AriesProvisionDependenciesDirective.INSTALL.equals(provisionDependencies);
BundleArchiveBuilder hostBuilder = new BundleArchiveBuilder();
hostBuilder.symbolicName("host");
BundleArchiveBuilder fragmentBuilder = new BundleArchiveBuilder();
fragmentBuilder.symbolicName("fragment");
fragmentBuilder.exportPackage("foo");
fragmentBuilder.importPackage("foo");
fragmentBuilder.header("Fragment-Host", "host");
Subsystem root = getRootSubsystem();
Bundle host = root.getBundleContext().installBundle("host", hostBuilder.build());
uninstallableBundles.add(host);
Bundle fragment = root.getBundleContext().installBundle("fragment", fragmentBuilder.build());
uninstallableBundles.add(fragment);
startBundle(host);
try {
Subsystem subsystem = installSubsystem(root, "subsystem", new SubsystemArchiveBuilder().symbolicName("subsystem").type(SubsystemConstants.SUBSYSTEM_TYPE_APPLICATION + ';' + provisionDependencies.toString()).bundle("a", new BundleArchiveBuilder().symbolicName("a").importPackage("foo").build()).build(), flag);
uninstallableSubsystems.add(subsystem);
startSubsystem(subsystem, flag);
stoppableSubsystems.add(subsystem);
} catch (SubsystemException e) {
e.printStackTrace();
fail("Subsystem should have installed and started");
}
}
Aggregations