You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@atlas.apache.org by ma...@apache.org on 2017/11/05 20:31:27 UTC

[05/40] atlas git commit: ATLAS-2251: Remove TypeSystem and related implementation, to avoid unncessary duplicate of type details in cache

http://git-wip-us.apache.org/repos/asf/atlas/blob/0877e47c/typesystem/src/test/java/org/apache/atlas/typesystem/types/EnumTest.java
----------------------------------------------------------------------
diff --git a/typesystem/src/test/java/org/apache/atlas/typesystem/types/EnumTest.java b/typesystem/src/test/java/org/apache/atlas/typesystem/types/EnumTest.java
deleted file mode 100755
index 2307192..0000000
--- a/typesystem/src/test/java/org/apache/atlas/typesystem/types/EnumTest.java
+++ /dev/null
@@ -1,245 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.atlas.typesystem.types;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
-
-import org.apache.atlas.AtlasException;
-import org.apache.atlas.typesystem.IReferenceableInstance;
-import org.apache.atlas.typesystem.ITypedReferenceableInstance;
-import org.apache.atlas.typesystem.ITypedStruct;
-import org.apache.atlas.typesystem.Referenceable;
-import org.apache.atlas.typesystem.Struct;
-import org.apache.atlas.typesystem.TypesDef;
-import org.apache.atlas.typesystem.types.utils.TypesUtil;
-import org.testng.Assert;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
-
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import java.util.Date;
-import java.util.Map;
-
-import static org.apache.atlas.typesystem.types.utils.TypesUtil.createClassTypeDef;
-import static org.apache.atlas.typesystem.types.utils.TypesUtil.createOptionalAttrDef;
-import static org.apache.atlas.typesystem.types.utils.TypesUtil.createRequiredAttrDef;
-
-public class EnumTest extends BaseTest {
-
-    @BeforeMethod
-    public void setup() throws Exception {
-        super.setup();
-    }
-
-    void defineEnums(TypeSystem ts) throws AtlasException {
-        ts.defineEnumType("HiveObjectType", new EnumValue("GLOBAL", 1), new EnumValue("DATABASE", 2),
-                new EnumValue("TABLE", 3), new EnumValue("PARTITION", 4), new EnumValue("COLUMN", 5));
-
-        ts.defineEnumType("PrincipalType", new EnumValue("USER", 1), new EnumValue("ROLE", 2),
-                new EnumValue("GROUP", 3));
-
-        ts.defineEnumType("TxnState", new EnumValue("COMMITTED", 1), new EnumValue("ABORTED", 2),
-                new EnumValue("OPEN", 3));
-
-        ts.defineEnumType("LockLevel", new EnumValue("DB", 1), new EnumValue("TABLE", 2),
-                new EnumValue("PARTITION", 3));
-    }
-
-    @Test
-    public void testTypeUpdate() throws Exception {
-        TypeSystem ts = getTypeSystem();
-        EnumTypeDefinition etd = new EnumTypeDefinition(newName(), new EnumValue("A", 1));
-        TypesDef typesDef = getTypesDef(etd);
-        ts.defineTypes(typesDef);
-
-        //Allow adding new enum
-        etd = new EnumTypeDefinition(etd.name, new EnumValue("A", 1), new EnumValue("B", 2));
-        typesDef = getTypesDef(etd);
-        ts.updateTypes(typesDef);
-
-        //Don't allow deleting enum
-        etd = new EnumTypeDefinition(etd.name, new EnumValue("A", 1));
-        typesDef = getTypesDef(etd);
-        try {
-            ts.updateTypes(typesDef);
-            Assert.fail("Expected TypeUpdateException");
-        } catch (TypeUpdateException e) {
-            //assert that type is not updated when validation fails
-            EnumType enumType = ts.getDataType(EnumType.class, etd.name);
-            Assert.assertEquals(enumType.values().size(), 2);
-        }
-
-        //Don't allow changing ordinal of existing enum value
-        etd = new EnumTypeDefinition(etd.name, new EnumValue("A", 2));
-        typesDef = getTypesDef(etd);
-        try {
-            ts.updateTypes(typesDef);
-            Assert.fail("Expected TypeUpdateException");
-        } catch (TypeUpdateException e) {
-            //expected
-        }
-    }
-
-    private TypesDef getTypesDef(EnumTypeDefinition enumTypeDefinition) {
-        return TypesUtil.getTypesDef(ImmutableList.of(enumTypeDefinition), ImmutableList.<StructTypeDefinition>of(),
-                ImmutableList.<HierarchicalTypeDefinition<TraitType>>of(),
-                ImmutableList.<HierarchicalTypeDefinition<ClassType>>of());
-    }
-
-    protected void fillStruct(Struct s) throws AtlasException {
-        s.set("a", 1);
-        s.set("b", true);
-        s.set("c", (byte) 1);
-        s.set("d", (short) 2);
-        s.set("e", 1);
-        s.set("f", 1);
-        s.set("g", 1L);
-        s.set("h", 1.0f);
-        s.set("i", 1.0);
-        s.set("j", BigInteger.valueOf(1L));
-        s.set("k", new BigDecimal(1));
-        s.set("l", new Date(1418265358440L));
-        s.set("m", Lists.asList(1, new Integer[]{1}));
-        s.set("n", Lists.asList(BigDecimal.valueOf(1.1), new BigDecimal[]{BigDecimal.valueOf(1.1)}));
-        Map<String, Double> hm = Maps.newHashMap();
-        hm.put("a", 1.0);
-        hm.put("b", 2.0);
-        s.set("o", hm);
-        s.set("enum1", "GLOBAL");
-        s.set("enum2", 1);
-        s.set("enum3", "COMMITTED");
-        s.set("enum4", 3);
-    }
-
-    protected Struct createStructWithEnum(String typeName) throws AtlasException {
-        Struct s = new Struct(typeName);
-        fillStruct(s);
-        return s;
-    }
-
-    protected Referenceable createInstanceWithEnum(String typeName) throws AtlasException {
-        Referenceable r = new Referenceable(typeName);
-        fillStruct(r);
-        return r;
-    }
-
-    protected ClassType defineClassTypeWithEnum(TypeSystem ts) throws AtlasException {
-        return ts.defineClassType(
-                createClassTypeDef("t4", ImmutableSet.<String>of(), createRequiredAttrDef("a", DataTypes.INT_TYPE),
-                        createOptionalAttrDef("b", DataTypes.BOOLEAN_TYPE),
-                        createOptionalAttrDef("c", DataTypes.BYTE_TYPE),
-                        createOptionalAttrDef("d", DataTypes.SHORT_TYPE),
-                        createOptionalAttrDef("enum1", ts.getDataType(EnumType.class, "HiveObjectType")),
-                        createOptionalAttrDef("e", DataTypes.INT_TYPE), createOptionalAttrDef("f", DataTypes.INT_TYPE),
-                        createOptionalAttrDef("g", DataTypes.LONG_TYPE),
-                        createOptionalAttrDef("enum2", ts.getDataType(EnumType.class, "PrincipalType")),
-                        createOptionalAttrDef("h", DataTypes.FLOAT_TYPE),
-                        createOptionalAttrDef("i", DataTypes.DOUBLE_TYPE),
-                        createOptionalAttrDef("j", DataTypes.BIGINTEGER_TYPE),
-                        createOptionalAttrDef("k", DataTypes.BIGDECIMAL_TYPE),
-                        createOptionalAttrDef("enum3", ts.getDataType(EnumType.class, "TxnState")),
-                        createOptionalAttrDef("l", DataTypes.DATE_TYPE),
-                        createOptionalAttrDef("m", ts.defineArrayType(DataTypes.INT_TYPE)),
-                        createOptionalAttrDef("n", ts.defineArrayType(DataTypes.BIGDECIMAL_TYPE)),
-                        createOptionalAttrDef("o", ts.defineMapType(DataTypes.STRING_TYPE, DataTypes.DOUBLE_TYPE)),
-                        createOptionalAttrDef("enum4", ts.getDataType(EnumType.class, "LockLevel"))));
-    }
-
-    @Test
-    public void testStruct() throws AtlasException {
-        TypeSystem ts = getTypeSystem();
-        defineEnums(ts);
-        StructType structType = ts.defineStructType("ts", true, createRequiredAttrDef("a", DataTypes.INT_TYPE),
-                createOptionalAttrDef("b", DataTypes.BOOLEAN_TYPE), createOptionalAttrDef("c", DataTypes.BYTE_TYPE),
-                createOptionalAttrDef("d", DataTypes.SHORT_TYPE),
-                createOptionalAttrDef("enum1", ts.getDataType(EnumType.class, "HiveObjectType")),
-                createOptionalAttrDef("e", DataTypes.INT_TYPE), createOptionalAttrDef("f", DataTypes.INT_TYPE),
-                createOptionalAttrDef("g", DataTypes.LONG_TYPE),
-                createOptionalAttrDef("enum2", ts.getDataType(EnumType.class, "PrincipalType")),
-                createOptionalAttrDef("h", DataTypes.FLOAT_TYPE), createOptionalAttrDef("i", DataTypes.DOUBLE_TYPE),
-                createOptionalAttrDef("j", DataTypes.BIGINTEGER_TYPE),
-                createOptionalAttrDef("k", DataTypes.BIGDECIMAL_TYPE),
-                createOptionalAttrDef("enum3", ts.getDataType(EnumType.class, "TxnState")),
-                createOptionalAttrDef("l", DataTypes.DATE_TYPE),
-                createOptionalAttrDef("m", ts.defineArrayType(DataTypes.INT_TYPE)),
-                createOptionalAttrDef("n", ts.defineArrayType(DataTypes.BIGDECIMAL_TYPE)),
-                createOptionalAttrDef("o", ts.defineMapType(DataTypes.STRING_TYPE, DataTypes.DOUBLE_TYPE)),
-                createOptionalAttrDef("enum4", ts.getDataType(EnumType.class, "LockLevel")));
-
-        Struct s = createStructWithEnum("ts");
-        ITypedStruct typedS = structType.convert(s, Multiplicity.REQUIRED);
-        Assert.assertEquals(typedS.toString(), "{\n" +
-                "\ta : \t1\n" +
-                "\tb : \ttrue\n" +
-                "\tc : \t1\n" +
-                "\td : \t2\n" +
-                "\tenum1 : \tGLOBAL\n" +
-                "\te : \t1\n" +
-                "\tf : \t1\n" +
-                "\tg : \t1\n" +
-                "\tenum2 : \tUSER\n" +
-                "\th : \t1.0\n" +
-                "\ti : \t1.0\n" +
-                "\tj : \t1\n" +
-                "\tk : \t1\n" +
-                "\tenum3 : \tCOMMITTED\n" +
-                "\tl : \t" + TEST_DATE + "\n" +
-                "\tm : \t[1, 1]\n" +
-                "\tn : \t[1.1, 1.1]\n" +
-                "\to : \t{a=1.0, b=2.0}\n" +
-                "\tenum4 : \tPARTITION\n" +
-                "}");
-    }
-
-    @Test
-    public void testClass() throws AtlasException {
-        TypeSystem ts = getTypeSystem();
-        defineEnums(ts);
-        ClassType clsType = defineClassTypeWithEnum(ts);
-
-        IReferenceableInstance r = createInstanceWithEnum("t4");
-        ITypedReferenceableInstance typedR = clsType.convert(r, Multiplicity.REQUIRED);
-        Assert.assertEquals(typedR.toString(), "{\n" +
-                "\tid : (type: t4, id: <unassigned>)\n" +
-                "\ta : \t1\n" +
-                "\tb : \ttrue\n" +
-                "\tc : \t1\n" +
-                "\td : \t2\n" +
-                "\tenum1 : \tGLOBAL\n" +
-                "\te : \t1\n" +
-                "\tf : \t1\n" +
-                "\tg : \t1\n" +
-                "\tenum2 : \tUSER\n" +
-                "\th : \t1.0\n" +
-                "\ti : \t1.0\n" +
-                "\tj : \t1\n" +
-                "\tk : \t1\n" +
-                "\tenum3 : \tCOMMITTED\n" +
-                "\tl : \t" + TEST_DATE + "\n" +
-                "\tm : \t[1, 1]\n" +
-                "\tn : \t[1.1, 1.1]\n" +
-                "\to : \t{a=1.0, b=2.0}\n" +
-                "\tenum4 : \tPARTITION\n" +
-                "}");
-    }
-}

