test_class.declarator: parser = (FeedEntityParser) EntityParserFactory
  			.getParser(EntityType.FEED)
test_class.modifier: private final
test_class.original_string: private final FeedEntityParser parser = (FeedEntityParser) EntityParserFactory
  			.getParser(EntityType.FEED);
test_class.type: FeedEntityParser
test_class.var_name: parser
test_class.declarator: modifiableFeed
test_class.modifier: private
test_class.original_string: private Feed modifiableFeed;
test_class.type: Feed
test_class.var_name: modifiableFeed
test_class.file: common/src/test/java/org/apache/ivory/entity/parser/FeedEntityParserTest.java
test_class.identifier: FeedEntityParserTest
test_class.superclass: extends AbstractTestBase
test_case.body: @Test
  	public void testPartitionExpression() throws IvoryException {
          Feed feed = (Feed) parser.parseAndValidate(ProcessEntityParserTest.class
                  .getResourceAsStream(FEED_XML));
          
          //When there are more than 1 src clusters, there should be partition expression
          org.apache.ivory.entity.v0.feed.Cluster newCluster = new org.apache.ivory.entity.v0.feed.Cluster();
          newCluster.setName("newCluster");
          newCluster.setType(ClusterType.SOURCE);
          newCluster.setPartition("${cluster.colo}");
          feed.getClusters().getClusters().add(newCluster);
          try {
              parser.validate(feed);
              Assert.fail("Expected ValidationException");
          } catch(ValidationException e) { }
          
          //When there are more than 1 src clusters, the partition expression should contain cluster variable
          feed.getClusters().getClusters().get(0).setPartition("*");
          try {
              parser.validate(feed);
              Assert.fail("Expected ValidationException");
          } catch(ValidationException e) { }
          
          //When there are more than 1 target cluster, there should be partition expre
          newCluster.setType(ClusterType.TARGET);
          try {
              parser.validate(feed);
              Assert.fail("Expected ValidationException");
          } catch(ValidationException e) { }
          
          //When there are more than 1 target clusters, the partition expression should contain cluster variable
          feed.getClusters().getClusters().get(1).setPartition("*");
          try {
              parser.validate(feed);
              Assert.fail("Expected ValidationException");
          } catch(ValidationException e) { }
          
          //Number of parts in partition expression < number of partitions defined for feed
          feed.getClusters().getClusters().get(1).setPartition("*/*");
          try {
              parser.validate(feed);
              Assert.fail("Expected ValidationException");
          } catch(ValidationException e) { }
  
          feed.getClusters().getClusters().get(0).setPartition(null);
          feed.getClusters().getClusters().get(1).setPartition(null);
          feed.getClusters().getClusters().remove(2);
          feed.setPartitions(null);
          parser.validate(feed);
  	}
