falcon-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pisayc...@apache.org
Subject falcon git commit: FALCON-1292 Avoid use of hard coded feed names in Bundle class. Contributed by Paul Isaychuk
Date Wed, 01 Jul 2015 17:55:13 GMT
Repository: falcon
Updated Branches:
  refs/heads/master aabf5e136 -> 5422ede87


FALCON-1292 Avoid use of hard coded feed names in Bundle class. Contributed by Paul Isaychuk


Project: http://git-wip-us.apache.org/repos/asf/falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/falcon/commit/5422ede8
Tree: http://git-wip-us.apache.org/repos/asf/falcon/tree/5422ede8
Diff: http://git-wip-us.apache.org/repos/asf/falcon/diff/5422ede8

Branch: refs/heads/master
Commit: 5422ede87153a39095049737e7033f2973628d2e
Parents: aabf5e1
Author: Paul Isaychuk <pisaychuk@apache.org>
Authored: Wed Jul 1 20:54:21 2015 +0300
Committer: Paul Isaychuk <pisaychuk@apache.org>
Committed: Wed Jul 1 20:54:21 2015 +0300

----------------------------------------------------------------------
 falcon-regression/CHANGES.txt                   |  2 ++
 .../falcon/regression/core/bundle/Bundle.java   | 33 +++++++++-----------
 .../falcon/regression/ELValidationsTest.java    |  2 ++
 3 files changed, 18 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/falcon/blob/5422ede8/falcon-regression/CHANGES.txt
----------------------------------------------------------------------
diff --git a/falcon-regression/CHANGES.txt b/falcon-regression/CHANGES.txt
index 4b56c37..75c6ad0 100644
--- a/falcon-regression/CHANGES.txt
+++ b/falcon-regression/CHANGES.txt
@@ -355,6 +355,8 @@ Trunk (Unreleased)
    FALCON-681 delete duplicate feed retention test from falcon regression (SamarthG)
 
   BUG FIXES
+   FALCON-1292 Avoid usage of hard coded feed names in Bundle class (Paul Isaychuk)
+
    FALCON-1281 Fix InstancePageTest#testInstancePageStatusWaitingRunning (Namit Maheshwari
via Ruslan Ostafiychuk)
 
    FALCON-1287 Use listAllEntities() instead of listEntities() (Ruslan Ostafiychuk via Paul
Isaychuk)

http://git-wip-us.apache.org/repos/asf/falcon/blob/5422ede8/falcon-regression/merlin-core/src/main/java/org/apache/falcon/regression/core/bundle/Bundle.java
----------------------------------------------------------------------
diff --git a/falcon-regression/merlin-core/src/main/java/org/apache/falcon/regression/core/bundle/Bundle.java
b/falcon-regression/merlin-core/src/main/java/org/apache/falcon/regression/core/bundle/Bundle.java
index a3ae17a..c8f2320 100644
--- a/falcon-regression/merlin-core/src/main/java/org/apache/falcon/regression/core/bundle/Bundle.java
+++ b/falcon-regression/merlin-core/src/main/java/org/apache/falcon/regression/core/bundle/Bundle.java
@@ -301,24 +301,25 @@ public class Bundle {
     }
 
     public void setInvalidData() {
-        int index = 0;
-        FeedMerlin dataElement = new FeedMerlin(dataSets.get(0));
-        if (!dataElement.getName().contains("raaw-logs16")) {
-            dataElement = new FeedMerlin(dataSets.get(1));
-            index = 1;
-        }
-
-
+        FeedMerlin dataElement = new FeedMerlin(getInputFeedFromBundle());
         String oldLocation = dataElement.getLocations().getLocations().get(0).getPath();
         LOGGER.info("oldlocation: " + oldLocation);
         dataElement.getLocations().getLocations().get(0).setPath(
             oldLocation.substring(0, oldLocation.indexOf('$')) + "invalid/"
-                    +
-                oldLocation.substring(oldLocation.indexOf('$')));
+                    + oldLocation.substring(oldLocation.indexOf('$')));
         LOGGER.info("new location: " + dataElement.getLocations().getLocations().get(0).getPath());
-        dataSets.set(index, dataElement.toString());
+        setInputFeed(dataElement.toString());
     }
 
+    public void setInputFeed(String newFeed) {
+        String inputFeedName = getInputFeedNameFromBundle();
+        for (int i = 0; i < dataSets.size(); i++) {
+            if (new FeedMerlin(dataSets.get(i)).getName().equals(inputFeedName)) {
+                dataSets.set(i, newFeed);
+                return;
+            }
+        }
+    }
 
     public void setFeedValidity(String feedStart, String feedEnd, String feedName) {
         FeedMerlin feedElement = getFeedElement(feedName);
@@ -327,10 +328,7 @@ public class Bundle {
     }
 
     public int getInitialDatasetFrequency() {
-        FeedMerlin dataElement = new FeedMerlin(dataSets.get(0));
-        if (!dataElement.getName().contains("raaw-logs16")) {
-            dataElement = new FeedMerlin(dataSets.get(1));
-        }
+        FeedMerlin dataElement = new FeedMerlin(getInputFeedFromBundle());
         if (dataElement.getFrequency().getTimeUnit() == TimeUnit.hours) {
             return (Integer.parseInt(dataElement.getFrequency().getFrequency())) * 60;
         } else {
@@ -849,10 +847,7 @@ public class Bundle {
     }
 
     public String getDatasetPath() {
-        FeedMerlin dataElement = new FeedMerlin(getDataSets().get(0));
-        if (!dataElement.getName().contains("raaw-logs16")) {
-            dataElement = new FeedMerlin(getDataSets().get(1));
-        }
+        FeedMerlin dataElement = new FeedMerlin(getInputFeedFromBundle());
         return dataElement.getLocations().getLocations().get(0).getPath();
     }
 

http://git-wip-us.apache.org/repos/asf/falcon/blob/5422ede8/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/ELValidationsTest.java
----------------------------------------------------------------------
diff --git a/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/ELValidationsTest.java
b/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/ELValidationsTest.java
index cc7ef15..a0922cb 100644
--- a/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/ELValidationsTest.java
+++ b/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/ELValidationsTest.java
@@ -214,6 +214,8 @@ public class ELValidationsTest extends BaseTestClass {
         if (fromJob.size() != qaList.size()) {
             return false;
         }
+        Collections.sort(fromJob);
+        Collections.sort(qaList);
         for (int index = 0; index < fromJob.size(); index++) {
             if (!fromJob.get(index).contains(qaList.get(index))) {
                 return false;


Mime
View raw message