use of org.apache.oozie.WorkflowJobBean in project oozie by apache.
the class TestBulkWorkflowXCommand method testBulkResumeNoOp.
public void testBulkResumeNoOp() throws Exception {
WorkflowJobBean job1 = this.addRecordToWfJobTable(WorkflowJob.Status.RUNNING, WorkflowInstance.Status.RUNNING);
WorkflowActionBean action1 = this.addRecordToWfActionTable(job1.getId(), "1", WorkflowAction.Status.RUNNING);
Map<String, List<String>> map = new HashMap<String, List<String>>();
List<String> names = new ArrayList<String>();
names.add("testApp");
map.put("name", names);
new BulkWorkflowXCommand(map, 1, 50, OperationType.Resume).call();
verifyJobStatus(job1.getId(), WorkflowJob.Status.RUNNING);
verifyActionStatus(action1.getId(), WorkflowAction.Status.RUNNING);
}
use of org.apache.oozie.WorkflowJobBean in project oozie by apache.
the class TestBulkWorkflowXCommand method testbulkWfKillSuccess.
public void testbulkWfKillSuccess() throws Exception {
WorkflowJobBean job1 = this.addRecordToWfJobTable(WorkflowJob.Status.SUSPENDED, WorkflowInstance.Status.SUSPENDED);
WorkflowActionBean action1 = this.addRecordToWfActionTable(job1.getId(), "1", WorkflowAction.Status.RUNNING);
WorkflowJobBean job2 = this.addRecordToWfJobTable(WorkflowJob.Status.SUSPENDED, WorkflowInstance.Status.SUSPENDED);
WorkflowActionBean action2 = this.addRecordToWfActionTable(job2.getId(), "1", WorkflowAction.Status.RUNNING);
Map<String, List<String>> map = new HashMap<String, List<String>>();
List<String> names = new ArrayList<String>();
names.add("testApp");
map.put("name", names);
new BulkWorkflowXCommand(map, 1, 50, OperationType.Kill).call();
verifyJobStatus(job1.getId(), WorkflowJob.Status.KILLED);
verifyJobStatus(job2.getId(), WorkflowJob.Status.KILLED);
verifyActionStatus(action1.getId(), WorkflowAction.Status.KILLED);
verifyActionStatus(action2.getId(), WorkflowAction.Status.KILLED);
}
use of org.apache.oozie.WorkflowJobBean in project oozie by apache.
the class TestBulkWorkflowXCommand method testBulkSuspendNegative.
public void testBulkSuspendNegative() throws Exception {
WorkflowJobBean job1 = this.addRecordToWfJobTable(WorkflowJob.Status.RUNNING, WorkflowInstance.Status.RUNNING);
WorkflowActionBean action1 = this.addRecordToWfActionTable(job1.getId(), "1", WorkflowAction.Status.RUNNING);
Map<String, List<String>> map = new HashMap<String, List<String>>();
List<String> names = new ArrayList<String>();
names.add("testApp-new");
map.put("name", names);
new BulkWorkflowXCommand(map, 1, 50, OperationType.Suspend).call();
verifyJobStatus(job1.getId(), WorkflowJob.Status.RUNNING);
verifyActionStatus(action1.getId(), WorkflowAction.Status.RUNNING);
}
use of org.apache.oozie.WorkflowJobBean in project oozie by apache.
the class TestBulkWorkflowXCommand method testbulkWfKillNoOp.
public void testbulkWfKillNoOp() throws Exception {
WorkflowJobBean job1 = this.addRecordToWfJobTable(WorkflowJob.Status.RUNNING, WorkflowInstance.Status.RUNNING);
WorkflowActionBean action1 = this.addRecordToWfActionTable(job1.getId(), "1", WorkflowAction.Status.RUNNING);
WorkflowJobBean job2 = this.addRecordToWfJobTable(WorkflowJob.Status.SUCCEEDED, WorkflowInstance.Status.SUCCEEDED);
WorkflowActionBean action2 = this.addRecordToWfActionTable(job2.getId(), "1", WorkflowAction.Status.DONE);
Map<String, List<String>> map = new HashMap<String, List<String>>();
List<String> names = new ArrayList<String>();
names.add("testApp");
map.put("name", names);
new BulkWorkflowXCommand(map, 1, 50, OperationType.Kill).call();
verifyJobStatus(job1.getId(), WorkflowJob.Status.KILLED);
verifyJobStatus(job2.getId(), WorkflowJob.Status.SUCCEEDED);
verifyActionStatus(action1.getId(), WorkflowAction.Status.KILLED);
verifyActionStatus(action2.getId(), WorkflowAction.Status.DONE);
}
use of org.apache.oozie.WorkflowJobBean in project oozie by apache.
the class TestCoordWfActionInfoXCommand method createTestData.
/**
* init the test case.
* 1 coordJob
* 5 coordAction created by the coordJob, while the 5th coordAction's workflow instance is null
* 4 wfJob match the 1st ~ 4th coordAction
* the 1st - 3rd wfAction has a wfAction named 'aa' each, but the 4th desn't.
*/
private void createTestData() throws Exception {
JPAService jpaService = Services.get().get(JPAService.class);
assertNotNull("Missing jpa service", jpaService);
coordJob = addRecordToCoordJobTable(CoordinatorJob.Status.SUCCEEDED, false, false);
wfJobs = new ArrayList<WorkflowJobBean>();
coordActions = new ArrayList<CoordinatorActionBean>();
for (int i = 0; i < 4; i++) {
WorkflowJobBean wfJob = addRecordToWfJobTable(WorkflowJob.Status.SUCCEEDED, WorkflowInstance.Status.SUCCEEDED);
wfJobs.add(wfJob);
}
for (int i = 0; i < 4; i++) {
CoordinatorActionBean coordAction = addRecordToCoordActionTable(coordJob.getId(), (i + 1), CoordinatorAction.Status.SUCCEEDED, "coord-action-get.xml", wfJobs.get(i).getId(), "SUCCEEDED", 0);
coordActions.add(coordAction);
}
// add a coordAction that doesnt create workflow instance yet
CoordinatorActionBean coordAction = addRecordToCoordActionTable(coordJob.getId(), 5, CoordinatorAction.Status.SUCCEEDED, "coord-action-get.xml", null, null, 0);
coordActions.add(coordAction);
// set the NominalTime,in order to keep the order of the coordAction.
for (int i = 0; i < 5; i++) {
setCoordActionNominalTime(coordActions.get(i).getId(), (i + 1) * 1000);
}
// create the case that the 4th wfJob doesnt have a action named "aa"
for (int i = 0; i < 4; i++) {
String name = (i == 3) ? "bb" : "aa";
addRecordToWfActionTable(wfJobs.get(i).getId(), name, WorkflowAction.Status.DONE);
}
}
Aggregations