atlas-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shweth...@apache.org
Subject incubator-atlas git commit: ATLAS-33 Atlas restart fails (shwethags)
Date Mon, 22 Jun 2015 08:29:09 GMT
Repository: incubator-atlas
Updated Branches:
  refs/heads/master 155554e66 -> 883251c0d


ATLAS-33 Atlas restart fails (shwethags)


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

Branch: refs/heads/master
Commit: 883251c0da0c27d179c837bcb891bd0f0dbaf11c
Parents: 155554e
Author: Shwetha GS <sshivalingamurthy@hortonworks.com>
Authored: Mon Jun 22 13:59:00 2015 +0530
Committer: Shwetha GS <sshivalingamurthy@hortonworks.com>
Committed: Mon Jun 22 13:59:00 2015 +0530

----------------------------------------------------------------------
 release-log.txt                                 |  2 +-
 .../typesystem/types/HierarchicalType.java      | 16 ++++++++++------
 .../atlas/typesystem/types/TypeSystemTest.java  | 20 ++++++++++++++++++++
 3 files changed, 31 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/883251c0/release-log.txt
----------------------------------------------------------------------
diff --git a/release-log.txt b/release-log.txt
index 150dde2..d49b359 100644
--- a/release-log.txt
+++ b/release-log.txt
@@ -6,13 +6,13 @@ Apache Atlas Release Notes
 INCOMPATIBLE CHANGES:
 
 ALL CHANGES:
+ATLAS-33 Atlas restart fails (shwethags)
 ATLAS-10 Update trunk version to 0.6-incubating-SNAPSHOT (shwethags)
 
 
 --Release 0.5-incubating
 
 ALL CHANGES:
-
 ATLAS-26 Minor issues with release prep (Venkatesh Seetharam)
 ATLAS-17 Parameterize schema API query per typeName (shwethags)
 ATLAS-13 Add project website (Venkatesh Seetharam)

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/883251c0/typesystem/src/main/java/org/apache/atlas/typesystem/types/HierarchicalType.java
----------------------------------------------------------------------
diff --git a/typesystem/src/main/java/org/apache/atlas/typesystem/types/HierarchicalType.java
b/typesystem/src/main/java/org/apache/atlas/typesystem/types/HierarchicalType.java
index 80c6c01..5bb04c6 100755
--- a/typesystem/src/main/java/org/apache/atlas/typesystem/types/HierarchicalType.java
+++ b/typesystem/src/main/java/org/apache/atlas/typesystem/types/HierarchicalType.java
@@ -340,12 +340,16 @@ public abstract class HierarchicalType<ST extends HierarchicalType,
T> extends A
     @Override
     public int compareTo(ST o) {
         String oName = o.getName();
-        if (superTypes.contains(oName)) {
-            return 1;
-        } else if (o.superTypes.contains(getName())) {
-            return -1;
-        } else {
-            return getName().compareTo(oName);
+        try {
+            if (o.isSubType(getName())) {
+                return 1;
+            } else if (isSubType(oName)) {
+                return -1;
+            } else {
+                return getName().compareTo(oName);
+            }
+        } catch(AtlasException e) {
+            throw new RuntimeException(e);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/883251c0/typesystem/src/test/java/org/apache/atlas/typesystem/types/TypeSystemTest.java
----------------------------------------------------------------------
diff --git a/typesystem/src/test/java/org/apache/atlas/typesystem/types/TypeSystemTest.java
b/typesystem/src/test/java/org/apache/atlas/typesystem/types/TypeSystemTest.java
index 5c63ec6..e8bbb0c 100755
--- a/typesystem/src/test/java/org/apache/atlas/typesystem/types/TypeSystemTest.java
+++ b/typesystem/src/test/java/org/apache/atlas/typesystem/types/TypeSystemTest.java
@@ -19,6 +19,7 @@
 package org.apache.atlas.typesystem.types;
 
 import com.google.common.collect.ImmutableList;
+import org.apache.atlas.AtlasException;
 import org.apache.atlas.typesystem.types.utils.TypesUtil;
 import org.apache.commons.lang3.RandomStringUtils;
 import org.testng.Assert;
@@ -118,4 +119,23 @@ public class TypeSystemTest extends BaseTest {
 
         ts.defineTypes(ImmutableList.of(structType), ImmutableList.of(traitType), ImmutableList.of(classType));
     }
+
+    @Test
+    public void testHierarchy() throws AtlasException {
+        HierarchicalTypeDefinition<ClassType> a = TypesUtil.createClassTypeDef("a",
ImmutableList.<String>of());
+        HierarchicalTypeDefinition<ClassType> b = TypesUtil.createClassTypeDef("B",
ImmutableList.of("a"));
+        HierarchicalTypeDefinition<ClassType> c = TypesUtil.createClassTypeDef("C",
ImmutableList.of("B"));
+
+        TypeSystem ts = getTypeSystem();
+        ts.defineTypes(ImmutableList.<StructTypeDefinition>of(),
+                ImmutableList.<HierarchicalTypeDefinition<TraitType>>of(),
+                ImmutableList.of(a, b, c));
+        ClassType ac = ts.getDataType(ClassType.class, "a");
+        ClassType bc = ts.getDataType(ClassType.class, "B");
+        ClassType cc = ts.getDataType(ClassType.class, "C");
+
+        Assert.assertTrue(ac.compareTo(bc) < 0);
+        Assert.assertTrue(bc.compareTo(cc) < 0);
+        Assert.assertTrue(ac.compareTo(cc) < 0);
+    }
 }


Mime
View raw message