http://git-wip-us.apache.org/repos/asf/atlas/blob/435fe3fb/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
deleted file mode 100755
index 952a644..0000000
--- 
a/repository/src/test/java/org/apache/atlas/repository/graph/GraphBackedMetadataRepositoryTest.java
+++ /dev/null
@@ -1,864 +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.graph;
-
-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.RequestContext;
-import org.apache.atlas.TestModules;
-import org.apache.atlas.TestUtils;
-import org.apache.atlas.annotation.GraphTransaction;
-import org.apache.atlas.discovery.graph.GraphBackedDiscoveryService;
-import org.apache.atlas.query.QueryParams;
-import org.apache.atlas.repository.Constants;
-import org.apache.atlas.repository.MetadataRepository;
-import org.apache.atlas.repository.RepositoryException;
-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.AtlasGraphQuery;
-import org.apache.atlas.repository.graphdb.AtlasGraphQuery.ComparisionOperator;
-import org.apache.atlas.repository.graphdb.AtlasVertex;
-import org.apache.atlas.type.AtlasTypeRegistry;
-import org.apache.atlas.typesystem.IStruct;
-import org.apache.atlas.typesystem.ITypedReferenceableInstance;
-import org.apache.atlas.typesystem.ITypedStruct;
-import org.apache.atlas.typesystem.Referenceable;
-import org.apache.atlas.typesystem.Struct;
-import org.apache.atlas.typesystem.exception.EntityNotFoundException;
-import org.apache.atlas.typesystem.exception.TraitNotFoundException;
-import org.apache.atlas.typesystem.persistence.AtlasSystemAttributes;
-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.HierarchicalTypeDefinition;
-import org.apache.atlas.typesystem.types.Multiplicity;
-import org.apache.atlas.typesystem.types.TraitType;
-import org.apache.atlas.typesystem.types.TypeSystem;
-import org.apache.atlas.typesystem.types.utils.TypesUtil;
-import org.apache.commons.lang.RandomStringUtils;
-import org.codehaus.jettison.json.JSONArray;
-import org.codehaus.jettison.json.JSONObject;
-import org.testng.Assert;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-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.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
- *
- * Guice loads the dependencies and injects the necessary objects
- *
- */
-@Guice(modules = TestModules.TestOnlyModule.class)
-public class GraphBackedMetadataRepositoryTest {
-
-    @Inject
-    private MetadataRepository repositoryService;
-
-    @Inject
-    private GraphBackedDiscoveryService discoveryService;
-
-    private TypeSystem typeSystem;
-    private String guid;
-    private QueryParams queryParams = new QueryParams(100, 0);
-
-    @BeforeClass
-    public void setUp() throws Exception {
-        typeSystem = TypeSystem.getInstance();
-        typeSystem.reset();
-
-        assertTrue(repositoryService instanceof GraphBackedMetadataRepository);
-        repositoryService = TestUtils.addTransactionWrapper(repositoryService);
-        new GraphBackedSearchIndexer(new AtlasTypeRegistry());
-
-        TestUtils.defineDeptEmployeeTypes(typeSystem);
-        TestUtils.createHiveTypes(typeSystem);
-    }
-
-    @BeforeMethod
-    public void setupContext() {
-        TestUtils.resetRequestContext();
-    }
-
-    @AfterClass
-    public void tearDown() {
-        TypeSystem.getInstance().reset();
-//        AtlasGraphProvider.cleanup();
-    }
-
-    @Test
-    public void testSubmitEntity() throws Exception {
-        ITypedReferenceableInstance hrDept = 
TestUtils.createDeptEg1(typeSystem);
-
-        List<String> guids = 
repositoryService.createEntities(hrDept).getCreatedEntities();
-        Assert.assertNotNull(guids);
-        Assert.assertEquals(guids.size(), 5);
-        guid = guids.get(4);
-        Assert.assertNotNull(guid);
-    }
-
-    @Test
-    public void testCreateEntityWithOneNestingLevel() throws AtlasException {
-
-        List<Referenceable> toValidate = new ArrayList<>();
-        Referenceable dept = new Referenceable(TestUtils.DEPARTMENT_TYPE);
-        toValidate.add(dept);
-        dept.set(TestUtils.NAME, "test1");
-
-        Referenceable mike = new Referenceable(TestUtils.PERSON_TYPE);
-        toValidate.add(mike);
-
-        mike.set(TestUtils.NAME, "Mike");
-        mike.set(TestUtils.DEPARTMENT_ATTR, dept);
-
-        Referenceable mark = new Referenceable(TestUtils.PERSON_TYPE);
-        toValidate.add(mark);
-        mark.set(TestUtils.NAME, "Mark");
-        mark.set(TestUtils.DEPARTMENT_ATTR, dept);
-
-        dept.set(TestUtils.EMPLOYEES_ATTR, ImmutableList.of(mike, mark));
-        Map<String,Referenceable> positions = new HashMap<>();
-        final String JANITOR = "janitor";
-        final String RECEPTIONIST = "receptionist";
-        positions.put(JANITOR, mike);
-        positions.put(RECEPTIONIST, mark);
-        dept.set(TestUtils.POSITIONS_ATTR, positions);
-
-
-        ClassType deptType = 
TypeSystem.getInstance().getDataType(ClassType.class, 
TestUtils.DEPARTMENT_TYPE);
-        ITypedReferenceableInstance deptInstance = deptType.convert(dept, 
Multiplicity.REQUIRED);
-
-        CreateUpdateEntitiesResult result = 
repositoryService.createEntities(deptInstance);
-
-        validateGuidMapping(toValidate, result);
-    }
-
-
-    @Test
-    public void testCreateEntityWithTwoNestingLevels() throws AtlasException {
-
-        List<Referenceable> toVerify = new ArrayList<>();
-        Referenceable dept = new Referenceable(TestUtils.DEPARTMENT_TYPE);
-        toVerify.add(dept);
-        dept.set(TestUtils.NAME, "test2");
-
-        Referenceable wallace = new Referenceable(TestUtils.PERSON_TYPE);
-        toVerify.add(wallace);
-        wallace.set(TestUtils.NAME, "Wallace");
-        wallace.set(TestUtils.DEPARTMENT_ATTR, dept);
-
-        Referenceable wallaceComputer = new 
Referenceable(TestUtils.ASSET_TYPE);
-        toVerify.add(wallaceComputer);
-        wallaceComputer.set("name", "wallaceComputer");
-        wallace.set(TestUtils.ASSETS_ATTR, ImmutableList.of(wallaceComputer));
-
-        Referenceable jordan = new Referenceable(TestUtils.PERSON_TYPE);
-        toVerify.add(jordan);
-        jordan.set(TestUtils.NAME, "Jordan");
-        jordan.set(TestUtils.DEPARTMENT_ATTR, dept);
-
-        Referenceable jordanComputer = new Referenceable(TestUtils.ASSET_TYPE);
-        toVerify.add(jordanComputer);
-        jordanComputer.set("name", "jordanComputer");
-        jordan.set(TestUtils.ASSETS_ATTR, ImmutableList.of(jordanComputer));
-
-        dept.set(TestUtils.EMPLOYEES_ATTR, ImmutableList.of(wallace, jordan));
-        Map<String,Referenceable> positions = new HashMap<>();
-        final String JANITOR = "janitor";
-        final String RECEPTIONIST = "receptionist";
-        positions.put(JANITOR, wallace);
-        positions.put(RECEPTIONIST, jordan);
-        dept.set(TestUtils.POSITIONS_ATTR, positions);
-
-
-        ClassType deptType = 
TypeSystem.getInstance().getDataType(ClassType.class, 
TestUtils.DEPARTMENT_TYPE);
-        ITypedReferenceableInstance deptInstance = deptType.convert(dept, 
Multiplicity.REQUIRED);
-
-        CreateUpdateEntitiesResult result = 
repositoryService.createEntities(deptInstance);
-        validateGuidMapping(toVerify, result);
-    }
-
-
-    @Test
-    public void testCreateEntityWithThreeNestingLevels() throws AtlasException 
{
-
-        List<Referenceable> toVerify = new ArrayList<>();
-
-        Referenceable dept = new Referenceable(TestUtils.DEPARTMENT_TYPE);
-        toVerify.add(dept);
-        dept.set(TestUtils.NAME, "test3");
-
-        Referenceable barry = new Referenceable(TestUtils.PERSON_TYPE);
-        toVerify.add(barry);
-        barry.set(TestUtils.NAME, "barry");
-        barry.set(TestUtils.DEPARTMENT_ATTR, dept);
-
-        Referenceable barryComputer = new Referenceable(TestUtils.ASSET_TYPE);
-        toVerify.add(barryComputer);
-        barryComputer.set("name", "barryComputer");
-        barry.set(TestUtils.ASSETS_ATTR, ImmutableList.of(barryComputer));
-
-        Referenceable barryHardDrive = new Referenceable(TestUtils.ASSET_TYPE);
-        toVerify.add(barryHardDrive);
-        barryHardDrive.set("name", "barryHardDrive");
-
-        Referenceable barryCpuFan = new Referenceable(TestUtils.ASSET_TYPE);
-        toVerify.add(barryCpuFan);
-        barryCpuFan.set("name", "barryCpuFan");
-
-        Referenceable barryVideoCard = new Referenceable(TestUtils.ASSET_TYPE);
-        toVerify.add(barryVideoCard);
-        barryVideoCard.set("name", "barryVideoCard");
-
-        barryComputer.set("childAssets", ImmutableList.of(barryHardDrive, 
barryVideoCard, barryCpuFan));
-
-
-        Referenceable jacob = new Referenceable(TestUtils.PERSON_TYPE);
-        toVerify.add(jacob);
-        jacob.set(TestUtils.NAME, "jacob");
-        jacob.set(TestUtils.DEPARTMENT_ATTR, dept);
-
-        Referenceable jacobComputer = new Referenceable(TestUtils.ASSET_TYPE);
-        toVerify.add(jacobComputer);
-        jacobComputer.set("name", "jacobComputer");
-        jacob.set(TestUtils.ASSETS_ATTR, ImmutableList.of(jacobComputer));
-
-        Referenceable jacobHardDrive = new Referenceable(TestUtils.ASSET_TYPE);
-        toVerify.add(jacobHardDrive);
-        jacobHardDrive.set("name", "jacobHardDrive");
-
-        Referenceable jacobCpuFan = new Referenceable(TestUtils.ASSET_TYPE);
-        toVerify.add(jacobCpuFan);
-        jacobCpuFan.set("name", "jacobCpuFan");
-
-        Referenceable jacobVideoCard = new Referenceable(TestUtils.ASSET_TYPE);
-        toVerify.add(jacobVideoCard);
-        jacobVideoCard.set("name", "jacobVideoCard");
-
-        jacobComputer.set("childAssets", ImmutableList.of(jacobHardDrive, 
jacobVideoCard, jacobCpuFan));
-
-        dept.set(TestUtils.EMPLOYEES_ATTR, ImmutableList.of(barry, jacob));
-        Map<String,Referenceable> positions = new HashMap<>();
-        final String JANITOR = "janitor";
-        final String RECEPTIONIST = "receptionist";
-        positions.put(JANITOR, barry);
-        positions.put(RECEPTIONIST, jacob);
-        dept.set(TestUtils.POSITIONS_ATTR, positions);
-
-
-        ClassType deptType = 
TypeSystem.getInstance().getDataType(ClassType.class, 
TestUtils.DEPARTMENT_TYPE);
-        ITypedReferenceableInstance deptInstance = deptType.convert(dept, 
Multiplicity.REQUIRED);
-
-        CreateUpdateEntitiesResult result = 
repositoryService.createEntities(deptInstance);
-
-        assertEquals(result.getCreatedEntities().size(), toVerify.size());
-
-        validateGuidMapping(toVerify, result);
-    }
-
-    @Test(dependsOnMethods = "testSubmitEntity")
-    public void testGetEntityDefinitionForDepartment() throws Exception {
-        ITypedReferenceableInstance entity = 
repositoryService.getEntityDefinition(guid);
-        Assert.assertNotNull(entity);
-
-        //entity state should be active by default
-        Assert.assertEquals(entity.getId().getState(), Id.EntityState.ACTIVE);
-
-        //System attributes created time and modified time should not be null
-        AtlasSystemAttributes systemAttributes = entity.getSystemAttributes();
-        Assert.assertNotNull(systemAttributes.createdTime);
-        Assert.assertNotNull(systemAttributes.modifiedTime);
-    }
-
-    @Test(expectedExceptions = EntityNotFoundException.class)
-    public void testGetEntityDefinitionNonExistent() throws Exception {
-        repositoryService.getEntityDefinition("blah");
-        Assert.fail();
-    }
-
-    @Test(dependsOnMethods = "testSubmitEntity")
-    public void testGetEntityList() throws Exception {
-        List<String> entityList = 
repositoryService.getEntityList(TestUtils.DEPARTMENT_TYPE);
-        System.out.println("entityList = " + entityList);
-        Assert.assertNotNull(entityList);
-        Assert.assertTrue(entityList.contains(guid));
-    }
-
-    @Test
-    public void testGetTypeAttributeName() throws Exception {
-        Assert.assertEquals(repositoryService.getTypeAttributeName(), 
Constants.ENTITY_TYPE_PROPERTY_KEY);
-    }
-
-    @Test(dependsOnMethods = "testSubmitEntity")
-    public void testGetTraitLabel() throws Exception {
-        Assert.assertEquals(
-                
repositoryService.getTraitLabel(typeSystem.getDataType(ClassType.class, 
TestUtils.TABLE_TYPE),
-                        TestUtils.CLASSIFICATION), TestUtils.CLASSIFICATION);
-    }
-
-    @Test
-    public void testCreateEntity() throws Exception {
-        Referenceable databaseInstance = new 
Referenceable(TestUtils.DATABASE_TYPE);
-        databaseInstance.set("name", TestUtils.DATABASE_NAME);
-        databaseInstance.set("description", "foo database");
-        databaseInstance.set("created", new Date(TestUtils.TEST_DATE_IN_LONG));
-
-        databaseInstance.set("namespace", "colo:cluster:hive:db");
-        databaseInstance.set("cluster", "cluster-1");
-        databaseInstance.set("colo", "colo-1");
-        System.out.println("databaseInstance = " + databaseInstance);
-
-        ClassType dbType = typeSystem.getDataType(ClassType.class, 
TestUtils.DATABASE_TYPE);
-        ITypedReferenceableInstance db = dbType.convert(databaseInstance, 
Multiplicity.REQUIRED);
-        System.out.println("db = " + db);
-
-        //Reuse the same database instance without id, with the same unique 
attribute
-        ITypedReferenceableInstance table = 
createHiveTableInstance(databaseInstance);
-        List<String> guids = createEntities(db, table);
-        Assert.assertEquals(guids.size(), 7);   //1 db + 5 columns + 1 table. 
Shouldn't create db again
-        System.out.println("added db = " + guids.get(0));
-        System.out.println("added table = " + guids.get(6));
-    }
-
-    @Test(dependsOnMethods = "testCreateEntity")
-    public void testGetEntityDefinition() throws Exception {
-        String guid = getGUID();
-
-        ITypedReferenceableInstance table = 
repositoryService.getEntityDefinition(guid);
-        Assert.assertEquals(table.getDate("created"), new 
Date(TestUtils.TEST_DATE_IN_LONG));
-        System.out.println("*** table = " + table);
-    }
-
-    @Test(dependsOnMethods = "testCreateEntity")
-    public void testGetTraitNames() throws Exception {
-        final List<String> traitNames = 
repositoryService.getTraitNames(getGUID());
-        Assert.assertEquals(traitNames.size(), 1);
-        Assert.assertEquals(traitNames, Arrays.asList(new 
String[]{TestUtils.CLASSIFICATION}));
-    }
-
-    @Test
-    public void testGetTraitNamesForEmptyTraits() throws Exception {
-        final List<String> traitNames = repositoryService.getTraitNames(guid);
-        Assert.assertEquals(traitNames.size(), 0);
-    }
-
-    @Test(expectedExceptions = EntityNotFoundException.class)
-    public void testGetTraitNamesForBadEntity() throws Exception {
-        repositoryService.getTraitNames(UUID.randomUUID().toString());
-        Assert.fail();
-    }
-
-    @Test
-    public void testMultipleTypesWithSameUniqueAttribute() throws Exception {
-        //Two entities of different types(with same supertype that has the 
unique attribute) with same qualified name should succeed
-        HierarchicalTypeDefinition<ClassType> supertype =
-                createClassTypeDef(randomString(), ImmutableSet.<String>of(),
-                        createUniqueRequiredAttrDef("name", 
DataTypes.STRING_TYPE));
-        HierarchicalTypeDefinition<ClassType> t1 =
-                createClassTypeDef(randomString(), 
ImmutableSet.of(supertype.typeName));
-        HierarchicalTypeDefinition<ClassType> t2 =
-                createClassTypeDef(randomString(), 
ImmutableSet.of(supertype.typeName));
-        typeSystem.defineClassTypes(supertype, t1, t2);
-
-        final String name = randomString();
-        String id1 = createEntity(new Referenceable(t1.typeName) {{
-            set("name", name);
-        }}).get(0);
-        String id2 = createEntity(new Referenceable(t2.typeName) {{
-            set("name", name);
-        }}).get(0);
-        assertNotEquals(id1, id2);
-
-        ITypedReferenceableInstance entity = 
repositoryService.getEntityDefinition(t1.typeName, "name", name);
-        assertEquals(entity.getTypeName(), t1.typeName);
-        assertEquals(entity.getId()._getId(), id1);
-
-        entity = repositoryService.getEntityDefinition(t2.typeName, "name", 
name);
-        assertEquals(entity.getTypeName(), t2.typeName);
-        assertEquals(entity.getId()._getId(), id2);
-    }
-
-    @Test(dependsOnMethods = "testGetTraitNames")
-    public void testAddTrait() throws Exception {
-        final String aGUID = getGUID();
-        AtlasVertex AtlasVertex = 
GraphHelper.getInstance().getVertexForGUID(aGUID);
-        Long modificationTimestampPreUpdate = 
GraphHelper.getSingleValuedProperty(AtlasVertex, 
Constants.MODIFICATION_TIMESTAMP_PROPERTY_KEY, Long.class);
-        Assert.assertNotNull(modificationTimestampPreUpdate);
-
-        List<String> traitNames = repositoryService.getTraitNames(aGUID);
-        System.out.println("traitNames = " + traitNames);
-        Assert.assertEquals(traitNames.size(), 1);
-        Assert.assertTrue(traitNames.contains(TestUtils.CLASSIFICATION));
-        Assert.assertFalse(traitNames.contains(TestUtils.PII));
-
-        TraitType traitType = typeSystem.getDataType(TraitType.class, 
TestUtils.PII);
-        ITypedStruct traitInstance = traitType.createInstance();
-
-        repositoryService.addTrait(aGUID, traitInstance);
-
-        // refresh trait names
-        traitNames = repositoryService.getTraitNames(aGUID);
-        Assert.assertEquals(traitNames.size(), 2);
-        Assert.assertTrue(traitNames.contains(TestUtils.PII));
-        Assert.assertTrue(traitNames.contains(TestUtils.CLASSIFICATION));
-
-        // Verify modification timestamp was updated.
-        GraphHelper.getInstance().getVertexForGUID(aGUID);
-        Long modificationTimestampPostUpdate = 
GraphHelper.getSingleValuedProperty(AtlasVertex, 
Constants.MODIFICATION_TIMESTAMP_PROPERTY_KEY, Long.class);
-        Assert.assertNotNull(modificationTimestampPostUpdate);
-    }
-
-    @Test(dependsOnMethods = "testAddTrait")
-    public void testAddTraitWithAttribute() throws Exception {
-        final String aGUID = getGUID();
-        final String traitName = "P_I_I";
-
-        HierarchicalTypeDefinition<TraitType> piiTrait = TypesUtil
-            .createTraitTypeDef(traitName, ImmutableSet.<String>of(),
-                TypesUtil.createRequiredAttrDef("type", 
DataTypes.STRING_TYPE));
-        TraitType traitType = typeSystem.defineTraitType(piiTrait);
-        ITypedStruct traitInstance = traitType.createInstance();
-        traitInstance.set("type", "SSN");
-
-        repositoryService.addTrait(aGUID, traitInstance);
-
-        TestUtils.dumpGraph(TestUtils.getGraph());
-
-        // refresh trait names
-        List<String> traitNames = repositoryService.getTraitNames(aGUID);
-        Assert.assertEquals(traitNames.size(), 3);
-        Assert.assertTrue(traitNames.contains(traitName));
-
-        ITypedReferenceableInstance instance = 
repositoryService.getEntityDefinition(aGUID);
-        IStruct traitInstanceRef = instance.getTrait(traitName);
-        String type = (String) traitInstanceRef.get("type");
-        Assert.assertEquals(type, "SSN");
-    }
-
-    @Test(dependsOnMethods = "testCreateEntity", expectedExceptions = 
NullPointerException.class)
-    public void testAddTraitWithNullInstance() throws Exception {
-        repositoryService.addTrait(getGUID(), null);
-        Assert.fail();
-    }
-
-    @Test(dependsOnMethods = "testAddTrait", expectedExceptions = 
RepositoryException.class)
-    public void testAddTraitForBadEntity() throws Exception {
-        TraitType traitType = typeSystem.getDataType(TraitType.class, 
TestUtils.PII);
-        ITypedStruct traitInstance = traitType.createInstance();
-
-        repositoryService.addTrait(UUID.randomUUID().toString(), 
traitInstance);
-        Assert.fail();
-    }
-
-    @Test(dependsOnMethods = "testAddTrait")
-    public void testDeleteTrait() throws Exception {
-        final String aGUID = getGUID();
-        AtlasVertex AtlasVertex = 
GraphHelper.getInstance().getVertexForGUID(aGUID);
-        Long modificationTimestampPreUpdate = 
GraphHelper.getSingleValuedProperty(AtlasVertex, 
Constants.MODIFICATION_TIMESTAMP_PROPERTY_KEY, Long.class);
-        Assert.assertNotNull(modificationTimestampPreUpdate);
-
-        List<String> traitNames = repositoryService.getTraitNames(aGUID);
-        Assert.assertEquals(traitNames.size(), 3);
-        Assert.assertTrue(traitNames.contains(TestUtils.PII));
-        Assert.assertTrue(traitNames.contains(TestUtils.CLASSIFICATION));
-        Assert.assertTrue(traitNames.contains("P_I_I"));
-
-        repositoryService.deleteTrait(aGUID, TestUtils.PII);
-
-        // refresh trait names
-        traitNames = repositoryService.getTraitNames(aGUID);
-        Assert.assertEquals(traitNames.size(), 2);
-        Assert.assertTrue(traitNames.contains(TestUtils.CLASSIFICATION));
-        Assert.assertFalse(traitNames.contains(TestUtils.PII));
-
-        // Verify modification timestamp was updated.
-        GraphHelper.getInstance().getVertexForGUID(aGUID);
-        Long modificationTimestampPostUpdate = 
GraphHelper.getSingleValuedProperty(AtlasVertex, 
Constants.MODIFICATION_TIMESTAMP_PROPERTY_KEY, Long.class);
-        Assert.assertNotNull(modificationTimestampPostUpdate);
-        Assert.assertTrue(modificationTimestampPostUpdate > 
modificationTimestampPreUpdate);
-    }
-
-    @Test(expectedExceptions = EntityNotFoundException.class)
-    public void testDeleteTraitForNonExistentEntity() throws Exception {
-        repositoryService.deleteTrait(UUID.randomUUID().toString(), 
TestUtils.PII);
-        Assert.fail();
-    }
-
-    @Test(expectedExceptions = TraitNotFoundException.class)
-    public void testDeleteTraitForNonExistentTrait() throws Exception {
-        final String aGUID = getGUID();
-        repositoryService.deleteTrait(aGUID, "PCI");
-        Assert.fail();
-    }
-
-    @Test(dependsOnMethods = "testCreateEntity")
-    @GraphTransaction
-    public void testGetIdFromVertex() throws Exception {
-        AtlasVertex tableVertex = getTableEntityVertex();
-
-        String guid = GraphHelper.getSingleValuedProperty(tableVertex, 
Constants.GUID_PROPERTY_KEY, String.class);
-        if (guid == null) {
-            Assert.fail();
-        }
-
-        Id expected = new Id(guid, 
GraphHelper.getSingleValuedProperty(tableVertex, 
Constants.VERSION_PROPERTY_KEY, Long.class).intValue(), TestUtils.TABLE_TYPE);
-        Assert.assertEquals(GraphHelper.getIdFromVertex(TestUtils.TABLE_TYPE, 
tableVertex), expected);
-    }
-
-    @Test(dependsOnMethods = "testCreateEntity")
-    @GraphTransaction
-    public void testGetTypeName() throws Exception {
-        AtlasVertex tableVertex = getTableEntityVertex();
-        Assert.assertEquals(GraphHelper.getTypeName(tableVertex), 
TestUtils.TABLE_TYPE);
-    }
-
-    @Test(dependsOnMethods = "testCreateEntity")
-    public void testSearchByDSLQuery() throws Exception {
-        String dslQuery = "hive_database as PII";
-        System.out.println("Executing dslQuery = " + dslQuery);
-        String jsonResults = discoveryService.searchByDSL(dslQuery, 
queryParams);
-        Assert.assertNotNull(jsonResults);
-
-        JSONObject results = new JSONObject(jsonResults);
-        Assert.assertEquals(results.length(), 3);
-        System.out.println("results = " + results);
-
-        Object query = results.get("query");
-        Assert.assertNotNull(query);
-
-        JSONObject dataType = results.getJSONObject("dataType");
-        Assert.assertNotNull(dataType);
-        String typeName = dataType.getString("typeName");
-        Assert.assertNotNull(typeName);
-
-        JSONArray rows = results.getJSONArray("rows");
-        Assert.assertNotNull(rows);
-        Assert.assertTrue(rows.length() > 0);
-
-        for (int index = 0; index < rows.length(); index++) {
-            JSONObject row = rows.getJSONObject(index);
-            String type = row.getString("$typeName$");
-            Assert.assertEquals(type, "hive_database");
-
-            String name = row.getString("name");
-            Assert.assertEquals(name, TestUtils.DATABASE_NAME);
-        }
-    }
-
-    @Test(dependsOnMethods = "testSubmitEntity")
-    public void testSearchByDSLWithInheritance() throws Exception {
-        String dslQuery = "Person where name = 'Jane'";
-        System.out.println("Executing dslQuery = " + dslQuery);
-        String jsonResults = discoveryService.searchByDSL(dslQuery, 
queryParams);
-        Assert.assertNotNull(jsonResults);
-
-        JSONObject results = new JSONObject(jsonResults);
-        Assert.assertEquals(results.length(), 3);
-        System.out.println("results = " + results);
-
-        Object query = results.get("query");
-        Assert.assertNotNull(query);
-
-        JSONObject dataType = results.getJSONObject("dataType");
-        Assert.assertNotNull(dataType);
-        String typeName = dataType.getString("typeName");
-        Assert.assertEquals(typeName, "Person");
-
-        JSONArray rows = results.getJSONArray("rows");
-        Assert.assertEquals(rows.length(), 1);
-
-        JSONObject row = rows.getJSONObject(0);
-        Assert.assertEquals(row.getString("$typeName$"), "Manager");
-        Assert.assertEquals(row.getString("name"), "Jane");
-    }
-
-    @Test(dependsOnMethods = "testCreateEntity")
-    public void testBug37860() throws Exception {
-        String dslQuery = "hive_table as t where name = 'bar' "
-            + "database where name = 'foo' and description = 'foo database' 
select t";
-
-        TestUtils.dumpGraph(TestUtils.getGraph());
-
-        System.out.println("Executing dslQuery = " + dslQuery);
-        String jsonResults = discoveryService.searchByDSL(dslQuery, 
queryParams);
-        Assert.assertNotNull(jsonResults);
-
-        JSONObject results = new JSONObject(jsonResults);
-        Assert.assertEquals(results.length(), 3);
-        System.out.println("results = " + results);
-
-        Object query = results.get("query");
-        Assert.assertNotNull(query);
-
-        JSONObject dataType = results.getJSONObject("dataType");
-        Assert.assertNotNull(dataType);
-
-        JSONArray rows = results.getJSONArray("rows");
-        Assert.assertEquals(rows.length(), 1);
-
-    }
-
-    /**
-     * Full text search requires GraphBackedSearchIndexer, and 
GraphBackedSearchIndexer can't be enabled in
-     * GraphBackedDiscoveryServiceTest because of its test data. So, test for 
full text search is in
-     * GraphBackedMetadataRepositoryTest:(
-     */
-    @Test(dependsOnMethods = "testSubmitEntity")
-    public void testFullTextSearch() throws Exception {
-        //todo fix this
-        //Weird: with lucene, the test passes without sleep
-        //but with elasticsearch, doesn't work without sleep. why??
-        long sleepInterval = 1000;
-
-        TestUtils.dumpGraph(TestUtils.getGraph());
-
-        //person in hr department whose name is john
-        Thread.sleep(sleepInterval);
-        String response = discoveryService.searchByFullText("john", 
queryParams);
-        Assert.assertNotNull(response);
-        JSONArray results = new JSONArray(response);
-        Assert.assertEquals(results.length(), 1);
-        JSONObject row = (JSONObject) results.get(0);
-        Assert.assertEquals(row.get("typeName"), "Person");
-
-        //person in hr department who lives in santa clara
-        response = discoveryService.searchByFullText("Jane AND santa AND 
clara", queryParams);
-        Assert.assertNotNull(response);
-        results = new JSONArray(response);
-        Assert.assertEquals(results.length(), 1);
-        row = (JSONObject) results.get(0);
-        Assert.assertEquals(row.get("typeName"), "Manager");
-
-        //search for person in hr department whose name starts is john/jahn
-        response = discoveryService.searchByFullText("hr AND (john OR jahn)", 
queryParams);
-        Assert.assertNotNull(response);
-        results = new JSONArray(response);
-        Assert.assertEquals(results.length(), 1);
-        row = (JSONObject) results.get(0);
-        Assert.assertEquals(row.get("typeName"), "Person");
-
-        //verify limit and offset
-        //higher limit should return all results
-        results = new 
JSONArray(discoveryService.searchByFullText("Department", queryParams));
-        assertTrue(results.length() > 0);
-        int maxResults = results.length();
-
-        //smaller limit should return those many rows
-        results = new 
JSONArray(discoveryService.searchByFullText("Department", new QueryParams(2, 
0)));
-        assertEquals(results.length(), 2);
-
-        //offset should offset the results
-        results = new 
JSONArray(discoveryService.searchByFullText("Department", new QueryParams(5, 
2)));
-        assertEquals(results.length(), maxResults > 5 ? 5 : 
Math.min((maxResults - 2) % 5, 5));
-
-        //higher offset shouldn't return any rows
-        results = new 
JSONArray(discoveryService.searchByFullText("Department", new QueryParams(2, 
6)));
-        assertEquals(results.length(), maxResults > 6 ? Math.min(maxResults - 
6, 2) : 0);
-    }
-
-    @Test
-    public void testUTFValues() throws Exception {
-        Referenceable hrDept = new Referenceable("Department");
-        Referenceable john = new Referenceable("Person");
-        john.set("name", randomUTF());
-        john.set("department", hrDept);
-
-        hrDept.set("name", randomUTF());
-        hrDept.set("employees", ImmutableList.of(john));
-
-        ClassType deptType = typeSystem.getDataType(ClassType.class, 
"Department");
-        ITypedReferenceableInstance hrDept2 = deptType.convert(hrDept, 
Multiplicity.REQUIRED);
-
-        List<String> guids = 
repositoryService.createEntities(hrDept2).getCreatedEntities();
-        Assert.assertNotNull(guids);
-        Assert.assertEquals(guids.size(), 2);
-        Assert.assertNotNull(guids.get(0));
-        Assert.assertNotNull(guids.get(1));
-    }
-
-    @GraphTransaction
-    String getGUID() {
-        AtlasVertex tableVertex = getTableEntityVertex();
-
-        String guid = GraphHelper.getSingleValuedProperty(tableVertex, 
Constants.GUID_PROPERTY_KEY, String.class);
-        if (guid == null) {
-            Assert.fail();
-        }
-        return guid;
-    }
-
-    AtlasVertex getTableEntityVertex() {
-        AtlasGraph graph = TestUtils.getGraph();
-        AtlasGraphQuery query = 
graph.query().has(Constants.ENTITY_TYPE_PROPERTY_KEY, 
ComparisionOperator.EQUAL, TestUtils.TABLE_TYPE);
-        Iterator<AtlasVertex> results = query.vertices().iterator();
-        // returning one since guid should be unique
-        AtlasVertex tableVertex = results.hasNext() ? results.next() : null;
-        if (tableVertex == null) {
-            Assert.fail();
-        }
-
-        return tableVertex;
-    }
-
-    private boolean assertEdge(String id, String typeName) throws Exception {
-        AtlasGraph            graph    = TestUtils.getGraph();
-        Iterable<AtlasVertex> vertices = 
graph.query().has(Constants.GUID_PROPERTY_KEY, id).vertices();
-        AtlasVertex           vertex   = vertices.iterator().next();
-        Iterable<AtlasEdge>   edges    = 
vertex.getEdges(AtlasEdgeDirection.OUT, Constants.INTERNAL_PROPERTY_KEY_PREFIX 
+ typeName + ".ref");
-
-        if (edges.iterator().hasNext()) {
-            ITypedReferenceableInstance entity = 
repositoryService.getEntityDefinition(id);
-            assertNotNull(entity.get("ref"));
-            return true;
-        }
-        return false;
-    }
-
-    private void validateGuidMapping(List<Referenceable> toVerify, 
CreateUpdateEntitiesResult result)
-            throws AtlasException {
-        Map<String,String> guids = 
result.getGuidMapping().getGuidAssignments();
-
-        TestUtils.assertContentsSame(result.getCreatedEntities(), 
guids.values());
-        assertEquals(guids.size(), toVerify.size());
-        for(Referenceable r : toVerify) {
-            loadAndDoSimpleValidation(guids.get(r.getId()._getId()), r);
-        }
-    }
-
-    private ITypedReferenceableInstance loadAndDoSimpleValidation(String guid, 
Referenceable inst) throws AtlasException {
-        return TestUtils.loadAndDoSimpleValidation(guid, inst, 
repositoryService);
-    }
-
-    private List<String> createEntities(ITypedReferenceableInstance... 
instances) throws Exception {
-        RequestContext.createContext();
-        return 
repositoryService.createEntities(instances).getCreatedEntities();
-    }
-
-    private List<String> createEntity(Referenceable entity) throws Exception {
-        ClassType type = typeSystem.getDataType(ClassType.class, 
entity.getTypeName());
-        ITypedReferenceableInstance instance = type.convert(entity, 
Multiplicity.REQUIRED);
-        return createEntities(instance);
-    }
-
-    private ITypedReferenceableInstance createHiveTableInstance(Referenceable 
databaseInstance) throws Exception {
-        Referenceable tableInstance = new Referenceable(TestUtils.TABLE_TYPE, 
TestUtils.CLASSIFICATION);
-        tableInstance.set("name", TestUtils.TABLE_NAME);
-        tableInstance.set("description", "bar table");
-        tableInstance.set("type", "managed");
-        tableInstance.set("created", new Date(TestUtils.TEST_DATE_IN_LONG));
-        tableInstance.set("tableType", 1); // enum
-
-        // super type
-        tableInstance.set("namespace", "colo:cluster:hive:db:table");
-        tableInstance.set("cluster", "cluster-1");
-        tableInstance.set("colo", "colo-1");
-
-        // refer to an existing class
-        tableInstance.set("database", databaseInstance);
-
-        ArrayList<String> columnNames = new ArrayList<>();
-        columnNames.add("first_name");
-        columnNames.add("last_name");
-        tableInstance.set("columnNames", columnNames);
-
-        Struct traitInstance = (Struct) 
tableInstance.getTrait(TestUtils.CLASSIFICATION);
-        traitInstance.set("tag", "foundation_etl");
-
-        Struct serde1Instance = new Struct("serdeType");
-        serde1Instance.set("name", "serde1");
-        serde1Instance.set("serde", "serde1");
-        tableInstance.set("serde1", serde1Instance);
-
-        Struct serde2Instance = new Struct("serdeType");
-        serde2Instance.set("name", "serde2");
-        serde2Instance.set("serde", "serde2");
-        tableInstance.set("serde2", serde2Instance);
-
-        // HashMap<String, Referenceable> columnsMap = new HashMap<>();
-        ArrayList<Referenceable> columns = new ArrayList<>();
-        for (int index = 0; index < 5; index++) {
-            Referenceable columnInstance = new Referenceable("column_type");
-            final String name = "column_" + index;
-            columnInstance.set("name", name);
-            columnInstance.set("type", "string");
-
-            columns.add(columnInstance);
-            // columnsMap.put(name, columnInstance);
-        }
-        tableInstance.set("columns", columns);
-        // tableInstance.set("columnsMap", columnsMap);
-
-        //        HashMap<String, Struct> partitionsMap = new HashMap<>();
-        ArrayList<Struct> partitions = new ArrayList<>();
-        for (int index = 0; index < 5; index++) {
-            Struct partitionInstance = new 
Struct(TestUtils.PARTITION_STRUCT_TYPE);
-            final String name = "partition_" + index;
-            partitionInstance.set("name", name);
-
-            partitions.add(partitionInstance);
-            //            partitionsMap.put(name, partitionInstance);
-        }
-        tableInstance.set("partitions", partitions);
-        //        tableInstance.set("partitionsMap", partitionsMap);
-
-        HashMap<String, String> parametersMap = new HashMap<>();
-        parametersMap.put("foo", "bar");
-        parametersMap.put("bar", "baz");
-        parametersMap.put("some", "thing");
-        tableInstance.set("parametersMap", parametersMap);
-
-        ClassType tableType = typeSystem.getDataType(ClassType.class, 
TestUtils.TABLE_TYPE);
-        return tableType.convert(tableInstance, Multiplicity.REQUIRED);
-    }
-
-    private String randomUTF() {
-        return RandomStringUtils.random(10);
-    }
-
-    private String randomString() {
-        return TestUtils.randomString(10);
-    }
-}

