use of org.osgi.service.subsystem.Subsystem in project aries by apache.
the class NoBSNTest method testApplication1.
/*
* Subsystem application1 has content bundle tb1.jar.
* Bundle tb1.jar has an import package dependency on org.apache.aries.subsystem.itests.tb3.
*/
@Test
public void testApplication1() throws Exception {
Subsystem nobsn = installSubsystemFromFile("nobsn.esa");
try {
assertSymbolicName("org.apache.aries.subsystem.nobsn", nobsn);
assertVersion("0.0.0", nobsn);
assertType(SubsystemConstants.SUBSYSTEM_TYPE_APPLICATION, nobsn);
assertChildren(0, nobsn);
assertConstituents(1, nobsn);
startSubsystem(nobsn);
} finally {
stopSubsystemSilently(nobsn);
uninstallSubsystemSilently(nobsn);
}
}
use of org.osgi.service.subsystem.Subsystem in project aries by apache.
the class RegionNameTest method testApplicationRegionName.
@Test
public void testApplicationRegionName() throws Exception {
Subsystem applicationA = installSubsystemFromFile(APPLICATION_A);
try {
testRegionName(applicationA);
Subsystem featureA = getChild(applicationA, FEATURE_A, null, SubsystemConstants.SUBSYSTEM_TYPE_FEATURE);
testRegionName(featureA);
} finally {
uninstallSubsystemSilently(applicationA);
}
}
use of org.osgi.service.subsystem.Subsystem in project aries by apache.
the class RootSubsystemTest method testServiceEvents.
@Test
public void testServiceEvents() throws Exception {
Subsystem root = getRootSubsystem();
Bundle core = getSubsystemCoreBundle();
// TODO Temporary(?) workaround to allow time for any tardy service
// events to arrive so they can be cleared. So far, this sleep has only
// been necessary on the IBM 6.0 64-bit JDK.
Thread.sleep(1000);
subsystemEvents.clear();
core.stop();
assertServiceEventsStop(root);
core.uninstall();
core = bundleContext.installBundle(normalizeBundleLocation(core));
core.start();
// There should be install events since the persisted root subsystem was
// deleted when the subsystems implementation bundle was uninstalled.
assertServiceEventsInstall(root);
assertServiceEventsResolve(root);
assertServiceEventsStart(root);
core.stop();
assertServiceEventsStop(root);
core.start();
// There should be no install events or RESOLVING event since there
// should be a persisted root subsystem already in the RESOLVED state.
assertServiceEventResolved(root, ServiceEvent.REGISTERED);
assertServiceEventsStart(root);
}
use of org.osgi.service.subsystem.Subsystem in project aries by apache.
the class SharedResourceTest method testSharedBundleNotUninstalledWhileStillReferenced.
@Test
public void testSharedBundleNotUninstalledWhileStillReferenced() throws Exception {
Subsystem applicationA = installSubsystemFromFile(APPLICATION_A);
try {
startSubsystem(applicationA);
Subsystem applicationB = installSubsystemFromFile(APPLICATION_B);
try {
startSubsystem(applicationB);
stopSubsystem(applicationA);
uninstallSubsystem(applicationA);
assertBundleState(Bundle.ACTIVE, BUNDLE_C, getRootSubsystem());
} finally {
stopAndUninstallSubsystemSilently(applicationB);
}
} finally {
stopAndUninstallSubsystemSilently(applicationA);
}
}
use of org.osgi.service.subsystem.Subsystem in project aries by apache.
the class Aries1084Test method testBundleStartsWhenSubsystemLeftInInvalidState.
@Test
public void testBundleStartsWhenSubsystemLeftInInvalidState() throws Exception {
Subsystem featureA = installSubsystemFromFile(FEATURE_A);
try {
startSubsystem(featureA);
assertBundleState(Bundle.ACTIVE, BUNDLE_A, featureA);
Bundle core = getSubsystemCoreBundle();
File file = core.getBundleContext().getDataFile(featureA.getSubsystemId() + "/OSGI-INF/DEPLOYMENT.MF");
core.stop();
DeploymentManifest manifest = new DeploymentManifest(file);
FileOutputStream fos = new FileOutputStream(file);
try {
new DeploymentManifest.Builder().manifest(manifest).state(Subsystem.State.ACTIVE).build().write(fos);
} finally {
fos.close();
}
core.start();
featureA = getChild(getRootSubsystem(), FEATURE_A);
assertBundleState(Bundle.ACTIVE, BUNDLE_A, featureA);
} finally {
stopAndUninstallSubsystemSilently(featureA);
}
}
Aggregations