atlas-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mad...@apache.org
Subject [2/2] atlas git commit: ATLAS-2083: Refactor Atlas<Type>DefStore classes to reduce code duplication
Date Mon, 28 Aug 2017 20:26:04 GMT
ATLAS-2083: Refactor Atlas<Type>DefStore classes to reduce code duplication

Signed-off-by: Madhan Neethiraj <madhan@apache.org>


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

Branch: refs/heads/master
Commit: 15d67e52f118ce689724f62ac3c83cfd3128e34f
Parents: 4820a20
Author: Richard Ding <sding@us.ibm.com>
Authored: Fri Aug 25 11:37:27 2017 -0700
Committer: Madhan Neethiraj <madhan@apache.org>
Committed: Mon Aug 28 13:25:45 2017 -0700

----------------------------------------------------------------------
 .../graph/AtlasClassificationDefStore.java      |  54 ---
 .../repository/store/graph/AtlasDefStore.java   |  53 +++
 .../store/graph/AtlasEntityDefStore.java        |  54 ---
 .../store/graph/AtlasEnumDefStore.java          |  48 ---
 .../store/graph/AtlasRelationshipDefStore.java  |  52 ---
 .../store/graph/AtlasStructDefStore.java        |  54 ---
 .../store/graph/AtlasTypeDefGraphStore.java     |  63 ++--
 .../store/graph/v1/AtlasAbstractDefStoreV1.java |  34 +-
 .../graph/v1/AtlasClassificationDefStoreV1.java |  55 +--
 .../store/graph/v1/AtlasEntityDefStoreV1.java   |  55 +--
 .../store/graph/v1/AtlasEnumDefStoreV1.java     |  49 ++-
 .../graph/v1/AtlasRelationshipDefStoreV1.java   |  55 +--
 .../store/graph/v1/AtlasStructDefStoreV1.java   |  55 +--
 .../graph/v1/AtlasTypeDefGraphStoreV1.java      |  19 +-
 .../test/java/org/apache/atlas/TestModules.java |   8 +-
 .../store/graph/AtlasEntityDefStoreV1Test.java  |  73 ----
 .../graph/AtlasRelationshipDefStoreV1Test.java  | 332 -------------------
 .../graph/v1/AtlasEntityDefStoreV1Test.java     |  72 ++++
 .../v1/AtlasRelationshipDefStoreV1Test.java     | 330 ++++++++++++++++++
 19 files changed, 563 insertions(+), 952 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/atlas/blob/15d67e52/repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasClassificationDefStore.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasClassificationDefStore.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasClassificationDefStore.java
deleted file mode 100644
index 92a59f3..0000000
--- a/repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasClassificationDefStore.java
+++ /dev/null
@@ -1,54 +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.repository.store.graph;
-
-import org.apache.atlas.exception.AtlasBaseException;
-import org.apache.atlas.model.SearchFilter;
-import org.apache.atlas.model.typedef.AtlasClassificationDef;
-import org.apache.atlas.model.typedef.AtlasClassificationDef.AtlasClassificationDefs;
-
-import java.util.List;
-
-/**
- * Interface for graph persistence store for AtlasClassificationDef
- */
-public interface AtlasClassificationDefStore {
-    Object preCreate(AtlasClassificationDef classificationDef) throws AtlasBaseException;
-
-    AtlasClassificationDef create(AtlasClassificationDef classifiDef, Object preCreateResult) throws AtlasBaseException;
-
-    List<AtlasClassificationDef> getAll() throws AtlasBaseException;
-
-    AtlasClassificationDef getByName(String name) throws AtlasBaseException;
-
-    AtlasClassificationDef getByGuid(String guid) throws AtlasBaseException;
-
-    AtlasClassificationDef update(AtlasClassificationDef classifiDef) throws AtlasBaseException;
-
-    AtlasClassificationDef updateByName(String name, AtlasClassificationDef classifiDef) throws AtlasBaseException;
-
-    AtlasClassificationDef updateByGuid(String guid, AtlasClassificationDef classifiDef) throws AtlasBaseException;
-
-    Object preDeleteByName(String name) throws AtlasBaseException;
-
-    void deleteByName(String name, Object preDeleteResult) throws AtlasBaseException;
-
-    Object preDeleteByGuid(String guid) throws AtlasBaseException;
-
-    void deleteByGuid(String guid, Object preDeleteResult) throws AtlasBaseException;
-}

http://git-wip-us.apache.org/repos/asf/atlas/blob/15d67e52/repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasDefStore.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasDefStore.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasDefStore.java
new file mode 100644
index 0000000..7df3c86
--- /dev/null
+++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasDefStore.java
@@ -0,0 +1,53 @@
+/**
+ * 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.repository.store.graph;
+
+import org.apache.atlas.exception.AtlasBaseException;
+import org.apache.atlas.model.typedef.AtlasBaseTypeDef;
+import org.apache.atlas.repository.graphdb.AtlasVertex;
+
+import java.util.List;
+
+/**
+ * Interface for graph persistence store for AtlasTypeDef
+ */
+public interface AtlasDefStore<T extends AtlasBaseTypeDef> {
+    AtlasVertex preCreate(T typeDef) throws AtlasBaseException;
+
+    T create(T typeDef, AtlasVertex preCreateResult) throws AtlasBaseException;
+
+    List<T> getAll() throws AtlasBaseException;
+
+    T getByName(String name) throws AtlasBaseException;
+
+    T getByGuid(String guid) throws AtlasBaseException;
+
+    T update(T typeDef) throws AtlasBaseException;
+
+    T updateByName(String name, T typeDef) throws AtlasBaseException;
+
+    T updateByGuid(String guid, T typeDef) throws AtlasBaseException;
+
+    AtlasVertex preDeleteByName(String name) throws AtlasBaseException;
+
+    void deleteByName(String name, AtlasVertex preDeleteResult) throws AtlasBaseException;
+
+    AtlasVertex preDeleteByGuid(String guid) throws AtlasBaseException;
+
+    void deleteByGuid(String guid, AtlasVertex preDeleteResult) throws AtlasBaseException;
+}

http://git-wip-us.apache.org/repos/asf/atlas/blob/15d67e52/repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasEntityDefStore.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasEntityDefStore.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasEntityDefStore.java
deleted file mode 100644
index 08391ba..0000000
--- a/repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasEntityDefStore.java
+++ /dev/null
@@ -1,54 +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.repository.store.graph;
-
-import org.apache.atlas.exception.AtlasBaseException;
-import org.apache.atlas.model.SearchFilter;
-import org.apache.atlas.model.typedef.AtlasEntityDef;
-import org.apache.atlas.model.typedef.AtlasEntityDef.AtlasEntityDefs;
-
-import java.util.List;
-
-/**
- * Interface for graph persistence store for AtlasEntityDef
- */
-public interface AtlasEntityDefStore {
-    Object preCreate(AtlasEntityDef entityDef) throws AtlasBaseException;
-
-    AtlasEntityDef create(AtlasEntityDef entityDef, Object preCreateResult) throws AtlasBaseException;
-
-    List<AtlasEntityDef> getAll() throws AtlasBaseException;
-
-    AtlasEntityDef getByName(String name) throws AtlasBaseException;
-
-    AtlasEntityDef getByGuid(String guid) throws AtlasBaseException;
-
-    AtlasEntityDef update(AtlasEntityDef entityDef) throws AtlasBaseException;
-
-    AtlasEntityDef updateByName(String name, AtlasEntityDef entityDef) throws AtlasBaseException;
-
-    AtlasEntityDef updateByGuid(String guid, AtlasEntityDef entityDef) throws AtlasBaseException;
-
-    Object preDeleteByName(String name) throws AtlasBaseException;
-
-    void deleteByName(String name, Object preDeleteResult) throws AtlasBaseException;
-
-    Object preDeleteByGuid(String guid) throws AtlasBaseException;
-
-    void deleteByGuid(String guid, Object preDeleteResult) throws AtlasBaseException;
-}

http://git-wip-us.apache.org/repos/asf/atlas/blob/15d67e52/repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasEnumDefStore.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasEnumDefStore.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasEnumDefStore.java
deleted file mode 100644
index d0f98e2..0000000
--- a/repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasEnumDefStore.java
+++ /dev/null
@@ -1,48 +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.repository.store.graph;
-
-import org.apache.atlas.exception.AtlasBaseException;
-import org.apache.atlas.model.SearchFilter;
-import org.apache.atlas.model.typedef.AtlasEnumDef;
-import org.apache.atlas.model.typedef.AtlasEnumDef.AtlasEnumDefs;
-
-import java.util.List;
-
-/**
- * Interface for graph persistence store for AtlasEnumDef
- */
-public interface AtlasEnumDefStore {
-    AtlasEnumDef create(AtlasEnumDef enumDef) throws AtlasBaseException;
-
-    List<AtlasEnumDef> getAll() throws AtlasBaseException;
-
-    AtlasEnumDef getByName(String name) throws AtlasBaseException;
-
-    AtlasEnumDef getByGuid(String guid) throws AtlasBaseException;
-
-    AtlasEnumDef update(AtlasEnumDef enumDef) throws AtlasBaseException;
-
-    AtlasEnumDef updateByName(String name, AtlasEnumDef enumDef) throws AtlasBaseException;
-
-    AtlasEnumDef updateByGuid(String guid, AtlasEnumDef enumDef) throws AtlasBaseException;
-
-    void deleteByName(String name) throws AtlasBaseException;
-
-    void deleteByGuid(String guid) throws AtlasBaseException;
-}

