コード例 #1
0
  /**
   * flow-part.
   *
   * @throws Exception if failed
   */
  @Test
  public void flowpart() throws Exception {
    MapReduceCompilerToolkit tk = new MapReduceCompilerToolkit();

    FlowPortMap ports = tk.newFlowPortMap();
    In<MockData> in = ports.addInput("in", MockData.class);
    Out<MockData> out = ports.addOutput("out", MockData.class);
    SimpleJobflow flow = new SimpleJobflow(in, out);

    CompilerConfiguration conf = getConf(tk);
    try (CompilerSession session = tk.newSession(conf)) {
      ArtifactMirror artifact = session.compileFlow(flow, ports);
      check(artifact);
      JobflowMirror single = single(artifact.getBatch());

      assertThat(single.getInputs(), hasSize(1));
      PortMirror<? extends ImporterDescription> i0 = single.findInput("in");
      assertThat(i0, is(notNullValue()));
      assertThat(i0.getDescription(), is(instanceOf(TemporaryInputDescription.class)));

      assertThat(single.getOutputs(), hasSize(1));
      PortMirror<? extends ExporterDescription> o0 = single.findOutput("out");
      assertThat(o0, is(notNullValue()));
      assertThat(o0.getDescription(), is(instanceOf(TemporaryOutputDescription.class)));
    }
  }
コード例 #2
0
 /**
  * jobflow.
  *
  * @throws Exception if failed
  */
 @Test
 public void jobflow() throws Exception {
   MapReduceCompilerToolkit tk = new MapReduceCompilerToolkit();
   CompilerConfiguration conf = getConf(tk);
   try (CompilerSession session = tk.newSession(conf)) {
     ArtifactMirror artifact = session.compileJobflow(SimpleJobflow.class);
     check(artifact);
     JobflowMirror single = single(artifact.getBatch());
     checkSimpleJobflow(single);
   }
 }
コード例 #3
0
 private CompilerConfiguration getConf(MapReduceCompilerToolkit tk) throws IOException {
   CompilerConfiguration conf = tk.newConfiguration();
   conf.withClassLoader(getClass().getClassLoader());
   conf.withWorkingDirectory(temporary.newFolder());
   return conf;
 }