test_case.class_method_signature: FeedEntityParserTest.testPartitionExpression()
test_case.full_signature: @Test public void testPartitionExpression()
test_case.identifier: testPartitionExpression
test_case.invocations: parseAndValidate getResourceAsStream setName setType setPartition add getClusters getClusters validate fail setPartition get getClusters getClusters validate fail setType validate fail setPartition get getClusters getClusters validate fail setPartition get getClusters getClusters validate fail setPartition get getClusters getClusters setPartition get getClusters getClusters remove getClusters getClusters setPartitions validate
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testPartitionExpression()
focal_class.declarator: LOG = Logger.getLogger(FeedEntityParser.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger LOG = Logger.getLogger(FeedEntityParser.class);
focal_class.type: Logger
focal_class.var_name: LOG
focal_class.file: common/src/main/java/org/apache/ivory/entity/parser/FeedEntityParser.java
focal_class.identifier: FeedEntityParser
focal_class.class_method_signature: FeedEntityParser.FeedEntityParser()
focal_class.full_signature: public  FeedEntityParser()
focal_class.identifier: FeedEntityParser
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.signature:  FeedEntityParser()
focal_class.class_method_signature: FeedEntityParser.validate(Feed feed)
focal_class.full_signature: @Override public void validate(Feed feed)
focal_class.identifier: validate
focal_class.modifiers: @Override public
focal_class.parameters: (Feed feed)
focal_class.return: void
focal_class.signature: void validate(Feed feed)
focal_class.class_method_signature: FeedEntityParser.findProcesses(Set<Entity> referenced)
focal_class.full_signature: private Set<Process> findProcesses(Set<Entity> referenced)
focal_class.identifier: findProcesses
focal_class.modifiers: private
focal_class.parameters: (Set<Entity> referenced)
focal_class.return: Set<Process>
focal_class.signature: Set<Process> findProcesses(Set<Entity> referenced)
focal_class.class_method_signature: FeedEntityParser.validateFeedGroups(Feed feed)
focal_class.full_signature: private void validateFeedGroups(Feed feed)
focal_class.identifier: validateFeedGroups
focal_class.modifiers: private
focal_class.parameters: (Feed feed)
focal_class.return: void
focal_class.signature: void validateFeedGroups(Feed feed)
focal_class.class_method_signature: FeedEntityParser.ensureValidityFor(Feed newFeed, Set<Process> processes)
focal_class.full_signature: private void ensureValidityFor(Feed newFeed, Set<Process> processes)
focal_class.identifier: ensureValidityFor
focal_class.modifiers: private
focal_class.parameters: (Feed newFeed, Set<Process> processes)
focal_class.return: void
focal_class.signature: void ensureValidityFor(Feed newFeed, Set<Process> processes)
focal_class.class_method_signature: FeedEntityParser.ensureValidityFor(Feed newFeed, Process process)
focal_class.full_signature: private void ensureValidityFor(Feed newFeed, Process process)
focal_class.identifier: ensureValidityFor
focal_class.modifiers: private
focal_class.parameters: (Feed newFeed, Process process)
focal_class.return: void
focal_class.signature: void ensureValidityFor(Feed newFeed, Process process)
focal_class.class_method_signature: FeedEntityParser.validateClusterValidity(Date start, Date end, String clusterName)
focal_class.full_signature: private void validateClusterValidity(Date start, Date end, String clusterName)
focal_class.identifier: validateClusterValidity
focal_class.modifiers: private
focal_class.parameters: (Date start, Date end, String clusterName)
focal_class.return: void
focal_class.signature: void validateClusterValidity(Date start, Date end, String clusterName)
focal_class.class_method_signature: FeedEntityParser.validateFeedCutOffPeriod(Feed feed, Cluster cluster)
focal_class.full_signature: private void validateFeedCutOffPeriod(Feed feed, Cluster cluster)
focal_class.identifier: validateFeedCutOffPeriod
focal_class.modifiers: private
focal_class.parameters: (Feed feed, Cluster cluster)
focal_class.return: void
focal_class.signature: void validateFeedCutOffPeriod(Feed feed, Cluster cluster)
focal_class.class_method_signature: FeedEntityParser.validateFeedPartitionExpression(Feed feed)
focal_class.full_signature: private void validateFeedPartitionExpression(Feed feed)
focal_class.identifier: validateFeedPartitionExpression
focal_class.modifiers: private
focal_class.parameters: (Feed feed)
focal_class.return: void
focal_class.signature: void validateFeedPartitionExpression(Feed feed)
focal_class.class_method_signature: FeedEntityParser.validateClusterExpDefined(Cluster cl)
focal_class.full_signature: private void validateClusterExpDefined(Cluster cl)
focal_class.identifier: validateClusterExpDefined
focal_class.modifiers: private
focal_class.parameters: (Cluster cl)
focal_class.return: void
focal_class.signature: void validateClusterExpDefined(Cluster cl)
focal_class.superclass: extends EntityParser<Feed>
focal_method.body: @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);
  
          // Seems like a good enough entity object for a new one
          // But is this an update ?
  
          Feed oldFeed = ConfigurationStore.get().get(EntityType.FEED, feed.getName());
          if (oldFeed == null)
              return; // Not an update case
  
          // Is actually an update. Need to iterate over all the processes
          // depending on this feed and see if they are valid with the new
          // feed reference
          EntityGraph graph = EntityGraph.get();
          Set<Entity> referenced = graph.getDependents(oldFeed);
          Set<Process> processes = findProcesses(referenced);
          if (processes.isEmpty())
              return;
  
          ensureValidityFor(feed, processes);
      }
focal_method.class_method_signature: FeedEntityParser.validate(Feed feed)
focal_method.full_signature: @Override public void validate(Feed feed)
focal_method.identifier: validate
focal_method.invocations: getTimezone setTimezone getTimeZone getClusters getClusters getClusters validateEntityExists getName validateClusterValidity getStart getValidity getEnd getValidity getName validateFeedCutOffPeriod validateFeedPartitionExpression validateFeedGroups get get getName get getDependents findProcesses isEmpty ensureValidityFor
focal_method.modifiers: @Override public
focal_method.parameters: (Feed feed)
focal_method.return: void
focal_method.signature: void validate(Feed feed)