@Test(expectedExceptions = ValidationException.class) public void applyValidationInvalidFeed() throws Exception { Feed feed = (Feed) parser .parseAndValidate(ProcessEntityParserTest.class .getResourceAsStream(FEED_XML)); feed.getClusters().getClusters().get(0).setName("invalid cluster"); parser.validate(feed); }
@Override public void validate(Feed feed) throws IvoryException { if(feed.getTimezone() == null) feed.setTimezone(TimeZone.getTimeZone("UTC")); if (feed.getClusters() == null) throw new ValidationException("Feed should have atleast one cluster"); for (Cluster cluster : feed.getClusters().getClusters()) { validateEntityExists(EntityType.CLUSTER, cluster.getName()); validateClusterValidity(cluster.getValidity().getStart(), cluster.getValidity().getEnd(), cluster.getName()); validateFeedCutOffPeriod(feed, cluster); } validateFeedPartitionExpression(feed); validateFeedGroups(feed); Feed oldFeed = ConfigurationStore.get().get(EntityType.FEED, feed.getName()); if (oldFeed == null) return; EntityGraph graph = EntityGraph.get(); Set<Entity> referenced = graph.getDependents(oldFeed); Set<Process> processes = findProcesses(referenced); if (processes.isEmpty()) return; ensureValidityFor(feed, processes); }
FeedEntityParser extends EntityParser<Feed> { @Override public void validate(Feed feed) throws IvoryException { if(feed.getTimezone() == null) feed.setTimezone(TimeZone.getTimeZone("UTC")); if (feed.getClusters() == null) throw new ValidationException("Feed should have atleast one cluster"); for (Cluster cluster : feed.getClusters().getClusters()) { validateEntityExists(EntityType.CLUSTER, cluster.getName()); validateClusterValidity(cluster.getValidity().getStart(), cluster.getValidity().getEnd(), cluster.getName()); validateFeedCutOffPeriod(feed, cluster); } validateFeedPartitionExpression(feed); validateFeedGroups(feed); Feed oldFeed = ConfigurationStore.get().get(EntityType.FEED, feed.getName()); if (oldFeed == null) return; EntityGraph graph = EntityGraph.get(); Set<Entity> referenced = graph.getDependents(oldFeed); Set<Process> processes = findProcesses(referenced); if (processes.isEmpty()) return; ensureValidityFor(feed, processes); } }
FeedEntityParser extends EntityParser<Feed> { @Override public void validate(Feed feed) throws IvoryException { if(feed.getTimezone() == null) feed.setTimezone(TimeZone.getTimeZone("UTC")); if (feed.getClusters() == null) throw new ValidationException("Feed should have atleast one cluster"); for (Cluster cluster : feed.getClusters().getClusters()) { validateEntityExists(EntityType.CLUSTER, cluster.getName()); validateClusterValidity(cluster.getValidity().getStart(), cluster.getValidity().getEnd(), cluster.getName()); validateFeedCutOffPeriod(feed, cluster); } validateFeedPartitionExpression(feed); validateFeedGroups(feed); Feed oldFeed = ConfigurationStore.get().get(EntityType.FEED, feed.getName()); if (oldFeed == null) return; EntityGraph graph = EntityGraph.get(); Set<Entity> referenced = graph.getDependents(oldFeed); Set<Process> processes = findProcesses(referenced); if (processes.isEmpty()) return; ensureValidityFor(feed, processes); } FeedEntityParser(); }
FeedEntityParser extends EntityParser<Feed> { @Override public void validate(Feed feed) throws IvoryException { if(feed.getTimezone() == null) feed.setTimezone(TimeZone.getTimeZone("UTC")); if (feed.getClusters() == null) throw new ValidationException("Feed should have atleast one cluster"); for (Cluster cluster : feed.getClusters().getClusters()) { validateEntityExists(EntityType.CLUSTER, cluster.getName()); validateClusterValidity(cluster.getValidity().getStart(), cluster.getValidity().getEnd(), cluster.getName()); validateFeedCutOffPeriod(feed, cluster); } validateFeedPartitionExpression(feed); validateFeedGroups(feed); Feed oldFeed = ConfigurationStore.get().get(EntityType.FEED, feed.getName()); if (oldFeed == null) return; EntityGraph graph = EntityGraph.get(); Set<Entity> referenced = graph.getDependents(oldFeed); Set<Process> processes = findProcesses(referenced); if (processes.isEmpty()) return; ensureValidityFor(feed, processes); } FeedEntityParser(); @Override void validate(Feed feed); }
FeedEntityParser extends EntityParser<Feed> { @Override public void validate(Feed feed) throws IvoryException { if(feed.getTimezone() == null) feed.setTimezone(TimeZone.getTimeZone("UTC")); if (feed.getClusters() == null) throw new ValidationException("Feed should have atleast one cluster"); for (Cluster cluster : feed.getClusters().getClusters()) { validateEntityExists(EntityType.CLUSTER, cluster.getName()); validateClusterValidity(cluster.getValidity().getStart(), cluster.getValidity().getEnd(), cluster.getName()); validateFeedCutOffPeriod(feed, cluster); } validateFeedPartitionExpression(feed); validateFeedGroups(feed); Feed oldFeed = ConfigurationStore.get().get(EntityType.FEED, feed.getName()); if (oldFeed == null) return; EntityGraph graph = EntityGraph.get(); Set<Entity> referenced = graph.getDependents(oldFeed); Set<Process> processes = findProcesses(referenced); if (processes.isEmpty()) return; ensureValidityFor(feed, processes); } FeedEntityParser(); @Override void validate(Feed feed);  }