http://git-wip-us.apache.org/repos/asf/atlas/blob/0877e47c/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;
-    }
-}

http://git-wip-us.apache.org/repos/asf/atlas/blob/0877e47c/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
deleted file mode 100755
index 1f077ba..0000000
--- 
a/repository/src/test/java/org/apache/atlas/repository/graph/GraphRepoMapperScaleTest.java
+++ /dev/null
@@ -1,241 +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.ApplicationProperties;
-import org.apache.atlas.CreateUpdateEntitiesResult;
-import org.apache.atlas.TestModules;
-import org.apache.atlas.TestUtils;
-import org.apache.atlas.annotation.GraphTransaction;
-import org.apache.atlas.repository.Constants;
-import org.apache.atlas.repository.RepositoryException;
-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.AtlasIndexQuery;
-import org.apache.atlas.repository.graphdb.AtlasVertex;
-import org.apache.atlas.type.AtlasTypeRegistry;
-import org.apache.atlas.typesystem.ITypedReferenceableInstance;
-import org.apache.atlas.typesystem.Referenceable;
-import org.apache.atlas.typesystem.Struct;
-import org.apache.atlas.typesystem.exception.EntityExistsException;
-import org.apache.atlas.typesystem.persistence.Id;
-import org.apache.atlas.typesystem.types.ClassType;
-import org.apache.atlas.typesystem.types.IDataType;
-import org.apache.atlas.typesystem.types.Multiplicity;
-import org.apache.atlas.typesystem.types.TypeSystem;
-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.Collection;
-import java.util.Date;
-import java.util.Iterator;
-
-@Test
-@Guice(modules = TestModules.TestOnlyModule.class)
-public class GraphRepoMapperScaleTest {
-
-    private static final String DATABASE_NAME = "foo";
-    private static final String TABLE_NAME = "bar";
-
-    @Inject
-    private GraphBackedMetadataRepository repositoryService;
-
-    @Inject
-    private GraphBackedSearchIndexer searchIndexer;
-
-    private TypeSystem typeSystem = TypeSystem.getInstance();
-
-    private String dbGUID;
-
-    @BeforeClass
-    @GraphTransaction
-    public void setUp() throws Exception {
-        //force up front graph initialization
-        TestUtils.getGraph();
-        searchIndexer = new GraphBackedSearchIndexer(new AtlasGraphProvider(), 
ApplicationProperties.get(), new AtlasTypeRegistry());
-        //Make sure we can cleanup the index directory
-        Collection<IDataType> typesAdded = 
TestUtils.createHiveTypes(typeSystem);
-        searchIndexer.onAdd(typesAdded);
-    }
-
-    @BeforeMethod
-    public void setupContext() {
-        TestUtils.resetRequestContext();
-    }
-
-    @AfterClass
-    public void tearDown() throws Exception {
-        TypeSystem.getInstance().reset();
-//        AtlasGraphProvider.cleanup();
-    }
-
-    @Test
-    public void testSubmitEntity() throws Exception {
-        Referenceable databaseInstance = new 
Referenceable(TestUtils.DATABASE_TYPE);
-        databaseInstance.set("name", DATABASE_NAME);
-        databaseInstance.set("description", "foo database");
-        // System.out.println("databaseInstance = " + databaseInstance);
-
-        ClassType dbType = typeSystem.getDataType(ClassType.class, 
TestUtils.DATABASE_TYPE);
-        ITypedReferenceableInstance db = dbType.convert(databaseInstance, 
Multiplicity.REQUIRED);
-
-        dbGUID = result(db).getCreatedEntities().get(0);
-
-        Referenceable dbInstance = new Referenceable(dbGUID, 
TestUtils.DATABASE_TYPE, databaseInstance.getValuesMap());
-
-        for (int index = 0; index < 1000; index++) {
-            ITypedReferenceableInstance table = 
createHiveTableInstance(dbInstance, index);
-            result(table);
-        }
-    }
-
-    private CreateUpdateEntitiesResult result(ITypedReferenceableInstance db)
-            throws RepositoryException, EntityExistsException {
-        return repositoryService.createEntities(db);
-    }
-
-    @Test(dependsOnMethods = "testSubmitEntity")
-    public void testSearchIndex() throws Exception {
-
-        //Elasticsearch requires some time before index is updated
-        Thread.sleep(5000);
-        searchWithOutIndex(Constants.GUID_PROPERTY_KEY, dbGUID);
-        searchWithOutIndex(Constants.ENTITY_TYPE_PROPERTY_KEY, "column_type");
-        searchWithOutIndex(Constants.ENTITY_TYPE_PROPERTY_KEY, 
TestUtils.TABLE_TYPE);
-
-        searchWithOutIndex("hive_table.name", "bar-999");
-        searchWithIndex("hive_table.name", "bar-999");
-        searchWithIndex("hive_table.created", 
ComparisionOperator.GREATER_THAN_EQUAL, TestUtils.TEST_DATE_IN_LONG, 1000);
-
-        for (int index = 500; index < 600; index++) {
-            searchWithIndex("hive_table.name", "bar-" + index);
-        }
-
-        searchWithIndex(Constants.STATE_PROPERTY_KEY, 
Id.EntityState.ACTIVE.name());
-    }
-
-    private void searchWithOutIndex(String key, String value) {
-        AtlasGraph graph = TestUtils.getGraph();
-        long start = System.currentTimeMillis();
-        int count = 0;
-        try {
-            AtlasGraphQuery query = graph.query().has(key, 
ComparisionOperator.EQUAL, value);
-            Iterable<AtlasVertex> result = query.vertices();
-            for (AtlasVertex ignored : result) {
-                count++;
-            }
-        } finally {
-            System.out.println("Search on [" + key + "=" + value + "] returned 
results: " + count + ", took " + (
-                    System.currentTimeMillis() - start) + " ms");
-        }
-    }
-
-
-    private void searchWithIndex(String key, String value) {
-        AtlasGraph graph = TestUtils.getGraph();
-        long start = System.currentTimeMillis();
-        int count = 0;
-        try {
-            String queryString = "v.\"" + key + "\":(" + value + ")";
-            AtlasIndexQuery query = graph.indexQuery(Constants.VERTEX_INDEX, 
queryString);
-            Iterator<AtlasIndexQuery.Result> result = query.vertices();
-            while(result.hasNext()) {
-                result.next();
-                count++;
-            }
-        } finally {
-            System.out.println("Search on [" + key + "=" + value + "] returned 
results: " + count + ", took " + (
-                    System.currentTimeMillis() - start) + " ms");
-        }
-    }
-    
-    private void searchWithIndex(String key, ComparisionOperator op, Object 
value, int expectedResults) {
-        AtlasGraph graph = TestUtils.getGraph();
-        long start = System.currentTimeMillis();
-        int count = 0;
-        try {
-            AtlasGraphQuery query = graph.query().has(key, op, value);
-            Iterable<AtlasVertex> itrble = query.vertices();
-            for (AtlasVertex ignored : itrble) {
-                count++;
-            }
-        } finally {
-            System.out.println("Search on [" + key + "=" + value + "] returned 
results: " + count + ", took " + (
-                    System.currentTimeMillis() - start) + " ms");
-            Assert.assertEquals(count, expectedResults);
-        }
-    }
-
-    private ITypedReferenceableInstance createHiveTableInstance(Referenceable 
databaseInstance, int uberIndex)
-    throws Exception {
-
-        Referenceable tableInstance = new Referenceable(TestUtils.TABLE_TYPE);
-        tableInstance.set("name", TABLE_NAME + "-" + uberIndex);
-        tableInstance.set("description", "bar table" + "-" + uberIndex);
-        tableInstance.set("type", "managed");
-        tableInstance.set("created", new Date(TestUtils.TEST_DATE_IN_LONG));
-        tableInstance.set("tableType", 1); // enum
-
-        // refer to an existing class
-        tableInstance.set("database", databaseInstance);
-
-        ArrayList<String> columnNames = new ArrayList<>();
-        columnNames.add("first_name" + "-" + uberIndex);
-        columnNames.add("last_name" + "-" + uberIndex);
-        tableInstance.set("columnNames", columnNames);
-
-        Struct serde1Instance = new Struct("serdeType");
-        serde1Instance.set("name", "serde1" + "-" + uberIndex);
-        serde1Instance.set("serde", "serde1" + "-" + uberIndex);
-        tableInstance.set("serde1", serde1Instance);
-
-        Struct serde2Instance = new Struct("serdeType");
-        serde2Instance.set("name", "serde2" + "-" + uberIndex);
-        serde2Instance.set("serde", "serde2" + "-" + uberIndex);
-        tableInstance.set("serde2", serde2Instance);
-
-        ArrayList<Referenceable> columns = new ArrayList<>();
-        for (int index = 0; index < 5; index++) {
-            Referenceable columnInstance = new Referenceable("column_type");
-            columnInstance.set("name", "column_" + "-" + uberIndex + "-" + 
index);
-            columnInstance.set("type", "string");
-            columns.add(columnInstance);
-        }
-        tableInstance.set("columns", columns);
-
-        ArrayList<Struct> partitions = new ArrayList<>();
-        for (int index = 0; index < 5; index++) {
-            Struct partitionInstance = new 
Struct(TestUtils.PARTITION_STRUCT_TYPE);
-            partitionInstance.set("name", "partition_" + "-" + uberIndex + "-" 
+ index);
-            partitions.add(partitionInstance);
-        }
-        tableInstance.set("partitions", partitions);
-
-        ClassType tableType = typeSystem.getDataType(ClassType.class, 
TestUtils.TABLE_TYPE);
-        return tableType.convert(tableInstance, Multiplicity.REQUIRED);
-    }
-}
-