http://git-wip-us.apache.org/repos/asf/atlas/blob/0877e47c/typesystem/src/test/java/org/apache/atlas/typesystem/types/FieldMappingTest.java
----------------------------------------------------------------------
diff --git a/typesystem/src/test/java/org/apache/atlas/typesystem/types/FieldMappingTest.java b/typesystem/src/test/java/org/apache/atlas/typesystem/types/FieldMappingTest.java
deleted file mode 100644
index 0259ade..0000000
--- a/typesystem/src/test/java/org/apache/atlas/typesystem/types/FieldMappingTest.java
+++ /dev/null
@@ -1,151 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.atlas.typesystem.types;
-
-import java.util.HashSet;
-
-import org.apache.atlas.typesystem.IReferenceableInstance;
-import org.apache.atlas.typesystem.ITypedReferenceableInstance;
-import org.apache.atlas.typesystem.ITypedStruct;
-import org.apache.atlas.typesystem.TypesDef;
-import org.apache.atlas.typesystem.types.AttributeDefinition;
-import org.apache.atlas.typesystem.types.ClassType;
-import org.apache.atlas.typesystem.types.EnumTypeDefinition;
-import org.apache.atlas.typesystem.types.HierarchicalTypeDefinition;
-import org.apache.atlas.typesystem.types.Multiplicity;
-import org.apache.atlas.typesystem.types.StructTypeDefinition;
-import org.apache.atlas.typesystem.types.TraitType;
-import org.apache.atlas.typesystem.types.TypeSystem;
-import org.apache.atlas.typesystem.types.utils.TypesUtil;
-import org.testng.Assert;
-import org.testng.annotations.BeforeTest;
-import org.testng.annotations.Test;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableSet;
-
-
-/**
- * Unit test for {@link FieldMapping}
- *
- */
-public class FieldMappingTest {
-
-    @BeforeTest
-    public void beforeTest() throws Exception {
-        TypeSystem typeSystem = TypeSystem.getInstance();
-        typeSystem.reset();
-    }
-
-    @Test
-    public void testOutputReferenceableInstance() throws Exception {
-        // ATLAS-645: verify that FieldMapping.output(IReferenceableInstance)
-        // does not infinitely recurse when ITypedReferenceableInstance's reference each other.
-        HierarchicalTypeDefinition<ClassType> valueDef = TypesUtil.createClassTypeDef("Value",
-            ImmutableSet.<String>of(),
-            new AttributeDefinition("owner", "Owner", Multiplicity.OPTIONAL, false, null));
-
-        // Define class type with reference, where the value is a class reference to Value.
-        HierarchicalTypeDefinition<ClassType> ownerDef = TypesUtil.createClassTypeDef("Owner",
-            ImmutableSet.<String>of(),
-            new AttributeDefinition("value", "Value", Multiplicity.OPTIONAL, false, null));
-        TypesDef typesDef = TypesUtil.getTypesDef(ImmutableList.<EnumTypeDefinition>of(),
-            ImmutableList.<StructTypeDefinition>of(), ImmutableList.<HierarchicalTypeDefinition<TraitType>>of(),
-            ImmutableList.of(ownerDef, valueDef));
-
-        TypeSystem typeSystem = TypeSystem.getInstance();
-        typeSystem.defineTypes(typesDef);
-        ClassType ownerType = typeSystem.getDataType(ClassType.class, "Owner");
-
-        // Prior to fix for ATLAS-645, this call would throw a StackOverflowError
-        try {
-            ownerType.toString();
-        }
-        catch (StackOverflowError e) {
-            Assert.fail("Infinite recursion in ClassType.toString() caused StackOverflowError");
-        }
-
-        ClassType valueType = typeSystem.getDataType(ClassType.class, "Value");
-
-        // Create instances of Owner and Value that reference each other.
-        ITypedReferenceableInstance ownerInstance = ownerType.createInstance();
-        ITypedReferenceableInstance valueInstance = valueType.createInstance();
-        // Set Owner.value reference to Value instance.
-        ownerInstance.set("value", valueInstance);
-        // Set Value.owner reference on Owner instance.
-        valueInstance.set("owner", ownerInstance);
-
-        // Prior to fix for ATLAS-645, this call would throw a StackOverflowError
-        try {
-            ownerInstance.fieldMapping().output(ownerInstance, new StringBuilder(), "", new HashSet<IReferenceableInstance>());
-        }
-        catch (StackOverflowError e) {
-            Assert.fail("Infinite recursion in FieldMapping.output() caused StackOverflowError");
-        }
-    }
-
-    @Test
-    public void testOutputStruct() throws Exception {
-        // ATLAS-645: verify that FieldMapping.output(IStruct) does not infinitely recurse
-        // when an IStruct and ITypedReferenceableInstance reference each other.
-        HierarchicalTypeDefinition<ClassType> valueDef = TypesUtil.createClassTypeDef("Value",
-            ImmutableSet.<String>of(),
-            new AttributeDefinition("owner", "Owner", Multiplicity.OPTIONAL, false, null));
-
-
-        // Define struct type with reference, where the value is a class reference to Value.
-        StructTypeDefinition ownerDef = TypesUtil.createStructTypeDef("Owner",
-             new AttributeDefinition("value", "Value", Multiplicity.OPTIONAL, false, null));
-
-        TypesDef typesDef = TypesUtil.getTypesDef(ImmutableList.<EnumTypeDefinition>of(),
-            ImmutableList.of(ownerDef), ImmutableList.<HierarchicalTypeDefinition<TraitType>>of(),
-            ImmutableList.of(valueDef));
-
-        TypeSystem typeSystem = TypeSystem.getInstance();
-        typeSystem.reset();
-        typeSystem.defineTypes(typesDef);
-        StructType ownerType = typeSystem.getDataType(StructType.class, "Owner");
-        ClassType valueType = typeSystem.getDataType(ClassType.class, "Value");
-
-        // Prior to fix for ATLAS-645, this call would throw a StackOverflowError
-        try {
-            ownerType.toString();
-        }
-        catch (StackOverflowError e) {
-            Assert.fail("Infinite recursion in StructType.toString() caused StackOverflowError");
-        }
-
-
-        // Create instances of Owner and Value that reference each other.
-        ITypedStruct ownerInstance = ownerType.createInstance();
-        ITypedReferenceableInstance valueInstance = valueType.createInstance();
-        // Set Owner.value reference to Value instance.
-        ownerInstance.set("value", valueInstance);
-        // Set Value.owner reference on Owner instance.
-        valueInstance.set("owner", ownerInstance);
-
-        // Prior to fix for ATLAS-645, this call would throw a StackOverflowError
-        try {
-            ownerInstance.fieldMapping().output(ownerInstance, new StringBuilder(), "", null);
-        }
-        catch (StackOverflowError e) {
-            Assert.fail("Infinite recursion in FieldMapping.output() caused StackOverflowError");
-        }
-
-    }
-}

