Package org.apache.falcon.entity.v0

Examples of org.apache.falcon.entity.v0.Frequency


        }
    }

    @Test
    public void testPublish() throws Exception {
        Process process = new Process();
        process.setName("hello");
        store.publish(EntityType.PROCESS, process);
        Process p = store.get(EntityType.PROCESS, "hello");
        Assert.assertEquals(p, process);

        store.registerListener(listener);
        process.setName("world");
        try {
View Full Code Here


        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

            List<CoordinatorJob> applicableCoords = getApplicableCoords(entity,
                    client, start, end, bundles);
            List<CoordinatorAction> actions = new ArrayList<CoordinatorAction>();

            for (CoordinatorJob coord : applicableCoords) {
                Frequency freq = createFrequency(coord.getFrequency(),
                        coord.getTimeUnit());
                TimeZone tz = EntityUtil.getTimeZone(coord.getTimeZone());
                Date iterStart = EntityUtil.getNextStartTime(
                        coord.getStartTime(), freq, tz, start);
                final Date iterEnd = (coord.getNextMaterializedTime().before(end) ? coord.getNextMaterializedTime() : end);
                while (!iterStart.after(iterEnd)) {
                    int sequence = EntityUtil.getInstanceSequence(
                            coord.getStartTime(), freq, tz, iterStart);
                    String actionId = coord.getId() + "@" + sequence;
                    CoordinatorAction coordActionInfo = null;
                    try {
                        coordActionInfo = client.getCoordActionInfo(actionId);
                    } catch (OozieClientException e) {
                        LOG.debug("Unable to get action for " + actionId + " "
                                + e.getMessage());
                    }
                    if (coordActionInfo != null) {
                        actions.add(coordActionInfo);
                    }
                    Calendar startCal = Calendar.getInstance(EntityUtil
                            .getTimeZone(coord.getTimeZone()));
                    startCal.setTime(iterStart);
                    startCal.add(freq.getTimeUnit().getCalendarUnit(),
                            coord.getFrequency());
                    iterStart = startCal.getTime();
                }
            }
            actionsMap.put(cluster, actions);
View Full Code Here

        }
        return actionsMap;
    }

    private Frequency createFrequency(int frequency, Timeunit timeUnit) {
        return new Frequency(frequency, OozieTimeUnit.valueOf(timeUnit.name())
                .getIvoryTimeUnit());
    }
View Full Code Here

    private Date getCoordLastActionTime(CoordinatorJob coord) {
        if (coord.getNextMaterializedTime() != null) {
            Calendar cal = Calendar.getInstance(EntityUtil.getTimeZone(coord
                    .getTimeZone()));
            cal.setTime(coord.getLastActionTime());
            Frequency freq = createFrequency(coord.getFrequency(),
                    coord.getTimeUnit());
            cal.add(freq.getTimeUnit().getCalendarUnit(), -1);
            return cal.getTime();
        }
        return null;
    }
View Full Code Here

    public void testGetNextStartTime() throws Exception {
        Date now = getDate("2012-04-03 02:45 UTC");
        Date start = getDate("2012-04-02 03:00 UTC");
        Date newStart = getDate("2012-04-03 03:00 UTC");

        Frequency frequency = new Frequency("hours(1)");
        Assert.assertEquals(newStart, EntityUtil.getNextStartTime(start,
                frequency, tz, now));
    }
View Full Code Here

    public void testgetNextStartTimeOld() throws Exception {
        Date now = getDate("2012-05-02 02:45 UTC");
        Date start = getDate("2012-02-01 03:00 UTC");
        Date newStart = getDate("2012-05-02 03:00 UTC");

        Frequency frequency = new Frequency("days(7)");
        Assert.assertEquals(newStart, EntityUtil.getNextStartTime(start,
                frequency, tz, now));
    }
View Full Code Here

    public void testGetNextStartTime2() throws Exception {
        Date now = getDate("2010-05-02 04:45 UTC");
        Date start = getDate("2010-02-01 03:00 UTC");
        Date newStart = getDate("2010-05-03 03:00 UTC");

        Frequency frequency = new Frequency("days(7)");
        Assert.assertEquals(newStart, EntityUtil.getNextStartTime(start,
                frequency, tz, now));
    }
View Full Code Here

    public void testGetNextStartTime3() throws Exception {
        Date now = getDate("2010-05-02 04:45 UTC");
        Date start = getDate("1980-02-01 03:00 UTC");
        Date newStart = getDate("2010-05-07 03:00 UTC");

        Frequency frequency = new Frequency("days(7)");
        Assert.assertEquals(newStart, EntityUtil.getNextStartTime(start,
                frequency, tz, now));
    }
View Full Code Here

TOP

Related Classes of org.apache.falcon.entity.v0.Frequency

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.