http://git-wip-us.apache.org/repos/asf/atlas/blob/0877e47c/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
deleted file mode 100644
index 8f638a0..0000000
--- 
a/repository/src/test/java/org/apache/atlas/repository/graph/Gremlin2QueryOptimizerTest.java
+++ /dev/null
@@ -1,364 +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.gremlin.Gremlin2ExpressionFactory;
-import org.apache.atlas.gremlin.GremlinExpressionFactory;
-import org.testng.annotations.Test;
-
-
-@Test
-public class Gremlin2QueryOptimizerTest extends 
AbstractGremlinQueryOptimizerTest {
-    private static GremlinExpressionFactory FACTORY = null;
-
-    @Override
-    protected GremlinExpressionFactory getFactory() {
-        if (null == FACTORY) {
-            FACTORY = new Gremlin2ExpressionFactory();
-        }
-        return FACTORY;
-    }
-
-    @Override
-    protected String getExpectedGremlinForTestPullHasExpressionsOutOfHas() {
-        return 
"g.V().has('prop1',T.'eq','Fred').has('prop2',T.'eq','George').and(out('out1'),out('out2'))";
-    }
-
-    @Override
-    protected String getExpectedGremlinForTestOrGrouping() {
-        return "def r=(([]) as Set);"
-                + "g.V().has('prop1',T.'eq','Fred').fill(r);"
-                + "g.V().has('prop2',T.'eq','George').fill(r);"
-                + "g.V().or(out('out1'),out('out2')).fill(r);"
-                + "r";
-    }
-
-    @Override
-    protected String getExpectedGremlinForTestAndOfOrs() {
-        return  "def r=(([]) as Set);"
-                + "g.V().has('p1',T.'eq','e1').has('p3',T.'eq','e3').fill(r);"
-                + "g.V().has('p1',T.'eq','e1').has('p4',T.'eq','e4').fill(r);"
-                + "g.V().has('p2',T.'eq','e2').has('p3',T.'eq','e3').fill(r);"
-                + "g.V().has('p2',T.'eq','e2').has('p4',T.'eq','e4').fill(r);"
-                + "r";
-    }
-
-
-    @Override
-    protected String getExpectedGremlinForTestAndWithMultiCallArguments() {
-        return 
"g.V().has('p1',T.'eq','e1').has('p2',T.'eq','e2').has('p3',T.'eq','e3').has('p4',T.'eq','e4')";
-    }
-
-    @Override
-    protected String getExpectedGremlinForTestOrOfAnds() {
-
-        return "def r=(([]) as Set);"
-                + "g.V().has('p1',T.'eq','e1').has('p2',T.'eq','e2').fill(r);"
-                + "g.V().has('p3',T.'eq','e3').has('p4',T.'eq','e4').fill(r);"
-                + "r";
-    }
-
-    @Override
-    protected String getExpectedGremlinForTestHasNotMovedToResult() {
-        return "def r=(([]) as Set);"
-                + "def f1={GremlinPipeline 
x->x.has('p3',T.'eq','e3').as('_src').select(['_src']).fill(r)};"
-                + "f1(g.V().has('p1',T.'eq','e1'));"
-                + "f1(g.V().has('p2',T.'eq','e2'));"
-                + 
"r._().transform({((Row)it).getColumn('_src')}).as('_src').select(['src1'],{it})";
-    }
-
-    @Override
-    protected String getExpectedGremlinForOptimizeLoopExpression() {
-        return "def r=(([]) as Set);"
-                + 
"g.V().has('__typeName','DataSet').has('name',T.'eq','Fred').fill(r);"
-                + 
"g.V().has('__superTypeNames','DataSet').has('name',T.'eq','Fred').fill(r);"
-                + 
"r._().as('label').in('inputTables').out('outputTables').loop('label',{((it.'path'.contains(it.'object'))?(false):(true))},{it.'object'.'__typeName'
 == 'string' || 
((it.'object'.'__superTypeNames')?(it.'object'.'__superTypeNames'.contains('string')):(false))}).enablePath().toList()";
-    }
-
-
-    @Override
-    protected String getExpectedGremlinForTestLongStringEndingWithOr() {
-        return "def r=(([]) as Set);"
-                + "def 
f1={g.V().has('name',T.'eq','Fred').has('age',T.'eq','13').out('livesIn').has('state',T.'eq','Massachusetts')};"
-                + "def f2={GremlinPipeline 
x->x.has('p5',T.'eq','e5').has('p6',T.'eq','e6')};"
-                + 
"f2(f1().has('p1',T.'eq','e1').has('p3',T.'eq','e3')).has('p7',T.'eq','e7').fill(r);"
-                + 
"f2(f1().has('p1',T.'eq','e1').has('p3',T.'eq','e3')).has('p8',T.'eq','e8').fill(r);"
-                + 
"f2(f1().has('p1',T.'eq','e1').has('p4',T.'eq','e4')).has('p7',T.'eq','e7').fill(r);"
-                + 
"f2(f1().has('p1',T.'eq','e1').has('p4',T.'eq','e4')).has('p8',T.'eq','e8').fill(r);"
-                + 
"f2(f1().has('p2',T.'eq','e2').has('p3',T.'eq','e3')).has('p7',T.'eq','e7').fill(r);"
-                + 
"f2(f1().has('p2',T.'eq','e2').has('p3',T.'eq','e3')).has('p8',T.'eq','e8').fill(r);"
-                + 
"f2(f1().has('p2',T.'eq','e2').has('p4',T.'eq','e4')).has('p7',T.'eq','e7').fill(r);"
-                + 
"f2(f1().has('p2',T.'eq','e2').has('p4',T.'eq','e4')).has('p8',T.'eq','e8').fill(r);"
-                + "r";
-    }
-
-    @Override
-    protected String getExpectedGremlinForTestLongStringNotEndingWithOr() {
-        return "def r=(([]) as Set);"
-                + "def 
f1={g.V().has('name',T.'eq','Fred').has('age',T.'eq','13').out('livesIn').has('state',T.'eq','Massachusetts')};"
-                + "def f2={GremlinPipeline 
x->x.has('p5',T.'eq','e5').has('p6',T.'eq','e6')};"
-                + "def f3={GremlinPipeline 
x->x.has('p9',T.'eq','e9').fill(r)};"
-                + 
"f3(f2(f1().has('p1',T.'eq','e1').has('p3',T.'eq','e3')).has('p7',T.'eq','e7'));"
-                + 
"f3(f2(f1().has('p1',T.'eq','e1').has('p3',T.'eq','e3')).has('p8',T.'eq','e8'));"
-                + 
"f3(f2(f1().has('p1',T.'eq','e1').has('p4',T.'eq','e4')).has('p7',T.'eq','e7'));"
-                + 
"f3(f2(f1().has('p1',T.'eq','e1').has('p4',T.'eq','e4')).has('p8',T.'eq','e8'));"
-                + 
"f3(f2(f1().has('p2',T.'eq','e2').has('p3',T.'eq','e3')).has('p7',T.'eq','e7'));"
-                + 
"f3(f2(f1().has('p2',T.'eq','e2').has('p3',T.'eq','e3')).has('p8',T.'eq','e8'));"
-                + 
"f3(f2(f1().has('p2',T.'eq','e2').has('p4',T.'eq','e4')).has('p7',T.'eq','e7'));"
-                + 
"f3(f2(f1().has('p2',T.'eq','e2').has('p4',T.'eq','e4')).has('p8',T.'eq','e8'));"
-                + "r";
-    }
-
-    @Override
-    protected String getExpectedGremlinForTestToListConversion() {
-        return "def r=(([]) as Set);"
-                + "g.V().has('prop1',T.'eq','Fred').fill(r);"
-                + "g.V().has('prop2',T.'eq','George').fill(r);"
-                + "r._().toList()";
-    }
-
-    @Override
-    protected String getExpectedGremlinForTestToListWithExtraStuff() {
-        return "def r=(([]) as Set);"
-                + "g.V().has('prop1',T.'eq','Fred').fill(r);"
-                + "g.V().has('prop2',T.'eq','George').fill(r);"
-                + "r._().toList().size()";
-    }
-
-
-    @Override
-    protected String 
getExpectedGremlinForTestAddClosureWithExitExpressionDifferentFromExpr() {
-        return "def r=(([]) as Set);"
-                + 
"g.V().has('prop1',T.'eq','Fred').out('knows').out('livesIn').fill(r);"
-                + 
"g.V().has('prop2',T.'eq','George').out('knows').out('livesIn').fill(r);"
-                + "r._().toList().size()";
-    }
-
-    @Override
-    protected String getExpectedGremlinForTestAddClosureNoExitExpression() {
-        return "def r=(([]) as Set);"
-                + 
"g.V().has('prop1',T.'eq','Fred').out('knows').out('livesIn').fill(r);"
-                + 
"g.V().has('prop2',T.'eq','George').out('knows').out('livesIn').fill(r);"
-                + "r";
-    }
-
-    @Override
-    protected String 
getExpectedGremlinForTestAddClosureWithExitExpressionEqualToExpr() {
-        return "def r=(([]) as Set);"
-                + 
"g.V().has('prop1',T.'eq','Fred').out('knows').out('livesIn').fill(r);"
-                + 
"g.V().has('prop2',T.'eq','George').out('knows').out('livesIn').fill(r);"
-                + "r._().toList()";
-    }
-
-    @Override
-    protected String getExpectedGremlinForTestClosureNotCreatedWhenNoOrs() {
-        return 
"g.V().has('prop1',T.'eq','Fred').has('prop2',T.'eq','George').out('knows').out('livesIn')";
-    }
-
-    @Override
-    protected String getExpectedGremlinForTestOrFollowedByAnd() {
-        return "def r=(([]) as Set);"
-                + "def f1={GremlinPipeline 
x->x.has('age',T.'eq','13').has('age',T.'eq','14').fill(r)};"
-                + "f1(g.V().has('name',T.'eq','Fred'));"
-                + "f1(g.V().has('name',T.'eq','George'));"
-                + "r";
-    }
-
-    @Override
-    protected String getExpectedGremlinForTestOrFollowedByOr() {
-        return "def r=(([]) as Set);"
-                + 
"g.V().has('name',T.'eq','Fred').has('age',T.'eq','13').fill(r);"
-                + 
"g.V().has('name',T.'eq','Fred').has('age',T.'eq','14').fill(r);"
-                + 
"g.V().has('name',T.'eq','George').has('age',T.'eq','13').fill(r);"
-                + 
"g.V().has('name',T.'eq','George').has('age',T.'eq','14').fill(r);"
-                + "r";
-    }
-
-    @Override
-    protected String getExpectedGremlinForTestMassiveOrExpansion() {
-        return "def r=(([]) as Set);"
-                + "def f1={g.V().has('h1',T.'eq','h2').has('h3',T.'eq','h4')};"
-                + "def f2={GremlinPipeline 
x->x.has('ha0',T.'eq','hb0').has('hc0',T.'eq','hd0')};"
-                + "def f3={GremlinPipeline 
x->x.has('ha1',T.'eq','hb1').has('hc1',T.'eq','hd1')};"
-                + "def f4={GremlinPipeline 
x->x.has('ha2',T.'eq','hb2').has('hc2',T.'eq','hd2')};"
-                + "def f5={GremlinPipeline 
x->x.has('ha3',T.'eq','hb3').has('hc3',T.'eq','hd3')};"
-                + "def f6={GremlinPipeline 
x->x.has('ha4',T.'eq','hb4').has('hc4',T.'eq','hd4').has('h5',T.'eq','h6').has('h7',T.'eq','h8').fill(r)};"
-                + 
"f6(f5(f4(f3(f2(f1().has('p10',T.'eq','e10')).has('p11',T.'eq','e11')).has('p12',T.'eq','e12')).has('p13',T.'eq','e13')).has('p14',T.'eq','e14'));"
-                + 
"f6(f5(f4(f3(f2(f1().has('p10',T.'eq','e10')).has('p11',T.'eq','e11')).has('p12',T.'eq','e12')).has('p13',T.'eq','e13')).has('p24',T.'eq','e24'));"
-                + 
"f6(f5(f4(f3(f2(f1().has('p10',T.'eq','e10')).has('p11',T.'eq','e11')).has('p12',T.'eq','e12')).has('p23',T.'eq','e23')).has('p14',T.'eq','e14'));"
-                + 
"f6(f5(f4(f3(f2(f1().has('p10',T.'eq','e10')).has('p11',T.'eq','e11')).has('p12',T.'eq','e12')).has('p23',T.'eq','e23')).has('p24',T.'eq','e24'));"
-                + 
"f6(f5(f4(f3(f2(f1().has('p10',T.'eq','e10')).has('p11',T.'eq','e11')).has('p22',T.'eq','e22')).has('p13',T.'eq','e13')).has('p14',T.'eq','e14'));"
-                + 
"f6(f5(f4(f3(f2(f1().has('p10',T.'eq','e10')).has('p11',T.'eq','e11')).has('p22',T.'eq','e22')).has('p13',T.'eq','e13')).has('p24',T.'eq','e24'));"
-                + 
"f6(f5(f4(f3(f2(f1().has('p10',T.'eq','e10')).has('p11',T.'eq','e11')).has('p22',T.'eq','e22')).has('p23',T.'eq','e23')).has('p14',T.'eq','e14'));"
-                + 
"f6(f5(f4(f3(f2(f1().has('p10',T.'eq','e10')).has('p11',T.'eq','e11')).has('p22',T.'eq','e22')).has('p23',T.'eq','e23')).has('p24',T.'eq','e24'));"
-                + 
"f6(f5(f4(f3(f2(f1().has('p10',T.'eq','e10')).has('p21',T.'eq','e21')).has('p12',T.'eq','e12')).has('p13',T.'eq','e13')).has('p14',T.'eq','e14'));"
-                + 
"f6(f5(f4(f3(f2(f1().has('p10',T.'eq','e10')).has('p21',T.'eq','e21')).has('p12',T.'eq','e12')).has('p13',T.'eq','e13')).has('p24',T.'eq','e24'));"
-                + 
"f6(f5(f4(f3(f2(f1().has('p10',T.'eq','e10')).has('p21',T.'eq','e21')).has('p12',T.'eq','e12')).has('p23',T.'eq','e23')).has('p14',T.'eq','e14'));"
-                + 
"f6(f5(f4(f3(f2(f1().has('p10',T.'eq','e10')).has('p21',T.'eq','e21')).has('p12',T.'eq','e12')).has('p23',T.'eq','e23')).has('p24',T.'eq','e24'));"
-                + 
"f6(f5(f4(f3(f2(f1().has('p10',T.'eq','e10')).has('p21',T.'eq','e21')).has('p22',T.'eq','e22')).has('p13',T.'eq','e13')).has('p14',T.'eq','e14'));"
-                + 
"f6(f5(f4(f3(f2(f1().has('p10',T.'eq','e10')).has('p21',T.'eq','e21')).has('p22',T.'eq','e22')).has('p13',T.'eq','e13')).has('p24',T.'eq','e24'));"
-                + 
"f6(f5(f4(f3(f2(f1().has('p10',T.'eq','e10')).has('p21',T.'eq','e21')).has('p22',T.'eq','e22')).has('p23',T.'eq','e23')).has('p14',T.'eq','e14'));"
-                + 
"f6(f5(f4(f3(f2(f1().has('p10',T.'eq','e10')).has('p21',T.'eq','e21')).has('p22',T.'eq','e22')).has('p23',T.'eq','e23')).has('p24',T.'eq','e24'));"
-                + 
"f6(f5(f4(f3(f2(f1().has('p20',T.'eq','e20')).has('p11',T.'eq','e11')).has('p12',T.'eq','e12')).has('p13',T.'eq','e13')).has('p14',T.'eq','e14'));"
-                + 
"f6(f5(f4(f3(f2(f1().has('p20',T.'eq','e20')).has('p11',T.'eq','e11')).has('p12',T.'eq','e12')).has('p13',T.'eq','e13')).has('p24',T.'eq','e24'));"
-                + 
"f6(f5(f4(f3(f2(f1().has('p20',T.'eq','e20')).has('p11',T.'eq','e11')).has('p12',T.'eq','e12')).has('p23',T.'eq','e23')).has('p14',T.'eq','e14'));"
-                + 
"f6(f5(f4(f3(f2(f1().has('p20',T.'eq','e20')).has('p11',T.'eq','e11')).has('p12',T.'eq','e12')).has('p23',T.'eq','e23')).has('p24',T.'eq','e24'));"
-                + 
"f6(f5(f4(f3(f2(f1().has('p20',T.'eq','e20')).has('p11',T.'eq','e11')).has('p22',T.'eq','e22')).has('p13',T.'eq','e13')).has('p14',T.'eq','e14'));"
-                + 
"f6(f5(f4(f3(f2(f1().has('p20',T.'eq','e20')).has('p11',T.'eq','e11')).has('p22',T.'eq','e22')).has('p13',T.'eq','e13')).has('p24',T.'eq','e24'));"
-                + 
"f6(f5(f4(f3(f2(f1().has('p20',T.'eq','e20')).has('p11',T.'eq','e11')).has('p22',T.'eq','e22')).has('p23',T.'eq','e23')).has('p14',T.'eq','e14'));"
-                + 
"f6(f5(f4(f3(f2(f1().has('p20',T.'eq','e20')).has('p11',T.'eq','e11')).has('p22',T.'eq','e22')).has('p23',T.'eq','e23')).has('p24',T.'eq','e24'));"
-                + 
"f6(f5(f4(f3(f2(f1().has('p20',T.'eq','e20')).has('p21',T.'eq','e21')).has('p12',T.'eq','e12')).has('p13',T.'eq','e13')).has('p14',T.'eq','e14'));"
-                + 
"f6(f5(f4(f3(f2(f1().has('p20',T.'eq','e20')).has('p21',T.'eq','e21')).has('p12',T.'eq','e12')).has('p13',T.'eq','e13')).has('p24',T.'eq','e24'));"
-                + 
"f6(f5(f4(f3(f2(f1().has('p20',T.'eq','e20')).has('p21',T.'eq','e21')).has('p12',T.'eq','e12')).has('p23',T.'eq','e23')).has('p14',T.'eq','e14'));"
-                + 
"f6(f5(f4(f3(f2(f1().has('p20',T.'eq','e20')).has('p21',T.'eq','e21')).has('p12',T.'eq','e12')).has('p23',T.'eq','e23')).has('p24',T.'eq','e24'));"
-                + 
"f6(f5(f4(f3(f2(f1().has('p20',T.'eq','e20')).has('p21',T.'eq','e21')).has('p22',T.'eq','e22')).has('p13',T.'eq','e13')).has('p14',T.'eq','e14'));"
-                + 
"f6(f5(f4(f3(f2(f1().has('p20',T.'eq','e20')).has('p21',T.'eq','e21')).has('p22',T.'eq','e22')).has('p13',T.'eq','e13')).has('p24',T.'eq','e24'));"
-                + 
"f6(f5(f4(f3(f2(f1().has('p20',T.'eq','e20')).has('p21',T.'eq','e21')).has('p22',T.'eq','e22')).has('p23',T.'eq','e23')).has('p14',T.'eq','e14'));"
-                + 
"f6(f5(f4(f3(f2(f1().has('p20',T.'eq','e20')).has('p21',T.'eq','e21')).has('p22',T.'eq','e22')).has('p23',T.'eq','e23')).has('p24',T.'eq','e24'));"
-                + "r";
-
-    }
-
-    @Override
-    protected String getExpectedGremlinForTestAndFollowedByAnd() {
-        return 
"g.V().has('name',T.'eq','Fred').has('name',T.'eq','George').has('age',T.'eq','13').has('age',T.'eq','14')";
-
-    }
-
-    @Override
-    protected String getExpectedGremlinForTestAndFollowedByOr() {
-        return "def r=(([]) as Set);"
-                + "def 
f1={g.V().has('name',T.'eq','Fred').has('name',T.'eq','George')};f1().has('age',T.'eq','13').fill(r);"
-                + "f1().has('age',T.'eq','14').fill(r);"
-                + "r";
-    }
-
-    @Override
-    protected String getExpectedGremlinForTestInitialAlias() {
-        return "def r=(([]) as Set);"
-                + "g.V().as('x').has('name',T.'eq','Fred').fill(r);"
-                + "g.V().as('x').has('name',T.'eq','George').fill(r);"
-                + "r";
-    }
-
-    @Override
-    protected String getExpectedGremlinForTestFinalAlias() {
-        return "def r=(([]) as Set);"
-                + "g.V().has('name',T.'eq','Fred').as('x').fill(r);"
-                + "g.V().has('name',T.'eq','George').as('x').fill(r);"
-                + "r";
-    }
-
-    @Override
-    protected String getExpectedGremlinForTestAliasInMiddle() {
-        return "def r=(([]) as Set);"
-                + 
"g.V().has('name',T.'eq','Fred').as('x').has('age',T.'eq','13').fill(r);"
-                + 
"g.V().has('name',T.'eq','Fred').as('x').has('age',T.'eq','14').fill(r);"
-                + 
"g.V().has('name',T.'eq','George').as('x').has('age',T.'eq','13').fill(r);"
-                + 
"g.V().has('name',T.'eq','George').as('x').has('age',T.'eq','14').fill(r);"
-                + "r";
-    }
-
-    @Override
-    protected String getExpectedGreminForTestMultipleAliases() {
-        return "def r=(([]) as Set);"
-                + "def f1={GremlinPipeline x->x.as('y').fill(r)};"
-                + 
"f1(g.V().has('name',T.'eq','Fred').as('x').has('age',T.'eq','13'));"
-                + 
"f1(g.V().has('name',T.'eq','Fred').as('x').has('age',T.'eq','14'));"
-                + 
"f1(g.V().has('name',T.'eq','George').as('x').has('age',T.'eq','13'));"
-                + 
"f1(g.V().has('name',T.'eq','George').as('x').has('age',T.'eq','14'));"
-                + "r";
-    }
-
-
-    @Override
-    protected String getExpectedGremlinForTestAliasInOrExpr() {
-        return "def r=(([]) as Set);"
-                + "g.V().has('name',T.'eq','Fred').fill(r);"
-                + "g.V().or(has('name',T.'eq','George').as('george')).fill(r);"
-                + "r";
-    }
-
-    @Override
-    protected String getExpectedGremlinForTestAliasInAndExpr() {
-        return 
"g.V().has('name',T.'eq','Fred').and(has('name',T.'eq','George').as('george'))";
-    }
-    @Override
-    protected String getExpectedGremlinForTestFlatMapExprInAnd() {
-        return 
"g.V().has('name',T.'eq','Fred').and(out('knows').has('name',T.'eq','George'))";
-    }
-
-    @Override
-    protected String getExpectedGremlinForTestFlatMapExprInOr() {
-        return "def r=(([]) as Set);"
-                + "g.V().has('name',T.'eq','Fred').fill(r);"
-                + "g.V().or(out('knows').has('name',T.'eq','George')).fill(r);"
-                + "r";
-    }
-
-
-    @Override
-    protected String 
getExpectedGremlinForTestFieldExpressionPushedToResultExpression() {
-        return "def r=(([]) as Set);"
-                + "g.V().has('name',T.'eq','Fred').fill(r);"
-                + "g.V().or(out('knows').has('name',T.'eq','George')).fill(r);"
-                + "r._().'name'";
-    }
-
-    @Override
-    protected String getExpectedGremlinFortestOrWithNoChildren() {
-        return "def r=(([]) as Set);"
-                + "r";
-    }
-
-    @Override
-    protected String getExpectedGremlinForTestFinalAliasNeeded() {
-        return "def r=(([]) as Set);"
-                + "def 
f1={g.V().has('name',T.'eq','Fred').as('person').out('livesIn')};"
-                + "def f2={GremlinPipeline 
x->x.as('city').out('state').has('name',T.'eq','Massachusetts').as('__res').select(['person',
 'city', '__res']).fill(r)};"
