Package org.apache.falcon.entity.v0.feed

Examples of org.apache.falcon.entity.v0.feed.Location


    }

    @Test
    public void testGetUriTemplateForDataWithAbsoluteURL() throws Exception {
        final String absoluteUrl = "s3://host:1000/foo/bar";
        final Location location = new Location();
        location.setPath(absoluteUrl); // absolute url
        location.setType(LocationType.DATA);
        List<Location> locations = new ArrayList<Location>();
        locations.add(location);

        FileSystemStorage storage = new FileSystemStorage("hdfs://localhost:41020", locations);
        Assert.assertEquals(storage.getUriTemplate(LocationType.DATA), absoluteUrl);
View Full Code Here


    }

    @Test (dataProvider = "locationTestWithRelativePathDataProvider")
    public void testGetUriTemplateWithRelativePath(String storageUrl, String path,
                                                   String expected) throws Exception {
        final Location location = new Location();
        location.setPath(path);
        location.setType(LocationType.DATA);
        List<Location> locations = new ArrayList<Location>();
        locations.add(location);

        FileSystemStorage storage = new FileSystemStorage(storageUrl, locations);
        Assert.assertEquals(storage.getUriTemplate(LocationType.DATA), expected);
View Full Code Here

        Assert.assertEquals(storage.getUriTemplate(LocationType.DATA), expected);
    }

    @Test
    public void testGetUriTemplate() throws Exception {
        final Location dataLocation = new Location();
        dataLocation.setPath("/data/foo/bar");
        dataLocation.setType(LocationType.DATA);

        final Location metaLocation = new Location();
        metaLocation.setPath("/meta/foo/bar");
        metaLocation.setType(LocationType.META);

        final Location statsLocation = new Location();
        statsLocation.setPath("/stats/foo/bar");
        statsLocation.setType(LocationType.STATS);

        final Location tmpLocation = new Location();
        tmpLocation.setPath("/tmp/foo/bar");
        tmpLocation.setType(LocationType.TMP);

        List<Location> locations = new ArrayList<Location>();
        locations.add(dataLocation);
        locations.add(metaLocation);
        locations.add(statsLocation);
View Full Code Here

        Assert.assertEquals(storage.getUriTemplate(), expected.toString());
    }

    @Test
    public void testGetUriTemplateWithOutStorageURL() throws Exception {
        final Location location = new Location();
        location.setPath("/foo/bar");
        location.setType(LocationType.DATA);
        List<Location> locations = new ArrayList<Location>();
        locations.add(location);

        FileSystemStorage storage = new FileSystemStorage(FileSystemStorage.FILE_SYSTEM_URL, locations);
        Assert.assertEquals(storage.getUriTemplate(LocationType.DATA), "${nameNode}/foo/bar");
View Full Code Here

    private 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);
            feed.getLocations().getLocations().add(location);
        } else {
            CatalogTable table = new CatalogTable();
            table.setUri(uriTemplate);
            feed.setTable(table);
View Full Code Here

    }

    @Test (dataProvider = "locationTestDataProvider")
    public void testGetUriTemplateWithLocationType(String storageUrl, String path,
                                                   String expected) throws Exception {
        final Location location = new Location();
        location.setPath(path);
        location.setType(LocationType.DATA);
        List<Location> locations = new ArrayList<Location>();
        locations.add(location);

        FileSystemStorage storage = new FileSystemStorage(storageUrl, locations);
        Assert.assertEquals(storage.getUriTemplate(LocationType.DATA), storageUrl + expected);
View Full Code Here

    }

    @Test
    public void testIsIdentical() throws Exception {
        final String storageUrl = "jail://global:00";
        final Location location1 = new Location();
        location1.setPath("/foo/bar");
        location1.setType(LocationType.DATA);
        List<Location> locations1 = new ArrayList<Location>();
        locations1.add(location1);
        FileSystemStorage storage1 = new FileSystemStorage(storageUrl, locations1);

        final Location location2 = new Location();
        location2.setPath("/foo/bar");
        location2.setType(LocationType.DATA);
        List<Location> locations2 = new ArrayList<Location>();
        locations2.add(location2);
        FileSystemStorage storage2 = new FileSystemStorage(storageUrl, locations2);

        Assert.assertTrue(storage1.isIdentical(storage2));
View Full Code Here

    }

    @Test
    public void testIsIdenticalNegative() throws Exception {
        final String storageUrl = "jail://global:00";
        final Location location1 = new Location();
        location1.setPath("/foo/baz");
        location1.setType(LocationType.DATA);
        List<Location> locations1 = new ArrayList<Location>();
        locations1.add(location1);
        FileSystemStorage storage1 = new FileSystemStorage(storageUrl, locations1);

        final Location location2 = new Location();
        location2.setPath("/foo/bar");
        location2.setType(LocationType.DATA);
        List<Location> locations2 = new ArrayList<Location>();
        locations2.add(location2);
        FileSystemStorage storage2 = new FileSystemStorage(storageUrl, locations2);

        Assert.assertFalse(storage1.isIdentical(storage2));
View Full Code Here

        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);
        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();
View Full Code Here

                FeedGroupMapTest.class
                        .getResourceAsStream("/config/feed/feed-0.1.xml"));
        feed1.setName("f1");
        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()
View Full Code Here

TOP

Related Classes of org.apache.falcon.entity.v0.feed.Location

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.