atlas-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shweth...@apache.org
Subject [1/5] incubator-atlas git commit: ATLAS-622 Introduce soft delete (shwethags)
Date Sat, 16 Apr 2016 03:58:10 GMT
Repository: incubator-atlas
Updated Branches:
  refs/heads/master daf812aad -> 40ee94921


http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/40ee9492/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
new file mode 100644
index 0000000..5c59c8a
--- /dev/null
+++ b/repository/src/test/java/org/apache/atlas/repository/graph/GraphBackedRepositorySoftDeleteTest.java
@@ -0,0 +1,121 @@
+/**
+ * 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 com.tinkerpop.blueprints.Vertex;
+import org.apache.atlas.AtlasClient;
+import org.apache.atlas.TestUtils;
+import org.apache.atlas.repository.Constants;
+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.types.TypeSystem;
+import org.testng.Assert;
+
+import java.util.List;
+import java.util.Map;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+
+public class GraphBackedRepositorySoftDeleteTest extends GraphBackedMetadataRepositoryDeleteTestBase {
+    @Override
+    DeleteHandler getDeleteHandler(TypeSystem typeSystem) {
+        return new SoftDeleteHandler(typeSystem);
+    }
+
+    @Override
+    protected void assertTestDeleteReference(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 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());
+    }
+
+    @Override
+    protected void assertVerticesDeleted(List<Vertex> vertices) {
+        for (Vertex vertex : vertices) {
+            assertEquals(vertex.getProperty(Constants.STATE_PROPERTY_KEY), Id.EntityState.DELETED.name());
+        }
+    }
+
+    @Override
+    protected void assertTestUpdateEntity_MultiplicityOneNonCompositeReference() throws Exception {
+        // Verify that max is no longer a subordinate of jane.
+        ITypedReferenceableInstance jane = repositoryService.getEntityDefinition("Manager", "name", "Jane");
+        List<ITypedReferenceableInstance> subordinates = (List<ITypedReferenceableInstance>) jane.get("subordinates");
+        Assert.assertEquals(subordinates.size(), 2);
+    }
+
+    @Override
+    protected void assertTestDisconnectBidirectionalReferences() throws Exception {
+        // Verify that the Manager.subordinates still references deleted employee
+        ITypedReferenceableInstance jane = repositoryService.getEntityDefinition("Manager", "name", "Jane");
+        List<ITypedReferenceableInstance> subordinates = (List<ITypedReferenceableInstance>) jane.get("subordinates");
+        assertEquals(subordinates.size(), 2);
+    }
+
+    @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");
+        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);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/40ee9492/repository/src/test/java/org/apache/atlas/repository/graph/GraphRepoMapperScaleTest.java
----------------------------------------------------------------------
diff --git a/repository/src/test/java/org/apache/atlas/repository/graph/GraphRepoMapperScaleTest.java b/repository/src/test/java/org/apache/atlas/repository/graph/GraphRepoMapperScaleTest.java
index 3f71eb3..2f02ae2 100755
--- a/repository/src/test/java/org/apache/atlas/repository/graph/GraphRepoMapperScaleTest.java
+++ b/repository/src/test/java/org/apache/atlas/repository/graph/GraphRepoMapperScaleTest.java
@@ -27,6 +27,7 @@ import com.tinkerpop.blueprints.Predicate;
 import com.tinkerpop.blueprints.Vertex;
 import org.apache.atlas.GraphTransaction;
 import org.apache.atlas.RepositoryMetadataModule;
+import org.apache.atlas.RequestContext;
 import org.apache.atlas.TestUtils;
 import org.apache.atlas.repository.Constants;
 import org.apache.atlas.typesystem.ITypedReferenceableInstance;
@@ -39,6 +40,7 @@ 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;
 
@@ -75,6 +77,11 @@ public class GraphRepoMapperScaleTest {
         searchIndexer.onAdd(typesAdded);
     }
 
+    @BeforeMethod
+    public void setupContext() {
+        RequestContext.createContext();
+    }
+
     @AfterClass
     public void tearDown() throws Exception {
         TypeSystem.getInstance().reset();

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/40ee9492/repository/src/test/java/org/apache/atlas/repository/typestore/GraphBackedTypeStoreTest.java
----------------------------------------------------------------------
diff --git a/repository/src/test/java/org/apache/atlas/repository/typestore/GraphBackedTypeStoreTest.java b/repository/src/test/java/org/apache/atlas/repository/typestore/GraphBackedTypeStoreTest.java
index 8ca3132..961442b 100755
--- a/repository/src/test/java/org/apache/atlas/repository/typestore/GraphBackedTypeStoreTest.java
+++ b/repository/src/test/java/org/apache/atlas/repository/typestore/GraphBackedTypeStoreTest.java
@@ -178,7 +178,7 @@ public class GraphBackedTypeStoreTest {
 
         HierarchicalTypeDefinition<ClassType> deptTypeDef = createClassTypeDef("Department", "Department"+_description,
             ImmutableSet.of(superTypeDef.typeName), createRequiredAttrDef("name", DataTypes.STRING_TYPE),
-                new AttributeDefinition("employees", String.format("array<%s>", "Person"), Multiplicity.COLLECTION,
+                new AttributeDefinition("employees", String.format("array<%s>", "Person"), Multiplicity.OPTIONAL,
                         true, "department"));
         TypesDef typesDef = TypesUtil.getTypesDef(ImmutableList.of(orgLevelEnum), ImmutableList.of(addressDetails),
                 ImmutableList.<HierarchicalTypeDefinition<TraitType>>of(),
@@ -227,7 +227,7 @@ public class GraphBackedTypeStoreTest {
                 createOptionalAttrDef("name", DataTypes.STRING_TYPE));
         HierarchicalTypeDefinition<ClassType> deptTypeDef = createClassTypeDef("Department",
             ImmutableSet.of("Division", superTypeDef2.typeName), createRequiredAttrDef("name", DataTypes.STRING_TYPE),
-            new AttributeDefinition("employees", String.format("array<%s>", "Person"), Multiplicity.COLLECTION,
+            new AttributeDefinition("employees", String.format("array<%s>", "Person"), Multiplicity.OPTIONAL,
                     true, "department"));
         TypesDef typesDef = TypesUtil.getTypesDef(ImmutableList.<EnumTypeDefinition>of(), ImmutableList.<StructTypeDefinition>of(),
             ImmutableList.<HierarchicalTypeDefinition<TraitType>>of(),
@@ -269,9 +269,9 @@ public class GraphBackedTypeStoreTest {
     
     private int countOutgoingEdges(Vertex typeVertex, String edgeLabel) {
 
-        Iterable<Edge> outGoingEdgesByLabel = GraphHelper.getOutGoingEdgesByLabel(typeVertex, edgeLabel);
+        Iterator<Edge> outGoingEdgesByLabel = GraphHelper.getOutGoingEdgesByLabel(typeVertex, edgeLabel);
         int edgeCount = 0;
-        for (Iterator<Edge> iterator = outGoingEdgesByLabel.iterator(); iterator.hasNext();) {
+        for (Iterator<Edge> iterator = outGoingEdgesByLabel; iterator.hasNext();) {
             iterator.next();
             edgeCount++;
         }

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/40ee9492/repository/src/test/java/org/apache/atlas/service/DefaultMetadataServiceTest.java
----------------------------------------------------------------------
diff --git a/repository/src/test/java/org/apache/atlas/service/DefaultMetadataServiceTest.java b/repository/src/test/java/org/apache/atlas/service/DefaultMetadataServiceTest.java
index 1156b67..1f906ed 100644
--- a/repository/src/test/java/org/apache/atlas/service/DefaultMetadataServiceTest.java
+++ b/repository/src/test/java/org/apache/atlas/service/DefaultMetadataServiceTest.java
@@ -24,22 +24,15 @@ import com.google.inject.Inject;
 import com.thinkaurelius.titan.core.TitanGraph;
 import com.thinkaurelius.titan.core.util.TitanCleanup;
 import org.apache.atlas.AtlasClient;
-import org.apache.atlas.repository.audit.EntityAuditRepository;
-import org.apache.atlas.repository.audit.HBaseBasedAuditRepository;
-import org.apache.atlas.repository.audit.HBaseTestUtils;
-import org.apache.atlas.typesystem.exception.TypeNotFoundException;
-import org.apache.atlas.typesystem.exception.EntityNotFoundException;
-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.utils.TypesUtil;
-import org.apache.atlas.utils.ParamChecker;
 import org.apache.atlas.AtlasException;
 import org.apache.atlas.EntityAuditEvent;
 import org.apache.atlas.RepositoryMetadataModule;
 import org.apache.atlas.RequestContext;
 import org.apache.atlas.TestUtils;
 import org.apache.atlas.listener.EntityChangeListener;
+import org.apache.atlas.repository.audit.EntityAuditRepository;
+import org.apache.atlas.repository.audit.HBaseBasedAuditRepository;
+import org.apache.atlas.repository.audit.HBaseTestUtils;
 import org.apache.atlas.repository.graph.GraphProvider;
 import org.apache.atlas.services.MetadataService;
 import org.apache.atlas.typesystem.IReferenceableInstance;
@@ -48,12 +41,19 @@ import org.apache.atlas.typesystem.ITypedReferenceableInstance;
 import org.apache.atlas.typesystem.Referenceable;
 import org.apache.atlas.typesystem.Struct;
 import org.apache.atlas.typesystem.TypesDef;
+import org.apache.atlas.typesystem.exception.EntityNotFoundException;
+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.persistence.Id;
+import org.apache.atlas.typesystem.types.ClassType;
+import org.apache.atlas.typesystem.types.DataTypes;
 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.ValueConversionException;
+import org.apache.atlas.typesystem.types.utils.TypesUtil;
+import org.apache.atlas.utils.ParamChecker;
 import org.apache.commons.lang.RandomStringUtils;
 import org.codehaus.jettison.json.JSONArray;
 import org.codehaus.jettison.json.JSONException;
@@ -67,15 +67,19 @@ import org.testng.annotations.Test;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
-import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
+import static org.apache.atlas.TestUtils.COLUMNS_ATTR_NAME;
+import static org.apache.atlas.TestUtils.COLUMN_TYPE;
+import static org.apache.atlas.TestUtils.TABLE_TYPE;
+import static org.apache.atlas.TestUtils.createColumnEntity;
+import static org.apache.atlas.TestUtils.createDBEntity;
+import static org.apache.atlas.TestUtils.createTableEntity;
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertNotNull;
 import static org.testng.Assert.assertNull;
-import static org.testng.Assert.assertTrue;
 import static org.testng.Assert.fail;
 
 @Guice(modules = RepositoryMetadataModule.class)
@@ -87,25 +91,22 @@ public class DefaultMetadataServiceTest {
     private GraphProvider<TitanGraph> graphProvider;
 
     @Inject
-    private EntityAuditRepository repository;
+    private EntityAuditRepository auditRepository;
 
     private Referenceable db = createDBEntity();
 
-    private Id dbId;
-
     private Referenceable table;
 
     private Id tableId;
     
     private final String NAME = "name";
-    private final String COLUMNS_ATTR_NAME = "columns";
 
 
     @BeforeTest
     public void setUp() throws Exception {
-        if (repository instanceof HBaseBasedAuditRepository) {
+        if (auditRepository instanceof HBaseBasedAuditRepository) {
             HBaseTestUtils.startCluster();
-            ((HBaseBasedAuditRepository) repository).start();
+            ((HBaseBasedAuditRepository) auditRepository).start();
         }
         RequestContext.createContext();
         RequestContext.get().setUser("testuser");
@@ -118,9 +119,7 @@ public class DefaultMetadataServiceTest {
         }
 
         String dbGUid = createInstance(db);
-        dbId = new Id(dbGUid, 0, TestUtils.DATABASE_TYPE);
-
-        table = createTableEntity(dbId);
+        table = createTableEntity(dbGUid);
         String tableGuid = createInstance(table);
         String tableDefinitionJson =
                 metadataService.getEntityDefinition(TestUtils.TABLE_TYPE, NAME, (String) table.get(NAME));
@@ -143,25 +142,28 @@ public class DefaultMetadataServiceTest {
             e.printStackTrace();
         }
 
-        if (repository instanceof HBaseBasedAuditRepository) {
-            ((HBaseBasedAuditRepository) repository).stop();
+        if (auditRepository instanceof HBaseBasedAuditRepository) {
+            ((HBaseBasedAuditRepository) auditRepository).stop();
             HBaseTestUtils.stopCluster();
         }
     }
 
     private String createInstance(Referenceable entity) throws Exception {
+        RequestContext.createContext();
+
         String entityjson = InstanceSerialization.toJson(entity, true);
         JSONArray entitiesJson = new JSONArray();
         entitiesJson.put(entityjson);
         String response = metadataService.createEntities(entitiesJson.toString());
         JSONArray guids = new JSONArray(response);
         if (guids != null && guids.length() > 0) {
-            return guids.getString(0);
+            return guids.getString(guids.length() - 1);
         }
         return null;
     }
 
     private String updateInstance(Referenceable entity) throws Exception {
+        RequestContext.createContext();
         ParamChecker.notNull(entity, "Entity");
         ParamChecker.notNull(entity.getId(), "Entity");
         String entityjson = InstanceSerialization.toJson(entity, true);
@@ -171,33 +173,6 @@ public class DefaultMetadataServiceTest {
         return new JSONArray(response).getString(0);
     }
 
-    private Referenceable createDBEntity() {
-        Referenceable entity = new Referenceable(TestUtils.DATABASE_TYPE);
-        String dbName = RandomStringUtils.randomAlphanumeric(10);
-        entity.set(NAME, dbName);
-        entity.set("description", "us db");
-        return entity;
-    }
-
-    private Referenceable createTableEntity(Id dbId) {
-        Referenceable entity = new Referenceable(TestUtils.TABLE_TYPE);
-        String tableName = RandomStringUtils.randomAlphanumeric(10);
-        entity.set(NAME, tableName);
-        entity.set("description", "random table");
-        entity.set("type", "type");
-        entity.set("tableType", "MANAGED");
-        entity.set("database", dbId);
-        entity.set("created", new Date());
-        return entity;
-    }
-
-    private Referenceable createColumnEntity() {
-        Referenceable entity = new Referenceable(TestUtils.COLUMN_TYPE);
-        entity.set(NAME, RandomStringUtils.randomAlphanumeric(10));
-        entity.set("type", "VARCHAR(32)");
-        return entity;
-    }
-
     @Test(expectedExceptions = TypeNotFoundException.class)
     public void testCreateEntityWithUnknownDatatype() throws Exception {
         Referenceable entity = new Referenceable("Unknown datatype");
@@ -246,8 +221,14 @@ public class DefaultMetadataServiceTest {
         assertAuditEvents(id, EntityAuditEvent.EntityAuditAction.ENTITY_DELETE);
     }
 
+    private List<String> deleteEntities(String... guids) throws AtlasException {
+        RequestContext.createContext();
+        return metadataService.deleteEntities(Arrays.asList(guids));
+    }
+
     private void assertAuditEvents(String id, EntityAuditEvent.EntityAuditAction expectedAction) throws Exception {
-        List<EntityAuditEvent> events = repository.listEvents(id, null, (short) 10);
+        List<EntityAuditEvent> events =
+                auditRepository.listEvents(id, null, (short) 10);
         for (EntityAuditEvent event : events) {
             if (event.getAction() == expectedAction) {
                 return;
@@ -257,7 +238,7 @@ public class DefaultMetadataServiceTest {
     }
 
     private void assertAuditEvents(String entityId, int numEvents) throws Exception {
-        List<EntityAuditEvent> events = repository.listEvents(entityId, null, (short)numEvents);
+        List<EntityAuditEvent> events = metadataService.getAuditEvents(entityId, null, (short) numEvents);
         assertNotNull(events);
         assertEquals(events.size(), numEvents);
     }
@@ -357,7 +338,7 @@ public class DefaultMetadataServiceTest {
         Assert.assertTrue(partsMap.get("part2").equalsContents(((Map<String, Struct>)tableDefinition.get("partitionsMap")).get("part2")));
 
         //update struct value for existing map key
-        Struct partition2 = (Struct)partsMap.get("part2");
+        Struct partition2 = partsMap.get("part2");
         partition2.set(NAME, "test2Updated");
         updateInstance(table);
         tableDefinitionJson =
@@ -457,6 +438,11 @@ public class DefaultMetadataServiceTest {
         Assert.assertEquals(actualColumns, updatedColNameList);
     }
 
+    private void updateEntityPartial(String guid, Referenceable entity) throws AtlasException {
+        RequestContext.createContext();
+        metadataService.updateEntityPartialByGuid(guid, entity);
+    }
+
     @Test
     public void testUpdateEntityArrayOfClass() throws Exception {
         
@@ -470,7 +456,7 @@ public class DefaultMetadataServiceTest {
         Referenceable tableUpdated = new Referenceable(TestUtils.TABLE_TYPE, new HashMap<String, Object>() {{
             put(COLUMNS_ATTR_NAME, columns);
         }});
-        metadataService.updateEntityPartialByGuid(tableId._getId(), tableUpdated);
+        updateEntityPartial(tableId._getId(), tableUpdated);
 
         verifyArrayUpdates(TestUtils.TABLE_TYPE, NAME, (String) table.get(NAME), columns, COLUMNS_ATTR_NAME);
 
@@ -488,7 +474,7 @@ public class DefaultMetadataServiceTest {
         tableUpdated = new Referenceable(TestUtils.TABLE_TYPE, new HashMap<String, Object>() {{
             put(COLUMNS_ATTR_NAME, updateColumns);
         }});
-        metadataService.updateEntityPartialByGuid(tableId._getId(), tableUpdated);
+        updateEntityPartial(tableId._getId(), tableUpdated);
 
         verifyArrayUpdates(TestUtils.TABLE_TYPE, NAME, (String) table.get(NAME), updateColumns, COLUMNS_ATTR_NAME);
 
@@ -566,15 +552,6 @@ public class DefaultMetadataServiceTest {
         }
     }
 
-    private void assertReferenceables(Referenceable r1, Referenceable r2) {
-        assertEquals(r1.getTypeName(), r2.getTypeName());
-        assertTrue(r1.getTraits().equals(r2.getTraits()));
-        for (String attr : r1.getValuesMap().keySet()) {
-            assertTrue(r1.getValuesMap().get(attr).equals(r2.getValuesMap().get(attr)));
-        }
-        //TODO assert trait instances and complex attributes
-    }
-
     @Test
     public void testStructs() throws Exception {
         Struct serdeInstance = new Struct(TestUtils.SERDE_TYPE);
@@ -853,76 +830,48 @@ public class DefaultMetadataServiceTest {
             //expected
         }
     }
-    
+
     @Test
     public void testDeleteEntities() throws Exception {
-        // Create 2 table entities, each with 3 composite column entities
+        // Create a table entity, with 3 composite column entities
         Referenceable dbEntity = createDBEntity();
         String dbGuid = createInstance(dbEntity);
-        Id dbId = new Id(dbGuid, 0, TestUtils.DATABASE_TYPE);
-        Referenceable table1Entity = createTableEntity(dbId);
-        Referenceable table2Entity = createTableEntity(dbId);
+        Referenceable table1Entity = createTableEntity(dbGuid);
         Referenceable col1 = createColumnEntity();
         Referenceable col2 = createColumnEntity();
         Referenceable col3 = createColumnEntity();
         table1Entity.set(COLUMNS_ATTR_NAME, ImmutableList.of(col1, col2, col3));
-        table2Entity.set(COLUMNS_ATTR_NAME, ImmutableList.of(col1, col2, col3));
         createInstance(table1Entity);
-        createInstance(table2Entity);
-        
+
         // Retrieve the table entities from the repository,
         // to get their guids and the composite column guids.
-        String entityJson = metadataService.getEntityDefinition(TestUtils.TABLE_TYPE, 
-            NAME, (String)table1Entity.get(NAME));
+        String entityJson = metadataService.getEntityDefinition(TestUtils.TABLE_TYPE,
+                NAME, (String)table1Entity.get(NAME));
         Assert.assertNotNull(entityJson);
         table1Entity = InstanceSerialization.fromJsonReferenceable(entityJson, true);
-        Object val = table1Entity.get(COLUMNS_ATTR_NAME);
-        Assert.assertTrue(val instanceof List);
-        List<IReferenceableInstance> table1Columns = (List<IReferenceableInstance>) val;
-        entityJson = metadataService.getEntityDefinition(TestUtils.TABLE_TYPE, 
-            NAME, (String)table2Entity.get(NAME));
-        Assert.assertNotNull(entityJson);
-        table2Entity = InstanceSerialization.fromJsonReferenceable(entityJson, true);
-        val = table2Entity.get(COLUMNS_ATTR_NAME);
-        Assert.assertTrue(val instanceof List);
-        List<IReferenceableInstance> table2Columns = (List<IReferenceableInstance>) val;
+        List<IReferenceableInstance> table1Columns = (List<IReferenceableInstance>) table1Entity.get(COLUMNS_ATTR_NAME);
 
         // Register an EntityChangeListener to verify the notification mechanism
         // is working for deleteEntities().
         DeleteEntitiesChangeListener listener = new DeleteEntitiesChangeListener();
         metadataService.registerListener(listener);
-        
+
         // Delete the table entities.  The deletion should cascade
         // to their composite columns.
-        JSONArray deleteCandidateGuids = new JSONArray();
-        deleteCandidateGuids.put(table1Entity.getId()._getId());
-        deleteCandidateGuids.put(table2Entity.getId()._getId());
-        List<String> deletedGuids = metadataService.deleteEntities(
-            Arrays.asList(table1Entity.getId()._getId(), table2Entity.getId()._getId()));
+        List<String> deletedGuids = deleteEntities(table1Entity.getId()._getId());
 
-        // Verify that deleteEntities() response has guids for tables and their composite columns. 
+        // Verify that deleteEntities() response has guids for tables and their composite columns.
         Assert.assertTrue(deletedGuids.contains(table1Entity.getId()._getId()));
-        Assert.assertTrue(deletedGuids.contains(table2Entity.getId()._getId()));
         for (IReferenceableInstance column : table1Columns) {
             Assert.assertTrue(deletedGuids.contains(column.getId()._getId()));
         }
-        for (IReferenceableInstance column : table2Columns) {
-            Assert.assertTrue(deletedGuids.contains(column.getId()._getId()));
-        }
-        
+
         // Verify that tables and their composite columns have been deleted from the repository.
-        for (String guid : deletedGuids) {
-            try {
-                metadataService.getEntityDefinition(guid);
-                Assert.fail(EntityNotFoundException.class.getSimpleName() + 
-                    " expected but not thrown.  The entity with guid " + guid + 
-                    " still exists in the repository after being deleted." );
-            }
-            catch(EntityNotFoundException e) {
-                // The entity does not exist in the repository, so deletion was successful.
-            }
-        }
-        
+        assertEntityDeleted(TABLE_TYPE, NAME, table1Entity.get(NAME));
+        assertEntityDeleted(COLUMN_TYPE, NAME, col1.get(NAME));
+        assertEntityDeleted(COLUMN_TYPE, NAME, col2.get(NAME));
+        assertEntityDeleted(COLUMN_TYPE, NAME, col3.get(NAME));
+
         // Verify that the listener was notified about the deleted entities.
         Collection<ITypedReferenceableInstance> deletedEntitiesFromListener = listener.getDeletedEntities();
         Assert.assertNotNull(deletedEntitiesFromListener);
@@ -935,13 +884,22 @@ public class DefaultMetadataServiceTest {
         Assert.assertTrue(deletedGuidsFromListener.containsAll(deletedGuids));
     }
 
+    private void assertEntityDeleted(String typeName, String attributeName, Object attributeValue)
+            throws AtlasException {
+        try {
+            metadataService.getEntityDefinition(typeName, attributeName, (String) attributeValue);
+            fail("Expected EntityNotFoundException");
+        } catch(EntityNotFoundException e) {
+            //expected
+        }
+    }
+
     @Test
     public void testDeleteEntityByUniqueAttribute() throws Exception {
-        // Create 2 table entities, each with 3 composite column entities
+        // Create a table entity, with 3 composite column entities
         Referenceable dbEntity = createDBEntity();
         String dbGuid = createInstance(dbEntity);
-        Id dbId = new Id(dbGuid, 0, TestUtils.DATABASE_TYPE);
-        Referenceable table1Entity = createTableEntity(dbId);
+        Referenceable table1Entity = createTableEntity(dbGuid);
         Referenceable col1 = createColumnEntity();
         Referenceable col2 = createColumnEntity();
         Referenceable col3 = createColumnEntity();
@@ -950,12 +908,10 @@ public class DefaultMetadataServiceTest {
 
         // to get their guids and the composite column guids.
         String entityJson = metadataService.getEntityDefinition(TestUtils.TABLE_TYPE,
-            NAME, (String)table1Entity.get(NAME));
+                NAME, (String) table1Entity.get(NAME));
         Assert.assertNotNull(entityJson);
         table1Entity = InstanceSerialization.fromJsonReferenceable(entityJson, true);
-        Object val = table1Entity.get(COLUMNS_ATTR_NAME);
-        Assert.assertTrue(val instanceof List);
-        List<IReferenceableInstance> table1Columns = (List<IReferenceableInstance>) val;
+        List<IReferenceableInstance> table1Columns = (List<IReferenceableInstance>) table1Entity.get(COLUMNS_ATTR_NAME);
 
         // Register an EntityChangeListener to verify the notification mechanism
         // is working for deleteEntityByUniqueAttribute().
@@ -973,17 +929,11 @@ public class DefaultMetadataServiceTest {
         }
 
         // Verify that tables and their composite columns have been deleted from the repository.
-        for (String guid : deletedGuids) {
-            try {
-                metadataService.getEntityDefinition(guid);
-                Assert.fail(EntityNotFoundException.class.getSimpleName() +
-                    " expected but not thrown.  The entity with guid " + guid +
-                    " still exists in the repository after being deleted." );
-            }
-            catch(EntityNotFoundException e) {
-                // The entity does not exist in the repository, so deletion was successful.
-            }
-        }
+        // Verify that tables and their composite columns have been deleted from the repository.
+        assertEntityDeleted(TABLE_TYPE, NAME, table1Entity.get(NAME));
+        assertEntityDeleted(COLUMN_TYPE, NAME, col1.get(NAME));
+        assertEntityDeleted(COLUMN_TYPE, NAME, col2.get(NAME));
+        assertEntityDeleted(COLUMN_TYPE, NAME, col3.get(NAME));
 
         // Verify that the listener was notified about the deleted entities.
         Collection<ITypedReferenceableInstance> deletedEntitiesFromListener = listener.getDeletedEntities();

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/40ee9492/repository/src/test/scala/org/apache/atlas/query/GremlinTest.scala
----------------------------------------------------------------------
diff --git a/repository/src/test/scala/org/apache/atlas/query/GremlinTest.scala b/repository/src/test/scala/org/apache/atlas/query/GremlinTest.scala
index 0289b1a..b23c0f6 100755
--- a/repository/src/test/scala/org/apache/atlas/query/GremlinTest.scala
+++ b/repository/src/test/scala/org/apache/atlas/query/GremlinTest.scala
@@ -37,7 +37,7 @@ class GremlinTest extends BaseGremlinTest {
     TypeSystem.getInstance().reset()
     QueryTestsUtils.setupTypes
     gProvider = new TitanGraphProvider()
-    gp = new DefaultGraphPersistenceStrategy(new GraphBackedMetadataRepository(gProvider))
+    gp = new DefaultGraphPersistenceStrategy(new GraphBackedMetadataRepository(gProvider, null))
     g = QueryTestsUtils.setupTestGraph(gProvider)
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/40ee9492/repository/src/test/scala/org/apache/atlas/query/GremlinTest2.scala
----------------------------------------------------------------------
diff --git a/repository/src/test/scala/org/apache/atlas/query/GremlinTest2.scala b/repository/src/test/scala/org/apache/atlas/query/GremlinTest2.scala
index 79ebfae..2fd8bb9 100755
--- a/repository/src/test/scala/org/apache/atlas/query/GremlinTest2.scala
+++ b/repository/src/test/scala/org/apache/atlas/query/GremlinTest2.scala
@@ -37,7 +37,7 @@ class GremlinTest2 extends BaseGremlinTest {
     TypeSystem.getInstance().reset()
     QueryTestsUtils.setupTypes
     gProvider = new TitanGraphProvider();
-    gp = new DefaultGraphPersistenceStrategy(new GraphBackedMetadataRepository(gProvider))
+    gp = new DefaultGraphPersistenceStrategy(new GraphBackedMetadataRepository(gProvider, null))
     g = QueryTestsUtils.setupTestGraph(gProvider)
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/40ee9492/repository/src/test/scala/org/apache/atlas/query/LineageQueryTest.scala
----------------------------------------------------------------------
diff --git a/repository/src/test/scala/org/apache/atlas/query/LineageQueryTest.scala b/repository/src/test/scala/org/apache/atlas/query/LineageQueryTest.scala
index cd1c424..0e0ac86 100755
--- a/repository/src/test/scala/org/apache/atlas/query/LineageQueryTest.scala
+++ b/repository/src/test/scala/org/apache/atlas/query/LineageQueryTest.scala
@@ -37,7 +37,7 @@ class LineageQueryTest extends BaseGremlinTest {
       TypeSystem.getInstance().reset()
       QueryTestsUtils.setupTypes
       gProvider = new TitanGraphProvider();
-      gp = new DefaultGraphPersistenceStrategy(new GraphBackedMetadataRepository(gProvider))
+      gp = new DefaultGraphPersistenceStrategy(new GraphBackedMetadataRepository(gProvider, null))
       g = QueryTestsUtils.setupTestGraph(gProvider)
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/40ee9492/repository/src/test/scala/org/apache/atlas/query/QueryTestsUtils.scala
----------------------------------------------------------------------
diff --git a/repository/src/test/scala/org/apache/atlas/query/QueryTestsUtils.scala b/repository/src/test/scala/org/apache/atlas/query/QueryTestsUtils.scala
index 1a0fa20..b5faaf3 100755
--- a/repository/src/test/scala/org/apache/atlas/query/QueryTestsUtils.scala
+++ b/repository/src/test/scala/org/apache/atlas/query/QueryTestsUtils.scala
@@ -164,7 +164,7 @@ object QueryTestsUtils extends GraphUtils {
         val bindings: Bindings = engine.createBindings
         bindings.put("g", g)
 
-        val hiveGraphFile = FileUtils.getTempDirectory().getPath.toString + File.separator + System.nanoTime() + ".gson"
+        val hiveGraphFile = FileUtils.getTempDirectory().getPath + File.separator + System.nanoTime() + ".gson"
         HiveTitanSample.writeGson(hiveGraphFile)
         bindings.put("hiveGraphFile", hiveGraphFile)
 

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/40ee9492/server-api/src/main/java/org/apache/atlas/RequestContext.java
----------------------------------------------------------------------
diff --git a/server-api/src/main/java/org/apache/atlas/RequestContext.java b/server-api/src/main/java/org/apache/atlas/RequestContext.java
index 943e4b8..fa94763 100644
--- a/server-api/src/main/java/org/apache/atlas/RequestContext.java
+++ b/server-api/src/main/java/org/apache/atlas/RequestContext.java
@@ -18,15 +18,33 @@
 
 package org.apache.atlas;
 
+import org.apache.atlas.typesystem.ITypedReferenceableInstance;
+import org.apache.atlas.typesystem.persistence.Id;
+import org.apache.atlas.typesystem.types.ClassType;
+import org.apache.atlas.typesystem.types.TypeSystem;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Set;
+
 public class RequestContext {
     private static final Logger LOG = LoggerFactory.getLogger(RequestContext.class);
 
     private static final ThreadLocal<RequestContext> CURRENT_CONTEXT = new ThreadLocal<>();
 
+    private Set<String> createdEntityIds = new LinkedHashSet<>();
+    private Set<String> updatedEntityIds = new LinkedHashSet<>();
+    private Set<String> deletedEntityIds = new LinkedHashSet<>();
+    private List<ITypedReferenceableInstance> deletedEntities = new ArrayList<>();
+
     private String user;
+    private long requestTime;
+
+    TypeSystem typeSystem = TypeSystem.getInstance();
 
     private RequestContext() {
     }
@@ -37,6 +55,7 @@ public class RequestContext {
 
     public static RequestContext createContext() {
         RequestContext context = new RequestContext();
+        context.requestTime = System.currentTimeMillis();
         CURRENT_CONTEXT.set(context);
         return context;
     }
@@ -52,4 +71,40 @@ public class RequestContext {
     public void setUser(String user) {
         this.user = user;
     }
+
+    public void recordCreatedEntities(Collection<String> createdEntityIds) {
+        this.createdEntityIds.addAll(createdEntityIds);
+    }
+
+    public void recordUpdatedEntities(Collection<String> updatedEntityIds) {
+        this.updatedEntityIds.addAll(updatedEntityIds);
+    }
+
+    public void recordDeletedEntity(String entityId, String typeName) throws AtlasException {
+        ClassType type = typeSystem.getDataType(ClassType.class, typeName);
+        ITypedReferenceableInstance entity = type.createInstance(new Id(entityId, 0, typeName));
+        if (deletedEntityIds.add(entityId)) {
+            deletedEntities.add(entity);
+        }
+    }
+
+    public List<String> getCreatedEntityIds() {
+        return new ArrayList<>(createdEntityIds);
+    }
+
+    public List<String> getUpdatedEntityIds() {
+        return new ArrayList<>(updatedEntityIds);
+    }
+
+    public List<String> getDeletedEntityIds() {
+        return new ArrayList<>(deletedEntityIds);
+    }
+
+    public List<ITypedReferenceableInstance> getDeletedEntities() {
+        return deletedEntities;
+    }
+
+    public long getRequestTime() {
+        return requestTime;
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/40ee9492/typesystem/src/main/java/org/apache/atlas/typesystem/IInstance.java
----------------------------------------------------------------------
diff --git a/typesystem/src/main/java/org/apache/atlas/typesystem/IInstance.java b/typesystem/src/main/java/org/apache/atlas/typesystem/IInstance.java
index ffe40a7..adb28d4 100755
--- a/typesystem/src/main/java/org/apache/atlas/typesystem/IInstance.java
+++ b/typesystem/src/main/java/org/apache/atlas/typesystem/IInstance.java
@@ -37,4 +37,5 @@ public interface IInstance {
 
     Map<String, Object> getValuesMap() throws AtlasException;
 
+    String toShortString();
 }

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/40ee9492/typesystem/src/main/java/org/apache/atlas/typesystem/Referenceable.java
----------------------------------------------------------------------
diff --git a/typesystem/src/main/java/org/apache/atlas/typesystem/Referenceable.java b/typesystem/src/main/java/org/apache/atlas/typesystem/Referenceable.java
index 7857483..31f157e 100755
--- a/typesystem/src/main/java/org/apache/atlas/typesystem/Referenceable.java
+++ b/typesystem/src/main/java/org/apache/atlas/typesystem/Referenceable.java
@@ -166,6 +166,11 @@ public class Referenceable extends Struct implements IReferenceableInstance {
             '}';
     }
 
+    @Override
+    public String toShortString() {
+        return String.format("entity[type=%s guid=%s]", typeName, id._getId());
+    }
+
     public void replaceWithNewId(Id id) {
         this.id = id;
     }

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/40ee9492/typesystem/src/main/java/org/apache/atlas/typesystem/Struct.java
----------------------------------------------------------------------
diff --git a/typesystem/src/main/java/org/apache/atlas/typesystem/Struct.java b/typesystem/src/main/java/org/apache/atlas/typesystem/Struct.java
index 70deab2..8f32b1a 100755
--- a/typesystem/src/main/java/org/apache/atlas/typesystem/Struct.java
+++ b/typesystem/src/main/java/org/apache/atlas/typesystem/Struct.java
@@ -78,6 +78,11 @@ public class Struct implements IStruct {
     }
 
     @Override
+    public String toShortString() {
+        return String.format("struct[type=%s]", typeName);
+    }
+
+    @Override
     public int hashCode() {
         int result = typeName.hashCode();
         result = 31 * result + values.hashCode();

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/40ee9492/typesystem/src/main/java/org/apache/atlas/typesystem/persistence/DownCastStructInstance.java
----------------------------------------------------------------------
diff --git a/typesystem/src/main/java/org/apache/atlas/typesystem/persistence/DownCastStructInstance.java b/typesystem/src/main/java/org/apache/atlas/typesystem/persistence/DownCastStructInstance.java
index d3b9a33..e4ebb17 100755
--- a/typesystem/src/main/java/org/apache/atlas/typesystem/persistence/DownCastStructInstance.java
+++ b/typesystem/src/main/java/org/apache/atlas/typesystem/persistence/DownCastStructInstance.java
@@ -70,6 +70,11 @@ public class DownCastStructInstance implements IStruct {
         }
         return m;
     }
+
+    @Override
+    public String toShortString() {
+        return toString();
+    }
 }
 
 

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/40ee9492/typesystem/src/main/java/org/apache/atlas/typesystem/persistence/Id.java
----------------------------------------------------------------------
diff --git a/typesystem/src/main/java/org/apache/atlas/typesystem/persistence/Id.java b/typesystem/src/main/java/org/apache/atlas/typesystem/persistence/Id.java
index d742bb7..7ff7958 100755
--- a/typesystem/src/main/java/org/apache/atlas/typesystem/persistence/Id.java
+++ b/typesystem/src/main/java/org/apache/atlas/typesystem/persistence/Id.java
@@ -58,20 +58,20 @@ public class Id implements ITypedReferenceableInstance {
         }
     }
 
-    public Id(String id, int version, String className) {
-        this(id, version, className, null);
+    public Id(String id, int version, String typeName) {
+        this(id, version, typeName, null);
     }
 
-    public Id(long id, int version, String className) {
-        this("" + id, version, className);
+    public Id(long id, int version, String typeName) {
+        this("" + id, version, typeName);
     }
 
-    public Id(long id, int version, String className, String state) {
-        this("" + id, version, className, state);
+    public Id(long id, int version, String typeName, String state) {
+        this("" + id, version, typeName, state);
     }
 
-    public Id(String className) {
-        this("" + (-System.nanoTime()), 0, className);
+    public Id(String typeName) {
+        this("" + (-System.nanoTime()), 0, typeName);
     }
 
     public boolean isUnassigned() {
@@ -93,10 +93,16 @@ public class Id implements ITypedReferenceableInstance {
         return true;
     }
 
+    @Override
     public String toString() {
         return String.format("(type: %s, id: %s)", typeName, isUnassigned() ? "<unassigned>" : "" + id);
     }
 
+    @Override
+    public String toShortString() {
+        return String.format("id[type=%s guid=%s state=%s]", typeName, id, state);
+    }
+
     public String getClassName() {
         return typeName;
     }

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/40ee9492/typesystem/src/main/java/org/apache/atlas/typesystem/persistence/ReferenceableInstance.java
----------------------------------------------------------------------
diff --git a/typesystem/src/main/java/org/apache/atlas/typesystem/persistence/ReferenceableInstance.java b/typesystem/src/main/java/org/apache/atlas/typesystem/persistence/ReferenceableInstance.java
index 0fa4666..31ef49d 100755
--- a/typesystem/src/main/java/org/apache/atlas/typesystem/persistence/ReferenceableInstance.java
+++ b/typesystem/src/main/java/org/apache/atlas/typesystem/persistence/ReferenceableInstance.java
@@ -98,6 +98,19 @@ public class ReferenceableInstance extends StructInstance implements ITypedRefer
     }
 
     @Override
+    public String toShortString() {
+        String name = null;
+        if (fieldMapping().fields.containsKey("name")) {
+            try {
+                name = getString("name");
+            } catch (AtlasException e) {
+                //ignore if there is no field name
+            }
+        }
+        return String.format("entity[type=%s guid=%s name=%s]", getTypeName(), getId()._getId(), name);
+    }
+
+    @Override
     public String getSignatureHash(MessageDigest digester) throws AtlasException {
         ClassType classType = TypeSystem.getInstance().getDataType(ClassType.class, getTypeName());
         classType.updateSignatureHash(digester, this);

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/40ee9492/typesystem/src/main/java/org/apache/atlas/typesystem/persistence/StructInstance.java
----------------------------------------------------------------------
diff --git a/typesystem/src/main/java/org/apache/atlas/typesystem/persistence/StructInstance.java b/typesystem/src/main/java/org/apache/atlas/typesystem/persistence/StructInstance.java
index 16c3a24..af62442 100755
--- a/typesystem/src/main/java/org/apache/atlas/typesystem/persistence/StructInstance.java
+++ b/typesystem/src/main/java/org/apache/atlas/typesystem/persistence/StructInstance.java
@@ -764,4 +764,9 @@ public class StructInstance implements ITypedStruct {
         byte[] digest = digester.digest();
         return MD5Utils.toString(digest);
     }
+
+    @Override
+    public String toShortString() {
+        return String.format("struct[type=%s]", dataTypeName);
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/40ee9492/typesystem/src/test/java/org/apache/atlas/ApplicationPropertiesTest.java
----------------------------------------------------------------------
diff --git a/typesystem/src/test/java/org/apache/atlas/ApplicationPropertiesTest.java b/typesystem/src/test/java/org/apache/atlas/ApplicationPropertiesTest.java
index d8098ac..27f1f7e 100644
--- a/typesystem/src/test/java/org/apache/atlas/ApplicationPropertiesTest.java
+++ b/typesystem/src/test/java/org/apache/atlas/ApplicationPropertiesTest.java
@@ -17,10 +17,12 @@
 
 package org.apache.atlas;
 
+import org.apache.atlas.typesystem.types.TypeSystem;
 import org.apache.commons.configuration.Configuration;
-import org.testng.Assert;
 import org.testng.annotations.Test;
 
+import static org.testng.Assert.assertEquals;
+
 public class ApplicationPropertiesTest {
 
     @Test
@@ -28,17 +30,17 @@ public class ApplicationPropertiesTest {
         Configuration properties = ApplicationProperties.get(ApplicationProperties.APPLICATION_PROPERTIES);
 
         //plain property without variables
-        Assert.assertEquals(properties.getString("atlas.service"), "atlas");
+        assertEquals(properties.getString("atlas.service"), "atlas");
 
         //property containing system property
         String data = "/var/data/" + System.getProperty("user.name") + "/atlas";
-        Assert.assertEquals(properties.getString("atlas.data"), data);
+        assertEquals(properties.getString("atlas.data"), data);
 
         //property referencing other property
-        Assert.assertEquals(properties.getString("atlas.graph.data"), data + "/graph");
+        assertEquals(properties.getString("atlas.graph.data"), data + "/graph");
 
         //invalid system property - not substituted
-        Assert.assertEquals(properties.getString("atlas.db"), "${atlasdb}");
+        assertEquals(properties.getString("atlas.db"), "${atlasdb}");
     }
 
     @Test
@@ -47,9 +49,20 @@ public class ApplicationPropertiesTest {
         Configuration configuration = ApplicationProperties.get(ApplicationProperties.APPLICATION_PROPERTIES);
         Configuration subConfiguration = configuration.subset("atlas");
 
-        Assert.assertEquals(subConfiguration.getString("service"), "atlas");
+        assertEquals(subConfiguration.getString("service"), "atlas");
         String data = "/var/data/" + System.getProperty("user.name") + "/atlas";
-        Assert.assertEquals(subConfiguration.getString("data"), data);
-        Assert.assertEquals(subConfiguration.getString("graph.data"), data + "/graph");
+        assertEquals(subConfiguration.getString("data"), data);
+        assertEquals(subConfiguration.getString("graph.data"), data + "/graph");
+    }
+
+    @Test
+    public void testGetClass() throws Exception {
+        //read from atlas-application.properties
+        Class cls = ApplicationProperties.getClass("atlas.TypeSystem.impl", ApplicationProperties.class.getName());
+        assertEquals(cls.getName(), TypeSystem.class.getName());
+
+        //default value
+        cls = ApplicationProperties.getClass("atlas.TypeSystem2.impl", TypeSystem.class.getName());
+        assertEquals(cls.getName(), TypeSystem.class.getName());
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/40ee9492/typesystem/src/test/resources/atlas-application.properties
----------------------------------------------------------------------
diff --git a/typesystem/src/test/resources/atlas-application.properties b/typesystem/src/test/resources/atlas-application.properties
index dbd6002..ba66ae5 100644
--- a/typesystem/src/test/resources/atlas-application.properties
+++ b/typesystem/src/test/resources/atlas-application.properties
@@ -26,4 +26,6 @@ atlas.graph.data=${atlas.data}/graph
 atlas.service=atlas
 
 #invalid system property
-atlas.db=${atlasdb}
\ No newline at end of file
+atlas.db=${atlasdb}
+
+atlas.TypeSystem.impl=org.apache.atlas.typesystem.types.TypeSystem
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/40ee9492/webapp/src/test/java/org/apache/atlas/notification/NotificationHookConsumerIT.java
----------------------------------------------------------------------
diff --git a/webapp/src/test/java/org/apache/atlas/notification/NotificationHookConsumerIT.java b/webapp/src/test/java/org/apache/atlas/notification/NotificationHookConsumerIT.java
index b2e9f91..03a0d3f 100644
--- a/webapp/src/test/java/org/apache/atlas/notification/NotificationHookConsumerIT.java
+++ b/webapp/src/test/java/org/apache/atlas/notification/NotificationHookConsumerIT.java
@@ -21,6 +21,7 @@ package org.apache.atlas.notification;
 import com.google.inject.Inject;
 import org.apache.atlas.notification.hook.HookNotification;
 import org.apache.atlas.typesystem.Referenceable;
+import org.apache.atlas.typesystem.persistence.Id;
 import org.apache.atlas.web.resources.BaseResourceIT;
 import org.codehaus.jettison.json.JSONArray;
 import org.testng.annotations.AfterClass;
@@ -127,20 +128,19 @@ public class NotificationHookConsumerIT extends BaseResourceIT {
 
     @Test
     public void testDeleteByQualifiedName() throws Exception {
-        final Referenceable entity = new Referenceable(DATABASE_TYPE);
+        Referenceable entity = new Referenceable(DATABASE_TYPE);
         final String dbName = "db" + randomString();
         entity.set("name", dbName);
         entity.set("description", randomString());
-        serviceClient.createEntity(entity);
+        final String dbId = serviceClient.createEntity(entity).getString(0);
 
         sendHookMessage(
             new HookNotification.EntityDeleteRequest(TEST_USER, DATABASE_TYPE, "name", dbName));
         waitFor(MAX_WAIT_TIME, new Predicate() {
             @Override
             public boolean evaluate() throws Exception {
-                JSONArray results = serviceClient.searchByDSL(String.format("%s where name='%s'", DATABASE_TYPE,
-                    dbName));
-                return results.length() == 0;
+                Referenceable getEntity = serviceClient.getEntity(dbId);
+                return getEntity.getId().getState() == Id.EntityState.DELETED;
             }
         });
     }

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/40ee9492/webapp/src/test/java/org/apache/atlas/web/resources/EntityJerseyResourceIT.java
----------------------------------------------------------------------
diff --git a/webapp/src/test/java/org/apache/atlas/web/resources/EntityJerseyResourceIT.java b/webapp/src/test/java/org/apache/atlas/web/resources/EntityJerseyResourceIT.java
index 23f6874..720ce79 100755
--- a/webapp/src/test/java/org/apache/atlas/web/resources/EntityJerseyResourceIT.java
+++ b/webapp/src/test/java/org/apache/atlas/web/resources/EntityJerseyResourceIT.java
@@ -810,15 +810,8 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
 
         // Verify entities were deleted from the repository.
         for (String guid : deletedGuidsList) {
-            try {
-                serviceClient.getEntity(guid);
-                Assert.fail(AtlasServiceException.class.getSimpleName() + 
-                    " was expected but not thrown.  The entity with guid " + guid + 
-                    " still exists in the repository after being deleted.");
-            }
-            catch (AtlasServiceException e) {
-                Assert.assertTrue(e.getMessage().contains(Integer.toString(Response.Status.NOT_FOUND.getStatusCode())));
-            }
+            Referenceable entity = serviceClient.getEntity(guid);
+            assertEquals(entity.getId().getState(), Id.EntityState.DELETED);
         }
     }
     
@@ -844,15 +837,8 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
         
         // Verify entities were deleted from the repository.
         for (String guid : deletedGuidsList) {
-            try {
-                serviceClient.getEntity(guid);
-                Assert.fail(AtlasServiceException.class.getSimpleName() + 
-                    " was expected but not thrown.  The entity with guid " + guid + 
-                    " still exists in the repository after being deleted.");
-            }
-            catch (AtlasServiceException e) {
-                Assert.assertTrue(e.getMessage().contains(Integer.toString(Response.Status.NOT_FOUND.getStatusCode())));
-            }
+            Referenceable entity = serviceClient.getEntity(guid);
+            assertEquals(entity.getId().getState(), Id.EntityState.DELETED);
         }
     }
 
@@ -874,15 +860,8 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
 
         // Verify entities were deleted from the repository.
         for (String guid : deletedGuidsList) {
-            try {
-                serviceClient.getEntity(guid);
-                Assert.fail(AtlasServiceException.class.getSimpleName() +
-                    " was expected but not thrown.  The entity with guid " + guid +
-                    " still exists in the repository after being deleted.");
-            }
-            catch (AtlasServiceException e) {
-                Assert.assertTrue(e.getMessage().contains(Integer.toString(Response.Status.NOT_FOUND.getStatusCode())));
-            }
+            Referenceable entity = serviceClient.getEntity(guid);
+            assertEquals(entity.getId().getState(), Id.EntityState.DELETED);
         }
     }
 


Mime
View raw message