use of org.apache.oozie.WorkflowActionBean in project oozie by apache.
the class TestWorkflowActionDeleteJPAExecutor method testWfActionDelete.
public void testWfActionDelete() throws Exception {
WorkflowJobBean job = addRecordToWfJobTable(WorkflowJob.Status.PREP, WorkflowInstance.Status.PREP);
WorkflowActionBean action = addRecordToWfActionTable(job.getId(), "1", WorkflowAction.Status.PREP);
_testWfActionDelete(action.getId());
System.out.println("testWfActionDelete Successful");
}
use of org.apache.oozie.WorkflowActionBean in project oozie by apache.
the class TestWorkflowActionGetJPAExecutor method _testGetAction.
private void _testGetAction(String actionId) throws Exception {
JPAService jpaService = Services.get().get(JPAService.class);
assertNotNull(jpaService);
WorkflowActionGetJPAExecutor actionGetCmd = new WorkflowActionGetJPAExecutor(actionId);
WorkflowActionBean ret = jpaService.execute(actionGetCmd);
assertNotNull(ret);
assertEquals(ret.getId(), actionId);
}
use of org.apache.oozie.WorkflowActionBean in project oozie by apache.
the class TestWorkflowActionQueryExecutor method testGetUpdateQuery.
public void testGetUpdateQuery() throws Exception {
EntityManager em = jpaService.getEntityManager();
WorkflowJobBean job = this.addRecordToWfJobTable(WorkflowJob.Status.RUNNING, WorkflowInstance.Status.RUNNING);
WorkflowActionBean bean = addRecordToWfActionTable(job.getId(), "1", WorkflowAction.Status.PREP);
// UPDATE_ACTION
Query query = WorkflowActionQueryExecutor.getInstance().getUpdateQuery(WorkflowActionQuery.UPDATE_ACTION, bean, em);
assertEquals(query.getParameterValue("conf"), bean.getConfBlob());
assertEquals(query.getParameterValue("consoleUrl"), bean.getConsoleUrl());
assertEquals(query.getParameterValue("data"), bean.getDataBlob());
assertEquals(query.getParameterValue("stats"), bean.getStatsBlob());
assertEquals(query.getParameterValue("externalChildIDs"), bean.getExternalChildIDsBlob());
assertEquals(query.getParameterValue("errorCode"), bean.getErrorCode());
assertEquals(query.getParameterValue("errorMessage"), bean.getErrorMessage());
assertEquals(query.getParameterValue("externalId"), bean.getExternalId());
assertEquals(query.getParameterValue("externalStatus"), bean.getExternalStatus());
assertEquals(query.getParameterValue("name"), bean.getName());
assertEquals(query.getParameterValue("cred"), bean.getCred());
assertEquals(query.getParameterValue("retries"), bean.getRetries());
assertEquals(query.getParameterValue("trackerUri"), bean.getTrackerUri());
assertEquals(query.getParameterValue("transition"), bean.getTransition());
assertEquals(query.getParameterValue("type"), bean.getType());
assertEquals(query.getParameterValue("endTime"), bean.getEndTimestamp());
assertEquals(query.getParameterValue("executionPath"), bean.getExecutionPath());
assertEquals(query.getParameterValue("lastCheckTime"), bean.getLastCheckTimestamp());
assertEquals(query.getParameterValue("logToken"), bean.getLogToken());
assertEquals(query.getParameterValue("pending"), bean.getPending());
assertEquals(query.getParameterValue("pendingAge"), bean.getPendingAge());
assertEquals(query.getParameterValue("signalValue"), bean.getSignalValue());
assertEquals(query.getParameterValue("slaXml"), bean.getSlaXmlBlob());
assertEquals(query.getParameterValue("startTime"), bean.getStartTimestamp());
assertEquals(query.getParameterValue("status"), bean.getStatus().toString());
assertEquals(query.getParameterValue("wfId"), bean.getWfId());
assertEquals(query.getParameterValue("id"), bean.getId());
// UPDATE_ACTION_FOR_LAST_CHECKED_TIME
query = WorkflowActionQueryExecutor.getInstance().getUpdateQuery(WorkflowActionQuery.UPDATE_ACTION, bean, em);
assertEquals(query.getParameterValue("lastCheckTime"), bean.getLastCheckTimestamp());
assertEquals(query.getParameterValue("id"), bean.getId());
// UPDATE_ACTION_PENDING
query = WorkflowActionQueryExecutor.getInstance().getUpdateQuery(WorkflowActionQuery.UPDATE_ACTION_PENDING, bean, em);
assertEquals(query.getParameterValue("pending"), bean.getPending());
assertEquals(query.getParameterValue("pendingAge"), bean.getPendingAgeTimestamp());
assertEquals(query.getParameterValue("id"), bean.getId());
// UPDATE_ACTION_STATUS_PENDING
query = WorkflowActionQueryExecutor.getInstance().getUpdateQuery(WorkflowActionQuery.UPDATE_ACTION_STATUS_PENDING, bean, em);
assertEquals(query.getParameterValue("pending"), bean.getPending());
assertEquals(query.getParameterValue("pendingAge"), bean.getPendingAgeTimestamp());
assertEquals(query.getParameterValue("status"), bean.getStatus().toString());
assertEquals(query.getParameterValue("id"), bean.getId());
// UPDATE_ACTION_PENDING_TRANS
query = WorkflowActionQueryExecutor.getInstance().getUpdateQuery(WorkflowActionQuery.UPDATE_ACTION_PENDING_TRANS, bean, em);
assertEquals(query.getParameterValue("pending"), bean.getPending());
assertEquals(query.getParameterValue("pendingAge"), bean.getPendingAgeTimestamp());
assertEquals(query.getParameterValue("transition"), bean.getTransition());
assertEquals(query.getParameterValue("id"), bean.getId());
// UPDATE_ACTION_PENDING_TRANS_ERROR
query = WorkflowActionQueryExecutor.getInstance().getUpdateQuery(WorkflowActionQuery.UPDATE_ACTION_PENDING_TRANS_ERROR, bean, em);
assertEquals(query.getParameterValue("pending"), bean.getPending());
assertEquals(query.getParameterValue("pendingAge"), bean.getPendingAgeTimestamp());
assertEquals(query.getParameterValue("transition"), bean.getTransition());
assertEquals(query.getParameterValue("errorCode"), bean.getErrorCode());
assertEquals(query.getParameterValue("errorMessage"), bean.getErrorMessage());
assertEquals(query.getParameterValue("status"), bean.getStatusStr());
assertEquals(query.getParameterValue("id"), bean.getId());
// UPDATE_ACTION_START
query = WorkflowActionQueryExecutor.getInstance().getUpdateQuery(WorkflowActionQuery.UPDATE_ACTION_START, bean, em);
assertEquals(query.getParameterValue("startTime"), bean.getStartTimestamp());
assertEquals(query.getParameterValue("externalChildIDs"), bean.getExternalChildIDsBlob());
assertEquals(query.getParameterValue("conf"), bean.getConfBlob());
assertEquals(query.getParameterValue("errorCode"), bean.getErrorCode());
assertEquals(query.getParameterValue("errorMessage"), bean.getErrorMessage());
assertEquals(query.getParameterValue("externalId"), bean.getExternalId());
assertEquals(query.getParameterValue("trackerUri"), bean.getTrackerUri());
assertEquals(query.getParameterValue("consoleUrl"), bean.getConsoleUrl());
assertEquals(query.getParameterValue("lastCheckTime"), bean.getLastCheckTimestamp());
assertEquals(query.getParameterValue("status"), bean.getStatus().toString());
assertEquals(query.getParameterValue("externalStatus"), bean.getExternalStatus());
assertEquals(query.getParameterValue("data"), bean.getDataBlob());
assertEquals(query.getParameterValue("retries"), bean.getRetries());
assertEquals(query.getParameterValue("pending"), bean.getPending());
assertEquals(query.getParameterValue("pendingAge"), bean.getPendingAgeTimestamp());
assertEquals(query.getParameterValue("userRetryCount"), bean.getUserRetryCount());
assertEquals(query.getParameterValue("id"), bean.getId());
// UPDATE_ACTION_CHECK
query = WorkflowActionQueryExecutor.getInstance().getUpdateQuery(WorkflowActionQuery.UPDATE_ACTION_CHECK, bean, em);
assertEquals(query.getParameterValue("externalChildIDs"), bean.getExternalChildIDsBlob());
assertEquals(query.getParameterValue("externalStatus"), bean.getExternalStatus());
assertEquals(query.getParameterValue("status"), bean.getStatus().toString());
assertEquals(query.getParameterValue("data"), bean.getDataBlob());
assertEquals(query.getParameterValue("pending"), bean.getPending());
assertEquals(query.getParameterValue("errorCode"), bean.getErrorCode());
assertEquals(query.getParameterValue("errorMessage"), bean.getErrorMessage());
assertEquals(query.getParameterValue("lastCheckTime"), bean.getLastCheckTimestamp());
assertEquals(query.getParameterValue("retries"), bean.getRetries());
assertEquals(query.getParameterValue("pendingAge"), bean.getPendingAgeTimestamp());
assertEquals(query.getParameterValue("startTime"), bean.getStartTimestamp());
assertEquals(query.getParameterValue("stats"), bean.getStatsBlob());
assertEquals(query.getParameterValue("userRetryCount"), bean.getUserRetryCount());
assertEquals(query.getParameterValue("id"), bean.getId());
// UPDATE_ACTION_END
query = WorkflowActionQueryExecutor.getInstance().getUpdateQuery(WorkflowActionQuery.UPDATE_ACTION_END, bean, em);
assertEquals(query.getParameterValue("errorCode"), bean.getErrorCode());
assertEquals(query.getParameterValue("errorMessage"), bean.getErrorMessage());
assertEquals(query.getParameterValue("retries"), bean.getRetries());
assertEquals(query.getParameterValue("endTime"), bean.getEndTimestamp());
assertEquals(query.getParameterValue("status"), bean.getStatus().toString());
assertEquals(query.getParameterValue("retries"), bean.getRetries());
assertEquals(query.getParameterValue("pending"), bean.getPending());
assertEquals(query.getParameterValue("pendingAge"), bean.getPendingAgeTimestamp());
assertEquals(query.getParameterValue("signalValue"), bean.getSignalValue());
assertEquals(query.getParameterValue("userRetryCount"), bean.getUserRetryCount());
assertEquals(query.getParameterValue("externalStatus"), bean.getExternalStatus());
assertEquals(query.getParameterValue("stats"), bean.getStatsBlob());
assertEquals(query.getParameterValue("id"), bean.getId());
em.close();
}
use of org.apache.oozie.WorkflowActionBean in project oozie by apache.
the class TestWorkflowActionQueryExecutor method testExecuteUpdate.
public void testExecuteUpdate() throws Exception {
WorkflowJobBean job = this.addRecordToWfJobTable(WorkflowJob.Status.RUNNING, WorkflowInstance.Status.RUNNING);
WorkflowActionBean bean = addRecordToWfActionTable(job.getId(), "1", WorkflowAction.Status.PREP);
bean.setStatus(WorkflowAction.Status.RUNNING);
bean.setName("test-name");
WorkflowActionQueryExecutor.getInstance().executeUpdate(WorkflowActionQuery.UPDATE_ACTION, bean);
WorkflowActionBean retBean = WorkflowActionQueryExecutor.getInstance().get(WorkflowActionQuery.GET_ACTION, bean.getId());
assertEquals("test-name", retBean.getName());
assertEquals(retBean.getStatus(), WorkflowAction.Status.RUNNING);
}
use of org.apache.oozie.WorkflowActionBean in project oozie by apache.
the class TestWorkflowActionRetryManualGetJPAExecutor method _testWfActionRetryManualGet.
private void _testWfActionRetryManualGet(String wfId) throws JPAExecutorException {
JPAService jpaService = Services.get().get(JPAService.class);
assertNotNull(jpaService);
WorkflowActionRetryManualGetJPAExecutor wfActionCmd = new WorkflowActionRetryManualGetJPAExecutor(wfId);
List<WorkflowActionBean> actions = jpaService.execute(wfActionCmd);
assertEquals(1, actions.size());
}
Aggregations