-                + "f2(f1().has('name',T.'eq','Chicago'));"
-                + "f2(f1().has('name',T.'eq','Boston'));"
-                + 
"r._().as('__tmp').transform({((Row)it).getColumn('person')}).as('person').back('__tmp').transform({((Row)it).getColumn('city')}).as('city').back('__tmp').transform({((Row)it).getColumn('__res')}).as('__res').path().toList().collect({it.tail()})";
-    }
-
-    @Override
-    protected String getExpectedGremlinForTestSimpleRangeExpression() {
-        return "def r=(([]) as Set);"
-                + "def f1={GremlinPipeline 
x->x.has('age',T.'eq','34').out('eats').has('size',T.'eq','small').has('color',T.'eq','blue')
 [0..<10].fill(r)};"
-                + "f1(g.V().has('name',T.'eq','Fred'));"
-                + "f1(g.V().has('name',T.'eq','George'));"
-                + "r._() [0..<10].toList().size()";
-    }
-
-    @Override
-    protected String getExpectedGremlinForTestRangeWithNonZeroOffset() {
-        return "def r=(([]) as Set);"
-                + "g.V().has('__typeName',T.'eq','OMAS_OMRSAsset').fill(r);"
-                + 
"g.V().has('__superTypeNames',T.'eq','OMAS_OMRSAsset').fill(r);"
-                + "r._() [5..<10].as('inst').select(['inst'])";
-    }
-
-    @Override
-    protected String getExpectedGremlinForTestRangeWithOrderBy() {
-        return "def r=(([]) as Set);"
-                + "g.V().has('__typeName',T.'eq','OMAS_OMRSAsset').fill(r);"
-                + 
"g.V().has('__superTypeNames',T.'eq','OMAS_OMRSAsset').fill(r);"
-                + "r._() [5..<10].as('inst').order({((it.'name' != 
null)?(it.'name'.toLowerCase()):(it.'name')) <=> ((it.'name' != 
null)?(it.'name'.toLowerCase()):(it.'name'))})";
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/atlas/blob/0877e47c/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
deleted file mode 100644
index 47dff14..0000000
--- 
a/repository/src/test/java/org/apache/atlas/repository/graph/Gremlin3QueryOptimizerTest.java
+++ /dev/null
@@ -1,367 +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.gremlin.Gremlin3ExpressionFactory;
-import org.apache.atlas.gremlin.GremlinExpressionFactory;
-import org.testng.annotations.Test;
-
-
-@Test
-public class Gremlin3QueryOptimizerTest extends 
AbstractGremlinQueryOptimizerTest {
-
-    public static GremlinExpressionFactory FACTORY = null;
-
-    @Override
-    protected GremlinExpressionFactory getFactory() {
-        if (null == FACTORY) {
-            FACTORY = new Gremlin3ExpressionFactory();
-        }
-        return FACTORY;
-    }
-
-    @Override
-    protected String getExpectedGremlinForTestPullHasExpressionsOutOfHas() {
-        return 
"g.V().has('prop1',eq('Fred')).has('prop2',eq('George')).and(out('out1'),out('out2'))";
-    }
-
-    @Override
-    protected String getExpectedGremlinForTestOrGrouping() {
-        return "def r=(([]) as Set);"
-                + "g.V().has('prop1',eq('Fred')).fill(r);"
-                + "g.V().has('prop2',eq('George')).fill(r);"
-                + "g.V().or(out('out1'),out('out2')).fill(r);"
-                + "r";
-    }
-
-    @Override
-    protected String getExpectedGremlinForTestAndOfOrs() {
-
-        return "def r=(([]) as Set);"
-                + "g.V().has('p1',eq('e1')).has('p3',eq('e3')).fill(r);"
-                + "g.V().has('p1',eq('e1')).has('p4',eq('e4')).fill(r);"
-                + "g.V().has('p2',eq('e2')).has('p3',eq('e3')).fill(r);"
-                + "g.V().has('p2',eq('e2')).has('p4',eq('e4')).fill(r);"
-                + "r";
-    }
-
-    @Override
-    protected String getExpectedGremlinForTestAndWithMultiCallArguments() {
-
-        return 
"g.V().has('p1',eq('e1')).has('p2',eq('e2')).has('p3',eq('e3')).has('p4',eq('e4'))";
-    }
-
-    @Override
-    protected String getExpectedGremlinForTestOrOfAnds() {
-        return  "def r=(([]) as Set);"
-                + "g.V().has('p1',eq('e1')).has('p2',eq('e2')).fill(r);"
-                + "g.V().has('p3',eq('e3')).has('p4',eq('e4')).fill(r);"
-                + "r";
-    }
-
-    @Override
-    protected String getExpectedGremlinForTestHasNotMovedToResult() {
-        return "def r=(([]) as Set);"
-                + "def f1={GraphTraversal 
x->x.has('p3',eq('e3')).as('_src').select('_src').fill(r)};"
-                + "f1(g.V().has('p1',eq('e1')));f1(g.V().has('p2',eq('e2')));"
-                + "g.V('').inject(((r) as 
Vertex[])).as('_src').select('src1').by((({it}) as Function))";
-    }
-
-
-    @Override
-    protected String getExpectedGremlinForTestLongStringEndingWithOr() {
-        return "def r=(([]) as Set);"
-                + "def 
f1={g.V().has('name',eq('Fred')).has('age',eq('13')).out('livesIn').has('state',eq('Massachusetts'))};"
-                + "def f2={GraphTraversal 
x->x.has('p5',eq('e5')).has('p6',eq('e6'))};"
-                + 
"f2(f1().has('p1',eq('e1')).has('p3',eq('e3'))).has('p7',eq('e7')).fill(r);"
-                + 
"f2(f1().has('p1',eq('e1')).has('p3',eq('e3'))).has('p8',eq('e8')).fill(r);"
-                + 
"f2(f1().has('p1',eq('e1')).has('p4',eq('e4'))).has('p7',eq('e7')).fill(r);"
-                + 
"f2(f1().has('p1',eq('e1')).has('p4',eq('e4'))).has('p8',eq('e8')).fill(r);"
-                + 
"f2(f1().has('p2',eq('e2')).has('p3',eq('e3'))).has('p7',eq('e7')).fill(r);"
-                + 
"f2(f1().has('p2',eq('e2')).has('p3',eq('e3'))).has('p8',eq('e8')).fill(r);"
-                + 
"f2(f1().has('p2',eq('e2')).has('p4',eq('e4'))).has('p7',eq('e7')).fill(r);"
-                + 
"f2(f1().has('p2',eq('e2')).has('p4',eq('e4'))).has('p8',eq('e8')).fill(r);"
-                + "r";
-    }
-
-    @Override
-    protected String getExpectedGremlinForTestLongStringNotEndingWithOr() {
-        return "def r=(([]) as Set);"
-                + "def 
f1={g.V().has('name',eq('Fred')).has('age',eq('13')).out('livesIn').has('state',eq('Massachusetts'))};"
-                + "def f2={GraphTraversal 
x->x.has('p5',eq('e5')).has('p6',eq('e6'))};"
-                + "def f3={GraphTraversal x->x.has('p9',eq('e9')).fill(r)};"
-                + 
"f3(f2(f1().has('p1',eq('e1')).has('p3',eq('e3'))).has('p7',eq('e7')));"
-                + 
"f3(f2(f1().has('p1',eq('e1')).has('p3',eq('e3'))).has('p8',eq('e8')));"
-                + 
"f3(f2(f1().has('p1',eq('e1')).has('p4',eq('e4'))).has('p7',eq('e7')));"
-                + 
"f3(f2(f1().has('p1',eq('e1')).has('p4',eq('e4'))).has('p8',eq('e8')));"
-                + 
"f3(f2(f1().has('p2',eq('e2')).has('p3',eq('e3'))).has('p7',eq('e7')));"
-                + 
"f3(f2(f1().has('p2',eq('e2')).has('p3',eq('e3'))).has('p8',eq('e8')));"
-                + 
"f3(f2(f1().has('p2',eq('e2')).has('p4',eq('e4'))).has('p7',eq('e7')));"
-                + 
"f3(f2(f1().has('p2',eq('e2')).has('p4',eq('e4'))).has('p8',eq('e8')));"
-                + "r";
-    }
-
-    @Override
-    protected String getExpectedGremlinForTestToListConversion() {
-
-        return "def r=(([]) as Set);"
-                + "g.V().has('prop1',eq('Fred')).fill(r);"
-                + "g.V().has('prop2',eq('George')).fill(r);"
-                + "g.V('').inject(((r) as Vertex[])).toList()";
-    }
-
-
-    @Override
-    protected String getExpectedGremlinForTestToListWithExtraStuff() {
-        return "def r=(([]) as Set);"
-                + "g.V().has('prop1',eq('Fred')).fill(r);"
-                + "g.V().has('prop2',eq('George')).fill(r);"
-                + "g.V('').inject(((r) as Vertex[])).toList().size()";
-    }
-
-
-    @Override
-    protected String 
getExpectedGremlinForTestAddClosureWithExitExpressionDifferentFromExpr() {
-        return "def r=(([]) as Set);"
-                + 
"g.V().has('prop1',eq('Fred')).out('knows').out('livesIn').fill(r);"
-                + 
"g.V().has('prop2',eq('George')).out('knows').out('livesIn').fill(r);"
-                + "g.V('').inject(((r) as Vertex[])).toList().size()";
-    }
-
-    @Override
-    protected String getExpectedGremlinForTestAddClosureNoExitExpression() {
-        return "def r=(([]) as Set);"
-                + 
"g.V().has('prop1',eq('Fred')).out('knows').out('livesIn').fill(r);"
-                + 
"g.V().has('prop2',eq('George')).out('knows').out('livesIn').fill(r);"
-                + "r";
-    }
-
-    @Override
-    protected String 
getExpectedGremlinForTestAddClosureWithExitExpressionEqualToExpr() {
-        return "def r=(([]) as Set);"
-                + 
"g.V().has('prop1',eq('Fred')).out('knows').out('livesIn').fill(r);"
-                + 
"g.V().has('prop2',eq('George')).out('knows').out('livesIn').fill(r);"
-                + "g.V('').inject(((r) as Vertex[])).toList()";
-    }
-
-    @Override
-    protected String getExpectedGremlinForTestClosureNotCreatedWhenNoOrs() {
-        return 
"g.V().has('prop1',eq('Fred')).has('prop2',eq('George')).out('knows').out('livesIn')";
-    }
-
-    @Override
-    protected String getExpectedGremlinForTestOrFollowedByAnd() {
-        return "def r=(([]) as Set);"
-                + "def f1={GraphTraversal 
x->x.has('age',eq('13')).has('age',eq('14')).fill(r)};"
-                + "f1(g.V().has('name',eq('Fred')));"
-                + "f1(g.V().has('name',eq('George')));"
-                + "r";
-    }
-
-
-    @Override
-    protected String getExpectedGremlinForTestOrFollowedByOr() {
-        return "def r=(([]) as Set);"
-                + "g.V().has('name',eq('Fred')).has('age',eq('13')).fill(r);"
-                + "g.V().has('name',eq('Fred')).has('age',eq('14')).fill(r);"
-                + "g.V().has('name',eq('George')).has('age',eq('13')).fill(r);"
-                + "g.V().has('name',eq('George')).has('age',eq('14')).fill(r);"
-                + "r";
-    }
-
-    @Override
-    protected String getExpectedGremlinForTestMassiveOrExpansion() {
-        return "def r=(([]) as Set);"
-                + "def f1={g.V().has('h1',eq('h2')).has('h3',eq('h4'))};"
-                + "def f2={GraphTraversal 
x->x.has('ha0',eq('hb0')).has('hc0',eq('hd0'))};"
-                + "def f3={GraphTraversal 
x->x.has('ha1',eq('hb1')).has('hc1',eq('hd1'))};"
-                + "def f4={GraphTraversal 
x->x.has('ha2',eq('hb2')).has('hc2',eq('hd2'))};"
-                + "def f5={GraphTraversal 
x->x.has('ha3',eq('hb3')).has('hc3',eq('hd3'))};"
-                + "def f6={GraphTraversal 
x->x.has('ha4',eq('hb4')).has('hc4',eq('hd4')).has('h5',eq('h6')).has('h7',eq('h8')).fill(r)};"
-                + 
"f6(f5(f4(f3(f2(f1().has('p10',eq('e10'))).has('p11',eq('e11'))).has('p12',eq('e12'))).has('p13',eq('e13'))).has('p14',eq('e14')));"
-                + 
"f6(f5(f4(f3(f2(f1().has('p10',eq('e10'))).has('p11',eq('e11'))).has('p12',eq('e12'))).has('p13',eq('e13'))).has('p24',eq('e24')));"
-                + 
"f6(f5(f4(f3(f2(f1().has('p10',eq('e10'))).has('p11',eq('e11'))).has('p12',eq('e12'))).has('p23',eq('e23'))).has('p14',eq('e14')));"
-                + 
"f6(f5(f4(f3(f2(f1().has('p10',eq('e10'))).has('p11',eq('e11'))).has('p12',eq('e12'))).has('p23',eq('e23'))).has('p24',eq('e24')));"
-                + 
"f6(f5(f4(f3(f2(f1().has('p10',eq('e10'))).has('p11',eq('e11'))).has('p22',eq('e22'))).has('p13',eq('e13'))).has('p14',eq('e14')));"
-                + 
"f6(f5(f4(f3(f2(f1().has('p10',eq('e10'))).has('p11',eq('e11'))).has('p22',eq('e22'))).has('p13',eq('e13'))).has('p24',eq('e24')));"
-                + 
"f6(f5(f4(f3(f2(f1().has('p10',eq('e10'))).has('p11',eq('e11'))).has('p22',eq('e22'))).has('p23',eq('e23'))).has('p14',eq('e14')));"
-                + 
"f6(f5(f4(f3(f2(f1().has('p10',eq('e10'))).has('p11',eq('e11'))).has('p22',eq('e22'))).has('p23',eq('e23'))).has('p24',eq('e24')));"
-                + 
"f6(f5(f4(f3(f2(f1().has('p10',eq('e10'))).has('p21',eq('e21'))).has('p12',eq('e12'))).has('p13',eq('e13'))).has('p14',eq('e14')));"
-                + 
"f6(f5(f4(f3(f2(f1().has('p10',eq('e10'))).has('p21',eq('e21'))).has('p12',eq('e12'))).has('p13',eq('e13'))).has('p24',eq('e24')));"
-                + 
"f6(f5(f4(f3(f2(f1().has('p10',eq('e10'))).has('p21',eq('e21'))).has('p12',eq('e12'))).has('p23',eq('e23'))).has('p14',eq('e14')));"
-                + 
"f6(f5(f4(f3(f2(f1().has('p10',eq('e10'))).has('p21',eq('e21'))).has('p12',eq('e12'))).has('p23',eq('e23'))).has('p24',eq('e24')));"
-                + 
"f6(f5(f4(f3(f2(f1().has('p10',eq('e10'))).has('p21',eq('e21'))).has('p22',eq('e22'))).has('p13',eq('e13'))).has('p14',eq('e14')));"
-                + 
"f6(f5(f4(f3(f2(f1().has('p10',eq('e10'))).has('p21',eq('e21'))).has('p22',eq('e22'))).has('p13',eq('e13'))).has('p24',eq('e24')));"
-                + 
"f6(f5(f4(f3(f2(f1().has('p10',eq('e10'))).has('p21',eq('e21'))).has('p22',eq('e22'))).has('p23',eq('e23'))).has('p14',eq('e14')));"
-                + 
"f6(f5(f4(f3(f2(f1().has('p10',eq('e10'))).has('p21',eq('e21'))).has('p22',eq('e22'))).has('p23',eq('e23'))).has('p24',eq('e24')));"
-                + 
"f6(f5(f4(f3(f2(f1().has('p20',eq('e20'))).has('p11',eq('e11'))).has('p12',eq('e12'))).has('p13',eq('e13'))).has('p14',eq('e14')));"
-                + 
"f6(f5(f4(f3(f2(f1().has('p20',eq('e20'))).has('p11',eq('e11'))).has('p12',eq('e12'))).has('p13',eq('e13'))).has('p24',eq('e24')));"
-                + 
"f6(f5(f4(f3(f2(f1().has('p20',eq('e20'))).has('p11',eq('e11'))).has('p12',eq('e12'))).has('p23',eq('e23'))).has('p14',eq('e14')));"
-                + 
"f6(f5(f4(f3(f2(f1().has('p20',eq('e20'))).has('p11',eq('e11'))).has('p12',eq('e12'))).has('p23',eq('e23'))).has('p24',eq('e24')));"
-                + 
"f6(f5(f4(f3(f2(f1().has('p20',eq('e20'))).has('p11',eq('e11'))).has('p22',eq('e22'))).has('p13',eq('e13'))).has('p14',eq('e14')));"
-                + 
"f6(f5(f4(f3(f2(f1().has('p20',eq('e20'))).has('p11',eq('e11'))).has('p22',eq('e22'))).has('p13',eq('e13'))).has('p24',eq('e24')));"
-                + 
"f6(f5(f4(f3(f2(f1().has('p20',eq('e20'))).has('p11',eq('e11'))).has('p22',eq('e22'))).has('p23',eq('e23'))).has('p14',eq('e14')));"
-                + 
"f6(f5(f4(f3(f2(f1().has('p20',eq('e20'))).has('p11',eq('e11'))).has('p22',eq('e22'))).has('p23',eq('e23'))).has('p24',eq('e24')));"
-                + 
"f6(f5(f4(f3(f2(f1().has('p20',eq('e20'))).has('p21',eq('e21'))).has('p12',eq('e12'))).has('p13',eq('e13'))).has('p14',eq('e14')));"
-                + 
"f6(f5(f4(f3(f2(f1().has('p20',eq('e20'))).has('p21',eq('e21'))).has('p12',eq('e12'))).has('p13',eq('e13'))).has('p24',eq('e24')));"
-                + 
"f6(f5(f4(f3(f2(f1().has('p20',eq('e20'))).has('p21',eq('e21'))).has('p12',eq('e12'))).has('p23',eq('e23'))).has('p14',eq('e14')));"
-                + 
"f6(f5(f4(f3(f2(f1().has('p20',eq('e20'))).has('p21',eq('e21'))).has('p12',eq('e12'))).has('p23',eq('e23'))).has('p24',eq('e24')));"
-                + 
"f6(f5(f4(f3(f2(f1().has('p20',eq('e20'))).has('p21',eq('e21'))).has('p22',eq('e22'))).has('p13',eq('e13'))).has('p14',eq('e14')));"
-                + 
"f6(f5(f4(f3(f2(f1().has('p20',eq('e20'))).has('p21',eq('e21'))).has('p22',eq('e22'))).has('p13',eq('e13'))).has('p24',eq('e24')));"
-                + 
"f6(f5(f4(f3(f2(f1().has('p20',eq('e20'))).has('p21',eq('e21'))).has('p22',eq('e22'))).has('p23',eq('e23'))).has('p14',eq('e14')));"
-                + 
"f6(f5(f4(f3(f2(f1().has('p20',eq('e20'))).has('p21',eq('e21'))).has('p22',eq('e22'))).has('p23',eq('e23'))).has('p24',eq('e24')));"
-                + "r";
-
-    }
-
-    @Override
-    protected String getExpectedGremlinForTestAndFollowedByAnd() {
-        return 
"g.V().has('name',eq('Fred')).has('name',eq('George')).has('age',eq('13')).has('age',eq('14'))";
-    }
-
-
-    @Override
-    protected String getExpectedGremlinForTestAndFollowedByOr() {
-        return "def r=(([]) as Set);"
-                + "def 
f1={g.V().has('name',eq('Fred')).has('name',eq('George'))};"
-                + "f1().has('age',eq('13')).fill(r);"
-                + "f1().has('age',eq('14')).fill(r);"
-                + "r";
-    }
-
-    @Override
-    protected String getExpectedGremlinForTestInitialAlias() {
-        return "def r=(([]) as Set);"
-                + "g.V().as('x').has('name',eq('Fred')).fill(r);"
-                + "g.V().as('x').has('name',eq('George')).fill(r);"
-                + "r";
-    }
-
-    @Override
-    protected String getExpectedGremlinForTestFinalAlias() {
-        return "def r=(([]) as Set);"
-                + "g.V().has('name',eq('Fred')).as('x').fill(r);"
-                + "g.V().has('name',eq('George')).as('x').fill(r);"
-                + "r";
-    }
-
-    @Override
-    protected String getExpectedGremlinForTestAliasInMiddle() {
-        return "def r=(([]) as Set);"
-                + 
"g.V().has('name',eq('Fred')).as('x').has('age',eq('13')).fill(r);"
-                + 
"g.V().has('name',eq('Fred')).as('x').has('age',eq('14')).fill(r);"
-                + 
"g.V().has('name',eq('George')).as('x').has('age',eq('13')).fill(r);"
-                + 
"g.V().has('name',eq('George')).as('x').has('age',eq('14')).fill(r);"
-                + "r";
-    }
-
-    @Override
-    protected String getExpectedGreminForTestMultipleAliases() {
-        return "def r=(([]) as Set);"
-                + "def f1={GraphTraversal x->x.as('y').fill(r)};"
-                + 
"f1(g.V().has('name',eq('Fred')).as('x').has('age',eq('13')));"
-                + 
"f1(g.V().has('name',eq('Fred')).as('x').has('age',eq('14')));"
-                + 
"f1(g.V().has('name',eq('George')).as('x').has('age',eq('13')));"
-                + 
"f1(g.V().has('name',eq('George')).as('x').has('age',eq('14')));"
-                + "r";
-    }
-
-    @Override
-    protected String getExpectedGremlinForTestAliasInOrExpr() {
-        return "def r=(([]) as Set);"
-                + "g.V().has('name',eq('Fred')).fill(r);"
-                + "g.V().or(has('name',eq('George')).as('george')).fill(r);"
-                + "r";
-    }
-
-    @Override
-    protected String getExpectedGremlinForTestAliasInAndExpr() {
-        return 
"g.V().has('name',eq('Fred')).and(has('name',eq('George')).as('george'))";
-    }
-
-    @Override
-    protected String getExpectedGremlinForTestFlatMapExprInAnd() {
-        return 
"g.V().has('name',eq('Fred')).and(out('knows').has('name',eq('George')))";
-    }
-
-    @Override
-    protected String getExpectedGremlinForTestFlatMapExprInOr() {
-        return "def r=(([]) as Set);"
-                + "g.V().has('name',eq('Fred')).fill(r);"
-                + "g.V().or(out('knows').has('name',eq('George'))).fill(r);"
-                + "r";
-    }
-
-    @Override
-    protected String 
getExpectedGremlinForTestFieldExpressionPushedToResultExpression() {
-
-        return "def r=(([]) as Set);"
-                + "g.V().has('name',eq('Fred')).fill(r);"
-                + "g.V().or(out('knows').has('name',eq('George'))).fill(r);"
-                + "g.V('').inject(((r) as Vertex[])).values('name')";
-    }
-
-    @Override
-    protected String getExpectedGremlinFortestOrWithNoChildren() {
-        return "def r=(([]) as Set);"
-                + "r";
-    }
-
-    @Override
-    protected String getExpectedGremlinForTestFinalAliasNeeded() {
-        return "def r=(([]) as Set);"
-                + "def 
f1={g.V().has('name',eq('Fred')).as('person').out('livesIn')};"
-                + "def f2={GraphTraversal 
x->x.as('city').out('state').has('name',eq('Massachusetts')).as('__res').select('person','city','__res').fill(r)};"
-                + 
"f2(f1().has('name',eq('Chicago')));f2(f1().has('name',eq('Boston')));"
-                + "__(((r) as 
Map[])).as('__tmp').map({((Map)it.get()).get('person')}).as('person').select('__tmp').map({((Map)it.get()).get('city')}).as('city').select('__tmp').map({((Map)it.get()).get('__res')}).as('__res').path().toList().collect({it.tail()})";
-    }
-
-    @Override
-    protected String getExpectedGremlinForTestSimpleRangeExpression() {
-        return "def r=(([]) as Set);"
-                + "def f1={GraphTraversal 
x->x.has('age',eq('34')).out('eats').has('size',eq('small')).has('color',eq('blue')).range(0,10).fill(r)};"
-                + "f1(g.V().has('name',eq('Fred')));"
-                + "f1(g.V().has('name',eq('George')));"
-                + "g.V('').inject(((r) as 
Vertex[])).range(0,10).toList().size()";
-    }
-
-    @Override
-    protected String getExpectedGremlinForOptimizeLoopExpression() {
-        return "def r=(([]) as Set);def f1={GraphTraversal 
x->x.has('name',eq('Fred')).as('label').select('label').fill(r)};"
-                + "f1(g.V().has('__typeName','DataSet'));"
-                + "f1(g.V().has('__superTypeNames','DataSet'));"
-                + "g.V('').inject(((r) as 
Vertex[])).as('label').repeat(__.in('inputTables').out('outputTables')).emit(has('__typeName',eq('string')).or().has('__superTypeNames',eq('string'))).toList()";
-    }
-
-    @Override
-    protected String getExpectedGremlinForTestRangeWithNonZeroOffset() {
-        return "def r=(([]) as Set);" +
-               "g.V().has('__typeName',eq('OMAS_OMRSAsset')).fill(r);" +
-               "g.V().has('__superTypeNames',eq('OMAS_OMRSAsset')).fill(r);" +
-               "g.V('').inject(((r) as 
Vertex[])).range(5,10).as('inst').select('inst')";
-    }
-
-    @Override
-    protected String getExpectedGremlinForTestRangeWithOrderBy() {
-        return "def r=(([]) as Set);"
-                + "g.V().has('__typeName',eq('OMAS_OMRSAsset')).fill(r);"
-                + "g.V().has('__superTypeNames',eq('OMAS_OMRSAsset')).fill(r);"
-                + "g.V('').inject(((r) as 
Vertex[])).range(5,10).as('inst').order().by((({it.get().values('name')}) as 
Function),{a, b->a.toString().toLowerCase() <=> b.toString().toLowerCase()})";
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/atlas/blob/0877e47c/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
deleted file mode 100644
index a3207fb..0000000
--- 
a/repository/src/test/java/org/apache/atlas/repository/graph/ReverseReferenceUpdateHardDeleteTest.java
+++ /dev/null
@@ -1,46 +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.TestModules;
-import org.apache.atlas.typesystem.ITypedReferenceableInstance;
-import org.testng.Assert;
-import org.testng.annotations.Guice;
-
-import java.util.List;
-
-
-/**
- * Run tests in {@link ReverseReferenceUpdateTestBase} with hard delete 
enabled.
- *
- */
-@Guice(modules = TestModules.HardDeleteModule.class)
-public class ReverseReferenceUpdateHardDeleteTest extends 
ReverseReferenceUpdateTestBase {
-    @Override
-    void assertTestOneToOneReference(Object refValue, 
ITypedReferenceableInstance expectedValue, ITypedReferenceableInstance 
referencingInstance) throws Exception {
-        // Verify reference was disconnected
-        Assert.assertNull(refValue);
-    }
-
-    @Override
-    void assertTestOneToManyReference(Object object, 
ITypedReferenceableInstance referencingInstance) {
-        Assert.assertTrue(object instanceof List);
-        List<ITypedReferenceableInstance> refValues = 
(List<ITypedReferenceableInstance>) object;
-        Assert.assertEquals(refValues.size(), 1);
-    }
-}

