@Test(expectedExceptions = IvoryException.class) public void testValidate() throws IvoryException { parser.parseAndValidate("<process></process>"); }
@Override public void validate(Process process) throws IvoryException { if(process.getTimezone() == null) process.setTimezone(TimeZone.getTimeZone("UTC")); Set<String> clusters = new HashSet<String>(); for (org.apache.ivory.entity.v0.process.Cluster cluster : process.getClusters().getClusters()) { String clusterName = cluster.getName(); if (!clusters.add(cluster.getName())) { throw new ValidationException("Cluster: " + cluster.getName() + " is defined more than once for process: "+process.getName()); } validateEntityExists(EntityType.CLUSTER, clusterName); validateProcessValidity(cluster.getValidity().getStart(), cluster.getValidity().getEnd()); validateHDFSpaths(process, clusterName); if (process.getInputs() != null) { for (Input input : process.getInputs().getInputs()) { validateEntityExists(EntityType.FEED, input.getFeed()); Feed feed = (Feed) ConfigurationStore.get().get(EntityType.FEED, input.getFeed()); CrossEntityValidations.validateFeedDefinedForCluster(feed, clusterName); CrossEntityValidations.validateFeedRetentionPeriod(input.getStart(), feed, clusterName); CrossEntityValidations.validateInstanceRange(process, input, feed); if (input.getPartition() != null) { CrossEntityValidations.validateInputPartition(input, feed); } } } if (process.getOutputs() != null) { for (Output output : process.getOutputs().getOutputs()) { validateEntityExists(EntityType.FEED, output.getFeed()); Feed feed = (Feed) ConfigurationStore.get().get(EntityType.FEED, output.getFeed()); CrossEntityValidations.validateFeedDefinedForCluster(feed, clusterName); CrossEntityValidations.validateInstance(process, output, feed); } } } validateDatasetName(process.getInputs(), process.getOutputs()); validateLateInputs(process); }
ProcessEntityParser extends EntityParser<Process> { @Override public void validate(Process process) throws IvoryException { if(process.getTimezone() == null) process.setTimezone(TimeZone.getTimeZone("UTC")); Set<String> clusters = new HashSet<String>(); for (org.apache.ivory.entity.v0.process.Cluster cluster : process.getClusters().getClusters()) { String clusterName = cluster.getName(); if (!clusters.add(cluster.getName())) { throw new ValidationException("Cluster: " + cluster.getName() + " is defined more than once for process: "+process.getName()); } validateEntityExists(EntityType.CLUSTER, clusterName); validateProcessValidity(cluster.getValidity().getStart(), cluster.getValidity().getEnd()); validateHDFSpaths(process, clusterName); if (process.getInputs() != null) { for (Input input : process.getInputs().getInputs()) { validateEntityExists(EntityType.FEED, input.getFeed()); Feed feed = (Feed) ConfigurationStore.get().get(EntityType.FEED, input.getFeed()); CrossEntityValidations.validateFeedDefinedForCluster(feed, clusterName); CrossEntityValidations.validateFeedRetentionPeriod(input.getStart(), feed, clusterName); CrossEntityValidations.validateInstanceRange(process, input, feed); if (input.getPartition() != null) { CrossEntityValidations.validateInputPartition(input, feed); } } } if (process.getOutputs() != null) { for (Output output : process.getOutputs().getOutputs()) { validateEntityExists(EntityType.FEED, output.getFeed()); Feed feed = (Feed) ConfigurationStore.get().get(EntityType.FEED, output.getFeed()); CrossEntityValidations.validateFeedDefinedForCluster(feed, clusterName); CrossEntityValidations.validateInstance(process, output, feed); } } } validateDatasetName(process.getInputs(), process.getOutputs()); validateLateInputs(process); } }
ProcessEntityParser extends EntityParser<Process> { @Override public void validate(Process process) throws IvoryException { if(process.getTimezone() == null) process.setTimezone(TimeZone.getTimeZone("UTC")); Set<String> clusters = new HashSet<String>(); for (org.apache.ivory.entity.v0.process.Cluster cluster : process.getClusters().getClusters()) { String clusterName = cluster.getName(); if (!clusters.add(cluster.getName())) { throw new ValidationException("Cluster: " + cluster.getName() + " is defined more than once for process: "+process.getName()); } validateEntityExists(EntityType.CLUSTER, clusterName); validateProcessValidity(cluster.getValidity().getStart(), cluster.getValidity().getEnd()); validateHDFSpaths(process, clusterName); if (process.getInputs() != null) { for (Input input : process.getInputs().getInputs()) { validateEntityExists(EntityType.FEED, input.getFeed()); Feed feed = (Feed) ConfigurationStore.get().get(EntityType.FEED, input.getFeed()); CrossEntityValidations.validateFeedDefinedForCluster(feed, clusterName); CrossEntityValidations.validateFeedRetentionPeriod(input.getStart(), feed, clusterName); CrossEntityValidations.validateInstanceRange(process, input, feed); if (input.getPartition() != null) { CrossEntityValidations.validateInputPartition(input, feed); } } } if (process.getOutputs() != null) { for (Output output : process.getOutputs().getOutputs()) { validateEntityExists(EntityType.FEED, output.getFeed()); Feed feed = (Feed) ConfigurationStore.get().get(EntityType.FEED, output.getFeed()); CrossEntityValidations.validateFeedDefinedForCluster(feed, clusterName); CrossEntityValidations.validateInstance(process, output, feed); } } } validateDatasetName(process.getInputs(), process.getOutputs()); validateLateInputs(process); } ProcessEntityParser(); }
ProcessEntityParser extends EntityParser<Process> { @Override public void validate(Process process) throws IvoryException { if(process.getTimezone() == null) process.setTimezone(TimeZone.getTimeZone("UTC")); Set<String> clusters = new HashSet<String>(); for (org.apache.ivory.entity.v0.process.Cluster cluster : process.getClusters().getClusters()) { String clusterName = cluster.getName(); if (!clusters.add(cluster.getName())) { throw new ValidationException("Cluster: " + cluster.getName() + " is defined more than once for process: "+process.getName()); } validateEntityExists(EntityType.CLUSTER, clusterName); validateProcessValidity(cluster.getValidity().getStart(), cluster.getValidity().getEnd()); validateHDFSpaths(process, clusterName); if (process.getInputs() != null) { for (Input input : process.getInputs().getInputs()) { validateEntityExists(EntityType.FEED, input.getFeed()); Feed feed = (Feed) ConfigurationStore.get().get(EntityType.FEED, input.getFeed()); CrossEntityValidations.validateFeedDefinedForCluster(feed, clusterName); CrossEntityValidations.validateFeedRetentionPeriod(input.getStart(), feed, clusterName); CrossEntityValidations.validateInstanceRange(process, input, feed); if (input.getPartition() != null) { CrossEntityValidations.validateInputPartition(input, feed); } } } if (process.getOutputs() != null) { for (Output output : process.getOutputs().getOutputs()) { validateEntityExists(EntityType.FEED, output.getFeed()); Feed feed = (Feed) ConfigurationStore.get().get(EntityType.FEED, output.getFeed()); CrossEntityValidations.validateFeedDefinedForCluster(feed, clusterName); CrossEntityValidations.validateInstance(process, output, feed); } } } validateDatasetName(process.getInputs(), process.getOutputs()); validateLateInputs(process); } ProcessEntityParser(); @Override void validate(Process process); }
ProcessEntityParser extends EntityParser<Process> { @Override public void validate(Process process) throws IvoryException { if(process.getTimezone() == null) process.setTimezone(TimeZone.getTimeZone("UTC")); Set<String> clusters = new HashSet<String>(); for (org.apache.ivory.entity.v0.process.Cluster cluster : process.getClusters().getClusters()) { String clusterName = cluster.getName(); if (!clusters.add(cluster.getName())) { throw new ValidationException("Cluster: " + cluster.getName() + " is defined more than once for process: "+process.getName()); } validateEntityExists(EntityType.CLUSTER, clusterName); validateProcessValidity(cluster.getValidity().getStart(), cluster.getValidity().getEnd()); validateHDFSpaths(process, clusterName); if (process.getInputs() != null) { for (Input input : process.getInputs().getInputs()) { validateEntityExists(EntityType.FEED, input.getFeed()); Feed feed = (Feed) ConfigurationStore.get().get(EntityType.FEED, input.getFeed()); CrossEntityValidations.validateFeedDefinedForCluster(feed, clusterName); CrossEntityValidations.validateFeedRetentionPeriod(input.getStart(), feed, clusterName); CrossEntityValidations.validateInstanceRange(process, input, feed); if (input.getPartition() != null) { CrossEntityValidations.validateInputPartition(input, feed); } } } if (process.getOutputs() != null) { for (Output output : process.getOutputs().getOutputs()) { validateEntityExists(EntityType.FEED, output.getFeed()); Feed feed = (Feed) ConfigurationStore.get().get(EntityType.FEED, output.getFeed()); CrossEntityValidations.validateFeedDefinedForCluster(feed, clusterName); CrossEntityValidations.validateInstance(process, output, feed); } } } validateDatasetName(process.getInputs(), process.getOutputs()); validateLateInputs(process); } ProcessEntityParser(); @Override void validate(Process process);  }