protected CoordinatorJobBean addRecordToCoordJobTable( CoordinatorJob.Status status, Date startTime, Date endTime, Date pauseTime, int timeout) throws Exception { CoordinatorJobBean coordJob = createCoordJob(status); coordJob.setStartTime(startTime); coordJob.setEndTime(endTime); coordJob.setPauseTime(pauseTime); coordJob.setFrequency(5); coordJob.setTimeUnit(Timeunit.MINUTE); coordJob.setTimeout(timeout); coordJob.setConcurrency(3); try { JPAService jpaService = Services.get().get(JPAService.class); assertNotNull(jpaService); CoordJobInsertJPAExecutor coordInsertCmd = new CoordJobInsertJPAExecutor(coordJob); jpaService.execute(coordInsertCmd); } catch (JPAExecutorException ex) { ex.printStackTrace(); fail("Unable to insert the test coord job record to table"); throw ex; } return coordJob; }
private void checkCoordActions(String jobId, int number, CoordinatorJob.Status status) { try { JPAService jpaService = Services.get().get(JPAService.class); List<CoordinatorActionBean> actions = jpaService.execute(new CoordJobGetActionsJPAExecutor(jobId)); if (actions.size() != number) { fail( "Should have " + number + " actions created for job " + jobId + ", but jave " + actions.size() + " actions."); } if (status != null) { CoordinatorJob job = jpaService.execute(new CoordJobGetJPAExecutor(jobId)); if (job.getStatus() != status) { fail("Job status " + job.getStatus() + " should be " + status); } } } catch (JPAExecutorException se) { se.printStackTrace(); fail("Job ID " + jobId + " was not stored properly in db"); } }
private void checkCoordActionsTimeout(String actionId, int expected) { try { JPAService jpaService = Services.get().get(JPAService.class); CoordinatorActionBean action = jpaService.execute(new CoordActionGetJPAExecutor(actionId)); assertEquals(action.getTimeOut(), expected); } catch (JPAExecutorException se) { se.printStackTrace(); fail("Action ID " + actionId + " was not stored properly in db"); } }
@Override protected WorkflowActionBean addRecordToWfActionTable( String wfId, String actionName, WorkflowAction.Status status) throws Exception { WorkflowActionBean action = createWorkflowActionSetPending(wfId, status); try { JPAService jpaService = Services.get().get(JPAService.class); assertNotNull(jpaService); WorkflowActionInsertJPAExecutor actionInsertCmd = new WorkflowActionInsertJPAExecutor(action); jpaService.execute(actionInsertCmd); } catch (JPAExecutorException ce) { ce.printStackTrace(); fail("Unable to insert the test wf action record to table"); throw ce; } return action; }