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 2016/10/02 13:35:22 UTC

[2/5] incubator-atlas git commit: ATLAS-1171 Structured, high-level public APIs (mneethiraj via shwethags)

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/698a5652/intg/src/main/java/org/apache/atlas/type/AtlasTypeRegistry.java
----------------------------------------------------------------------
diff --git a/intg/src/main/java/org/apache/atlas/type/AtlasTypeRegistry.java b/intg/src/main/java/org/apache/atlas/type/AtlasTypeRegistry.java
new file mode 100644
index 0000000..4b2e325
--- /dev/null
+++ b/intg/src/main/java/org/apache/atlas/type/AtlasTypeRegistry.java
@@ -0,0 +1,442 @@
+/**
+ * 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.type;
+
+import org.apache.atlas.exception.AtlasBaseException;
+import org.apache.atlas.model.typedef.*;
+import static org.apache.atlas.model.typedef.AtlasBaseTypeDef.ATLAS_TYPE_ARRAY_PREFIX;
+import static org.apache.atlas.model.typedef.AtlasBaseTypeDef.ATLAS_TYPE_ARRAY_SUFFIX;
+import static org.apache.atlas.model.typedef.AtlasBaseTypeDef.ATLAS_TYPE_MAP_PREFIX;
+import static org.apache.atlas.model.typedef.AtlasBaseTypeDef.ATLAS_TYPE_MAP_SUFFIX;
+import static org.apache.atlas.model.typedef.AtlasBaseTypeDef.ATLAS_TYPE_MAP_KEY_VAL_SEP;
+import org.apache.commons.lang.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+/**
+ * registry for all types defined in Atlas.
+ */
+public class AtlasTypeRegistry {
+    private static final Logger LOG = LoggerFactory.getLogger(AtlasStructType.class);
+
+    private final Map<String, AtlasType>               allTypes;
+    private final TypeDefCache<AtlasEnumDef>           enumDefs;
+    private final TypeDefCache<AtlasStructDef>         structDefs;
+    private final TypeDefCache<AtlasClassificationDef> classificationDefs;
+    private final TypeDefCache<AtlasEntityDef>         entityDefs;
+
+
+    public AtlasTypeRegistry() {
+        allTypes           = new ConcurrentHashMap<String, AtlasType>();
+        enumDefs           = new TypeDefCache<AtlasEnumDef>(this);
+        structDefs         = new TypeDefCache<AtlasStructDef>(this);
+        classificationDefs = new TypeDefCache<AtlasClassificationDef>(this);
+        entityDefs         = new TypeDefCache<AtlasEntityDef>(this);
+
+        registerType(new AtlasBuiltInTypes.AtlasBooleanType());
+        registerType(new AtlasBuiltInTypes.AtlasByteType());
+        registerType(new AtlasBuiltInTypes.AtlasShortType());
+        registerType(new AtlasBuiltInTypes.AtlasIntType());
+        registerType(new AtlasBuiltInTypes.AtlasLongType());
+        registerType(new AtlasBuiltInTypes.AtlasFloatType());
+        registerType(new AtlasBuiltInTypes.AtlasDoubleType());
+        registerType(new AtlasBuiltInTypes.AtlasBigIntegerType());
+        registerType(new AtlasBuiltInTypes.AtlasBigDecimalType());
+        registerType(new AtlasBuiltInTypes.AtlasDateType());
+        registerType(new AtlasBuiltInTypes.AtlasStringType());
+        registerType(new AtlasBuiltInTypes.AtlasObjectIdType());
+    }
+
+    public void resolveReferences() throws AtlasBaseException {
+        for (Map.Entry<String, AtlasType> e : allTypes.entrySet()) {
+            e.getValue().resolveReferences(this);
+        }
+    }
+
+    public Collection<String> getAllTypeNames() { return Collections.unmodifiableSet(allTypes.keySet()); }
+
+    public AtlasType getType(String typeName) {
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("==> AtlasTypeRegistry.getType(" + typeName + ")");
+        }
+
+        AtlasType ret = allTypes.get(typeName);
+
+        if (ret == null) {
+            try {
+                if (typeName.startsWith(ATLAS_TYPE_ARRAY_PREFIX) && typeName.endsWith(ATLAS_TYPE_ARRAY_SUFFIX)) {
+                    int startIdx = ATLAS_TYPE_ARRAY_PREFIX.length();
+                    int endIdx = typeName.length() - ATLAS_TYPE_ARRAY_SUFFIX.length();
+                    String elementTypeName = typeName.substring(startIdx, endIdx);
+
+                    ret = new AtlasArrayType(elementTypeName, this);
+                } else if (typeName.startsWith(ATLAS_TYPE_MAP_PREFIX) && typeName.endsWith(ATLAS_TYPE_MAP_SUFFIX)) {
+                    int startIdx = ATLAS_TYPE_MAP_PREFIX.length();
+                    int endIdx = typeName.length() - ATLAS_TYPE_MAP_SUFFIX.length();
+                    String[] keyValueTypes = typeName.substring(startIdx, endIdx).split(ATLAS_TYPE_MAP_KEY_VAL_SEP, 2);
+                    String keyTypeName = keyValueTypes.length > 0 ? keyValueTypes[0] : null;
+                    String valueTypeName = keyValueTypes.length > 1 ? keyValueTypes[1] : null;
+
+                    ret = new AtlasMapType(keyTypeName, valueTypeName, this);
+                }
+            } catch(AtlasBaseException excp) {
+                LOG.warn("failed to instantiate type for " + typeName, excp);
+            }
+        }
+
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("<== AtlasTypeRegistry.getType(" + typeName + ")");
+        }
+
+        return ret;
+    }
+
+
+    public void addEnumDef(AtlasEnumDef enumDef) {
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("==> AtlasTypeRegistry.addEnumDef(" + enumDef + ")");
+        }
+
+        enumDefs.addType(enumDef, new AtlasEnumType(enumDef));
+
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("<== AtlasTypeRegistry.addEnumDef(" + enumDef + ")");
+        }
+    }
+
+    public Collection<AtlasEnumDef> getAllEnumDefs() { return enumDefs.getAll(); }
+
+    public AtlasEnumDef getEnumDefByGuid(String guid) {
+        return enumDefs.getTypeDefByGuid(guid);
+    }
+
+    public AtlasEnumDef getEnumDefByName(String name) {
+        return enumDefs.getTypeDefByName(name);
+    }
+
+    public void removeEnumDefByGuid(String guid) {
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("==> AtlasTypeRegistry.removeEnumDefByGuid(" + guid + ")");
+        }
+
+        AtlasEnumDef enumDef = enumDefs.getTypeDefByGuid(guid);
+
+        if (enumDef != null) {
+            enumDefs.removeTypeDefByGuid(guid);
+        }
+
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("<== AtlasTypeRegistry.removeEnumDefByGuid(" + guid + ")");
+        }
+    }
+
+    public void removeEnumDefByName(String name) {
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("==> AtlasTypeRegistry.removeEnumDefByName(" + name + ")");
+        }
+
+        AtlasEnumDef enumDef = enumDefs.getTypeDefByName(name);
+
+        if (enumDef != null) {
+            enumDefs.removeTypeDefByName(name);
+        }
+
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("<== AtlasTypeRegistry.removeEnumDefByName(" + name + ")");
+        }
+    }
+
+
+    public void addStructDefWithNoRefResolve(AtlasStructDef structDef) {
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("==> AtlasTypeRegistry.addStructDefWithNoRefResolve(" + structDef + ")");
+        }
+
+        structDefs.addType(structDef, new AtlasStructType(structDef));
+
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("<== AtlasTypeRegistry.addStructDefWithNoRefResolve(" + structDef + ")");
+        }
+    }
+
+    public void addStructDef(AtlasStructDef structDef) throws AtlasBaseException {
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("==> AtlasTypeRegistry.addStructDef(" + structDef + ")");
+        }
+
+        structDefs.addType(structDef, new AtlasStructType(structDef, this));
+
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("<== AtlasTypeRegistry.addStructDef(" + structDef + ")");
+        }
+    }
+
+    public Collection<AtlasStructDef> getAllStructDefs() { return structDefs.getAll(); }
+
+    public AtlasStructDef getStructDefByGuid(String guid) {
+        return structDefs.getTypeDefByGuid(guid);
+    }
+
+    public AtlasStructDef getStructDefByName(String name) { return structDefs.getTypeDefByName(name); }
+
+    public void removeStructDefByGuid(String guid) {
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("==> AtlasTypeRegistry.removeStructDefByGuid(" + guid + ")");
+        }
+
+        AtlasStructDef structDef = structDefs.getTypeDefByGuid(guid);
+
+        if (structDef != null) {
+            structDefs.removeTypeDefByGuid(guid);
+        }
+
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("<== AtlasTypeRegistry.removeStructDefByGuid(" + guid + ")");
+        }
+    }
+
+    public void removeStructDefByName(String name) {
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("==> AtlasTypeRegistry.removeStructDefByName(" + name + ")");
+        }
+
+        AtlasStructDef structDef = structDefs.getTypeDefByName(name);
+
+        if (structDef != null) {
+            structDefs.removeTypeDefByName(name);
+        }
+
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("<== AtlasTypeRegistry.removeStructDefByName(" + name + ")");
+        }
+    }
+
+
+    public void addClassificationDefWithNoRefResolve(AtlasClassificationDef classificationDef) {
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("==> AtlasTypeRegistry.addClassificationDefWithNoRefResolve(" + classificationDef + ")");
+        }
+
+        classificationDefs.addType(classificationDef, new AtlasClassificationType(classificationDef));
+
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("<== AtlasTypeRegistry.addClassificationDefWithNoRefResolve(" + classificationDef + ")");
+        }
+    }
+
+    public void addClassificationDef(AtlasClassificationDef classificationDef)
+        throws AtlasBaseException {
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("==> AtlasTypeRegistry.addClassificationDef(" + classificationDef + ")");
+        }
+
+        classificationDefs.addType(classificationDef, new AtlasClassificationType(classificationDef, this));
+
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("<== AtlasTypeRegistry.addClassificationDef(" + classificationDef + ")");
+        }
+    }
+
+    public Collection<AtlasClassificationDef> getAllClassificationDefs() { return classificationDefs.getAll(); }
+
+    public AtlasClassificationDef getClassificationDefByGuid(String guid) {
+        return classificationDefs.getTypeDefByGuid(guid);
+    }
+
+    public AtlasClassificationDef getClassificationDefByName(String name) {
+        return classificationDefs.getTypeDefByName(name);
+    }
+
+    public void removeClassificationDefByGuid(String guid) {
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("==> AtlasTypeRegistry.removeClassificationDefByGuid(" + guid + ")");
+        }
+
+        AtlasClassificationDef classificationDef = classificationDefs.getTypeDefByGuid(guid);
+
+        if (classificationDef != null) {
+            classificationDefs.removeTypeDefByGuid(guid);
+        }
+
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("<== AtlasTypeRegistry.removeClassificationDefByGuid(" + guid + ")");
+        }
+    }
+
+    public void removeClassificationDefByName(String name) {
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("==> AtlasTypeRegistry.removeClassificationDefByName(" + name + ")");
+        }
+
+        AtlasClassificationDef classificationDef = classificationDefs.getTypeDefByName(name);
+
+        if (classificationDef != null) {
+            classificationDefs.removeTypeDefByName(name);
+        }
+
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("<== AtlasTypeRegistry.removeClassificationDefByName(" + name + ")");
+        }
+    }
+
+
+    public void addEntityDefWithNoRefResolve(AtlasEntityDef entityDef) {
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("==> AtlasTypeRegistry.addEntityDefWithNoRefResolve(" + entityDef + ")");
+        }
+
+        entityDefs.addType(entityDef, new AtlasEntityType(entityDef));
+
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("<== AtlasTypeRegistry.addEntityDefWithNoRefResolve(" + entityDef + ")");
+        }
+    }
+
+    public void addEntityDef(AtlasEntityDef entityDef) throws AtlasBaseException {
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("==> AtlasTypeRegistry.addEntityDef(" + entityDef + ")");
+        }
+
+        entityDefs.addType(entityDef, new AtlasEntityType(entityDef, this));
+
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("<== AtlasTypeRegistry.addEntityDef(" + entityDef + ")");
+        }
+    }
+
+    public Collection<AtlasEntityDef> getAllEntityDefs() { return entityDefs.getAll(); }
+
+    public AtlasEntityDef getEntityDefByGuid(String guid) {
+        return entityDefs.getTypeDefByGuid(guid);
+    }
+
+    public AtlasEntityDef getEntityDefByName(String name) {
+        return entityDefs.getTypeDefByName(name);
+    }
+
+    public void removeEntityDefByGuid(String guid) {
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("==> AtlasTypeRegistry.removeEntityDefByGuid(" + guid + ")");
+        }
+
+        AtlasEntityDef entityDef = entityDefs.getTypeDefByGuid(guid);
+
+        if (entityDef != null) {
+            entityDefs.removeTypeDefByGuid(guid);
+        }
+
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("<== AtlasTypeRegistry.removeEntityDefByGuid(" + guid + ")");
+        }
+    }
+
+    public void removeEntityDefByName(String name) {
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("==> AtlasTypeRegistry.removeEntityDefByName(" + name + ")");
+        }
+
+        AtlasEntityDef entityDef = entityDefs.getTypeDefByName(name);
+
+        if (entityDef != null) {
+            entityDefs.removeTypeDefByName(name);
+        }
+
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("<== AtlasTypeRegistry.removeEntityDefByName(" + name + ")");
+        }
+    }
+
+    private void registerType(AtlasType dataType) {
+        allTypes.put(dataType.getTypeName(), dataType);
+    }
+
+    private void unregisterType(AtlasType dataType) {
+        allTypes.remove(dataType.getTypeName());
+    }
+
+    private void unregisterTypeByName(String typeName) {
+        allTypes.remove(typeName);
+    }
+
+    class TypeDefCache<T extends AtlasBaseTypeDef> {
+        private final AtlasTypeRegistry typeRegistry;
+        private final Map<String, T>    typeDefGuidMap = new ConcurrentHashMap<String, T>();
+        private final Map<String, T>    typeDefNameMap = new ConcurrentHashMap<String, T>();
+
+        public TypeDefCache(AtlasTypeRegistry typeRegistry) {
+            this.typeRegistry = typeRegistry;
+        }
+
+        public void addType(T typeDef, AtlasType type) {
+            if (type != null) {
+                if (StringUtils.isNotEmpty(typeDef.getGuid())) {
+                    typeDefGuidMap.put(typeDef.getGuid(), typeDef);
+                }
+
+                if (StringUtils.isNotEmpty(typeDef.getName())) {
+                    typeDefNameMap.put(typeDef.getName(), typeDef);
+                }
+
+                typeRegistry.registerType(type);
+            }
+        }
+
+        public Collection<T> getAll() {
+            return Collections.unmodifiableCollection(typeDefNameMap.values());
+        }
+
+        public T getTypeDefByGuid(String guid) {
+            T ret = guid != null ? typeDefGuidMap.get(guid) : null;
+
+            return ret;
+        }
+
+        public T getTypeDefByName(String name) {
+            T ret = name != null ? typeDefNameMap.get(name) : null;
+
+            return ret;
+        }
+
+        public void removeTypeDefByGuid(String guid) {
+            T typeDef = guid != null ? typeDefGuidMap.remove(guid) : null;
+
+            if (typeDef != null) {
+                if (StringUtils.isNotEmpty(typeDef.getName())) {
+                    typeDefNameMap.remove(typeDef.getName());
+                    typeRegistry.unregisterTypeByName(typeDef.getName());
+                }
+            }
+        }
+
+        public void removeTypeDefByName(String name) {
+            T typeDef = name != null ? typeDefNameMap.get(name) : null;
+
+            if (typeDef != null) {
+                if (StringUtils.isNotEmpty(typeDef.getGuid())) {
+                    typeDefGuidMap.remove(typeDef.getGuid());
+                    typeRegistry.unregisterTypeByName(typeDef.getName());
+                }
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/698a5652/intg/src/test/java/org/apache/atlas/model/ModelTestUtil.java
----------------------------------------------------------------------
diff --git a/intg/src/test/java/org/apache/atlas/model/ModelTestUtil.java b/intg/src/test/java/org/apache/atlas/model/ModelTestUtil.java
new file mode 100644
index 0000000..fcd22f8
--- /dev/null
+++ b/intg/src/test/java/org/apache/atlas/model/ModelTestUtil.java
@@ -0,0 +1,411 @@
+/**
+ * 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.model;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.ThreadLocalRandom;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import org.apache.atlas.exception.AtlasBaseException;
+import org.apache.atlas.model.instance.AtlasClassification;
+import org.apache.atlas.model.instance.AtlasEntity;
+import org.apache.atlas.model.instance.AtlasStruct;
+
+import static org.apache.atlas.model.typedef.AtlasBaseTypeDef.ATLAS_BUILTIN_TYPES;
+import static org.apache.atlas.model.typedef.AtlasBaseTypeDef.ATLAS_PRIMITIVE_TYPES;
+import org.apache.atlas.model.typedef.AtlasBaseTypeDef;
+import org.apache.atlas.model.typedef.AtlasEntityDef;
+import org.apache.atlas.model.typedef.AtlasEnumDef;
+import org.apache.atlas.model.typedef.AtlasStructDef;
+import org.apache.atlas.model.typedef.AtlasEnumDef.AtlasEnumElementDef;
+import org.apache.atlas.model.typedef.AtlasStructDef.AtlasAttributeDef;
+import org.apache.atlas.model.typedef.AtlasClassificationDef;
+import org.apache.atlas.type.AtlasType;
+import org.apache.atlas.type.AtlasClassificationType;
+import org.apache.atlas.type.AtlasEntityType;
+import org.apache.atlas.type.AtlasStructType;
+import org.apache.atlas.type.AtlasTypeRegistry;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+public final class  ModelTestUtil {
+    private static final Logger LOG = LoggerFactory.getLogger(ModelTestUtil.class);
+
+    private static final String PREFIX_ENUM_DEF           = "testEnumDef-";
+    private static final String PREFIX_STRUCT_DEF         = "testStructDef-";
+    private static final String PREFIX_ENTITY_DEF         = "testEntityDef-";
+    private static final String PREFIX_CLASSIFICATION_DEF = "testClassificationDef-";
+    private static final String PREFIX_ATTRIBUTE_NAME     = "attr-";
+    private static final String PREFIX_STRUCT             = "testStruct-";
+    private static final String PREFIX_ENTITY             = "testEntity-";
+    private static final String PREFIX_CLASSIFICATION     = "testClassification-";
+    private static final int    MAX_ENUM_ELEMENT_COUNT    = 30;
+
+    private static final AtomicInteger IDX_ENUM_DEF           = new AtomicInteger();
+    private static final AtomicInteger IDX_ENTITY_DEF         = new AtomicInteger();
+    private static final AtomicInteger IDX_CLASSIFICATION_DEF = new AtomicInteger();
+    private static final AtomicInteger IDX_STRUCT_DEF         = new AtomicInteger();
+    private static final AtomicInteger IDX_CLASSIFICATION     = new AtomicInteger();
+    private static final AtomicInteger IDX_ENTITY             = new AtomicInteger();
+    private static final AtomicInteger IDX_STRUCT             = new AtomicInteger();
+
+    private static final AtlasTypeRegistry      TYPE_REGISTRY;
+    private static final AtlasEnumDef           ENUM_DEF;
+    private static final AtlasEnumDef           ENUM_DEF_WITH_NO_DEFAULT;
+    private static final AtlasStructDef         STRUCT_DEF;
+    private static final AtlasEntityDef         ENTITY_DEF;
+    private static final AtlasEntityDef         ENTITY_DEF_WITH_SUPER_TYPE;
+    private static final AtlasEntityDef         ENTITY_DEF_WITH_SUPER_TYPES;
+    private static final AtlasClassificationDef CLASSIFICATION_DEF;
+    private static final AtlasClassificationDef CLASSIFICATION_DEF_WITH_SUPER_TYPE;
+    private static final AtlasClassificationDef CLASSIFICATION_DEF_WITH_SUPER_TYPES;
+
+    static {
+        TYPE_REGISTRY = new AtlasTypeRegistry();
+
+        ENUM_DEF                 = newEnumDef(true);
+        ENUM_DEF_WITH_NO_DEFAULT = newEnumDef(false);
+
+        STRUCT_DEF = newStructDef();
+
+        ENTITY_DEF                  = newEntityDef();
+        ENTITY_DEF_WITH_SUPER_TYPE  = newEntityDef(new AtlasEntityDef[] { ENTITY_DEF });
+        ENTITY_DEF_WITH_SUPER_TYPES = newEntityDef(new AtlasEntityDef[] { ENTITY_DEF, ENTITY_DEF_WITH_SUPER_TYPE });
+
+        CLASSIFICATION_DEF                  = newClassificationDef();
+        CLASSIFICATION_DEF_WITH_SUPER_TYPE  = newClassificationDef(new AtlasClassificationDef[] { CLASSIFICATION_DEF });
+        CLASSIFICATION_DEF_WITH_SUPER_TYPES = newClassificationDef(
+                               new AtlasClassificationDef[] { CLASSIFICATION_DEF, CLASSIFICATION_DEF_WITH_SUPER_TYPE });
+    }
+
+    private ModelTestUtil() {
+
+    }
+
+    public static AtlasTypeRegistry getTypesRegistry() { return TYPE_REGISTRY; }
+
+    public static AtlasEnumDef getEnumDef() { return ENUM_DEF; }
+
+    public static AtlasEnumDef getEnumDefWithNoDefault() { return ENUM_DEF_WITH_NO_DEFAULT; }
+
+    public static AtlasStructDef getStructDef() { return STRUCT_DEF; }
+
+    public static AtlasEntityDef getEntityDef() { return ENTITY_DEF; }
+
+    public static AtlasEntityDef getEntityDefWithSuperType() { return ENTITY_DEF_WITH_SUPER_TYPE; }
+
+    public static AtlasEntityDef getEntityDefWithSuperTypes() { return ENTITY_DEF_WITH_SUPER_TYPES; }
+
+    public static AtlasClassificationDef getClassificationDef() { return CLASSIFICATION_DEF; }
+
+    public static AtlasClassificationDef getClassificationDefWithSuperType() {
+        return CLASSIFICATION_DEF_WITH_SUPER_TYPE;
+    }
+
+    public static AtlasClassificationDef getClassificationDefWithSuperTypes() {
+        return CLASSIFICATION_DEF_WITH_SUPER_TYPES;
+    }
+
+
+    public static AtlasEnumDef newEnumDef() {
+        return newEnumDef(getTypesRegistry(), true);
+    }
+
+    public static AtlasEnumDef newEnumDef(boolean hasDefaultValue) {
+        return newEnumDef(getTypesRegistry(), hasDefaultValue);
+    }
+
+    public static AtlasEnumDef newEnumDef(AtlasTypeRegistry typesRegistry) {
+        return newEnumDef(getTypesRegistry(), true);
+    }
+
+    public static AtlasEnumDef newEnumDef(AtlasTypeRegistry typesRegistry, boolean hasDefaultValue) {
+        int enumDefIdx = IDX_ENUM_DEF.getAndIncrement();
+
+        AtlasEnumDef ret = new AtlasEnumDef();
+
+        ret.setName(PREFIX_ENUM_DEF + enumDefIdx);
+        ret.setDescription(ret.getName());
+
+        int numElements = ThreadLocalRandom.current().nextInt(1, MAX_ENUM_ELEMENT_COUNT);
+
+        for (int i = 0; i < numElements; i++) {
+            String elementName = "element-" + i;
+            ret.addElement(new AtlasEnumElementDef(elementName, elementName.toUpperCase(), i));
+        }
+
+        if (hasDefaultValue) {
+            int idxDefault = ThreadLocalRandom.current().nextInt(0, numElements);
+
+            ret.setDefaultValue(ret.getElementDefs().get(idxDefault).getValue());
+        }
+
+        typesRegistry.addEnumDef(ret);
+
+        return ret;
+    }
+
+    public static AtlasStructDef newStructDef() {
+        return newStructDef(getTypesRegistry());
+    }
+
+    public static AtlasStructDef newStructDef(AtlasTypeRegistry typesRegistry) {
+        int structDefIdx = IDX_STRUCT_DEF.getAndIncrement();
+
+        AtlasStructDef ret = new AtlasStructDef();
+
+        ret.setName(PREFIX_STRUCT_DEF + structDefIdx);
+        ret.setDescription(ret.getName());
+        ret.setAttributeDefs(newAttributeDefsWithAllBuiltInTypes(PREFIX_ATTRIBUTE_NAME));
+
+        try {
+            typesRegistry.addStructDef(ret);
+        } catch (AtlasBaseException excp) {
+            LOG.error("failed to create struct-def", excp);
+
+            ret = null;
+        }
+
+        return ret;
+    }
+
+    public static AtlasEntityDef newEntityDef() {
+        return newEntityDef(getTypesRegistry(), null);
+    }
+
+    public static AtlasEntityDef newEntityDef(AtlasEntityDef[] superTypes) {
+        return newEntityDef(getTypesRegistry(), superTypes);
+    }
+
+    public static AtlasEntityDef newEntityDef(AtlasTypeRegistry typesRegistry) {
+        return newEntityDef(getTypesRegistry(), null);
+    }
+
+    public static AtlasEntityDef newEntityDef(AtlasTypeRegistry typesRegistry, AtlasEntityDef[] superTypes) {
+        int entDefIdx = IDX_ENTITY_DEF.getAndIncrement();
+
+        AtlasEntityDef ret = new AtlasEntityDef();
+
+        ret.setName(PREFIX_ENTITY_DEF + entDefIdx);
+        ret.setDescription(ret.getName());
+        ret.setAttributeDefs(newAttributeDefsWithAllBuiltInTypes(PREFIX_ATTRIBUTE_NAME));
+
+        if (superTypes != null) {
+            for (AtlasEntityDef superType : superTypes) {
+                ret.addSuperType(superType.getName());
+            }
+        }
+
+        try {
+            typesRegistry.addEntityDef(ret);
+        } catch (AtlasBaseException excp) {
+            LOG.error("failed to create entity-def", excp);
+
+            ret = null;
+        }
+
+        return ret;
+    }
+
+    public static AtlasEntityDef newEntityDefWithSuperTypes() {
+        return newEntityDefWithSuperTypes(getTypesRegistry());
+    }
+
+    public static AtlasEntityDef newEntityDefWithSuperTypes(AtlasTypeRegistry typesRegistry) {
+        return newEntityDef(typesRegistry, new AtlasEntityDef[] { ENTITY_DEF, ENTITY_DEF_WITH_SUPER_TYPE });
+    }
+
+    public static AtlasClassificationDef newClassificationDef() {
+        return newClassificationDef(getTypesRegistry(), null);
+    }
+
+    public static AtlasClassificationDef newClassificationDef(AtlasClassificationDef[] superTypes) {
+        return newClassificationDef(getTypesRegistry(), superTypes);
+    }
+
+    public static AtlasClassificationDef newClassificationDef(AtlasTypeRegistry typesRegistry) {
+        return newClassificationDef(typesRegistry, null);
+    }
+
+    public static AtlasClassificationDef newClassificationDef(AtlasTypeRegistry typesRegistry,
+                                                              AtlasClassificationDef[] superTypes) {
+        int classificationDefIdx = IDX_CLASSIFICATION_DEF.getAndIncrement();
+
+        AtlasClassificationDef ret = new AtlasClassificationDef();
+
+        ret.setName(PREFIX_CLASSIFICATION_DEF + classificationDefIdx);
+        ret.setDescription(ret.getName());
+        ret.setAttributeDefs(newAttributeDefsWithAllBuiltInTypes(PREFIX_ATTRIBUTE_NAME));
+
+        if (superTypes != null) {
+            for (AtlasClassificationDef superType : superTypes) {
+                ret.addSuperType(superType.getName());
+            }
+        }
+
+        try {
+            typesRegistry.addClassificationDef(ret);
+        } catch (AtlasBaseException excp) {
+            LOG.error("failed to create classification-def", excp);
+
+            ret = null;
+        }
+
+        return ret;
+    }
+
+
+    public static AtlasEntity newEntity(AtlasEntityDef entityDef) {
+        return newEntity(entityDef, getTypesRegistry());
+    }
+
+    public static AtlasEntity newEntity(AtlasEntityDef entityDef, AtlasTypeRegistry typesRegistry) {
+        AtlasEntity ret = null;
+
+        AtlasType dataType = typesRegistry.getType(entityDef.getName());
+
+        if (dataType != null && dataType instanceof AtlasEntityType) {
+            ret = ((AtlasEntityType)dataType).createDefaultValue();
+        }
+
+        return ret;
+    }
+
+    public static AtlasStruct newStruct(AtlasStructDef structDef) {
+        return newStruct(structDef, getTypesRegistry());
+    }
+
+    public static AtlasStruct newStruct(AtlasStructDef structDef, AtlasTypeRegistry typesRegistry) {
+        AtlasStruct ret = null;
+
+        AtlasType dataType = typesRegistry.getType(structDef.getName());
+
+        if (dataType != null && dataType instanceof AtlasStructType) {
+            ret = ((AtlasStructType)dataType).createDefaultValue();
+        }
+
+        return ret;
+    }
+
+    public static AtlasClassification newClassification(AtlasClassificationDef classificationDef) {
+        return newClassification(classificationDef, getTypesRegistry());
+    }
+
+    public static AtlasClassification newClassification(AtlasClassificationDef classificationDef,
+                                                        AtlasTypeRegistry typesRegistry) {
+        AtlasClassification ret = null;
+
+        AtlasType dataType = typesRegistry.getType(classificationDef.getName());
+
+        if (dataType != null && dataType instanceof AtlasClassificationType) {
+            ret = ((AtlasClassificationType)dataType).createDefaultValue();
+        }
+
+        return ret;
+    }
+
+    public static List<AtlasAttributeDef> newAttributeDefsWithAllBuiltInTypes(String attrNamePrefix) {
+        List<AtlasAttributeDef> ret = new ArrayList<AtlasAttributeDef>();
+
+        // add all built-in types
+        for (int i = 0; i < ATLAS_BUILTIN_TYPES.length; i++) {
+            ret.add(getAttributeDef(attrNamePrefix, ATLAS_BUILTIN_TYPES[i]));
+        }
+        // add enum types
+        ret.add(getAttributeDef(attrNamePrefix, ENUM_DEF.getName()));
+        ret.add(getAttributeDef(attrNamePrefix, ENUM_DEF_WITH_NO_DEFAULT.getName()));
+
+        // add array of built-in types
+        for (int i = 0; i < ATLAS_BUILTIN_TYPES.length; i++) {
+            ret.add(getAttributeDef(attrNamePrefix, AtlasBaseTypeDef.getArrayTypeName(ATLAS_BUILTIN_TYPES[i])));
+        }
+        // add array of enum types
+        ret.add(getAttributeDef(attrNamePrefix, AtlasBaseTypeDef.getArrayTypeName(ENUM_DEF.getName())));
+        ret.add(getAttributeDef(attrNamePrefix, AtlasBaseTypeDef.getArrayTypeName(ENUM_DEF_WITH_NO_DEFAULT.getName())));
+
+        // add few map types
+        for (int i = 0; i < ATLAS_PRIMITIVE_TYPES.length; i++) {
+            ret.add(getAttributeDef(attrNamePrefix,
+                    AtlasBaseTypeDef.getMapTypeName(ATLAS_PRIMITIVE_TYPES[i], getRandomBuiltInType())));
+        }
+        // add map types with enum as key
+        ret.add(getAttributeDef(attrNamePrefix,
+                                AtlasBaseTypeDef.getMapTypeName(ENUM_DEF.getName(), getRandomBuiltInType())));
+        ret.add(getAttributeDef(attrNamePrefix,
+                AtlasBaseTypeDef.getMapTypeName(ENUM_DEF_WITH_NO_DEFAULT.getName(), getRandomBuiltInType())));
+        // add map types with enum as value
+        ret.add(getAttributeDef(attrNamePrefix,
+                AtlasBaseTypeDef.getMapTypeName(getRandomPrimitiveType(), ENUM_DEF.getName())));
+        ret.add(getAttributeDef(attrNamePrefix,
+                AtlasBaseTypeDef.getMapTypeName(getRandomPrimitiveType(), ENUM_DEF_WITH_NO_DEFAULT.getName())));
+
+        // add few array of arrays
+        for (int i = 0; i < ATLAS_BUILTIN_TYPES.length; i++) {
+            ret.add(getAttributeDef(attrNamePrefix,
+                    AtlasBaseTypeDef.getArrayTypeName(AtlasBaseTypeDef.getArrayTypeName(getRandomBuiltInType()))));
+        }
+        ret.add(getAttributeDef(attrNamePrefix, AtlasBaseTypeDef.getArrayTypeName(ENUM_DEF.getName())));
+        ret.add(getAttributeDef(attrNamePrefix, AtlasBaseTypeDef.getArrayTypeName(ENUM_DEF_WITH_NO_DEFAULT.getName())));
+
+        // add few array of maps
+        for (int i = 0; i < ATLAS_PRIMITIVE_TYPES.length; i++) {
+            ret.add(getAttributeDef(attrNamePrefix, AtlasBaseTypeDef.getArrayTypeName(
+                    AtlasBaseTypeDef.getMapTypeName(ATLAS_PRIMITIVE_TYPES[i], getRandomBuiltInType()))));
+        }
+        ret.add(getAttributeDef(attrNamePrefix, AtlasBaseTypeDef.getArrayTypeName(
+                AtlasBaseTypeDef.getMapTypeName(ENUM_DEF.getName(), getRandomBuiltInType()))));
+        ret.add(getAttributeDef(attrNamePrefix, AtlasBaseTypeDef.getArrayTypeName(
+                AtlasBaseTypeDef.getMapTypeName(ENUM_DEF_WITH_NO_DEFAULT.getName(), getRandomBuiltInType()))));
+        ret.add(getAttributeDef(attrNamePrefix, AtlasBaseTypeDef.getArrayTypeName(
+                AtlasBaseTypeDef.getMapTypeName(getRandomPrimitiveType(), ENUM_DEF.getName()))));
+        ret.add(getAttributeDef(attrNamePrefix, AtlasBaseTypeDef.getArrayTypeName(
+                AtlasBaseTypeDef.getMapTypeName(getRandomPrimitiveType(), ENUM_DEF_WITH_NO_DEFAULT.getName()))));
+
+        // add few map of arrays
+        for (int i = 0; i < ATLAS_PRIMITIVE_TYPES.length; i++) {
+            ret.add(getAttributeDef(attrNamePrefix, AtlasBaseTypeDef.getMapTypeName(ATLAS_PRIMITIVE_TYPES[i],
+                                    AtlasBaseTypeDef.getArrayTypeName(getRandomBuiltInType()))));
+        }
+
+        // add few map of maps
+        for (int i = 0; i < ATLAS_PRIMITIVE_TYPES.length; i++) {
+            ret.add(getAttributeDef(attrNamePrefix, AtlasBaseTypeDef.getMapTypeName(ATLAS_PRIMITIVE_TYPES[i],
+                                   AtlasBaseTypeDef.getMapTypeName(ATLAS_PRIMITIVE_TYPES[i], getRandomBuiltInType()))));
+        }
+
+        return ret;
+    }
+
+    public static String getDefaultAttributeName(String attrType) {
+        return PREFIX_ATTRIBUTE_NAME + attrType;
+    }
+
+    private static AtlasAttributeDef getAttributeDef(String attrNamePrefix, String attrType) {
+        return new AtlasAttributeDef(attrNamePrefix + attrType, attrType);
+    }
+
+    private static String getRandomPrimitiveType() {
+        return ATLAS_PRIMITIVE_TYPES[ThreadLocalRandom.current().nextInt(0, ATLAS_PRIMITIVE_TYPES.length)];
+    }
+
+    private static String getRandomBuiltInType() {
+        return ATLAS_BUILTIN_TYPES[ThreadLocalRandom.current().nextInt(0, ATLAS_BUILTIN_TYPES.length)];
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/698a5652/intg/src/test/java/org/apache/atlas/model/instance/TestAtlasClassification.java
----------------------------------------------------------------------
diff --git a/intg/src/test/java/org/apache/atlas/model/instance/TestAtlasClassification.java b/intg/src/test/java/org/apache/atlas/model/instance/TestAtlasClassification.java
new file mode 100644
index 0000000..577dccf
--- /dev/null
+++ b/intg/src/test/java/org/apache/atlas/model/instance/TestAtlasClassification.java
@@ -0,0 +1,89 @@
+/**
+ * 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.model.instance;
+
+import org.apache.atlas.model.ModelTestUtil;
+import org.apache.atlas.model.typedef.AtlasClassificationDef;
+import org.apache.atlas.type.AtlasType;
+import org.apache.atlas.type.AtlasClassificationType;
+import org.apache.atlas.type.AtlasTypeRegistry;
+import org.testng.annotations.Test;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertTrue;
+
+
+public class TestAtlasClassification {
+
+    @Test
+    public void testClassificationSerDe() {
+        AtlasClassificationDef classificationDef = ModelTestUtil.getClassificationDef();
+        AtlasTypeRegistry      typeRegistry      = ModelTestUtil.getTypesRegistry();
+        AtlasType              dataType          = typeRegistry.getType(classificationDef.getName());
+
+        assertTrue(dataType instanceof  AtlasClassificationType);
+
+        AtlasClassification ent1 = ModelTestUtil.newClassification(classificationDef, typeRegistry);
+
+        String jsonString = AtlasType.toJson(ent1);
+
+        AtlasClassification ent2 = AtlasType.fromJson(jsonString, AtlasClassification.class);
+
+        ((AtlasClassificationType)dataType).normalizeAttributeValues(ent2);
+
+        assertEquals(ent2, ent1, "Incorrect serialization/deserialization of AtlasClassification");
+    }
+
+    @Test
+    public void testClassificationSerDeWithSuperType() {
+        AtlasClassificationDef classificationDef = ModelTestUtil.getClassificationDefWithSuperType();
+        AtlasTypeRegistry      typeRegistry      = ModelTestUtil.getTypesRegistry();
+        AtlasType              dataType          = typeRegistry.getType(classificationDef.getName());
+
+        assertTrue(dataType instanceof AtlasClassificationType);
+
+        AtlasClassification ent1 =  ((AtlasClassificationType)dataType).createDefaultValue();
+
+        String jsonString = AtlasType.toJson(ent1);
+
+        AtlasClassification ent2 = AtlasType.fromJson(jsonString, AtlasClassification.class);
+
+        ((AtlasClassificationType)dataType).normalizeAttributeValues(ent2);
+
+        assertEquals(ent2, ent1, "Incorrect serialization/deserialization of AtlasClassification with superType");
+    }
+
+    @Test
+    public void testClassificationSerDeWithSuperTypes() {
+        AtlasClassificationDef classificationDef = ModelTestUtil.getClassificationDefWithSuperTypes();
+        AtlasTypeRegistry      typeRegistry      = ModelTestUtil.getTypesRegistry();
+        AtlasType              dataType          = typeRegistry.getType(classificationDef.getName());
+
+        assertTrue(dataType instanceof  AtlasClassificationType);
+
+        AtlasClassification ent1 =  ((AtlasClassificationType)dataType).createDefaultValue();
+
+        String jsonString = AtlasType.toJson(ent1);
+
+        AtlasClassification ent2 = AtlasType.fromJson(jsonString, AtlasClassification.class);
+
+        ((AtlasClassificationType)dataType).normalizeAttributeValues(ent2);
+
+        assertEquals(ent2, ent1, "Incorrect serialization/deserialization of AtlasClassification with superTypes");
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/698a5652/intg/src/test/java/org/apache/atlas/model/instance/TestAtlasEntity.java
----------------------------------------------------------------------
diff --git a/intg/src/test/java/org/apache/atlas/model/instance/TestAtlasEntity.java b/intg/src/test/java/org/apache/atlas/model/instance/TestAtlasEntity.java
new file mode 100644
index 0000000..fbf1cc7
--- /dev/null
+++ b/intg/src/test/java/org/apache/atlas/model/instance/TestAtlasEntity.java
@@ -0,0 +1,89 @@
+/**
+ * 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.model.instance;
+
+import org.apache.atlas.model.ModelTestUtil;
+import org.apache.atlas.model.typedef.AtlasEntityDef;
+import org.apache.atlas.type.AtlasType;
+import org.apache.atlas.type.AtlasEntityType;
+import org.apache.atlas.type.AtlasTypeRegistry;
+import org.testng.annotations.Test;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertTrue;
+
+
+public class TestAtlasEntity {
+
+    @Test
+    public void testEntitySerDe() {
+        AtlasEntityDef    entityDef    = ModelTestUtil.getEntityDef();
+        AtlasTypeRegistry typeRegistry = ModelTestUtil.getTypesRegistry();
+        AtlasType         dataType     = typeRegistry.getType(entityDef.getName());
+
+        assertTrue(dataType instanceof  AtlasEntityType);
+
+        AtlasEntity ent1 =  ((AtlasEntityType)dataType).createDefaultValue();
+
+        String jsonString = AtlasType.toJson(ent1);
+
+        AtlasEntity ent2 = AtlasType.fromJson(jsonString, AtlasEntity.class);
+
+        ((AtlasEntityType)dataType).normalizeAttributeValues(ent2);
+
+        assertEquals(ent2, ent1, "Incorrect serialization/deserialization of AtlasEntity");
+    }
+
+    @Test
+    public void testEntitySerDeWithSuperType() {
+        AtlasEntityDef    entityDef    = ModelTestUtil.getEntityDefWithSuperType();
+        AtlasTypeRegistry typeRegistry = ModelTestUtil.getTypesRegistry();
+        AtlasType         dataType     = typeRegistry.getType(entityDef.getName());
+
+        assertTrue(dataType instanceof  AtlasEntityType);
+
+        AtlasEntity ent1 =  ((AtlasEntityType)dataType).createDefaultValue();
+
+        String jsonString = AtlasType.toJson(ent1);
+
+        AtlasEntity ent2 = AtlasType.fromJson(jsonString, AtlasEntity.class);
+
+        ((AtlasEntityType)dataType).normalizeAttributeValues(ent2);
+
+        assertEquals(ent2, ent1, "Incorrect serialization/deserialization of AtlasEntity with superType");
+    }
+
+    @Test
+    public void testEntitySerDeWithSuperTypes() {
+        AtlasEntityDef    entityDef    = ModelTestUtil.getEntityDefWithSuperTypes();
+        AtlasTypeRegistry typeRegistry = ModelTestUtil.getTypesRegistry();
+        AtlasType         dataType     = typeRegistry.getType(entityDef.getName());
+
+        assertTrue(dataType instanceof  AtlasEntityType);
+
+        AtlasEntity ent1 =  ((AtlasEntityType)dataType).createDefaultValue();
+
+        String jsonString = AtlasType.toJson(ent1);
+
+        AtlasEntity ent2 = AtlasType.fromJson(jsonString, AtlasEntity.class);
+
+        ((AtlasEntityType)dataType).normalizeAttributeValues(ent2);
+
+        assertEquals(ent2, ent1, "Incorrect serialization/deserialization of AtlasEntity with superTypes");
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/698a5652/intg/src/test/java/org/apache/atlas/model/typedef/TestAtlasClassificationDef.java
----------------------------------------------------------------------
diff --git a/intg/src/test/java/org/apache/atlas/model/typedef/TestAtlasClassificationDef.java b/intg/src/test/java/org/apache/atlas/model/typedef/TestAtlasClassificationDef.java
new file mode 100644
index 0000000..a1abc6e
--- /dev/null
+++ b/intg/src/test/java/org/apache/atlas/model/typedef/TestAtlasClassificationDef.java
@@ -0,0 +1,100 @@
+/**
+ * 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.model.typedef;
+
+import org.apache.atlas.model.ModelTestUtil;
+import org.apache.atlas.type.AtlasType;
+import org.testng.annotations.Test;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertTrue;
+import static org.testng.Assert.assertFalse;
+
+
+public class TestAtlasClassificationDef {
+
+    @Test
+    public void testClassificationDefSerDeEmpty() {
+        AtlasClassificationDef classificationDef = new AtlasClassificationDef("emptyClassificationDef");
+
+        String jsonString = AtlasType.toJson(classificationDef);
+
+        AtlasClassificationDef classificationDef2 = AtlasType.fromJson(jsonString, AtlasClassificationDef.class);
+
+        assertEquals(classificationDef2, classificationDef,
+                     "Incorrect serialization/deserialization of AtlasClassificationDef");
+    }
+
+    @Test
+    public void testClassificationDefSerDe() {
+        AtlasClassificationDef classificationDef = ModelTestUtil.getClassificationDef();
+
+        String jsonString = AtlasType.toJson(classificationDef);
+
+        AtlasClassificationDef classificationDef2 = AtlasType.fromJson(jsonString, AtlasClassificationDef.class);
+
+        assertEquals(classificationDef2, classificationDef,
+                     "Incorrect serialization/deserialization of AtlasClassificationDef");
+    }
+
+    @Test
+    public void testClassificationDefSerDeWithSuperType() {
+        AtlasClassificationDef classificationDef = ModelTestUtil.getClassificationDefWithSuperType();
+
+        String jsonString = AtlasType.toJson(classificationDef);
+
+        AtlasClassificationDef classificationDef2 = AtlasType.fromJson(jsonString, AtlasClassificationDef.class);
+
+        assertEquals(classificationDef2, classificationDef,
+                     "Incorrect serialization/deserialization of AtlasClassificationDef with superType");
+    }
+
+    @Test
+    public void testClassificationDefSerDeWithSuperTypes() {
+        AtlasClassificationDef classificationDef = ModelTestUtil.getClassificationDefWithSuperTypes();
+
+        String jsonString = AtlasType.toJson(classificationDef);
+
+        AtlasClassificationDef classificationDef2 = AtlasType.fromJson(jsonString, AtlasClassificationDef.class);
+
+        assertEquals(classificationDef2, classificationDef,
+                     "Incorrect serialization/deserialization of AtlasClassificationDef with superTypes");
+    }
+
+    @Test
+    public void testClassificationDefHasSuperTypeWithNoSuperType() {
+        AtlasClassificationDef classificationDef = ModelTestUtil.getClassificationDef();
+
+        for (String superType : classificationDef.getSuperTypes()) {
+            assertTrue(classificationDef.hasSuperType(superType));
+        }
+
+        assertFalse(classificationDef.hasSuperType("01234-xyzabc-;''-)("));
+    }
+
+    @Test
+    public void testClassificationDefHasSuperTypeWithSuperType() {
+        AtlasClassificationDef classificationDef = ModelTestUtil.getClassificationDefWithSuperTypes();
+
+        for (String superType : classificationDef.getSuperTypes()) {
+            assertTrue(classificationDef.hasSuperType(superType));
+        }
+
+        assertFalse(classificationDef.hasSuperType("01234-xyzabc-;''-)("));
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/698a5652/intg/src/test/java/org/apache/atlas/model/typedef/TestAtlasEntityDef.java
----------------------------------------------------------------------
diff --git a/intg/src/test/java/org/apache/atlas/model/typedef/TestAtlasEntityDef.java b/intg/src/test/java/org/apache/atlas/model/typedef/TestAtlasEntityDef.java
new file mode 100644
index 0000000..f3b12ef
--- /dev/null
+++ b/intg/src/test/java/org/apache/atlas/model/typedef/TestAtlasEntityDef.java
@@ -0,0 +1,140 @@
+/**
+ * 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.model.typedef;
+
+import org.apache.atlas.model.ModelTestUtil;
+import org.apache.atlas.type.AtlasType;
+import org.testng.annotations.Test;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertTrue;
+import static org.testng.Assert.assertFalse;
+
+
+public class TestAtlasEntityDef {
+
+    @Test
+    public void testEntityDefSerDeEmpty() {
+        AtlasEntityDef entityDef = new AtlasEntityDef("emptyEntityDef");
+
+        String jsonString = AtlasType.toJson(entityDef);
+
+        AtlasEntityDef entityDef2 = AtlasType.fromJson(jsonString, AtlasEntityDef.class);
+
+        assertEquals(entityDef2, entityDef, "Incorrect serialization/deserialization of AtlasEntityDef");
+    }
+
+    @Test
+    public void testEntityDefSerDe() {
+        AtlasEntityDef entityDef = ModelTestUtil.getEntityDef();
+
+        String jsonString = AtlasType.toJson(entityDef);
+
+        AtlasEntityDef entityDef2 = AtlasType.fromJson(jsonString, AtlasEntityDef.class);
+
+        assertEquals(entityDef2, entityDef, "Incorrect serialization/deserialization of AtlasEntityDef");
+    }
+
+    @Test
+    public void testEntityDefSerDeWithSuperType() {
+        AtlasEntityDef entityDef = ModelTestUtil.getEntityDefWithSuperType();
+
+        String jsonString = AtlasType.toJson(entityDef);
+
+        AtlasEntityDef entityDef2 = AtlasType.fromJson(jsonString, AtlasEntityDef.class);
+
+        assertEquals(entityDef2, entityDef, "Incorrect serialization/deserialization of AtlasEntityDef with superType");
+    }
+
+    @Test
+    public void testEntityDefSerDeWithSuperTypes() {
+        AtlasEntityDef entityDef = ModelTestUtil.getEntityDefWithSuperTypes();
+
+        String jsonString = AtlasType.toJson(entityDef);
+
+        AtlasEntityDef entityDef2 = AtlasType.fromJson(jsonString, AtlasEntityDef.class);
+
+        assertEquals(entityDef2, entityDef,
+                     "Incorrect serialization/deserialization of AtlasEntityDef with superTypes");
+    }
+
+    @Test
+    public void testEntityDefAddSuperType() {
+        AtlasEntityDef entityDef = ModelTestUtil.newEntityDef();
+
+        String newSuperType = "newType-abcd-1234";
+        entityDef.addSuperType(newSuperType);
+
+        assertTrue(entityDef.hasSuperType(newSuperType));
+    }
+
+    @Test
+    public void testEntityDefDefRemoveElement() {
+        AtlasEntityDef entityDef = ModelTestUtil.newEntityDefWithSuperTypes();
+
+        for (String superType : entityDef.getSuperTypes()) {
+            entityDef.removeSuperType(superType);
+            assertFalse(entityDef.hasSuperType(superType));
+        }
+    }
+
+    @Test
+    public void testEntityDefSetSuperTypes() {
+        AtlasEntityDef entityDef = ModelTestUtil.newEntityDefWithSuperTypes();
+
+        Set<String> oldSuperTypes = entityDef.getSuperTypes();
+        Set<String> newSuperTypes = new HashSet<String>();
+
+        newSuperTypes.add("newType-abcd-1234");
+
+        entityDef.setSuperTypes(newSuperTypes);
+
+        for (String superType : oldSuperTypes) {
+            assertFalse(entityDef.hasSuperType(superType));
+        }
+
+        for (String superType : newSuperTypes) {
+            assertTrue(entityDef.hasSuperType(superType));
+        }
+    }
+
+    @Test
+    public void testEntityDefHasSuperTypeWithNoSuperType() {
+        AtlasEntityDef entityDef = ModelTestUtil.getEntityDef();
+
+        for (String superType : entityDef.getSuperTypes()) {
+            assertTrue(entityDef.hasSuperType(superType));
+        }
+
+        assertFalse(entityDef.hasSuperType("01234-xyzabc-;''-)("));
+    }
+
+    @Test
+    public void testEntityDefHasSuperTypeWithNoSuperTypes() {
+        AtlasEntityDef entityDef = ModelTestUtil.getEntityDefWithSuperTypes();
+
+        for (String superType : entityDef.getSuperTypes()) {
+            assertTrue(entityDef.hasSuperType(superType));
+        }
+
+        assertFalse(entityDef.hasSuperType("01234-xyzabc-;''-)("));
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/698a5652/intg/src/test/java/org/apache/atlas/model/typedef/TestAtlasEnumDef.java
----------------------------------------------------------------------
diff --git a/intg/src/test/java/org/apache/atlas/model/typedef/TestAtlasEnumDef.java b/intg/src/test/java/org/apache/atlas/model/typedef/TestAtlasEnumDef.java
new file mode 100644
index 0000000..61e102e
--- /dev/null
+++ b/intg/src/test/java/org/apache/atlas/model/typedef/TestAtlasEnumDef.java
@@ -0,0 +1,110 @@
+/**
+ * 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.model.typedef;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.atlas.model.ModelTestUtil;
+import org.apache.atlas.model.typedef.AtlasEnumDef.AtlasEnumElementDef;
+import org.apache.atlas.type.AtlasType;
+import org.testng.annotations.Test;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
+
+
+public class TestAtlasEnumDef {
+
+    @Test
+    public void testEnumDefSerDeEmpty() {
+        AtlasEnumDef enumDef1 = new AtlasEnumDef();
+
+        String jsonString = AtlasType.toJson(enumDef1);
+
+        AtlasEnumDef enumDef2 = AtlasType.fromJson(jsonString, AtlasEnumDef.class);
+
+        assertEquals(enumDef1, enumDef2, "Incorrect serialization/deserialization of AtlasEnumDef");
+    }
+
+    @Test
+    public void testEnumDefSerDe() {
+        AtlasEnumDef enumDef = ModelTestUtil.getEnumDef();
+
+        String jsonString = AtlasType.toJson(enumDef);
+
+        AtlasEnumDef enumDef2 = AtlasType.fromJson(jsonString, AtlasEnumDef.class);
+
+        assertEquals(enumDef, enumDef2, "Incorrect serialization/deserialization of AtlasEnumDef");
+    }
+
+    @Test
+    public void testEnumDefHasElement() {
+        AtlasEnumDef enumDef = ModelTestUtil.getEnumDef();
+
+        for (AtlasEnumElementDef elementDef : enumDef.getElementDefs()) {
+            assertTrue(enumDef.hasElement(elementDef.getValue()));
+        }
+
+        assertFalse(enumDef.hasElement("01234-xyzabc-;''-)("));
+    }
+
+    @Test
+    public void testEnumDefAddElement() {
+        AtlasEnumDef enumDef = ModelTestUtil.newEnumDef();
+
+        String newElement = "newElement-abcd-1234";
+        enumDef.addElement(new AtlasEnumElementDef(newElement, "A new element", enumDef.getElementDefs().size()));
+        assertTrue(enumDef.hasElement(newElement));
+    }
+
+    @Test
+    public void testEnumDefRemoveElement() {
+        AtlasEnumDef enumDef = ModelTestUtil.newEnumDef();
+
+        if (enumDef.getElementDefs().size() > 0) {
+            String elementValue = enumDef.getElementDefs().get(0).getValue();
+
+            assertTrue(enumDef.hasElement(elementValue));
+
+            enumDef.removeElement(elementValue);
+            assertFalse(enumDef.hasElement(elementValue));
+        }
+    }
+
+    @Test
+    public void testEnumDefSetElementDefs() {
+        AtlasEnumDef enumDef = ModelTestUtil.newEnumDef();
+
+        List<AtlasEnumElementDef> oldElements = enumDef.getElementDefs();
+        List<AtlasEnumElementDef> newElements = new ArrayList<AtlasEnumElementDef>();
+
+        newElements.add(new AtlasEnumElementDef("newElement", "new Element", 100));
+
+        enumDef.setElementDefs(newElements);
+
+        for (AtlasEnumElementDef elementDef : oldElements) {
+            assertFalse(enumDef.hasElement(elementDef.getValue()));
+        }
+
+        for (AtlasEnumElementDef elementDef : newElements) {
+            assertTrue(enumDef.hasElement(elementDef.getValue()));
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/698a5652/intg/src/test/java/org/apache/atlas/model/typedef/TestAtlasStructDef.java
----------------------------------------------------------------------
diff --git a/intg/src/test/java/org/apache/atlas/model/typedef/TestAtlasStructDef.java b/intg/src/test/java/org/apache/atlas/model/typedef/TestAtlasStructDef.java
new file mode 100644
index 0000000..b87b33e
--- /dev/null
+++ b/intg/src/test/java/org/apache/atlas/model/typedef/TestAtlasStructDef.java
@@ -0,0 +1,104 @@
+/**
+ * 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.model.typedef;
+
+import java.util.List;
+
+import org.apache.atlas.model.ModelTestUtil;
+import org.apache.atlas.model.typedef.AtlasStructDef.AtlasAttributeDef;
+import org.apache.atlas.type.AtlasType;
+import org.testng.annotations.Test;
+
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertTrue;
+import static org.testng.Assert.assertFalse;
+
+
+public class TestAtlasStructDef {
+
+    @Test
+    public void testStructDefSerDeEmpty() {
+        AtlasStructDef structDef = new AtlasStructDef("emptyStructDef");
+
+        String jsonString = AtlasType.toJson(structDef);
+
+        AtlasStructDef structDef2 = AtlasType.fromJson(jsonString, AtlasStructDef.class);
+
+        assertEquals(structDef2, structDef, "Incorrect serialization/deserialization of AtlasStructDef");
+    }
+
+    @Test
+    public void testStructDefSerDe() {
+        AtlasStructDef structDef = ModelTestUtil.getStructDef();
+
+        String jsonString = AtlasType.toJson(structDef);
+
+        AtlasStructDef structDef2 = AtlasType.fromJson(jsonString, AtlasStructDef.class);
+
+        assertEquals(structDef2, structDef, "Incorrect serialization/deserialization of AtlasStructDef");
+    }
+
+    @Test
+    public void testStructDefHasAttribute() {
+        AtlasStructDef structDef = ModelTestUtil.getStructDef();
+
+        for (AtlasAttributeDef attributeDef : structDef.getAttributeDefs()) {
+            assertTrue(structDef.hasAttribute(attributeDef.getName()));
+        }
+
+        assertFalse(structDef.hasAttribute("01234-xyzabc-;''-)("));
+    }
+
+    @Test
+    public void testStructDefAddAttribute() {
+        AtlasStructDef structDef = ModelTestUtil.newStructDef();
+
+        structDef.addAttribute(new AtlasAttributeDef("newAttribute", AtlasBaseTypeDef.ATLAS_TYPE_INT));
+        assertTrue(structDef.hasAttribute("newAttribute"));
+    }
+
+    @Test
+    public void testStructDefRemoveAttribute() {
+        AtlasStructDef structDef = ModelTestUtil.newStructDef();
+
+        String attrName = structDef.getAttributeDefs().get(0).getName();
+        assertTrue(structDef.hasAttribute(attrName));
+
+        structDef.removeAttribute(attrName);
+        assertFalse(structDef.hasAttribute(attrName));
+    }
+
+    @Test
+    public void testStructDefSetAttributeDefs() {
+        AtlasStructDef structDef = ModelTestUtil.newStructDef();
+
+        List<AtlasAttributeDef> oldAttributes = structDef.getAttributeDefs();
+        List<AtlasAttributeDef> newttributes = ModelTestUtil.newAttributeDefsWithAllBuiltInTypes("newAttributes");
+
+        structDef.setAttributeDefs(newttributes);
+
+        for (AtlasAttributeDef attributeDef : oldAttributes) {
+            assertFalse(structDef.hasAttribute(attributeDef.getName()));
+        }
+
+        for (AtlasAttributeDef attributeDef : newttributes) {
+            assertTrue(structDef.hasAttribute(attributeDef.getName()));
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/698a5652/intg/src/test/java/org/apache/atlas/type/TestAtlasArrayType.java
----------------------------------------------------------------------
diff --git a/intg/src/test/java/org/apache/atlas/type/TestAtlasArrayType.java b/intg/src/test/java/org/apache/atlas/type/TestAtlasArrayType.java
new file mode 100644
index 0000000..e1a9658
--- /dev/null
+++ b/intg/src/test/java/org/apache/atlas/type/TestAtlasArrayType.java
@@ -0,0 +1,120 @@
+/**
+ * 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.type;
+
+import org.apache.atlas.type.AtlasBuiltInTypes.AtlasIntType;
+import org.testng.annotations.Test;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.util.*;
+
+import static org.testng.Assert.*;
+
+
+public class TestAtlasArrayType {
+    private final AtlasArrayType intArrayType  = new AtlasArrayType(new AtlasIntType());
+    private final Object[]       validValues;
+    private final Object[]       invalidValues;
+
+    {
+        List<Integer> intList  = new ArrayList<Integer>();
+        Set<Integer>  intSet   = new HashSet<Integer>();
+        Integer[]     intArray = new Integer[] { 1, 2, 3 };
+        List<Object>  objList  = new ArrayList<Object>();
+        Set<Object>   objSet   = new HashSet<Object>();
+        Object[]      objArray = new Object[] { 1, 2, 3 };
+        List<String>  strList  = new ArrayList<String>();
+        Set<String>   strSet   = new HashSet<String>();
+        String[]      strArray = new String[] { "1", "2", "3" };
+
+        for (int i = 0; i < 10; i++) {
+            intList.add(i);
+            intSet.add(i);
+            objList.add(i);
+            objSet.add(i);
+            strList.add(Integer.toString(i));
+            strSet.add(Integer.toString(i));
+        }
+
+        validValues = new Object[] {
+            null, new Integer[] { }, intList, intSet, intArray, objList, objSet, objArray, strList, strSet, strArray,
+            new byte[] { 1 }, new short[] { 1 }, new int[] { 1 }, new long[] { 1 }, new float[] { 1 },
+            new double[] { 1 }, new BigInteger[] { BigInteger.valueOf(1) }, new BigDecimal[] { BigDecimal.valueOf(1)},
+        };
+
+        invalidValues = new Object[] {
+            new String[] { "1", "abcd", "3", "xyz", "5" }, "1", Byte.valueOf((byte)1), Short.valueOf((short)1),
+            Integer.valueOf(1), Long.valueOf(1L), Float.valueOf(1), Double.valueOf(1), BigInteger.valueOf(1),
+            BigDecimal.valueOf(1),
+        };
+    }
+
+
+    @Test
+    public void testArrayTypeDefaultValue() {
+        Collection defValue = intArrayType.createDefaultValue();
+
+        assertEquals(defValue.size(), 1);
+    }
+
+    @Test
+    public void testArrayTypeIsValidValue() {
+        for (Object value : validValues) {
+            assertTrue(intArrayType.isValidValue(value), "value=" + value);
+        }
+
+        for (Object value : invalidValues) {
+            assertFalse(intArrayType.isValidValue(value), "value=" + value);
+        }
+    }
+
+    @Test
+    public void testArrayTypeGetNormalizedValue() {
+        assertNull(intArrayType.getNormalizedValue(null), "value=" + null);
+
+        for (Object value : validValues) {
+            if (value == null) {
+                continue;
+            }
+
+            Collection normalizedValue = intArrayType.getNormalizedValue(value);
+
+            assertNotNull(normalizedValue, "value=" + value);
+        }
+
+        for (Object value : invalidValues) {
+            assertNull(intArrayType.getNormalizedValue(value), "value=" + value);
+        }
+    }
+
+    @Test
+    public void testArrayTypeValidateValue() {
+        List<String> messages = new ArrayList<String>();
+        for (Object value : validValues) {
+            assertTrue(intArrayType.validateValue(value, "testObj", messages));
+            assertEquals(messages.size(), 0, "value=" + value);
+        }
+
+        for (Object value : invalidValues) {
+            assertFalse(intArrayType.validateValue(value, "testObj", messages));
+            assertTrue(messages.size() > 0, "value=" + value);
+            messages.clear();
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/698a5652/intg/src/test/java/org/apache/atlas/type/TestAtlasBigDecimalType.java
----------------------------------------------------------------------
diff --git a/intg/src/test/java/org/apache/atlas/type/TestAtlasBigDecimalType.java b/intg/src/test/java/org/apache/atlas/type/TestAtlasBigDecimalType.java
new file mode 100644
index 0000000..0d8c65f
--- /dev/null
+++ b/intg/src/test/java/org/apache/atlas/type/TestAtlasBigDecimalType.java
@@ -0,0 +1,114 @@
+/**
+ * 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.type;
+
+import org.apache.atlas.type.AtlasBuiltInTypes.AtlasBigDecimalType;
+import org.testng.annotations.Test;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.util.ArrayList;
+import java.util.List;
+
+import static org.testng.Assert.*;
+
+
+public class TestAtlasBigDecimalType {
+    private final AtlasBigDecimalType bigDecimalType = new AtlasBigDecimalType();
+    private final Object[] validValues = {
+        null, Byte.valueOf((byte)1), Short.valueOf((short)1), Integer.valueOf(1), Long.valueOf(1L), Float.valueOf(1),
+        Double.valueOf(1), BigInteger.valueOf(1), BigDecimal.valueOf(1), "1",
+    };
+
+    private final Object[] negativeValues = {
+        Byte.valueOf((byte)-1), Short.valueOf((short)-1), Integer.valueOf(-1), Long.valueOf(-1L), Float.valueOf(-1),
+        Double.valueOf(-1), BigInteger.valueOf(-1), BigDecimal.valueOf(-1), "-1",
+    };
+
+    private final Object[] invalidValues  = { "", "12ab", "abcd", "-12ab" };
+
+
+    @Test
+    public void testBigDecimalTypeDefaultValue() {
+        BigDecimal defValue = bigDecimalType.createDefaultValue();
+
+        assertEquals(defValue, BigDecimal.valueOf(0));
+    }
+
+    @Test
+    public void testBigDecimalTypeIsValidValue() {
+        for (Object value : validValues) {
+            assertTrue(bigDecimalType.isValidValue(value), "value=" + value);
+        }
+
+        for (Object value : negativeValues) {
+            assertTrue(bigDecimalType.isValidValue(value), "value=" + value);
+        }
+
+        for (Object value : invalidValues) {
+            assertFalse(bigDecimalType.isValidValue(value), "value=" + value);
+        }
+    }
+
+    @Test
+    public void testBigDecimalTypeGetNormalizedValue() {
+        assertNull(bigDecimalType.getNormalizedValue(null), "value=" + null);
+
+        for (Object value : validValues) {
+            if (value == null) {
+                continue;
+            }
+
+            BigDecimal normalizedValue = bigDecimalType.getNormalizedValue(value);
+
+            assertNotNull(normalizedValue, "value=" + value);
+            assertEquals(normalizedValue, BigDecimal.valueOf(1), "value=" + value);
+        }
+
+        for (Object value : negativeValues) {
+            BigDecimal normalizedValue = bigDecimalType.getNormalizedValue(value);
+
+            assertNotNull(normalizedValue, "value=" + value);
+            assertEquals(normalizedValue, BigDecimal.valueOf(-1), "value=" + value);
+        }
+
+        for (Object value : invalidValues) {
+            assertNull(bigDecimalType.getNormalizedValue(value), "value=" + value);
+        }
+    }
+
+    @Test
+    public void testBigDecimalTypeValidateValue() {
+        List<String> messages = new ArrayList<String>();
+        for (Object value : validValues) {
+            assertTrue(bigDecimalType.validateValue(value, "testObj", messages));
+            assertEquals(messages.size(), 0, "value=" + value);
+        }
+
+        for (Object value : negativeValues) {
+            assertTrue(bigDecimalType.validateValue(value, "testObj", messages));
+            assertEquals(messages.size(), 0, "value=" + value);
+        }
+
+        for (Object value : invalidValues) {
+            assertFalse(bigDecimalType.validateValue(value, "testObj", messages));
+            assertEquals(messages.size(), 1, "value=" + value);
+            messages.clear();
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/698a5652/intg/src/test/java/org/apache/atlas/type/TestAtlasBigIntegerType.java
----------------------------------------------------------------------
diff --git a/intg/src/test/java/org/apache/atlas/type/TestAtlasBigIntegerType.java b/intg/src/test/java/org/apache/atlas/type/TestAtlasBigIntegerType.java
new file mode 100644
index 0000000..f234bb8
--- /dev/null
+++ b/intg/src/test/java/org/apache/atlas/type/TestAtlasBigIntegerType.java
@@ -0,0 +1,115 @@
+/**
+ * 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.type;
+
+import org.apache.atlas.type.AtlasBuiltInTypes.AtlasBigIntegerType;
+import org.testng.annotations.Test;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.util.ArrayList;
+import java.util.List;
+
+import static org.testng.Assert.*;
+
+
+public class TestAtlasBigIntegerType {
+    private final AtlasBigIntegerType bigIntegerType = new AtlasBigIntegerType();
+
+    private final Object[] validValues = {
+        null, Byte.valueOf((byte)1), Short.valueOf((short)1), Integer.valueOf(1), Long.valueOf(1L), Float.valueOf(1),
+        Double.valueOf(1), BigInteger.valueOf(1), BigDecimal.valueOf(1), "1",
+    };
+
+    private final Object[] negativeValues = {
+        Byte.valueOf((byte)-1), Short.valueOf((short)-1), Integer.valueOf(-1), Long.valueOf(-1L), Float.valueOf(-1),
+        Double.valueOf(-1), BigInteger.valueOf(-1), BigDecimal.valueOf(-1), "-1",
+    };
+
+    private final Object[] invalidValues  = { "", "12ab", "abcd", "-12ab", };
+
+
+    @Test
+    public void testBigIntegerTypeDefaultValue() {
+        BigInteger defValue = bigIntegerType.createDefaultValue();
+
+        assertEquals(defValue, BigInteger.valueOf(0));
+    }
+
+    @Test
+    public void testBigIntegerTypeIsValidValue() {
+        for (Object value : validValues) {
+            assertTrue(bigIntegerType.isValidValue(value), "value=" + value);
+        }
+
+        for (Object value : negativeValues) {
+            assertTrue(bigIntegerType.isValidValue(value), "value=" + value);
+        }
+
+        for (Object value : invalidValues) {
+            assertFalse(bigIntegerType.isValidValue(value), "value=" + value);
+        }
+    }
+
+    @Test
+    public void testBigIntegerTypeGetNormalizedValue() {
+        assertNull(bigIntegerType.getNormalizedValue(null), "value=" + null);
+
+        for (Object value : validValues) {
+            if (value == null) {
+                continue;
+            }
+
+            BigInteger normalizedValue = bigIntegerType.getNormalizedValue(value);
+
+            assertNotNull(normalizedValue, "value=" + value);
+            assertEquals(normalizedValue, BigInteger.valueOf(1), "value=" + value);
+        }
+
+        for (Object value : negativeValues) {
+            BigInteger normalizedValue = bigIntegerType.getNormalizedValue(value);
+
+            assertNotNull(normalizedValue, "value=" + value);
+            assertEquals(normalizedValue, BigInteger.valueOf(-1), "value=" + value);
+        }
+
+        for (Object value : invalidValues) {
+            assertNull(bigIntegerType.getNormalizedValue(value), "value=" + value);
+        }
+    }
+
+    @Test
+    public void testBigIntegerTypeValidateValue() {
+        List<String> messages = new ArrayList<String>();
+        for (Object value : validValues) {
+            assertTrue(bigIntegerType.validateValue(value, "testObj", messages));
+            assertEquals(messages.size(), 0, "value=" + value);
+        }
+
+        for (Object value : negativeValues) {
+            assertTrue(bigIntegerType.validateValue(value, "testObj", messages));
+            assertEquals(messages.size(), 0, "value=" + value);
+        }
+
+        for (Object value : invalidValues) {
+            assertFalse(bigIntegerType.validateValue(value, "testObj", messages));
+            assertEquals(messages.size(), 1, "value=" + value);
+            messages.clear();
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/698a5652/intg/src/test/java/org/apache/atlas/type/TestAtlasBooleanType.java
----------------------------------------------------------------------
diff --git a/intg/src/test/java/org/apache/atlas/type/TestAtlasBooleanType.java b/intg/src/test/java/org/apache/atlas/type/TestAtlasBooleanType.java
new file mode 100644
index 0000000..4373a38
--- /dev/null
+++ b/intg/src/test/java/org/apache/atlas/type/TestAtlasBooleanType.java
@@ -0,0 +1,88 @@
+/**
+ * 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.type;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.atlas.type.AtlasBuiltInTypes.AtlasBooleanType;
+import org.testng.annotations.Test;
+
+import static org.testng.Assert.*;
+
+
+public class TestAtlasBooleanType {
+    private final AtlasBooleanType booleanType = new AtlasBooleanType();
+    private final Object[] validValues   = { null, Boolean.TRUE, Boolean.FALSE, "true", "false", "TRUE", "FALSE", };
+    private final Object[] invalidValues = { };
+
+    @Test
+    public void testBooleanTypeDefaultValue() {
+        Boolean defValue = booleanType.createDefaultValue();
+
+        assertFalse(defValue);
+    }
+
+    @Test
+    public void testBooleanTypeIsValidValue() {
+        for (Object value : validValues) {
+            assertTrue(booleanType.isValidValue(value), "value=" + value);
+        }
+
+        for (Object value : invalidValues) {
+            assertFalse(booleanType.isValidValue(value), "value=" + value);
+        }
+    }
+
+    @Test
+    public void testBooleanTypeGetNormalizedValue() {
+        Object[] trueValues  = { Boolean.TRUE, "true", "TRUE", "tRuE", "TrUe" };
+        Object[] falseValues = { Boolean.FALSE, "false", "FALSE", "fAlSe", "FaLsE" };
+
+        assertNull(booleanType.getNormalizedValue(null), "value=" + null);
+
+        for (Object value : trueValues) {
+            Boolean normalizedValue = booleanType.getNormalizedValue(value);
+
+            assertNotNull(normalizedValue, "value=" + value);
+            assertTrue(normalizedValue, "value=" + value);
+        }
+
+        for (Object value : falseValues) {
+            Boolean normalizedValue = booleanType.getNormalizedValue(value);
+
+            assertNotNull(normalizedValue, "value=" + value);
+            assertFalse(normalizedValue, "value=" + value);
+        }
+    }
+
+    @Test
+    public void testBooleanTypeValidateValue() {
+        List<String> messages = new ArrayList<String>();
+        for (Object value : validValues) {
+            assertTrue(booleanType.validateValue(value, "testObj", messages));
+            assertEquals(messages.size(), 0, "value=" + value);
+        }
+
+        for (Object value : invalidValues) {
+            assertFalse(booleanType.validateValue(value, "testObj", messages));
+            assertEquals(messages.size(), 1, "value=" + value);
+            messages.clear();
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/698a5652/intg/src/test/java/org/apache/atlas/type/TestAtlasByteType.java
----------------------------------------------------------------------
diff --git a/intg/src/test/java/org/apache/atlas/type/TestAtlasByteType.java b/intg/src/test/java/org/apache/atlas/type/TestAtlasByteType.java
new file mode 100644
index 0000000..338ceda
--- /dev/null
+++ b/intg/src/test/java/org/apache/atlas/type/TestAtlasByteType.java
@@ -0,0 +1,115 @@
+/**
+ * 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.type;
+
+import org.apache.atlas.type.AtlasBuiltInTypes.AtlasByteType;
+import org.testng.annotations.Test;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.util.ArrayList;
+import java.util.List;
+
+import static org.testng.Assert.*;
+
+
+public class TestAtlasByteType {
+    private final AtlasByteType byteType = new AtlasByteType();
+
+    private final Object[] validValues = {
+        null, Byte.valueOf((byte)1), Short.valueOf((short)1), Integer.valueOf(1), Long.valueOf(1L), Float.valueOf(1),
+        Double.valueOf(1), BigInteger.valueOf(1), BigDecimal.valueOf(1), "1",
+    };
+
+    private final Object[] negativeValues = {
+        Byte.valueOf((byte)-1), Short.valueOf((short)-1), Integer.valueOf(-1), Long.valueOf(-1L), Float.valueOf(-1),
+        Double.valueOf(-1), BigInteger.valueOf(-1), BigDecimal.valueOf(-1), "-1",
+    };
+
+    private final Object[] invalidValues  = { "", };
+
+
+    @Test
+    public void testByteTypeDefaultValue() {
+        Byte defValue = byteType.createDefaultValue();
+
+        assertEquals(defValue, Byte.valueOf((byte)0));
+    }
+
+    @Test
+    public void testByteTypeIsValidValue() {
+        for (Object value : validValues) {
+            assertTrue(byteType.isValidValue(value), "value=" + value);
+        }
+
+        for (Object value : negativeValues) {
+            assertTrue(byteType.isValidValue(value), "value=" + value);
+        }
+
+        for (Object value : invalidValues) {
+            assertFalse(byteType.isValidValue(value), "value=" + value);
+        }
+    }
+
+    @Test
+    public void testByteTypeGetNormalizedValue() {
+        assertNull(byteType.getNormalizedValue(null), "value=" + null);
+
+        for (Object value : validValues) {
+            if (value == null) {
+                continue;
+            }
+
+            Byte normalizedValue = byteType.getNormalizedValue(value);
+
+            assertNotNull(normalizedValue, "value=" + value);
+            assertEquals(normalizedValue, Byte.valueOf((byte)1), "value=" + value);
+        }
+
+        for (Object value : negativeValues) {
+            Byte normalizedValue = byteType.getNormalizedValue(value);
+
+            assertNotNull(normalizedValue, "value=" + value);
+            assertEquals(normalizedValue, Byte.valueOf((byte)-1), "value=" + value);
+        }
+
+        for (Object value : invalidValues) {
+            assertNull(byteType.getNormalizedValue(value), "value=" + value);
+        }
+    }
+
+    @Test
+    public void testByteTypeValidateValue() {
+        List<String> messages = new ArrayList<String>();
+        for (Object value : validValues) {
+            assertTrue(byteType.validateValue(value, "testObj", messages));
+            assertEquals(messages.size(), 0, "value=" + value);
+        }
+
+        for (Object value : negativeValues) {
+            assertTrue(byteType.validateValue(value, "testObj", messages));
+            assertEquals(messages.size(), 0, "value=" + value);
+        }
+
+        for (Object value : invalidValues) {
+            assertFalse(byteType.validateValue(value, "testObj", messages));
+            assertEquals(messages.size(), 1, "value=" + value);
+            messages.clear();
+        }
+    }
+}