use of org.apache.oozie.executor.jpa.WorkflowActionInsertJPAExecutor in project oozie by apache.
the class TestActionStartXCommand method addRecordToWfActionTableWithAppPathConfig.
/**
* Create workflow action with custom action configuration
*
* @param wfId workflow id
* @param actionName action name
* @param status workflow action status
* @return workflow action bean
* @throws Exception thrown if failed to create workflow action
*/
protected WorkflowActionBean addRecordToWfActionTableWithAppPathConfig(String wfId, String actionName, WorkflowAction.Status status) throws Exception {
WorkflowActionBean action = createWorkflowActionWithAppPathConfig(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;
}
use of org.apache.oozie.executor.jpa.WorkflowActionInsertJPAExecutor in project oozie by apache.
the class TestActionStartXCommand method addRecordToWfActionTableWithFS.
private WorkflowActionBean addRecordToWfActionTableWithFS(String wfId, String actionName, WorkflowAction.Status status) throws Exception {
WorkflowActionBean action = createWorkflowActionForFS(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;
}
use of org.apache.oozie.executor.jpa.WorkflowActionInsertJPAExecutor in project oozie by apache.
the class TestActionStartXCommand method addRecordToWfActionTable.
/* (non-Javadoc)
* @see org.apache.oozie.test.XDataTestCase#addRecordToWfActionTable(
* java.lang.String, java.lang.String, org.apache.oozie.client.WorkflowAction.Status)
*/
@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;
}
use of org.apache.oozie.executor.jpa.WorkflowActionInsertJPAExecutor in project oozie by apache.
the class TestEventGeneration method _createWorkflowAction.
private String _createWorkflowAction(String wfId, String actionName) throws JPAExecutorException {
WorkflowActionBean action = new WorkflowActionBean();
action.setName(actionName);
action.setId(Services.get().get(UUIDService.class).generateChildId(wfId, actionName));
action.setJobId(wfId);
action.setType("java");
action.setTransition("transition");
action.setStatus(WorkflowAction.Status.PREP);
action.setStartTime(new Date());
action.setEndTime(new Date());
action.setLastCheckTime(new Date());
action.setPendingOnly();
String actionXml = "<java>" + "<job-tracker>" + getJobTrackerUri() + "</job-tracker>" + "<name-node>" + getNameNodeUri() + "</name-node>" + "<main-class>" + "${dummy}" + "</java>";
action.setConf(actionXml);
jpaService.execute(new WorkflowActionInsertJPAExecutor(action));
return action.getId();
}
use of org.apache.oozie.executor.jpa.WorkflowActionInsertJPAExecutor in project oozie by apache.
the class TestWorkflowActionKillXCommand method addRecordToWfActionTable.
protected WorkflowActionBean addRecordToWfActionTable(String wfId, String externalJobID, String actionName, WorkflowAction.Status status, String childID) throws Exception {
WorkflowActionBean action = new WorkflowActionBean();
action.setId(Services.get().get(UUIDService.class).generateChildId(wfId, actionName));
action.setJobId(wfId);
action.setName(actionName);
action.setType("map-reduce");
action.setStatus(status);
action.setStartTime(new Date());
action.setEndTime(new Date());
action.setLastCheckTime(new Date());
action.setPending();
action.setExternalId(externalJobID);
action.setExternalStatus("RUNNING");
action.setExternalChildIDs(childID);
String actionXml = "<map-reduce>" + "<job-tracker>" + getJobTrackerUri() + "</job-tracker>" + "<name-node>" + getNameNodeUri() + "</name-node>" + "<configuration>" + "<property><name>mapred.mapper.class</name><value>" + MapperReducerForTest.class.getName() + "</value></property>" + "<property><name>mapred.reducer.class</name><value>" + MapperReducerForTest.class.getName() + "</value></property>" + "<property><name>mapred.input.dir</name><value>inputDir</value></property>" + "<property><name>mapred.output.dir</name><value>outputDir</value></property>" + "</configuration>" + "</map-reduce>";
action.setConf(actionXml);
try {
JPAService jpaService = Services.get().get(JPAService.class);
assertNotNull(jpaService);
WorkflowActionInsertJPAExecutor actionInsertExe = new WorkflowActionInsertJPAExecutor(action);
jpaService.execute(actionInsertExe);
} catch (JPAExecutorException je) {
je.printStackTrace();
fail("Unable to insert the test wf action record to table");
throw je;
}
return action;
}
Aggregations