Package org.apache.ivory.entity.v0.feed

Examples of org.apache.ivory.entity.v0.feed.Feed


    parser.parseAndValidate(feed2.toString());
  }

  @Test
  public void testValidGroupNames() throws IvoryException, JAXBException {
    Feed feed1 = (Feed) EntityType.FEED.getUnmarshaller().unmarshal(
        FeedGroupMapTest.class
            .getResourceAsStream("/config/feed/feed-0.1.xml"));
    feed1.setName("f1" + System.currentTimeMillis());
    feed1.setGroups("group7,group8");
    parser.parseAndValidate(feed1.toString());

    feed1.setGroups("group7");
    parser.parseAndValidate(feed1.toString());

    feed1.setGroups(null);
    parser.parseAndValidate(feed1.toString());
    ConfigurationStore.get().publish(EntityType.FEED, feed1);
  }
View Full Code Here


    ConfigurationStore.get().publish(EntityType.FEED, feed1);
  }

  @Test
  public void testInvalidGroupNames() throws IvoryException, JAXBException {
    Feed feed1 = (Feed) EntityType.FEED.getUnmarshaller().unmarshal(
        FeedGroupMapTest.class
            .getResourceAsStream("/config/feed/feed-0.1.xml"));
    feed1.setName("f1" + System.currentTimeMillis());

    try {
      feed1.setGroups("commaend,");
      parser.parseAndValidate(feed1.toString());
      Assert.fail("Expected exception");
    } catch (IvoryException e) {

    }
    try {
      feed1.setGroups("group8,   group9");
      parser.parseAndValidate(feed1.toString());
      Assert.fail("Expected exception");
    } catch (IvoryException e) {

    }
    try {
      feed1.setGroups("space in group,group9");
      parser.parseAndValidate(feed1.toString());
      Assert.fail("Expected exception");
    } catch (IvoryException e) {

    }
  }
View Full Code Here

        "/*/${cluster.field1}/Local"), "/*/value1/Local");
  }
 
  @Test(expectedExceptions=IvoryException.class)
  public void testInvalidFeedName() throws JAXBException, IvoryException  {
    Feed feed1 = (Feed) EntityType.FEED.getUnmarshaller().unmarshal(
        FeedGroupMapTest.class
            .getResourceAsStream("/config/feed/feed-0.1.xml"));
    feed1.setName("Feed_name");
    parser.parseAndValidate(feed1.toString());
  }
View Full Code Here

    parser.parseAndValidate(feed1.toString());
  }
 
  @Test(expectedExceptions=IvoryException.class)
  public void testInvalidFeedGroupName() throws JAXBException, IvoryException  {
    Feed feed1 = (Feed) EntityType.FEED.getUnmarshaller().unmarshal(
        FeedGroupMapTest.class
            .getResourceAsStream("/config/feed/feed-0.1.xml"));
    feed1.setName("feed1");
    feed1.getLocations().getLocations().get(0)
        .setPath("/data/clicks/${YEAR}/${MONTH}/${DAY}/${HOUR}");
    feed1.getClusters().getClusters().get(0).getLocations().getLocations()
        .get(0).setPath("/data/clicks/${YEAR}/${MONTH}/${DAY}/${HOUR}");
    ConfigurationStore.get().publish(EntityType.FEED, feed1);
   
    Feed feed2 = (Feed) EntityType.FEED.getUnmarshaller().unmarshal(
        FeedGroupMapTest.class
            .getResourceAsStream("/config/feed/feed-0.1.xml"));
    feed2.setName("feed2");
    feed2.getLocations().getLocations().get(0).setPath("/data/clicks/${YEAR}/${MONTH}/${DAY}/${HOUR}");
    feed2.getClusters().getClusters().get(0).getLocations().getLocations()
    .get(0).setPath("/data/clicks/${YEAR}/${MONTH}/${DAY}/${HOUR}");
    feed2.setFrequency(new Frequency("hours(1)"));
    try{
      parser.parseAndValidate(feed2.toString());
    }catch(IvoryException e){
      e.printStackTrace();
      Assert.fail("Not expecting exception for same frequency");
    }
    feed2.setFrequency(new Frequency("hours(2)"));
    //expecting exception
    parser.parseAndValidate(feed2.toString());
  }
