Search in sources :

Example 1 with SLAEventInsertJPAExecutor

use of org.apache.oozie.executor.jpa.SLAEventInsertJPAExecutor in project oozie by apache.

the class XDataTestCase method addRecordToSLAEventTable.

/**
 * Insert sla event for testing.
 *
 * @param slaId sla id
 * @param slaId app name
 * @param status sla status
 * @throws Exception thrown if unable to create sla bean
 */
@Deprecated
protected void addRecordToSLAEventTable(String slaId, String appName, SLAEvent.Status status, Date today) throws Exception {
    SLAEventBean sla = new SLAEventBean();
    sla.setSlaId(slaId);
    sla.setAppName(appName);
    sla.setParentClientId("parent-client-id");
    sla.setParentSlaId("parent-sla-id");
    sla.setExpectedStart(today);
    sla.setExpectedEnd(today);
    sla.setNotificationMsg("notification-msg");
    sla.setAlertContact("alert-contact");
    sla.setDevContact("dev-contact");
    sla.setQaContact("qa-contact");
    sla.setSeContact("se-contact");
    sla.setAlertFrequency("alert-frequency");
    sla.setAlertPercentage("alert-percentage");
    sla.setUpstreamApps("upstream-apps");
    sla.setAppType(SLAEvent.SlaAppType.WORKFLOW_JOB);
    sla.setUser(getTestUser());
    sla.setGroupName(getTestGroup());
    sla.setJobStatus(status);
    sla.setStatusTimestamp(today);
    try {
        JPAService jpaService = Services.get().get(JPAService.class);
        assertNotNull(jpaService);
        SLAEventInsertJPAExecutor slaInsertCmd = new SLAEventInsertJPAExecutor(sla);
        jpaService.execute(slaInsertCmd);
    } catch (JPAExecutorException je) {
        je.printStackTrace();
        fail("Unable to insert the test sla event record to table");
        throw je;
    }
}
Also used : JPAExecutorException(org.apache.oozie.executor.jpa.JPAExecutorException) SLAEventInsertJPAExecutor(org.apache.oozie.executor.jpa.SLAEventInsertJPAExecutor) JPAService(org.apache.oozie.service.JPAService) SLAEventBean(org.apache.oozie.SLAEventBean)

Aggregations

SLAEventBean (org.apache.oozie.SLAEventBean)1 JPAExecutorException (org.apache.oozie.executor.jpa.JPAExecutorException)1 SLAEventInsertJPAExecutor (org.apache.oozie.executor.jpa.SLAEventInsertJPAExecutor)1 JPAService (org.apache.oozie.service.JPAService)1