use of org.apache.oozie.client.rest.JsonBean in project oozie by apache.
the class TestSLACalculationJPAExecutor method testInsert.
/**
* Test simple insert
*
* @throws Exception
*/
@Test
public void testInsert() throws Exception {
JPAService jpaService = Services.get().get(JPAService.class);
assertNotNull(jpaService);
String wfId = "workflow-1";
cal.setTime(new Date());
cal.add(Calendar.DAY_OF_MONTH, -2);
Date expStart = cal.getTime();
cal.add(Calendar.DAY_OF_MONTH, -1);
Date expEnd = cal.getTime();
Date actStart = new Date();
cal.add(Calendar.DAY_OF_MONTH, 2);
Date actEnd = cal.getTime();
SLASummaryBean bean2 = _createSLASummaryBean(wfId, "RUNNING", EventStatus.START_MISS, expStart, expEnd, 1000, actStart, actEnd, 2000, (byte) 1, actEnd);
List<JsonBean> insertList = new ArrayList<JsonBean>();
insertList.add(bean2);
BatchQueryExecutor.getInstance().executeBatchInsertUpdateDelete(insertList, null, null);
SLASummaryBean sBean = SLASummaryQueryExecutor.getInstance().get(SLASummaryQuery.GET_SLA_SUMMARY, wfId);
assertEquals(wfId, sBean.getId());
assertEquals("RUNNING", sBean.getJobStatus());
assertEquals(EventStatus.START_MISS, sBean.getEventStatus());
assertEquals(expStart, sBean.getExpectedStart());
assertEquals(expEnd, sBean.getExpectedEnd());
assertEquals(1000, sBean.getExpectedDuration());
assertEquals(actStart, sBean.getActualStart());
assertEquals(actEnd, sBean.getActualEnd());
assertEquals(2000, sBean.getActualDuration());
assertEquals(actEnd, sBean.getLastModifiedTime());
}
use of org.apache.oozie.client.rest.JsonBean in project oozie by apache.
the class TestSLACalculatorMemory method createWorkflow.
private void createWorkflow(List<String> idList) throws Exception {
List<JsonBean> insertList = new ArrayList<JsonBean>();
for (String id : idList) {
WorkflowJobBean workflow = new WorkflowJobBean();
workflow.setId(id);
workflow.setStatusStr("PREP");
workflow.setStartTime(new Date());
insertList.add(workflow);
}
BatchQueryExecutor.getInstance().executeBatchInsertUpdateDelete(insertList, null, null);
}
use of org.apache.oozie.client.rest.JsonBean in project oozie by apache.
the class TestSLAJobEventListener method createWorkflowAction.
private WorkflowActionBean createWorkflowAction(String id, String parentId) throws Exception {
List<JsonBean> insertList = new ArrayList<JsonBean>();
WorkflowActionBean action = new WorkflowActionBean();
action.setId(id);
action.setJobId(parentId);
insertList.add(action);
BatchQueryExecutor.getInstance().executeBatchInsertUpdateDelete(insertList, null, null);
return action;
}
use of org.apache.oozie.client.rest.JsonBean in project oozie by apache.
the class TestSLAJobEventListener method createWorkflow.
private WorkflowJobBean createWorkflow(String id, Date actualStart) throws Exception {
List<JsonBean> insertList = new ArrayList<JsonBean>();
WorkflowJobBean workflow = new WorkflowJobBean();
workflow.setId(id);
workflow.setStatusStr("PREP");
workflow.setStartTime(actualStart);
workflow.setSlaXml("<sla></sla>");
insertList.add(workflow);
BatchQueryExecutor.getInstance().executeBatchInsertUpdateDelete(insertList, null, null);
return workflow;
}
use of org.apache.oozie.client.rest.JsonBean in project oozie by apache.
the class TestSLAJobEventListener method createCoordAction.
private CoordinatorActionBean createCoordAction(String id, String parentId) throws Exception {
List<JsonBean> insertList = new ArrayList<JsonBean>();
CoordinatorActionBean action = new CoordinatorActionBean();
action.setId(id);
action.setJobId(parentId);
insertList.add(action);
BatchQueryExecutor.getInstance().executeBatchInsertUpdateDelete(insertList, null, null);
return action;
}
Aggregations