Search in sources :

Example 31 with SLAEventBean

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

the class TestCoordMaterializeTransitionXCommand method checkCoordAction.

private CoordinatorActionBean checkCoordAction(String actionId) throws JPAExecutorException {
    long[] lastSeqId = new long[1];
    JPAService jpaService = Services.get().get(JPAService.class);
    List<SLAEventBean> slaEventList = jpaService.execute(new SLAEventsGetForSeqIdJPAExecutor(-1, 10, lastSeqId));
    if (slaEventList.size() == 0) {
        fail("Unable to GET any record of sequence id greater than 0");
    }
    CoordinatorActionBean actionBean;
    actionBean = jpaService.execute(new CoordActionGetJPAExecutor(actionId));
    return actionBean;
}
Also used : SLAEventsGetForSeqIdJPAExecutor(org.apache.oozie.executor.jpa.SLAEventsGetForSeqIdJPAExecutor) CoordinatorActionBean(org.apache.oozie.CoordinatorActionBean) CoordActionGetJPAExecutor(org.apache.oozie.executor.jpa.CoordActionGetJPAExecutor) JPAService(org.apache.oozie.service.JPAService) SLAEventBean(org.apache.oozie.SLAEventBean)

Example 32 with SLAEventBean

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

the class TestSLAEventsGetForFilterJPAExecutor method testGetSLAEventsForCoordJobId.

public void testGetSLAEventsForCoordJobId() throws Exception {
    Map<String, List<String>> filterListJob1 = createFilterList("jobid", coordId1);
    JPAService jpaService = Services.get().get(JPAService.class);
    assertNotNull(jpaService);
    // Use -1 instead of 0 because HSQLDB starts the event_id generator at 0 instead of 1
    SLAEventsGetForFilterJPAExecutor slaEventsGetCmd = new SLAEventsGetForFilterJPAExecutor(-1, 100, filterListJob1, new long[1]);
    List<SLAEventBean> list = jpaService.execute(slaEventsGetCmd);
    assertNotNull(list);
    assertEquals(1, list.size());
}
Also used : List(java.util.List) JPAService(org.apache.oozie.service.JPAService) SLAEventBean(org.apache.oozie.SLAEventBean)

Example 33 with SLAEventBean

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

the class TestSLAEventsGetForFilterJPAExecutor method testGetSLAEventsForAppName.

public void testGetSLAEventsForAppName() throws Exception {
    Map<String, List<String>> filterListApp2 = createFilterList("appname", appName2);
    JPAService jpaService = Services.get().get(JPAService.class);
    assertNotNull(jpaService);
    SLAEventsGetForFilterJPAExecutor slaEventsGetCmd = new SLAEventsGetForFilterJPAExecutor(0, 100, filterListApp2, new long[1]);
    List<SLAEventBean> list = jpaService.execute(slaEventsGetCmd);
    assertNotNull(list);
    assertEquals(2, list.size());
}
Also used : List(java.util.List) JPAService(org.apache.oozie.service.JPAService) SLAEventBean(org.apache.oozie.SLAEventBean)

Example 34 with SLAEventBean

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

the class TestSLAEventsGetForFilterJPAExecutor method testGetSLAEventsForOR.

public void testGetSLAEventsForOR() throws Exception {
    Map<String, List<String>> filterList = createFilterList("jobid", coordId1, coordActionId1);
    JPAService jpaService = Services.get().get(JPAService.class);
    assertNotNull(jpaService);
    // Use -1 instead of 0 because HSQLDB starts the event_id generator at 0 instead of 1
    SLAEventsGetForFilterJPAExecutor slaEventsGetCmd = new SLAEventsGetForFilterJPAExecutor(-1, 100, filterList, new long[1]);
    List<SLAEventBean> list = jpaService.execute(slaEventsGetCmd);
    assertNotNull(list);
    assertEquals(4, list.size());
}
Also used : List(java.util.List) JPAService(org.apache.oozie.service.JPAService) SLAEventBean(org.apache.oozie.SLAEventBean)

Example 35 with SLAEventBean

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

the class TestSLAEventsGetForFilterJPAExecutor method testGetSLAEventsForCombined.

public void testGetSLAEventsForCombined() throws Exception {
    Map<String, List<String>> filterList = createFilterList("jobid", coordId1, coordActionId1);
    filterList.put("appname", Arrays.asList(new String[] { appName1 }));
    JPAService jpaService = Services.get().get(JPAService.class);
    assertNotNull(jpaService);
    long[] lastSeqId = new long[1];
    lastSeqId[0] = -1;
    // Use -1 instead of 0 because HSQLDB starts the event_id generator at 0 instead of 1
    SLAEventsGetForFilterJPAExecutor slaEventsGetCmd = new SLAEventsGetForFilterJPAExecutor(-1, 100, filterList, lastSeqId);
    List<SLAEventBean> list = jpaService.execute(slaEventsGetCmd);
    assertNotNull(list);
    assertEquals(4, list.size());
}
Also used : List(java.util.List) JPAService(org.apache.oozie.service.JPAService) SLAEventBean(org.apache.oozie.SLAEventBean)

Aggregations

SLAEventBean (org.apache.oozie.SLAEventBean)42 Date (java.util.Date)15 JPAService (org.apache.oozie.service.JPAService)14 CommandException (org.apache.oozie.command.CommandException)13 List (java.util.List)12 JPAExecutorException (org.apache.oozie.executor.jpa.JPAExecutorException)10 Element (org.jdom.Element)7 XException (org.apache.oozie.XException)6 WorkflowActionQuery (org.apache.oozie.executor.jpa.WorkflowActionQueryExecutor.WorkflowActionQuery)6 ArrayList (java.util.ArrayList)5 UpdateEntry (org.apache.oozie.executor.jpa.BatchQueryExecutor.UpdateEntry)5 WorkflowJobQuery (org.apache.oozie.executor.jpa.WorkflowJobQueryExecutor.WorkflowJobQuery)5 IOException (java.io.IOException)4 Configuration (org.apache.hadoop.conf.Configuration)4 ControlNodeActionExecutor (org.apache.oozie.action.control.ControlNodeActionExecutor)4 Status (org.apache.oozie.client.SLAEvent.Status)4 PreconditionException (org.apache.oozie.command.PreconditionException)4 Query (javax.persistence.Query)3 ActionExecutorException (org.apache.oozie.action.ActionExecutorException)3 CoordActionQuery (org.apache.oozie.executor.jpa.CoordActionQueryExecutor.CoordActionQuery)3