Package org.apache.falcon.entity.v0.cluster

Examples of org.apache.falcon.entity.v0.cluster.Cluster


    public void testClusterEntityWithInvalidInterfaces(Interfacetype interfacetype, String endpoint)
        throws Exception {
        overlay = context.getUniqueOverlay();
        String filePath = context.overlayParametersOverTemplate(TestContext.CLUSTER_TEMPLATE, overlay);
        InputStream stream = new FileInputStream(filePath);
        Cluster cluster = (Cluster) EntityType.CLUSTER.getUnmarshaller().unmarshal(stream);
        Assert.assertNotNull(cluster);
        cluster.setColo("default")// validations will be ignored if not default & tests fail

        Interface anInterface = ClusterHelper.getInterface(cluster, interfacetype);
        anInterface.setEndpoint(endpoint);

        File tmpFile = context.getTempFile();
View Full Code Here


    private static final Logger LOG = Logger.getLogger(OozieWorkflowBuilder.class);
    protected static final ConfigurationStore CONFIG_STORE = ConfigurationStore.get();

    protected Properties createAppProperties(String clusterName, Path bundlePath, String user) throws FalconException {

        Cluster cluster = EntityUtil.getEntity(EntityType.CLUSTER, clusterName);
        Properties properties = new Properties();
        if (cluster.getProperties() != null) {
            addClusterProperties(properties, cluster.getProperties()
                    .getProperties());
        }
        properties.setProperty(OozieWorkflowEngine.NAME_NODE,
                ClusterHelper.getStorageUrl(cluster));
        properties.setProperty(OozieWorkflowEngine.JOB_TRACKER,
                ClusterHelper.getMREndPoint(cluster));
        properties.setProperty(OozieClient.BUNDLE_APP_PATH,
                "${" + OozieWorkflowEngine.NAME_NODE + "}" + bundlePath.toString());
        properties.setProperty("colo.name", cluster.getColo());

        properties.setProperty(OozieClient.USER_NAME, user);
        properties.setProperty(OozieClient.USE_SYSTEM_LIBPATH, "true");
        properties.setProperty("falcon.libpath", ClusterHelper.getLocation(cluster, "working") + "/lib");
        LOG.info("Cluster: " + cluster.getName() + ", PROPS: " + properties);
        return properties;
    }
View Full Code Here

        org.apache.falcon.entity.v0.feed.Cluster feedCluster = FeedHelper.getCluster(feed, clusterName);
        if (!startDate.before(feedCluster.getValidity().getEnd())) {
            return null;
        }

        Cluster cluster = CONFIG_STORE.get(EntityType.CLUSTER, feedCluster.getName());
        Path bundlePath = new Path(ClusterHelper.getLocation(cluster, "staging"), EntityUtil.getStagingPath(feed));
        Feed feedClone = (Feed) feed.copy();
        EntityUtil.setStartDate(feedClone, clusterName, startDate);

        AbstractOozieEntityMapper<Feed> mapper = new OozieFeedMapper(feedClone);
View Full Code Here

        Entity entity = (Entity) unmarshaller
                .unmarshal(OozieFeedMapperTest.class.getResource(template));
        store.publish(type, entity);

        if (type == EntityType.CLUSTER) {
            Cluster cluster = (Cluster) entity;
            ClusterHelper.getInterface(cluster, Interfacetype.WRITE).setEndpoint(writeEndpoint);
            FileSystem fs = new Path(writeEndpoint).getFileSystem(new Configuration());
            fs.create(new Path(ClusterHelper.getLocation(cluster, "working"), "libext/FEED/retention/ext.jar")).close();
            fs.create(
                    new Path(ClusterHelper.getLocation(cluster, "working"), "libext/FEED/replication/ext.jar")).close();
View Full Code Here

    public void onAdd(Entity entity, boolean ignoreFailure) {
        if (entity.getEntityType() != EntityType.CLUSTER) {
            return;
        }

        Cluster cluster = (Cluster) entity;
        COLO_CLUSTER_MAP.putIfAbsent(cluster.getColo(), new HashSet<String>());
        COLO_CLUSTER_MAP.get(cluster.getColo()).add(cluster.getName());
    }
View Full Code Here

    public void onRemove(Entity entity) {
        if (entity.getEntityType() != EntityType.CLUSTER) {
            return;
        }

        Cluster cluster = (Cluster) entity;
        COLO_CLUSTER_MAP.get(cluster.getColo()).remove(cluster.getName());
        if (COLO_CLUSTER_MAP.get(cluster.getColo()).isEmpty()) {
            COLO_CLUSTER_MAP.remove(cluster.getColo());
        }
    }
View Full Code Here

*/
@Test
public class ColoClusterRelationTest extends AbstractTestBase {

    private Cluster newCluster(String name, String colo) {
        Cluster cluster = new Cluster();
        cluster.setName(name);
        cluster.setColo(colo);
        return cluster;
    }
View Full Code Here

        return cluster;
    }

    @Test
    public void testMapping() throws Exception {
        Cluster cluster1 = newCluster("cluster1", "colo1");
        Cluster cluster2 = newCluster("cluster2", "colo1");
        Cluster cluster3 = newCluster("cluster3", "colo2");
        getStore().publish(EntityType.CLUSTER, cluster1);
        getStore().publish(EntityType.CLUSTER, cluster2);
        getStore().publish(EntityType.CLUSTER, cluster3);

        ColoClusterRelation relation = ColoClusterRelation.get();
        Set<String> clusters = relation.getClusters("colo1");
        Assert.assertNotNull(clusters);
        Assert.assertEquals(2, clusters.size());
        Assert.assertTrue(clusters.contains(cluster1.getName()));
        Assert.assertTrue(clusters.contains(cluster2.getName()));

        clusters = relation.getClusters("colo2");
        Assert.assertNotNull(clusters);
        Assert.assertEquals(1, clusters.size());
        Assert.assertTrue(clusters.contains(cluster3.getName()));

        getStore().remove(EntityType.CLUSTER, cluster1.getName());
        clusters = relation.getClusters("colo1");
        Assert.assertNotNull(clusters);
        Assert.assertEquals(1, clusters.size());
View Full Code Here

        Map<String, String> overlay = sourceContext.getUniqueOverlay();
        String sourceFilePath = sourceContext.overlayParametersOverTemplate("/table/primary-cluster.xml", overlay);
        sourceContext.setCluster(sourceFilePath);

        final Cluster sourceCluster = sourceContext.getCluster().getCluster();
        String sourceStorageUrl = ClusterHelper.getStorageUrl(sourceCluster);

        // copyTestDataToHDFS
        final String sourcePath = sourceStorageUrl + SOURCE_LOCATION + PARTITION_VALUE;
        FSUtils.copyResourceToHDFS("/apps/data/data.txt", "data.txt", sourcePath);

        String targetFilePath = targetContext.overlayParametersOverTemplate("/table/bcp-cluster.xml", overlay);
        targetContext.setCluster(targetFilePath);

        final Cluster targetCluster = targetContext.getCluster().getCluster();
        copyLibsToHDFS(targetCluster);

        String file = targetAlphaContext.overlayParametersOverTemplate("/table/target-cluster-alpha.xml", overlay);
        targetAlphaContext.setCluster(file);
        copyLibsToHDFS(targetAlphaContext.getCluster().getCluster());
View Full Code Here

    }

    @Test (enabled = false)
    public void testFSReplicationComplex() throws Exception {
        // copyTestDataToHDFS
        Cluster sourceCluster = sourceContext.getCluster().getCluster();
        FileSystem sourceFS = FileSystem.get(ClusterHelper.getConfiguration(sourceCluster));
        String sourceStorageUrl = ClusterHelper.getStorageUrl(sourceCluster);
        final String partitionValue = "2012-10-01-12";
        String sourceLocation = sourceStorageUrl + SOURCE_LOCATION + partitionValue + "/" + sourceCluster.getColo();
        FSUtils.copyResourceToHDFS("/apps/data/data.txt", "data.txt", sourceLocation);
        Path sourcePath = new Path(sourceLocation);
        Assert.assertTrue(sourceFS.exists(sourcePath));

        final Map<String, String> overlay = sourceContext.getUniqueOverlay();
View Full Code Here

TOP

Related Classes of org.apache.falcon.entity.v0.cluster.Cluster

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.