You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@atlas.apache.org by sh...@apache.org on 2015/09/22 12:10:33 UTC

incubator-atlas git commit: ATLAS-147 Fix a code issue when defineTypes (ltfxyz via shwethags)

Repository: incubator-atlas
Updated Branches:
  refs/heads/master 1bfda02a1 -> c3453f60a


ATLAS-147 Fix a code issue when defineTypes (ltfxyz via 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/c3453f60
Tree: http://git-wip-us.apache.org/repos/asf/incubator-atlas/tree/c3453f60
Diff: http://git-wip-us.apache.org/repos/asf/incubator-atlas/diff/c3453f60

Branch: refs/heads/master
Commit: c3453f60af575c7ec8e830b629280931b5e72e2d
Parents: 1bfda02
Author: Shwetha GS <ss...@hortonworks.com>
Authored: Tue Sep 22 15:40:26 2015 +0530
Committer: Shwetha GS <ss...@hortonworks.com>
Committed: Tue Sep 22 15:40:26 2015 +0530

----------------------------------------------------------------------
 release-log.txt                                 | 10 +++---
 .../atlas/typesystem/types/TypeSystem.java      |  2 +-
 .../atlas/typesystem/types/TypeSystemTest.java  | 37 ++++++++++++++++++++
 3 files changed, 42 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/c3453f60/release-log.txt
----------------------------------------------------------------------
diff --git a/release-log.txt b/release-log.txt
index 767bd20..4bebef8 100644
--- a/release-log.txt
+++ b/release-log.txt
@@ -9,14 +9,12 @@ ATLAS-54 Rename configs in hive hook (shwethags)
 ATLAS-3 Mixed Index creation fails with Date types (suma.shivaprasad via shwethags)
 
 ALL CHANGES:
+ATLAS-147 Fix a code issue when defineTypes (ltfxyz via shwethags)
 ATLAS-110 UI: Lineage should be clickable (Vishal Kadam via Venkatesh Seetharam)
-ATLAS-112 UI: Make lineage graph extensible for multiple nodes (Vishal Kadam
-via Venkatesh Seetharam)
-ATLAS-152 TimeStamp fields not showing the details tab (Vishal Kadam
-via Venkatesh Seetharam)
+ATLAS-112 UI: Make lineage graph extensible for multiple nodes (Vishal Kadam via Venkatesh Seetharam)
+ATLAS-152 TimeStamp fields not showing the details tab (Vishal Kadam via Venkatesh Seetharam)
 ATLAS-111 UI: Create Help Link (Vishal Kadam via Venkatesh Seetharam)
-ATLAS-113 Add an About Dialog to Apache Atlas UI with version number (Vishal Kadam
-via Venkatesh Seetharam)
+ATLAS-113 Add an About Dialog to Apache Atlas UI with version number (Vishal Kadam via Venkatesh Seetharam)
 ATLAS-109 Remove v2 Folder (Vishal Kadam via Venkatesh Seetharam)
 ATLAS-90 Support offline builds (Vishal Kadam via Venkatesh Seetharam)
 ATLAS-154 Update website for 0.5-incubating release (Venkatesh Seetharam)

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/c3453f60/typesystem/src/main/java/org/apache/atlas/typesystem/types/TypeSystem.java
----------------------------------------------------------------------
diff --git a/typesystem/src/main/java/org/apache/atlas/typesystem/types/TypeSystem.java b/typesystem/src/main/java/org/apache/atlas/typesystem/types/TypeSystem.java
index b03b780..a6367b1 100755
--- a/typesystem/src/main/java/org/apache/atlas/typesystem/types/TypeSystem.java
+++ b/typesystem/src/main/java/org/apache/atlas/typesystem/types/TypeSystem.java
@@ -516,7 +516,7 @@ public class TypeSystem {
 
             for (StructTypeDefinition structDef : structDefs) {
                 constructStructureType(structDef);
-                typeCategoriesToTypeNamesMap.put(DataTypes.TypeCategory.CLASS, structDef.typeName);
+                typeCategoriesToTypeNamesMap.put(DataTypes.TypeCategory.STRUCT, structDef.typeName);
             }
 
             for (TraitType traitType : traitTypes) {

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/c3453f60/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 cedfa0b..eb472e9 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
@@ -139,4 +139,41 @@ public class TypeSystemTest extends BaseTest {
         Assert.assertTrue(bc.compareTo(cc) < 0);
         Assert.assertTrue(ac.compareTo(cc) < 0);
     }
+
+    @Test
+    public void testTypeCategory() throws AtlasException {
+        TypeSystem ts = getTypeSystem();
+        ts.reset();
+
+        StructTypeDefinition struct_A = createStructTypeDef("struct_A", createRequiredAttrDef("s_A", DataTypes.STRING_TYPE));
+        StructTypeDefinition struct_B = createStructTypeDef("struct_B", createRequiredAttrDef("s_B", DataTypes.STRING_TYPE));
+
+        HierarchicalTypeDefinition<TraitType> trait_A = createTraitTypeDef("trait_A", null,
+                createRequiredAttrDef("t_A", DataTypes.STRING_TYPE));
+        HierarchicalTypeDefinition<TraitType> trait_B = createTraitTypeDef("trait_B", ImmutableList.<String>of("trait_A"),
+                createRequiredAttrDef("t_B", DataTypes.STRING_TYPE));
+        HierarchicalTypeDefinition<TraitType> trait_C = createTraitTypeDef("trait_C", ImmutableList.<String>of("trait_A"),
+                createRequiredAttrDef("t_C", DataTypes.STRING_TYPE));
+        HierarchicalTypeDefinition<TraitType> trait_D = createTraitTypeDef("trait_D", ImmutableList.<String>of("trait_B", "trait_C"),
+                createRequiredAttrDef("t_D", DataTypes.STRING_TYPE));
+
+        HierarchicalTypeDefinition<ClassType> class_A = createClassTypeDef("class_A", null,
+                createRequiredAttrDef("c_A", DataTypes.STRING_TYPE));
+        HierarchicalTypeDefinition<ClassType> class_B = createClassTypeDef("class_B", ImmutableList.<String>of("class_A"),
+                createRequiredAttrDef("c_B", DataTypes.STRING_TYPE));
+        HierarchicalTypeDefinition<ClassType> class_C = createClassTypeDef("class_C", ImmutableList.<String>of("class_B"),
+                createRequiredAttrDef("c_C", DataTypes.STRING_TYPE));
+
+        ts.defineTypes(ImmutableList.<EnumTypeDefinition>of(), ImmutableList.of(struct_A, struct_B),
+                ImmutableList.of(trait_A, trait_B, trait_C, trait_D),
+                ImmutableList.of(class_A, class_B, class_C));
+
+        final ImmutableList<String> structNames = ts.getTypeNamesByCategory(DataTypes.TypeCategory.STRUCT);
+        final ImmutableList<String> traitNames = ts.getTypeNamesByCategory(DataTypes.TypeCategory.TRAIT);
+        final ImmutableList<String> classNames = ts.getTypeNamesByCategory(DataTypes.TypeCategory.CLASS);
+
+        Assert.assertEquals(structNames.size(), 2);
+        Assert.assertEquals(traitNames.size(), 4);
+        Assert.assertEquals(classNames.size(), 3);
+    }
 }