* @throws Exception
*/
public void testBundleChange2() throws Exception {
BundleJobBean bundleJob = this.addRecordToBundleJobTable(Job.Status.RUNNING, false);
CoordinatorJobBean coordJob = addRecordToCoordJobTable(CoordinatorJob.Status.SUCCEEDED, false, false);
coordJob.setBundleId(bundleJob.getId());
final JPAService jpaService = Services.get().get(JPAService.class);
assertNotNull(jpaService);
jpaService.execute(new CoordJobUpdateJPAExecutor(coordJob));
BundleActionBean bundleAction = new BundleActionBean();
bundleAction.setBundleActionId("11111");
bundleAction.setCoordId(coordJob.getId());
bundleAction.setBundleId(bundleJob.getId());
bundleAction.setStatus(Job.Status.SUCCEEDED);
jpaService.execute(new BundleActionInsertJPAExecutor(bundleAction));
String dateStr = "2099-01-01T01:00Z";
BundleJobGetJPAExecutor bundleJobGetCmd = new BundleJobGetJPAExecutor(bundleJob.getId());
bundleJob = jpaService.execute(bundleJobGetCmd);
assertEquals(bundleJob.getPauseTime(), null);
new BundleJobChangeXCommand(bundleJob.getId(), "pausetime=" + dateStr).call();
bundleJob = jpaService.execute(bundleJobGetCmd);
assertEquals(DateUtils.parseDateUTC(dateStr), bundleJob.getPauseTime());
final String coordJobId = coordJob.getId();
waitFor(60000, new Predicate() {
public boolean evaluate() throws Exception {
CoordinatorJobBean coordJob1 = jpaService.execute(new CoordJobGetJPAExecutor(coordJobId));
return (coordJob1.getPauseTime() != null);
}
});
coordJob = jpaService.execute(new CoordJobGetJPAExecutor(coordJob.getId()));
assertEquals(DateUtils.parseDateUTC(dateStr), coordJob.getPauseTime());