@Test public void testShouldUpdate2() throws Exception { Feed oldFeed = parser.parseAndValidate(this.getClass() .getResourceAsStream(FEED_XML)); String cluster = "testCluster"; Feed newFeed = (Feed)oldFeed.clone(); Assert.assertFalse(UpdateHelper.shouldUpdate(oldFeed, newFeed, cluster)); newFeed.setGroups("newgroups"); Assert.assertFalse(UpdateHelper.shouldUpdate(oldFeed, newFeed, cluster)); newFeed.getLateArrival().setCutOff(Frequency.fromString("hours(8)")); Assert.assertFalse(UpdateHelper.shouldUpdate(oldFeed, newFeed, cluster)); newFeed.setFrequency(Frequency.fromString("days(1)")); Assert.assertTrue(UpdateHelper.shouldUpdate(oldFeed, newFeed, cluster)); Process oldProcess = processParser.parseAndValidate(this.getClass(). getResourceAsStream(PROCESS_XML)); Process newProcess = (Process) oldProcess.clone(); newProcess.getRetry().setPolicy(PolicyType.FINAL); Assert.assertFalse(UpdateHelper.shouldUpdate(oldProcess, newProcess, cluster)); newProcess.getLateProcess().getLateInputs().remove(1); Assert.assertFalse(UpdateHelper.shouldUpdate(oldProcess, newProcess, cluster)); newProcess.getLateProcess().setPolicy(PolicyType.PERIODIC); Assert.assertFalse(UpdateHelper.shouldUpdate(oldProcess, newProcess, cluster)); newProcess.setFrequency(Frequency.fromString("days(1)")); Assert.assertTrue(UpdateHelper.shouldUpdate(oldProcess, newProcess, cluster)); }
public static boolean shouldUpdate(Entity oldEntity, Entity newEntity, String cluster) throws IvoryException { Entity oldView = EntityUtil.getClusterView(oldEntity, cluster); Entity newView = EntityUtil.getClusterView(newEntity, cluster); switch(oldEntity.getEntityType()) { case FEED: if(EntityUtil.equals(oldView, newView, FEED_FIELDS)) return false; return true; case PROCESS: if(EntityUtil.equals(oldView, newView, PROCESS_FIELDS)) return false; return true; } throw new IllegalArgumentException("Unhandled entity type " + oldEntity.getEntityType()); }
UpdateHelper { public static boolean shouldUpdate(Entity oldEntity, Entity newEntity, String cluster) throws IvoryException { Entity oldView = EntityUtil.getClusterView(oldEntity, cluster); Entity newView = EntityUtil.getClusterView(newEntity, cluster); switch(oldEntity.getEntityType()) { case FEED: if(EntityUtil.equals(oldView, newView, FEED_FIELDS)) return false; return true; case PROCESS: if(EntityUtil.equals(oldView, newView, PROCESS_FIELDS)) return false; return true; } throw new IllegalArgumentException("Unhandled entity type " + oldEntity.getEntityType()); } }
UpdateHelper { public static boolean shouldUpdate(Entity oldEntity, Entity newEntity, String cluster) throws IvoryException { Entity oldView = EntityUtil.getClusterView(oldEntity, cluster); Entity newView = EntityUtil.getClusterView(newEntity, cluster); switch(oldEntity.getEntityType()) { case FEED: if(EntityUtil.equals(oldView, newView, FEED_FIELDS)) return false; return true; case PROCESS: if(EntityUtil.equals(oldView, newView, PROCESS_FIELDS)) return false; return true; } throw new IllegalArgumentException("Unhandled entity type " + oldEntity.getEntityType()); }  }
UpdateHelper { public static boolean shouldUpdate(Entity oldEntity, Entity newEntity, String cluster) throws IvoryException { Entity oldView = EntityUtil.getClusterView(oldEntity, cluster); Entity newView = EntityUtil.getClusterView(newEntity, cluster); switch(oldEntity.getEntityType()) { case FEED: if(EntityUtil.equals(oldView, newView, FEED_FIELDS)) return false; return true; case PROCESS: if(EntityUtil.equals(oldView, newView, PROCESS_FIELDS)) return false; return true; } throw new IllegalArgumentException("Unhandled entity type " + oldEntity.getEntityType()); }  static boolean shouldUpdate(Entity oldEntity, Entity newEntity, String cluster); static boolean shouldUpdate(Entity oldEntity, Entity newEntity, Entity affectedEntity); static boolean shouldUpdate(Feed oldFeed, Feed newFeed, Process affectedProcess); }
UpdateHelper { public static boolean shouldUpdate(Entity oldEntity, Entity newEntity, String cluster) throws IvoryException { Entity oldView = EntityUtil.getClusterView(oldEntity, cluster); Entity newView = EntityUtil.getClusterView(newEntity, cluster); switch(oldEntity.getEntityType()) { case FEED: if(EntityUtil.equals(oldView, newView, FEED_FIELDS)) return false; return true; case PROCESS: if(EntityUtil.equals(oldView, newView, PROCESS_FIELDS)) return false; return true; } throw new IllegalArgumentException("Unhandled entity type " + oldEntity.getEntityType()); }  static boolean shouldUpdate(Entity oldEntity, Entity newEntity, String cluster); static boolean shouldUpdate(Entity oldEntity, Entity newEntity, Entity affectedEntity); static boolean shouldUpdate(Feed oldFeed, Feed newFeed, Process affectedProcess);  }