http://git-wip-us.apache.org/repos/asf/atlas/blob/0877e47c/typesystem/src/test/java/org/apache/atlas/typesystem/types/HierarchicalTypeDependencySorterTest.java
----------------------------------------------------------------------
diff --git a/typesystem/src/test/java/org/apache/atlas/typesystem/types/HierarchicalTypeDependencySorterTest.java b/typesystem/src/test/java/org/apache/atlas/typesystem/types/HierarchicalTypeDependencySorterTest.java
deleted file mode 100644
index 19bdccf..0000000
--- a/typesystem/src/test/java/org/apache/atlas/typesystem/types/HierarchicalTypeDependencySorterTest.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.atlas.typesystem.types;
-
-import java.util.Arrays;
-import java.util.List;
-
-import org.apache.atlas.AtlasException;
-import org.testng.Assert;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
-
-import com.google.common.collect.ImmutableSet;
-
-
-public class HierarchicalTypeDependencySorterTest {
-
-    @BeforeMethod
-    public void setup() throws Exception {
-        TypeSystem ts = TypeSystem.getInstance();
-        ts.reset();
-    }
-    
-    @SuppressWarnings("rawtypes")
-    @Test
-    public void testSimpleModel() throws AtlasException {
-        TypeSystem ts = TypeSystem.getInstance();
-        HierarchicalType a = new ClassType(ts, "a", null, ImmutableSet.<String>of(), 0);
-        HierarchicalType b = new ClassType(ts, "B", null, ImmutableSet.of("a"), 0);
-        HierarchicalType c = new ClassType(ts, "C", null, ImmutableSet.of("B"), 0);
-
-        List<HierarchicalType> unsortedTypes = Arrays.asList(c, a, b);
-        List<HierarchicalType> sortedTypes = HierarchicalTypeDependencySorter.sortTypes(unsortedTypes);
-        Assert.assertEquals(sortedTypes.size(), 3);
-        Assert.assertEquals(sortedTypes.indexOf(a), 0);
-        Assert.assertEquals(sortedTypes.indexOf(b), 1);
-        Assert.assertEquals(sortedTypes.indexOf(c), 2);
-    }
-
-    @SuppressWarnings("rawtypes")
-    @Test
-    public void testLargerModel() throws Exception {
-        TypeSystem ts = TypeSystem.getInstance();
-        HierarchicalType testObjectType = new ClassType(ts, "TestObject", null, ImmutableSet.<String>of(), 0);
-        HierarchicalType testDataSetType = new ClassType(ts, "TestDataSet", null, ImmutableSet.of("TestObject"), 0);
-        HierarchicalType testColumnType = new ClassType(ts, "TestColumn", null, ImmutableSet.of("TestObject"), 0);
-        HierarchicalType testRelationalDataSetType = new ClassType(ts, "TestRelationalDataSet", null, ImmutableSet.of("TestDataSet"), 0);
-        HierarchicalType testTableType = new ClassType(ts, "Table", null, ImmutableSet.of("TestDataSet"), 0);
-        HierarchicalType testDataFileType = new ClassType(ts, "TestDataFile", null, ImmutableSet.of("TestRelationalDataSet"), 0);
-        HierarchicalType testDocumentType = new ClassType(ts, "TestDocument", null, ImmutableSet.of("TestDataSet"), 0);
-        HierarchicalType testAnnotationType = new ClassType(ts, "TestAnnotation", null, ImmutableSet.<String>of(), 0);
-        HierarchicalType myNewAnnotationType = new ClassType(ts, "MyNewAnnotation", null, ImmutableSet.of("TestAnnotation"), 0);
-
-        List<HierarchicalType> unsortedTypes = Arrays.asList(testTableType, testColumnType, myNewAnnotationType, testDataSetType,
-            testDataFileType, testAnnotationType, testRelationalDataSetType, testObjectType, testDocumentType);
-        List<HierarchicalType> sortedTypes = HierarchicalTypeDependencySorter.sortTypes(unsortedTypes);
-        // Verify that super types were sorted before their subtypes.
-        Assert.assertTrue(sortedTypes.indexOf(testObjectType) < sortedTypes.indexOf(testDataSetType));
-        Assert.assertTrue(sortedTypes.indexOf(testObjectType) < sortedTypes.indexOf(testColumnType));
-        Assert.assertTrue(sortedTypes.indexOf(testDataSetType) < sortedTypes.indexOf(testRelationalDataSetType));
-        Assert.assertTrue(sortedTypes.indexOf(testDataSetType) < sortedTypes.indexOf(testDocumentType));
-        Assert.assertTrue(sortedTypes.indexOf(testDataSetType) < sortedTypes.indexOf(testTableType));
-        Assert.assertTrue(sortedTypes.indexOf(testRelationalDataSetType) < sortedTypes.indexOf(testDataFileType));
-        Assert.assertTrue(sortedTypes.indexOf(testAnnotationType) < sortedTypes.indexOf(myNewAnnotationType));
-    }
-}

