falcon-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From samar...@apache.org
Subject falcon git commit: FALCON-1145 Changing entity name if it exceeds defined length. Contributed by Pragya M
Date Wed, 15 Apr 2015 09:06:01 GMT
Repository: falcon
Updated Branches:
  refs/heads/master d0c9850e5 -> 311baa903


FALCON-1145 Changing entity name if it exceeds defined length. Contributed by Pragya M


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

Branch: refs/heads/master
Commit: 311baa9038964d3e2cc84929fada3686716faf08
Parents: d0c9850
Author: samarthg <samarthg@apacge.org>
Authored: Wed Apr 15 14:33:32 2015 +0530
Committer: samarthg <samarthg@apacge.org>
Committed: Wed Apr 15 14:33:32 2015 +0530

----------------------------------------------------------------------
 falcon-regression/CHANGES.txt                        |  3 +++
 .../falcon/regression/Entities/TestEntityUtil.java   | 15 +++++++++++++--
 .../core/enumsAndConstants/MerlinConstants.java      |  3 +++
 3 files changed, 19 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/falcon/blob/311baa90/falcon-regression/CHANGES.txt
----------------------------------------------------------------------
diff --git a/falcon-regression/CHANGES.txt b/falcon-regression/CHANGES.txt
index 492814b..419b143 100644
--- a/falcon-regression/CHANGES.txt
+++ b/falcon-regression/CHANGES.txt
@@ -63,6 +63,9 @@ Trunk (Unreleased)
    via Samarth Gupta)
 
   IMPROVEMENTS
+   
+   FALCON-1145 Changing entity name if it exceeds defined length(Pragya M via Samarth G)
+
    FALCON-1151 Migrate oozie related methods from InstanceUtil.java to OozieUtil.java
    (Paul Isaychuk via Ruslan Ostafiychuk)
 

http://git-wip-us.apache.org/repos/asf/falcon/blob/311baa90/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 d597073..fa30f13 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
@@ -20,6 +20,8 @@ package org.apache.falcon.regression.Entities;
 
 import org.apache.falcon.entity.v0.Entity;
 import org.apache.falcon.entity.v0.EntityType;
+import org.apache.falcon.regression.core.enumsAndConstants.MerlinConstants;
+import org.apache.log4j.Logger;
 import org.testng.Assert;
 
 import javax.xml.bind.Unmarshaller;
@@ -31,6 +33,7 @@ import java.util.UUID;
  */
 final class TestEntityUtil {
 
+    private static final Logger LOGGER = Logger.getLogger(TestEntityUtil.class);
     private TestEntityUtil() {
         throw new AssertionError("Instantiating utility class...");
     }
@@ -45,9 +48,17 @@ final class TestEntityUtil {
         }
     }
 
+    /*
+    Deprecating entity name if its length >= 30 and 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!");
-        return prefix + '-' + oldName + '-' + UUID.randomUUID().toString().split("-")[0];
+        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];
+        }
+        return name;
     }
-
 }

http://git-wip-us.apache.org/repos/asf/falcon/blob/311baa90/falcon-regression/merlin-core/src/main/java/org/apache/falcon/regression/core/enumsAndConstants/MerlinConstants.java
----------------------------------------------------------------------
diff --git a/falcon-regression/merlin-core/src/main/java/org/apache/falcon/regression/core/enumsAndConstants/MerlinConstants.java
b/falcon-regression/merlin-core/src/main/java/org/apache/falcon/regression/core/enumsAndConstants/MerlinConstants.java
index 0323fbc..7654c52 100644
--- a/falcon-regression/merlin-core/src/main/java/org/apache/falcon/regression/core/enumsAndConstants/MerlinConstants.java
+++ b/falcon-regression/merlin-core/src/main/java/org/apache/falcon/regression/core/enumsAndConstants/MerlinConstants.java
@@ -85,6 +85,9 @@ public final class MerlinConstants {
     public static final boolean CLEAN_TESTS_DIR =
         Boolean.valueOf(Config.getProperty("clean_tests_dir", "true"));
 
+    public static final boolean IS_DEPRECATE=
+            Boolean.valueOf(Config.getProperty("is_deprecate", "false"));
+
     /* initialize keyTabMap */
     static {
         final String currentUserKeytab = Config.getProperty(CURRENT_USER_KEYTAB_STR);


Mime
View raw message