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

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


        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);
        getStore().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);
        getStore().publish(EntityType.FEED, feed2);
        groupMapping = FeedGroupMap.get().getGroupsMapping();

        group = groupMapping.get("group1");
View Full Code Here


        getStore().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);
        getStore().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);
        getStore().publish(EntityType.FEED, feed2);

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

        getStore().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);
        getStore().publish(EntityType.FEED, feed1);

    }
View Full Code Here

        return null;
    }

    public static Storage createStorage(Feed feed) throws FalconException {

        final Locations feedLocations = feed.getLocations();
        if (feedLocations != null
                && feedLocations.getLocations().size() != 0) {
            return new FileSystemStorage(feed);
        }

        try {
            final CatalogTable table = feed.getTable();
View Full Code Here

        throw new IllegalArgumentException("Bad type: " + type);
    }

    public static Storage.TYPE getStorageType(Feed feed) throws FalconException {
        final Locations feedLocations = feed.getLocations();
        if (feedLocations != null
                && feedLocations.getLocations().size() != 0) {
            return Storage.TYPE.FILESYSTEM;
        }

        final CatalogTable table = feed.getTable();
        if (table != null) {
View Full Code Here

        return getStorageType(feed, feedCluster);
    }

    protected static List<Location> getLocations(Cluster cluster, Feed feed) {
        // check if locations are overridden in cluster
        final Locations clusterLocations = cluster.getLocations();
        if (clusterLocations != null
                && clusterLocations.getLocations().size() != 0) {
            return clusterLocations.getLocations();
        }

        final Locations feedLocations = feed.getLocations();
        return feedLocations == null ? null : feedLocations.getLocations();
    }
View Full Code Here

        return getStorageType(feed, feedCluster);
    }

    protected static List<Location> getLocations(Cluster cluster, Feed feed) {
        // check if locations are overridden in cluster
        final Locations clusterLocations = cluster.getLocations();
        if (clusterLocations != null
                && clusterLocations.getLocations().size() != 0) {
            return clusterLocations.getLocations();
        }

        final Locations feedLocations = feed.getLocations();
        return feedLocations == null ? null : feedLocations.getLocations();
    }
View Full Code Here

        return feed;
    }

    public static void addStorage(Feed feed, Storage.TYPE storageType, String uriTemplate) {
        if (storageType == Storage.TYPE.FILESYSTEM) {
            Locations locations = new Locations();
            feed.setLocations(locations);

            Location location = new Location();
            location.setType(LocationType.DATA);
            location.setPath(uriTemplate);
View Full Code Here

        Feed feed = (Feed) EntityType.FEED.getUnmarshaller().unmarshal(new File(tmpFileName));
        Location location = new Location();
        location.setPath("fsext://global:00/falcon/test/input/${YEAR}/${MONTH}/${DAY}/${HOUR}");
        location.setType(LocationType.DATA);
        Cluster cluster = feed.getClusters().getClusters().get(0);
        cluster.setLocations(new Locations());
        feed.getClusters().getClusters().get(0).getLocations().getLocations().add(location);

        File tmpFile = TestContext.getTempFile();
        EntityType.FEED.getMarshaller().marshal(feed, tmpFile);
        response = context.submitAndSchedule(tmpFileName, overlay, EntityType.FEED);
View Full Code Here

        return null;
    }

    public static Storage createStorage(Feed feed) throws FalconException {

        final Locations feedLocations = feed.getLocations();
        if (feedLocations != null
                && feedLocations.getLocations().size() != 0) {
            return new FileSystemStorage(feed);
        }

        try {
            final CatalogTable table = feed.getTable();
View Full Code Here

TOP

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

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.