Search in sources :

Example 21 with EndNodeDef

use of org.apache.oozie.workflow.lite.EndNodeDef in project oozie by apache.

the class TestWorkflowJobsGetForPurgeJPAExecutor method addRecordToWfJobTable.

@Override
protected WorkflowJobBean addRecordToWfJobTable(WorkflowJob.Status jobStatus, WorkflowInstance.Status instanceStatus) throws Exception {
    WorkflowApp app = new LiteWorkflowApp("testApp", "<workflow-app/>", new StartNodeDef(LiteWorkflowStoreService.LiteControlNodeHandler.class, "end")).addNode(new EndNodeDef("end", LiteWorkflowStoreService.LiteControlNodeHandler.class));
    Configuration conf = new Configuration();
    Path appUri = new Path(getAppPath(), "workflow.xml");
    conf.set(OozieClient.APP_PATH, appUri.toString());
    conf.set(OozieClient.LOG_TOKEN, "testToken");
    conf.set(OozieClient.USER_NAME, getTestUser());
    WorkflowJobBean wfBean = createWorkflow(app, conf, jobStatus, instanceStatus);
    Timestamp startTS = new Timestamp(System.currentTimeMillis() - (3 * DAY_IN_MS));
    Timestamp endTS = new Timestamp(System.currentTimeMillis() - (2 * DAY_IN_MS));
    wfBean.setStartTime(DateUtils.toDate(startTS));
    wfBean.setEndTime(DateUtils.toDate(endTS));
    try {
        JPAService jpaService = Services.get().get(JPAService.class);
        assertNotNull(jpaService);
        WorkflowJobInsertJPAExecutor wfInsertCmd = new WorkflowJobInsertJPAExecutor(wfBean);
        jpaService.execute(wfInsertCmd);
    } catch (JPAExecutorException je) {
        je.printStackTrace();
        fail("Unable to insert the test wf job record to table");
        throw je;
    }
    return wfBean;
}
Also used : LiteWorkflowApp(org.apache.oozie.workflow.lite.LiteWorkflowApp) WorkflowApp(org.apache.oozie.workflow.WorkflowApp) EndNodeDef(org.apache.oozie.workflow.lite.EndNodeDef) Path(org.apache.hadoop.fs.Path) Configuration(org.apache.hadoop.conf.Configuration) LiteWorkflowApp(org.apache.oozie.workflow.lite.LiteWorkflowApp) WorkflowJobBean(org.apache.oozie.WorkflowJobBean) Timestamp(java.sql.Timestamp) StartNodeDef(org.apache.oozie.workflow.lite.StartNodeDef) LiteWorkflowStoreService(org.apache.oozie.service.LiteWorkflowStoreService) JPAService(org.apache.oozie.service.JPAService)

Aggregations

EndNodeDef (org.apache.oozie.workflow.lite.EndNodeDef)21 LiteWorkflowApp (org.apache.oozie.workflow.lite.LiteWorkflowApp)21 StartNodeDef (org.apache.oozie.workflow.lite.StartNodeDef)21 WorkflowJobBean (org.apache.oozie.WorkflowJobBean)20 LiteWorkflowStoreService (org.apache.oozie.service.LiteWorkflowStoreService)15 XConfiguration (org.apache.oozie.util.XConfiguration)14 Configuration (org.apache.hadoop.conf.Configuration)13 WorkflowActionBean (org.apache.oozie.WorkflowActionBean)13 WorkflowApp (org.apache.oozie.workflow.WorkflowApp)13 Path (org.apache.hadoop.fs.Path)9 LiteWorkflowInstance (org.apache.oozie.workflow.lite.LiteWorkflowInstance)9 WorkflowJobInsertJPAExecutor (org.apache.oozie.executor.jpa.WorkflowJobInsertJPAExecutor)7 ELService (org.apache.oozie.service.ELService)7 ELEvaluator (org.apache.oozie.util.ELEvaluator)7 JPAService (org.apache.oozie.service.JPAService)6 WorkflowInstance (org.apache.oozie.workflow.WorkflowInstance)5 ByteArrayOutputStream (java.io.ByteArrayOutputStream)4 JPAExecutorException (org.apache.oozie.executor.jpa.JPAExecutorException)4 Date (java.util.Date)3 Test (org.junit.Test)3