http://git-wip-us.apache.org/repos/asf/atlas/blob/435fe3fb/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
deleted file mode 100644
index 9c0ef43..0000000
--- 
a/repository/src/test/java/org/apache/atlas/repository/graph/GraphBackedRepositoryHardDeleteTest.java
+++ /dev/null
@@ -1,212 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * <p/>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p/>
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.atlas.repository.graph;
-
-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;
-import org.apache.atlas.typesystem.ITypedStruct;
-import org.apache.atlas.typesystem.exception.EntityNotFoundException;
-import org.apache.atlas.typesystem.exception.NullRequiredAttributeException;
-import org.apache.atlas.typesystem.types.TypeSystem;
-import org.testng.Assert;
-
-import java.util.List;
-import java.util.Map;
-
-import static org.apache.atlas.TestUtils.COLUMNS_ATTR_NAME;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertNull;
-import static org.testng.Assert.fail;
-import static org.testng.AssertJUnit.assertNotNull;
-
-public class GraphBackedRepositoryHardDeleteTest extends 
GraphBackedMetadataRepositoryDeleteTestBase {
-    @Override
-    DeleteHandler getDeleteHandler(TypeSystem typeSystem) {
-        return new HardDeleteHandler(typeSystem);
-    }
-
-    @Override
-    protected void assertTestDeleteEntityWithTraits(String guid) {
-        //entity is deleted. So, no assertions
-    }
-
-    @Override
-    protected void assertTableForTestDeleteReference(String tableId) {
-        //entity is deleted. So, no assertions
-    }
-
-    @Override
-    protected void 
assertColumnForTestDeleteReference(ITypedReferenceableInstance tableInstance) 
throws AtlasException {
-        List<ITypedReferenceableInstance> columns =
-                (List<ITypedReferenceableInstance>) 
tableInstance.get(COLUMNS_ATTR_NAME);
-        assertNull(columns);
-    }
-
-    @Override
-    protected void 
assertProcessForTestDeleteReference(ITypedReferenceableInstance 
processInstance) throws Exception {
-        //assert that outputs is empty
-        ITypedReferenceableInstance newProcess =
-                
repositoryService.getEntityDefinition(processInstance.getId()._getId());
-        assertNull(newProcess.get(AtlasClient.PROCESS_ATTRIBUTE_OUTPUTS));
-    }
-
-    @Override
-    protected void assertEntityDeleted(String id) throws Exception {
-        try {
-            repositoryService.getEntityDefinition(id);
-            fail("Expected EntityNotFoundException");
-        } catch(EntityNotFoundException e) {
-            // expected
-        }
-    }
-
-    @Override
-    protected void assertDeletedColumn(ITypedReferenceableInstance 
tableInstance) throws AtlasException {
-        assertEquals(((List<IReferenceableInstance>) 
tableInstance.get(COLUMNS_ATTR_NAME)).size(), 2);
-    }
-
-    @Override
-    protected void assertTestDeleteEntities(ITypedReferenceableInstance 
tableInstance) {
-        int vertexCount = getVertices(Constants.ENTITY_TYPE_PROPERTY_KEY, 
TestUtils.TABLE_TYPE).size();
-        assertEquals(vertexCount, 0);
-
-        vertexCount = getVertices(Constants.ENTITY_TYPE_PROPERTY_KEY, 
TestUtils.COLUMN_TYPE).size();
-        assertEquals(vertexCount, 0);
-    }
-
-    @Override
-    protected void assertVerticesDeleted(List<AtlasVertex> vertices) {
-        assertEquals(vertices.size(), 0);
-    }
-
-    @Override
-    protected void 
assertTestUpdateEntity_MultiplicityOneNonCompositeReference(String janeGuid) 
throws Exception {
-        // Verify that max is no longer a subordinate of jane.
-        ITypedReferenceableInstance jane = 
repositoryService.getEntityDefinition(janeGuid);
-        List<ITypedReferenceableInstance> subordinates = 
(List<ITypedReferenceableInstance>) jane.get("subordinates");
-        Assert.assertEquals(subordinates.size(), 1);
-    }
-
-    @Override
-    protected void 
assertJohnForTestDisconnectBidirectionalReferences(ITypedReferenceableInstance 
john,
-                                                                      String 
janeGuid) throws Exception {
-        assertNull(john.get("manager"));
-    }
-
-    @Override
-    protected void 
assertMaxForTestDisconnectBidirectionalReferences(Map<String, String> 
nameGuidMap)
-            throws Exception {
-        // Verify that the Department.employees reference to the deleted 
employee
-        // was disconnected.
-        ITypedReferenceableInstance hrDept = 
repositoryService.getEntityDefinition(nameGuidMap.get("hr"));
-        List<ITypedReferenceableInstance> employees = 
(List<ITypedReferenceableInstance>) hrDept.get("employees");
-        Assert.assertEquals(employees.size(), 3);
-        String maxGuid = nameGuidMap.get("Max");
-        for (ITypedReferenceableInstance employee : employees) {
-            Assert.assertNotEquals(employee.getId()._getId(), maxGuid);
-        }
-
-        // Verify that the Manager.subordinates reference to the deleted 
employee
-        // Max was disconnected.
-        ITypedReferenceableInstance jane = 
repositoryService.getEntityDefinition(nameGuidMap.get("Jane"));
-        List<ITypedReferenceableInstance> subordinates = 
(List<ITypedReferenceableInstance>) jane.get("subordinates");
-        assertEquals(subordinates.size(), 1);
-
-        // Verify that max's Person.mentor unidirectional reference to john 
was disconnected.
-        ITypedReferenceableInstance john = 
repositoryService.getEntityDefinition(nameGuidMap.get("John"));
-        assertNull(john.get("mentor"));
-    }
-
-    @Override
-    protected void 
assertTestDisconnectUnidirectionalArrayReferenceFromClassType(
-            List<ITypedReferenceableInstance> columns, String columnGuid) {
-        assertEquals(columns.size(), 4);
-        for (ITypedReferenceableInstance column : columns) {
-            assertFalse(column.getId()._getId().equals(columnGuid));
-        }
-    }
-
-    @Override
-    protected void 
assertTestDisconnectUnidirectionalArrayReferenceFromStructAndTraitTypes(String 
structContainerGuid)
-            throws Exception {
-        // Verify that the unidirectional references from the struct and trait 
instances
-        // to the deleted entities were disconnected.
-        ITypedReferenceableInstance structContainerConvertedEntity =
-                repositoryService.getEntityDefinition(structContainerGuid);
-        ITypedStruct struct = (ITypedStruct) 
structContainerConvertedEntity.get("struct");
-        assertNull(struct.get("target"));
-        IStruct trait = structContainerConvertedEntity.getTrait("TestTrait");
-        assertNotNull(trait);
-        assertNull(trait.get("target"));
-    }
-
-    @Override
-    protected void assertTestDisconnectMapReferenceFromClassType(String 
mapOwnerGuid) throws Exception {
-        // Verify map references from mapOwner were disconnected.
-        ITypedReferenceableInstance mapOwnerInstance = 
repositoryService.getEntityDefinition(mapOwnerGuid);
-        assertNull(mapOwnerInstance.get("map"));
-        assertNull(mapOwnerInstance.get("biMap"));
-
-        AtlasVertex mapOwnerVertex = 
GraphHelper.getInstance().getVertexForGUID(mapOwnerGuid);
-        Object object = mapOwnerVertex.getProperty("MapOwner.map.value1", 
String.class);
-        assertNull(object);
-        object = mapOwnerVertex.getProperty("MapOwner.biMap.value1", 
String.class);
-        assertNull(object);
-    }
-
-    @Override
-    protected void assertTestDeleteTargetOfMultiplicityRequiredReference() 
throws Exception {
-
-        Assert.fail("Lower bound on attribute Manager.subordinates was not 
enforced - " +
-            NullRequiredAttributeException.class.getSimpleName() + " was 
expected but none thrown");
-    }
-
-    @Override
-    protected void 
assertTestLowerBoundsIgnoredOnDeletedEntities(List<ITypedReferenceableInstance> 
employees) {
-
-        Assert.assertEquals(employees.size(), 1, "References to deleted 
employees were not disconnected");
-    }
-
-    @Override
-    protected void 
assertTestLowerBoundsIgnoredOnCompositeDeletedEntities(String hrDeptGuid) 
throws Exception {
-
-        try {
-            repositoryService.getEntityDefinition(hrDeptGuid);
-            Assert.fail(EntityNotFoundException.class.getSimpleName() + " was 
expected but none thrown");
-        }
-        catch (EntityNotFoundException e) {
-            // good
-        }
-    }
-
-    @Override
-    protected void 
verifyTestDeleteEntityWithDuplicateReferenceListElements(List 
columnsPropertyValue) {
-
-        // With hard deletes enabled, verify that duplicate edge IDs for 
deleted edges
-        // were removed from the array property list.
-        Assert.assertEquals(columnsPropertyValue.size(), 2);
-    }
-}

http://git-wip-us.apache.org/repos/asf/atlas/blob/435fe3fb/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
deleted file mode 100644
index 8c86235..0000000
--- 
a/repository/src/test/java/org/apache/atlas/repository/graph/GraphBackedRepositorySoftDeleteTest.java
+++ /dev/null
@@ -1,239 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * <p/>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p/>
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.atlas.repository.graph;
-
-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;
-import org.apache.atlas.typesystem.ITypedStruct;
-import org.apache.atlas.typesystem.persistence.Id;
-import org.apache.atlas.typesystem.persistence.Id.EntityState;
-import org.apache.atlas.typesystem.types.TypeSystem;
-import org.testng.Assert;
-
-import java.util.List;
-import java.util.Map;
-
-import static org.apache.atlas.TestUtils.COLUMNS_ATTR_NAME;
-import static org.apache.atlas.TestUtils.NAME;
-import static org.apache.atlas.TestUtils.PII;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertTrue;
-
-public class GraphBackedRepositorySoftDeleteTest extends 
GraphBackedMetadataRepositoryDeleteTestBase {
-    @Override
-    DeleteHandler getDeleteHandler(TypeSystem typeSystem) {
-        return new SoftDeleteHandler(typeSystem);
-    }
-
-    @Override
-    protected void assertTestDeleteEntityWithTraits(String guid) throws 
Exception {
-        ITypedReferenceableInstance instance = 
repositoryService.getEntityDefinition(guid);
-        assertTrue(instance.getTraits().contains(PII));
-    }
-
-    @Override
-    protected void assertTableForTestDeleteReference(String tableId) throws 
Exception  {
-        ITypedReferenceableInstance table = 
repositoryService.getEntityDefinition(tableId);
-        assertNotNull(table.get(NAME));
-        assertNotNull(table.get("description"));
-        assertNotNull(table.get("type"));
-        assertNotNull(table.get("tableType"));
-        assertNotNull(table.get("created"));
-
-        Id dbId = (Id) table.get("database");
-        assertNotNull(dbId);
-
-        ITypedReferenceableInstance db = 
repositoryService.getEntityDefinition(dbId.getId()._getId());
-        assertNotNull(db);
-        assertEquals(db.getId().getState(), Id.EntityState.ACTIVE);
-    }
-
-    @Override
-    protected void 
assertColumnForTestDeleteReference(ITypedReferenceableInstance tableInstance) 
throws AtlasException {
-        List<ITypedReferenceableInstance> columns =
-                (List<ITypedReferenceableInstance>) 
tableInstance.get(COLUMNS_ATTR_NAME);
-        assertEquals(columns.size(), 1);
-        assertEquals(columns.get(0).getId().getState(), 
Id.EntityState.DELETED);
-    }
-
-    @Override
-    protected void 
assertProcessForTestDeleteReference(ITypedReferenceableInstance expected) 
throws Exception {
-        ITypedReferenceableInstance process = 
repositoryService.getEntityDefinition(expected.getId()._getId());
-        List<ITypedReferenceableInstance> outputs =
-                (List<ITypedReferenceableInstance>) 
process.get(AtlasClient.PROCESS_ATTRIBUTE_OUTPUTS);
-        List<ITypedReferenceableInstance> expectedOutputs =
-                (List<ITypedReferenceableInstance>) 
process.get(AtlasClient.PROCESS_ATTRIBUTE_OUTPUTS);
-        assertEquals(outputs.size(), expectedOutputs.size());
-    }
-
-    @Override
-    protected void assertEntityDeleted(String id) throws Exception {
-        ITypedReferenceableInstance entity = 
repositoryService.getEntityDefinition(id);
-        assertEquals(entity.getId().getState(), Id.EntityState.DELETED);
-    }
-
-    @Override
-    protected void assertDeletedColumn(ITypedReferenceableInstance 
tableInstance) throws AtlasException {
-        List<IReferenceableInstance> columns = (List<IReferenceableInstance>) 
tableInstance.get(COLUMNS_ATTR_NAME);
-        assertEquals(columns.size(), 3);
-        assertEquals(columns.get(0).getId().getState(), 
Id.EntityState.DELETED);
-    }
-
-    @Override
-    protected void assertTestDeleteEntities(ITypedReferenceableInstance 
expected) throws Exception {
-        //Assert that the deleted table can be fully constructed back
-        ITypedReferenceableInstance table = 
repositoryService.getEntityDefinition(expected.getId()._getId());
-        List<ITypedReferenceableInstance> columns =
-                (List<ITypedReferenceableInstance>) 
table.get(TestUtils.COLUMNS_ATTR_NAME);
-        List<ITypedReferenceableInstance> expectedColumns =
-                (List<ITypedReferenceableInstance>) 
table.get(TestUtils.COLUMNS_ATTR_NAME);
-        assertEquals(columns.size(), expectedColumns.size());
-        assertNotNull(table.get("database"));
-    }
-
-    @Override
-    protected void assertVerticesDeleted(List<AtlasVertex> vertices) {
-        for (AtlasVertex vertex : vertices) {
-            assertEquals(GraphHelper.getSingleValuedProperty(vertex, 
Constants.STATE_PROPERTY_KEY, String.class), Id.EntityState.DELETED.name());
-        }
-    }
-
-    @Override
-    protected void 
assertTestUpdateEntity_MultiplicityOneNonCompositeReference(String janeGuid) 
throws Exception {
-        // Verify Jane's subordinates reference cardinality is still 2.
-        ITypedReferenceableInstance jane = 
repositoryService.getEntityDefinition(janeGuid);
-        List<ITypedReferenceableInstance> subordinates = 
(List<ITypedReferenceableInstance>) jane.get("subordinates");
-        Assert.assertEquals(subordinates.size(), 2);
-    }
-
-    @Override
-    protected void 
assertJohnForTestDisconnectBidirectionalReferences(ITypedReferenceableInstance 
john, String janeGuid)
-            throws Exception {
-        Id mgr = (Id) john.get("manager");
-        assertNotNull(mgr);
-        assertEquals(mgr._getId(), janeGuid);
-        assertEquals(mgr.getState(), Id.EntityState.DELETED);
-    }
-
-    @Override
-    protected void 
assertMaxForTestDisconnectBidirectionalReferences(Map<String, String> 
nameGuidMap) throws Exception {
-        // Verify that the Department.employees reference to the deleted 
employee
-        // was disconnected.
-        ITypedReferenceableInstance hrDept = 
repositoryService.getEntityDefinition(nameGuidMap.get("hr"));
-        List<ITypedReferenceableInstance> employees = 
(List<ITypedReferenceableInstance>) hrDept.get("employees");
-        Assert.assertEquals(employees.size(), 4);
-        String maxGuid = nameGuidMap.get("Max");
-        for (ITypedReferenceableInstance employee : employees) {
-            if (employee.getId()._getId().equals(maxGuid)) {
-                assertEquals(employee.getId().getState(), 
Id.EntityState.DELETED);
-            }
-        }
-
-        // Verify that the Manager.subordinates still references deleted 
employee
-        ITypedReferenceableInstance jane = 
repositoryService.getEntityDefinition(nameGuidMap.get("Jane"));
-        List<ITypedReferenceableInstance> subordinates = 
(List<ITypedReferenceableInstance>) jane.get("subordinates");
-        assertEquals(subordinates.size(), 2);
-        for (ITypedReferenceableInstance subordinate : subordinates) {
-            if (subordinate.getId()._getId().equals(maxGuid)) {
-                assertEquals(subordinate.getId().getState(), 
Id.EntityState.DELETED);
-            }
-        }
-
-        // Verify that max's Person.mentor unidirectional reference to john 
was disconnected.
-        ITypedReferenceableInstance john = 
repositoryService.getEntityDefinition(nameGuidMap.get("John"));
-        Id mentor = (Id) john.get("mentor");
-        assertEquals(mentor._getId(), maxGuid);
-        assertEquals(mentor.getState(), Id.EntityState.DELETED);
-    }
-
-    @Override
-    protected void 
assertTestDisconnectUnidirectionalArrayReferenceFromClassType(
-            List<ITypedReferenceableInstance> columns, String columnGuid) {
-        Assert.assertEquals(columns.size(), 5);
-        for (ITypedReferenceableInstance column : columns) {
-            if (column.getId()._getId().equals(columnGuid)) {
-                assertEquals(column.getId().getState(), 
Id.EntityState.DELETED);
-            } else {
-                assertEquals(column.getId().getState(), Id.EntityState.ACTIVE);
-            }
-        }
-
-    }
-
-    @Override
-    protected void 
assertTestDisconnectUnidirectionalArrayReferenceFromStructAndTraitTypes(String 
structContainerGuid)
-            throws Exception {
-        // Verify that the unidirectional references from the struct and trait 
instances
-        // to the deleted entities were not disconnected.
-        ITypedReferenceableInstance structContainerConvertedEntity =
-                repositoryService.getEntityDefinition(structContainerGuid);
-        ITypedStruct struct = (ITypedStruct) 
structContainerConvertedEntity.get("struct");
-        assertNotNull(struct.get("target"));
-        IStruct trait = structContainerConvertedEntity.getTrait("TestTrait");
-        assertNotNull(trait);
-        assertNotNull(trait.get("target"));
-
-    }
-
-    @Override
-    protected void assertTestDisconnectMapReferenceFromClassType(String 
mapOwnerGuid) throws Exception {
-        ITypedReferenceableInstance mapOwnerInstance = 
repositoryService.getEntityDefinition(mapOwnerGuid);
-        Map<String, ITypedReferenceableInstance> map =
-                (Map<String, ITypedReferenceableInstance>) 
mapOwnerInstance.get("map");
-        assertNotNull(map);
-        assertEquals(map.size(), 1);
-        Map<String, ITypedReferenceableInstance> biMap =
-                (Map<String, ITypedReferenceableInstance>) 
mapOwnerInstance.get("biMap");
-        assertNotNull(biMap);
-        assertEquals(biMap.size(), 1);
-    }
-
-    @Override
-    protected void assertTestDeleteTargetOfMultiplicityRequiredReference() 
throws Exception {
-        // No-op - it's ok that no exception was thrown if soft deletes are 
enabled.
-    }
-
-    @Override
-    protected void 
assertTestLowerBoundsIgnoredOnDeletedEntities(List<ITypedReferenceableInstance> 
employees) {
-
-        Assert.assertEquals(employees.size(), 4, "References to deleted 
employees should not have been disconnected with soft deletes enabled");
-    }
-
-    @Override
-    protected void 
assertTestLowerBoundsIgnoredOnCompositeDeletedEntities(String hrDeptGuid) 
throws Exception {
-
-        ITypedReferenceableInstance hrDept = 
repositoryService.getEntityDefinition(hrDeptGuid);
-        Assert.assertEquals(hrDept.getId().getState(), EntityState.DELETED);
-    }
-
-    @Override
-    protected void 
verifyTestDeleteEntityWithDuplicateReferenceListElements(List 
columnsPropertyValue) {
-
-        // With soft deletes enabled, verify that edge IDs for deleted edges
-        // were not removed from the array property list.
-        Assert.assertEquals(columnsPropertyValue.size(), 4);
-    }
-}

http://git-wip-us.apache.org/repos/asf/atlas/blob/435fe3fb/repository/src/test/java/org/apache/atlas/repository/graph/GraphBackedSearchIndexerMockTest.java
----------------------------------------------------------------------
diff --git 
a/repository/src/test/java/org/apache/atlas/repository/graph/GraphBackedSearchIndexerMockTest.java
 
b/repository/src/test/java/org/apache/atlas/repository/graph/GraphBackedSearchIndexerMockTest.java
deleted file mode 100644
index a98ef38..0000000
--- 
a/repository/src/test/java/org/apache/atlas/repository/graph/GraphBackedSearchIndexerMockTest.java
+++ /dev/null
@@ -1,91 +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.graph;
-
-import org.apache.atlas.AtlasException;
-import org.apache.atlas.ha.HAConfiguration;
-import org.apache.atlas.repository.Constants;
-import org.apache.atlas.repository.IndexException;
-import org.apache.atlas.repository.RepositoryException;
-import org.apache.atlas.repository.graphdb.AtlasGraph;
-import org.apache.atlas.repository.graphdb.AtlasGraphManagement;
-import org.apache.atlas.type.AtlasTypeRegistry;
-import org.apache.commons.configuration.Configuration;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
-
-import static org.mockito.Mockito.verifyZeroInteractions;
-import static org.mockito.Mockito.when;
-
-public class GraphBackedSearchIndexerMockTest implements IAtlasGraphProvider {
-
-    @Mock
-    private Configuration configuration;
-
-    @Mock
-    private AtlasGraph graph;
-
-    @Mock
-    private AtlasGraphManagement management;
-
-    @Mock
-    private AtlasTypeRegistry typeRegistry;
-
-    @BeforeMethod
-    public void setup() {
-        MockitoAnnotations.initMocks(this);
-    }
-
-    @Test
-    public void 
testSearchIndicesAreInitializedOnConstructionWhenHAIsDisabled() throws 
IndexException, RepositoryException {
-        
when(configuration.getBoolean(HAConfiguration.ATLAS_SERVER_HA_ENABLED_KEY, 
false)).thenReturn(false);        
-        when(graph.getManagementSystem()).thenReturn(management);
-
-        GraphBackedSearchIndexer graphBackedSearchIndexer = new 
GraphBackedSearchIndexer(this, configuration, typeRegistry);
-    }
-
-    @Test
-    public void 
testSearchIndicesAreNotInitializedOnConstructionWhenHAIsEnabled() throws 
IndexException, RepositoryException {
-        
when(configuration.containsKey(HAConfiguration.ATLAS_SERVER_HA_ENABLED_KEY)).thenReturn(true);
-        
when(configuration.getBoolean(HAConfiguration.ATLAS_SERVER_HA_ENABLED_KEY)).thenReturn(true);
-        when(graph.getManagementSystem()).thenReturn(management);
-        
when(management.containsPropertyKey(Constants.VERTEX_TYPE_PROPERTY_KEY)).thenReturn(true);
-
-        new GraphBackedSearchIndexer(this, configuration, typeRegistry);
-        verifyZeroInteractions(management);
-    }
-
-    @Test
-    public void testIndicesAreReinitializedWhenServerBecomesActive() throws 
AtlasException {
-        
when(configuration.containsKey(HAConfiguration.ATLAS_SERVER_HA_ENABLED_KEY)).thenReturn(true);
-        
when(configuration.getBoolean(HAConfiguration.ATLAS_SERVER_HA_ENABLED_KEY)).thenReturn(true);
-        when(graph.getManagementSystem()).thenReturn(management);
-
-        GraphBackedSearchIndexer graphBackedSearchIndexer = new 
GraphBackedSearchIndexer(this, configuration, typeRegistry);
-        graphBackedSearchIndexer.instanceIsActive();
-    }
-    
-
-    @Override
-      public AtlasGraph get() {
-          return graph;
-      }
-}

http://git-wip-us.apache.org/repos/asf/atlas/blob/435fe3fb/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
deleted file mode 100644
index feffabf..0000000
--- 
a/repository/src/test/java/org/apache/atlas/repository/graph/GraphBackedSearchIndexerTest.java
+++ /dev/null
@@ -1,177 +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.graph;
-
-import com.google.inject.Inject;
-import org.apache.atlas.AtlasException;
-import org.apache.atlas.TestModules;
-import org.apache.atlas.TestUtils;
-import org.apache.atlas.repository.Constants;
-import org.apache.atlas.repository.graphdb.AtlasGraph;
-import org.apache.atlas.repository.graphdb.AtlasGraphIndex;
-import org.apache.atlas.repository.graphdb.AtlasGraphManagement;
-import org.apache.atlas.repository.graphdb.AtlasPropertyKey;
-import org.apache.atlas.typesystem.types.ClassType;
-import org.apache.atlas.typesystem.types.DataTypes;
-import org.apache.atlas.typesystem.types.EnumType;
-import org.apache.atlas.typesystem.types.EnumValue;
-import org.apache.atlas.typesystem.types.HierarchicalTypeDefinition;
-import org.apache.atlas.typesystem.types.TypeSystem;
-import org.apache.atlas.typesystem.types.utils.TypesUtil;
-import org.testng.annotations.Guice;
-import org.testng.annotations.Test;
-
-import java.util.Arrays;
-import java.util.Set;
-
-import static 
org.apache.atlas.typesystem.types.utils.TypesUtil.createClassTypeDef;
-import static org.testng.Assert.*;
-
-@Guice(modules = TestModules.TestOnlyModule.class)
-public class GraphBackedSearchIndexerTest {
-    @Inject
-    private GraphBackedSearchIndexer graphBackedSearchIndexer;
-
-    @Test
-    public void verifySystemMixedIndexes() {
-        AtlasGraph graph = TestUtils.getGraph();
-        AtlasGraphManagement managementSystem = graph.getManagementSystem();
-        try {
-            AtlasGraphIndex vertexIndex = 
managementSystem.getGraphIndex(Constants.VERTEX_INDEX);
-            assertNotNull(vertexIndex);
-            assertTrue(vertexIndex.isMixedIndex());
-            assertFalse(vertexIndex.isEdgeIndex());
-            assertTrue(vertexIndex.isVertexIndex());
-            
-            AtlasGraphIndex edgeIndex = 
managementSystem.getGraphIndex(Constants.EDGE_INDEX);
-            assertNotNull(edgeIndex);
-            assertTrue(edgeIndex.isMixedIndex());
-            assertTrue(edgeIndex.isEdgeIndex());
-            assertFalse(edgeIndex.isVertexIndex());
-           
-    
-            verifyVertexIndexContains(managementSystem, 
Constants.STATE_PROPERTY_KEY);
-        }
-        finally {
-            managementSystem.rollback();
-        }
-    }
-
-    @Test
-    public void verifySystemCompositeIndexes() {
-        AtlasGraph graph = TestUtils.getGraph();
-        AtlasGraphManagement managementSystem = graph.getManagementSystem();
-        try {
-            verifySystemCompositeIndex(managementSystem, 
Constants.GUID_PROPERTY_KEY, true);
-            verifyVertexIndexContains(managementSystem, 
Constants.GUID_PROPERTY_KEY);
-    
-            verifySystemCompositeIndex(managementSystem, 
Constants.ENTITY_TYPE_PROPERTY_KEY, false);
-            verifyVertexIndexContains(managementSystem, 
Constants.ENTITY_TYPE_PROPERTY_KEY);
-    
-            verifySystemCompositeIndex(managementSystem, 
Constants.SUPER_TYPES_PROPERTY_KEY, false);
-            verifyVertexIndexContains(managementSystem, 
Constants.SUPER_TYPES_PROPERTY_KEY);
-    
-            verifySystemCompositeIndex(managementSystem, 
Constants.TRAIT_NAMES_PROPERTY_KEY, false);
-            verifyVertexIndexContains(managementSystem, 
Constants.TRAIT_NAMES_PROPERTY_KEY);
-        }
-        finally {
-            managementSystem.rollback();
-        }
-    }
-
-    @Test
-    public void verifyFullTextIndex() {
-        AtlasGraph graph = TestUtils.getGraph();
-        AtlasGraphManagement managementSystem = graph.getManagementSystem();
-        try {
-        AtlasGraphIndex fullTextIndex = 
managementSystem.getGraphIndex(Constants.FULLTEXT_INDEX);
-        assertTrue(fullTextIndex.isMixedIndex());
-
-        Arrays.asList(fullTextIndex.getFieldKeys()).contains(
-                
managementSystem.getPropertyKey(Constants.ENTITY_TEXT_PROPERTY_KEY));
-        }
-        finally {
-            managementSystem.rollback();
-        }
-    }
-
-    @Test
-    public void verifyTypeStoreIndexes() {
-        AtlasGraph graph = TestUtils.getGraph();
-        AtlasGraphManagement managementSystem = graph.getManagementSystem();
-        try {
-            verifySystemCompositeIndex(managementSystem, 
Constants.TYPENAME_PROPERTY_KEY, true);
-            verifyVertexIndexContains(managementSystem, 
Constants.TYPENAME_PROPERTY_KEY);
-    
-            verifySystemCompositeIndex(managementSystem, 
Constants.VERTEX_TYPE_PROPERTY_KEY, false);
-            verifyVertexIndexContains(managementSystem, 
Constants.VERTEX_TYPE_PROPERTY_KEY);
-        }
-        finally {
-            managementSystem.rollback();
-        }
-        
-    }
-
-    @Test
-    public void verifyUserDefinedTypeIndex() throws AtlasException {
-        AtlasGraph graph = TestUtils.getGraph();
-        AtlasGraphManagement managementSystem = graph.getManagementSystem();
-        try {
-            TypeSystem typeSystem = TypeSystem.getInstance();
-    
-            String enumName = "randomEnum" + TestUtils.randomString(10);
-            EnumType managedType = typeSystem.defineEnumType(enumName, new 
EnumValue("randomEnumValue", 0));
-    
-            HierarchicalTypeDefinition<ClassType> databaseTypeDefinition =
-                    createClassTypeDef("Database", "Database type 
description", null,
-                            TypesUtil.createUniqueRequiredAttrDef("name", 
DataTypes.STRING_TYPE),
-                            TypesUtil.createRequiredAttrDef("managedType", 
managedType));
-                
-            ClassType databaseType = 
typeSystem.defineClassType(databaseTypeDefinition);
-            graphBackedSearchIndexer.onAdd(Arrays.asList(databaseType));
-    
-            verifySystemCompositeIndex(managementSystem, "Database.name" + 
Constants.ENTITY_TYPE_PROPERTY_KEY, false);
-            verifyVertexIndexContains(managementSystem, "Database.name" + 
Constants.ENTITY_TYPE_PROPERTY_KEY);
-            verifySystemCompositeIndex(managementSystem, "Database.name" + 
Constants.SUPER_TYPES_PROPERTY_KEY, false);
-    
-            verifyVertexIndexContains(managementSystem, 
"Database.managedType");
-        }
-        finally {
-            //search indexer uses its own titan management transaction
-            managementSystem.rollback();
-        }
-    }
-
-    private void verifyVertexIndexContains(AtlasGraphManagement 
managementSystem, String indexName) {
-        AtlasGraphIndex vertexIndex = 
managementSystem.getGraphIndex(Constants.VERTEX_INDEX);
-        Set<AtlasPropertyKey> fieldKeys = vertexIndex.getFieldKeys();
-        
Arrays.asList(fieldKeys).contains(managementSystem.getPropertyKey(indexName));
-    }
-
-    private void verifySystemCompositeIndex(AtlasGraphManagement 
managementSystem, String indexName, boolean isUnique) {
-        AtlasGraphIndex systemIndex = 
managementSystem.getGraphIndex(indexName);
-        assertNotNull(systemIndex);
-        assertTrue(systemIndex.isCompositeIndex());
-        if (isUnique) {
-            assertTrue(systemIndex.isUnique());
-        } else {
-            assertFalse(systemIndex.isUnique());
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/atlas/blob/435fe3fb/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
deleted file mode 100644
index a0894cd..0000000
--- 
a/repository/src/test/java/org/apache/atlas/repository/graph/GraphHelperMockTest.java
+++ /dev/null
@@ -1,121 +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.graph;
-
-import org.apache.atlas.repository.RepositoryException;
-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.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;
-
-    private AtlasGraph graph;
-
-    @BeforeClass
-    public void setup() {
-        MockitoAnnotations.initMocks(this);
-        graph = mock(AtlasGraph.class);
-        graphHelperInstance = GraphHelper.getInstance(graph);
-    }
-
-    @Test(expectedExceptions = RepositoryException.class)
-    public void testGetOrCreateEdgeLabelWithMaxRetries() throws Exception {
-        final String edgeLabel = "testLabel";
-        AtlasVertex v1 = mock(AtlasVertex.class);
-        AtlasVertex v2 = mock(AtlasVertex.class);
-
-        Iterable noEdgesIterable = new Iterable<AtlasEdge>() {
-            @Override
-            public Iterator<AtlasEdge> iterator() {
-                return new Iterator<AtlasEdge>() {
-                    @Override
-                    public boolean hasNext() {
-                        return false;
-                    }
-
-                    @Override
-                    public AtlasEdge next() {
-                        return null;
-                    }
-
-                    @Override
-                    public void remove() {
-                    }
-                };
-            }
-        };
-        when(v2.getEdges(AtlasEdgeDirection.IN)).thenReturn(noEdgesIterable);
-        when(v1.getEdges(AtlasEdgeDirection.OUT)).thenReturn(noEdgesIterable);
-
-        when(v1.getId()).thenReturn("1234");
-        when(v2.getId()).thenReturn("5678");
-        when(graph.addEdge(v1, v2, edgeLabel)).thenThrow(new 
RuntimeException("Unique property constraint violated"));
-        graphHelperInstance.getOrCreateEdge(v1, v2, edgeLabel);
-    }
-
-    @Test
-    public void testGetOrCreateEdgeLabelWithRetries() throws Exception {
-        final String edgeLabel = "testLabel";
-        AtlasVertex v1 = mock(AtlasVertex.class);
-        AtlasVertex v2 = mock(AtlasVertex.class);
-        AtlasEdge edge = mock(AtlasEdge.class);
-
-        Iterable noEdgesIterable = new Iterable<AtlasEdge>() {
-            @Override
-            public Iterator<AtlasEdge> iterator() {
-                return new Iterator<AtlasEdge>() {
-                    @Override
-                    public boolean hasNext() {
-                        return false;
-                    }
-
-                    @Override
-                    public AtlasEdge next() {
-                        return null;
-                    }
-
-                    @Override
-                    public void remove() {
-                    }
-                };
-            }
-        };
-        when(v2.getEdges(AtlasEdgeDirection.IN)).thenReturn(noEdgesIterable);
-        when(v1.getEdges(AtlasEdgeDirection.OUT)).thenReturn(noEdgesIterable);
-
-        when(v1.getId()).thenReturn("v1");
-        when(v2.getId()).thenReturn("v2");
-        when(edge.getId()).thenReturn("edge");
-        when(graph.addEdge(v1, v2, edgeLabel))
-                .thenThrow(new RuntimeException("Unique property constraint 
violated")).thenReturn(edge);
-        AtlasEdge redge = graphHelperInstance.getOrCreateEdge(v1, v2, 
edgeLabel);
-        assertEquals(edge, redge);
-    }
-}

http://git-wip-us.apache.org/repos/asf/atlas/blob/435fe3fb/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
deleted file mode 100644
index e64c2c8..0000000
--- 
a/repository/src/test/java/org/apache/atlas/repository/graph/GraphHelperTest.java
+++ /dev/null
@@ -1,218 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.atlas.repository.graph;
-
-import org.apache.atlas.AtlasException;
-import org.apache.atlas.TestModules;
-import org.apache.atlas.TestUtils;
-import org.apache.atlas.repository.graph.GraphHelper.VertexInfo;
-import org.apache.atlas.repository.graphdb.AtlasEdge;
-import org.apache.atlas.repository.graphdb.AtlasGraph;
-import org.apache.atlas.repository.graphdb.AtlasVertex;
-import org.apache.atlas.services.MetadataService;
-import org.apache.atlas.type.AtlasTypeRegistry;
-import org.apache.atlas.typesystem.ITypedReferenceableInstance;
-import org.apache.atlas.typesystem.Referenceable;
-import org.apache.atlas.typesystem.TypesDef;
-import org.apache.atlas.typesystem.exception.TypeNotFoundException;
-import org.apache.atlas.typesystem.json.InstanceSerialization;
-import org.apache.atlas.typesystem.json.TypesSerialization;
-import org.apache.atlas.typesystem.types.ClassType;
-import org.apache.atlas.typesystem.types.Multiplicity;
-import org.apache.atlas.typesystem.types.TypeSystem;
-import org.codehaus.jettison.json.JSONArray;
-import org.testng.Assert;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.DataProvider;
-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.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 = TestModules.TestOnlyModule.class)
-public class GraphHelperTest {
-
-
-    @DataProvider(name = "encodeDecodeTestData")
-    private Object[][] createTestData() {
-        return new Object[][]{
-                {"hivedb$", "hivedb_d"},
-                {"hivedb", "hivedb"},
-                {"{hivedb}", "_ohivedb_c"},
-                {"%hivedb}", "_phivedb_c"},
-                {"\"hivedb\"", "_qhivedb_q"},
-                {"\"$%{}", "_q_d_p_o_c"},
-                {"", ""},
-                {"  ", "  "},
-                {"\n\r", "\n\r"},
-                {null, null}
-        };
-    }
-
-    @Inject
-    private MetadataService metadataService;
-
-    @Inject
-    private GraphBackedMetadataRepository repositoryService;
-
-    private TypeSystem typeSystem;
-
-    @Inject
-    private AtlasTypeRegistry typeRegistry;
-
-    @BeforeClass
-    public void setUp() throws Exception {
-        typeSystem = TypeSystem.getInstance();
-        typeSystem.reset();
-
-        new GraphBackedSearchIndexer(typeRegistry);
-        TypesDef typesDef = TestUtils.defineHiveTypes();
-        try {
-            metadataService.getTypeDefinition(TestUtils.TABLE_TYPE);
-        } catch (TypeNotFoundException e) {
-            metadataService.createType(TypesSerialization.toJson(typesDef));
-        }
-        TestUtils.defineDeptEmployeeTypes(typeSystem);
-    }
-
-    @AfterClass
-    public void tearDown() {
-//        AtlasGraphProvider.cleanup();
-    }
-
-    @Test
-    public void testGetInstancesByUniqueAttributes() throws Exception {
-
-        GraphHelper helper = GraphHelper.getInstance();
-        List<ITypedReferenceableInstance> instances =  new ArrayList<>();
-        List<String> guids = new ArrayList<>();
-        TypeSystem ts = TypeSystem.getInstance();
-        ClassType dbType = ts.getDataType(ClassType.class, 
TestUtils.DATABASE_TYPE);
-
-        for(int i = 0; i < 10; i++) {
-            Referenceable db = TestUtils.createDBEntity();
-            String guid = createInstance(db);
-            ITypedReferenceableInstance instance = convert(db, dbType);
-            instances.add(instance);
-            guids.add(guid);
-        }
-
-        //lookup vertices via getVertexForInstanceByUniqueAttributes
-        List<AtlasVertex> vertices = 
helper.getVerticesForInstancesByUniqueAttribute(dbType, instances);
-        assertEquals(instances.size(), vertices.size());
-        //assert vertex matches the vertex we get through getVertexForGUID
-        for(int i = 0; i < instances.size(); i++) {
-            String guid = guids.get(i);
-            AtlasVertex foundVertex = vertices.get(i);
-            AtlasVertex expectedVertex = helper.getVertexForGUID(guid);
-            assertEquals(foundVertex, expectedVertex);
-        }
-    }
-    @Test
-    public void testGetVerticesForGUIDSWithDuplicates() throws Exception {
-        ITypedReferenceableInstance hrDept = 
TestUtils.createDeptEg1(TypeSystem.getInstance());
-        List<String> result = 
repositoryService.createEntities(hrDept).getCreatedEntities();
-        String guid = result.get(0);
-        Map<String, AtlasVertex> verticesForGUIDs = 
GraphHelper.getInstance().getVerticesForGUIDs(Arrays.asList(guid, guid));
-        Assert.assertEquals(verticesForGUIDs.size(), 1);
-        Assert.assertTrue(verticesForGUIDs.containsKey(guid));
-    }
-    @Test
-    public void testGetCompositeGuidsAndVertices() throws Exception {
-        ITypedReferenceableInstance hrDept = 
TestUtils.createDeptEg1(typeSystem);
-        List<String> createdGuids = 
repositoryService.createEntities(hrDept).getCreatedEntities();
-        String deptGuid = null;
-        Set<String> expectedGuids = new HashSet<>();
-
-        for (String guid : createdGuids) {
-            ITypedReferenceableInstance entityDefinition = 
repositoryService.getEntityDefinition(guid);
-            expectedGuids.add(guid);
-            if 
(entityDefinition.getId().getTypeName().equals(TestUtils.DEPARTMENT_TYPE)) {
-                deptGuid = guid;
-            }
-        }
-        AtlasVertex deptVertex = 
GraphHelper.getInstance().getVertexForGUID(deptGuid);
-        Set<VertexInfo> compositeVertices = 
GraphHelper.getInstance().getCompositeVertices(deptVertex);
-        HashMap<String, VertexInfo> verticesByGuid = new HashMap<>();
-        for (VertexInfo vertexInfo: compositeVertices) {
-            verticesByGuid.put(vertexInfo.getGuid(), vertexInfo);
-        }
-
-        // Verify compositeVertices has entries for all expected guids.
-        Assert.assertEquals(compositeVertices.size(), expectedGuids.size());
-        for (String expectedGuid : expectedGuids) {
-            Assert.assertTrue(verticesByGuid.containsKey(expectedGuid));
-        }
-    }
-
-    @Test(dataProvider = "encodeDecodeTestData")
-    public void testEncodeDecode(String str, String expectedEncodedStr) throws 
Exception {
-        String encodedStr = GraphHelper.encodePropertyKey(str);
-        assertEquals(encodedStr, expectedEncodedStr);
-
-        String decodedStr = GraphHelper.decodePropertyKey(encodedStr);
-        assertEquals(decodedStr, str);
-    }
-
-    @Test
-    public void testGetOutgoingEdgesByLabel() throws Exception {
-        AtlasGraph graph = TestUtils.getGraph();
-        AtlasVertex v1 = graph.addVertex();
-        AtlasVertex v2 = graph.addVertex();
-        graph.addEdge(v1, v2, "l1");
-        graph.addEdge(v1, v2, "l2");
-
-        Iterator<AtlasEdge> iterator = 
GraphHelper.getInstance().getOutGoingEdgesByLabel(v1, "l1");
-        assertTrue(iterator.hasNext());
-        assertTrue(iterator.hasNext());
-        assertNotNull(iterator.next());
-        assertNull(iterator.next());
-        assertFalse(iterator.hasNext());
-        assertFalse(iterator.hasNext());
-    }
-
-    private ITypedReferenceableInstance convert(Referenceable instance, 
ClassType type) throws AtlasException {
-
-        return type.convert(instance, Multiplicity.REQUIRED);
-    }
-
-    private String createInstance(Referenceable entity) throws Exception {
-        TestUtils.resetRequestContext();
-
-        String entityjson = InstanceSerialization.toJson(entity, true);
-        JSONArray entitiesJson = new JSONArray();
-        entitiesJson.put(entityjson);
-        List<String> guids = 
metadataService.createEntities(entitiesJson.toString()).getCreatedEntities();
-        if (guids != null && guids.size() > 0) {
-            return guids.get(guids.size() - 1);
-        }
-        return null;
-    }
-}

Reply via email to