use of org.apache.felix.deploymentadmin.itest.util.DeploymentPackageBuilder.JarManifestManipulatingFilter in project felix by apache.
the class ResourceSharingTest method testForeignBundleCanCoexistWithPackagedBundleIfVersionsDiffer.
@Test
public void testForeignBundleCanCoexistWithPackagedBundleIfVersionsDiffer() throws Exception {
// Manually install a bundle...
Bundle result = m_context.installBundle(getTestBundleURL("bundle1").toExternalForm());
assertNotNull(result);
long bundleId = result.getBundleId();
assertBundleExists(getSymbolicName("bundle1"), "1.0.0");
assertTrue(isBundleInstalled(result));
DeploymentPackageBuilder dpBuilder = createNewDeploymentPackageBuilder("1.0.0");
dpBuilder.add(dpBuilder.createBundleResource().setVersion("1.1.0").setUrl(getTestBundleURL("bundle1")).setFilter(new JarManifestManipulatingFilter("Bundle-Version", "1.1.0"))).add(dpBuilder.createBundleResource().setUrl(getTestBundleURL("bundle2")));
// should succeed: valid-bundle1 is installed, but has a different version than the one in our DP...
DeploymentPackage dp = installDeploymentPackage(dpBuilder);
awaitRefreshPackagesEvent();
assertBundleExists(getSymbolicName("bundle1"), "1.0.0");
assertBundleExists(getSymbolicName("bundle1"), "1.1.0");
// The manually installed bundle should still be in the installed or resolved state...
assertTrue(isBundleInstalled(m_context.getBundle(bundleId)) || isBundleResolved(m_context.getBundle(bundleId)));
assertTrue(isBundleActive(dp.getBundle(getSymbolicName("bundle1"))));
}
Aggregations