You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@atlas.apache.org by ap...@apache.org on 2017/05/09 19:21:36 UTC

[2/2] incubator-atlas git commit: ATLAS-1573: Sandbox test data to avoid interference

ATLAS-1573: Sandbox test data to avoid interference


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

Branch: refs/heads/master
Commit: 1d67afc6fa74e4160a2b98ad793d2d1560b19743
Parents: b6eef8c
Author: apoorvnaik <an...@hortonworks.com>
Authored: Tue Apr 25 21:56:00 2017 -0700
Committer: apoorvnaik <an...@hortonworks.com>
Committed: Tue May 9 12:20:57 2017 -0700

----------------------------------------------------------------------
 graphdb/common/pom.xml                          | 24 +++++--
 .../apache/atlas/graph/GraphSandboxUtil.java    | 52 +++++++++++++++
 graphdb/titan0/pom.xml                          |  8 +++
 .../titan0/AbstractGraphDatabaseTest.java       | 16 ++---
 .../graphdb/titan0/Titan0DatabaseTest.java      | 28 ++++----
 .../titan0/Titan0DatabaseValidationTest.java    |  3 +
 graphdb/titan1/pom.xml                          |  8 +++
 .../titan1/AbstractGraphDatabaseTest.java       | 16 ++---
 .../graphdb/titan1/Titan1DatabaseTest.java      | 26 ++++----
 .../graphdb/titan1/TitanGraphProviderTest.java  |  3 +
 pom.xml                                         |  7 +-
 repository/pom.xml                              | 16 ++++-
 .../org/apache/atlas/BaseRepositoryTest.java    | 21 ++----
 .../test/java/org/apache/atlas/DBSandboxer.java | 35 ++++++++++
 .../atlas/RepositoryServiceLoadingTest.java     |  2 +-
 .../java/org/apache/atlas/TestOnlyModule.java   | 30 +++++++++
 .../test/java/org/apache/atlas/TestUtils.java   | 67 ++++++++------------
 .../discovery/DataSetLineageServiceTest.java    |  4 +-
 .../GraphBackedDiscoveryServiceTest.java        | 36 ++++-------
 .../atlas/lineage/EntityLineageServiceTest.java | 29 ++++-----
 .../apache/atlas/query/QueryProcessorTest.java  | 20 +++---
 .../AbstractGremlinQueryOptimizerTest.java      | 25 ++++----
 ...hBackedMetadataRepositoryDeleteTestBase.java | 28 ++------
 .../GraphBackedMetadataRepositoryTest.java      | 49 +++++++-------
 .../GraphBackedRepositoryHardDeleteTest.java    |  3 +-
 .../GraphBackedRepositorySoftDeleteTest.java    |  3 +-
 .../graph/GraphBackedSearchIndexerTest.java     | 23 +++----
 .../repository/graph/GraphHelperMockTest.java   | 12 ++--
 .../atlas/repository/graph/GraphHelperTest.java | 33 ++++------
 .../graph/GraphRepoMapperScaleTest.java         |  7 +-
 .../graph/Gremlin2QueryOptimizerTest.java       |  7 +-
 .../graph/Gremlin3QueryOptimizerTest.java       |  5 +-
 .../ReverseReferenceUpdateHardDeleteTest.java   |  4 +-
 .../ReverseReferenceUpdateSoftDeleteTest.java   |  6 +-
 .../graph/ReverseReferenceUpdateTestBase.java   | 19 +++---
 .../repository/impexp/ExportServiceTest.java    |  8 +--
 .../impexp/ImportServiceReportingTest.java      | 13 +---
 .../repository/impexp/ImportServiceTest.java    |  4 +-
 .../store/graph/AtlasTypeDefGraphStoreTest.java | 13 +---
 .../graph/v1/AtlasDeleteHandlerV1Test.java      | 13 +---
 .../store/graph/v1/AtlasEntityStoreV1Test.java  |  4 +-
 .../InverseReferenceUpdateHardDeleteV1Test.java | 11 ++--
 .../InverseReferenceUpdateSoftDeleteV1Test.java | 11 ++--
 .../graph/v1/InverseReferenceUpdateV1Test.java  | 32 +++++-----
 .../typestore/GraphBackedTypeStoreTest.java     |  4 +-
 .../StoreBackedTypeCacheConfigurationTest.java  |  5 +-
 .../typestore/StoreBackedTypeCacheTest.java     | 16 ++---
 .../StoreBackedTypeCacheTestModule.java         | 43 -------------
 .../StoreBackedTypeCacheTestOnlyModule.java     | 44 +++++++++++++
 .../service/DefaultMetadataServiceTest.java     | 47 +++++---------
 ...StoreBackedTypeCacheMetadataServiceTest.java | 14 ++--
 .../atlas/util/CompiledQueryCacheKeyTest.java   |  6 +-
 .../java/org/apache/atlas/utils/HiveModel.java  | 14 ++--
 .../org/apache/atlas/query/ExpressionTest.scala |  3 +-
 .../org/apache/atlas/query/GremlinTest.scala    | 33 +++++-----
 .../org/apache/atlas/query/GremlinTest2.scala   | 11 +---
 .../org/apache/atlas/query/LexerTest.scala      |  3 +-
 .../apache/atlas/query/LineageQueryTest.scala   |  7 +-
 .../org/apache/atlas/query/ParserTest.scala     |  3 +-
 webapp/pom.xml                                  |  6 ++
 .../atlas/web/adapters/TestEntitiesREST.java    |  9 ++-
 .../atlas/web/adapters/TestEntityREST.java      |  6 +-
 62 files changed, 546 insertions(+), 512 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1d67afc6/graphdb/common/pom.xml
----------------------------------------------------------------------
diff --git a/graphdb/common/pom.xml b/graphdb/common/pom.xml
index 2b8d9ab..8b95f36 100644
--- a/graphdb/common/pom.xml
+++ b/graphdb/common/pom.xml
@@ -34,13 +34,6 @@ under the License. -->
         </dependency>
 
         <dependency>
-            <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
-            <version>4.9</version>
-            <scope>test</scope>
-        </dependency>
-
-        <dependency>
             <groupId>org.testng</groupId>
             <artifactId>testng</artifactId>
             <version>6.9.4</version>
