assert bResults.size() == 0;
}
@Test(enabled = TESTS_ENABLED)
public void testDeleteBundleDeployment() throws Exception {
Bundle b1 = createBundle("one");
assertNotNull("Instance of newly created bundle should not be null", b1);
BundleVersion bv1 = createBundleVersion(b1.getName() + "-1", null, b1);
assertNotNull("Instance of newly created bundle version should not be null", bv1);
ResourceGroup platformResourceGroup = createTestResourceGroup();
assertNotNull("Instance of newly created resource group should not be null", platformResourceGroup);
BundleDestination dest1 = createDestination(b1, "one", "/test", platformResourceGroup);
assertNotNull("Instance of newly created bundle destination should not be null", dest1);
BundleDeployment deployment1 = createDeployment("one", bv1, dest1,
Configuration.builder().addSimple("bundletest.property", "bundletest.property value").build());
assertNotNull("Instance of newly created bundle deployment should not be null", deployment1);
getTransactionManager().begin();
deployment1.setStatus(BundleDeploymentStatus.SUCCESS);
em.merge(deployment1);
getTransactionManager().commit();
BundleDeployment deployment2 = createDeployment("two", bv1, dest1,
Configuration.builder().addSimple("bundletest.property", "bundletest.property value").build());
assertNotNull("Instance of newly created bundle deployment should not be null", deployment2);
getTransactionManager().begin();
deployment2.setStatus(BundleDeploymentStatus.SUCCESS);
deployment2.setReplacedBundleDeploymentId(deployment1.getId());
em.merge(deployment2);
getTransactionManager().commit();
BundleDeployment deployment3 = createDeployment("three", bv1, dest1,
Configuration.builder().addSimple("bundletest.property", "bundletest.property value").build());
assertNotNull("Instance of newly created bundle deployment should not be null", deployment3);
getTransactionManager().begin();
deployment3.setStatus(BundleDeploymentStatus.SUCCESS);
deployment3.setReplacedBundleDeploymentId(deployment2.getId());
em.merge(deployment3);
getTransactionManager().commit();
BundleDeploymentCriteria criteria = new BundleDeploymentCriteria();
criteria.addFilterBundleId(b1.getId());
List<BundleDeployment> deployments = bundleManager.findBundleDeploymentsByCriteria(
subjectManager.getOverlord(), criteria);
assertNotNull("List of bundle deployments should not be null", deployments);
assertEquals(3, deployments.size());