Search in sources :

Example 96 with BundleJobBean

use of org.apache.oozie.BundleJobBean in project oozie by apache.

the class TestBulkBundleXCommand method testBulkBundleSuspendNegative.

public void testBulkBundleSuspendNegative() throws Exception {
    BundleJobBean job1 = this.addRecordToBundleJobTable(Job.Status.RUNNING, false);
    BundleJobBean job2 = this.addRecordToBundleJobTable(Job.Status.KILLED, false);
    Map<String, List<String>> map = new HashMap<String, List<String>>();
    List<String> names = new ArrayList<String>();
    names.add("BUNDLE");
    map.put("name", names);
    new BulkBundleXCommand(map, 1, 10, OperationType.Suspend).call();
    verifyJobStatus(job1.getId(), BundleJob.Status.RUNNING);
    verifyChildrenStatus(job1.getId(), CoordinatorJob.Status.RUNNING);
    verifyJobStatus(job2.getId(), BundleJob.Status.KILLED);
    verifyChildrenStatus(job2.getId(), CoordinatorJob.Status.KILLED);
}
Also used : BundleJobBean(org.apache.oozie.BundleJobBean) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List)

Example 97 with BundleJobBean

use of org.apache.oozie.BundleJobBean in project oozie by apache.

the class TestBulkBundleXCommand method testBulkBundleKillNegative.

public void testBulkBundleKillNegative() throws Exception {
    BundleJobBean job1 = this.addRecordToBundleJobTable(Job.Status.RUNNING, false);
    BundleJobBean job2 = this.addRecordToBundleJobTable(Job.Status.RUNNING, false);
    Map<String, List<String>> map = new HashMap<String, List<String>>();
    List<String> names = new ArrayList<String>();
    names.add("BUNDLE");
    map.put("name", names);
    new BulkBundleXCommand(map, 1, 50, OperationType.Kill).call();
    verifyJobStatus(job1.getId(), BundleJob.Status.RUNNING);
    verifyChildrenStatus(job1.getId(), CoordinatorJob.Status.RUNNING);
    verifyJobStatus(job2.getId(), BundleJob.Status.RUNNING);
    verifyChildrenStatus(job2.getId(), CoordinatorJob.Status.RUNNING);
}
Also used : BundleJobBean(org.apache.oozie.BundleJobBean) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List)

Example 98 with BundleJobBean

use of org.apache.oozie.BundleJobBean in project oozie by apache.

the class TestBulkBundleXCommand method verifyJobStatus.

private void verifyJobStatus(String jobId, BundleJob.Status status) throws Exception {
    BundleJobBean job = BundleJobQueryExecutor.getInstance().get(BundleJobQueryExecutor.BundleJobQuery.GET_BUNDLE_JOB, jobId);
    assertEquals(status, job.getStatus());
}
Also used : BundleJobBean(org.apache.oozie.BundleJobBean)

Example 99 with BundleJobBean

use of org.apache.oozie.BundleJobBean in project oozie by apache.

the class TestBulkBundleXCommand method testBulkBundleSuspendResumeKillSuccess.

public void testBulkBundleSuspendResumeKillSuccess() throws Exception {
    BundleJobBean job1 = this.addRecordToBundleJobTable(Job.Status.RUNNING, false);
    BundleJobBean job2 = this.addRecordToBundleJobTable(Job.Status.RUNNING, false);
    Map<String, List<String>> map = new HashMap<String, List<String>>();
    List<String> names = new ArrayList<String>();
    names.add("BUNDLE-TEST");
    map.put("name", names);
    new BulkBundleXCommand(map, 1, 50, OperationType.Suspend).call();
    verifyJobStatus(job1.getId(), BundleJob.Status.SUSPENDED);
    verifyChildrenStatus(job1.getId(), CoordinatorJob.Status.SUSPENDED);
    verifyJobStatus(job2.getId(), BundleJob.Status.SUSPENDED);
    verifyChildrenStatus(job2.getId(), CoordinatorJob.Status.SUSPENDED);
    new BulkBundleXCommand(map, 1, 50, OperationType.Resume).call();
    verifyJobStatus(job1.getId(), BundleJob.Status.RUNNING);
    verifyChildrenStatus(job1.getId(), CoordinatorJob.Status.RUNNING);
    verifyJobStatus(job2.getId(), BundleJob.Status.RUNNING);
    verifyChildrenStatus(job2.getId(), CoordinatorJob.Status.RUNNING);
    new BulkBundleXCommand(map, 1, 50, OperationType.Kill).call();
    verifyJobStatus(job1.getId(), BundleJob.Status.KILLED);
    verifyChildrenStatus(job1.getId(), CoordinatorJob.Status.KILLED);
    verifyJobStatus(job2.getId(), BundleJob.Status.KILLED);
    verifyChildrenStatus(job2.getId(), CoordinatorJob.Status.KILLED);
}
Also used : BundleJobBean(org.apache.oozie.BundleJobBean) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List)

Example 100 with BundleJobBean

use of org.apache.oozie.BundleJobBean in project oozie by apache.

the class TestBulkBundleXCommand method testBulkBundleResumeNegative.

public void testBulkBundleResumeNegative() throws Exception {
    BundleJobBean job1 = this.addRecordToBundleJobTable(Job.Status.RUNNING, false);
    BundleJobBean job2 = this.addRecordToBundleJobTable(Job.Status.SUSPENDED, false);
    Map<String, List<String>> map = new HashMap<String, List<String>>();
    List<String> names = new ArrayList<String>();
    names.add("BUNDLE");
    map.put("name", names);
    new BulkBundleXCommand(map, 1, 10, OperationType.Resume).call();
    verifyJobStatus(job1.getId(), BundleJob.Status.RUNNING);
    verifyChildrenStatus(job1.getId(), CoordinatorJob.Status.RUNNING);
    verifyJobStatus(job2.getId(), BundleJob.Status.SUSPENDED);
    verifyChildrenStatus(job2.getId(), CoordinatorJob.Status.SUSPENDED);
}
Also used : BundleJobBean(org.apache.oozie.BundleJobBean) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List)

Aggregations

BundleJobBean (org.apache.oozie.BundleJobBean)159 JPAService (org.apache.oozie.service.JPAService)78 BundleJobGetJPAExecutor (org.apache.oozie.executor.jpa.BundleJobGetJPAExecutor)69 BundleActionBean (org.apache.oozie.BundleActionBean)58 CoordinatorJobBean (org.apache.oozie.CoordinatorJobBean)46 JPAExecutorException (org.apache.oozie.executor.jpa.JPAExecutorException)44 Date (java.util.Date)35 ArrayList (java.util.ArrayList)24 BundleActionGetJPAExecutor (org.apache.oozie.executor.jpa.BundleActionGetJPAExecutor)24 List (java.util.List)21 WorkflowJobBean (org.apache.oozie.WorkflowJobBean)21 CoordJobGetJPAExecutor (org.apache.oozie.executor.jpa.CoordJobGetJPAExecutor)21 HashMap (java.util.HashMap)20 CoordinatorActionBean (org.apache.oozie.CoordinatorActionBean)20 StatusTransitRunnable (org.apache.oozie.service.StatusTransitService.StatusTransitRunnable)18 IOException (java.io.IOException)16 WorkflowActionBean (org.apache.oozie.WorkflowActionBean)16 XConfiguration (org.apache.oozie.util.XConfiguration)16 Query (javax.persistence.Query)14 CommandException (org.apache.oozie.command.CommandException)14