Package org.apache.oozie.util

Examples of org.apache.oozie.util.ELEvaluator$Context


        eval.setVariable(".wrap", "true");
        return "lastMonth(" + day + ", " + hr + ", " + min + ")"; // Unresolved
    }

    public static String ph1_currentYear_echo(int month, int day, int hr, int min) {
        ELEvaluator eval = ELEvaluator.getCurrent();
        eval.setVariable(".wrap", "true");
        return "currentYear(" + month + ", " + day + ", " + hr + ", " + min + ")"; // Unresolved
    }
View Full Code Here


        eval.setVariable(".wrap", "true");
        return "currentYear(" + month + ", " + day + ", " + hr + ", " + min + ")"; // Unresolved
    }

    public static String ph1_lastYear_echo(int month, int day, int hr, int min) {
        ELEvaluator eval = ELEvaluator.getCurrent();
        eval.setVariable(".wrap", "true");
        return "lastYear(" + month + ", " + day + ", " + hr + ", " + min + ")"; // Unresolved
    }
View Full Code Here

    private static boolean isActionContext() {
        return !isDatasetContext();
    }

    private static boolean isDatasetContext() {
        ELEvaluator eval = ELEvaluator.getCurrent();
        SyncCoordDataset ds = (SyncCoordDataset) eval.getVariable(CoordELFunctions.DATASET);
        return ds != null;
    }
View Full Code Here

    @edu.umd.cs.findbugs.annotations.SuppressWarnings({"SF_SWITCH_FALLTHROUGH"})
    private static Calendar getEffectiveTime(TruncateBoundary trunc, int yr, int mon, int day, int hr, int min) {
        Calendar cal;
        if (isActionContext()) {
            ELEvaluator eval = ELEvaluator.getCurrent();
            SyncCoordAction action = ParamChecker.notNull((SyncCoordAction)
                    eval.getVariable(CoordELFunctions.COORD_ACTION),
                    "Coordinator Action");
            cal = Calendar.getInstance(action.getTimeZone());
            cal.setTime(action.getNominalTime());
        } else {
            Calendar tmp = CoordELFunctions.getEffectiveNominalTime();
View Full Code Here

        createEval.setVariable(OozieClient.GROUP_NAME, "test_group");
    }

    @Test
    public void testActionExpressions() throws Exception {
        ELEvaluator eval = createActionStartEvaluator();
        Assert.assertEquals(CoordELFunctions.evalAndWrap(eval, "${now(0, 0)}"), "2009-09-02T10:00Z");
        Assert.assertEquals(CoordELFunctions.evalAndWrap(eval, "${now(1, 0)}"), "2009-09-02T11:00Z");

        Assert.assertEquals(CoordELFunctions.evalAndWrap(eval, "${today(0, 0)}"), "2009-09-02T00:00Z");
        Assert.assertEquals(CoordELFunctions.evalAndWrap(eval, "${today(-1, 0)}"), "2009-09-01T23:00Z");
View Full Code Here

                "2009-Sep-02");
    }

    @Test
    public void testUser() throws Exception {
        ELEvaluator eval = Services.get().get(ELService.class).createEvaluator("coord-action-start");
        eval.setVariable(OozieClient.USER_NAME, "test");
        Assert.assertEquals(CoordELFunctions.evalAndWrap(eval, "${user()}"), "test");
    }
View Full Code Here

        Assert.assertEquals(CoordELFunctions.evalAndWrap(eval, "${user()}"), "test");
    }

    @Test
    public void testDataIn() throws Exception {
        ELEvaluator eval = createActionStartEvaluator();
        String uris = "hdfs://localhost:8020/clicks/2009/09/02/10,hdfs://localhost:8020/clicks/2009/09/02/09";
        eval.setVariable(".datain.clicks", uris);
        String expuris =
                "hdfs://localhost:8020/clicks/2009/09/02/10/*/US,hdfs://localhost:8020/clicks/2009/09/02/09/*/US";
        Assert.assertEquals(expuris, CoordELFunctions.evalAndWrap(eval, "${dataIn('clicks', '*/US')}"));

        //test optional input
        String inName = "clicks";
        SyncCoordDataset ds = createDataSet("2007-09-30T010:00Z");
        eval.setVariable(inName + ".frequency", String.valueOf(ds.getFrequency()));
        eval.setVariable(inName + ".freq_timeunit", ds.getTimeUnit().name());
        eval.setVariable(inName + ".timezone", ds.getTimeZone().getID());
        eval.setVariable(inName + ".end_of_duration", Timeunit.NONE.name());
        eval.setVariable(inName + ".initial-instance", DateUtils.formatDateOozieTZ(ds.getInitInstance()));
        eval.setVariable(inName + ".done-flag", "notused");
        eval.setVariable(inName + ".uri-template", ds.getUriTemplate());
        eval.setVariable(inName + ".start-instance", "now(-1,0)");
        eval.setVariable(inName + ".end-instance", "now(0,0)");
        // TODO Had to comment this out for this test to PASS else NPE in
        // TODO org.apache.oozie.command.coord.CoordCommandUtils.createEarlyURIs(CoordCommandUtils.java:359)
        // eval.setVariable(".datain.clicks", null);
        Assert.assertEquals(expuris, CoordELFunctions.evalAndWrap(eval, "${dataIn('clicks', '*/US')}"));
    }
View Full Code Here

        CoordELFunctions.configureEvaluator(createEval, ds, appInst);
    }

    private ELEvaluator createActionStartEvaluator() throws Exception {
        SyncCoordAction appInst = createCoordAction("2009-09-02T11:30Z", "2009-09-02T10:00Z");
        ELEvaluator eval = Services.get().get(ELService.class).createEvaluator("coord-action-start");
        CoordELFunctions.configureEvaluator(eval, null, appInst);
        return eval;
    }
View Full Code Here

        createEval.setVariable(OozieClient.GROUP_NAME, "test_group");
    }

    @Test
    public void testActionExpressions() throws Exception {
        ELEvaluator eval = createActionStartEvaluator();
        Assert.assertEquals(CoordELFunctions.evalAndWrap(eval, "${now(0, 0)}"), "2009-09-02T10:00Z");
        Assert.assertEquals(CoordELFunctions.evalAndWrap(eval, "${now(1, 0)}"), "2009-09-02T11:00Z");

        Assert.assertEquals(CoordELFunctions.evalAndWrap(eval, "${today(0, 0)}"), "2009-09-02T00:00Z");
        Assert.assertEquals(CoordELFunctions.evalAndWrap(eval, "${today(-1, 0)}"), "2009-09-01T23:00Z");
View Full Code Here

                "2009-Sep-02");
    }

    @Test
    public void testUser() throws Exception {
        ELEvaluator eval = Services.get().get(ELService.class).createEvaluator("coord-action-start");
        eval.setVariable(OozieClient.USER_NAME, "test");
        Assert.assertEquals(CoordELFunctions.evalAndWrap(eval, "${user()}"), "test");
    }
View Full Code Here

TOP

Related Classes of org.apache.oozie.util.ELEvaluator$Context

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.