super.tearDown();
}
public void testDeleteBundles() throws Exception {
BundleJobBean jobA = this.addRecordToBundleJobTable(Job.Status.SUCCEEDED, false);
BundleActionBean actionA1 = addRecordToBundleActionTable(jobA.getId(), "actionA1", 0, Job.Status.SUCCEEDED);
BundleActionBean actionA2 = addRecordToBundleActionTable(jobA.getId(), "actionA2", 0, Job.Status.SUCCEEDED);
BundleJobBean jobB = this.addRecordToBundleJobTable(Job.Status.SUCCEEDED, false);
BundleActionBean actionB1 = addRecordToBundleActionTable(jobB.getId(), "actionB1", 0, Job.Status.SUCCEEDED);
BundleActionBean actionB2 = addRecordToBundleActionTable(jobB.getId(), "actionB2", 0, Job.Status.SUCCEEDED);
BundleJobBean jobC = this.addRecordToBundleJobTable(Job.Status.SUCCEEDED, false);
BundleActionBean actionC1 = addRecordToBundleActionTable(jobC.getId(), "actionC1", 0, Job.Status.SUCCEEDED);
BundleActionBean actionC2 = addRecordToBundleActionTable(jobC.getId(), "actionC2", 0, Job.Status.SUCCEEDED);
JPAService jpaService = Services.get().get(JPAService.class);
assertNotNull(jpaService);
List<String> deleteList = new ArrayList<String>();
deleteList.add(jobA.getId());
deleteList.add(jobB.getId());
deleteList.add(jobC.getId());
jpaService.execute(new BundleJobsDeleteJPAExecutor(deleteList));
try {
jpaService.execute(new BundleJobGetJPAExecutor(jobA.getId()));
fail("Bundle Job A should have been deleted");
}
catch (JPAExecutorException je) {
assertEquals(ErrorCode.E0604, je.getErrorCode());
}
try {
jpaService.execute(new BundleActionGetJPAExecutor(actionA1.getBundleId(), actionA1.getCoordName()));
fail("Bundle Action A1 should have been deleted");
}
catch (JPAExecutorException je) {
assertEquals(ErrorCode.E0605, je.getErrorCode());
}
try {
jpaService.execute(new BundleActionGetJPAExecutor(actionA2.getBundleId(), actionA2.getCoordName()));
fail("Bundle Action A2 should have been deleted");
}
catch (JPAExecutorException je) {
assertEquals(ErrorCode.E0605, je.getErrorCode());
}
try {
jpaService.execute(new BundleJobGetJPAExecutor(jobB.getId()));
fail("Bundle Job B should have been deleted");
}
catch (JPAExecutorException je) {
assertEquals(ErrorCode.E0604, je.getErrorCode());
}
try {
jpaService.execute(new BundleActionGetJPAExecutor(actionB1.getBundleId(), actionB1.getCoordName()));
fail("Bundle Action B1 should have been deleted");
}
catch (JPAExecutorException je) {
assertEquals(ErrorCode.E0605, je.getErrorCode());
}
try {
jpaService.execute(new BundleActionGetJPAExecutor(actionB2.getBundleId(), actionB2.getCoordName()));
fail("Bundle Action B2 should have been deleted");
}
catch (JPAExecutorException je) {
assertEquals(ErrorCode.E0605, je.getErrorCode());
}
try {
jpaService.execute(new BundleJobGetJPAExecutor(jobC.getId()));
fail("Bundle Job C should have been deleted");
}
catch (JPAExecutorException je) {
assertEquals(ErrorCode.E0604, je.getErrorCode());
}
try {
jpaService.execute(new BundleActionGetJPAExecutor(actionC1.getBundleId(), actionC1.getCoordName()));
fail("Bundle Action C1 should have been deleted");
}
catch (JPAExecutorException je) {
assertEquals(ErrorCode.E0605, je.getErrorCode());
}
try {
jpaService.execute(new BundleActionGetJPAExecutor(actionC2.getBundleId(), actionC2.getCoordName()));
fail("Bundle Action C2 should have been deleted");
}
catch (JPAExecutorException je) {
assertEquals(ErrorCode.E0605, je.getErrorCode());
}