Menu

Home

pasha

Library validated complex Oozie workflows (http://oozie.apache.org/).

Two usage scenarios:

1) Execute workflow with specified parameters, and as result get list of passed nodes.
Sample in WorkflowDirProcessorIntegrationTest:

public class WorkflowDirProcessorIntegrationTest {
private static final File file = new File("src/test/resources/org/sf/owcheker");

@Test
public void testProcess() throws Exception {
    final Configuration configuration = new Configuration();
    configuration.set("nameNode", "src/test/resources/org/sf/owcheker");

    WorkflowDirProcessor processor = new WorkflowDirProcessor(file);
    final List<AbstractActionNode> result = processor.process(configuration);

    System.out.println(result.size());
    assertEquals("start", result.get(0).getNodeName());
    assertEquals("end", result.get(result.size() - 1).getNodeName());

    System.out.println("---- result --");
    for (AbstractActionNode current : result) {
        System.out.println(current.getNodeName());
    }
    assertNotNull(WorkflowContextUtil.getById(result, "mrStart"));
}

}
Note: from all workflow functions only "wf:conf" supported now.

2) Check called actions exists or build full call tree in xml format
Sample in OozieWorkflowCheckerTest:

final String path = "src/test/resources/org/sf/owcheker";

@Test
public void testRun() throws Exception {
    new OozieWorkflowChecker(path).run();
}
@Test
public void testRunAndSaveTree() throws Exception {
    final String resultPath = System.getProperty("user.dir")

            + File.separator + "_result.xml";
    new OozieWorkflowChecker(path).runAndSaveTree(resultPath);
}

You can override properties from "config-default.xml" and "job.properties" by file with name "override.properties"


MongoDB Logo MongoDB