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:25:57 GMT
Repository: atlas
Updated Branches:
  refs/heads/master de251913c -> 7fb09b0f9


ATLAS-1981: fix for unit test failures


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

Branch: refs/heads/master
Commit: 7fb09b0f964f4b4373c885b427359ccf58dfff26
Parents: de25191
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 00:48:25 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/7fb09b0f/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 049a537..9e263d7 100644
--- a/intg/src/main/java/org/apache/atlas/type/AtlasStructType.java
+++ b/intg/src/main/java/org/apache/atlas/type/AtlasStructType.java
@@ -34,11 +34,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.
@@ -714,13 +715,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/7fb09b0f/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 dfb2ee2..5a0739c 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("("));
         assertTrue(s.contains(TEST_TYPE_WITH_SUB_TYPES));
@@ -115,7 +115,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