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