http://git-wip-us.apache.org/repos/asf/atlas/blob/0877e47c/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
deleted file mode 100644
index ce43bdc..0000000
--- 
a/repository/src/test/java/org/apache/atlas/repository/graph/ReverseReferenceUpdateSoftDeleteTest.java
+++ /dev/null
@@ -1,79 +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.TestModules;
-import org.apache.atlas.repository.Constants;
-import org.apache.atlas.repository.graphdb.AtlasEdge;
-import org.apache.atlas.repository.graphdb.AtlasVertex;
-import org.apache.atlas.typesystem.ITypedReferenceableInstance;
-import org.apache.atlas.typesystem.persistence.Id;
-import org.testng.Assert;
-import org.testng.annotations.Guice;
-
-import java.util.Iterator;
-import java.util.List;
-
-
-/**
- * Run tests in {@link ReverseReferenceUpdateTestBase} with soft delete 
enabled.
- *
- */
-@Guice(modules = TestModules.SoftDeleteModule.class)
-public class ReverseReferenceUpdateSoftDeleteTest extends 
ReverseReferenceUpdateTestBase {
-    @Override
-    void assertTestOneToOneReference(Object actual, 
ITypedReferenceableInstance expectedValue, ITypedReferenceableInstance 
referencingInstance) throws Exception {
-        // Verify reference was not disconnected if soft deletes are enabled.
-        Assert.assertNotNull(actual);
-        Assert.assertTrue(actual instanceof ITypedReferenceableInstance);
-        ITypedReferenceableInstance referenceValue = 
(ITypedReferenceableInstance) actual;
-        Assert.assertEquals(referenceValue.getId()._getId(), 
expectedValue.getId()._getId());
-
-        //Verify reference edge was marked as DELETED.
-        AtlasVertex vertexForGUID = 
GraphHelper.getInstance().getVertexForGUID(referencingInstance.getId()._getId());
-        String edgeLabel = GraphHelper.getEdgeLabel(typeB, 
typeB.fieldMapping.fields.get("a"));
-        AtlasEdge edgeForLabel = 
GraphHelper.getInstance().getEdgeForLabel(vertexForGUID, edgeLabel);
-        Assert.assertNotNull(edgeForLabel);
-        String edgeState = 
edgeForLabel.getProperty(Constants.STATE_PROPERTY_KEY, String.class);
-        Assert.assertEquals(edgeState, Id.EntityState.DELETED.name());
-    }
-
-    @Override
- void assertTestOneToManyReference(Object object, ITypedReferenceableInstance 
referencingInstance) throws Exception {
-        // Verify reference was not disconnected if soft deletes are enabled.
-        Assert.assertTrue(object instanceof List);
-        List<ITypedReferenceableInstance> refValues = 
(List<ITypedReferenceableInstance>) object;
-        Assert.assertEquals(refValues.size(), 2);
-
-        // Verify that one of the reference edges is marked DELETED.
-        AtlasVertex vertexForGUID = 
GraphHelper.getInstance().getVertexForGUID(referencingInstance.getId()._getId());
-        String edgeLabel = GraphHelper.getEdgeLabel(typeB, 
typeB.fieldMapping.fields.get("manyA"));
-        Iterator<AtlasEdge> outGoingEdgesByLabel = 
GraphHelper.getInstance().getOutGoingEdgesByLabel(vertexForGUID, edgeLabel);
-        boolean found = false;
-        while (outGoingEdgesByLabel.hasNext()) {
-            AtlasEdge edge = outGoingEdgesByLabel.next();
-            String edgeState = edge.getProperty(Constants.STATE_PROPERTY_KEY, 
String.class);
-            if (edgeState.equals(Id.EntityState.DELETED.name())) {
-                found = true;
-                break;
-            }
-        }
-        Assert.assertTrue(found, "One edge for label " + edgeLabel + " should 
be marked " + Id.EntityState.DELETED.name());
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/atlas/blob/0877e47c/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
deleted file mode 100644
index 8518f93..0000000
--- 
a/repository/src/test/java/org/apache/atlas/repository/graph/ReverseReferenceUpdateTestBase.java
+++ /dev/null
@@ -1,275 +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 com.google.inject.Inject;
-import org.apache.atlas.CreateUpdateEntitiesResult;
-import org.apache.atlas.TestUtils;
-import org.apache.atlas.repository.MetadataRepository;
-import org.apache.atlas.typesystem.ITypedReferenceableInstance;
-import org.apache.atlas.typesystem.TypesDef;
-import org.apache.atlas.typesystem.types.AttributeDefinition;
-import org.apache.atlas.typesystem.types.ClassType;
-import org.apache.atlas.typesystem.types.DataTypes;
-import org.apache.atlas.typesystem.types.EnumTypeDefinition;
-import org.apache.atlas.typesystem.types.HierarchicalTypeDefinition;
-import org.apache.atlas.typesystem.types.Multiplicity;
-import org.apache.atlas.typesystem.types.StructTypeDefinition;
-import org.apache.atlas.typesystem.types.TraitType;
-import org.apache.atlas.typesystem.types.TypeSystem;
-import org.apache.atlas.typesystem.types.utils.TypesUtil;
-import org.testng.Assert;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
-
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-
-/**
- * Verifies automatic update of reverse references
- *
- */
-public abstract class ReverseReferenceUpdateTestBase {
-    @Inject
-    MetadataRepository repositoryService;
-
-    private TypeSystem typeSystem;
-
-    protected ClassType typeA;
-    protected ClassType typeB;
-
-    abstract void assertTestOneToOneReference(Object actual, 
ITypedReferenceableInstance expectedValue, ITypedReferenceableInstance 
referencingInstance) throws Exception;
-    abstract void assertTestOneToManyReference(Object refValue, 
ITypedReferenceableInstance referencingInstance) throws Exception;
-
-    @BeforeClass
-    public void setUp() throws Exception {
-        typeSystem = TypeSystem.getInstance();
-        typeSystem.reset();
-
-        HierarchicalTypeDefinition<ClassType> aDef = 
TypesUtil.createClassTypeDef("A", ImmutableSet.<String>of(),
-            TypesUtil.createRequiredAttrDef("name", DataTypes.STRING_TYPE),
-            new AttributeDefinition("b", "B", Multiplicity.OPTIONAL, false, 
"a"), // 1-1
-            new AttributeDefinition("oneB", "B", Multiplicity.OPTIONAL, false, 
"manyA"), // 1-*
-            new AttributeDefinition("manyB", DataTypes.arrayTypeName("B"), 
Multiplicity.OPTIONAL,  false, "manyToManyA"), // *-*
-            new AttributeDefinition("map", 
DataTypes.mapTypeName(DataTypes.STRING_TYPE.getName(),
-                "B"), Multiplicity.OPTIONAL, false, "backToMap"));
-        HierarchicalTypeDefinition<ClassType> bDef = 
TypesUtil.createClassTypeDef("B", ImmutableSet.<String>of(),
-            TypesUtil.createRequiredAttrDef("name", DataTypes.STRING_TYPE),
-            new AttributeDefinition("a", "A", Multiplicity.OPTIONAL, false, 
"b"),
-            new AttributeDefinition("manyA", DataTypes.arrayTypeName("A"), 
Multiplicity.OPTIONAL, false, "oneB"),
-            new AttributeDefinition("manyToManyA", 
DataTypes.arrayTypeName("A"), Multiplicity.OPTIONAL, false, "manyB"),
-            new AttributeDefinition("backToMap", "A", Multiplicity.OPTIONAL, 
false, "map"));
-        TypesDef typesDef = 
TypesUtil.getTypesDef(ImmutableList.<EnumTypeDefinition>of(),
-            ImmutableList.<StructTypeDefinition>of(), 
ImmutableList.<HierarchicalTypeDefinition<TraitType>>of(),
-            ImmutableList.of(aDef, bDef));
-        typeSystem.defineTypes(typesDef);
-        typeA = typeSystem.getDataType(ClassType.class, "A");
-        typeB = typeSystem.getDataType(ClassType.class, "B");
-
-        repositoryService = TestUtils.addTransactionWrapper(repositoryService);
-    }
-
-    @BeforeMethod
-    public void setupContext() {
-        TestUtils.resetRequestContext();
-    }
-
-    @Test
-    public void testOneToOneReference() throws Exception {
-        ITypedReferenceableInstance a = typeA.createInstance();
-        a.setString("name", TestUtils.randomString());
-        ITypedReferenceableInstance b1 = typeB.createInstance();
-        b1.setString("name", TestUtils.randomString());
-        a.set("b", b1);
-        // Create a.  This should also create b1 and set the reverse b1->a 
reference.
-        repositoryService.createEntities(a);
-        a = repositoryService.getEntityDefinition("A", "name", 
a.getString("name"));
-        b1 = repositoryService.getEntityDefinition("B", "name", 
b1.getString("name"));
-        Object object = a.get("b");
-        Assert.assertTrue(object instanceof ITypedReferenceableInstance);
-        ITypedReferenceableInstance refValue = (ITypedReferenceableInstance) 
object;
-        Assert.assertEquals(refValue.getId()._getId(), b1.getId()._getId());
-        object = b1.get("a");
-        Assert.assertTrue(object instanceof ITypedReferenceableInstance);
-        refValue = (ITypedReferenceableInstance) object;
-        Assert.assertEquals(refValue.getId()._getId(), a.getId()._getId());
-
-        ITypedReferenceableInstance b2 = typeB.createInstance();
-        b2.setString("name", TestUtils.randomString());
-        b2.set("a", a.getId());
-        // Create b2.  This should set the reverse a->b2 reference
-        // and disconnect b1->a.
-        repositoryService.createEntities(b2);
-        a = repositoryService.getEntityDefinition(a.getId()._getId());
-        b2 = repositoryService.getEntityDefinition("B", "name", 
b2.getString("name"));
-        object = a.get("b");
-        Assert.assertTrue(object instanceof ITypedReferenceableInstance);
-        refValue = (ITypedReferenceableInstance) object;
-        Assert.assertEquals(refValue.getId()._getId(), b2.getId()._getId());
-        object = b2.get("a");
-        Assert.assertTrue(object instanceof ITypedReferenceableInstance);
-        refValue = (ITypedReferenceableInstance) object;
-        Assert.assertEquals(refValue.getId()._getId(), a.getId()._getId());
-        // Verify b1->a was disconnected.
-        b1 = repositoryService.getEntityDefinition("B", "name", 
b1.getString("name"));
-        object = b1.get("a");
-        assertTestOneToOneReference(object, a, b1);
-    }
-
-    @Test
-    public void testOneToManyReference() throws Exception {
-        ITypedReferenceableInstance a1 = typeA.createInstance();
-        a1.setString("name", TestUtils.randomString());
-        ITypedReferenceableInstance a2 = typeA.createInstance();
-        a2.setString("name", TestUtils.randomString());
-        ITypedReferenceableInstance b1 = typeB.createInstance();
-        b1.setString("name", TestUtils.randomString());
-        a1.set("oneB", b1);
-        ITypedReferenceableInstance b2 = typeB.createInstance();
-        b2.setString("name", TestUtils.randomString());
-        repositoryService.createEntities(a1, a2, b2);
-        a1 = repositoryService.getEntityDefinition("A", "name", 
a1.getString("name"));
-        a2 = repositoryService.getEntityDefinition("A", "name", 
a2.getString("name"));
-        b1 = repositoryService.getEntityDefinition("B", "name", 
b1.getString("name"));
-        b2 = repositoryService.getEntityDefinition("B", "name", 
b2.getString("name"));
-        Object object = b1.get("manyA");
-        Assert.assertTrue(object instanceof List);
-        List<ITypedReferenceableInstance> refValues = 
(List<ITypedReferenceableInstance>) object;
-        Assert.assertEquals(refValues.size(), 1);
-        Assert.assertTrue(refValues.contains(a1.getId()));
-
-        a2.set("oneB", b1.getId());
-        repositoryService.updateEntities(a2);
-        b1 = repositoryService.getEntityDefinition(b1.getId()._getId());
-        object = b1.get("manyA");
-        Assert.assertTrue(object instanceof List);
-        refValues = (List<ITypedReferenceableInstance>) object;
-        Assert.assertEquals(refValues.size(), 2);
-        Assert.assertTrue(refValues.containsAll(Arrays.asList(a1.getId(), 
a2.getId())));
-
-        b2.set("manyA", Collections.singletonList(a2));
-        repositoryService.updateEntities(b2);
-        a2 = repositoryService.getEntityDefinition("A", "name", 
a2.getString("name"));
-
-        // Verify reverse a2.oneB reference was set to b2.
-        object = a2.get("oneB");
-        Assert.assertTrue(object instanceof ITypedReferenceableInstance);
-        ITypedReferenceableInstance refValue = (ITypedReferenceableInstance) 
object;
-        Assert.assertEquals(refValue.getId()._getId(), b2.getId()._getId());
-
-        // Verify a2 was removed from b1.manyA reference list.
-        b1 = repositoryService.getEntityDefinition(b1.getId()._getId());
-        object = b1.get("manyA");
-        assertTestOneToManyReference(object, b1);
-    }
-
-    @Test
-    public void testManyToManyReference() throws Exception {
-        ITypedReferenceableInstance a1 = typeA.createInstance();
-        a1.setString("name", TestUtils.randomString());
-        ITypedReferenceableInstance a2 = typeA.createInstance();
-        a2.setString("name", TestUtils.randomString());
-        ITypedReferenceableInstance b1 = typeB.createInstance();
-        b1.setString("name", TestUtils.randomString());
-        ITypedReferenceableInstance b2 = typeB.createInstance();
-        b2.setString("name", TestUtils.randomString());
-        repositoryService.createEntities(a1, a2, b1, b2);
-        a1 = repositoryService.getEntityDefinition("A", "name", 
a1.getString("name"));
-        a2 = repositoryService.getEntityDefinition("A", "name", 
a2.getString("name"));
-        b1 = repositoryService.getEntityDefinition("B", "name", 
b1.getString("name"));
-        b2 = repositoryService.getEntityDefinition("B", "name", 
b2.getString("name"));
-
-        // Update a1 to add b1 to its manyB reference.
-        // This should update b1.manyToManyA.
-        a1.set("manyB", Arrays.asList(b1.getId()));
-        repositoryService.updateEntities(a1);
-
-        // Verify reverse b1.manyToManyA reference was updated.
-        b1 = repositoryService.getEntityDefinition(b1.getId()._getId());
-        Object object = b1.get("manyToManyA");
-        Assert.assertTrue(object instanceof List);
-        List<ITypedReferenceableInstance> refValues = 
(List<ITypedReferenceableInstance>) object;
-        Assert.assertEquals(refValues.size(), 1);
-        Assert.assertTrue(refValues.contains(a1.getId()));
-    }
-
-    /**
-     * Auto-update of bi-directional references where one end is a map 
reference is
-     * not currently supported.  Verify that the auto-update is not applied in 
this case.
-     */
-    @Test
-    public void testMapReference() throws Exception {
-        ITypedReferenceableInstance a1 = typeA.createInstance();
-        a1.setString("name", TestUtils.randomString());
-        ITypedReferenceableInstance a2 = typeA.createInstance();
-        a2.setString("name", TestUtils.randomString());
-        ITypedReferenceableInstance b1 = typeB.createInstance();
-        b1.setString("name", TestUtils.randomString());
-        ITypedReferenceableInstance b2 = typeB.createInstance();
-        b2.setString("name", TestUtils.randomString());
-        repositoryService.createEntities(a1, a2, b1, b2);
-        a1 = repositoryService.getEntityDefinition("A", "name", 
a1.getString("name"));
-        a2 = repositoryService.getEntityDefinition("A", "name", 
a2.getString("name"));
-        b1 = repositoryService.getEntityDefinition("B", "name", 
b1.getString("name"));
-        b2 = repositoryService.getEntityDefinition("B", "name", 
b2.getString("name"));
-        a1.set("map", Collections.singletonMap("b1", b1));
-        repositoryService.updateEntities(a1);
-        // Verify reverse b1.manyToManyA reference was not updated.
-        b1 = repositoryService.getEntityDefinition(b1.getId()._getId());
-        Object object = b1.get("backToMap");
-        Assert.assertNull(object);
-    }
-
-    /**
-     * Verify that explicitly setting both ends of a reference
-     * does not cause duplicate entries due to auto-update of
-     * reverse reference.
-     */
-    @Test
-    public void testCallerHasSetBothEnds() throws Exception {
-        ITypedReferenceableInstance a = typeA.createInstance();
-        a.setString("name", TestUtils.randomString());
-        ITypedReferenceableInstance b1 = typeB.createInstance();
-        b1.setString("name", TestUtils.randomString());
-        // Set both sides of the reference.
-        a.set("oneB", b1);
-        b1.set("manyA", Collections.singletonList(a));
-
-        CreateUpdateEntitiesResult result          = 
repositoryService.createEntities(a);
-        Map<String, String>        guidAssignments = 
result.getGuidMapping().getGuidAssignments();
-        String                     aGuid           = a.getId()._getId();
-        String                     b1Guid          = 
guidAssignments.get(b1.getId()._getId());
-
-        a = repositoryService.getEntityDefinition(aGuid);
-        Object object = a.get("oneB");
-        Assert.assertTrue(object instanceof ITypedReferenceableInstance);
-        
Assert.assertEquals(((ITypedReferenceableInstance)object).getId()._getId(), 
b1Guid);
-
-        b1 = repositoryService.getEntityDefinition(b1Guid);
-        object = b1.get("manyA");
-        Assert.assertTrue(object instanceof List);
-        List<ITypedReferenceableInstance> refValues = 
(List<ITypedReferenceableInstance>)object;
-        Assert.assertEquals(refValues.size(), 1);
-        Assert.assertEquals(refValues.get(0).getId()._getId(), aGuid);
-    }
-}

http://git-wip-us.apache.org/repos/asf/atlas/blob/0877e47c/repository/src/test/java/org/apache/atlas/repository/graph/TestIntSequence.java
----------------------------------------------------------------------
diff --git 
a/repository/src/test/java/org/apache/atlas/repository/graph/TestIntSequence.java
 
b/repository/src/test/java/org/apache/atlas/repository/graph/TestIntSequence.java
deleted file mode 100644
index b8eefca..0000000
--- 
a/repository/src/test/java/org/apache/atlas/repository/graph/TestIntSequence.java
+++ /dev/null
@@ -1,35 +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.query.IntSequence;
-
-/**
- * IntSequence for use in unit tests.
- *
- */
-public class TestIntSequence implements IntSequence {
-
-    public static final IntSequence INSTANCE = new TestIntSequence();
-    private TestIntSequence() {
-    }
-    @Override
-    public int next() {
-        return 0;
-    }
-}
\ No newline at end of file

Reply via email to