http://git-wip-us.apache.org/repos/asf/atlas/blob/15d67e52/repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasRelationshipDefStore.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasRelationshipDefStore.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasRelationshipDefStore.java
deleted file mode 100644
index df67958..0000000
--- a/repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasRelationshipDefStore.java
+++ /dev/null
@@ -1,52 +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.repository.store.graph;
-
-import java.util.List;
-
-import org.apache.atlas.exception.AtlasBaseException;
-import org.apache.atlas.model.typedef.AtlasRelationshipDef;
-
-/**
- * Interface for graph persistence store for AtlasRelationshipDef
- */
-public interface AtlasRelationshipDefStore {
-    Object preCreate(AtlasRelationshipDef relationshipDef) throws AtlasBaseException;
-
-    AtlasRelationshipDef create(AtlasRelationshipDef relationshipDef, Object preCreateResult) throws AtlasBaseException;
-
-    List<AtlasRelationshipDef> getAll() throws AtlasBaseException;
-
-    AtlasRelationshipDef getByName(String name) throws AtlasBaseException;
-
-    AtlasRelationshipDef getByGuid(String guid) throws AtlasBaseException;
-
-    AtlasRelationshipDef update(AtlasRelationshipDef relationshipDef) throws AtlasBaseException;
-
-    AtlasRelationshipDef updateByName(String name, AtlasRelationshipDef relationshipDef) throws AtlasBaseException;
-
-    AtlasRelationshipDef updateByGuid(String guid, AtlasRelationshipDef relationshipDef) throws AtlasBaseException;
-
-    Object preDeleteByName(String name) throws AtlasBaseException;
-
-    void deleteByName(String name, Object preDeleteResult) throws AtlasBaseException;
-
-    Object preDeleteByGuid(String guid) throws AtlasBaseException;
-
-    void deleteByGuid(String guid, Object preDeleteResult) throws AtlasBaseException;
-}

http://git-wip-us.apache.org/repos/asf/atlas/blob/15d67e52/repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasStructDefStore.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasStructDefStore.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasStructDefStore.java
deleted file mode 100644
index ebd2b70..0000000
--- a/repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasStructDefStore.java
+++ /dev/null
@@ -1,54 +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.repository.store.graph;
-
-import org.apache.atlas.exception.AtlasBaseException;
-import org.apache.atlas.model.SearchFilter;
-import org.apache.atlas.model.typedef.AtlasStructDef;
-import org.apache.atlas.model.typedef.AtlasStructDef.AtlasStructDefs;
-
-import java.util.List;
-
-/**
- * Interface for graph persistence store for AtlasStructDef
- */
-public interface AtlasStructDefStore {
-    Object preCreate(AtlasStructDef structDef) throws AtlasBaseException;
-
-    AtlasStructDef create(AtlasStructDef structDef, Object preCreateResult) throws AtlasBaseException;
-
-    List<AtlasStructDef> getAll() throws AtlasBaseException;
-
-    AtlasStructDef getByName(String name) throws AtlasBaseException;
-
-    AtlasStructDef getByGuid(String guid) throws AtlasBaseException;
-
-    AtlasStructDef update(AtlasStructDef structDef) throws AtlasBaseException;
-
-    AtlasStructDef updateByName(String name, AtlasStructDef structDef) throws AtlasBaseException;
-
-    AtlasStructDef updateByGuid(String guid, AtlasStructDef structDef) throws AtlasBaseException;
-
-    Object preDeleteByName(String name) throws AtlasBaseException;
-
-    void deleteByName(String name, Object preDeleteResult) throws AtlasBaseException;
-
-    Object preDeleteByGuid(String name) throws AtlasBaseException;
-
-    void deleteByGuid(String guid, Object preDeleteResult) throws AtlasBaseException;
-}

http://git-wip-us.apache.org/repos/asf/atlas/blob/15d67e52/repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasTypeDefGraphStore.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasTypeDefGraphStore.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasTypeDefGraphStore.java
index f5e1618..8d68986 100644
--- a/repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasTypeDefGraphStore.java
+++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasTypeDefGraphStore.java
@@ -27,6 +27,7 @@ import org.apache.atlas.model.SearchFilter;
 import org.apache.atlas.model.typedef.*;
 import org.apache.atlas.model.typedef.AtlasStructDef.AtlasAttributeDef;
 import org.apache.atlas.model.typedef.AtlasStructDef.AtlasConstraintDef;
+import org.apache.atlas.repository.graphdb.AtlasVertex;
 import org.apache.atlas.repository.util.FilterUtil;
 import org.apache.atlas.store.AtlasTypeDefStore;
 import org.apache.atlas.type.*;
@@ -65,15 +66,15 @@ public abstract class AtlasTypeDefGraphStore implements AtlasTypeDefStore {
         this.typeUpdateLockMaxWaitTimeSeconds = AtlasRepositoryConfiguration.getTypeUpdateLockMaxWaitTimeInSeconds();
     }
 
-    protected abstract AtlasEnumDefStore getEnumDefStore(AtlasTypeRegistry typeRegistry);
+    protected abstract AtlasDefStore<AtlasEnumDef> getEnumDefStore(AtlasTypeRegistry typeRegistry);
 
-    protected abstract AtlasStructDefStore getStructDefStore(AtlasTypeRegistry typeRegistry);
+    protected abstract AtlasDefStore<AtlasStructDef> getStructDefStore(AtlasTypeRegistry typeRegistry);
 
-    protected abstract AtlasClassificationDefStore getClassificationDefStore(AtlasTypeRegistry typeRegistry);
+    protected abstract AtlasDefStore<AtlasClassificationDef> getClassificationDefStore(AtlasTypeRegistry typeRegistry);
 
-    protected abstract AtlasEntityDefStore getEntityDefStore(AtlasTypeRegistry typeRegistry);
+    protected abstract AtlasDefStore<AtlasEntityDef> getEntityDefStore(AtlasTypeRegistry typeRegistry);
 