http://git-wip-us.apache.org/repos/asf/atlas/blob/0877e47c/typesystem/src/test/java/org/apache/atlas/typesystem/types/HierarchicalTypeTest.java
----------------------------------------------------------------------
diff --git a/typesystem/src/test/java/org/apache/atlas/typesystem/types/HierarchicalTypeTest.java b/typesystem/src/test/java/org/apache/atlas/typesystem/types/HierarchicalTypeTest.java
deleted file mode 100644
index 9f63f52..0000000
--- a/typesystem/src/test/java/org/apache/atlas/typesystem/types/HierarchicalTypeTest.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * <p/>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p/>
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.atlas.typesystem.types;
-
-import com.google.common.collect.ImmutableSet;
-
-import org.apache.atlas.typesystem.TypesDef;
-import org.apache.atlas.typesystem.types.utils.TypesUtil;
-import org.testng.Assert;
-import org.testng.annotations.Test;
-
-public abstract class HierarchicalTypeTest<T extends HierarchicalType> extends TypeUpdateBaseTest {
-    @Test
-    public void testTypeUpdate() throws Exception {
-        testTypeUpdateForAttributes();
-
-        //Test super types
-        HierarchicalTypeDefinition baseSuperType =
-                getTypeDefinition(newName(), TypesUtil.createOptionalAttrDef("s", DataTypes.INT_TYPE));
-
-        HierarchicalTypeDefinition classType = getTypeDefinition(newName(), ImmutableSet.of(baseSuperType.typeName),
-                        TypesUtil.createRequiredAttrDef("a", DataTypes.INT_TYPE));
-        TypeSystem ts = getTypeSystem();
-        ts.defineTypes(getTypesDef(baseSuperType, classType));
-
-        //Add super type with optional attribute
-        HierarchicalTypeDefinition superType =
-                getTypeDefinition(newName(), TypesUtil.createOptionalAttrDef("s", DataTypes.INT_TYPE));
-        classType = getTypeDefinition(classType.typeName, ImmutableSet.of(superType.typeName, baseSuperType.typeName),
-                TypesUtil.createRequiredAttrDef("a", DataTypes.INT_TYPE));
-        try {
-            ts.updateTypes(getTypesDef(superType, classType));
-            Assert.fail("Expected TypeUpdateException");
-        } catch (TypeUpdateException e) {
-            //expected
-        }
-
-        //Add super type with required attribute should fail
-        HierarchicalTypeDefinition superTypeRequired =
-                getTypeDefinition(newName(), TypesUtil.createRequiredAttrDef("s", DataTypes.INT_TYPE));
-        classType = getTypeDefinition(classType.typeName,
-                ImmutableSet.of(superTypeRequired.typeName, baseSuperType.typeName),
-                TypesUtil.createRequiredAttrDef("a", DataTypes.INT_TYPE));
-        try {
-            ts.updateTypes(getTypesDef(superTypeRequired, classType));
-            Assert.fail("Expected TypeUpdateException");
-        } catch (TypeUpdateException e) {
-            //expected
-        }
-
-        //Deleting super type should fail
-        classType = getTypeDefinition(classType.typeName, TypesUtil.createRequiredAttrDef("a", DataTypes.INT_TYPE));
-        try {
-            ts.updateTypes(getTypesDef(classType));
-            Assert.fail("Expected TypeUpdateException");
-        } catch (TypeUpdateException e) {
-            //expected
-        }
-    }
-
-    @Override
-    protected abstract HierarchicalTypeDefinition<T> getTypeDefinition(String name, AttributeDefinition... attributes);
-
-    protected abstract HierarchicalTypeDefinition<T> getTypeDefinition(String name, ImmutableSet<String> superTypes,
-                                                                       AttributeDefinition... attributes);
-
-    @Override
-    protected abstract TypesDef getTypesDef(StructTypeDefinition typeDefinition);
-
-    protected abstract TypesDef getTypesDef(HierarchicalTypeDefinition<T>... typeDefinitions);
-
-    @Override
-    protected int getNumberOfFields(TypeSystem ts, String typeName) throws Exception {
-        return ts.getDataType(HierarchicalType.class, typeName).numFields;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/atlas/blob/0877e47c/typesystem/src/test/java/org/apache/atlas/typesystem/types/StructTest.java
----------------------------------------------------------------------
diff --git a/typesystem/src/test/java/org/apache/atlas/typesystem/types/StructTest.java b/typesystem/src/test/java/org/apache/atlas/typesystem/types/StructTest.java
deleted file mode 100755
index 3a1675e..0000000
--- a/typesystem/src/test/java/org/apache/atlas/typesystem/types/StructTest.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.atlas.typesystem.types;
-
-import com.google.common.collect.ImmutableList;
-import org.apache.atlas.AtlasException;
-import org.apache.atlas.typesystem.ITypedStruct;
-import org.apache.atlas.typesystem.Struct;
-import org.apache.atlas.typesystem.TypesDef;
-import org.apache.atlas.typesystem.types.utils.TypesUtil;
-import org.testng.Assert;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
-
-import static org.testng.Assert.assertTrue;
-
-public class StructTest extends TypeUpdateBaseTest {
-
-    StructType structType;
-    StructType recursiveStructType;
-    StructType invalidStructType;
-
-    @BeforeMethod
-    public void setup() throws Exception {
-        super.setup();
-        structType = getTypeSystem().getDataType(StructType.class, STRUCT_TYPE_1);
-        recursiveStructType = getTypeSystem().getDataType(StructType.class, STRUCT_TYPE_2);
-        invalidStructType = getTypeSystem().getDataType(StructType.class, STRUCT_TYPE_3);
-    }
-
-    @Test
-    public void test1() throws AtlasException {
-        Struct s = createStruct();
-        ITypedStruct ts = structType.convert(s, Multiplicity.REQUIRED);
-        Assert.assertEquals(ts.toString(), "{\n" +
-                "\ta : \t1\n" +
-                "\tb : \ttrue\n" +
-                "\tc : \t1\n" +
-                "\td : \t2\n" +
-                "\te : \t1\n" +
-                "\tf : \t1\n" +
-                "\tg : \t1\n" +
-                "\th : \t1.0\n" +
-                "\ti : \t1.0\n" +
-                "\tj : \t1\n" +
-                "\tk : \t1\n" +
-                "\tl : \t" + TEST_DATE + "\n" +
-                "\tm : \t[1, 1]\n" +
-                "\tn : \t[1.1, 1.1]\n" +
-                "\to : \t{a=1.0, b=2.0}\n" +
-                "\tp : \t\n" +
-                "\tq : \t<null>\n"+
-                "\tr : \t{a=}\n" +
-                "}");
-    }
-
-    @Test
-    public void testStructWithEmptyString() throws AtlasException{
-        try {
-            assertTrue(getTypeSystem().getTypeNames().contains("t3"));
-            Struct s = new Struct(invalidStructType.getName());
-            s.set("a", "");
-            ITypedStruct ts = invalidStructType.convert(s, Multiplicity.REQUIRED);
-        }
-        catch (AtlasException e){
-            String err = "org.apache.atlas.typesystem.types.ValueConversionException: Cannot convert value 'org.apache.atlas.typesystem.Struct@1ba02' to datatype t3";
-            Assert.assertEquals(e.toString(), err);
-        }
-    }
-
-    @Test
-    public void testRecursive() throws AtlasException {
-        Struct s1 = new Struct(recursiveStructType.getName());
-        s1.set("a", 1);
-        Struct s2 = new Struct(recursiveStructType.getName());
-        s2.set("a", 1);
-        s2.set("s", s1);
-        ITypedStruct ts = recursiveStructType.convert(s2, Multiplicity.REQUIRED);
-        Assert.assertEquals(ts.toString(), "{\n" +
-                "\ta : \t1\n" +
-                "\ts : \t{\n" +
-                "\t\ta : \t\t1\n" +
-                "\t\ts : <null>\n" +
-                "\n" +
-                "\t}\n" +
-                "}");
-    }
-
-    @Test
-    public void testTypeUpdate() throws Exception {
-        testTypeUpdateForAttributes();
-    }
-
-    @Override
-    protected int getNumberOfFields(TypeSystem ts, String typeName) throws Exception {
-        return ts.getDataType(StructType.class, typeName).numFields;
-    }
-
-    @Override
-    protected StructTypeDefinition getTypeDefinition(String name, AttributeDefinition... attributes) {
-        return new StructTypeDefinition(name, attributes);
-    }
-
-    @Override
-    protected TypesDef getTypesDef(StructTypeDefinition typeDefinition) {
-        return TypesUtil.getTypesDef(ImmutableList.<EnumTypeDefinition>of(), ImmutableList.of(typeDefinition),
-                ImmutableList.<HierarchicalTypeDefinition<TraitType>>of(),
-                ImmutableList.<HierarchicalTypeDefinition<ClassType>>of());
-    }
-}

http://git-wip-us.apache.org/repos/asf/atlas/blob/0877e47c/typesystem/src/test/java/org/apache/atlas/typesystem/types/TraitTest.java
----------------------------------------------------------------------
diff --git a/typesystem/src/test/java/org/apache/atlas/typesystem/types/TraitTest.java b/typesystem/src/test/java/org/apache/atlas/typesystem/types/TraitTest.java
deleted file mode 100755
index 7c39213..0000000
--- a/typesystem/src/test/java/org/apache/atlas/typesystem/types/TraitTest.java
+++ /dev/null
@@ -1,247 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.atlas.typesystem.types;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableSet;
-
-import org.apache.atlas.AtlasException;
-import org.apache.atlas.typesystem.IStruct;
-import org.apache.atlas.typesystem.ITypedStruct;
-import org.apache.atlas.typesystem.Struct;
-import org.apache.atlas.typesystem.TypesDef;
-import org.apache.atlas.typesystem.types.utils.TypesUtil;
-import org.testng.Assert;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import static org.apache.atlas.typesystem.types.utils.TypesUtil.createOptionalAttrDef;
-import static org.apache.atlas.typesystem.types.utils.TypesUtil.createRequiredAttrDef;
-import static org.apache.atlas.typesystem.types.utils.TypesUtil.createTraitTypeDef;
-
-public class TraitTest extends HierarchicalTypeTest<TraitType> {
-
-
-    @BeforeMethod
-    public void setup() throws Exception {
-        super.setup();
-    }
-
-    /*
-     * Type Hierarchy is:
-     *   A(a,b,c,d)
-     *   B(b) extends A
-     *   C(c) extends A
-     *   D(d) extends B,C
-     *
-     * - There are a total of 11 fields in an instance of D
-     * - an attribute that is hidden by a SubType can referenced by prefixing it with the
-     * complete Path.
-     *   For e.g. the 'b' attribute in A (that is a superType for B) is hidden the 'b' attribute
-     *   in B.
-     *   So it is available by the name 'A.B.D.b'
-     *
-     * - Another way to set attributes is to cast. Casting a 'D' instance of 'B' makes the 'A.B.D
-     * .b' attribute
-     *   available as 'A.B.b'. Casting one more time to an 'A' makes the 'A.B.b' attribute
-     *   available as 'b'.
-     */
-    @Test
-    public void test1() throws AtlasException {
-        HierarchicalTypeDefinition A = createTraitTypeDef("A", null, createRequiredAttrDef("a", DataTypes.INT_TYPE),
-                createOptionalAttrDef("b", DataTypes.BOOLEAN_TYPE), createOptionalAttrDef("c", DataTypes.BYTE_TYPE),
-                createOptionalAttrDef("d", DataTypes.SHORT_TYPE));
-        HierarchicalTypeDefinition B = createTraitTypeDef("B", ImmutableSet.of("A"),
-                createOptionalAttrDef("b", DataTypes.BOOLEAN_TYPE));
-        HierarchicalTypeDefinition C =
-                createTraitTypeDef("C", ImmutableSet.of("A"), createOptionalAttrDef("c", DataTypes.BYTE_TYPE));
-        HierarchicalTypeDefinition D = createTraitTypeDef("D", ImmutableSet.of("B", "C"),
-                createOptionalAttrDef("d", DataTypes.SHORT_TYPE));
-
-        defineTraits(A, B, C, D);
-
-        TraitType DType = getTypeSystem().getDataType(TraitType.class, "D");
-
-        //        for(String aName : DType.fieldMapping().fields.keySet()) {
-        //            System.out.println(String.format("nameToQualifiedName.put(\"%s\", \"%s\");", aName, DType
-        // .getQualifiedName(aName)));
-        //        }
-
-        Map<String, String> nameToQualifiedName = new HashMap();
-        {
-            nameToQualifiedName.put("d", "D.d");
-            nameToQualifiedName.put("b", "B.b");
-            nameToQualifiedName.put("c", "C.c");
-            nameToQualifiedName.put("a", "A.a");
-            nameToQualifiedName.put("A.B.D.b", "A.B.D.b");
-            nameToQualifiedName.put("A.B.D.c", "A.B.D.c");
-            nameToQualifiedName.put("A.B.D.d", "A.B.D.d");
-            nameToQualifiedName.put("A.C.D.a", "A.C.D.a");
-            nameToQualifiedName.put("A.C.D.b", "A.C.D.b");
-            nameToQualifiedName.put("A.C.D.c", "A.C.D.c");
-            nameToQualifiedName.put("A.C.D.d", "A.C.D.d");
-        }
-
-        Struct s1 = new Struct("D");
-        s1.set("d", 1);
-        s1.set("c", 1);
-        s1.set("b", true);
-        s1.set("a", 1);
-        s1.set("A.B.D.b", true);
-        s1.set("A.B.D.c", 2);
-        s1.set("A.B.D.d", 2);
-
-        s1.set("A.C.D.a", 3);
-        s1.set("A.C.D.b", false);
-        s1.set("A.C.D.c", 3);
-        s1.set("A.C.D.d", 3);
-
-
-        ITypedStruct ts = DType.convert(s1, Multiplicity.REQUIRED);
-        Assert.assertEquals(ts.toString(), "{\n" +
-                "\td : \t1\n" +
-                "\tb : \ttrue\n" +
-                "\tc : \t1\n" +
-                "\ta : \t1\n" +
-                "\tA.B.D.b : \ttrue\n" +
-                "\tA.B.D.c : \t2\n" +
-                "\tA.B.D.d : \t2\n" +
-                "\tA.C.D.a : \t3\n" +
-                "\tA.C.D.b : \tfalse\n" +
-                "\tA.C.D.c : \t3\n" +
-                "\tA.C.D.d : \t3\n" +
-                "}");
-
-        /*
-         * cast to B and set the 'b' attribute on A.
-         */
-        TraitType BType = getTypeSystem().getDataType(TraitType.class, "B");
-        IStruct s2 = DType.castAs(ts, "B");
-        s2.set("A.B.b", false);
-
-        Assert.assertEquals(ts.toString(), "{\n" +
-                "\td : \t1\n" +
-                "\tb : \ttrue\n" +
-                "\tc : \t1\n" +
-                "\ta : \t1\n" +
-                "\tA.B.D.b : \tfalse\n" +
-                "\tA.B.D.c : \t2\n" +
-                "\tA.B.D.d : \t2\n" +
-                "\tA.C.D.a : \t3\n" +
-                "\tA.C.D.b : \tfalse\n" +
-                "\tA.C.D.c : \t3\n" +
-                "\tA.C.D.d : \t3\n" +
-                "}");
-
-        /*
-         * cast again to A and set the 'b' attribute on A.
-         */
-        TraitType AType = getTypeSystem().getDataType(TraitType.class, "A");
-        IStruct s3 = BType.castAs(s2, "A");
-        s3.set("b", true);
-        Assert.assertEquals(ts.toString(), "{\n" +
-                "\td : \t1\n" +
-                "\tb : \ttrue\n" +
-                "\tc : \t1\n" +
-                "\ta : \t1\n" +
-                "\tA.B.D.b : \ttrue\n" +
-                "\tA.B.D.c : \t2\n" +
-                "\tA.B.D.d : \t2\n" +
-                "\tA.C.D.a : \t3\n" +
-                "\tA.C.D.b : \tfalse\n" +
-                "\tA.C.D.c : \t3\n" +
-                "\tA.C.D.d : \t3\n" +
-                "}");
-    }
-
-    @Test
-    public void testRandomOrder() throws AtlasException {
-        HierarchicalTypeDefinition A = createTraitTypeDef("A", null, createRequiredAttrDef("a", DataTypes.INT_TYPE),
-                createOptionalAttrDef("b", DataTypes.BOOLEAN_TYPE), createOptionalAttrDef("c", DataTypes.BYTE_TYPE),
-                createOptionalAttrDef("d", DataTypes.SHORT_TYPE));
-        HierarchicalTypeDefinition B = createTraitTypeDef("B", ImmutableSet.of("A"),
-                createOptionalAttrDef("b", DataTypes.BOOLEAN_TYPE));
-        HierarchicalTypeDefinition C = createTraitTypeDef("C", ImmutableSet.of("A"),
-                createOptionalAttrDef("c", DataTypes.BYTE_TYPE));
-        HierarchicalTypeDefinition D = createTraitTypeDef("D", ImmutableSet.of("B", "C"),
-                createOptionalAttrDef("d", DataTypes.SHORT_TYPE));
-
-        defineTraits(B, D, A, C);
-
-        TraitType DType = getTypeSystem().getDataType(TraitType.class, "D");
-
-        Struct s1 = new Struct("D");
-        s1.set("d", 1);
-        s1.set("c", 1);
-        s1.set("b", true);
-        s1.set("a", 1);
-        s1.set("A.B.D.b", true);
-        s1.set("A.B.D.c", 2);
-        s1.set("A.B.D.d", 2);
-
-        s1.set("A.C.D.a", 3);
-        s1.set("A.C.D.b", false);
-        s1.set("A.C.D.c", 3);
-        s1.set("A.C.D.d", 3);
-
-
-        ITypedStruct ts = DType.convert(s1, Multiplicity.REQUIRED);
-        Assert.assertEquals(ts.toString(), "{\n" +
-                "\td : \t1\n" +
-                "\tb : \ttrue\n" +
-                "\tc : \t1\n" +
-                "\ta : \t1\n" +
-                "\tA.B.D.b : \ttrue\n" +
-                "\tA.B.D.c : \t2\n" +
-                "\tA.B.D.d : \t2\n" +
-                "\tA.C.D.a : \t3\n" +
-                "\tA.C.D.b : \tfalse\n" +
-                "\tA.C.D.c : \t3\n" +
-                "\tA.C.D.d : \t3\n" +
-                "}");
-    }
-
-    @Override
-    protected HierarchicalTypeDefinition<TraitType> getTypeDefinition(String name, AttributeDefinition... attributes) {
-        return new HierarchicalTypeDefinition(TraitType.class, name, null, null, attributes);
-    }
-
-    @Override
-    protected HierarchicalTypeDefinition<TraitType> getTypeDefinition(String name, ImmutableSet<String> superTypes,
-                                                                      AttributeDefinition... attributes) {
-        return new HierarchicalTypeDefinition(TraitType.class, name, null, superTypes, attributes);
-    }
-
-    @Override
-    protected TypesDef getTypesDef(StructTypeDefinition typeDefinition) {
-        return TypesUtil.getTypesDef(ImmutableList.<EnumTypeDefinition>of(), ImmutableList.<StructTypeDefinition>of(),
-                ImmutableList.of((HierarchicalTypeDefinition<TraitType>) typeDefinition),
-                ImmutableList.<HierarchicalTypeDefinition<ClassType>>of());
-    }
-
-    @Override
-    protected TypesDef getTypesDef(HierarchicalTypeDefinition<TraitType>... typeDefinitions) {
-        return TypesUtil.getTypesDef(ImmutableList.<EnumTypeDefinition>of(), ImmutableList.<StructTypeDefinition>of(),
-                ImmutableList.copyOf(typeDefinitions), ImmutableList.<HierarchicalTypeDefinition<ClassType>>of());
-    }
-}
-

http://git-wip-us.apache.org/repos/asf/atlas/blob/0877e47c/typesystem/src/test/java/org/apache/atlas/typesystem/types/TypeInheritanceTest.java
----------------------------------------------------------------------
diff --git a/typesystem/src/test/java/org/apache/atlas/typesystem/types/TypeInheritanceTest.java b/typesystem/src/test/java/org/apache/atlas/typesystem/types/TypeInheritanceTest.java
deleted file mode 100644
index c13ef3a..0000000
--- a/typesystem/src/test/java/org/apache/atlas/typesystem/types/TypeInheritanceTest.java
+++ /dev/null
@@ -1,252 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.atlas.typesystem.types;
-
-import com.google.common.collect.ImmutableSet;
-
-import org.apache.atlas.AtlasException;
-import org.apache.atlas.typesystem.IStruct;
-import org.apache.atlas.typesystem.ITypedInstance;
-import org.apache.atlas.typesystem.ITypedStruct;
-import org.apache.atlas.typesystem.Struct;
-import org.testng.Assert;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
-
-import static org.apache.atlas.typesystem.types.utils.TypesUtil.createClassTypeDef;
-import static org.apache.atlas.typesystem.types.utils.TypesUtil.createOptionalAttrDef;
-import static org.apache.atlas.typesystem.types.utils.TypesUtil.createRequiredAttrDef;
-import static org.apache.atlas.typesystem.types.utils.TypesUtil.createTraitTypeDef;
-
-/**
- * Unit tests for type inheritance.
- */
-public class TypeInheritanceTest extends BaseTest {
-
-    @BeforeMethod
-    public void setup() throws Exception {
-        TypeSystem.getInstance().reset();
-        super.setup();
-    }
-
-    /*
-     * Type Hierarchy is:
-     *   A(a)
-     *   B(b) extends A
-     */
-    @Test
-    public void testSimpleInheritance() throws AtlasException {
-        HierarchicalTypeDefinition A = createClassTypeDef("A", null, createRequiredAttrDef("a", DataTypes.INT_TYPE));
-
-        HierarchicalTypeDefinition B =
-                createClassTypeDef("B", ImmutableSet.of("A"), createOptionalAttrDef("b", DataTypes.BOOLEAN_TYPE));
-
-        defineClasses(A, B);
-
-        ClassType BType = getTypeSystem().getDataType(ClassType.class, "B");
-
-        Struct s1 = new Struct("B");
-        s1.set("b", true);
-        s1.set("a", 1);
-
-        ITypedInstance ts = BType.convert(s1, Multiplicity.REQUIRED);
-        Assert.assertEquals(ts.toString(), "{\n" +
-                "\tid : (type: B, id: <unassigned>)\n" +
-                "\tb : \ttrue\n" +
-                "\ta : \t1\n" +
-                "}");
-    }
-
-    /*
-     * Type Hierarchy is:
-     *   A(a, b)
-     *   B(b) extends A
-     */
-    @Test
-    public void testSimpleInheritanceWithOverrides() throws AtlasException {
-        HierarchicalTypeDefinition A = createClassTypeDef("A", null, createRequiredAttrDef("a", DataTypes.INT_TYPE),
-                createRequiredAttrDef("b", DataTypes.BOOLEAN_TYPE));
-
-        HierarchicalTypeDefinition B =
-                createClassTypeDef("B", ImmutableSet.of("A"), createOptionalAttrDef("b", DataTypes.BOOLEAN_TYPE));
-
-        defineClasses(A, B);
-
-        ClassType BType = getTypeSystem().getDataType(ClassType.class, "B");
-
-        Struct s1 = new Struct("B");
-        s1.set("b", true);
-        s1.set("a", 1);
-        s1.set("A.B.b", false);
-
-        ITypedInstance ts = BType.convert(s1, Multiplicity.REQUIRED);
-        Assert.assertEquals(ts.toString(), "{\n" +
-                "\tid : (type: B, id: <unassigned>)\n" +
-                "\tb : \ttrue\n" +
-                "\ta : \t1\n" +
-                "\tA.B.b : \tfalse\n" +
-                "}");
-    }
-
-    /*
-     * Type Hierarchy is:
-     *   A(a)
-     *   B(b) extends A
-     *   C(c) extends B
-     *   D(d) extends C
-     */
-    @Test
-    public void testMultiLevelInheritance() throws AtlasException {
-        HierarchicalTypeDefinition A = createClassTypeDef("A", null, createRequiredAttrDef("a", DataTypes.INT_TYPE));
-
-        HierarchicalTypeDefinition B =
-                createClassTypeDef("B", ImmutableSet.of("A"), createOptionalAttrDef("b", DataTypes.BOOLEAN_TYPE));
-
-        HierarchicalTypeDefinition C =
-                createClassTypeDef("C", ImmutableSet.of("B"), createOptionalAttrDef("c", DataTypes.BYTE_TYPE));
-
-        HierarchicalTypeDefinition D =
-                createClassTypeDef("D", ImmutableSet.of("C"), createOptionalAttrDef("d", DataTypes.SHORT_TYPE));
-
-        defineClasses(A, B, C, D);
-
-        ClassType DType = getTypeSystem().getDataType(ClassType.class, "D");
-
-        Struct s1 = new Struct("D");
-        s1.set("d", 1);
-        s1.set("c", 1);
-        s1.set("b", true);
-        s1.set("a", 1);
-
-        ITypedInstance ts = DType.convert(s1, Multiplicity.REQUIRED);
-        Assert.assertEquals(ts.toString(), "{\n" +
-                "\tid : (type: D, id: <unassigned>)\n" +
-                "\td : \t1\n" +
-                "\tc : \t1\n" +
-                "\tb : \ttrue\n" +
-                "\ta : \t1\n" +
-                "}");
-    }
-
-    /*
-     * Type Hierarchy is:
-     *   A(a,b,c,d)
-     *   B(b) extends A
-     *   C(c) extends A
-     *   D(d) extends B,C
-     *
-     * - There are a total of 11 fields in an instance of D
-     * - an attribute that is hidden by a SubType can referenced by prefixing it with the
-     * complete Path.
-     *   For e.g. the 'b' attribute in A (that is a superType for B) is hidden the 'b' attribute
-     *   in B.
-     *   So it is availabel by the name 'A.B.D.b'
-     *
-     * - Another way to set attributes is to cast. Casting a 'D' instance of 'B' makes the 'A.B.D
-     * .b' attribute
-     *   available as 'A.B.b'. Casting one more time to an 'A' makes the 'A.B.b' attribute
-     *   available as 'b'.
-     */
-    @Test
-    public void testDiamondInheritance() throws AtlasException {
-        HierarchicalTypeDefinition A = createTraitTypeDef("A", null, createRequiredAttrDef("a", DataTypes.INT_TYPE),
-                createOptionalAttrDef("b", DataTypes.BOOLEAN_TYPE), createOptionalAttrDef("c", DataTypes.BYTE_TYPE),
-                createOptionalAttrDef("d", DataTypes.SHORT_TYPE));
-        HierarchicalTypeDefinition B =
-                createTraitTypeDef("B", ImmutableSet.of("A"), createOptionalAttrDef("b", DataTypes.BOOLEAN_TYPE));
-        HierarchicalTypeDefinition C =
-                createTraitTypeDef("C", ImmutableSet.of("A"), createOptionalAttrDef("c", DataTypes.BYTE_TYPE));
-        HierarchicalTypeDefinition D =
-                createTraitTypeDef("D", ImmutableSet.of("B", "C"), createOptionalAttrDef("d", DataTypes.SHORT_TYPE));
-
-        defineTraits(A, B, C, D);
-
-        TraitType DType = getTypeSystem().getDataType(TraitType.class, "D");
-
-        Struct s1 = new Struct("D");
-        s1.set("d", 1);
-        s1.set("c", 1);
-        s1.set("b", true);
-        s1.set("a", 1);
-        s1.set("A.B.D.b", true);
-        s1.set("A.B.D.c", 2);
-        s1.set("A.B.D.d", 2);
-
-        s1.set("A.C.D.a", 3);
-        s1.set("A.C.D.b", false);
-        s1.set("A.C.D.c", 3);
-        s1.set("A.C.D.d", 3);
-
-
-        ITypedStruct ts = DType.convert(s1, Multiplicity.REQUIRED);
-        Assert.assertEquals(ts.toString(), "{\n" +
-                "\td : \t1\n" +
-                "\tb : \ttrue\n" +
-                "\tc : \t1\n" +
-                "\ta : \t1\n" +
-                "\tA.B.D.b : \ttrue\n" +
-                "\tA.B.D.c : \t2\n" +
-                "\tA.B.D.d : \t2\n" +
-                "\tA.C.D.a : \t3\n" +
-                "\tA.C.D.b : \tfalse\n" +
-                "\tA.C.D.c : \t3\n" +
-                "\tA.C.D.d : \t3\n" +
-                "}");
-
-        /*
-         * cast to B and set the 'b' attribute on A.
-         */
-        TraitType BType = getTypeSystem().getDataType(TraitType.class, "B");
-        IStruct s2 = DType.castAs(ts, "B");
-        s2.set("A.B.b", false);
-
-        Assert.assertEquals(ts.toString(), "{\n" +
-                "\td : \t1\n" +
-                "\tb : \ttrue\n" +
-                "\tc : \t1\n" +
-                "\ta : \t1\n" +
-                "\tA.B.D.b : \tfalse\n" +
-                "\tA.B.D.c : \t2\n" +
-                "\tA.B.D.d : \t2\n" +
-                "\tA.C.D.a : \t3\n" +
-                "\tA.C.D.b : \tfalse\n" +
-                "\tA.C.D.c : \t3\n" +
-                "\tA.C.D.d : \t3\n" +
-                "}");
-
-        /*
-         * cast again to A and set the 'b' attribute on A.
-         */
-        IStruct s3 = BType.castAs(s2, "A");
-        s3.set("b", true);
-        Assert.assertEquals(ts.toString(), "{\n" +
-                "\td : \t1\n" +
-                "\tb : \ttrue\n" +
-                "\tc : \t1\n" +
-                "\ta : \t1\n" +
-                "\tA.B.D.b : \ttrue\n" +
-                "\tA.B.D.c : \t2\n" +
-                "\tA.B.D.d : \t2\n" +
-                "\tA.C.D.a : \t3\n" +
-                "\tA.C.D.b : \tfalse\n" +
-                "\tA.C.D.c : \t3\n" +
-                "\tA.C.D.d : \t3\n" +
-                "}");
-    }
-}

http://git-wip-us.apache.org/repos/asf/atlas/blob/0877e47c/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
deleted file mode 100755
index 0ef5d10..0000000
--- a/typesystem/src/test/java/org/apache/atlas/typesystem/types/TypeSystemTest.java
+++ /dev/null
@@ -1,327 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.atlas.typesystem.types;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableSet;
-
-import org.apache.atlas.AtlasException;
-import org.apache.atlas.typesystem.exception.TypeExistsException;
-import org.apache.atlas.typesystem.types.utils.TypesUtil;
-import org.apache.commons.lang3.RandomStringUtils;
-import org.testng.Assert;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-import scala.actors.threadpool.Arrays;
-
-import java.util.Collections;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-
-import static org.apache.atlas.typesystem.types.utils.TypesUtil.createClassTypeDef;
-import static org.apache.atlas.typesystem.types.utils.TypesUtil.createOptionalAttrDef;
-import static org.apache.atlas.typesystem.types.utils.TypesUtil.createRequiredAttrDef;
-import static org.apache.atlas.typesystem.types.utils.TypesUtil.createStructTypeDef;
-import static org.apache.atlas.typesystem.types.utils.TypesUtil.createTraitTypeDef;
-import static org.testng.Assert.assertTrue;
-import static org.testng.Assert.fail;
-
-public class TypeSystemTest extends BaseTest {
-
-    public static final long TEST_DATE_IN_LONG = 1418265358440L;
-    public static final String TEST_DATE_STRING = "2014-12-11T02:35:58.440Z";
-
-    @BeforeClass
-    public void setUp() throws Exception {
-        super.setup();
-    }
-
-    @AfterMethod
-    public void tearDown() throws Exception {
-        getTypeSystem().reset();
-    }
-
-    @Test
-    public void testGetTypeNames() throws Exception {
-        getTypeSystem().defineEnumType("enum_test", new EnumValue("0", 0), new EnumValue("1", 1), new EnumValue("2", 2),
-                new EnumValue("3", 3));
-        assertTrue(getTypeSystem().getTypeNames().contains("enum_test"));
-    }
-
-    @Test
-    public void testGetTypeDescription() throws Exception {
-        String typeName = "enum_type";
-        String description = "_description";
-        String typeDescription = typeName + description;
-        getTypeSystem().defineEnumType(typeName, typeDescription, new EnumValue("0", 0), new EnumValue("1", 1), new EnumValue("2", 2),
-                new EnumValue("3", 3));
-        assertTrue(getTypeSystem().getTypeNames().contains(typeName));
-        IDataType type = getTypeSystem().getDataType(EnumType.class, typeName);
-        Assert.assertNotNull(type);
-        Assert.assertEquals(type.getDescription(), typeDescription);
-
-        typeName = "trait_type";
-        typeDescription = typeName + description;
-        HierarchicalTypeDefinition<TraitType> trait = TypesUtil
-            .createTraitTypeDef(typeName, typeDescription, ImmutableSet.<String>of(),
-                TypesUtil.createRequiredAttrDef("type", DataTypes.STRING_TYPE));
-        getTypeSystem().defineTraitType(trait);
-        assertTrue(getTypeSystem().getTypeNames().contains(typeName));
-        type = getTypeSystem().getDataType(TraitType.class, typeName);
-        Assert.assertNotNull(type);
-        Assert.assertEquals(type.getDescription(), typeDescription);
-
-        typeName = "class_type";
-        typeDescription = typeName + description;
-        HierarchicalTypeDefinition<ClassType> classType = TypesUtil
-            .createClassTypeDef(typeName, typeDescription, ImmutableSet.<String>of(),
-                TypesUtil.createRequiredAttrDef("type", DataTypes.STRING_TYPE));
-        getTypeSystem().defineClassType(classType);
-        assertTrue(getTypeSystem().getTypeNames().contains(typeName));
-        type = getTypeSystem().getDataType(ClassType.class, typeName);
-        Assert.assertNotNull(type);
-        Assert.assertEquals(type.getDescription(), typeDescription);
-
-        typeName = "struct_type";
-        typeDescription = typeName + description;
-        getTypeSystem().defineStructType(typeName, typeDescription, true, createRequiredAttrDef("a", DataTypes.INT_TYPE));
-        assertTrue(getTypeSystem().getTypeNames().contains(typeName));
-        type = getTypeSystem().getDataType(StructType.class, typeName);
-        Assert.assertNotNull(type);
-        Assert.assertEquals(type.getDescription(), typeDescription);
-        
-    }
-
-    @Test
-    public void testIsRegistered() throws Exception {
-        getTypeSystem().defineEnumType("enum_test", new EnumValue("0", 0), new EnumValue("1", 1), new EnumValue("2", 2),
-                new EnumValue("3", 3));
-        assertTrue(getTypeSystem().isRegistered("enum_test"));
-    }
-
-    @Test
-    public void testGetTraitsNames() throws Exception {
-        HierarchicalTypeDefinition<TraitType> classificationTraitDefinition = TypesUtil
-                .createTraitTypeDef("Classification", ImmutableSet.<String>of(),
-                        TypesUtil.createRequiredAttrDef("tag", DataTypes.STRING_TYPE));
-        HierarchicalTypeDefinition<TraitType> piiTrait =
-                TypesUtil.createTraitTypeDef("PII", ImmutableSet.<String>of());
-        HierarchicalTypeDefinition<TraitType> phiTrait =
-                TypesUtil.createTraitTypeDef("PHI", ImmutableSet.<String>of());
-        HierarchicalTypeDefinition<TraitType> pciTrait =
-                TypesUtil.createTraitTypeDef("PCI", ImmutableSet.<String>of());
-        HierarchicalTypeDefinition<TraitType> soxTrait =
-                TypesUtil.createTraitTypeDef("SOX", ImmutableSet.<String>of());
-        HierarchicalTypeDefinition<TraitType> secTrait =
-                TypesUtil.createTraitTypeDef("SEC", ImmutableSet.<String>of());
-        HierarchicalTypeDefinition<TraitType> financeTrait =
-                TypesUtil.createTraitTypeDef("Finance", ImmutableSet.<String>of());
-
-        getTypeSystem().defineTypes(ImmutableList.<EnumTypeDefinition>of(),
-                ImmutableList.<StructTypeDefinition>of(),
-                ImmutableList.of(classificationTraitDefinition, piiTrait, phiTrait, pciTrait, soxTrait, secTrait,
-                        financeTrait), ImmutableList.<HierarchicalTypeDefinition<ClassType>>of());
-
-        final ImmutableList<String> traitsNames = getTypeSystem().getTypeNamesByCategory(DataTypes.TypeCategory.TRAIT);
-        Assert.assertEquals(traitsNames.size(), 7);
-        List traits = Arrays.asList(new String[]{"Classification", "PII", "PHI", "PCI", "SOX", "SEC", "Finance",});
-
-        Assert.assertFalse(Collections.disjoint(traitsNames, traits));
-    }
-
-    private String random() {
-        return RandomStringUtils.random(10);
-    }
-
-    @Test
-    public void testUTFNames() throws Exception {
-        TypeSystem ts = getTypeSystem();
-
-        String enumType = random();
-        EnumTypeDefinition orgLevelEnum =
-                new EnumTypeDefinition(enumType, new EnumValue(random(), 1), new EnumValue(random(), 2));
-
-        String structName = random();
-        String attrType = random();
-        StructTypeDefinition structType =
-                createStructTypeDef(structName, createRequiredAttrDef(attrType, DataTypes.STRING_TYPE));
-
-        String className = random();
-        HierarchicalTypeDefinition<ClassType> classType = createClassTypeDef(className, ImmutableSet.<String>of(),
-                createRequiredAttrDef(attrType, DataTypes.STRING_TYPE));
-
-        String traitName = random();
-        HierarchicalTypeDefinition<TraitType> traitType = createTraitTypeDef(traitName, ImmutableSet.<String>of(),
-                createRequiredAttrDef(attrType, DataTypes.INT_TYPE));
-
-        ts.defineTypes(ImmutableList.of(orgLevelEnum), ImmutableList.of(structType),
-                ImmutableList.of(traitType), ImmutableList.of(classType));
-    }
-
-    @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", ImmutableSet.of("trait_A"),
-                createRequiredAttrDef("t_B", DataTypes.STRING_TYPE));
-        HierarchicalTypeDefinition<TraitType> trait_C = createTraitTypeDef("trait_C", ImmutableSet.of("trait_A"),
-                createRequiredAttrDef("t_C", DataTypes.STRING_TYPE));
-        HierarchicalTypeDefinition<TraitType> trait_D = createTraitTypeDef("trait_D", ImmutableSet.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", ImmutableSet.of("class_A"),
-                createRequiredAttrDef("c_B", DataTypes.STRING_TYPE));
-        HierarchicalTypeDefinition<ClassType> class_C = createClassTypeDef("class_C", ImmutableSet.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);
-    }
-
-    @Test
-    public void testTypeNamesAreNotDuplicated() throws Exception {
-        TypeSystem typeSystem = getTypeSystem();
-        ImmutableList<String> traitNames = typeSystem.getTypeNamesByCategory(DataTypes.TypeCategory.TRAIT);
-        int numTraits = traitNames.size();
-
-        HashMap<String, IDataType> typesAdded = new HashMap<>();
-        String traitName = "dup_type_test" + random();
-        TraitType traitType = new TraitType(typeSystem, traitName, null, null, 0);
-        typesAdded.put(traitName, traitType);
-        typeSystem.commitTypes(typesAdded);
-
-        traitNames = typeSystem.getTypeNamesByCategory(DataTypes.TypeCategory.TRAIT);
-        Assert.assertEquals(traitNames.size(), numTraits+1);
-
-        // add again with another trait this time
-        traitName = "dup_type_test" + random();
-        TraitType traitTypeNew = new TraitType(typeSystem, traitName, null, null, 0);
-        typesAdded.put(traitName, traitTypeNew);
-
-        typeSystem.commitTypes(typesAdded);
-        traitNames = typeSystem.getTypeNamesByCategory(DataTypes.TypeCategory.TRAIT);
-        Assert.assertEquals(traitNames.size(), numTraits+2);
-    }
-
-    @Test
-    public void testHierarchy() throws Exception {
-        HierarchicalTypeDefinition<ClassType> testObjectDef = TypesUtil.createClassTypeDef("TestObject", ImmutableSet.<String>of(),
-            createOptionalAttrDef("name", DataTypes.STRING_TYPE),
-            createOptionalAttrDef("description", DataTypes.STRING_TYPE),
-            createOptionalAttrDef("topAttribute", DataTypes.STRING_TYPE));
-        HierarchicalTypeDefinition<ClassType> testDataSetDef = TypesUtil.createClassTypeDef("TestDataSet", ImmutableSet.of("TestObject"));
-        HierarchicalTypeDefinition<ClassType> testColumnDef = TypesUtil.createClassTypeDef("TestColumn", ImmutableSet.of("TestObject"),
-            createRequiredAttrDef("name", DataTypes.STRING_TYPE));
-        HierarchicalTypeDefinition<ClassType> testRelationalDataSetDef = 
-            TypesUtil.createClassTypeDef("TestRelationalDataSet", ImmutableSet.of("TestDataSet"),
-                new AttributeDefinition("columns", DataTypes.arrayTypeName("TestColumn"),
-                    Multiplicity.OPTIONAL, true, null));
-        HierarchicalTypeDefinition<ClassType> testTableDef = TypesUtil.createClassTypeDef("TestTable", ImmutableSet.of("TestRelationalDataSet"),
-            createOptionalAttrDef("schema", DataTypes.STRING_TYPE));
-        HierarchicalTypeDefinition<ClassType> testDataFileDef = TypesUtil.createClassTypeDef("TestDataFile", ImmutableSet.of("TestRelationalDataSet"),
-            createOptionalAttrDef("urlString", DataTypes.STRING_TYPE));
-        HierarchicalTypeDefinition<ClassType> testDocumentDef = TypesUtil.createClassTypeDef("TestDocument", ImmutableSet.of("TestDataSet"),
-            createOptionalAttrDef("urlString", DataTypes.STRING_TYPE),
-            createOptionalAttrDef("encoding", DataTypes.STRING_TYPE));
-        HierarchicalTypeDefinition<ClassType> testAnnotationDef =TypesUtil.createClassTypeDef("TestAnnotation",  ImmutableSet.<String>of(),
-            createOptionalAttrDef("inheritedAttribute", DataTypes.STRING_TYPE));
-        HierarchicalTypeDefinition<ClassType> myNewAnnotationDef = TypesUtil.createClassTypeDef("MyNewAnnotation", ImmutableSet.of("TestAnnotation"),
-            createRequiredAttrDef("myNewAnnotationAttribute", DataTypes.STRING_TYPE));
-        getTypeSystem().defineTypes(ImmutableList.<EnumTypeDefinition>of(), ImmutableList.<StructTypeDefinition>of(),
-            ImmutableList.<HierarchicalTypeDefinition<TraitType>>of(),
-            ImmutableList.of(testObjectDef, testDataSetDef, testColumnDef, testRelationalDataSetDef, testTableDef, testDataFileDef, testDocumentDef, testAnnotationDef, myNewAnnotationDef));
-
-        // Verify that field mappings for MyNewAnnotation contains the attribute inherited from the TestAnnotation superclass.
-        // Prior to fix for ATLAS-573, the inherited attribute was missing.
-        ClassType dataType = getTypeSystem().getDataType(ClassType.class, "MyNewAnnotation");
-        Assert.assertTrue(dataType.fieldMapping.fields.containsKey("inheritedAttribute"));
-    }
-
-    @Test
-    public void testRedefineExistingType() throws Exception {
-        TypeSystem typeSystem = getTypeSystem();
-        HierarchicalTypeDefinition<TraitType> trait = TypesUtil
-                .createTraitTypeDef(random(), "description", ImmutableSet.<String>of(),
-                        TypesUtil.createRequiredAttrDef("type", DataTypes.STRING_TYPE));
-        typeSystem.defineTraitType(trait);
-
-        try {
-            typeSystem.defineTraitType(trait);
-            fail("Expected TypeExistsException");
-        } catch(TypeExistsException e) {
-            //expected
-        }
-    }
-
-    @Test
-    public void testDuplicateNewTypenames() throws Exception {
-        TypeSystem typeSystem = getTypeSystem();
-        HierarchicalTypeDefinition<TraitType> trait1 = TypesUtil
-                .createTraitTypeDef(random(), "description", ImmutableSet.<String>of(),
-                        TypesUtil.createRequiredAttrDef("type", DataTypes.STRING_TYPE));
-        // create another trait with the same name
-        HierarchicalTypeDefinition<TraitType> trait2 = TypesUtil
-                .createTraitTypeDef(trait1.typeName, "description", ImmutableSet.<String>of(),
-                        TypesUtil.createRequiredAttrDef("type", DataTypes.STRING_TYPE));
-
-        try {
-            typeSystem.defineTypes(ImmutableList.<EnumTypeDefinition>of(), ImmutableList.<StructTypeDefinition>of(),
-                    ImmutableList.of(trait1, trait2), ImmutableList.<HierarchicalTypeDefinition<ClassType>>of());
-        } catch(AtlasException e) {
-            fail("Exception unexpected");
-        }
-    }
-
-    @Test(expectedExceptions = ValueConversionException.class)
-    public void testConvertInvalidDate() throws Exception {
-       DataTypes.DATE_TYPE.convert("", Multiplicity.OPTIONAL);
-    }
-
-    @Test()
-    public void testConvertValidDate() throws Exception {
-        Date date = DataTypes.DATE_TYPE.convert(TEST_DATE_STRING, Multiplicity.OPTIONAL);
-        Assert.assertEquals(date, new Date(TEST_DATE_IN_LONG));
-
-
-        StringBuilder buf = new StringBuilder();
-        DataTypes.DATE_TYPE.output(new Date(TEST_DATE_IN_LONG), buf, "", new HashSet<Date>());
-        Assert.assertEquals(buf.toString(), TEST_DATE_STRING);
-    }
-}

