@Test(dependsOnMethods = "testOnChange")
  public void testOnFeedEntityChange() throws Exception {
    Feed oldFeed = inputFeeds.get(0);
    Feed newFeed =
        EntityBuilderTestUtil.buildFeed(
            oldFeed.getName(),
            clusterEntity,
            "classified-as=Secured,source=data-warehouse",
            "reporting");
    addStorage(
        newFeed, Storage.TYPE.FILESYSTEM, "jail://global:00/falcon/impression-feed/20140101");

    try {
      configStore.initiateUpdate(newFeed);

      // add cluster
      org.apache.falcon.entity.v0.feed.Cluster feedCluster =
          new org.apache.falcon.entity.v0.feed.Cluster();
      feedCluster.setName(anotherCluster.getName());
      newFeed.getClusters().getClusters().add(feedCluster);

      configStore.update(EntityType.FEED, newFeed);
    } finally {
      configStore.cleanupUpdateInit();
    }

    verifyUpdatedEdges(newFeed);
    Assert.assertEquals(getVerticesCount(service.getGraph()), 22); // +2 = 2 new tags
    Assert.assertEquals(getEdgesCount(service.getGraph()), 35); // +2 = 1 new cluster, 1 new tag
  }
  @Test(dependsOnMethods = "testOnFeedEntityChange")
  public void testOnProcessEntityChange() throws Exception {
    Process oldProcess = processEntity;
    Process newProcess =
        EntityBuilderTestUtil.buildProcess(oldProcess.getName(), anotherCluster, null, null);
    EntityBuilderTestUtil.addProcessWorkflow(newProcess, GENERATE_WORKFLOW_NAME, "2.0.0");
    EntityBuilderTestUtil.addInput(newProcess, inputFeeds.get(0));

    try {
      configStore.initiateUpdate(newProcess);
      configStore.update(EntityType.PROCESS, newProcess);
    } finally {
      configStore.cleanupUpdateInit();
    }

    verifyUpdatedEdges(newProcess);
    Assert.assertEquals(getVerticesCount(service.getGraph()), 22); // +0, no net new
    Assert.assertEquals(
        getEdgesCount(service.getGraph()), 29); // -6 = -2 outputs, -1 tag, -1 cluster, -2 pipelines
  }
  public Process addProcessEntity(
      String processName,
      Cluster cluster,
      String tags,
      String pipelineTags,
      String workflowName,
      String version)
      throws Exception {
    Process process = EntityBuilderTestUtil.buildProcess(processName, cluster, tags, pipelineTags);
    EntityBuilderTestUtil.addProcessWorkflow(process, workflowName, version);

    for (Feed inputFeed : inputFeeds) {
      EntityBuilderTestUtil.addInput(process, inputFeed);
    }

    for (Feed outputFeed : outputFeeds) {
      EntityBuilderTestUtil.addOutput(process, outputFeed);
    }

    configStore.publish(EntityType.PROCESS, process);
    return process;
  }
 private Feed addFeedEntity(
     String feedName,
     Cluster[] clusters,
     String tags,
     String groups,
     Storage.TYPE storageType,
     String uriTemplate)
     throws Exception {
   Feed feed = EntityBuilderTestUtil.buildFeed(feedName, clusters, tags, groups);
   addStorage(feed, storageType, uriTemplate);
   for (org.apache.falcon.entity.v0.feed.Cluster feedCluster : feed.getClusters().getClusters()) {
     if (feedCluster.getName().equals(BCP_CLUSTER_ENTITY_NAME)) {
       feedCluster.setType(ClusterType.TARGET);
     }
   }
   configStore.publish(EntityType.FEED, feed);
   return feed;
 }
 private Cluster addClusterEntity(String name, String colo, String tags) throws Exception {
   Cluster cluster = EntityBuilderTestUtil.buildCluster(name, colo, tags);
   configStore.publish(EntityType.CLUSTER, cluster);
   return cluster;
 }