use of org.apache.oozie.executor.jpa.JPAExecutorException in project oozie by apache.
the class XDataTestCase method addRecordToCoordJobTable.
/**
* Insert coord job for testing.
*
* @param testFileName test file name
* @param status coord job status
* @param start start time
* @param end end time
* @param pending true if pending is true
* @param doneMatd true if doneMaterialization is true
* @param lastActionNum last action number
* @return coord job bean
* @throws Exception
*/
protected CoordinatorJobBean addRecordToCoordJobTable(String testFileName, CoordinatorJob.Status status, Date start, Date end, boolean pending, boolean doneMatd, int lastActionNum) throws Exception {
CoordinatorJobBean coordJob = createCoordJob(testFileName, status, start, end, pending, doneMatd, lastActionNum);
try {
JPAService jpaService = Services.get().get(JPAService.class);
assertNotNull(jpaService);
CoordJobInsertJPAExecutor coordInsertCmd = new CoordJobInsertJPAExecutor(coordJob);
jpaService.execute(coordInsertCmd);
} catch (JPAExecutorException je) {
je.printStackTrace();
fail("Unable to insert the test coord job record to table");
throw je;
}
return coordJob;
}
use of org.apache.oozie.executor.jpa.JPAExecutorException in project oozie by apache.
the class XDataTestCase method addRecordToCoordActionTable.
/**
* Insert coord action for testing.
*
* @param jobId coord job id
* @param actionNum action number
* @param status coord action status
* @param resourceXmlName xml file name
* @param pending pending counter
* @param actionNominalTime
* @return coord action bean
* @throws Exception thrown if unable to create coord action bean
*/
protected CoordinatorActionBean addRecordToCoordActionTable(String jobId, int actionNum, CoordinatorAction.Status status, String resourceXmlName, int pending, Date actionNominalTime) throws Exception {
CoordinatorActionBean action = createCoordAction(jobId, actionNum, status, resourceXmlName, pending, actionNominalTime);
try {
JPAService jpaService = Services.get().get(JPAService.class);
assertNotNull(jpaService);
CoordActionInsertJPAExecutor coordActionInsertCmd = new CoordActionInsertJPAExecutor(action);
jpaService.execute(coordActionInsertCmd);
} catch (JPAExecutorException je) {
je.printStackTrace();
fail("Unable to insert the test coord action record to table");
throw je;
}
return action;
}
use of org.apache.oozie.executor.jpa.JPAExecutorException in project oozie by apache.
the class XDataTestCase method insertRecordCoordAction.
/**
* Inserts a record to coord action table
*
* @param action the record to be inserted
* @throws Exception
*/
protected void insertRecordCoordAction(CoordinatorActionBean action) throws Exception {
try {
JPAService jpaService = Services.get().get(JPAService.class);
assertNotNull(jpaService);
CoordActionInsertJPAExecutor coordActionInsertCmd = new CoordActionInsertJPAExecutor(action);
jpaService.execute(coordActionInsertCmd);
} catch (JPAExecutorException je) {
je.printStackTrace();
fail("Unable to insert the test coord action record to table");
throw je;
}
}
use of org.apache.oozie.executor.jpa.JPAExecutorException in project oozie by apache.
the class XDataTestCase method addRecordToWfJobTable.
/**
* Insert subwf job for testing.
*
* @param jobStatus workflow job status
* @param instanceStatus workflow instance status
* @param parentId the id of the parent workflow
* @return workflow job bean
* @throws Exception thrown if unable to create workflow job bean
*/
protected WorkflowJobBean addRecordToWfJobTable(WorkflowJob.Status jobStatus, WorkflowInstance.Status instanceStatus, String parentId) throws Exception {
WorkflowJobBean subwfBean = addRecordToWfJobTable(jobStatus, instanceStatus);
subwfBean.setParentId(parentId);
try {
JPAService jpaService = Services.get().get(JPAService.class);
assertNotNull(jpaService);
WorkflowJobQueryExecutor.getInstance().executeUpdate(WorkflowJobQuery.UPDATE_WORKFLOW_PARENT_MODIFIED, subwfBean);
} catch (JPAExecutorException je) {
je.printStackTrace();
fail("Unable to insert the test wf job record to table");
throw je;
}
return subwfBean;
}
use of org.apache.oozie.executor.jpa.JPAExecutorException in project oozie by apache.
the class XDataTestCase method addRecordToSLARegistrationTable.
/**
* Insert sla registration for test
* @param appName application name
* @param status sla status
* @return
* @throws Exception
*/
protected SLARegistrationBean addRecordToSLARegistrationTable(String appName, SLAStatus status) throws Exception {
SLARegistrationBean sla = new SLARegistrationBean();
Date today = new Date();
sla.setId(Services.get().get(UUIDService.class).generateId(ApplicationType.COORDINATOR));
sla.setAppName(appName);
sla.setAppType(AppType.COORDINATOR_JOB);
sla.setExpectedDuration(100);
sla.setExpectedEnd(today);
sla.setExpectedStart(today);
sla.setJobData("test-job-data");
sla.setCreatedTime(today);
sla.setNominalTime(today);
sla.setNotificationMsg("test-sla-notification-msg");
sla.setParentId(Services.get().get(UUIDService.class).generateId(ApplicationType.BUNDLE));
sla.setSlaConfig("alert-events");
sla.setUpstreamApps("test-upstream-apps");
sla.setUser("oozie");
try {
SLARegistrationQueryExecutor.getInstance().insert(sla);
} catch (JPAExecutorException je) {
je.printStackTrace();
fail("Unable to insert the test sla registration record to table");
throw je;
}
return sla;
}
Aggregations