http://git-wip-us.apache.org/repos/asf/atlas/blob/0877e47c/typesystem/src/test/java/org/apache/atlas/typesystem/types/TypeUpdateBaseTest.java
----------------------------------------------------------------------
diff --git a/typesystem/src/test/java/org/apache/atlas/typesystem/types/TypeUpdateBaseTest.java b/typesystem/src/test/java/org/apache/atlas/typesystem/types/TypeUpdateBaseTest.java
deleted file mode 100644
index 4a6ed2d..0000000
--- a/typesystem/src/test/java/org/apache/atlas/typesystem/types/TypeUpdateBaseTest.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * <p/>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p/>
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.atlas.typesystem.types;
-
-import org.apache.atlas.typesystem.TypesDef;
-import org.apache.atlas.typesystem.types.utils.TypesUtil;
-import org.testng.Assert;
-
-public abstract class TypeUpdateBaseTest extends BaseTest {
-    protected void testTypeUpdateForAttributes() throws Exception {
-        StructTypeDefinition typeDefinition =
-                getTypeDefinition(newName(), TypesUtil.createRequiredAttrDef("a", DataTypes.INT_TYPE));
-        TypeSystem ts = getTypeSystem();
-        TypesDef typesDef = getTypesDef(typeDefinition);
-        ts.defineTypes(typesDef);
-        String typeName = typeDefinition.typeName;
-
-        //Allow modifying required to optional attribute
-        typeDefinition = getTypeDefinition(typeName, TypesUtil.createOptionalAttrDef("a", DataTypes.INT_TYPE));
-        ts.updateTypes(getTypesDef(typeDefinition));
-
-        //Allow adding new optional attribute
-        typeDefinition = getTypeDefinition(typeName, TypesUtil.createOptionalAttrDef("a", DataTypes.INT_TYPE),
-                TypesUtil.createOptionalAttrDef("b", DataTypes.INT_TYPE));
-        ts.updateTypes(getTypesDef(typeDefinition));
-
-        //Don't allow adding required attribute
-        typeDefinition = getTypeDefinition(typeName, TypesUtil.createOptionalAttrDef("a", DataTypes.INT_TYPE),
-                TypesUtil.createOptionalAttrDef("b", DataTypes.INT_TYPE),
-                TypesUtil.createRequiredAttrDef("c", DataTypes.INT_TYPE));
-        try {
-            ts.updateTypes(getTypesDef(typeDefinition));
-            Assert.fail("Expected TypeUpdateException");
-        } catch (TypeUpdateException e) {
-            //assert that type is not updated when validation fails
-            Assert.assertEquals(getNumberOfFields(ts, typeDefinition.typeName), 2);
-        }
-
-        //Don't allow removing attribute
-        typeDefinition = getTypeDefinition(typeName, TypesUtil.createOptionalAttrDef("a", DataTypes.INT_TYPE));
-        try {
-            ts.updateTypes(getTypesDef(typeDefinition));
-        } catch (TypeUpdateException e) {
-            //expected
-        }
-
-        //Don't allow modifying other fields of attribute definition - optional to required
-        typeDefinition = getTypeDefinition(typeName, TypesUtil.createOptionalAttrDef("a", DataTypes.INT_TYPE),
-                TypesUtil.createRequiredAttrDef("b", DataTypes.INT_TYPE));
-        try {
-            ts.updateTypes(getTypesDef(typeDefinition));
-        } catch (TypeUpdateException e) {
-            //expected
-        }
-
-        //Don't allow modifying other fields of attribute definition - attribute type change
-        typeDefinition = getTypeDefinition(typeName, TypesUtil.createOptionalAttrDef("a", DataTypes.INT_TYPE),
-                TypesUtil.createOptionalAttrDef("b", DataTypes.STRING_TYPE));
-        try {
-            ts.updateTypes(getTypesDef(typeDefinition));
-        } catch (TypeUpdateException e) {
-            //expected
-        }
-
-        //Don't allow modifying other fields of attribute definition - attribute type change
-        typeDefinition = getTypeDefinition(typeName, TypesUtil.createRequiredAttrDef("a", DataTypes.INT_TYPE),
-                new AttributeDefinition("b", DataTypes.arrayTypeName(DataTypes.STRING_TYPE.getName()),
-                        Multiplicity.COLLECTION, false, null));
-        try {
-            ts.updateTypes(getTypesDef(typeDefinition));
-        } catch (TypeUpdateException e) {
-            //expected
-        }
-    }
-
-    protected abstract int getNumberOfFields(TypeSystem ts, String typeName) throws Exception;
-
-    protected abstract TypesDef getTypesDef(StructTypeDefinition typeDefinition);
-
-    protected abstract StructTypeDefinition getTypeDefinition(String typeName,
-                                                              AttributeDefinition... attributeDefinitions);
-}

