Assert.assertTrue(UpdateHelper.isEntityUpdated(oldProcess, newProcess, cluster));
}
@Test
public void testShouldUpdateFeed() throws Exception {
Feed oldFeed = parser.parseAndValidate(this.getClass().getResourceAsStream(FEED_XML));
Feed newFeed = (Feed) oldFeed.copy();
Process process = processParser.parseAndValidate(this.getClass().getResourceAsStream(PROCESS_XML));
prepare(process);
String cluster = process.getClusters().getClusters().get(0).getName();
Assert.assertFalse(UpdateHelper.shouldUpdate(oldFeed, newFeed, process, cluster));
newFeed.getLateArrival().setCutOff(Frequency.fromString("hours(1)"));
Assert.assertFalse(UpdateHelper.shouldUpdate(oldFeed, newFeed, process, cluster));
newFeed.getLateArrival().setCutOff(oldFeed.getLateArrival().getCutOff());
getLocation(newFeed, LocationType.DATA, cluster).setPath("/test");
Assert.assertTrue(UpdateHelper.shouldUpdate(oldFeed, newFeed, process, cluster));
getLocation(newFeed, LocationType.DATA, cluster).setPath(
getLocation(oldFeed, LocationType.DATA, cluster).getPath());
newFeed.setFrequency(Frequency.fromString("months(1)"));
Assert.assertTrue(UpdateHelper.shouldUpdate(oldFeed, newFeed, process, cluster));
newFeed.setFrequency(oldFeed.getFrequency());
Partition partition = new Partition();
partition.setName("1");
newFeed.getPartitions().getPartitions().add(partition);
Assert.assertFalse(UpdateHelper.shouldUpdate(oldFeed, newFeed, process, cluster));
Property property = new Property();
property.setName("1");
property.setValue("1");
newFeed.setProperties(new Properties());
newFeed.getProperties().getProperties().add(property);
Assert.assertFalse(UpdateHelper.shouldUpdate(oldFeed, newFeed, process, cluster));
newFeed.getProperties().getProperties().remove(0);
Assert.assertFalse(UpdateHelper.shouldUpdate(oldFeed, newFeed, process, cluster));
FeedHelper.getCluster(newFeed, process.getClusters().getClusters().get(0).getName()).getValidity().setStart(
SchemaHelper.parseDateUTC("2012-11-01T00:00Z"));
Assert.assertFalse(UpdateHelper.shouldUpdate(oldFeed, newFeed, process, cluster));
FeedHelper.getCluster(newFeed, process.getClusters().getClusters().get(0).getName()).getValidity().
setStart(FeedHelper.getCluster(oldFeed,
process.getClusters().getClusters().get(0).getName()).getValidity().getStart());
//Change location to table should trigger process update
newFeed.setLocations(null);
CatalogTable table = new CatalogTable();
table.setUri("catalog:default:clicks-blah#ds=${YEAR}-${MONTH}-${DAY}-${HOUR}");
newFeed.setTable(table);
Assert.assertFalse(UpdateHelper.shouldUpdate(oldFeed, newFeed, process, cluster));
}