コード例 #1
0
  protected WorkflowActionBean createWorkflowActionSetPending(
      String wfId, WorkflowAction.Status status) throws Exception {
    WorkflowActionBean action = new WorkflowActionBean();
    String actionname = "testAction";
    action.setName(actionname);
    action.setCred("null");
    action.setId(Services.get().get(UUIDService.class).generateChildId(wfId, actionname));
    action.setJobId(wfId);
    action.setType("map-reduce");
    action.setTransition("transition");
    action.setStatus(status);
    action.setStartTime(new Date());
    action.setEndTime(new Date());
    action.setLastCheckTime(new Date());
    action.setPending();
    action.setExecutionPath("/");

    Path inputDir = new Path(getFsTestCaseDir(), "input");
    Path outputDir = new Path(getFsTestCaseDir(), "output");

    FileSystem fs = getFileSystem();
    Writer w = new OutputStreamWriter(fs.create(new Path(inputDir, "data.txt")));
    w.write("dummy\n");
    w.write("dummy\n");
    w.close();

    String actionXml =
        "<map-reduce>"
            + "<job-tracker>"
            + getJobTrackerUri()
            + "</job-tracker>"
            + "<name-node>"
            + getNameNodeUri()
            + "</name-node>"
            + "<prepare><delete path=\""
            + outputDir.toString()
            + "\"/></prepare>"
            + "<configuration>"
            + "<property><name>mapred.mapper.class</name><value>"
            + MapperReducerForTest.class.getName()
            + "</value></property>"
            + "<property><name>mapred.reducer.class</name><value>"
            + MapperReducerForTest.class.getName()
            + "</value></property>"
            + "<property><name>mapred.input.dir</name><value>"
            + inputDir.toString()
            + "</value></property>"
            + "<property><name>mapred.output.dir</name><value>"
            + outputDir.toString()
            + "</value></property>"
            + "</configuration>"
            + "</map-reduce>";
    action.setConf(actionXml);

    return action;
  }