@@ -55,4 +48,21 @@ under the License. -->
         </dependency>
     </dependencies>
 
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-jar-plugin</artifactId>
+                <version>2.4</version>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>test-jar</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+
 </project>

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1d67afc6/graphdb/common/src/test/java/org/apache/atlas/graph/GraphSandboxUtil.java
----------------------------------------------------------------------
diff --git a/graphdb/common/src/test/java/org/apache/atlas/graph/GraphSandboxUtil.java b/graphdb/common/src/test/java/org/apache/atlas/graph/GraphSandboxUtil.java
new file mode 100644
index 0000000..44ad4fc
--- /dev/null
+++ b/graphdb/common/src/test/java/org/apache/atlas/graph/GraphSandboxUtil.java
@@ -0,0 +1,52 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.atlas.graph;
+
+import org.apache.atlas.ApplicationProperties;
+import org.apache.atlas.AtlasException;
+import org.apache.commons.configuration.Configuration;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.File;
+
+public class GraphSandboxUtil {
+    private static final Logger LOG = LoggerFactory.getLogger(GraphSandboxUtil.class);
+
+    public static void create() {
+        Configuration configuration;
+        try {
+            configuration = ApplicationProperties.get();
+            // Append a suffix to isolate the database for each instance
+            long currentMillisecs = System.currentTimeMillis();
+
+            String newStorageDir = System.getProperty("atlas.data") +
+                    File.pathSeparator + "storage" +
+                    File.pathSeparator + currentMillisecs;
+            configuration.setProperty("atlas.graph.storage.directory", newStorageDir);
+
+            String newIndexerDir = System.getProperty("atlas.data") +
+                    File.pathSeparator + "index" +
+                    File.pathSeparator + currentMillisecs;
+            configuration.setProperty("atlas.graph.index.search.directory", newIndexerDir);
+
+            LOG.debug("New Storage dir : {}", newStorageDir);
+            LOG.debug("New Indexer dir : {}", newIndexerDir);
+        } catch (AtlasException ignored) {}
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1d67afc6/graphdb/titan0/pom.xml
----------------------------------------------------------------------
diff --git a/graphdb/titan0/pom.xml b/graphdb/titan0/pom.xml
index 2db5514..71f2832 100644
--- a/graphdb/titan0/pom.xml
+++ b/graphdb/titan0/pom.xml
@@ -166,6 +166,14 @@
             <scope>test</scope>
         </dependency>
 
+        <dependency>
+            <groupId>org.apache.atlas</groupId>
+            <artifactId>atlas-graphdb-common</artifactId>
+            <version>${project.version}</version>
+            <classifier>tests</classifier>
+            <scope>test</scope>
+        </dependency>
+
     </dependencies>
 
     <build>

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1d67afc6/graphdb/titan0/src/test/java/org/apache/atlas/repository/graphdb/titan0/AbstractGraphDatabaseTest.java
----------------------------------------------------------------------
diff --git a/graphdb/titan0/src/test/java/org/apache/atlas/repository/graphdb/titan0/AbstractGraphDatabaseTest.java b/graphdb/titan0/src/test/java/org/apache/atlas/repository/graphdb/titan0/AbstractGraphDatabaseTest.java
index 2dca50e..fbbfdef 100644
--- a/graphdb/titan0/src/test/java/org/apache/atlas/repository/graphdb/titan0/AbstractGraphDatabaseTest.java
+++ b/graphdb/titan0/src/test/java/org/apache/atlas/repository/graphdb/titan0/AbstractGraphDatabaseTest.java
@@ -18,10 +18,7 @@
 
 package org.apache.atlas.repository.graphdb.titan0;
 
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
+import org.apache.atlas.graph.GraphSandboxUtil;
 import org.apache.atlas.repository.Constants;
 import org.apache.atlas.repository.graphdb.AtlasCardinality;
 import org.apache.atlas.repository.graphdb.AtlasGraph;
@@ -32,6 +29,10 @@ import org.testng.annotations.AfterClass;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeClass;
 
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
 /**
  *
  */
@@ -46,13 +47,10 @@ public abstract class AbstractGraphDatabaseTest {
 
     private AtlasGraph<?, ?> graph = null;
 
-
-    public AbstractGraphDatabaseTest() {
-       super();
-    }
-
     @BeforeClass
     public static void createIndices() {
+        GraphSandboxUtil.create();
+
         Titan0GraphDatabase db = new Titan0GraphDatabase();
         AtlasGraphManagement mgmt = db.getGraph().getManagementSystem();
 

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1d67afc6/graphdb/titan0/src/test/java/org/apache/atlas/repository/graphdb/titan0/Titan0DatabaseTest.java
----------------------------------------------------------------------
diff --git a/graphdb/titan0/src/test/java/org/apache/atlas/repository/graphdb/titan0/Titan0DatabaseTest.java b/graphdb/titan0/src/test/java/org/apache/atlas/repository/graphdb/titan0/Titan0DatabaseTest.java
index ade395b..3756382 100644
--- a/graphdb/titan0/src/test/java/org/apache/atlas/repository/graphdb/titan0/Titan0DatabaseTest.java
+++ b/graphdb/titan0/src/test/java/org/apache/atlas/repository/graphdb/titan0/Titan0DatabaseTest.java
@@ -18,22 +18,8 @@
 
 package org.apache.atlas.repository.graphdb.titan0;
 
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertNull;
-import static org.testng.Assert.assertTrue;
-import static org.testng.Assert.fail;
-
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-
 import org.apache.atlas.AtlasException;
+import org.apache.atlas.graph.GraphSandboxUtil;
 import org.apache.atlas.repository.Constants;
 import org.apache.atlas.repository.graphdb.AtlasCardinality;
 import org.apache.atlas.repository.graphdb.AtlasEdge;
@@ -48,6 +34,16 @@ import org.apache.atlas.typesystem.types.DataTypes.TypeCategory;
 import org.testng.annotations.AfterClass;
 import org.testng.annotations.Test;
 
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+
+import static org.testng.Assert.*;
+
 /**
  * Sanity test of basic graph operations using the Titan 0.5.4 graphdb
  * abstraction layer implementation.
@@ -57,6 +53,8 @@ public class Titan0DatabaseTest {
     private AtlasGraph<?, ?> atlasGraph;
 
     private <V, E> AtlasGraph<V, E> getGraph() {
+        GraphSandboxUtil.create();
+
         if (atlasGraph == null) {
             Titan0GraphDatabase db = new Titan0GraphDatabase();
             atlasGraph = db.getGraph();

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1d67afc6/graphdb/titan0/src/test/java/org/apache/atlas/repository/graphdb/titan0/Titan0DatabaseValidationTest.java
----------------------------------------------------------------------
diff --git a/graphdb/titan0/src/test/java/org/apache/atlas/repository/graphdb/titan0/Titan0DatabaseValidationTest.java b/graphdb/titan0/src/test/java/org/apache/atlas/repository/graphdb/titan0/Titan0DatabaseValidationTest.java
index 1eccc7f..b70d322 100644
--- a/graphdb/titan0/src/test/java/org/apache/atlas/repository/graphdb/titan0/Titan0DatabaseValidationTest.java
+++ b/graphdb/titan0/src/test/java/org/apache/atlas/repository/graphdb/titan0/Titan0DatabaseValidationTest.java
@@ -19,6 +19,7 @@ package org.apache.atlas.repository.graphdb.titan0;
 
 import org.apache.atlas.ApplicationProperties;
 import org.apache.atlas.AtlasException;
+import org.apache.atlas.graph.GraphSandboxUtil;
 import org.apache.atlas.repository.graphdb.AtlasGraph;
 import org.apache.commons.configuration.Configuration;
 import org.testng.Assert;
@@ -34,6 +35,8 @@ public class Titan0DatabaseValidationTest {
 
     @BeforeTest
     public void setUp() throws AtlasException {
+        GraphSandboxUtil.create();
+
         // First get Instance
         graph = new Titan0Graph();
         configuration = ApplicationProperties.getSubsetConfiguration(ApplicationProperties.get(),

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1d67afc6/graphdb/titan1/pom.xml
----------------------------------------------------------------------
diff --git a/graphdb/titan1/pom.xml b/graphdb/titan1/pom.xml
index b147987..5611193 100644
--- a/graphdb/titan1/pom.xml
+++ b/graphdb/titan1/pom.xml
@@ -210,6 +210,14 @@
             <artifactId>tinkergraph-gremlin</artifactId>
             <version>3.0.1-incubating</version>
         </dependency>
+
+        <dependency>
+            <groupId>org.apache.atlas</groupId>
+            <artifactId>atlas-graphdb-common</artifactId>
+            <version>${project.version}</version>
+            <classifier>tests</classifier>
+            <scope>test</scope>
+        </dependency>
     </dependencies>
 
     <build>

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1d67afc6/graphdb/titan1/src/test/java/org/apache/atlas/repository/graphdb/titan1/AbstractGraphDatabaseTest.java
----------------------------------------------------------------------
diff --git a/graphdb/titan1/src/test/java/org/apache/atlas/repository/graphdb/titan1/AbstractGraphDatabaseTest.java b/graphdb/titan1/src/test/java/org/apache/atlas/repository/graphdb/titan1/AbstractGraphDatabaseTest.java
index 7f3a436..06e2785 100644
--- a/graphdb/titan1/src/test/java/org/apache/atlas/repository/graphdb/titan1/AbstractGraphDatabaseTest.java
+++ b/graphdb/titan1/src/test/java/org/apache/atlas/repository/graphdb/titan1/AbstractGraphDatabaseTest.java
@@ -18,10 +18,7 @@
 
 package org.apache.atlas.repository.graphdb.titan1;
 
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
+import org.apache.atlas.graph.GraphSandboxUtil;
 import org.apache.atlas.repository.Constants;
 import org.apache.atlas.repository.graphdb.AtlasCardinality;
 import org.apache.atlas.repository.graphdb.AtlasGraph;
@@ -32,6 +29,10 @@ import org.testng.annotations.AfterClass;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeClass;
 
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
 /**
  *
  */
@@ -46,13 +47,10 @@ public abstract class AbstractGraphDatabaseTest {
 
     private AtlasGraph<?, ?> graph = null;
 
-
-    public AbstractGraphDatabaseTest() {
-       super();
-    }
-
     @BeforeClass
     public static void createIndices() {
+        GraphSandboxUtil.create();
+
         Titan1GraphDatabase db = new Titan1GraphDatabase();
         AtlasGraphManagement mgmt = db.getGraph().getManagementSystem();
 

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1d67afc6/graphdb/titan1/src/test/java/org/apache/atlas/repository/graphdb/titan1/Titan1DatabaseTest.java
----------------------------------------------------------------------
diff --git a/graphdb/titan1/src/test/java/org/apache/atlas/repository/graphdb/titan1/Titan1DatabaseTest.java b/graphdb/titan1/src/test/java/org/apache/atlas/repository/graphdb/titan1/Titan1DatabaseTest.java
index 6db0da8..ab2c8c9 100644
--- a/graphdb/titan1/src/test/java/org/apache/atlas/repository/graphdb/titan1/Titan1DatabaseTest.java
+++ b/graphdb/titan1/src/test/java/org/apache/atlas/repository/graphdb/titan1/Titan1DatabaseTest.java
@@ -18,21 +18,8 @@
 
 package org.apache.atlas.repository.graphdb.titan1;
 
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertNull;
-import static org.testng.Assert.assertTrue;
-import static org.testng.Assert.fail;
-
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-
 import org.apache.atlas.AtlasException;
+import org.apache.atlas.graph.GraphSandboxUtil;
 import org.apache.atlas.repository.Constants;
 import org.apache.atlas.repository.graphdb.AtlasCardinality;
 import org.apache.atlas.repository.graphdb.AtlasEdge;
@@ -47,6 +34,15 @@ import org.apache.atlas.typesystem.types.DataTypes.TypeCategory;
 import org.testng.annotations.AfterClass;
 import org.testng.annotations.Test;
 
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+
+import static org.testng.Assert.*;
+
 /**
  * Sanity test of basic graph operations using the Titan 0.5.4 graphdb
  * abstraction layer implementation.
@@ -56,6 +52,8 @@ public class Titan1DatabaseTest {
     private AtlasGraph<?, ?> atlasGraph;
 
     private <V, E> AtlasGraph<V, E> getGraph() {
+        GraphSandboxUtil.create();
+
         if (atlasGraph == null) {
             Titan1GraphDatabase db = new Titan1GraphDatabase();
             atlasGraph = db.getGraph();

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1d67afc6/graphdb/titan1/src/test/java/org/apache/atlas/repository/graphdb/titan1/TitanGraphProviderTest.java
----------------------------------------------------------------------
diff --git a/graphdb/titan1/src/test/java/org/apache/atlas/repository/graphdb/titan1/TitanGraphProviderTest.java b/graphdb/titan1/src/test/java/org/apache/atlas/repository/graphdb/titan1/TitanGraphProviderTest.java
index 6b255f0..53148fa 100644
--- a/graphdb/titan1/src/test/java/org/apache/atlas/repository/graphdb/titan1/TitanGraphProviderTest.java
+++ b/graphdb/titan1/src/test/java/org/apache/atlas/repository/graphdb/titan1/TitanGraphProviderTest.java
@@ -19,6 +19,7 @@ package org.apache.atlas.repository.graphdb.titan1;
 
 import org.apache.atlas.ApplicationProperties;
 import org.apache.atlas.AtlasException;
+import org.apache.atlas.graph.GraphSandboxUtil;
 import org.apache.atlas.repository.graphdb.AtlasGraph;
 import org.apache.commons.configuration.Configuration;
 import org.testng.Assert;
@@ -34,6 +35,8 @@ public class TitanGraphProviderTest {
 
     @BeforeTest
     public void setUp() throws AtlasException {
+        GraphSandboxUtil.create();
+
         //First get Instance
         graph = new Titan1Graph();
         configuration = ApplicationProperties.getSubsetConfiguration(ApplicationProperties.get(),

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1d67afc6/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 934be23..d2ef436 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1805,7 +1805,8 @@
                         <log4j.configuration>atlas-log4j.xml</log4j.configuration>
                     </systemProperties>
                     <skipTests>${skipTests}</skipTests>
-                    <forkMode>always</forkMode>
+                    <forkCount>2C</forkCount>
+                    <reuseForks>false</reuseForks>
                     <redirectTestOutputToFile>true</redirectTestOutputToFile>
                     <argLine>-Djava.awt.headless=true -Dproject.version=${project.version}
                         -Dhadoop.tmp.dir="${project.build.directory}/tmp-hadoop-${user.name}"
@@ -1838,10 +1839,8 @@
                         -Xmx1024m -XX:MaxPermSize=512m ${atlas.surefire.options}
                     </argLine>
                     <skip>${skipITs}</skip>
-                    <parallel>none</parallel>
                     <reuseForks>false</reuseForks>
-                    <forkCount>1</forkCount>
-                    <threadCount>5</threadCount>
+                    <forkCount>2C</forkCount>
                     <redirectTestOutputToFile>true</redirectTestOutputToFile>
                 </configuration>
                 <executions>

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1d67afc6/repository/pom.xml
----------------------------------------------------------------------
diff --git a/repository/pom.xml b/repository/pom.xml
index 4ff0999..54c779f 100755
--- a/repository/pom.xml
+++ b/repository/pom.xml
@@ -144,7 +144,8 @@
 
         <dependency>
             <groupId>org.apache.atlas</groupId>
-            <artifactId>atlas-typesystem</artifactId>
+            <artifactId>atlas-graphdb-common</artifactId>
+            <version>${project.version}</version>
             <classifier>tests</classifier>
             <scope>test</scope>
         </dependency>
@@ -222,8 +223,17 @@
                 </executions>
             </plugin>
             <plugin>
-                <groupId>net.alchim31.maven</groupId>
-                <artifactId>scala-maven-plugin</artifactId>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-surefire-plugin</artifactId>
+                <version>2.18.1</version>
+                <configuration combine.children="override">
+                    <properties>
+                        <property>
+                            <name>listener</name>
+                            <value>org.apache.atlas.DBSandboxer</value>
+                        </property>
+                    </properties>
+                </configuration>
             </plugin>
 
             <plugin>

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1d67afc6/repository/src/test/java/org/apache/atlas/BaseRepositoryTest.java
----------------------------------------------------------------------
diff --git a/repository/src/test/java/org/apache/atlas/BaseRepositoryTest.java b/repository/src/test/java/org/apache/atlas/BaseRepositoryTest.java
index 6656dc6..a7cb2e5 100644
--- a/repository/src/test/java/org/apache/atlas/BaseRepositoryTest.java
+++ b/repository/src/test/java/org/apache/atlas/BaseRepositoryTest.java
@@ -20,7 +20,6 @@ package org.apache.atlas;
 import com.google.common.base.Preconditions;
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableSet;
-
 import org.apache.atlas.repository.MetadataRepository;
 import org.apache.atlas.repository.graph.AtlasGraphProvider;
 import org.apache.atlas.repository.graph.GraphBackedSearchIndexer;
@@ -31,32 +30,22 @@ import org.apache.atlas.typesystem.Referenceable;
 import org.apache.atlas.typesystem.TypesDef;
 import org.apache.atlas.typesystem.json.TypesSerialization;
 import org.apache.atlas.typesystem.persistence.Id;
-import org.apache.atlas.typesystem.types.AttributeDefinition;
-import org.apache.atlas.typesystem.types.ClassType;
-import org.apache.atlas.typesystem.types.DataTypes;
-import org.apache.atlas.typesystem.types.EnumTypeDefinition;
-import org.apache.atlas.typesystem.types.HierarchicalTypeDefinition;
-import org.apache.atlas.typesystem.types.IDataType;
-import org.apache.atlas.typesystem.types.Multiplicity;
-import org.apache.atlas.typesystem.types.StructTypeDefinition;
-import org.apache.atlas.typesystem.types.TraitType;
-import org.apache.atlas.typesystem.types.TypeSystem;
+import org.apache.atlas.typesystem.types.*;
 import org.apache.atlas.typesystem.types.utils.TypesUtil;
 import org.testng.annotations.Guice;
 
-import static org.apache.atlas.AtlasClient.PROCESS_ATTRIBUTE_INPUTS;
-import static org.apache.atlas.AtlasClient.PROCESS_ATTRIBUTE_OUTPUTS;
-
+import javax.inject.Inject;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
 
-import javax.inject.Inject;
+import static org.apache.atlas.AtlasClient.PROCESS_ATTRIBUTE_INPUTS;
+import static org.apache.atlas.AtlasClient.PROCESS_ATTRIBUTE_OUTPUTS;
 
 /**
  *  Base Class to set up hive types and instances for tests
  */
-@Guice(modules = RepositoryMetadataModule.class)
+@Guice(modules = TestOnlyModule.class)
 public class BaseRepositoryTest {
 
     @Inject

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1d67afc6/repository/src/test/java/org/apache/atlas/DBSandboxer.java
----------------------------------------------------------------------
diff --git a/repository/src/test/java/org/apache/atlas/DBSandboxer.java b/repository/src/test/java/org/apache/atlas/DBSandboxer.java
new file mode 100644
index 0000000..cc8e0e2
--- /dev/null
+++ b/repository/src/test/java/org/apache/atlas/DBSandboxer.java
@@ -0,0 +1,35 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.atlas;
+
+import org.apache.atlas.graph.GraphSandboxUtil;
+import org.apache.atlas.repository.graph.AtlasGraphProvider;
+import org.testng.ITestContext;
+import org.testng.TestListenerAdapter;
+
+public class DBSandboxer extends TestListenerAdapter {
+    @Override
+    public void onStart(ITestContext context) {
+        GraphSandboxUtil.create();
+    }
+
+    @Override
+    public void onFinish(ITestContext context) {
+        AtlasGraphProvider.cleanup();
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1d67afc6/repository/src/test/java/org/apache/atlas/RepositoryServiceLoadingTest.java
----------------------------------------------------------------------
diff --git a/repository/src/test/java/org/apache/atlas/RepositoryServiceLoadingTest.java b/repository/src/test/java/org/apache/atlas/RepositoryServiceLoadingTest.java
index 6e13077..01081da 100755
--- a/repository/src/test/java/org/apache/atlas/RepositoryServiceLoadingTest.java
+++ b/repository/src/test/java/org/apache/atlas/RepositoryServiceLoadingTest.java
@@ -29,7 +29,7 @@ import org.testng.annotations.Test;
  * Uses TestNG's Guice annotation to load the necessary modules and inject the
  * objects from Guice
  */
-@Guice(modules = RepositoryMetadataModule.class)
+@Guice(modules = TestOnlyModule.class)
 public class RepositoryServiceLoadingTest {
 
     @Test

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1d67afc6/repository/src/test/java/org/apache/atlas/TestOnlyModule.java
----------------------------------------------------------------------
diff --git a/repository/src/test/java/org/apache/atlas/TestOnlyModule.java b/repository/src/test/java/org/apache/atlas/TestOnlyModule.java
new file mode 100644
index 0000000..c930953
--- /dev/null
+++ b/repository/src/test/java/org/apache/atlas/TestOnlyModule.java
@@ -0,0 +1,30 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.atlas;
+
+import org.apache.atlas.graph.GraphSandboxUtil;
+
+public class TestOnlyModule extends RepositoryMetadataModule {
+    @Override
+    protected void configure() {
+        GraphSandboxUtil.create();
+
+        // Configure extra stuff for test DI here
+        super.configure();
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1d67afc6/repository/src/test/java/org/apache/atlas/TestUtils.java
----------------------------------------------------------------------
diff --git a/repository/src/test/java/org/apache/atlas/TestUtils.java b/repository/src/test/java/org/apache/atlas/TestUtils.java
index f09aa5a..cf39d8d 100755
--- a/repository/src/test/java/org/apache/atlas/TestUtils.java
+++ b/repository/src/test/java/org/apache/atlas/TestUtils.java
@@ -18,33 +18,9 @@
 
 package org.apache.atlas;
 
-import static org.apache.atlas.typesystem.types.utils.TypesUtil.createClassTypeDef;
-import static org.apache.atlas.typesystem.types.utils.TypesUtil.createOptionalAttrDef;
-import static org.apache.atlas.typesystem.types.utils.TypesUtil.createRequiredAttrDef;
-import static org.apache.atlas.typesystem.types.utils.TypesUtil.createStructTypeDef;
-import static org.apache.atlas.typesystem.types.utils.TypesUtil.createTraitTypeDef;
-import static org.apache.atlas.typesystem.types.utils.TypesUtil.createUniqueRequiredAttrDef;
-import static org.testng.Assert.assertEquals;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableSet;
+import com.google.inject.Provider;
 import org.apache.atlas.listener.EntityChangeListener;
 import org.apache.atlas.listener.TypesChangeListener;
 import org.apache.atlas.repository.MetadataRepository;
@@ -65,19 +41,8 @@ import org.apache.atlas.typesystem.Referenceable;
 import org.apache.atlas.typesystem.TypesDef;
 import org.apache.atlas.typesystem.json.InstanceSerialization;
 import org.apache.atlas.typesystem.persistence.Id;
-import org.apache.atlas.typesystem.types.AttributeDefinition;
-import org.apache.atlas.typesystem.types.AttributeInfo;
-import org.apache.atlas.typesystem.types.ClassType;
-import org.apache.atlas.typesystem.types.DataTypes;
+import org.apache.atlas.typesystem.types.*;
 import org.apache.atlas.typesystem.types.DataTypes.TypeCategory;
-import org.apache.atlas.typesystem.types.EnumTypeDefinition;
-import org.apache.atlas.typesystem.types.EnumValue;
-import org.apache.atlas.typesystem.types.HierarchicalTypeDefinition;
-import org.apache.atlas.typesystem.types.IDataType;
-import org.apache.atlas.typesystem.types.Multiplicity;
-import org.apache.atlas.typesystem.types.StructTypeDefinition;
-import org.apache.atlas.typesystem.types.TraitType;
-import org.apache.atlas.typesystem.types.TypeSystem;
 import org.apache.atlas.typesystem.types.cache.DefaultTypeCache;
 import org.apache.atlas.typesystem.types.cache.TypeCache;
 import org.apache.atlas.typesystem.types.utils.TypesUtil;
@@ -88,9 +53,27 @@ import org.codehaus.jettison.json.JSONArray;
 import org.testng.Assert;
 import org.testng.SkipException;
 
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableSet;
-import com.google.inject.Provider;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import static org.apache.atlas.typesystem.types.utils.TypesUtil.*;
+import static org.testng.Assert.assertEquals;
 
 /**
  * Test utility class.

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1d67afc6/repository/src/test/java/org/apache/atlas/discovery/DataSetLineageServiceTest.java
----------------------------------------------------------------------
diff --git a/repository/src/test/java/org/apache/atlas/discovery/DataSetLineageServiceTest.java b/repository/src/test/java/org/apache/atlas/discovery/DataSetLineageServiceTest.java
index da2b442..fc38edf 100644
--- a/repository/src/test/java/org/apache/atlas/discovery/DataSetLineageServiceTest.java
+++ b/repository/src/test/java/org/apache/atlas/discovery/DataSetLineageServiceTest.java
@@ -22,7 +22,7 @@ import com.google.common.collect.ImmutableList;
 import org.apache.atlas.AtlasClient;
 import org.apache.atlas.AtlasException;
 import org.apache.atlas.BaseRepositoryTest;
-import org.apache.atlas.RepositoryMetadataModule;
+import org.apache.atlas.TestOnlyModule;
 import org.apache.atlas.query.QueryParams;
 import org.apache.atlas.typesystem.ITypedReferenceableInstance;
 import org.apache.atlas.typesystem.Referenceable;
@@ -55,7 +55,7 @@ import static org.testng.Assert.fail;
 /**
  * Unit tests for Hive LineageService.
  */
-@Guice(modules = RepositoryMetadataModule.class)
+@Guice(modules = TestOnlyModule.class)
 public class DataSetLineageServiceTest extends BaseRepositoryTest {
 
     @Inject

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1d67afc6/repository/src/test/java/org/apache/atlas/discovery/GraphBackedDiscoveryServiceTest.java
----------------------------------------------------------------------
diff --git a/repository/src/test/java/org/apache/atlas/discovery/GraphBackedDiscoveryServiceTest.java b/repository/src/test/java/org/apache/atlas/discovery/GraphBackedDiscoveryServiceTest.java
index f3fdf08..18573fc 100755
--- a/repository/src/test/java/org/apache/atlas/discovery/GraphBackedDiscoveryServiceTest.java
+++ b/repository/src/test/java/org/apache/atlas/discovery/GraphBackedDiscoveryServiceTest.java
@@ -18,30 +18,11 @@
 
 package org.apache.atlas.discovery;
 
-import static org.apache.atlas.typesystem.types.utils.TypesUtil.createClassTypeDef;
-import static org.apache.atlas.typesystem.types.utils.TypesUtil.createOptionalAttrDef;
-import static org.apache.atlas.typesystem.types.utils.TypesUtil.createRequiredAttrDef;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import javax.inject.Inject;
-
+import com.google.common.collect.ImmutableSet;
 import org.apache.atlas.AtlasException;
 import org.apache.atlas.BaseRepositoryTest;
-import org.apache.atlas.RepositoryMetadataModule;
 import org.apache.atlas.RequestContext;
+import org.apache.atlas.TestOnlyModule;
 import org.apache.atlas.TestUtils;
 import org.apache.atlas.discovery.graph.GraphBackedDiscoveryService;
 import org.apache.atlas.query.QueryParams;
@@ -64,7 +45,6 @@ import org.codehaus.jettison.json.JSONArray;
 import org.codehaus.jettison.json.JSONException;
 import org.codehaus.jettison.json.JSONObject;
 import org.testng.Assert;
-import org.testng.SkipException;
 import org.testng.annotations.AfterClass;
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.BeforeMethod;
@@ -72,9 +52,17 @@ import org.testng.annotations.DataProvider;
 import org.testng.annotations.Guice;
 import org.testng.annotations.Test;
 
-import com.google.common.collect.ImmutableSet;
+import javax.inject.Inject;
+import java.text.SimpleDateFormat;
+import java.util.*;
+
+import static org.apache.atlas.typesystem.types.utils.TypesUtil.createClassTypeDef;
+import static org.apache.atlas.typesystem.types.utils.TypesUtil.createOptionalAttrDef;
+import static org.apache.atlas.typesystem.types.utils.TypesUtil.createRequiredAttrDef;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
 
-@Guice(modules = RepositoryMetadataModule.class)
+@Guice(modules = TestOnlyModule.class)
 public class GraphBackedDiscoveryServiceTest extends BaseRepositoryTest {
 
     @Inject

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1d67afc6/repository/src/test/java/org/apache/atlas/lineage/EntityLineageServiceTest.java
----------------------------------------------------------------------
diff --git a/repository/src/test/java/org/apache/atlas/lineage/EntityLineageServiceTest.java b/repository/src/test/java/org/apache/atlas/lineage/EntityLineageServiceTest.java
index 6a1979a..0a4a445 100644
--- a/repository/src/test/java/org/apache/atlas/lineage/EntityLineageServiceTest.java
+++ b/repository/src/test/java/org/apache/atlas/lineage/EntityLineageServiceTest.java
@@ -18,22 +18,11 @@
 
 package org.apache.atlas.lineage;
 
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertTrue;
-import static org.testng.Assert.fail;
-
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import javax.inject.Inject;
-
+import com.google.common.collect.ImmutableList;
 import org.apache.atlas.AtlasClient;
 import org.apache.atlas.AtlasErrorCode;
 import org.apache.atlas.BaseRepositoryTest;
-import org.apache.atlas.RepositoryMetadataModule;
+import org.apache.atlas.TestOnlyModule;
 import org.apache.atlas.TestUtils;
 import org.apache.atlas.discovery.EntityLineageService;
 import org.apache.atlas.exception.AtlasBaseException;
@@ -49,17 +38,25 @@ import org.apache.commons.lang.RandomStringUtils;
 import org.testng.Assert;
 import org.testng.annotations.AfterClass;
 import org.testng.annotations.BeforeClass;
-import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.DataProvider;
 import org.testng.annotations.Guice;
 import org.testng.annotations.Test;
 
-import com.google.common.collect.ImmutableList;
+import javax.inject.Inject;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertTrue;
+import static org.testng.Assert.fail;
 
 /**
  * Unit tests for the new v2 Instance LineageService.
  */
-@Guice(modules = RepositoryMetadataModule.class)
+@Guice(modules = TestOnlyModule.class)
 public class EntityLineageServiceTest extends BaseRepositoryTest {
 
     @Inject

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1d67afc6/repository/src/test/java/org/apache/atlas/query/QueryProcessorTest.java
----------------------------------------------------------------------
diff --git a/repository/src/test/java/org/apache/atlas/query/QueryProcessorTest.java b/repository/src/test/java/org/apache/atlas/query/QueryProcessorTest.java
index 7f5ed94..57bc74f 100644
--- a/repository/src/test/java/org/apache/atlas/query/QueryProcessorTest.java
+++ b/repository/src/test/java/org/apache/atlas/query/QueryProcessorTest.java
@@ -17,12 +17,7 @@
  */
 package org.apache.atlas.query;
 
-import static org.apache.atlas.typesystem.types.utils.TypesUtil.createClassTypeDef;
-import static org.apache.atlas.typesystem.types.utils.TypesUtil.createRequiredAttrDef;
-
-import java.util.HashSet;
-import java.util.Set;
-
+import com.google.common.collect.ImmutableSet;
 import org.apache.atlas.AtlasException;
 import org.apache.atlas.typesystem.types.ClassType;
 import org.apache.atlas.typesystem.types.DataTypes;
@@ -32,14 +27,17 @@ import org.apache.atlas.typesystem.types.IDataType;
 import org.apache.atlas.typesystem.types.TypeSystem;
 import org.apache.atlas.typesystem.types.cache.DefaultTypeCache;
 import org.testng.annotations.Test;
-import static org.testng.Assert.assertTrue;
-import static org.testng.Assert.assertFalse;
-
-import com.google.common.collect.ImmutableSet;
-
 import scala.util.Either;
 import scala.util.parsing.combinator.Parsers;
 
+import java.util.HashSet;
+import java.util.Set;
+
+import static org.apache.atlas.typesystem.types.utils.TypesUtil.createClassTypeDef;
+import static org.apache.atlas.typesystem.types.utils.TypesUtil.createRequiredAttrDef;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
+
 /**
  * Tests the logic for skipping type cache lookup for things that
  * cannot be types.

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1d67afc6/repository/src/test/java/org/apache/atlas/repository/graph/AbstractGremlinQueryOptimizerTest.java
----------------------------------------------------------------------
diff --git a/repository/src/test/java/org/apache/atlas/repository/graph/AbstractGremlinQueryOptimizerTest.java b/repository/src/test/java/org/apache/atlas/repository/graph/AbstractGremlinQueryOptimizerTest.java
index 2dda853..59d2a3f 100644
--- a/repository/src/test/java/org/apache/atlas/repository/graph/AbstractGremlinQueryOptimizerTest.java
+++ b/repository/src/test/java/org/apache/atlas/repository/graph/AbstractGremlinQueryOptimizerTest.java
@@ -17,16 +17,6 @@
  */
 package org.apache.atlas.repository.graph;
 
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-
 import org.apache.atlas.AtlasException;
 import org.apache.atlas.gremlin.GremlinExpressionFactory;
 import org.apache.atlas.gremlin.optimizer.GremlinQueryOptimizer;
@@ -54,19 +44,31 @@ import org.apache.atlas.typesystem.types.TypeSystem;
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.Test;
 
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+
 
 public abstract class AbstractGremlinQueryOptimizerTest implements IAtlasGraphProvider {
 
     protected abstract GremlinExpressionFactory getFactory();
 
-    private MetadataRepository repo = new GraphBackedMetadataRepository(this, new HardDeleteHandler(TypeSystem.getInstance()));
+    private MetadataRepository repo;
     private final GraphPersistenceStrategies STRATEGY = mock(GraphPersistenceStrategies.class);
+
     @BeforeClass
     public void setUp() {
         GremlinQueryOptimizer.reset();
         GremlinQueryOptimizer.setExpressionFactory(getFactory());
         when(STRATEGY.typeAttributeName()).thenReturn(Constants.ENTITY_TYPE_PROPERTY_KEY);
         when(STRATEGY.superTypeAttributeName()).thenReturn(Constants.SUPER_TYPES_PROPERTY_KEY);
+        repo = new GraphBackedMetadataRepository(this, new HardDeleteHandler(TypeSystem.getInstance()));
     }
 
     private FieldInfo getTestFieldInfo() throws AtlasException {
@@ -695,6 +697,7 @@ public abstract class AbstractGremlinQueryOptimizerTest implements IAtlasGraphPr
 
 
     protected abstract String getExpectedGremlinForTestRangeWithOrderBy();
+
     @Override
     public AtlasGraph get() throws RepositoryException {
         AtlasGraph graph = mock(AtlasGraph.class);

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1d67afc6/repository/src/test/java/org/apache/atlas/repository/graph/GraphBackedMetadataRepositoryDeleteTestBase.java
----------------------------------------------------------------------
diff --git a/repository/src/test/java/org/apache/atlas/repository/graph/GraphBackedMetadataRepositoryDeleteTestBase.java b/repository/src/test/java/org/apache/atlas/repository/graph/GraphBackedMetadataRepositoryDeleteTestBase.java
index f0424ab..4fd416c 100644
--- a/repository/src/test/java/org/apache/atlas/repository/graph/GraphBackedMetadataRepositoryDeleteTestBase.java
+++ b/repository/src/test/java/org/apache/atlas/repository/graph/GraphBackedMetadataRepositoryDeleteTestBase.java
@@ -20,15 +20,14 @@ package org.apache.atlas.repository.graph;
 
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableSet;
-
 import org.apache.atlas.AtlasClient;
 import org.apache.atlas.AtlasClient.EntityResult;
 import org.apache.atlas.AtlasException;
-import org.apache.atlas.RepositoryMetadataModule;
+import org.apache.atlas.CreateUpdateEntitiesResult;
 import org.apache.atlas.RequestContext;
+import org.apache.atlas.TestOnlyModule;
 import org.apache.atlas.TestUtils;
 import org.apache.atlas.repository.Constants;
-import org.apache.atlas.CreateUpdateEntitiesResult;
 import org.apache.atlas.repository.MetadataRepository;
 import org.apache.atlas.repository.RepositoryException;
 import org.apache.atlas.repository.graphdb.AtlasGraph;
@@ -45,16 +44,7 @@ import org.apache.atlas.typesystem.exception.EntityExistsException;
 import org.apache.atlas.typesystem.exception.EntityNotFoundException;
 import org.apache.atlas.typesystem.exception.NullRequiredAttributeException;
 import org.apache.atlas.typesystem.persistence.Id;
-import org.apache.atlas.typesystem.types.AttributeDefinition;
-import org.apache.atlas.typesystem.types.ClassType;
-import org.apache.atlas.typesystem.types.DataTypes;
-import org.apache.atlas.typesystem.types.EnumTypeDefinition;
-import org.apache.atlas.typesystem.types.HierarchicalTypeDefinition;
-import org.apache.atlas.typesystem.types.IDataType;
-import org.apache.atlas.typesystem.types.Multiplicity;
-import org.apache.atlas.typesystem.types.StructTypeDefinition;
-import org.apache.atlas.typesystem.types.TraitType;
-import org.apache.atlas.typesystem.types.TypeSystem;
+import org.apache.atlas.typesystem.types.*;
 import org.apache.atlas.typesystem.types.utils.TypesUtil;
 import org.testng.Assert;
 import org.testng.annotations.AfterClass;
@@ -70,15 +60,7 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
-import static org.apache.atlas.TestUtils.COLUMNS_ATTR_NAME;
-import static org.apache.atlas.TestUtils.COLUMN_TYPE;
-import static org.apache.atlas.TestUtils.NAME;
-import static org.apache.atlas.TestUtils.PII;
-import static org.apache.atlas.TestUtils.PROCESS_TYPE;
-import static org.apache.atlas.TestUtils.TABLE_TYPE;
-import static org.apache.atlas.TestUtils.createColumnEntity;
-import static org.apache.atlas.TestUtils.createDBEntity;
-import static org.apache.atlas.TestUtils.createTableEntity;
+import static org.apache.atlas.TestUtils.*;
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertNotEquals;
 import static org.testng.Assert.assertTrue;
@@ -90,7 +72,7 @@ import static org.testng.Assert.fail;
  * Guice loads the dependencies and injects the necessary objects
  *
  */
-@Guice(modules = RepositoryMetadataModule.class)
+@Guice(modules = TestOnlyModule.class)
 public abstract class GraphBackedMetadataRepositoryDeleteTestBase {
 
     protected MetadataRepository repositoryService;

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1d67afc6/repository/src/test/java/org/apache/atlas/repository/graph/GraphBackedMetadataRepositoryTest.java
----------------------------------------------------------------------
diff --git a/repository/src/test/java/org/apache/atlas/repository/graph/GraphBackedMetadataRepositoryTest.java b/repository/src/test/java/org/apache/atlas/repository/graph/GraphBackedMetadataRepositoryTest.java
index 9f32b85..9f44c31 100755
--- a/repository/src/test/java/org/apache/atlas/repository/graph/GraphBackedMetadataRepositoryTest.java
+++ b/repository/src/test/java/org/apache/atlas/repository/graph/GraphBackedMetadataRepositoryTest.java
@@ -18,32 +18,13 @@
 
 package org.apache.atlas.repository.graph;
 
-import static org.apache.atlas.typesystem.types.utils.TypesUtil.createClassTypeDef;
-import static org.apache.atlas.typesystem.types.utils.TypesUtil.createUniqueRequiredAttrDef;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotEquals;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertTrue;
-
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
-import java.util.concurrent.Callable;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.Future;
-
-import javax.inject.Inject;
-
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableSet;
 import org.apache.atlas.AtlasException;
 import org.apache.atlas.CreateUpdateEntitiesResult;
 import org.apache.atlas.GraphTransaction;
-import org.apache.atlas.RepositoryMetadataModule;
 import org.apache.atlas.RequestContext;
+import org.apache.atlas.TestOnlyModule;
 import org.apache.atlas.TestUtils;
 import org.apache.atlas.discovery.graph.GraphBackedDiscoveryService;
 import org.apache.atlas.query.QueryParams;
@@ -84,10 +65,26 @@ import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Guice;
 import org.testng.annotations.Test;
 
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableSet;
-
+import javax.inject.Inject;
+import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+
+import static org.apache.atlas.typesystem.types.utils.TypesUtil.createClassTypeDef;
+import static org.apache.atlas.typesystem.types.utils.TypesUtil.createUniqueRequiredAttrDef;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotEquals;
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertTrue;
 
 /**
  * GraphBackedMetadataRepository test
@@ -95,7 +92,7 @@ import java.util.Arrays;
  * Guice loads the dependencies and injects the necessary objects
  *
  */
-@Guice(modules = RepositoryMetadataModule.class)
+@Guice(modules = TestOnlyModule.class)
 public class GraphBackedMetadataRepositoryTest {
 
     @Inject

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1d67afc6/repository/src/test/java/org/apache/atlas/repository/graph/GraphBackedRepositoryHardDeleteTest.java
----------------------------------------------------------------------
diff --git a/repository/src/test/java/org/apache/atlas/repository/graph/GraphBackedRepositoryHardDeleteTest.java b/repository/src/test/java/org/apache/atlas/repository/graph/GraphBackedRepositoryHardDeleteTest.java
index 174b8cb..9c0ef43 100644
--- a/repository/src/test/java/org/apache/atlas/repository/graph/GraphBackedRepositoryHardDeleteTest.java
+++ b/repository/src/test/java/org/apache/atlas/repository/graph/GraphBackedRepositoryHardDeleteTest.java
@@ -18,12 +18,11 @@
 
 package org.apache.atlas.repository.graph;
 
-import org.apache.atlas.repository.graphdb.AtlasVertex;
-
 import org.apache.atlas.AtlasClient;
 import org.apache.atlas.AtlasException;
 import org.apache.atlas.TestUtils;
 import org.apache.atlas.repository.Constants;
+import org.apache.atlas.repository.graphdb.AtlasVertex;
 import org.apache.atlas.typesystem.IReferenceableInstance;
 import org.apache.atlas.typesystem.IStruct;
 import org.apache.atlas.typesystem.ITypedReferenceableInstance;

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1d67afc6/repository/src/test/java/org/apache/atlas/repository/graph/GraphBackedRepositorySoftDeleteTest.java
----------------------------------------------------------------------
diff --git a/repository/src/test/java/org/apache/atlas/repository/graph/GraphBackedRepositorySoftDeleteTest.java b/repository/src/test/java/org/apache/atlas/repository/graph/GraphBackedRepositorySoftDeleteTest.java
index 5ac7c8f..8c86235 100644
--- a/repository/src/test/java/org/apache/atlas/repository/graph/GraphBackedRepositorySoftDeleteTest.java
+++ b/repository/src/test/java/org/apache/atlas/repository/graph/GraphBackedRepositorySoftDeleteTest.java
@@ -18,12 +18,11 @@
 
 package org.apache.atlas.repository.graph;
 
-import org.apache.atlas.repository.graphdb.AtlasVertex;
-
 import org.apache.atlas.AtlasClient;
 import org.apache.atlas.AtlasException;
 import org.apache.atlas.TestUtils;
 import org.apache.atlas.repository.Constants;
+import org.apache.atlas.repository.graphdb.AtlasVertex;
 import org.apache.atlas.typesystem.IReferenceableInstance;
 import org.apache.atlas.typesystem.IStruct;
 import org.apache.atlas.typesystem.ITypedReferenceableInstance;

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1d67afc6/repository/src/test/java/org/apache/atlas/repository/graph/GraphBackedSearchIndexerTest.java
----------------------------------------------------------------------
diff --git a/repository/src/test/java/org/apache/atlas/repository/graph/GraphBackedSearchIndexerTest.java b/repository/src/test/java/org/apache/atlas/repository/graph/GraphBackedSearchIndexerTest.java
index 1716ac5..a254d0a 100644
--- a/repository/src/test/java/org/apache/atlas/repository/graph/GraphBackedSearchIndexerTest.java
+++ b/repository/src/test/java/org/apache/atlas/repository/graph/GraphBackedSearchIndexerTest.java
@@ -18,16 +18,9 @@
 
 package org.apache.atlas.repository.graph;
 
-import static junit.framework.Assert.assertTrue;
-import static org.apache.atlas.typesystem.types.utils.TypesUtil.createClassTypeDef;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertNotNull;
-
-import java.util.Arrays;
-import java.util.Set;
-
+import com.google.inject.Inject;
 import org.apache.atlas.AtlasException;
-import org.apache.atlas.RepositoryMetadataModule;
+import org.apache.atlas.TestOnlyModule;
 import org.apache.atlas.TestUtils;
 import org.apache.atlas.repository.Constants;
 import org.apache.atlas.repository.graphdb.AtlasGraph;
@@ -45,12 +38,16 @@ import org.apache.commons.lang.RandomStringUtils;
 import org.testng.annotations.Guice;
 import org.testng.annotations.Test;
 
-import com.google.inject.Inject;
+import java.util.Arrays;
+import java.util.Set;
 
-@Guice(modules = RepositoryMetadataModule.class)
-public class GraphBackedSearchIndexerTest {
+import static junit.framework.Assert.assertTrue;
+import static org.apache.atlas.typesystem.types.utils.TypesUtil.createClassTypeDef;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertNotNull;
 
- 
+@Guice(modules = TestOnlyModule.class)
+public class GraphBackedSearchIndexerTest {
     @Inject
     private GraphBackedSearchIndexer graphBackedSearchIndexer;
 

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1d67afc6/repository/src/test/java/org/apache/atlas/repository/graph/GraphHelperMockTest.java
----------------------------------------------------------------------
diff --git a/repository/src/test/java/org/apache/atlas/repository/graph/GraphHelperMockTest.java b/repository/src/test/java/org/apache/atlas/repository/graph/GraphHelperMockTest.java
index 8f8aadc..a0894cd 100644
--- a/repository/src/test/java/org/apache/atlas/repository/graph/GraphHelperMockTest.java
+++ b/repository/src/test/java/org/apache/atlas/repository/graph/GraphHelperMockTest.java
@@ -17,12 +17,6 @@
  */
 package org.apache.atlas.repository.graph;
 
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-import static org.testng.Assert.assertEquals;
-
-import java.util.Iterator;
-
 import org.apache.atlas.repository.RepositoryException;
 import org.apache.atlas.repository.graphdb.AtlasEdge;
 import org.apache.atlas.repository.graphdb.AtlasEdgeDirection;
@@ -32,6 +26,12 @@ import org.mockito.MockitoAnnotations;
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.Test;
 
+import java.util.Iterator;
+
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+import static org.testng.Assert.assertEquals;
+
 public class GraphHelperMockTest {
 
     private GraphHelper graphHelperInstance;

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1d67afc6/repository/src/test/java/org/apache/atlas/repository/graph/GraphHelperTest.java
----------------------------------------------------------------------
diff --git a/repository/src/test/java/org/apache/atlas/repository/graph/GraphHelperTest.java b/repository/src/test/java/org/apache/atlas/repository/graph/GraphHelperTest.java
index 3831920..4061543 100644
--- a/repository/src/test/java/org/apache/atlas/repository/graph/GraphHelperTest.java
+++ b/repository/src/test/java/org/apache/atlas/repository/graph/GraphHelperTest.java
@@ -18,25 +18,8 @@
 
 package org.apache.atlas.repository.graph;
 
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertNull;
-import static org.testng.Assert.assertTrue;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import javax.inject.Inject;
-
 import org.apache.atlas.AtlasException;
-import org.apache.atlas.RepositoryMetadataModule;
+import org.apache.atlas.TestOnlyModule;
 import org.apache.atlas.TestUtils;
 import org.apache.atlas.repository.graph.GraphHelper.VertexInfo;
 import org.apache.atlas.repository.graphdb.AtlasEdge;
@@ -61,7 +44,19 @@ import org.testng.annotations.DataProvider;
 import org.testng.annotations.Guice;
 import org.testng.annotations.Test;
 
-@Guice(modules = RepositoryMetadataModule.class)
+import javax.inject.Inject;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import static org.testng.Assert.*;
+
+@Guice(modules = TestOnlyModule.class)
 public class GraphHelperTest {
 
 

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1d67afc6/repository/src/test/java/org/apache/atlas/repository/graph/GraphRepoMapperScaleTest.java
----------------------------------------------------------------------
diff --git a/repository/src/test/java/org/apache/atlas/repository/graph/GraphRepoMapperScaleTest.java b/repository/src/test/java/org/apache/atlas/repository/graph/GraphRepoMapperScaleTest.java
index a2fffe7..21926dc 100755
--- a/repository/src/test/java/org/apache/atlas/repository/graph/GraphRepoMapperScaleTest.java
+++ b/repository/src/test/java/org/apache/atlas/repository/graph/GraphRepoMapperScaleTest.java
@@ -21,7 +21,7 @@ package org.apache.atlas.repository.graph;
 import org.apache.atlas.ApplicationProperties;
 import org.apache.atlas.CreateUpdateEntitiesResult;
 import org.apache.atlas.GraphTransaction;
-import org.apache.atlas.RepositoryMetadataModule;
+import org.apache.atlas.TestOnlyModule;
 import org.apache.atlas.TestUtils;
 import org.apache.atlas.repository.Constants;
 import org.apache.atlas.repository.RepositoryException;
@@ -47,15 +47,14 @@ import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Guice;
 import org.testng.annotations.Test;
 
+import javax.inject.Inject;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Date;
 import java.util.Iterator;
 
-import javax.inject.Inject;
-
 @Test
-@Guice(modules = RepositoryMetadataModule.class)
+@Guice(modules = TestOnlyModule.class)
 public class GraphRepoMapperScaleTest {
 
     private static final String DATABASE_NAME = "foo";

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1d67afc6/repository/src/test/java/org/apache/atlas/repository/graph/Gremlin2QueryOptimizerTest.java
----------------------------------------------------------------------
diff --git a/repository/src/test/java/org/apache/atlas/repository/graph/Gremlin2QueryOptimizerTest.java b/repository/src/test/java/org/apache/atlas/repository/graph/Gremlin2QueryOptimizerTest.java
index b857255..8f638a0 100644
--- a/repository/src/test/java/org/apache/atlas/repository/graph/Gremlin2QueryOptimizerTest.java
+++ b/repository/src/test/java/org/apache/atlas/repository/graph/Gremlin2QueryOptimizerTest.java
@@ -24,12 +24,13 @@ import org.testng.annotations.Test;
 
 @Test
 public class Gremlin2QueryOptimizerTest extends AbstractGremlinQueryOptimizerTest {
-
-
-    private static final GremlinExpressionFactory FACTORY = new Gremlin2ExpressionFactory();
+    private static GremlinExpressionFactory FACTORY = null;
 
     @Override
     protected GremlinExpressionFactory getFactory() {
+        if (null == FACTORY) {
+            FACTORY = new Gremlin2ExpressionFactory();
+        }
         return FACTORY;
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1d67afc6/repository/src/test/java/org/apache/atlas/repository/graph/Gremlin3QueryOptimizerTest.java
----------------------------------------------------------------------
diff --git a/repository/src/test/java/org/apache/atlas/repository/graph/Gremlin3QueryOptimizerTest.java b/repository/src/test/java/org/apache/atlas/repository/graph/Gremlin3QueryOptimizerTest.java
index 4045a4f..47dff14 100644
--- a/repository/src/test/java/org/apache/atlas/repository/graph/Gremlin3QueryOptimizerTest.java
+++ b/repository/src/test/java/org/apache/atlas/repository/graph/Gremlin3QueryOptimizerTest.java
@@ -25,10 +25,13 @@ import org.testng.annotations.Test;
 @Test
 public class Gremlin3QueryOptimizerTest extends AbstractGremlinQueryOptimizerTest {
 
-    public static final GremlinExpressionFactory FACTORY = new Gremlin3ExpressionFactory();
+    public static GremlinExpressionFactory FACTORY = null;
 
     @Override
     protected GremlinExpressionFactory getFactory() {
+        if (null == FACTORY) {
+            FACTORY = new Gremlin3ExpressionFactory();
+        }
         return FACTORY;
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1d67afc6/repository/src/test/java/org/apache/atlas/repository/graph/ReverseReferenceUpdateHardDeleteTest.java
----------------------------------------------------------------------
diff --git a/repository/src/test/java/org/apache/atlas/repository/graph/ReverseReferenceUpdateHardDeleteTest.java b/repository/src/test/java/org/apache/atlas/repository/graph/ReverseReferenceUpdateHardDeleteTest.java
index 808305c..9778c63 100644
--- a/repository/src/test/java/org/apache/atlas/repository/graph/ReverseReferenceUpdateHardDeleteTest.java
+++ b/repository/src/test/java/org/apache/atlas/repository/graph/ReverseReferenceUpdateHardDeleteTest.java
@@ -17,12 +17,12 @@
  */
 package org.apache.atlas.repository.graph;
 
-import java.util.List;
-
 import org.apache.atlas.typesystem.ITypedReferenceableInstance;
 import org.apache.atlas.typesystem.types.TypeSystem;
 import org.testng.Assert;
 
+import java.util.List;
+
 
 /**
  * Run tests in {@link ReverseReferenceUpdateTestBase} with hard delete enabled.

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1d67afc6/repository/src/test/java/org/apache/atlas/repository/graph/ReverseReferenceUpdateSoftDeleteTest.java
----------------------------------------------------------------------
diff --git a/repository/src/test/java/org/apache/atlas/repository/graph/ReverseReferenceUpdateSoftDeleteTest.java b/repository/src/test/java/org/apache/atlas/repository/graph/ReverseReferenceUpdateSoftDeleteTest.java
index 6e20ddd..100ccfb 100644
--- a/repository/src/test/java/org/apache/atlas/repository/graph/ReverseReferenceUpdateSoftDeleteTest.java
+++ b/repository/src/test/java/org/apache/atlas/repository/graph/ReverseReferenceUpdateSoftDeleteTest.java
@@ -17,9 +17,6 @@
  */
 package org.apache.atlas.repository.graph;
 
-import java.util.Iterator;
-import java.util.List;
-
 import org.apache.atlas.repository.Constants;
 import org.apache.atlas.repository.graphdb.AtlasEdge;
 import org.apache.atlas.repository.graphdb.AtlasVertex;
@@ -28,6 +25,9 @@ import org.apache.atlas.typesystem.persistence.Id;
 import org.apache.atlas.typesystem.types.TypeSystem;
 import org.testng.Assert;
 
+import java.util.Iterator;
+import java.util.List;
+
 
 /**
  * Run tests in {@link ReverseReferenceUpdateTestBase} with soft delete enabled.

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1d67afc6/repository/src/test/java/org/apache/atlas/repository/graph/ReverseReferenceUpdateTestBase.java
----------------------------------------------------------------------
diff --git a/repository/src/test/java/org/apache/atlas/repository/graph/ReverseReferenceUpdateTestBase.java b/repository/src/test/java/org/apache/atlas/repository/graph/ReverseReferenceUpdateTestBase.java
index b87f7fd..c08fbc9 100644
--- a/repository/src/test/java/org/apache/atlas/repository/graph/ReverseReferenceUpdateTestBase.java
+++ b/repository/src/test/java/org/apache/atlas/repository/graph/ReverseReferenceUpdateTestBase.java
@@ -17,13 +17,11 @@
  */
 package org.apache.atlas.repository.graph;
 
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableSet;
+import com.google.inject.Inject;
 import org.apache.atlas.CreateUpdateEntitiesResult;
-import org.apache.atlas.RepositoryMetadataModule;
+import org.apache.atlas.TestOnlyModule;
 import org.apache.atlas.TestUtils;
 import org.apache.atlas.repository.MetadataRepository;
 import org.apache.atlas.type.AtlasTypeRegistry;
@@ -45,15 +43,16 @@ import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Guice;
 import org.testng.annotations.Test;
 
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableSet;
-import com.google.inject.Inject;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
 
 /**
  * Verifies automatic update of reverse references
  *
  */
-@Guice(modules = RepositoryMetadataModule.class)
+@Guice(modules = TestOnlyModule.class)
 public abstract class ReverseReferenceUpdateTestBase {
 
     @Inject

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1d67afc6/repository/src/test/java/org/apache/atlas/repository/impexp/ExportServiceTest.java
----------------------------------------------------------------------
diff --git a/repository/src/test/java/org/apache/atlas/repository/impexp/ExportServiceTest.java b/repository/src/test/java/org/apache/atlas/repository/impexp/ExportServiceTest.java
index a7fc24c..cd355c3 100644
--- a/repository/src/test/java/org/apache/atlas/repository/impexp/ExportServiceTest.java
+++ b/repository/src/test/java/org/apache/atlas/repository/impexp/ExportServiceTest.java
@@ -19,7 +19,7 @@ package org.apache.atlas.repository.impexp;
 
 
 import com.google.inject.Inject;
-import org.apache.atlas.RepositoryMetadataModule;
+import org.apache.atlas.TestOnlyModule;
 import org.apache.atlas.TestUtilsV2;
 import org.apache.atlas.exception.AtlasBaseException;
 import org.apache.atlas.model.impexp.AtlasExportRequest;
@@ -35,10 +35,10 @@ import org.apache.atlas.repository.store.graph.v1.DeleteHandlerV1;
 import org.apache.atlas.repository.store.graph.v1.SoftDeleteHandlerV1;
 import org.apache.atlas.store.AtlasTypeDefStore;
 import org.apache.atlas.type.AtlasTypeRegistry;
-import org.testng.Assert;
-import org.powermock.reflect.Whitebox;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.testng.Assert;
+import org.powermock.reflect.Whitebox;
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.BeforeTest;
 import org.testng.annotations.Guice;
@@ -57,7 +57,7 @@ import java.util.Map;
 import static org.testng.Assert.*;
 import static org.mockito.Mockito.mock;
 
-@Guice(modules = RepositoryMetadataModule.class)
+@Guice(modules = TestOnlyModule.class)
 public class ExportServiceTest {
     private static final Logger LOG = LoggerFactory.getLogger(ExportServiceTest.class);
 

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1d67afc6/repository/src/test/java/org/apache/atlas/repository/impexp/ImportServiceReportingTest.java
----------------------------------------------------------------------
diff --git a/repository/src/test/java/org/apache/atlas/repository/impexp/ImportServiceReportingTest.java b/repository/src/test/java/org/apache/atlas/repository/impexp/ImportServiceReportingTest.java
index 411299e..f9a0584 100644
--- a/repository/src/test/java/org/apache/atlas/repository/impexp/ImportServiceReportingTest.java
+++ b/repository/src/test/java/org/apache/atlas/repository/impexp/ImportServiceReportingTest.java
@@ -18,24 +18,15 @@
 package org.apache.atlas.repository.impexp;
 
 import com.google.inject.Inject;
-import org.apache.atlas.RepositoryMetadataModule;
-import org.apache.atlas.exception.AtlasBaseException;
+import org.apache.atlas.TestOnlyModule;
 import org.apache.atlas.repository.store.graph.AtlasEntityStore;
 import org.apache.atlas.store.AtlasTypeDefStore;
 import org.apache.atlas.type.AtlasTypeRegistry;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.testng.annotations.DataProvider;
 import org.testng.annotations.Guice;
-import org.testng.annotations.Test;
 
-import java.io.IOException;
-
-import static org.apache.atlas.repository.impexp.ZipFileResourceTestUtils.getZipSource;
-import static org.apache.atlas.repository.impexp.ZipFileResourceTestUtils.loadModelFromJson;
-import static org.apache.atlas.repository.impexp.ZipFileResourceTestUtils.runAndVerifyQuickStart_v1_Import;
-
-@Guice(modules = RepositoryMetadataModule.class)
+@Guice(modules = TestOnlyModule.class)
 public class ImportServiceReportingTest {
     private static final Logger LOG = LoggerFactory.getLogger(ImportServiceReportingTest.class);
 

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1d67afc6/repository/src/test/java/org/apache/atlas/repository/impexp/ImportServiceTest.java
----------------------------------------------------------------------
diff --git a/repository/src/test/java/org/apache/atlas/repository/impexp/ImportServiceTest.java b/repository/src/test/java/org/apache/atlas/repository/impexp/ImportServiceTest.java
index 131a6e1..91966f8 100644
--- a/repository/src/test/java/org/apache/atlas/repository/impexp/ImportServiceTest.java
+++ b/repository/src/test/java/org/apache/atlas/repository/impexp/ImportServiceTest.java
@@ -18,7 +18,7 @@
 package org.apache.atlas.repository.impexp;
 
 import com.google.inject.Inject;
-import org.apache.atlas.RepositoryMetadataModule;
+import org.apache.atlas.TestOnlyModule;
 import org.apache.atlas.exception.AtlasBaseException;
 import org.apache.atlas.repository.store.graph.AtlasEntityStore;
 import org.apache.atlas.store.AtlasTypeDefStore;
@@ -36,7 +36,7 @@ import static org.apache.atlas.repository.impexp.ZipFileResourceTestUtils.getZip
 import static org.apache.atlas.repository.impexp.ZipFileResourceTestUtils.loadModelFromJson;
 import static org.apache.atlas.repository.impexp.ZipFileResourceTestUtils.runAndVerifyQuickStart_v1_Import;
 
-@Guice(modules = RepositoryMetadataModule.class)
+@Guice(modules = TestOnlyModule.class)
 public class ImportServiceTest {
     private static final Logger LOG = LoggerFactory.getLogger(ImportServiceTest.class);
 

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1d67afc6/repository/src/test/java/org/apache/atlas/repository/store/graph/AtlasTypeDefGraphStoreTest.java
----------------------------------------------------------------------
diff --git a/repository/src/test/java/org/apache/atlas/repository/store/graph/AtlasTypeDefGraphStoreTest.java b/repository/src/test/java/org/apache/atlas/repository/store/graph/AtlasTypeDefGraphStoreTest.java
index 84ad72c..99df272 100644
--- a/repository/src/test/java/org/apache/atlas/repository/store/graph/AtlasTypeDefGraphStoreTest.java
+++ b/repository/src/test/java/org/apache/atlas/repository/store/graph/AtlasTypeDefGraphStoreTest.java
@@ -18,8 +18,7 @@
 package org.apache.atlas.repository.store.graph;
 
 import com.google.inject.Inject;
-
-import org.apache.atlas.RepositoryMetadataModule;
+import org.apache.atlas.TestOnlyModule;
 import org.apache.atlas.TestUtilsV2;
 import org.apache.atlas.exception.AtlasBaseException;
 import org.apache.atlas.model.SearchFilter;
@@ -38,18 +37,12 @@ import org.testng.annotations.DataProvider;
 import org.testng.annotations.Guice;
 import org.testng.annotations.Test;
 
-import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
 
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotEquals;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertNull;
-import static org.testng.Assert.assertTrue;
-import static org.testng.Assert.fail;
+import static org.testng.Assert.*;
 
-@Guice(modules = RepositoryMetadataModule.class)
+@Guice(modules = TestOnlyModule.class)
 public class AtlasTypeDefGraphStoreTest {
     private static final Logger LOG = LoggerFactory.getLogger(AtlasTypeDefGraphStoreTest.class);
 

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1d67afc6/repository/src/test/java/org/apache/atlas/repository/store/graph/v1/AtlasDeleteHandlerV1Test.java
----------------------------------------------------------------------
diff --git a/repository/src/test/java/org/apache/atlas/repository/store/graph/v1/AtlasDeleteHandlerV1Test.java b/repository/src/test/java/org/apache/atlas/repository/store/graph/v1/AtlasDeleteHandlerV1Test.java
index f1c4e48..9a11e08 100644
--- a/repository/src/test/java/org/apache/atlas/repository/store/graph/v1/AtlasDeleteHandlerV1Test.java
+++ b/repository/src/test/java/org/apache/atlas/repository/store/graph/v1/AtlasDeleteHandlerV1Test.java
@@ -20,9 +20,8 @@ package org.apache.atlas.repository.store.graph.v1;
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableSet;
 import org.apache.atlas.AtlasException;
-import org.apache.atlas.RepositoryMetadataModule;
-import org.apache.atlas.RequestContext;
 import org.apache.atlas.RequestContextV1;
+import org.apache.atlas.TestOnlyModule;
 import org.apache.atlas.TestUtils;
 import org.apache.atlas.TestUtilsV2;
 import org.apache.atlas.exception.AtlasBaseException;
@@ -38,7 +37,6 @@ import org.apache.atlas.model.typedef.AtlasEnumDef;
 import org.apache.atlas.model.typedef.AtlasStructDef;
 import org.apache.atlas.model.typedef.AtlasTypesDef;
 import org.apache.atlas.repository.Constants;
-import org.apache.atlas.repository.RepositoryException;
 import org.apache.atlas.repository.graph.AtlasEdgeLabel;
 import org.apache.atlas.repository.graph.AtlasGraphProvider;
 import org.apache.atlas.repository.graph.GraphBackedSearchIndexer;
@@ -69,7 +67,6 @@ import org.testng.annotations.Guice;
 import org.testng.annotations.Test;
 
 import javax.inject.Inject;
-
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
@@ -77,18 +74,14 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
-import static org.apache.atlas.TestUtils.COLUMNS_ATTR_NAME;
-import static org.apache.atlas.TestUtils.COLUMN_TYPE;
-import static org.apache.atlas.TestUtils.DEPARTMENT_TYPE;
-import static org.apache.atlas.TestUtils.NAME;
-import static org.apache.atlas.TestUtils.TABLE_TYPE;
+import static org.apache.atlas.TestUtils.*;
 import static org.mockito.Mockito.mock;
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertNotEquals;
 import static org.testng.Assert.assertTrue;
 import static org.testng.Assert.fail;
 
-@Guice(modules = RepositoryMetadataModule.class)
+@Guice(modules = TestOnlyModule.class)
 public abstract class AtlasDeleteHandlerV1Test {
 
     @Inject

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1d67afc6/repository/src/test/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityStoreV1Test.java
----------------------------------------------------------------------
diff --git a/repository/src/test/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityStoreV1Test.java b/repository/src/test/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityStoreV1Test.java
index acb8075..d83b2b9 100644
--- a/repository/src/test/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityStoreV1Test.java
+++ b/repository/src/test/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityStoreV1Test.java
@@ -20,8 +20,8 @@ package org.apache.atlas.repository.store.graph.v1;
 import com.google.common.collect.ImmutableSet;
 import org.apache.atlas.AtlasErrorCode;
 import org.apache.atlas.AtlasException;
-import org.apache.atlas.RepositoryMetadataModule;
 import org.apache.atlas.RequestContextV1;
+import org.apache.atlas.TestOnlyModule;
 import org.apache.atlas.TestUtils;
 import org.apache.atlas.TestUtilsV2;
 import org.apache.atlas.exception.AtlasBaseException;
@@ -77,7 +77,7 @@ import static org.mockito.Mockito.mock;
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertTrue;
 
-@Guice(modules = RepositoryMetadataModule.class)
+@Guice(modules = TestOnlyModule.class)
 public class AtlasEntityStoreV1Test {
     private static final Logger LOG = LoggerFactory.getLogger(AtlasEntityStoreV1Test.class);
 

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1d67afc6/repository/src/test/java/org/apache/atlas/repository/store/graph/v1/InverseReferenceUpdateHardDeleteV1Test.java
----------------------------------------------------------------------
diff --git a/repository/src/test/java/org/apache/atlas/repository/store/graph/v1/InverseReferenceUpdateHardDeleteV1Test.java b/repository/src/test/java/org/apache/atlas/repository/store/graph/v1/InverseReferenceUpdateHardDeleteV1Test.java
index 8b5eaff..6a23807 100644
--- a/repository/src/test/java/org/apache/atlas/repository/store/graph/v1/InverseReferenceUpdateHardDeleteV1Test.java
+++ b/repository/src/test/java/org/apache/atlas/repository/store/graph/v1/InverseReferenceUpdateHardDeleteV1Test.java
@@ -17,17 +17,16 @@
  */
 package org.apache.atlas.repository.store.graph.v1;
 
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertTrue;
-
-import java.util.Map;
-
+import com.google.common.collect.ImmutableList;
 import org.apache.atlas.model.instance.AtlasEntity;
 import org.apache.atlas.model.instance.AtlasObjectId;
 import org.apache.atlas.type.AtlasTypeRegistry;
 import org.apache.atlas.type.AtlasTypeUtil;
 
-import com.google.common.collect.ImmutableList;
+import java.util.Map;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertTrue;
 
 /**
  * Inverse reference update test with {@link HardDeleteHandlerV1}

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1d67afc6/repository/src/test/java/org/apache/atlas/repository/store/graph/v1/InverseReferenceUpdateSoftDeleteV1Test.java
----------------------------------------------------------------------
diff --git a/repository/src/test/java/org/apache/atlas/repository/store/graph/v1/InverseReferenceUpdateSoftDeleteV1Test.java b/repository/src/test/java/org/apache/atlas/repository/store/graph/v1/InverseReferenceUpdateSoftDeleteV1Test.java
index 0b3c5db..ae6731c 100644
--- a/repository/src/test/java/org/apache/atlas/repository/store/graph/v1/InverseReferenceUpdateSoftDeleteV1Test.java
+++ b/repository/src/test/java/org/apache/atlas/repository/store/graph/v1/InverseReferenceUpdateSoftDeleteV1Test.java
@@ -17,17 +17,16 @@
  */
 package org.apache.atlas.repository.store.graph.v1;
 
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertTrue;
-
-import java.util.Map;
-
+import com.google.common.collect.ImmutableList;
 import org.apache.atlas.model.instance.AtlasEntity;
 import org.apache.atlas.model.instance.AtlasObjectId;
 import org.apache.atlas.type.AtlasTypeRegistry;
 import org.apache.atlas.type.AtlasTypeUtil;
 
-import com.google.common.collect.ImmutableList;
+import java.util.Map;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertTrue;
 
 
 /**

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1d67afc6/repository/src/test/java/org/apache/atlas/repository/store/graph/v1/InverseReferenceUpdateV1Test.java
----------------------------------------------------------------------
diff --git a/repository/src/test/java/org/apache/atlas/repository/store/graph/v1/InverseReferenceUpdateV1Test.java b/repository/src/test/java/org/apache/atlas/repository/store/graph/v1/InverseReferenceUpdateV1Test.java
index da12a77..c90f716 100644
--- a/repository/src/test/java/org/apache/atlas/repository/store/graph/v1/InverseReferenceUpdateV1Test.java
+++ b/repository/src/test/java/org/apache/atlas/repository/store/graph/v1/InverseReferenceUpdateV1Test.java
@@ -17,21 +17,10 @@
  */
 package org.apache.atlas.repository.store.graph.v1;
 
-import static org.apache.atlas.TestUtils.NAME;
-import static org.mockito.Mockito.mock;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNull;
-import static org.testng.Assert.assertTrue;
-
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.inject.Inject;
-
-import org.apache.atlas.RepositoryMetadataModule;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
 import org.apache.atlas.RequestContextV1;
+import org.apache.atlas.TestOnlyModule;
 import org.apache.atlas.TestUtils;
 import org.apache.atlas.TestUtilsV2;
 import org.apache.atlas.model.instance.AtlasEntity;
@@ -56,14 +45,23 @@ import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Guice;
 import org.testng.annotations.Test;
 
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableMap;
+import javax.inject.Inject;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import static org.apache.atlas.TestUtils.NAME;
+import static org.mockito.Mockito.mock;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNull;
+import static org.testng.Assert.assertTrue;
 
 /**
  * Test automatic inverse reference updating in V1 (V2?) code path.
  *
  */
-@Guice(modules = RepositoryMetadataModule.class)
+@Guice(modules = TestOnlyModule.class)
 public abstract class InverseReferenceUpdateV1Test {
 
     @Inject

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1d67afc6/repository/src/test/java/org/apache/atlas/repository/typestore/GraphBackedTypeStoreTest.java
----------------------------------------------------------------------
diff --git a/repository/src/test/java/org/apache/atlas/repository/typestore/GraphBackedTypeStoreTest.java b/repository/src/test/java/org/apache/atlas/repository/typestore/GraphBackedTypeStoreTest.java
index 732a382..65cd938 100755
--- a/repository/src/test/java/org/apache/atlas/repository/typestore/GraphBackedTypeStoreTest.java
+++ b/repository/src/test/java/org/apache/atlas/repository/typestore/GraphBackedTypeStoreTest.java
@@ -21,7 +21,7 @@ package org.apache.atlas.repository.typestore;
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableSet;
 import org.apache.atlas.AtlasException;
-import org.apache.atlas.RepositoryMetadataModule;
+import org.apache.atlas.TestOnlyModule;
 import org.apache.atlas.TestUtils;
 import org.apache.atlas.repository.RepositoryException;
 import org.apache.atlas.repository.graph.AtlasGraphProvider;
@@ -50,7 +50,7 @@ import static org.apache.atlas.typesystem.types.utils.TypesUtil.createOptionalAt
 import static org.apache.atlas.typesystem.types.utils.TypesUtil.createRequiredAttrDef;
 import static org.apache.atlas.typesystem.types.utils.TypesUtil.createStructTypeDef;
 
-@Guice(modules = RepositoryMetadataModule.class)
+@Guice(modules = TestOnlyModule.class)
 public class GraphBackedTypeStoreTest {
     
     private static final String DESCRIPTION = "_description";

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1d67afc6/repository/src/test/java/org/apache/atlas/repository/typestore/StoreBackedTypeCacheConfigurationTest.java
----------------------------------------------------------------------
diff --git a/repository/src/test/java/org/apache/atlas/repository/typestore/StoreBackedTypeCacheConfigurationTest.java b/repository/src/test/java/org/apache/atlas/repository/typestore/StoreBackedTypeCacheConfigurationTest.java
index e62af85..6c5dcfc 100644
--- a/repository/src/test/java/org/apache/atlas/repository/typestore/StoreBackedTypeCacheConfigurationTest.java
+++ b/repository/src/test/java/org/apache/atlas/repository/typestore/StoreBackedTypeCacheConfigurationTest.java
@@ -17,19 +17,18 @@
  */
 package org.apache.atlas.repository.typestore;
 
+import com.google.inject.Inject;
 import org.apache.atlas.typesystem.types.cache.TypeCache;
 import org.testng.Assert;
 import org.testng.annotations.Guice;
 import org.testng.annotations.Test;
 
-import com.google.inject.Inject;
-
 /**
  *  Verify Guice can successfully instantiate and inject StoreBackTypeCache.
  *  StoreBackedTypeCacheTestModule Guice module uses Atlas configuration
  *  which has type cache implementation class set to {@link StoreBackedTypeCache}.
  */
-@Guice(modules = StoreBackedTypeCacheTestModule.class)
+@Guice(modules = StoreBackedTypeCacheTestOnlyModule.class)
 public class StoreBackedTypeCacheConfigurationTest {
 
     @Inject