Package org.apache.falcon.entity.v0.process

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


        store.unregisterListener(listener);
    }

    @Test
    public void testGet() throws Exception {
        Process p = store.get(EntityType.PROCESS, "notfound");
        Assert.assertNull(p);
    }
View Full Code Here


        Assert.assertNull(p);
    }

    @Test
    public void testRemove() throws Exception {
        Process process = new Process();
        process.setName("remove");
        store.publish(EntityType.PROCESS, process);
        Process p = store.get(EntityType.PROCESS, "remove");
        Assert.assertEquals(p, process);
        store.remove(EntityType.PROCESS, "remove");
        p = store.get(EntityType.PROCESS, "remove");
        Assert.assertNull(p);
View Full Code Here

        builder.setSuffixes(Arrays.asList("cluster1"));
        Assert.assertEquals(builder.getWorkflowName().toString(),
                "FALCON_FEED_REPLICATION_raw-logs_cluster1");

        Process process = new Process();
        process.setName("agg-logs");
        WorkflowNameBuilder<Process> processBuilder = new WorkflowNameBuilder<Process>(
                process);
        processBuilder.setTag(Tag.DEFAULT);
        Assert.assertEquals(processBuilder.getWorkflowName().toString(),
                "FALCON_PROCESS_DEFAULT_agg-logs");
View Full Code Here

    }

    @Test
    public void testParse() throws FalconException, JAXBException {

        Process process = parser.parseAndValidate(getClass().getResourceAsStream(PROCESS_XML));

        Assert.assertNotNull(process);
        Assert.assertEquals(process.getName(), "sample");

        Assert.assertEquals(process.getParallel(), 1);
        Assert.assertEquals(process.getOrder().name(), "LIFO");
        Assert.assertEquals(process.getFrequency().toString(), "hours(1)");
        Assert.assertEquals(process.getEntityType(), EntityType.PROCESS);

        Assert.assertEquals(process.getInputs().getInputs().get(0).getName(), "impression");
        Assert.assertEquals(process.getInputs().getInputs().get(0).getFeed(), "impressionFeed");
        Assert.assertEquals(process.getInputs().getInputs().get(0).getStart(), "today(0,0)");
        Assert.assertEquals(process.getInputs().getInputs().get(0).getEnd(), "today(2,0)");
        Assert.assertEquals(process.getInputs().getInputs().get(0).getPartition(), "*/US");
        Assert.assertEquals(process.getInputs().getInputs().get(0).isOptional(), false);

        Assert.assertEquals(process.getOutputs().getOutputs().get(0).getName(), "impOutput");
        Assert.assertEquals(process.getOutputs().getOutputs().get(0).getFeed(), "imp-click-join1");
        Assert.assertEquals(process.getOutputs().getOutputs().get(0).getInstance(), "today(0,0)");

        Assert.assertEquals(process.getProperties().getProperties().get(0).getName(), "name1");
        Assert.assertEquals(process.getProperties().getProperties().get(0).getValue(), "value1");

        Cluster processCluster = process.getClusters().getClusters().get(0);
        Assert.assertEquals(SchemaHelper.formatDateUTC(processCluster.getValidity().getStart()), "2011-11-02T00:00Z");
        Assert.assertEquals(SchemaHelper.formatDateUTC(processCluster.getValidity().getEnd()), "2011-12-30T00:00Z");
        Assert.assertEquals(process.getTimezone().getID(), "UTC");

        Assert.assertEquals(process.getWorkflow().getEngine().name().toLowerCase(), "oozie");
        Assert.assertEquals(process.getWorkflow().getPath(), "/path/to/workflow");

        StringWriter stringWriter = new StringWriter();
        Marshaller marshaller = EntityType.PROCESS.getMarshaller();
        marshaller.marshal(process, stringWriter);
        System.out.println(stringWriter.toString());
View Full Code Here

        // TODO for retry and late policy
    }

    @Test
    public void testELExpressions() throws Exception {
        Process process = parser.parseAndValidate(getClass().getResourceAsStream(PROCESS_XML));
        process.getInputs().getInputs().get(0).setStart("lastMonth(0,0,0)");
        try {
            parser.validate(process);
            throw new AssertionError("Expected ValidationException!");
        } catch (ValidationException e) {
            //ignore
        }

        process.getInputs().getInputs().get(0).setStart("today(0,0)");
        process.getInputs().getInputs().get(0).setEnd("lastMonth(0,0,0)");
        try {
            parser.validate(process);
            throw new AssertionError("Expected ValidationException!");
        } catch (ValidationException e) {
            //ignore
        }

        process.getInputs().getInputs().get(0).setStart("today(2,0)");
        process.getInputs().getInputs().get(0).setEnd("today(0,0)");
        try {
            parser.validate(process);
            throw new AssertionError("Expected ValidationException!");
        } catch (ValidationException e) {
            //ignore
View Full Code Here

        parser.parseAndValidate(this.getClass().getResourceAsStream(invalidProcessXml));
    }

    @Test(expectedExceptions = ValidationException.class)
    public void applyValidationInvalidProcess() throws Exception {
        Process process = parser.parseAndValidate(getClass().getResourceAsStream(PROCESS_XML));
        process.getClusters().getClusters().get(0).setName("invalid cluster");
        parser.validate(process);
    }
View Full Code Here

    }
    //RESUME CHECKSTYLE CHECK HiddenFieldCheck

    @Test(expectedExceptions = ValidationException.class)
    public void testInvalidProcessValidity() throws Exception {
        Process process = parser
                .parseAndValidate((ProcessEntityParserTest.class
                        .getResourceAsStream(PROCESS_XML)));
        process.getClusters().getClusters().get(0).getValidity().setStart(
                SchemaHelper.parseDateUTC("2011-12-31T00:00Z"));
        parser.validate(process);
    }
View Full Code Here

        parser.validate(process);
    }

    @Test(expectedExceptions = ValidationException.class)
    public void testInvalidDependentFeedsRetentionLimit() throws Exception {
        Process process = parser
                .parseAndValidate((ProcessEntityParserTest.class
                        .getResourceAsStream(PROCESS_XML)));
        process.getInputs().getInputs().get(0).setStart("today(-48,0)");
        parser.validate(process);
    }
View Full Code Here

        parser.validate(process);
    }

    @Test(expectedExceptions = ValidationException.class)
    public void testDuplicateInputOutputNames() throws FalconException {
        Process process = parser
                .parseAndValidate((ProcessEntityParserTest.class
                        .getResourceAsStream(PROCESS_XML)));
        process.getInputs().getInputs().get(0).setName("duplicateName");
        process.getOutputs().getOutputs().get(0).setName("duplicateName");
        parser.validate(process);
    }
View Full Code Here

        parser.validate(process);
    }

    @Test(expectedExceptions = FalconException.class)
    public void testInvalidRetryAttempt() throws FalconException {
        Process process = parser
                .parseAndValidate((ProcessEntityParserTest.class
                        .getResourceAsStream(PROCESS_XML)));
        process.getRetry().setAttempts(-1);
        parser.parseAndValidate(process.toString());
    }
View Full Code Here

TOP

Related Classes of org.apache.falcon.entity.v0.process.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.