-    protected abstract AtlasRelationshipDefStore getRelationshipDefStore(AtlasTypeRegistry typeRegistry);
+    protected abstract AtlasDefStore<AtlasRelationshipDef> getRelationshipDefStore(AtlasTypeRegistry typeRegistry);
 
     @Override
     public void init() throws AtlasBaseException {
@@ -471,16 +472,16 @@ public abstract class AtlasTypeDefGraphStore implements AtlasTypeDefStore {
 
         AtlasTransientTypeRegistry ttr = lockTypeRegistryAndReleasePostCommit();
 
-        AtlasEnumDefStore           enumDefStore     = getEnumDefStore(ttr);
-        AtlasStructDefStore         structDefStore   = getStructDefStore(ttr);
-        AtlasClassificationDefStore classifiDefStore = getClassificationDefStore(ttr);
-        AtlasEntityDefStore         entityDefStore   = getEntityDefStore(ttr);
-        AtlasRelationshipDefStore   relationshipDefStore = getRelationshipDefStore(ttr);
+        AtlasDefStore<AtlasEnumDef>           enumDefStore          = getEnumDefStore(ttr);
+        AtlasDefStore<AtlasStructDef>         structDefStore        = getStructDefStore(ttr);
+        AtlasDefStore<AtlasClassificationDef> classifiDefStore      = getClassificationDefStore(ttr);
+        AtlasDefStore<AtlasEntityDef>         entityDefStore        = getEntityDefStore(ttr);
+        AtlasDefStore<AtlasRelationshipDef>   relationshipDefStore  = getRelationshipDefStore(ttr);
 
-        List<Object> preDeleteStructDefs   = new ArrayList<>();
-        List<Object> preDeleteClassifiDefs = new ArrayList<>();
-        List<Object> preDeleteEntityDefs   = new ArrayList<>();
-        List<Object> preDeleteRelationshipDefs = new ArrayList<>();
+        List<AtlasVertex> preDeleteStructDefs   = new ArrayList<>();
+        List<AtlasVertex> preDeleteClassifiDefs = new ArrayList<>();
+        List<AtlasVertex> preDeleteEntityDefs   = new ArrayList<>();
+        List<AtlasVertex> preDeleteRelationshipDefs = new ArrayList<>();
 
         // pre deletes
 
@@ -578,9 +579,9 @@ public abstract class AtlasTypeDefGraphStore implements AtlasTypeDefStore {
         if (CollectionUtils.isNotEmpty(typesDef.getEnumDefs())) {
             for (AtlasEnumDef enumDef : typesDef.getEnumDefs()) {
                 if (StringUtils.isNotBlank(enumDef.getGuid())) {
-                    enumDefStore.deleteByGuid(enumDef.getGuid());
+                    enumDefStore.deleteByGuid(enumDef.getGuid(), null);
                 } else {
-                    enumDefStore.deleteByName(enumDef.getName());
+                    enumDefStore.deleteByName(enumDef.getName(), null);
                 }
             }
         }
@@ -792,21 +793,21 @@ public abstract class AtlasTypeDefGraphStore implements AtlasTypeDefStore {
     private AtlasTypesDef addToGraphStore(AtlasTypesDef typesDef, AtlasTransientTypeRegistry ttr) throws AtlasBaseException {
         AtlasTypesDef ret = new AtlasTypesDef();
 
-        AtlasEnumDefStore           enumDefStore     = getEnumDefStore(ttr);
-        AtlasStructDefStore         structDefStore   = getStructDefStore(ttr);
-        AtlasClassificationDefStore classifiDefStore = getClassificationDefStore(ttr);
-        AtlasEntityDefStore         entityDefStore   = getEntityDefStore(ttr);
-        AtlasRelationshipDefStore   relationshipDefStore   = getRelationshipDefStore(ttr);
+        AtlasDefStore<AtlasEnumDef>           enumDefStore          = getEnumDefStore(ttr);
+        AtlasDefStore<AtlasStructDef>         structDefStore        = getStructDefStore(ttr);
+        AtlasDefStore<AtlasClassificationDef> classifiDefStore      = getClassificationDefStore(ttr);
+        AtlasDefStore<AtlasEntityDef>         entityDefStore        = getEntityDefStore(ttr);
+        AtlasDefStore<AtlasRelationshipDef>   relationshipDefStore  = getRelationshipDefStore(ttr);
 
-        List<Object> preCreateStructDefs   = new ArrayList<>();
-        List<Object> preCreateClassifiDefs = new ArrayList<>();
-        List<Object> preCreateEntityDefs   = new ArrayList<>();
-        List<Object> preCreateRelationshipDefs   = new ArrayList<>();
+        List<AtlasVertex> preCreateStructDefs   = new ArrayList<>();
+        List<AtlasVertex> preCreateClassifiDefs = new ArrayList<>();
+        List<AtlasVertex> preCreateEntityDefs   = new ArrayList<>();
+        List<AtlasVertex> preCreateRelationshipDefs   = new ArrayList<>();
 
         // for enumerations run the create
         if (CollectionUtils.isNotEmpty(typesDef.getEnumDefs())) {
             for (AtlasEnumDef enumDef : typesDef.getEnumDefs()) {
-                AtlasEnumDef createdDef = enumDefStore.create(enumDef);
+                AtlasEnumDef createdDef = enumDefStore.create(enumDef, null);
 
                 ttr.updateGuid(createdDef.getName(), createdDef.getGuid());
 
@@ -892,11 +893,11 @@ public abstract class AtlasTypeDefGraphStore implements AtlasTypeDefStore {
     private AtlasTypesDef updateGraphStore(AtlasTypesDef typesDef, AtlasTransientTypeRegistry ttr) throws AtlasBaseException {
         AtlasTypesDef ret = new AtlasTypesDef();
 
-        AtlasEnumDefStore           enumDefStore     = getEnumDefStore(ttr);
-        AtlasStructDefStore         structDefStore   = getStructDefStore(ttr);
-        AtlasClassificationDefStore classifiDefStore = getClassificationDefStore(ttr);
-        AtlasEntityDefStore         entityDefStore   = getEntityDefStore(ttr);
-        AtlasRelationshipDefStore   relationDefStore = getRelationshipDefStore(ttr);
+        AtlasDefStore<AtlasEnumDef>           enumDefStore     = getEnumDefStore(ttr);
+        AtlasDefStore<AtlasStructDef>         structDefStore   = getStructDefStore(ttr);
+        AtlasDefStore<AtlasClassificationDef> classifiDefStore = getClassificationDefStore(ttr);
+        AtlasDefStore<AtlasEntityDef>         entityDefStore   = getEntityDefStore(ttr);
+        AtlasDefStore<AtlasRelationshipDef>   relationDefStore = getRelationshipDefStore(ttr);
 
         if (CollectionUtils.isNotEmpty(typesDef.getEnumDefs())) {
             for (AtlasEnumDef enumDef : typesDef.getEnumDefs()) {

http://git-wip-us.apache.org/repos/asf/atlas/blob/15d67e52/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasAbstractDefStoreV1.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasAbstractDefStoreV1.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasAbstractDefStoreV1.java
index baf2309..2bf53a1 100644
--- a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasAbstractDefStoreV1.java
+++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasAbstractDefStoreV1.java
@@ -24,6 +24,8 @@ import org.apache.atlas.exception.AtlasBaseException;
 import org.apache.atlas.model.typedef.AtlasBaseTypeDef;
 import org.apache.atlas.model.typedef.AtlasStructDef;
 import org.apache.atlas.query.QueryParser;
+import org.apache.atlas.repository.graphdb.AtlasVertex;
+import org.apache.atlas.repository.store.graph.AtlasDefStore;
 import org.apache.atlas.type.AtlasTypeRegistry;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -35,7 +37,7 @@ import java.util.regex.Pattern;
 /**
  * Abstract typedef-store for v1 format.
  */
-public abstract class AtlasAbstractDefStoreV1 {
+  abstract class AtlasAbstractDefStoreV1 <T extends AtlasBaseTypeDef> implements AtlasDefStore<T> {
     private static final Logger LOG = LoggerFactory.getLogger(AtlasAbstractDefStoreV1.class);
     protected final AtlasTypeDefGraphStoreV1 typeDefStore;
     protected final AtlasTypeRegistry        typeRegistry;
@@ -77,4 +79,34 @@ public abstract class AtlasAbstractDefStoreV1 {
 
         return m.matches();
     }
+
+    @Override
+    public void deleteByName(String name, AtlasVertex preDeleteResult) throws AtlasBaseException {
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("==> AtlasAbstractDefStoreV1.deleteByName({}, {})", name, preDeleteResult);
+        }
+
+        AtlasVertex vertex = (preDeleteResult == null) ? preDeleteByName(name) : preDeleteResult;
+
+        typeDefStore.deleteTypeVertex(vertex);
+
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("<== AtlasAbstractDefStoreV1.deleteByName({}, {})", name, preDeleteResult);
+        }
+    }
+
+    @Override
+    public void deleteByGuid(String guid, AtlasVertex preDeleteResult) throws AtlasBaseException {
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("==> AtlasAbstractDefStoreV1.deleteByGuid({}, {})", guid, preDeleteResult);
+        }
+
+        AtlasVertex vertex = (preDeleteResult == null) ? preDeleteByGuid(guid) : preDeleteResult;
+
+        typeDefStore.deleteTypeVertex(vertex);
+
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("<== AtlasAbstractDefStoreV1.deleteByGuid({}, {})", guid, preDeleteResult);
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/atlas/blob/15d67e52/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasClassificationDefStoreV1.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasClassificationDefStoreV1.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasClassificationDefStoreV1.java
index 8944504..e3aa4e0 100644
--- a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasClassificationDefStoreV1.java
+++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasClassificationDefStoreV1.java
@@ -23,7 +23,6 @@ import org.apache.atlas.exception.AtlasBaseException;
 import org.apache.atlas.model.typedef.AtlasClassificationDef;
 import org.apache.atlas.repository.Constants;
 import org.apache.atlas.repository.graphdb.AtlasVertex;
-import org.apache.atlas.repository.store.graph.AtlasClassificationDefStore;
 import org.apache.atlas.type.AtlasClassificationType;
 import org.apache.atlas.type.AtlasType;
 import org.apache.atlas.type.AtlasTypeRegistry;
@@ -41,7 +40,7 @@ import java.util.regex.Pattern;
 /**
  * ClassificationDef store in v1 format.
  */
-public class AtlasClassificationDefStoreV1 extends AtlasAbstractDefStoreV1 implements AtlasClassificationDefStore {
+class AtlasClassificationDefStoreV1 extends AtlasAbstractDefStoreV1<AtlasClassificationDef> {
     private static final Logger LOG = LoggerFactory.getLogger(AtlasClassificationDefStoreV1.class);
 
     private static final String  TRAIT_NAME_REGEX   = "[a-zA-Z][a-zA-Z0-9_ .]*";
@@ -84,19 +83,13 @@ public class AtlasClassificationDefStoreV1 extends AtlasAbstractDefStoreV1 imple
     }
 
     @Override
-    public AtlasClassificationDef create(AtlasClassificationDef classificationDef, Object preCreateResult)
+    public AtlasClassificationDef create(AtlasClassificationDef classificationDef, AtlasVertex preCreateResult)
         throws AtlasBaseException {
         if (LOG.isDebugEnabled()) {
             LOG.debug("==> AtlasClassificationDefStoreV1.create({}, {})", classificationDef, preCreateResult);
         }
 
-        AtlasVertex vertex;
-
-        if (preCreateResult == null || !(preCreateResult instanceof AtlasVertex)) {
-            vertex = preCreate(classificationDef);
-        } else {
-            vertex = (AtlasVertex)preCreateResult;
-        }
+        AtlasVertex vertex = (preCreateResult == null) ? preCreate(classificationDef) : preCreateResult;
 
         updateVertexAddReferences(classificationDef, vertex);
 
@@ -281,27 +274,6 @@ public class AtlasClassificationDefStoreV1 extends AtlasAbstractDefStoreV1 imple
     }
 
     @Override
-    public void deleteByName(String name, Object preDeleteResult) throws AtlasBaseException {
-        if (LOG.isDebugEnabled()) {
-            LOG.debug("==> AtlasClassificationDefStoreV1.deleteByName({})", name);
-        }
-
-        AtlasVertex vertex;
-
-        if (preDeleteResult == null || !(preDeleteResult instanceof AtlasVertex)) {
-            vertex = preDeleteByName(name);
-        } else {
-            vertex = (AtlasVertex)preDeleteResult;
-        }
-
-        typeDefStore.deleteTypeVertex(vertex);
-
-        if (LOG.isDebugEnabled()) {
-            LOG.debug("<== AtlasClassificationDefStoreV1.deleteByName({})", name);
-        }
-    }
-
-    @Override
     public AtlasVertex preDeleteByGuid(String guid) throws AtlasBaseException {
         if (LOG.isDebugEnabled()) {
             LOG.debug("==> AtlasClassificationDefStoreV1.preDeleteByGuid({})", guid);
@@ -328,27 +300,6 @@ public class AtlasClassificationDefStoreV1 extends AtlasAbstractDefStoreV1 imple
         return ret;
     }
 
-    @Override
-    public void deleteByGuid(String guid, Object preDeleteResult) throws AtlasBaseException {
-        if (LOG.isDebugEnabled()) {
-            LOG.debug("==> AtlasClassificationDefStoreV1.deleteByGuid({})", guid);
-        }
-
-        AtlasVertex vertex;
-
-        if (preDeleteResult == null || !(preDeleteResult instanceof AtlasVertex)) {
-            vertex = preDeleteByGuid(guid);
-        } else {
-            vertex = (AtlasVertex)preDeleteResult;
-        }
-
-        typeDefStore.deleteTypeVertex(vertex);
-
-        if (LOG.isDebugEnabled()) {
-            LOG.debug("<== AtlasClassificationDefStoreV1.deleteByGuid({})", guid);
-        }
-    }
-
     private void updateVertexPreCreate(AtlasClassificationDef  classificationDef,
                                        AtlasClassificationType classificationType,
                                        AtlasVertex             vertex) throws AtlasBaseException {

http://git-wip-us.apache.org/repos/asf/atlas/blob/15d67e52/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityDefStoreV1.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityDefStoreV1.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityDefStoreV1.java
index d6cb2fd..1d784ef 100644
--- a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityDefStoreV1.java
+++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityDefStoreV1.java
@@ -22,7 +22,6 @@ import org.apache.atlas.exception.AtlasBaseException;
 import org.apache.atlas.model.typedef.AtlasEntityDef;
 import org.apache.atlas.repository.Constants;
 import org.apache.atlas.repository.graphdb.AtlasVertex;
-import org.apache.atlas.repository.store.graph.AtlasEntityDefStore;
 import org.apache.atlas.type.AtlasEntityType;
 import org.apache.atlas.type.AtlasType;
 import org.apache.atlas.type.AtlasTypeRegistry;
@@ -39,7 +38,7 @@ import java.util.List;
 /**
  * EntityDef store in v1 format.
  */
-public class AtlasEntityDefStoreV1 extends AtlasAbstractDefStoreV1 implements AtlasEntityDefStore {
+public class AtlasEntityDefStoreV1 extends AtlasAbstractDefStoreV1<AtlasEntityDef> {
     private static final Logger LOG = LoggerFactory.getLogger(AtlasEntityDefStoreV1.class);
 
     @Inject
@@ -79,18 +78,12 @@ public class AtlasEntityDefStoreV1 extends AtlasAbstractDefStoreV1 implements At
     }
 
     @Override
-    public AtlasEntityDef create(AtlasEntityDef entityDef, Object preCreateResult) throws AtlasBaseException {
+    public AtlasEntityDef create(AtlasEntityDef entityDef, AtlasVertex preCreateResult) throws AtlasBaseException {
         if (LOG.isDebugEnabled()) {
             LOG.debug("==> AtlasEntityDefStoreV1.create({}, {})", entityDef, preCreateResult);
         }
 
-        AtlasVertex vertex;
-
-        if (preCreateResult == null || !(preCreateResult instanceof AtlasVertex)) {
-            vertex = preCreate(entityDef);
-        } else {
-            vertex = (AtlasVertex)preCreateResult;
-        }
+        AtlasVertex vertex = (preCreateResult == null) ? preCreate(entityDef) : preCreateResult;
 
         updateVertexAddReferences(entityDef, vertex);
 
@@ -280,27 +273,6 @@ public class AtlasEntityDefStoreV1 extends AtlasAbstractDefStoreV1 implements At
     }
 
     @Override
-    public void deleteByName(String name, Object preDeleteResult) throws AtlasBaseException {
-        if (LOG.isDebugEnabled()) {
-            LOG.debug("==> AtlasEntityDefStoreV1.deleteByName({}, {})", name, preDeleteResult);
-        }
-
-        AtlasVertex vertex;
-
-        if (preDeleteResult == null || !(preDeleteResult instanceof AtlasVertex)) {
-            vertex = preDeleteByName(name);
-        } else {
-            vertex = (AtlasVertex)preDeleteResult;
-        }
-
-        typeDefStore.deleteTypeVertex(vertex);
-
-        if (LOG.isDebugEnabled()) {
-            LOG.debug("<== AtlasEntityDefStoreV1.deleteByName({}, {})", name, preDeleteResult);
-        }
-    }
-
-    @Override
     public AtlasVertex preDeleteByGuid(String guid) throws AtlasBaseException {
         if (LOG.isDebugEnabled()) {
             LOG.debug("==> AtlasEntityDefStoreV1.preDeleteByGuid({})", guid);
@@ -332,27 +304,6 @@ public class AtlasEntityDefStoreV1 extends AtlasAbstractDefStoreV1 implements At
         return ret;
     }
 
-    @Override
-    public void deleteByGuid(String guid, Object preDeleteResult) throws AtlasBaseException {
-        if (LOG.isDebugEnabled()) {
-            LOG.debug("==> AtlasEntityDefStoreV1.deleteByGuid({}, {})", guid, preDeleteResult);
-        }
-
-        AtlasVertex vertex;
-
-        if (preDeleteResult == null || !(preDeleteResult instanceof AtlasVertex)) {
-            vertex = preDeleteByGuid(guid);
-        } else {
-            vertex = (AtlasVertex)preDeleteResult;
-        }
-
-        typeDefStore.deleteTypeVertex(vertex);
-
-        if (LOG.isDebugEnabled()) {
-            LOG.debug("<== AtlasEntityDefStoreV1.deleteByGuid({}, {})", guid, preDeleteResult);
-        }
-    }
-
     private void updateVertexPreCreate(AtlasEntityDef entityDef, AtlasEntityType entityType, AtlasVertex vertex) throws AtlasBaseException {
         AtlasStructDefStoreV1.updateVertexPreCreate(entityDef, entityType, vertex, typeDefStore);
     }

http://git-wip-us.apache.org/repos/asf/atlas/blob/15d67e52/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEnumDefStoreV1.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEnumDefStoreV1.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEnumDefStoreV1.java
index 39c4dd9..5bd9c12 100644
--- a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEnumDefStoreV1.java
+++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEnumDefStoreV1.java
@@ -23,9 +23,7 @@ import org.apache.atlas.model.typedef.AtlasEnumDef;
 import org.apache.atlas.model.typedef.AtlasEnumDef.AtlasEnumElementDef;
 import org.apache.atlas.repository.Constants;
 import org.apache.atlas.repository.graphdb.AtlasVertex;
-import org.apache.atlas.repository.store.graph.AtlasEnumDefStore;
 import org.apache.atlas.type.AtlasTypeRegistry;
-import org.apache.atlas.type.AtlasTypeUtil;
 import org.apache.atlas.typesystem.types.DataTypes.TypeCategory;
 import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.lang3.StringUtils;
@@ -39,7 +37,7 @@ import java.util.List;
 /**
  * EnumDef store in v1 format.
  */
-public class AtlasEnumDefStoreV1 extends AtlasAbstractDefStoreV1 implements AtlasEnumDefStore {
+class AtlasEnumDefStoreV1 extends AtlasAbstractDefStoreV1<AtlasEnumDef> {
     private static final Logger LOG = LoggerFactory.getLogger(AtlasEnumDefStoreV1.class);
 
     public AtlasEnumDefStoreV1(AtlasTypeDefGraphStoreV1 typeDefStore, AtlasTypeRegistry typeRegistry) {
@@ -47,9 +45,9 @@ public class AtlasEnumDefStoreV1 extends AtlasAbstractDefStoreV1 implements Atla
     }
 
     @Override
-    public AtlasEnumDef create(AtlasEnumDef enumDef) throws AtlasBaseException {
+    public AtlasVertex preCreate(AtlasEnumDef enumDef) throws AtlasBaseException {
         if (LOG.isDebugEnabled()) {
-            LOG.debug("==> AtlasEnumDefStoreV1.create({})", enumDef);
+          LOG.debug("==> AtlasEnumDefStoreV1.preCreate({})", enumDef);
         }
 
         validateType(enumDef);
@@ -64,10 +62,25 @@ public class AtlasEnumDefStoreV1 extends AtlasAbstractDefStoreV1 implements Atla
 
         toVertex(enumDef, vertex);
 
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("<== AtlasEnumDefStoreV1.preCreate({}): {}", enumDef, vertex);
+        }
+
+        return vertex;
+    }
+
+    @Override
+    public AtlasEnumDef create(AtlasEnumDef enumDef, AtlasVertex preCreateResult) throws AtlasBaseException {
+        if (LOG.isDebugEnabled()) {
+          LOG.debug("==> AtlasEnumDefStoreV1.create({}, {})", enumDef, preCreateResult);
+        }
+
+        AtlasVertex vertex = (preCreateResult == null) ? preCreate(enumDef) : preCreateResult;
+
         AtlasEnumDef ret = toEnumDef(vertex);
 
         if (LOG.isDebugEnabled()) {
-            LOG.debug("<== AtlasEnumDefStoreV1.create({}): {}", enumDef, ret);
+            LOG.debug("<== AtlasEntityDefStoreV1.create({}, {}): {}", enumDef, preCreateResult, ret);
         }
 
         return ret;
@@ -210,41 +223,25 @@ public class AtlasEnumDefStoreV1 extends AtlasAbstractDefStoreV1 implements Atla
     }
 
     @Override
-    public void deleteByName(String name) throws AtlasBaseException {
-        if (LOG.isDebugEnabled()) {
-            LOG.debug("==> AtlasEnumDefStoreV1.deleteByName({})", name);
-        }
-
+    public AtlasVertex preDeleteByName(String name) throws AtlasBaseException {
         AtlasVertex vertex = typeDefStore.findTypeVertexByNameAndCategory(name, TypeCategory.ENUM);
 
         if (vertex == null) {
             throw new AtlasBaseException(AtlasErrorCode.TYPE_NAME_NOT_FOUND, name);
         }
 
-        typeDefStore.deleteTypeVertex(vertex);
-
-        if (LOG.isDebugEnabled()) {
-            LOG.debug("<== AtlasEnumDefStoreV1.deleteByName({})", name);
-        }
+        return vertex;
     }
 
     @Override
-    public void deleteByGuid(String guid) throws AtlasBaseException {
-        if (LOG.isDebugEnabled()) {
-            LOG.debug("==> AtlasEnumDefStoreV1.deleteByGuid({})", guid);
-        }
-
+    public AtlasVertex preDeleteByGuid(String guid) throws AtlasBaseException {
         AtlasVertex vertex = typeDefStore.findTypeVertexByGuidAndCategory(guid, TypeCategory.ENUM);
 
         if (vertex == null) {
             throw new AtlasBaseException(AtlasErrorCode.TYPE_GUID_NOT_FOUND, guid);
         }
 
-        typeDefStore.deleteTypeVertex(vertex);
-
-        if (LOG.isDebugEnabled()) {
-            LOG.debug("<== AtlasEnumDefStoreV1.deleteByGuid({})", guid);
-        }
+        return vertex;
     }
 
     private void toVertex(AtlasEnumDef enumDef, AtlasVertex vertex) throws AtlasBaseException {

http://git-wip-us.apache.org/repos/asf/atlas/blob/15d67e52/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasRelationshipDefStoreV1.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasRelationshipDefStoreV1.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasRelationshipDefStoreV1.java
index bdde58b..4c69d6e 100644
--- a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasRelationshipDefStoreV1.java
+++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasRelationshipDefStoreV1.java
@@ -29,7 +29,6 @@ import org.apache.atlas.query.QueryParser;
 import org.apache.atlas.repository.Constants;
 import org.apache.atlas.repository.graphdb.AtlasEdge;
 import org.apache.atlas.repository.graphdb.AtlasVertex;
-import org.apache.atlas.repository.store.graph.AtlasRelationshipDefStore;
 import org.apache.atlas.type.AtlasRelationshipType;
 import org.apache.atlas.type.AtlasType;
 import org.apache.atlas.type.AtlasTypeRegistry;
@@ -46,7 +45,7 @@ import java.util.List;
 /**
  * RelationshipDef store in v1 format.
  */
-public class AtlasRelationshipDefStoreV1 extends AtlasAbstractDefStoreV1 implements AtlasRelationshipDefStore {
+public class AtlasRelationshipDefStoreV1 extends AtlasAbstractDefStoreV1<AtlasRelationshipDef> {
     private static final Logger LOG = LoggerFactory.getLogger(AtlasRelationshipDefStoreV1.class);
 
     @Inject
@@ -124,19 +123,13 @@ public class AtlasRelationshipDefStoreV1 extends AtlasAbstractDefStoreV1 impleme
     }
 
     @Override
-    public AtlasRelationshipDef create(AtlasRelationshipDef relationshipDef, Object preCreateResult)
+    public AtlasRelationshipDef create(AtlasRelationshipDef relationshipDef, AtlasVertex preCreateResult)
             throws AtlasBaseException {
         if (LOG.isDebugEnabled()) {
             LOG.debug("==> AtlasRelationshipDefStoreV1.create({}, {})", relationshipDef, preCreateResult);
         }
 
-        AtlasVertex vertex;
-
-        if (preCreateResult == null || !(preCreateResult instanceof AtlasVertex)) {
-            vertex = preCreate(relationshipDef);
-        } else {
-            vertex = (AtlasVertex) preCreateResult;
-        }
+        AtlasVertex vertex = (preCreateResult == null) ? preCreate(relationshipDef) : preCreateResult;
 
         AtlasRelationshipDef ret = toRelationshipDef(vertex);
 
@@ -321,27 +314,6 @@ public class AtlasRelationshipDefStoreV1 extends AtlasAbstractDefStoreV1 impleme
     }
 
     @Override
-    public void deleteByName(String name, Object preDeleteResult) throws AtlasBaseException {
-        if (LOG.isDebugEnabled()) {
-            LOG.debug("==> AtlasRelationshipDefStoreV1.deleteByName({}, {})", name, preDeleteResult);
-        }
-
-        AtlasVertex vertex;
-
-        if (preDeleteResult == null || !(preDeleteResult instanceof AtlasVertex)) {
-            vertex = preDeleteByName(name);
-        } else {
-            vertex = (AtlasVertex) preDeleteResult;
-        }
-
-        typeDefStore.deleteTypeVertex(vertex);
-
-        if (LOG.isDebugEnabled()) {
-            LOG.debug("<== AtlasRelationshipDefStoreV1.deleteByName({}, {})", name, preDeleteResult);
-        }
-    }
-
-    @Override
     public AtlasVertex preDeleteByGuid(String guid) throws AtlasBaseException {
         if (LOG.isDebugEnabled()) {
             LOG.debug("==> AtlasRelationshipDefStoreV1.preDeleteByGuid({})", guid);
@@ -368,27 +340,6 @@ public class AtlasRelationshipDefStoreV1 extends AtlasAbstractDefStoreV1 impleme
         return ret;
     }
 
-    @Override
-    public void deleteByGuid(String guid, Object preDeleteResult) throws AtlasBaseException {
-        if (LOG.isDebugEnabled()) {
-            LOG.debug("==> AtlasRelationshipDefStoreV1.deleteByGuid({}, {})", guid, preDeleteResult);
-        }
-
-        AtlasVertex vertex;
-
-        if (preDeleteResult == null || !(preDeleteResult instanceof AtlasVertex)) {
-            vertex = preDeleteByGuid(guid);
-        } else {
-            vertex = (AtlasVertex) preDeleteResult;
-        }
-
-        typeDefStore.deleteTypeVertex(vertex);
-
-        if (LOG.isDebugEnabled()) {
-            LOG.debug("<== AtlasRelationshipDefStoreV1.deleteByGuid({}, {})", guid, preDeleteResult);
-        }
-    }
-
     private void updateVertexPreCreate(AtlasRelationshipDef relationshipDef, AtlasRelationshipType relationshipType,
                                        AtlasVertex vertex) throws AtlasBaseException {
         AtlasRelationshipEndDef end1 = relationshipDef.getEndDef1();

http://git-wip-us.apache.org/repos/asf/atlas/blob/15d67e52/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasStructDefStoreV1.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasStructDefStoreV1.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasStructDefStoreV1.java
index 62729e7..c3c42be 100644
--- a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasStructDefStoreV1.java
+++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasStructDefStoreV1.java
@@ -26,7 +26,6 @@ import org.apache.atlas.model.typedef.AtlasStructDef.AtlasConstraintDef;
 import org.apache.atlas.repository.Constants;
 import org.apache.atlas.repository.graph.GraphHelper;
 import org.apache.atlas.repository.graphdb.AtlasVertex;
-import org.apache.atlas.repository.store.graph.AtlasStructDefStore;
 import org.apache.atlas.type.AtlasStructType;
 import org.apache.atlas.type.AtlasStructType.AtlasAttribute;
 import org.apache.atlas.type.AtlasType;
@@ -51,7 +50,7 @@ import java.util.Set;
 /**
  * StructDef store in v1 format.
  */
-public class AtlasStructDefStoreV1 extends AtlasAbstractDefStoreV1 implements AtlasStructDefStore {
+public class AtlasStructDefStoreV1 extends AtlasAbstractDefStoreV1<AtlasStructDef> {
     private static final Logger LOG = LoggerFactory.getLogger(AtlasStructDefStoreV1.class);
 
     public AtlasStructDefStoreV1(AtlasTypeDefGraphStoreV1 typeDefStore, AtlasTypeRegistry typeRegistry) {
@@ -90,18 +89,12 @@ public class AtlasStructDefStoreV1 extends AtlasAbstractDefStoreV1 implements At
     }
 
     @Override
-    public AtlasStructDef create(AtlasStructDef structDef, Object preCreateResult) throws AtlasBaseException {
+    public AtlasStructDef create(AtlasStructDef structDef, AtlasVertex preCreateResult) throws AtlasBaseException {
         if (LOG.isDebugEnabled()) {
             LOG.debug("==> AtlasStructDefStoreV1.create({}, {})", structDef, preCreateResult);
         }
 
-        AtlasVertex vertex;
-
-        if (preCreateResult == null || !(preCreateResult instanceof AtlasVertex)) {
-            vertex = preCreate(structDef);
-        } else {
-            vertex = (AtlasVertex)preCreateResult;
-        }
+        AtlasVertex vertex = (preCreateResult == null) ? preCreate(structDef) : preCreateResult;
 
         if (CollectionUtils.isEmpty(structDef.getAttributeDefs())) {
             throw new AtlasBaseException(AtlasErrorCode.BAD_REQUEST, "Missing attributes for structdef");
@@ -289,27 +282,6 @@ public class AtlasStructDefStoreV1 extends AtlasAbstractDefStoreV1 implements At
     }
 
     @Override
-    public void deleteByName(String name, Object preDeleteResult) throws AtlasBaseException {
-        if (LOG.isDebugEnabled()) {
-            LOG.debug("==> AtlasStructDefStoreV1.deleteByName({}, {})", name, preDeleteResult);
-        }
-
-        AtlasVertex vertex;
-
-        if (preDeleteResult == null || !(preDeleteResult instanceof AtlasVertex)) {
-            vertex = preDeleteByName(name);
-        } else {
-            vertex = (AtlasVertex)preDeleteResult;
-        }
-
-        typeDefStore.deleteTypeVertex(vertex);
-
-        if (LOG.isDebugEnabled()) {
-            LOG.debug("<== AtlasStructDefStoreV1.deleteByName({}, {})", name, preDeleteResult);
-        }
-    }
-
-    @Override
     public AtlasVertex preDeleteByGuid(String guid) throws AtlasBaseException {
         if (LOG.isDebugEnabled()) {
             LOG.debug("==> AtlasStructDefStoreV1.preDeleteByGuid({})", guid);
@@ -336,27 +308,6 @@ public class AtlasStructDefStoreV1 extends AtlasAbstractDefStoreV1 implements At
         return ret;
     }
 
-    @Override
-    public void deleteByGuid(String guid, Object preDeleteResult) throws AtlasBaseException {
-        if (LOG.isDebugEnabled()) {
-            LOG.debug("==> AtlasStructDefStoreV1.deleteByGuid({}, {})", guid, preDeleteResult);
-        }
-
-        AtlasVertex vertex;
-
-        if (preDeleteResult == null || !(preDeleteResult instanceof AtlasVertex)) {
-            vertex = preDeleteByGuid(guid);
-        } else {
-            vertex = (AtlasVertex)preDeleteResult;
-        }
-
-        typeDefStore.deleteTypeVertex(vertex);
-
-        if (LOG.isDebugEnabled()) {
-            LOG.debug("<== AtlasStructDefStoreV1.deleteByGuid({}, {})", guid, preDeleteResult);
-        }
-    }
-
     private AtlasStructDef toStructDef(AtlasVertex vertex) throws AtlasBaseException {
         AtlasStructDef ret = null;
 

http://git-wip-us.apache.org/repos/asf/atlas/blob/15d67e52/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasTypeDefGraphStoreV1.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasTypeDefGraphStoreV1.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasTypeDefGraphStoreV1.java
index ab73849..f639ea5 100644
--- a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasTypeDefGraphStoreV1.java
+++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasTypeDefGraphStoreV1.java
@@ -34,18 +34,13 @@ import org.apache.atlas.AtlasErrorCode;
 import org.apache.atlas.RequestContextV1;
 import org.apache.atlas.exception.AtlasBaseException;
 import org.apache.atlas.listener.TypeDefChangeListener;
-import org.apache.atlas.model.typedef.AtlasBaseTypeDef;
+import org.apache.atlas.model.typedef.*;
 import org.apache.atlas.repository.Constants;
 import org.apache.atlas.repository.graphdb.AtlasEdge;
 import org.apache.atlas.repository.graphdb.AtlasEdgeDirection;
 import org.apache.atlas.repository.graphdb.AtlasGraph;
 import org.apache.atlas.repository.graphdb.AtlasVertex;
-import org.apache.atlas.repository.store.graph.AtlasClassificationDefStore;
-import org.apache.atlas.repository.store.graph.AtlasEntityDefStore;
-import org.apache.atlas.repository.store.graph.AtlasEnumDefStore;
-import org.apache.atlas.repository.store.graph.AtlasRelationshipDefStore;
-import org.apache.atlas.repository.store.graph.AtlasStructDefStore;
-import org.apache.atlas.repository.store.graph.AtlasTypeDefGraphStore;
+import org.apache.atlas.repository.store.graph.*;
 import org.apache.atlas.type.AtlasType;
 import org.apache.atlas.type.AtlasTypeRegistry;
 import org.apache.atlas.typesystem.types.DataTypes.TypeCategory;
@@ -81,27 +76,27 @@ public class AtlasTypeDefGraphStoreV1 extends AtlasTypeDefGraphStore {
     }
 
     @Override
-    protected AtlasEnumDefStore getEnumDefStore(AtlasTypeRegistry typeRegistry) {
+    protected AtlasDefStore<AtlasEnumDef> getEnumDefStore(AtlasTypeRegistry typeRegistry) {
         return new AtlasEnumDefStoreV1(this, typeRegistry);
     }
 
     @Override
-    protected AtlasStructDefStore getStructDefStore(AtlasTypeRegistry typeRegistry) {
+    protected AtlasDefStore<AtlasStructDef> getStructDefStore(AtlasTypeRegistry typeRegistry) {
         return new AtlasStructDefStoreV1(this, typeRegistry);
     }
 
     @Override
-    protected AtlasClassificationDefStore getClassificationDefStore(AtlasTypeRegistry typeRegistry) {
+    protected AtlasDefStore<AtlasClassificationDef> getClassificationDefStore(AtlasTypeRegistry typeRegistry) {
         return new AtlasClassificationDefStoreV1(this, typeRegistry);
     }
 
     @Override
-    protected AtlasEntityDefStore getEntityDefStore(AtlasTypeRegistry typeRegistry) {
+    protected AtlasDefStore<AtlasEntityDef> getEntityDefStore(AtlasTypeRegistry typeRegistry) {
         return new AtlasEntityDefStoreV1(this, typeRegistry);
     }
 
     @Override
-    protected AtlasRelationshipDefStore getRelationshipDefStore(AtlasTypeRegistry typeRegistry) {
+    protected AtlasDefStore<AtlasRelationshipDef> getRelationshipDefStore(AtlasTypeRegistry typeRegistry) {
         return new AtlasRelationshipDefStoreV1(this, typeRegistry);
     }
 

http://git-wip-us.apache.org/repos/asf/atlas/blob/15d67e52/repository/src/test/java/org/apache/atlas/TestModules.java
----------------------------------------------------------------------
diff --git a/repository/src/test/java/org/apache/atlas/TestModules.java b/repository/src/test/java/org/apache/atlas/TestModules.java
index 4bc1487..a442a01 100644
--- a/repository/src/test/java/org/apache/atlas/TestModules.java
+++ b/repository/src/test/java/org/apache/atlas/TestModules.java
@@ -40,10 +40,7 @@ import org.apache.atlas.repository.graph.HardDeleteHandler;
 import org.apache.atlas.repository.graph.SoftDeleteHandler;
 import org.apache.atlas.repository.graphdb.AtlasGraph;
 import org.apache.atlas.repository.impexp.ExportService;
-import org.apache.atlas.repository.store.graph.AtlasEntityDefStore;
-import org.apache.atlas.repository.store.graph.AtlasEntityStore;
-import org.apache.atlas.repository.store.graph.AtlasRelationshipDefStore;
-import org.apache.atlas.repository.store.graph.AtlasRelationshipStore;
+import org.apache.atlas.repository.store.graph.*;
 import org.apache.atlas.repository.store.graph.v1.*;
 import org.apache.atlas.repository.typestore.GraphBackedTypeStore;
 import org.apache.atlas.repository.typestore.ITypeStore;
@@ -123,9 +120,6 @@ public class TestModules {
             bind(ITypeStore.class).to(GraphBackedTypeStore.class).asEagerSingleton();
             bind(AtlasTypeDefStore.class).to(AtlasTypeDefGraphStoreV1.class).asEagerSingleton();
 
-            //For testing
-            bind(AtlasEntityDefStore.class).to(AtlasEntityDefStoreV1.class).asEagerSingleton();
-            bind(AtlasRelationshipDefStore.class).to(AtlasRelationshipDefStoreV1.class).asEagerSingleton();
             bind(AtlasTypeRegistry.class).asEagerSingleton();
             bind(EntityGraphMapper.class).asEagerSingleton();
             bind(ExportService.class).asEagerSingleton();

http://git-wip-us.apache.org/repos/asf/atlas/blob/15d67e52/repository/src/test/java/org/apache/atlas/repository/store/graph/AtlasEntityDefStoreV1Test.java
----------------------------------------------------------------------
diff --git a/repository/src/test/java/org/apache/atlas/repository/store/graph/AtlasEntityDefStoreV1Test.java b/repository/src/test/java/org/apache/atlas/repository/store/graph/AtlasEntityDefStoreV1Test.java
deleted file mode 100644
index 5f01136..0000000
--- a/repository/src/test/java/org/apache/atlas/repository/store/graph/AtlasEntityDefStoreV1Test.java
+++ /dev/null
@@ -1,73 +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.repository.store.graph;
-
-import com.google.common.collect.ImmutableSet;
-import com.google.inject.Inject;
-import org.apache.atlas.ApplicationProperties;
-import org.apache.atlas.AtlasErrorCode;
-import org.apache.atlas.AtlasException;
-import org.apache.atlas.TestModules;
-import org.apache.atlas.exception.AtlasBaseException;
-import org.apache.atlas.model.typedef.AtlasEntityDef;
-import org.apache.atlas.repository.graph.AtlasGraphProvider;
-import org.apache.atlas.repository.store.graph.v1.AtlasAbstractDefStoreV1;
-import org.apache.atlas.type.AtlasTypeUtil;
-import org.testng.Assert;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Guice;
-import org.testng.annotations.Test;
-
-/**
- * Tests for AtlasEntityStoreV1
- */
-@Guice(modules = TestModules.TestOnlyModule.class)
-public class AtlasEntityDefStoreV1Test {
-
-    @Inject
-    private
-    AtlasEntityDefStore entityDefStore;
-
-    @DataProvider
-    public Object[][] invalidAttributeNameWithReservedKeywords(){
-        AtlasEntityDef invalidAttrNameType =
-            AtlasTypeUtil.createClassTypeDef("Invalid_Attribute_Type", "description", ImmutableSet.<String>of(),
-                AtlasTypeUtil.createRequiredAttrDef("order", "string"),
-                AtlasTypeUtil.createRequiredAttrDef("limit", "string"));
-
-        return new Object[][] {{
-            invalidAttrNameType
-        }};
-    }
-
-    @Test(dataProvider = "invalidAttributeNameWithReservedKeywords")
-    public void testCreateTypeWithReservedKeywords(AtlasEntityDef atlasEntityDef) throws AtlasException {
-        try {
-            ApplicationProperties.get().setProperty(AtlasAbstractDefStoreV1.ALLOW_RESERVED_KEYWORDS, false);
-            entityDefStore.create(atlasEntityDef, null);
-        } catch (AtlasBaseException e) {
-            Assert.assertEquals(e.getAtlasErrorCode(), AtlasErrorCode.ATTRIBUTE_NAME_INVALID);
-        }
-    }
-
-    @AfterClass
-    public void clear(){
-        AtlasGraphProvider.cleanup();
-    }
-}

http://git-wip-us.apache.org/repos/asf/atlas/blob/15d67e52/repository/src/test/java/org/apache/atlas/repository/store/graph/AtlasRelationshipDefStoreV1Test.java
----------------------------------------------------------------------
diff --git a/repository/src/test/java/org/apache/atlas/repository/store/graph/AtlasRelationshipDefStoreV1Test.java b/repository/src/test/java/org/apache/atlas/repository/store/graph/AtlasRelationshipDefStoreV1Test.java
deleted file mode 100644
index 00d4977..0000000
--- a/repository/src/test/java/org/apache/atlas/repository/store/graph/AtlasRelationshipDefStoreV1Test.java
+++ /dev/null
@@ -1,332 +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.repository.store.graph;
-
-import com.google.inject.Inject;
-import org.apache.atlas.ApplicationProperties;
-import org.apache.atlas.AtlasErrorCode;
-import org.apache.atlas.AtlasException;
-import org.apache.atlas.TestModules;
-import org.apache.atlas.exception.AtlasBaseException;
-import org.apache.atlas.model.typedef.AtlasRelationshipDef;
-import org.apache.atlas.model.typedef.AtlasRelationshipEndDef;
-import org.apache.atlas.model.typedef.AtlasStructDef;
-import org.apache.atlas.repository.graph.AtlasGraphProvider;
-import org.apache.atlas.repository.store.graph.v1.AtlasAbstractDefStoreV1;
-import org.apache.atlas.repository.store.graph.v1.AtlasRelationshipDefStoreV1;
-import org.apache.atlas.type.AtlasTypeUtil;
-import org.testng.Assert;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Guice;
-import org.testng.annotations.Test;
-
-import static org.testng.AssertJUnit.fail;
-
-/**
- * Tests for AtlasRelationshipStoreV1
- */
-@Guice(modules = TestModules.TestOnlyModule.class)
-public class AtlasRelationshipDefStoreV1Test {
-
-    @Inject
-    private
-    AtlasRelationshipDefStore relationshipDefStore;
-
-    @DataProvider
-    public Object[][] invalidAttributeNameWithReservedKeywords(){
-        AtlasRelationshipDef invalidAttrNameType =
-            AtlasTypeUtil.createRelationshipTypeDef("Invalid_Attribute_Type", "description","" ,
-                    AtlasRelationshipDef.RelationshipCategory.ASSOCIATION,
-                    AtlasRelationshipDef.PropagateTags.BOTH,
-                    new AtlasRelationshipEndDef("typeA", "attr1", AtlasStructDef.AtlasAttributeDef.Cardinality.SINGLE),
-                    new AtlasRelationshipEndDef("typeB", "attr1", AtlasStructDef.AtlasAttributeDef.Cardinality.SINGLE),
-
-                    AtlasTypeUtil.createRequiredAttrDef("order", "string"),
-                    AtlasTypeUtil.createRequiredAttrDef("limit", "string"));
-
-        return new Object[][] {{
-            invalidAttrNameType
-        }};
-    }
-    @DataProvider
-    public Object[][] updateValidProperties(){
-        AtlasRelationshipDef existingType =
-                AtlasTypeUtil.createRelationshipTypeDef("basicType", "description","0" ,
-                        AtlasRelationshipDef.RelationshipCategory.ASSOCIATION,
-                        AtlasRelationshipDef.PropagateTags.ONE_TO_TWO,
-                        new AtlasRelationshipEndDef("typeC", "attr1", AtlasStructDef.AtlasAttributeDef.Cardinality.SINGLE),
-                        new AtlasRelationshipEndDef("typeD", "attr1", AtlasStructDef.AtlasAttributeDef.Cardinality.SINGLE),
-
-                        AtlasTypeUtil.createRequiredAttrDef("aaaa", "string"),
-                        AtlasTypeUtil.createRequiredAttrDef("bbbb", "string"));
-        AtlasRelationshipDef newType =
-                AtlasTypeUtil.createRelationshipTypeDef("basicType",
-                        "description1", // updated
-                        "1" , // updated
-                        AtlasRelationshipDef.RelationshipCategory.ASSOCIATION,
-                        AtlasRelationshipDef.PropagateTags.BOTH, // updated
-                        new AtlasRelationshipEndDef("typeC", "attr1", AtlasStructDef.AtlasAttributeDef.Cardinality.SINGLE),
-                        new AtlasRelationshipEndDef("typeD", "attr1", AtlasStructDef.AtlasAttributeDef.Cardinality.SINGLE),
-
-                        AtlasTypeUtil.createRequiredAttrDef("aaaa", "string"),
-                        AtlasTypeUtil.createRequiredAttrDef("bbbb", "string"));
-
-
-        return new Object[][] {{
-                existingType,
-                newType
-        }};
-    }
-
-
-    @DataProvider
-    public Object[][] updateRename(){
-        AtlasRelationshipDef existingType =
-                AtlasTypeUtil.createRelationshipTypeDef("basicType", "description","" ,
-                        AtlasRelationshipDef.RelationshipCategory.ASSOCIATION,
-                        AtlasRelationshipDef.PropagateTags.BOTH,
-                        new AtlasRelationshipEndDef("typeC", "attr1", AtlasStructDef.AtlasAttributeDef.Cardinality.SINGLE),
-                        new AtlasRelationshipEndDef("typeD", "attr1", AtlasStructDef.AtlasAttributeDef.Cardinality.SINGLE),
-
-                        AtlasTypeUtil.createRequiredAttrDef("aaaa", "string"),
-                        AtlasTypeUtil.createRequiredAttrDef("bbbb", "string"));
-        AtlasRelationshipDef newType =
-                AtlasTypeUtil.createRelationshipTypeDef("basicType2", "description","" ,
-                        AtlasRelationshipDef.RelationshipCategory.ASSOCIATION,
-                        AtlasRelationshipDef.PropagateTags.BOTH,
-                        new AtlasRelationshipEndDef("typeC", "attr1", AtlasStructDef.AtlasAttributeDef.Cardinality.SINGLE),
-                        new AtlasRelationshipEndDef("typeD", "attr1", AtlasStructDef.AtlasAttributeDef.Cardinality.SINGLE),
-
-                        AtlasTypeUtil.createRequiredAttrDef("aaaa", "string"),
-                        AtlasTypeUtil.createRequiredAttrDef("bbbb", "string"));
-
-
-        return new Object[][] {{
-                existingType,
-                newType
-        }};
-    }
-    @DataProvider
-    public Object[][] updateRelCat(){
-        AtlasRelationshipDef existingType =
-                AtlasTypeUtil.createRelationshipTypeDef("basicType", "description","" ,
-                        AtlasRelationshipDef.RelationshipCategory.ASSOCIATION,
-                        AtlasRelationshipDef.PropagateTags.BOTH,
-                        new AtlasRelationshipEndDef("typeC", "attr1", AtlasStructDef.AtlasAttributeDef.Cardinality.SINGLE),
-                        new AtlasRelationshipEndDef("typeD", "attr1", AtlasStructDef.AtlasAttributeDef.Cardinality.SINGLE),
-
-                        AtlasTypeUtil.createRequiredAttrDef("aaaa", "string"),
-                        AtlasTypeUtil.createRequiredAttrDef("bbbb", "string"));
-        AtlasRelationshipDef newType =
-                AtlasTypeUtil.createRelationshipTypeDef("basicType", "description","" ,
-                        AtlasRelationshipDef.RelationshipCategory.AGGREGATION,
-                        AtlasRelationshipDef.PropagateTags.BOTH,
-                        new AtlasRelationshipEndDef("typeC", "attr1", AtlasStructDef.AtlasAttributeDef.Cardinality.SINGLE),
-                        new AtlasRelationshipEndDef("typeD", "attr1", AtlasStructDef.AtlasAttributeDef.Cardinality.SINGLE),
-
-                        AtlasTypeUtil.createRequiredAttrDef("aaaa", "string"),
-                        AtlasTypeUtil.createRequiredAttrDef("bbbb", "string"));
-
-
-        return new Object[][] {{
-                existingType,
-                newType
-        }};
-    }
-    @DataProvider
-    public Object[][] updateEnd1(){
-        AtlasRelationshipDef existingType =
-                AtlasTypeUtil.createRelationshipTypeDef("basicType", "description","" ,
-                        AtlasRelationshipDef.RelationshipCategory.ASSOCIATION,
-                        AtlasRelationshipDef.PropagateTags.BOTH,
-                        new AtlasRelationshipEndDef("typeC", "attr1", AtlasStructDef.AtlasAttributeDef.Cardinality.SINGLE),
-                        new AtlasRelationshipEndDef("typeD", "attr1", AtlasStructDef.AtlasAttributeDef.Cardinality.SINGLE),
-
-                        AtlasTypeUtil.createRequiredAttrDef("aaaa", "string"),
-                        AtlasTypeUtil.createRequiredAttrDef("bbbb", "string"));
-        AtlasRelationshipDef changeType =
-                AtlasTypeUtil.createRelationshipTypeDef("basicType", "description","" ,
-                        AtlasRelationshipDef.RelationshipCategory.ASSOCIATION,
-                        AtlasRelationshipDef.PropagateTags.BOTH,
-                        new AtlasRelationshipEndDef("typeE", "attr1", AtlasStructDef.AtlasAttributeDef.Cardinality.SINGLE),
-                        new AtlasRelationshipEndDef("typeD", "attr1", AtlasStructDef.AtlasAttributeDef.Cardinality.SINGLE),
-
-                        AtlasTypeUtil.createRequiredAttrDef("aaaa", "string"),
-                        AtlasTypeUtil.createRequiredAttrDef("bbbb", "string"));
-        AtlasRelationshipDef changeAttr =
-                AtlasTypeUtil.createRelationshipTypeDef("basicType", "description","" ,
-                        AtlasRelationshipDef.RelationshipCategory.ASSOCIATION,
-                        AtlasRelationshipDef.PropagateTags.BOTH,
-                        new AtlasRelationshipEndDef("typeC", "attr2", AtlasStructDef.AtlasAttributeDef.Cardinality.SINGLE),
-                        new AtlasRelationshipEndDef("typeD", "attr1", AtlasStructDef.AtlasAttributeDef.Cardinality.SINGLE),
-
-                        AtlasTypeUtil.createRequiredAttrDef("aaaa", "string"),
-                        AtlasTypeUtil.createRequiredAttrDef("bbbb", "string"));
-        AtlasRelationshipDef changeCardinality =
-                AtlasTypeUtil.createRelationshipTypeDef("basicType", "description","" ,
-                        AtlasRelationshipDef.RelationshipCategory.ASSOCIATION,
-                        AtlasRelationshipDef.PropagateTags.BOTH,
-                        new AtlasRelationshipEndDef("typeC", "attr1", AtlasStructDef.AtlasAttributeDef.Cardinality.LIST),
-                        new AtlasRelationshipEndDef("typeD", "attr1", AtlasStructDef.AtlasAttributeDef.Cardinality.SINGLE),
-
-                        AtlasTypeUtil.createRequiredAttrDef("aaaa", "string"),
-                        AtlasTypeUtil.createRequiredAttrDef("bbbb", "string"));
-
-
-        return new Object[][]{
-                {
-                        existingType,
-                        changeType
-                },
-                {
-                        existingType,
-                        changeAttr
-                },
-                {
-                        existingType,
-                        changeCardinality
-                }
-        };
-    }
-    @DataProvider
-    public Object[][] updateEnd2(){
-        AtlasRelationshipDef existingType =
-                AtlasTypeUtil.createRelationshipTypeDef("basicType", "description","" ,
-                        AtlasRelationshipDef.RelationshipCategory.ASSOCIATION,
-                        AtlasRelationshipDef.PropagateTags.BOTH,
-                        new AtlasRelationshipEndDef("typeC", "attr1", AtlasStructDef.AtlasAttributeDef.Cardinality.SINGLE),
-                        new AtlasRelationshipEndDef("typeD", "attr1", AtlasStructDef.AtlasAttributeDef.Cardinality.SINGLE),
-
-                        AtlasTypeUtil.createRequiredAttrDef("aaaa", "string"),
-                        AtlasTypeUtil.createRequiredAttrDef("bbbb", "string"));
-
-        AtlasRelationshipDef changeType =
-                AtlasTypeUtil.createRelationshipTypeDef("basicType", "description","" ,
-                        AtlasRelationshipDef.RelationshipCategory.ASSOCIATION,
-                        AtlasRelationshipDef.PropagateTags.BOTH,
-                        new AtlasRelationshipEndDef("typeC", "attr1", AtlasStructDef.AtlasAttributeDef.Cardinality.SINGLE),
-                        new AtlasRelationshipEndDef("typeE", "attr1", AtlasStructDef.AtlasAttributeDef.Cardinality.SINGLE),
-
-                        AtlasTypeUtil.createRequiredAttrDef("aaaa", "string"),
-                        AtlasTypeUtil.createRequiredAttrDef("bbbb", "string"));
-        AtlasRelationshipDef changeAttr =
-                AtlasTypeUtil.createRelationshipTypeDef("basicType", "description","" ,
-                        AtlasRelationshipDef.RelationshipCategory.ASSOCIATION,
-                        AtlasRelationshipDef.PropagateTags.BOTH,
-                        new AtlasRelationshipEndDef("typeC", "attr1", AtlasStructDef.AtlasAttributeDef.Cardinality.SINGLE),
-                        new AtlasRelationshipEndDef("typeD", "attr2", AtlasStructDef.AtlasAttributeDef.Cardinality.SINGLE),
-
-                        AtlasTypeUtil.createRequiredAttrDef("aaaa", "string"),
-                        AtlasTypeUtil.createRequiredAttrDef("bbbb", "string"));
-        AtlasRelationshipDef changeCardinality =
-                AtlasTypeUtil.createRelationshipTypeDef("basicType", "description","" ,
-                        AtlasRelationshipDef.RelationshipCategory.ASSOCIATION,
-                        AtlasRelationshipDef.PropagateTags.BOTH,
-                        new AtlasRelationshipEndDef("typeC", "attr1", AtlasStructDef.AtlasAttributeDef.Cardinality.SINGLE),
-                        new AtlasRelationshipEndDef("typeD", "attr1", AtlasStructDef.AtlasAttributeDef.Cardinality.LIST),
-
-                        AtlasTypeUtil.createRequiredAttrDef("aaaa", "string"),
-                        AtlasTypeUtil.createRequiredAttrDef("bbbb", "string"));
-
-
-        return new Object[][]{
-                {
-                        existingType,
-                        changeType
-                },
-                {
-                        existingType,
-                        changeAttr
-                },
-                {
-                        existingType,
-                        changeCardinality
-                }
-        };
-    }
-
-    @Test(dataProvider = "invalidAttributeNameWithReservedKeywords")
-    public void testCreateTypeWithReservedKeywords(AtlasRelationshipDef atlasRelationshipDef) throws AtlasException {
-        try {
-            ApplicationProperties.get().setProperty(AtlasAbstractDefStoreV1.ALLOW_RESERVED_KEYWORDS, false);
-            relationshipDefStore.create(atlasRelationshipDef, null);
-        } catch (AtlasBaseException e) {
-            Assert.assertEquals(e.getAtlasErrorCode(), AtlasErrorCode.ATTRIBUTE_NAME_INVALID);
-        }
-    }
-
-    @Test(dataProvider = "updateValidProperties")
-    public void testupdateVertexPreUpdatepropagateTags(AtlasRelationshipDef existingRelationshipDef,AtlasRelationshipDef newRelationshipDef) throws AtlasBaseException {
-        AtlasRelationshipDefStoreV1.preUpdateCheck(existingRelationshipDef,newRelationshipDef);
-    }
-
-    @Test(dataProvider = "updateRename")
-    public void testupdateVertexPreUpdateRename(AtlasRelationshipDef existingRelationshipDef,AtlasRelationshipDef newRelationshipDef)  {
-
-        try {
-            AtlasRelationshipDefStoreV1.preUpdateCheck(existingRelationshipDef,newRelationshipDef);
-            fail("expected error");
-        } catch (AtlasBaseException e) {
-            if (!e.getAtlasErrorCode().equals(AtlasErrorCode.RELATIONSHIPDEF_INVALID_NAME_UPDATE)){
-                fail("unexpected AtlasErrorCode "+e.getAtlasErrorCode());
-            }
-        }
-    }
-    @Test(dataProvider = "updateRelCat")
-    public void testupdateVertexPreUpdateRelcat(AtlasRelationshipDef existingRelationshipDef,AtlasRelationshipDef newRelationshipDef)  {
-
-        try {
-            AtlasRelationshipDefStoreV1.preUpdateCheck(existingRelationshipDef,newRelationshipDef);
-            fail("expected error");
-        } catch (AtlasBaseException e) {
-            if (!e.getAtlasErrorCode().equals(AtlasErrorCode.RELATIONSHIPDEF_INVALID_CATEGORY_UPDATE)){
-                fail("unexpected AtlasErrorCode "+e.getAtlasErrorCode());
-            }
-        }
-    }
-    @Test(dataProvider = "updateEnd1")
-    public void testupdateVertexPreUpdateEnd1(AtlasRelationshipDef existingRelationshipDef,AtlasRelationshipDef newRelationshipDef)  {
-
-        try {
-            AtlasRelationshipDefStoreV1.preUpdateCheck(existingRelationshipDef,newRelationshipDef);
-            fail("expected error");
-        } catch (AtlasBaseException e) {
-            if (!e.getAtlasErrorCode().equals(AtlasErrorCode.RELATIONSHIPDEF_INVALID_END1_UPDATE)){
-                fail("unexpected AtlasErrorCode "+e.getAtlasErrorCode());
-            }
-        }
-    }
-
-    @Test(dataProvider = "updateEnd2")
-    public void testupdateVertexPreUpdateEnd2(AtlasRelationshipDef existingRelationshipDef,AtlasRelationshipDef newRelationshipDef)  {
-
-        try {
-            AtlasRelationshipDefStoreV1.preUpdateCheck(existingRelationshipDef,newRelationshipDef);
-            fail("expected error");
-        } catch (AtlasBaseException e) {
-            if (!e.getAtlasErrorCode().equals(AtlasErrorCode.RELATIONSHIPDEF_INVALID_END2_UPDATE)){
-                fail("unexpected AtlasErrorCode "+e.getAtlasErrorCode());
-            }
-        }
-    }
-    @AfterClass
-    public void clear(){
-        AtlasGraphProvider.cleanup();
-    }
-}

http://git-wip-us.apache.org/repos/asf/atlas/blob/15d67e52/repository/src/test/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityDefStoreV1Test.java
----------------------------------------------------------------------
diff --git a/repository/src/test/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityDefStoreV1Test.java b/repository/src/test/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityDefStoreV1Test.java
new file mode 100644
index 0000000..95b5761
--- /dev/null
+++ b/repository/src/test/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityDefStoreV1Test.java
@@ -0,0 +1,72 @@
+/**
+ * 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.repository.store.graph.v1;
+
+import com.google.common.collect.ImmutableSet;
+import com.google.inject.Inject;
+import org.apache.atlas.ApplicationProperties;
+import org.apache.atlas.AtlasErrorCode;
+import org.apache.atlas.AtlasException;
+import org.apache.atlas.TestModules;
+import org.apache.atlas.exception.AtlasBaseException;
+import org.apache.atlas.model.typedef.AtlasEntityDef;
+import org.apache.atlas.repository.graph.AtlasGraphProvider;
+import org.apache.atlas.type.AtlasTypeUtil;
+import org.testng.Assert;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Guice;
+import org.testng.annotations.Test;
+
+/**
+ * Tests for AtlasEntityStoreV1
+ */
+@Guice(modules = TestModules.TestOnlyModule.class)
+public class AtlasEntityDefStoreV1Test {
+
+    @Inject
+    private
+    AtlasEntityDefStoreV1 entityDefStore;
+
+    @DataProvider
+    public Object[][] invalidAttributeNameWithReservedKeywords(){
+        AtlasEntityDef invalidAttrNameType =
+            AtlasTypeUtil.createClassTypeDef("Invalid_Attribute_Type", "description", ImmutableSet.<String>of(),
+                AtlasTypeUtil.createRequiredAttrDef("order", "string"),
+                AtlasTypeUtil.createRequiredAttrDef("limit", "string"));
+
+        return new Object[][] {{
+            invalidAttrNameType
+        }};
+    }
+
+    @Test(dataProvider = "invalidAttributeNameWithReservedKeywords")
+    public void testCreateTypeWithReservedKeywords(AtlasEntityDef atlasEntityDef) throws AtlasException {
+        try {
+            ApplicationProperties.get().setProperty(AtlasAbstractDefStoreV1.ALLOW_RESERVED_KEYWORDS, false);
+            entityDefStore.create(atlasEntityDef, null);
+        } catch (AtlasBaseException e) {
+            Assert.assertEquals(e.getAtlasErrorCode(), AtlasErrorCode.ATTRIBUTE_NAME_INVALID);
+        }
+    }
+
+    @AfterClass
+    public void clear(){
+        AtlasGraphProvider.cleanup();
+    }
+}


Mime
View raw message