atlas-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mad...@apache.org
Subject atlas git commit: ATLAS-1981: fix for unit test failures
Date Mon, 24 Jul 2017 08:26:48 GMT
Repository: atlas
Updated Branches:
  refs/heads/0.8-incubating 679880118 -> 8264b2a61


ATLAS-1981: fix for unit test failures

(cherry picked from commit 7fb09b0f964f4b4373c885b427359ccf58dfff26)


Project: http://git-wip-us.apache.org/repos/asf/atlas/repo
Commit: http://git-wip-us.apache.org/repos/asf/atlas/commit/8264b2a6
Tree: http://git-wip-us.apache.org/repos/asf/atlas/tree/8264b2a6
Diff: http://git-wip-us.apache.org/repos/asf/atlas/diff/8264b2a6

Branch: refs/heads/0.8-incubating
Commit: 8264b2a61f100e7e1965d2c63639a7c8e2046ddf
Parents: 6798801
Author: Madhan Neethiraj <madhan@apache.org>
Authored: Sun Jul 23 20:46:32 2017 -0700
Committer: Madhan Neethiraj <madhan@apache.org>
Committed: Mon Jul 24 01:26:29 2017 -0700

----------------------------------------------------------------------
 .../org/apache/atlas/type/AtlasStructType.java     | 17 +++++++++++++----
 .../atlas/services/EntityDiscoveryServiceTest.java | 12 ++++++------
 2 files changed, 19 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/atlas/blob/8264b2a6/intg/src/main/java/org/apache/atlas/type/AtlasStructType.java
----------------------------------------------------------------------
diff --git a/intg/src/main/java/org/apache/atlas/type/AtlasStructType.java b/intg/src/main/java/org/apache/atlas/type/AtlasStructType.java
index e73b503..878d452 100644
--- a/intg/src/main/java/org/apache/atlas/type/AtlasStructType.java
+++ b/intg/src/main/java/org/apache/atlas/type/AtlasStructType.java
@@ -35,11 +35,12 @@ import org.apache.commons.lang.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import java.util.Collection;
 import java.util.Collections;
 import java.util.HashMap;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
-import java.util.Set;
 
 /**
  * class that implements behaviour of a struct-type.
@@ -684,13 +685,21 @@ public class AtlasStructType extends AtlasType {
             return key;
         }
 
-        public static String escapeIndexQueryValue(Set<String> values) {
+        public static String escapeIndexQueryValue(Collection<String> values) {
             StringBuilder sb = new StringBuilder();
 
             sb.append(BRACE_OPEN_CHAR);
-            for (String value : values) {
-                sb.append(escapeIndexQueryValue(value)).append(SPACE_CHAR);
+
+            if (CollectionUtils.isNotEmpty(values)) {
+                Iterator<String> iter = values.iterator();
+
+                sb.append(escapeIndexQueryValue(iter.next()));
+
+                while (iter.hasNext()) {
+                    sb.append(SPACE_CHAR).append(escapeIndexQueryValue(iter.next()));
+                }
             }
+
             sb.append(BRACE_CLOSE_CHAR);
 
             return sb.toString();

http://git-wip-us.apache.org/repos/asf/atlas/blob/8264b2a6/repository/src/test/java/org/apache/atlas/services/EntityDiscoveryServiceTest.java
----------------------------------------------------------------------
diff --git a/repository/src/test/java/org/apache/atlas/services/EntityDiscoveryServiceTest.java
b/repository/src/test/java/org/apache/atlas/services/EntityDiscoveryServiceTest.java
index 597cebd..5706d26 100644
--- a/repository/src/test/java/org/apache/atlas/services/EntityDiscoveryServiceTest.java
+++ b/repository/src/test/java/org/apache/atlas/services/EntityDiscoveryServiceTest.java
@@ -50,7 +50,7 @@ public class EntityDiscoveryServiceTest {
     AtlasEntityDef typeTest3        = null;
     AtlasEntityDef typeWithSubTypes = null;
 
-    private final int maxTypesCountInIdxQuery = 10;
+    private final int maxTypesStrLengthInIdxQuery = 55;
 
     @Inject
     EntityDiscoveryService discoveryService;
@@ -81,17 +81,17 @@ public class EntityDiscoveryServiceTest {
 
     @Test
     public void getSubTypesForType_NullStringReturnsEmptyString() throws Exception {
-        invokeGetSubTypesForType(null, maxTypesCountInIdxQuery);
+        invokeGetSubTypesForType(null, maxTypesStrLengthInIdxQuery);
     }
 
     @Test
     public void getSubTypesForType_BlankStringReturnsEmptyString() throws Exception {
-        invokeGetSubTypesForType(" ", maxTypesCountInIdxQuery);
+        invokeGetSubTypesForType(" ", maxTypesStrLengthInIdxQuery);
     }
 
     @Test
     public void getSubTypesForType_EmptyStringReturnsEmptyString() throws Exception {
-        invokeGetSubTypesForType("", maxTypesCountInIdxQuery);
+        invokeGetSubTypesForType("", maxTypesStrLengthInIdxQuery);
     }
 
     @Test
@@ -103,7 +103,7 @@ public class EntityDiscoveryServiceTest {
 
     @Test
     public void getSubTypeForTypeWithSubTypes_ReturnsOrClause() throws Exception {
-        String s = invokeGetSubTypesForType(TEST_TYPE_WITH_SUB_TYPES, maxTypesCountInIdxQuery);
+        String s = invokeGetSubTypesForType(TEST_TYPE_WITH_SUB_TYPES, maxTypesStrLengthInIdxQuery);
 
         assertTrue(s.startsWith("(" + TEST_TYPE_WITH_SUB_TYPES));
         assertTrue(s.contains(" " + TEST_TYPE1));
@@ -114,7 +114,7 @@ public class EntityDiscoveryServiceTest {
 
     @Test
     public void getSubTypeForTypeWithSubTypes_ReturnsEmptyString() throws Exception {
-        String s = invokeGetSubTypesForType(TEST_TYPE_WITH_SUB_TYPES, 2);
+        String s = invokeGetSubTypesForType(TEST_TYPE_WITH_SUB_TYPES, 20);
 
         assertTrue(StringUtils.isBlank(s));
     }


Mime
View raw message