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-1284 Fix entity cleanup when is_depracate=true. Contributed by Ruslan Ostafiychuk
Date Mon, 22 Jun 2015 12:36:30 GMT
Repository: falcon
Updated Branches:
  refs/heads/master dc950f718 -> 8db18628a


FALCON-1284 Fix entity cleanup when is_depracate=true. Contributed by Ruslan Ostafiychuk


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

Branch: refs/heads/master
Commit: 8db18628a4d6cb689a2416052ccef615e288273f
Parents: dc950f7
Author: Paul Isaychuk <pisaychuk@apache.org>
Authored: Mon Jun 22 15:34:26 2015 +0300
Committer: Paul Isaychuk <pisaychuk@apache.org>
Committed: Mon Jun 22 15:34:26 2015 +0300

----------------------------------------------------------------------
 falcon-regression/CHANGES.txt                        |  2 ++
 .../falcon/regression/Entities/TestEntityUtil.java   | 12 ++++++------
 .../apache/falcon/regression/core/bundle/Bundle.java |  2 +-
 .../org/apache/falcon/regression/core/util/Util.java | 15 +++++++++++++++
 .../falcon/regression/testHelper/BaseTestClass.java  |  5 ++++-
 .../org/apache/falcon/regression/SearchApiTest.java  |  5 +++--
 .../falcon/regression/lineage/LineageApiTest.java    |  3 ++-
 .../regression/lineage/ProcessPipelineTest.java      |  3 ++-
 .../regression/prism/NewPrismProcessUpdateTest.java  |  2 +-
 .../falcon/regression/prism/PrismFeedUpdateTest.java |  2 +-
 .../prism/RescheduleKilledProcessTest.java           |  2 +-
 .../regression/searchUI/EntitiesTableTest.java       |  3 ++-
 .../falcon/regression/searchUI/ProcessSetupTest.java |  5 +++--
 .../apache/falcon/regression/ui/ProcessUITest.java   |  2 +-
 14 files changed, 44 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/falcon/blob/8db18628/falcon-regression/CHANGES.txt
----------------------------------------------------------------------
diff --git a/falcon-regression/CHANGES.txt b/falcon-regression/CHANGES.txt
index 7c19724..6c6ee4f 100644
--- a/falcon-regression/CHANGES.txt
+++ b/falcon-regression/CHANGES.txt
@@ -93,6 +93,8 @@ Trunk (Unreleased)
    via Samarth Gupta)
 
   IMPROVEMENTS
+   FALCON-1284 Fix entity cleanup when is_depracate=true (Ruslan Ostafiychuk via Paul Isaychuk)
+
    FALCON-1283 Save screenshots to log.capture.location (Ruslan Ostafiychuk via Paul Isaychuk)
 
    FALCON-1259 Fix property picked for DIFFERENT_USER_GROUP (Raghav Kumar Gautam)

http://git-wip-us.apache.org/repos/asf/falcon/blob/8db18628/falcon-regression/merlin-core/src/main/java/org/apache/falcon/regression/Entities/TestEntityUtil.java
----------------------------------------------------------------------
diff --git a/falcon-regression/merlin-core/src/main/java/org/apache/falcon/regression/Entities/TestEntityUtil.java
b/falcon-regression/merlin-core/src/main/java/org/apache/falcon/regression/Entities/TestEntityUtil.java
index fa30f13..a9a8f00 100644
--- a/falcon-regression/merlin-core/src/main/java/org/apache/falcon/regression/Entities/TestEntityUtil.java
+++ b/falcon-regression/merlin-core/src/main/java/org/apache/falcon/regression/Entities/TestEntityUtil.java
@@ -49,16 +49,16 @@ final class TestEntityUtil {
     }
 
     /*
-    Deprecating entity name if its length >= 30 and is_deprecate is set.
+    Deprecating entity name if is_deprecate is set.
     Useful when oozie uses embedded database(derby)
      */
     public static String generateUniqueName(String prefix, String oldName) {
         Assert.assertNotNull(prefix, "name prefix shouldn't be null!");
-        String name=prefix + '-' + oldName + '-' + UUID.randomUUID().toString().split("-")[0];
-        if (name.length()>=30 && MerlinConstants.IS_DEPRECATE) {
-            LOGGER.warn("Entity name " + name + " length exceeds 30 character");
-            name=oldName + '-' + UUID.randomUUID().toString().split("-")[0];
+        String randomPart = UUID.randomUUID().toString().split("-")[0];
+        if (MerlinConstants.IS_DEPRECATE) {
+            return  'A' + Integer.toHexString(prefix.hashCode()) + '-' + randomPart;
+        } else {
+            return prefix + '-' + oldName + '-' + randomPart;
         }
-        return name;
     }
 }

