Exemplo n.º 1
0
  private org.apache.falcon.entity.v0.feed.Clusters createBlankClusters() {
    org.apache.falcon.entity.v0.feed.Clusters clusters =
        new org.apache.falcon.entity.v0.feed.Clusters();

    Cluster cluster = new Cluster();
    cluster.setName("blankCluster1");
    clusters.getClusters().add(cluster);

    Cluster cluster2 = new Cluster();
    cluster2.setName("blankCluster2");
    clusters.getClusters().add(cluster2);

    return clusters;
  }
  @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
  }