View Full Code Here

      switch(entity.getEntityType()) {
      case CLUSTER:
          return entity;
         
      case FEED:
          Feed feed = (Feed) entity.clone();
          Cluster feedCluster = FeedHelper.getCluster(feed, clusterName);
          Iterator<Cluster> itr = feed.getClusters().getClusters().iterator();
          while(itr.hasNext()) {
              Cluster cluster = itr.next();
              //In addition to retaining the required clster, retain the sources clusters if this is the target cluster
              //1. Retain cluster if cluster n
              if(!(cluster.getName().equals(clusterName) ||
View Full Code Here

  }
 
  @Test
  public void testOnAdd() throws IvoryException, JAXBException {
    store.publish(EntityType.CLUSTER, cluster);
    Feed feed1 = (Feed) EntityType.FEED.getUnmarshaller().unmarshal(
        FeedGroupMapTest.class
            .getResourceAsStream("/config/feed/feed-0.1.xml"));
    feed1.setName("f1");
    feed1.setGroups("group1,group2,group3");
    Location location = new Location();
    location.setPath("/projects/bi/rmc/daily/ad/${YEAR}/fraud/${MONTH}-${DAY}/ad");
    location.setType(LocationType.DATA);
    feed1.setLocations(new Locations());
    feed1.getLocations().getLocations().add(location);
    store.publish(EntityType.FEED, feed1);
    Map<String, FeedGroup> groupMapping = FeedGroupMap.get()
        .getGroupsMapping();

    FeedGroup group = groupMapping.get("group1");
    Assert.assertEquals(group.getName(), "group1");
    Assert.assertEquals(group.getFeeds().size(), 1);
    assertFields(group, feed1);

    group = groupMapping.get("group2");
    Assert.assertEquals(group.getName(), "group2");
    Assert.assertEquals(group.getFeeds().size(), 1);
    assertFields(group, feed1);

    group = groupMapping.get("group3");
    Assert.assertEquals(group.getName(), "group3");
    Assert.assertEquals(group.getFeeds().size(), 1);
    assertFields(group, feed1);

    Feed feed2 = (Feed) EntityType.FEED.getUnmarshaller().unmarshal(
        FeedGroupMapTest.class
            .getResourceAsStream("/config/feed/feed-0.1.xml"));

    feed2.setName("f2");
    feed2.setGroups("group1,group5,group3");
    location.setPath("/projects/bi/rmc/daily/ad/${YEAR}/${MONTH}/${DAY}/ad2");
        location.setType(LocationType.DATA);
        feed2.setLocations(new Locations());
        feed2.getLocations().getLocations().add(location);
    store.publish(EntityType.FEED, feed2);
    groupMapping = FeedGroupMap.get().getGroupsMapping();

    group = groupMapping.get("group1");
    Assert.assertEquals(group.getName(), "group1");
View Full Code Here

    case CLUSTER:
        clusters.add(entity.getName());
        break;
       
    case FEED:
      Feed feed = (Feed) entity;
      for(Cluster cluster:feed.getClusters().getClusters())
        clusters.add(cluster.getName());
      break;
     
    case PROCESS:
      Process process = (Process) entity;
View Full Code Here

    parser.parseAndValidate(feed2.toString());
  }
 
  @Test
  public void testNullFeedLateArrival() throws JAXBException, IvoryException  {
    Feed feed = (Feed) EntityType.FEED.getUnmarshaller().unmarshal(
        FeedGroupMapTest.class
            .getResourceAsStream("/config/feed/feed-0.1.xml"));
   
    feed.setLateArrival(null);
    parser.parseAndValidate(feed.toString());
   
  }
View Full Code Here

  }

  @Test
  public void testOnRemove() throws IvoryException, JAXBException {
    Feed feed1 = (Feed) EntityType.FEED.getUnmarshaller().unmarshal(
        FeedGroupMapTest.class
            .getResourceAsStream("/config/feed/feed-0.1.xml"));
    feed1.setName("f1");
    store.publish(EntityType.CLUSTER, cluster);
    feed1.setGroups("group7,group8,group9");
    Location location = new Location();
    location.setPath("/projects/bi/rmc/daily/ad/${YEAR}/fraud/${MONTH}-${DAY}/ad");
        location.setType(LocationType.DATA);
        feed1.setLocations(new Locations());
        feed1.getLocations().getLocations().add(location);
    store.publish(EntityType.FEED, feed1);

    Feed feed2 = (Feed) EntityType.FEED.getUnmarshaller().unmarshal(
        FeedGroupMapTest.class
            .getResourceAsStream("/config/feed/feed-0.1.xml"));
    feed2.setName("f2");
    feed2.setGroups("group7,group8,group10");
    location.setPath("/projects/bi/rmc/daily/ad/${YEAR}/${MONTH}/${DAY}/ad2");
        location.setType(LocationType.DATA);
        feed2.setLocations(new Locations());
        feed2.getLocations().getLocations().add(location);
    store.publish(EntityType.FEED, feed2);

    Map<String, FeedGroup> groupMapping = FeedGroupMap.get()
        .getGroupsMapping();
View Full Code Here

  }

  @Test
  public void testNullGroup() throws IvoryException, JAXBException {
    Feed feed1 = (Feed) EntityType.FEED.getUnmarshaller().unmarshal(
        FeedGroupMapTest.class
            .getResourceAsStream("/config/feed/feed-0.1.xml"));
    feed1.setName("f5" + System.currentTimeMillis());
    store.publish(EntityType.CLUSTER, cluster);
    feed1.setGroups(null);
    Location location = new Location();
    location.setPath("/projects/bi/rmc/daily/ad/${YEAR}/fraud/${MONTH}-${DAY}/ad");
        location.setType(LocationType.DATA);
        feed1.setLocations(new Locations());
        feed1.getLocations().getLocations().add(location);
    store.publish(EntityType.FEED, feed1);

  }
View Full Code Here

TOP

Related Classes of org.apache.ivory.entity.v0.feed.Feed

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.