http://git-wip-us.apache.org/repos/asf/falcon/blob/8db18628/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 a073101..a3ae17a 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
@@ -206,7 +206,7 @@ public class Bundle {
      * to unique.
      */
     public void generateUniqueBundle(Object testClassObject) {
-        generateUniqueBundle(testClassObject.getClass().getSimpleName() + '-');
+        generateUniqueBundle(testClassObject.getClass().getSimpleName());
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/falcon/blob/8db18628/falcon-regression/merlin-core/src/main/java/org/apache/falcon/regression/core/util/Util.java
----------------------------------------------------------------------
diff --git a/falcon-regression/merlin-core/src/main/java/org/apache/falcon/regression/core/util/Util.java
b/falcon-regression/merlin-core/src/main/java/org/apache/falcon/regression/core/util/Util.java
index 62e8ae1..c220215 100644
--- a/falcon-regression/merlin-core/src/main/java/org/apache/falcon/regression/core/util/Util.java
+++ b/falcon-regression/merlin-core/src/main/java/org/apache/falcon/regression/core/util/Util.java
@@ -29,6 +29,7 @@ import org.apache.falcon.entity.v0.feed.LocationType;
 import org.apache.falcon.regression.Entities.ClusterMerlin;
 import org.apache.falcon.regression.Entities.FeedMerlin;
 import org.apache.falcon.regression.Entities.ProcessMerlin;
+import org.apache.falcon.regression.core.enumsAndConstants.MerlinConstants;
 import org.apache.falcon.regression.core.helpers.ColoHelper;
 import org.apache.falcon.regression.core.helpers.entity.AbstractEntityHelper;
 import org.apache.falcon.regression.core.response.ServiceResponse;
@@ -544,4 +545,18 @@ public final class Util {
         Assert.assertNotNull(result);
         return result;
     }
+
+    /**
+     * Get prefix for test entities.
+     * @param testClass object of test class
+     * @return test class name if is_deprecate=false or 'A' and hash if is_deprecate=true
+     */
+    public static String getEntityPrefix(Object testClass) {
+        String className = testClass.getClass().getSimpleName();
+        if (MerlinConstants.IS_DEPRECATE) {
+            return 'A' + Integer.toHexString(className.hashCode());
+        } else {
+            return className;
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/falcon/blob/8db18628/falcon-regression/merlin/src/main/java/org/apache/falcon/regression/testHelper/BaseTestClass.java
----------------------------------------------------------------------
diff --git a/falcon-regression/merlin/src/main/java/org/apache/falcon/regression/testHelper/BaseTestClass.java
b/falcon-regression/merlin/src/main/java/org/apache/falcon/regression/testHelper/BaseTestClass.java
index 28dbdf3..00ef79d 100644
--- a/falcon-regression/merlin/src/main/java/org/apache/falcon/regression/testHelper/BaseTestClass.java
+++ b/falcon-regression/merlin/src/main/java/org/apache/falcon/regression/testHelper/BaseTestClass.java
@@ -114,7 +114,10 @@ public class BaseTestClass {
                 bundle.deleteBundle(prism);
             }
         }
-        CleanupUtil.cleanEntitiesWithPrefix(prism, this.getClass().getSimpleName());
+        String className = this.getClass().getSimpleName();
+        CleanupUtil.cleanEntitiesWithPrefix(prism, className);
+        String deprecatedPrefix = 'A' + Integer.toHexString(className.hashCode());
+        CleanupUtil.cleanEntitiesWithPrefix(prism, deprecatedPrefix);
     }
 
 

http://git-wip-us.apache.org/repos/asf/falcon/blob/8db18628/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/SearchApiTest.java
----------------------------------------------------------------------
diff --git a/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/SearchApiTest.java
b/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/SearchApiTest.java
index 44d362f..ee14164 100644
--- a/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/SearchApiTest.java
+++ b/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/SearchApiTest.java
@@ -26,6 +26,7 @@ import org.apache.falcon.regression.core.response.ServiceResponse;
 import org.apache.falcon.regression.core.util.AssertUtil;
 import org.apache.falcon.regression.core.util.BundleUtil;
 import org.apache.falcon.regression.core.util.OSUtil;
+import org.apache.falcon.regression.core.util.Util;
 import org.apache.falcon.regression.testHelper.BaseTestClass;
 import org.apache.falcon.resource.EntityList.EntityElement;
 import org.apache.hadoop.security.authentication.client.AuthenticationException;
@@ -60,7 +61,7 @@ public class SearchApiTest extends BaseTestClass {
     private ColoHelper cluster = servers.get(0);
     private String baseTestHDFSDir = cleanAndGetTestDir();
     private String aggregateWorkflowDir = baseTestHDFSDir + "/aggregator";
-    private final String base = getClass().getSimpleName();
+    private final String base = Util.getEntityPrefix(this);
     private static final Comparator<EntityElement> ASC = new Comparator<EntityElement>()
{
         @Override
         public int compare(EntityElement o1, EntityElement o2) {
@@ -101,7 +102,7 @@ public class SearchApiTest extends BaseTestClass {
         bundles[0] = new Bundle(bundles[0], servers.get(0));
         bundles[0].generateUniqueBundle(this);
         bundles[0].submitClusters(cluster);
-        String prefix = getClass().getSimpleName() + "-bundle";
+        String prefix = base + "-bundle";
 
         FeedMerlin basicFeed = new FeedMerlin(bundles[0].getInputFeedFromBundle());
         basicFeed.setName(prefix + "0-input-feed");

http://git-wip-us.apache.org/repos/asf/falcon/blob/8db18628/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/lineage/LineageApiTest.java
----------------------------------------------------------------------
diff --git a/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/lineage/LineageApiTest.java
b/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/lineage/LineageApiTest.java
index 5238b4e..d01b707 100644
--- a/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/lineage/LineageApiTest.java
+++ b/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/lineage/LineageApiTest.java
@@ -37,6 +37,7 @@ import org.apache.falcon.regression.core.util.AssertUtil;
 import org.apache.falcon.regression.core.util.BundleUtil;
 import org.apache.falcon.regression.core.util.Generator;
 import org.apache.falcon.regression.core.util.GraphAssert;
+import org.apache.falcon.regression.core.util.Util;
 import org.apache.falcon.regression.testHelper.BaseTestClass;
 import org.apache.http.HttpResponse;
 import org.apache.log4j.Logger;
@@ -94,7 +95,7 @@ public class LineageApiTest extends BaseTestClass {
         LOGGER.info("numOutputFeeds = " + numOutputFeeds);
         final FeedMerlin inputMerlin = new FeedMerlin(bundles[0].getInputFeedFromBundle());
         inputMerlin.setTags(TEST_TAG);
-        String namePrefix = this.getClass().getSimpleName() + '-';
+        String namePrefix = Util.getEntityPrefix(this) + '-';
         inputFeeds = generateFeeds(numInputFeeds, inputMerlin,
             Generator.getNameGenerator(namePrefix + "infeed",
                 inputMerlin.getName().replace(namePrefix, "")),

http://git-wip-us.apache.org/repos/asf/falcon/blob/8db18628/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/lineage/ProcessPipelineTest.java
----------------------------------------------------------------------
diff --git a/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/lineage/ProcessPipelineTest.java
b/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/lineage/ProcessPipelineTest.java
index 719c30b..bd4b9c2 100644
--- a/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/lineage/ProcessPipelineTest.java
+++ b/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/lineage/ProcessPipelineTest.java
@@ -24,6 +24,7 @@ import org.apache.falcon.regression.core.response.ServiceResponse;
 import org.apache.falcon.regression.core.util.AssertUtil;
 import org.apache.falcon.regression.core.util.BundleUtil;
 import org.apache.falcon.regression.core.util.OSUtil;
+import org.apache.falcon.regression.core.util.Util;
 import org.apache.falcon.regression.core.util.XmlUtil;
 import org.apache.falcon.regression.testHelper.BaseTestClass;
 import org.apache.falcon.resource.EntityList.EntityElement;
@@ -90,7 +91,7 @@ public class ProcessPipelineTest extends BaseTestClass{
             map.put(pipeline, new ArrayList<String>());
             //index for new processes for current pipeline
             for(; i < n; i++){
-                String processName = this.getClass().getSimpleName() + "-process-" + i;
+                String processName = Util.getEntityPrefix(this) + "-process-" + i;
                 bundles[0].setProcessName(processName);
                 bundles[0].setProcessPipeline(pipeline);
                 bundles[0].submitProcess(true);

http://git-wip-us.apache.org/repos/asf/falcon/blob/8db18628/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/prism/NewPrismProcessUpdateTest.java
----------------------------------------------------------------------
diff --git a/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/prism/NewPrismProcessUpdateTest.java
b/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/prism/NewPrismProcessUpdateTest.java
index a5a89d7..4946b30 100644
--- a/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/prism/NewPrismProcessUpdateTest.java
+++ b/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/prism/NewPrismProcessUpdateTest.java
@@ -376,7 +376,7 @@ public class NewPrismProcessUpdateTest extends BaseTestClass {
         TimeUtil.sleepSeconds(20);
         List<String> oldNominalTimes =
                 OozieUtil.getActionsNominalTime(cluster3OC, oldBundleId, EntityType.PROCESS);
-        bundles[1].setProcessName(this.getClass().getSimpleName() + "-myNewProcessName");
+        bundles[1].setProcessName(Util.getEntityPrefix(this) + "-myNewProcessName");
 
         //now to update
         ServiceResponse response =

http://git-wip-us.apache.org/repos/asf/falcon/blob/8db18628/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/prism/PrismFeedUpdateTest.java
----------------------------------------------------------------------
diff --git a/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/prism/PrismFeedUpdateTest.java
b/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/prism/PrismFeedUpdateTest.java
index 8fb632d..35806fd 100644
--- a/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/prism/PrismFeedUpdateTest.java
+++ b/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/prism/PrismFeedUpdateTest.java
@@ -186,7 +186,7 @@ public class PrismFeedUpdateTest extends BaseTestClass {
 
         //get 2nd process
         ProcessMerlin process02 = new ProcessMerlin(process01);
-        process02.setName(this.getClass().getSimpleName() + "-zeroInputProcess"
+        process02.setName(Util.getEntityPrefix(this) + "-zeroInputProcess"
             + new Random().nextInt());
         List<String> feed = new ArrayList<>();
         feed.add(outputFeed.toString());

http://git-wip-us.apache.org/repos/asf/falcon/blob/8db18628/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/prism/RescheduleKilledProcessTest.java
----------------------------------------------------------------------
diff --git a/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/prism/RescheduleKilledProcessTest.java
b/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/prism/RescheduleKilledProcessTest.java
index 86eeb4e..c4fa214 100644
--- a/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/prism/RescheduleKilledProcessTest.java
+++ b/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/prism/RescheduleKilledProcessTest.java
@@ -76,7 +76,7 @@ public class RescheduleKilledProcessTest extends BaseTestClass {
         String processStartTime = TimeUtil.getTimeWrtSystemTime(-11);
         String processEndTime = TimeUtil.getTimeWrtSystemTime(6);
         ProcessMerlin process = bundles[0].getProcessObject();
-        process.setName(this.getClass().getSimpleName() + "-zeroInputProcess"
+        process.setName(Util.getEntityPrefix(this) + "-zeroInputProcess"
             + new Random().nextInt());
         List<String> feed = new ArrayList<>();
         feed.add(bundles[0].getOutputFeedFromBundle());

http://git-wip-us.apache.org/repos/asf/falcon/blob/8db18628/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/searchUI/EntitiesTableTest.java
----------------------------------------------------------------------
diff --git a/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/searchUI/EntitiesTableTest.java
b/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/searchUI/EntitiesTableTest.java
index c875659..63da183 100644
--- a/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/searchUI/EntitiesTableTest.java
+++ b/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/searchUI/EntitiesTableTest.java
@@ -24,6 +24,7 @@ import org.apache.falcon.regression.core.bundle.Bundle;
 import org.apache.falcon.regression.core.util.AssertUtil;
 import org.apache.falcon.regression.core.util.BundleUtil;
 import org.apache.falcon.regression.core.util.OSUtil;
+import org.apache.falcon.regression.core.util.Util;
 import org.apache.falcon.regression.testHelper.BaseUITestClass;
 import org.apache.falcon.regression.ui.search.LoginPage;
 import org.apache.falcon.regression.ui.search.SearchPage;
@@ -136,7 +137,7 @@ public class EntitiesTableTest extends BaseUITestClass {
      */
     @Test(dataProvider = "getBoolean")
     public void testSearchBoxCleanSingleParam(boolean deleteByClick) {
-        searchPage.doSearch(this.getClass().getSimpleName() + ' ' + StringUtils.join(tags,
' '));
+        searchPage.doSearch(Util.getEntityPrefix(this) + ' ' + StringUtils.join(tags, ' '));
         for (int i = 1; i <= tags.length; i++) {
             Assert.assertEquals(searchPage.getSearchResults().size(), i,
                 "There should be " + i + " results");

http://git-wip-us.apache.org/repos/asf/falcon/blob/8db18628/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/searchUI/ProcessSetupTest.java
----------------------------------------------------------------------
diff --git a/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/searchUI/ProcessSetupTest.java
b/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/searchUI/ProcessSetupTest.java
index 0fcb50c..bda658c 100644
--- a/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/searchUI/ProcessSetupTest.java
+++ b/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/searchUI/ProcessSetupTest.java
@@ -29,6 +29,7 @@ import org.apache.falcon.regression.core.util.AssertUtil;
 import org.apache.falcon.regression.core.util.BundleUtil;
 import org.apache.falcon.regression.core.util.HadoopUtil;
 import org.apache.falcon.regression.core.util.OSUtil;
+import org.apache.falcon.regression.core.util.Util;
 import org.apache.falcon.regression.testHelper.BaseUITestClass;
 import org.apache.falcon.regression.ui.search.LoginPage;
 import org.apache.falcon.regression.ui.search.ProcessWizardPage;
@@ -450,9 +451,9 @@ public class ProcessSetupTest extends BaseUITestClass {
         List<String> dropdownValues = new ArrayList<>(processWizardPage.getClustersFromDropDown());
 
         //clean all clusters which belong to anything else then current test class
-        String testClassName = ProcessSetupTest.class.getSimpleName();
+        String entitiesPrefix = Util.getEntityPrefix(this);
         for(int i = 0; i < dropdownValues.size(); i++) {
-            if (!dropdownValues.get(i).contains(testClassName)) {
+            if (!dropdownValues.get(i).contains(entitiesPrefix)) {
                 dropdownValues.remove(i);
             }
         }

http://git-wip-us.apache.org/repos/asf/falcon/blob/8db18628/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/ui/ProcessUITest.java
----------------------------------------------------------------------
diff --git a/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/ui/ProcessUITest.java
b/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/ui/ProcessUITest.java
index 12b87f5..46db977 100644
--- a/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/ui/ProcessUITest.java
+++ b/falcon-regression/merlin/src/test/java/org/apache/falcon/regression/ui/ProcessUITest.java
@@ -135,7 +135,7 @@ public class ProcessUITest extends BaseUITestClass {
         final FeedMerlin inputMerlin = new FeedMerlin(bundles[0].getInputFeedFromBundle());
         final FeedMerlin outputMerlin = new FeedMerlin(bundles[0].getOutputFeedFromBundle());
 
-        String namePrefix = this.getClass().getSimpleName() + '-';
+        String namePrefix = Util.getEntityPrefix(this) + '-';
         inputFeeds = LineageApiTest.generateFeeds(numInputFeeds, inputMerlin,
                 Generator.getNameGenerator(namePrefix + "infeed",
                     inputMerlin.getName().replace(namePrefix, "")),


Mime
View raw message