ByteArrayInputStream inputStream = new ByteArrayInputStream(baos.toByteArray());
Bundle bundle = context.installBundle(archive.getName(), inputStream);
ServiceReference sref = context.getServiceReference(PackageAdmin.class.getName());
PackageAdmin pa = (PackageAdmin) context.getService(sref);
if (pa.resolveBundles(new Bundle[] { bundle }) == false)
throw new IllegalStateException("Cannot resolve test bundle - see framework log");
bundleInst.set(bundle);
} catch (RuntimeException rte) {
throw rte;