http://git-wip-us.apache.org/repos/asf/atlas/blob/0877e47c/typesystem/src/test/java/org/apache/atlas/typesystem/types/ValidationTest.java
----------------------------------------------------------------------
diff --git a/typesystem/src/test/java/org/apache/atlas/typesystem/types/ValidationTest.java b/typesystem/src/test/java/org/apache/atlas/typesystem/types/ValidationTest.java
deleted file mode 100644
index 1a86cf3..0000000
--- a/typesystem/src/test/java/org/apache/atlas/typesystem/types/ValidationTest.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.atlas.typesystem.types;
-
-import com.google.common.collect.ImmutableSet;
-
-import org.apache.atlas.typesystem.types.utils.TypesUtil;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-
-public class ValidationTest {
-    @DataProvider(name = "attributeData")
-    private Object[][] createAttributeData() {
-        return new String[][]{{null, "type"}, {"", "type"}, {"name", null}, {"name", ""}};
-    }
-
-    @Test(dataProvider = "attributeData", expectedExceptions = {IllegalArgumentException.class})
-    public void testAttributes(String name, String type) {
-        TypesUtil.createRequiredAttrDef(name, type);
-    }
-
-    @DataProvider(name = "enumValueData")
-    private Object[][] createEnumValueData() {
-        return new String[][]{{null}, {""}};
-    }
-
-    @Test(dataProvider = "enumValueData", expectedExceptions = {IllegalArgumentException.class})
-    public void testEnumValue(String name) {
-        new EnumValue(name, 1);
-    }
-
-    @DataProvider(name = "enumTypeData")
-    private Object[][] createEnumTypeData() {
-        EnumValue value = new EnumValue("name", 1);
-        return new Object[][]{{null, value}, {"", value}, {"name"}};
-    }
-
-    @Test(dataProvider = "enumTypeData", expectedExceptions = {IllegalArgumentException.class})
-    public void testEnumType(String name, EnumValue... values) {
-        new EnumTypeDefinition(name, values);
-    }
-
-    @DataProvider(name = "structTypeData")
-    private Object[][] createStructTypeData() {
-        AttributeDefinition value = TypesUtil.createRequiredAttrDef("name", "type");
-        return new Object[][]{{null, value}, {"", value}, {"name"}};
-    }
-
-    @Test(dataProvider = "structTypeData", expectedExceptions = {IllegalArgumentException.class})
-    public void testStructType(String name, AttributeDefinition... values) {
-        new StructTypeDefinition(name, values);
-    }
-
-    @DataProvider(name = "classTypeData")
-    private Object[][] createClassTypeData() {
-        return new Object[][]{{null}, {""}};
-    }
-
-    @Test(dataProvider = "classTypeData", expectedExceptions = {IllegalArgumentException.class})
-    public void testClassType(String name) {
-        AttributeDefinition value = TypesUtil.createRequiredAttrDef("name", "type");
-        TypesUtil.createClassTypeDef(name, ImmutableSet.of("super"), value);
-    }
-
-    @Test(dataProvider = "classTypeData", expectedExceptions = {IllegalArgumentException.class})
-    public void testTraitType(String name) {
-        AttributeDefinition value = TypesUtil.createRequiredAttrDef("name", "type");
-        TypesUtil.createTraitTypeDef(name, ImmutableSet.of("super"), value);
-    }
-
-    @Test
-    public void testValidTypes() {
-        AttributeDefinition attribute = TypesUtil.createRequiredAttrDef("name", "type");
-
-        //class with no attributes
-        TypesUtil.createClassTypeDef("name", ImmutableSet.of("super"));
-
-        //class with no super types
-        TypesUtil.createClassTypeDef("name", ImmutableSet.<String>of(), attribute);
-
-        //trait with no attributes
-        TypesUtil.createTraitTypeDef("name", ImmutableSet.of("super"));
-
-        //trait with no super types
-        TypesUtil.createTraitTypeDef("name", ImmutableSet.<String>of(), attribute);
-    }
-}