コード例 #1
0
  @Test(dependsOnMethods = "testOnProcessEntityChange")
  public void testAreSame() throws Exception {

    Inputs inputs1 = new Inputs();
    Inputs inputs2 = new Inputs();
    Outputs outputs1 = new Outputs();
    Outputs outputs2 = new Outputs();
    // return true when both are null
    Assert.assertTrue(EntityRelationshipGraphBuilder.areSame(inputs1, inputs2));
    Assert.assertTrue(EntityRelationshipGraphBuilder.areSame(outputs1, outputs2));

    Input i1 = new Input();
    i1.setName("input1");
    Input i2 = new Input();
    i2.setName("input2");
    Output o1 = new Output();
    o1.setName("output1");
    Output o2 = new Output();
    o2.setName("output2");

    inputs1.getInputs().add(i1);
    Assert.assertFalse(EntityRelationshipGraphBuilder.areSame(inputs1, inputs2));
    outputs1.getOutputs().add(o1);
    Assert.assertFalse(EntityRelationshipGraphBuilder.areSame(outputs1, outputs2));

    inputs2.getInputs().add(i1);
    Assert.assertTrue(EntityRelationshipGraphBuilder.areSame(inputs1, inputs2));
    outputs2.getOutputs().add(o1);
    Assert.assertTrue(EntityRelationshipGraphBuilder.areSame(outputs1, outputs2));
  }
コード例 #2
0
  public void removeInputFeeds(Inputs inputs, Vertex processVertex) {
    if (inputs == null) {
      return;
    }

    for (Input input : inputs.getInputs()) {
      removeProcessFeedEdge(processVertex, input.getFeed(), RelationshipLabel.FEED_PROCESS_EDGE);
    }
  }
コード例 #3
0
  @Test
  public void testProcessInputUpdate() throws Exception {
    scheduleProcess();
    waitForBundleStart(Job.Status.RUNNING);

    ClientResponse response =
        this.service
            .path("api/entities/definition/process/" + processName)
            .header("Remote-User", REMOTE_USER)
            .accept(MediaType.TEXT_XML)
            .get(ClientResponse.class);
    Process process =
        (Process)
            EntityType.PROCESS
                .getUnmarshaller()
                .unmarshal(new StringReader(response.getEntity(String.class)));

    String feed3 = "f3" + System.currentTimeMillis();
    Map<String, String> overlay = new HashMap<String, String>();
    overlay.put("inputFeedName", feed3);
    overlay.put("cluster", clusterName);
    response = submitToFalcon(FEED_TEMPLATE1, overlay, EntityType.FEED);
    assertSuccessful(response);

    Input input = new Input();
    input.setFeed(feed3);
    input.setName("inputData2");
    input.setStart("today(20,0)");
    input.setEnd("today(20,20)");
    process.getInputs().getInputs().add(input);

    Validity processValidity = process.getClusters().getClusters().get(0).getValidity();
    processValidity.setEnd(new Date(new Date().getTime() + 2 * 24 * 60 * 60 * 1000));
    File tmpFile = getTempFile();
    EntityType.PROCESS.getMarshaller().marshal(process, tmpFile);
    response =
        this.service
            .path("api/entities/update/process/" + processName)
            .header("Remote-User", REMOTE_USER)
            .accept(MediaType.TEXT_XML)
            .post(ClientResponse.class, getServletInputStream(tmpFile.getAbsolutePath()));
    assertSuccessful(response);

    // Assert that update creates new bundle
    List<BundleJob> bundles = getBundles();
    Assert.assertEquals(bundles.size(), 2);
  }
コード例 #4
0
  @Test(enabled = false)
  public void testOptionalInput() throws Exception {
    Map<String, String> overlay = getUniqueOverlay();
    String tmpFileName = overlayParametersOverTemplate(PROCESS_TEMPLATE, overlay);
    Process process =
        (Process) EntityType.PROCESS.getUnmarshaller().unmarshal(new File(tmpFileName));

    Input in1 = process.getInputs().getInputs().get(0);
    Input in2 = new Input();
    in2.setFeed(in1.getFeed());
    in2.setName("input2");
    in2.setOptional(true);
    in2.setPartition(in1.getPartition());
    in2.setStart("now(-1,0)");
    in2.setEnd("now(0,0)");
    process.getInputs().getInputs().add(in2);

    File tmpFile = getTempFile();
    EntityType.PROCESS.getMarshaller().marshal(process, tmpFile);
    scheduleProcess(tmpFile.getAbsolutePath(), overlay);
    waitForWorkflowStart(processName);
  }