Repository: incubator-falcon Updated Branches: refs/heads/master aa3e455fb -> 067047661
FALCON-841 Test falcon process with different frequencies-2. Contributed by Raghav Kumar Gautam Project: http://git-wip-us.apache.org/repos/asf/incubator-falcon/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-falcon/commit/06704766 Tree: http://git-wip-us.apache.org/repos/asf/incubator-falcon/tree/06704766 Diff: http://git-wip-us.apache.org/repos/asf/incubator-falcon/diff/06704766 Branch: refs/heads/master Commit: 067047661b7228e6b202dda427d14f56d8b7b847 Parents: aa3e455 Author: Raghav Kumar Gautam <rag...@apache.org> Authored: Wed Oct 29 10:25:35 2014 -0700 Committer: Raghav Kumar Gautam <rag...@apache.org> Committed: Wed Oct 29 10:25:35 2014 -0700 ---------------------------------------------------------------------- falcon-regression/CHANGES.txt | 3 +- .../core/enumsAndConstants/FeedType.java | 98 --------------- .../core/enumsAndConstants/FreqType.java | 126 +++++++++++++++++++ 3 files changed, 128 insertions(+), 99 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/06704766/falcon-regression/CHANGES.txt ---------------------------------------------------------------------- diff --git a/falcon-regression/CHANGES.txt b/falcon-regression/CHANGES.txt index d5f004e..e6a1ed9 100644 --- a/falcon-regression/CHANGES.txt +++ b/falcon-regression/CHANGES.txt @@ -5,7 +5,8 @@ Trunk (Unreleased) INCOMPATIBLE CHANGES NEW FEATURES - FALCON-836 Add tests for entities list API (Ruslan Ostafiychuk) + FALCON-841 Test falcon process with different frequencies + (Raghav Kumar Gautam) FALCON-814 Tests for entities summary API (Paul Isaychuk via Ruslan Ostafiychuk) http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/06704766/falcon-regression/merlin-core/src/main/java/org/apache/falcon/regression/core/enumsAndConstants/FeedType.java ---------------------------------------------------------------------- diff --git a/falcon-regression/merlin-core/src/main/java/org/apache/falcon/regression/core/enumsAndConstants/FeedType.java b/falcon-regression/merlin-core/src/main/java/org/apache/falcon/regression/core/enumsAndConstants/FeedType.java deleted file mode 100644 index 67a19b0..0000000 --- a/falcon-regression/merlin-core/src/main/java/org/apache/falcon/regression/core/enumsAndConstants/FeedType.java +++ /dev/null @@ -1,98 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.falcon.regression.core.enumsAndConstants; - -import org.apache.commons.lang.StringUtils; -import org.joda.time.DateTime; -import org.joda.time.format.DateTimeFormat; -import org.joda.time.format.DateTimeFormatter; - -/** - * Enum to represent different feed periodicity. - */ -public enum FeedType { - MINUTELY("minutely", "yyyy/MM/dd/HH/mm", "${YEAR}/${MONTH}/${DAY}/${HOUR}/${MINUTE}", - "year=${YEAR};month=${MONTH};day=${DAY};hour=${HOUR};minute=${MINUTE}") { - public DateTime addTime(DateTime dateTime, int amount) { - return dateTime.plusMinutes(amount); - } - }, - HOURLY("hourly", "yyyy/MM/dd/HH", "${YEAR}/${MONTH}/${DAY}/${HOUR}", - "year=${YEAR};month=${MONTH};day=${DAY};hour=${HOUR}") { - @Override - public DateTime addTime(DateTime dateTime, int amount) { - return dateTime.plusHours(amount); - } - }, - DAILY("daily", "yyyy/MM/dd", "${YEAR}/${MONTH}/${DAY}", - "year=${YEAR};month=${MONTH};day=${DAY}") { - @Override - public DateTime addTime(DateTime dateTime, int amount) { - return dateTime.plusDays(amount); - } - }, - MONTHLY("monthly", "yyyy/MM", "${YEAR}/${MONTH}", - "year=${YEAR};month=${MONTH}") { - @Override - public DateTime addTime(DateTime dateTime, int amount) { - return dateTime.plusMonths(amount); - } - }, - YEARLY("yearly", "yyyy", "${YEAR}", - "year=${YEAR}") { - @Override - public DateTime addTime(DateTime dateTime, int amount) { - return dateTime.plusYears(amount); - } - }; - - private final String value; - private final String pathValue; - private final String hcatPathValue; - private final DateTimeFormatter formatter; - - private FeedType(String value, String format, String pathValue, String hcatPathValue) { - this.value = value; - formatter = DateTimeFormat.forPattern(format); - this.pathValue = pathValue; - this.hcatPathValue = hcatPathValue; - } - - public String getValue() { - return value; - } - - public String getPathValue() { - return pathValue; - } - - public String getHcatPathValue() { - return hcatPathValue; - } - - public DateTimeFormatter getFormatter() { - return formatter; - } - - public int getDirDepth() { - return StringUtils.countMatches(pathValue, "/"); - } - - public abstract DateTime addTime(DateTime dateTime, int amount); -} http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/06704766/falcon-regression/merlin-core/src/main/java/org/apache/falcon/regression/core/enumsAndConstants/FreqType.java ---------------------------------------------------------------------- diff --git a/falcon-regression/merlin-core/src/main/java/org/apache/falcon/regression/core/enumsAndConstants/FreqType.java b/falcon-regression/merlin-core/src/main/java/org/apache/falcon/regression/core/enumsAndConstants/FreqType.java new file mode 100644 index 0000000..46c30ba --- /dev/null +++ b/falcon-regression/merlin-core/src/main/java/org/apache/falcon/regression/core/enumsAndConstants/FreqType.java @@ -0,0 +1,126 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.falcon.regression.core.enumsAndConstants; + +import org.apache.commons.lang.StringUtils; +import org.apache.falcon.entity.v0.Frequency; +import org.joda.time.DateTime; +import org.joda.time.format.DateTimeFormat; +import org.joda.time.format.DateTimeFormatter; + +/** + * Enum to represent different feed periodicity. + */ +public enum FreqType { + MINUTELY("minutely", "yyyy/MM/dd/HH/mm", "${YEAR}/${MONTH}/${DAY}/${HOUR}/${MINUTE}", + "year=${YEAR};month=${MONTH};day=${DAY};hour=${HOUR};minute=${MINUTE}") { + public DateTime addTime(DateTime dateTime, int amount) { + return dateTime.plusMinutes(amount); + } + + @Override + public Frequency.TimeUnit getFalconTimeUnit() { + return Frequency.TimeUnit.minutes; + } + }, + HOURLY("hourly", "yyyy/MM/dd/HH", "${YEAR}/${MONTH}/${DAY}/${HOUR}", + "year=${YEAR};month=${MONTH};day=${DAY};hour=${HOUR}") { + @Override + public DateTime addTime(DateTime dateTime, int amount) { + return dateTime.plusHours(amount); + } + + @Override + public Frequency.TimeUnit getFalconTimeUnit() { + return Frequency.TimeUnit.hours; + } + }, + DAILY("daily", "yyyy/MM/dd", "${YEAR}/${MONTH}/${DAY}", + "year=${YEAR};month=${MONTH};day=${DAY}") { + @Override + public DateTime addTime(DateTime dateTime, int amount) { + return dateTime.plusDays(amount); + } + + @Override + public Frequency.TimeUnit getFalconTimeUnit() { + return Frequency.TimeUnit.days; + } + }, + MONTHLY("monthly", "yyyy/MM", "${YEAR}/${MONTH}", + "year=${YEAR};month=${MONTH}") { + @Override + public DateTime addTime(DateTime dateTime, int amount) { + return dateTime.plusMonths(amount); + } + + @Override + public Frequency.TimeUnit getFalconTimeUnit() { + return Frequency.TimeUnit.months; + } + }, + YEARLY("yearly", "yyyy", "${YEAR}", + "year=${YEAR}") { + @Override + public DateTime addTime(DateTime dateTime, int amount) { + return dateTime.plusYears(amount); + } + + @Override + public Frequency.TimeUnit getFalconTimeUnit() { + throw new UnsupportedOperationException(); + } + }; + + private final String value; + private final String pathValue; + private final String hcatPathValue; + private final DateTimeFormatter formatter; + + private FreqType(String value, String format, String pathValue, String hcatPathValue) { + this.value = value; + formatter = DateTimeFormat.forPattern(format); + this.pathValue = pathValue; + this.hcatPathValue = hcatPathValue; + } + + public String getValue() { + return value; + } + + public String getPathValue() { + return pathValue; + } + + public String getHcatPathValue() { + return hcatPathValue; + } + + public DateTimeFormatter getFormatter() { + return formatter; + } + + public int getDirDepth() { + return StringUtils.countMatches(pathValue, "/"); + } + + public abstract DateTime addTime(DateTime dateTime, int amount); + + public abstract Frequency.TimeUnit getFalconTimeUnit(); +}