You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@atlas.apache.org by ma...@apache.org on 2016/12/21 18:20:30 UTC

[1/3] incubator-atlas git commit: ATLAS-1311: Integration tests for V2 Entity APIs

Repository: incubator-atlas
Updated Branches:
  refs/heads/master 3b1a7d09c -> ec1b160ac


http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/ec1b160a/webapp/src/test/java/org/apache/atlas/web/resources/EntityV2JerseyResourceIT.java
----------------------------------------------------------------------
diff --git a/webapp/src/test/java/org/apache/atlas/web/resources/EntityV2JerseyResourceIT.java b/webapp/src/test/java/org/apache/atlas/web/resources/EntityV2JerseyResourceIT.java
new file mode 100755
index 0000000..c407130
--- /dev/null
+++ b/webapp/src/test/java/org/apache/atlas/web/resources/EntityV2JerseyResourceIT.java
@@ -0,0 +1,669 @@
+/**
+ * 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.web.resources;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Lists;
+import com.google.inject.Inject;
+import com.sun.jersey.api.client.ClientResponse;
+import org.apache.atlas.AtlasClient;
+import org.apache.atlas.AtlasServiceException;
+import org.apache.atlas.EntityAuditEvent;
+import org.apache.atlas.model.instance.AtlasClassification;
+import org.apache.atlas.model.instance.AtlasClassification.AtlasClassifications;
+import org.apache.atlas.model.instance.AtlasEntity;
+import org.apache.atlas.model.instance.AtlasEntityHeader;
+import org.apache.atlas.model.instance.AtlasEntityWithAssociations;
+import org.apache.atlas.model.instance.EntityMutationResponse;
+import org.apache.atlas.model.instance.EntityMutations;
+import org.apache.atlas.model.typedef.AtlasClassificationDef;
+import org.apache.atlas.model.typedef.AtlasEntityDef;
+import org.apache.atlas.model.typedef.AtlasTypesDef;
+import org.apache.atlas.notification.NotificationConsumer;
+import org.apache.atlas.notification.NotificationInterface;
+import org.apache.atlas.notification.NotificationModule;
+import org.apache.atlas.notification.entity.EntityNotification;
+import org.apache.atlas.type.AtlasTypeUtil;
+import org.apache.atlas.typesystem.types.TypeUtils;
+import org.apache.commons.lang.RandomStringUtils;
+import org.codehaus.jettison.json.JSONArray;
+import org.joda.time.DateTime;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.testng.Assert;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Guice;
+import org.testng.annotations.Test;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import static org.testng.Assert.*;
+
+
+/**
+ * Integration tests for Entity Jersey Resource.
+ */
+@Guice(modules = {NotificationModule.class})
+public class EntityV2JerseyResourceIT extends BaseResourceIT {
+
+    private static final Logger LOG = LoggerFactory.getLogger(EntityV2JerseyResourceIT.class);
+
+    private final String DATABASE_NAME = "db" + randomString();
+    private final String TABLE_NAME = "table" + randomString();
+    private static final String TRAITS = "traits";
+    private static final String TRAIT_DEFINITION = "traitDefinitions";
+
+    private String traitName;
+
+    private AtlasEntity dbEntity;
+    private AtlasEntityHeader dbEntityHeader;
+    private AtlasEntityWithAssociations tableEntity;
+    private AtlasEntityHeader tableEntityHeader;
+
+    @Inject
+    private NotificationInterface notificationInterface;
+    private NotificationConsumer<EntityNotification> notificationConsumer;
+
+    @BeforeClass
+    public void setUp() throws Exception {
+        super.setUp();
+
+        createTypeDefinitionsV2();
+
+        List<NotificationConsumer<EntityNotification>> consumers =
+                notificationInterface.createConsumers(NotificationInterface.NotificationType.ENTITIES, 1);
+
+        notificationConsumer = consumers.iterator().next();
+    }
+
+    @Test
+    public void testSubmitEntity() throws Exception {
+        TypeUtils.Pair dbAndTable = createDBAndTable(DATABASE_NAME, TABLE_NAME);
+        assertNotNull(dbAndTable);
+        assertNotNull(dbAndTable.left);
+        assertNotNull(dbAndTable.right);
+    }
+
+    @Test
+    public void testRequestUser() throws Exception {
+        AtlasEntity hiveDBInstanceV2 = createHiveDB(DATABASE_NAME);
+        List<EntityAuditEvent> events = atlasClientV1.getEntityAuditEvents(hiveDBInstanceV2.getGuid(), (short) 10);
+        assertTrue(events.size() > 1);
+        assertEquals(events.get(0).getUser(), "admin");
+    }
+
+    @Test
+    public void testEntityDeduping() throws Exception {
+        JSONArray results = searchByDSL(String.format("%s where name='%s'", DATABASE_TYPE, DATABASE_NAME));
+        assertEquals(results.length(), 1);
+
+        final AtlasEntity hiveDBInstanceV2 = createHiveDB(DATABASE_NAME);
+        // Do the notification thing here
+        waitForNotification(notificationConsumer, MAX_WAIT_TIME, new NotificationPredicate() {
+            @Override
+            public boolean evaluate(EntityNotification notification) throws Exception {
+                return notification != null && notification.getEntity().getId()._getId().equals(hiveDBInstanceV2.getGuid());
+            }
+        });
+
+
+        results = searchByDSL(String.format("%s where name='%s'", DATABASE_TYPE, DATABASE_NAME));
+        assertEquals(results.length(), 1);
+
+        //Test the same across references
+        final String tableName = randomString();
+        AtlasEntityWithAssociations hiveTableInstanceV2 = createHiveTableInstanceV2(hiveDBInstanceV2, tableName);
+        hiveTableInstanceV2.setAttribute(AtlasClient.REFERENCEABLE_ATTRIBUTE_NAME, tableName);
+
+        EntityMutationResponse entity = entitiesClientV2.createEntity(hiveTableInstanceV2);
+        assertNotNull(entity);
+        assertNotNull(entity.getEntitiesByOperation(EntityMutations.EntityOperation.CREATE_OR_UPDATE));
+        results = searchByDSL(String.format("%s where name='%s'", DATABASE_TYPE, DATABASE_NAME));
+        assertEquals(results.length(), 1);
+    }
+
+    private void assertEntityAudit(String dbid, EntityAuditEvent.EntityAuditAction auditAction)
+            throws Exception {
+        List<EntityAuditEvent> events = atlasClientV1.getEntityAuditEvents(dbid, (short) 100);
+        for (EntityAuditEvent event : events) {
+            if (event.getAction() == auditAction) {
+                return;
+            }
+        }
+        fail("Expected audit event with action = " + auditAction);
+    }
+
+    @Test
+    public void testEntityDefinitionAcrossTypeUpdate() throws Exception {
+        //create type
+        AtlasEntityDef entityDef = AtlasTypeUtil
+                .createClassTypeDef(randomString(),
+                        ImmutableSet.<String>of(),
+                        AtlasTypeUtil.createUniqueRequiredAttrDef("name", "string")
+                );
+        AtlasTypesDef typesDef = new AtlasTypesDef();
+        typesDef.getEntityDefs().add(entityDef);
+
+        AtlasTypesDef created = typedefClientV2.createAtlasTypeDefs(typesDef);
+        assertNotNull(created);
+        assertNotNull(created.getEntityDefs());
+        assertEquals(created.getEntityDefs().size(), 1);
+
+        //create entity for the type
+        AtlasEntity instance = new AtlasEntity(entityDef.getName());
+        instance.setAttribute("name", randomString());
+        EntityMutationResponse mutationResponse = entitiesClientV2.createEntity(instance);
+        assertNotNull(mutationResponse);
+        assertNotNull(mutationResponse.getEntitiesByOperation(EntityMutations.EntityOperation.CREATE_OR_UPDATE));
+        assertEquals(mutationResponse.getEntitiesByOperation(EntityMutations.EntityOperation.CREATE_OR_UPDATE).size(),1 );
+        String guid = mutationResponse.getEntitiesByOperation(EntityMutations.EntityOperation.CREATE_OR_UPDATE).get(0).getGuid();
+
+        //update type - add attribute
+        entityDef = AtlasTypeUtil.createClassTypeDef(entityDef.getName(), ImmutableSet.<String>of(),
+                AtlasTypeUtil.createUniqueRequiredAttrDef("name", "string"),
+                AtlasTypeUtil.createOptionalAttrDef("description", "string"));
+
+        typesDef = new AtlasTypesDef();
+        typesDef.getEntityDefs().add(entityDef);
+
+        AtlasTypesDef updated = typedefClientV2.updateAtlasTypeDefs(typesDef);
+        assertNotNull(updated);
+        assertNotNull(updated.getEntityDefs());
+        assertEquals(updated.getEntityDefs().size(), 1);
+
+        //Get definition after type update - new attributes should be null
+        AtlasEntity entityByGuid = entitiesClientV2.getEntityByGuid(guid);
+        assertNull(entityByGuid.getAttribute("description"));
+        assertEquals(entityByGuid.getAttribute("name"), instance.getAttribute("name"));
+    }
+
+    @DataProvider
+    public Object[][] invalidAttrValues() {
+        return new Object[][]{{null}, {""}};
+    }
+
+    @Test(dataProvider = "invalidAttrValues")
+    public void testEntityInvalidValue(String value) throws Exception {
+        AtlasEntity databaseInstance = new AtlasEntity(DATABASE_TYPE);
+        String dbName = randomString();
+        databaseInstance.setAttribute("name", dbName);
+        databaseInstance.setAttribute("description", value);
+
+        AtlasEntityHeader created = createEntity(databaseInstance);
+        assertNull(created);
+    }
+
+    @Test
+    public void testGetEntityByAttribute() throws Exception {
+        AtlasEntity hiveDB = createHiveDB(DATABASE_NAME);
+        String qualifiedName = (String) hiveDB.getAttribute(QUALIFIED_NAME);
+        //get entity by attribute
+        AtlasEntity byAttribute = entitiesClientV2.getEntityByAttribute(DATABASE_TYPE, QUALIFIED_NAME, qualifiedName);
+        assertEquals(byAttribute.getTypeName(), DATABASE_TYPE);
+        assertEquals(byAttribute.getAttribute(QUALIFIED_NAME), qualifiedName);
+    }
+
+    @Test
+    public void testSubmitEntityWithBadDateFormat() throws Exception {
+        AtlasEntity hiveDBInstance = createHiveDBInstanceV2("db" + randomString());
+        AtlasEntityHeader entity = createEntity(hiveDBInstance);
+
+        AtlasEntity tableInstance = createHiveTableInstanceV2(hiveDBInstance, "table" + randomString());
+        tableInstance.setAttribute("lastAccessTime", "2014-07-11");
+        AtlasEntityHeader tableEntityHeader = createEntity(tableInstance);
+        assertNull(tableEntityHeader);
+    }
+
+    @Test(dependsOnMethods = "testSubmitEntity")
+    public void testAddProperty() throws Exception {
+        //add property
+        String description = "bar table - new desc";
+        addProperty(tableEntity.getGuid(), "description", description);
+
+        AtlasEntity entityByGuid = entitiesClientV2.getEntityByGuid(tableEntity.getGuid());
+        Assert.assertNotNull(entityByGuid);
+
+        entityByGuid.setAttribute("description", description);
+
+        // TODO: This behavior should've been consistent across APIs
+//        //invalid property for the type
+//        try {
+//            addProperty(table.getGuid(), "invalid_property", "bar table");
+//            Assert.fail("Expected AtlasServiceException");
+//        } catch (AtlasServiceException e) {
+//            assertNotNull(e.getStatus());
+//            assertEquals(e.getStatus(), ClientResponse.Status.BAD_REQUEST);
+//        }
+
+        //non-string property, update
+        String currentTime = String.valueOf(new DateTime());
+
+
+        addProperty(tableEntity.getGuid(), "createTime", currentTime);
+
+        entityByGuid = entitiesClientV2.getEntityByGuid(tableEntity.getGuid());
+        Assert.assertNotNull(entityByGuid);
+    }
+
+    @Test
+    public void testAddNullPropertyValue() throws Exception {
+        // FIXME: Behavior has changed between v1 and v2
+        //add property
+//        try {
+            addProperty(tableEntity.getGuid(), "description", null);
+//            Assert.fail("Expected AtlasServiceException");
+//        } catch(AtlasServiceException e) {
+//            Assert.assertEquals(e.getStatus().getStatusCode(), Response.Status.BAD_REQUEST.getStatusCode());
+//        }
+    }
+
+    @Test(expectedExceptions = AtlasServiceException.class)
+    public void testGetInvalidEntityDefinition() throws Exception {
+        entitiesClientV2.getEntityByGuid("blah");
+    }
+
+    @Test(dependsOnMethods = "testSubmitEntity", enabled = false)
+    public void testGetEntityList() throws Exception {
+        // TODO: Can only be done when there's a search API exposed from entity REST
+    }
+
+    @Test(enabled = false)
+    public void testGetEntityListForBadEntityType() throws Exception {
+        // FIXME: Complete test when search interface is in place
+    }
+
+    @Test(enabled = false)
+    public void testGetEntityListForNoInstances() throws Exception {
+        // FIXME: Complete test when search interface is in place
+        /*
+        String typeName = "";
+
+        ClientResponse clientResponse =
+                service.path(ENTITIES).queryParam("type", typeName).accept(Servlets.JSON_MEDIA_TYPE)
+                        .type(Servlets.JSON_MEDIA_TYPE).method(HttpMethod.GET, ClientResponse.class);
+        Assert.assertEquals(clientResponse.getStatus(), Response.Status.OK.getStatusCode());
+
+        String responseAsString = clientResponse.getEntity(String.class);
+        Assert.assertNotNull(responseAsString);
+
+        JSONObject response = new JSONObject(responseAsString);
+        Assert.assertNotNull(response.get(AtlasClient.REQUEST_ID));
+
+        final JSONArray list = response.getJSONArray(AtlasClient.RESULTS);
+        Assert.assertEquals(list.length(), 0);
+         */
+    }
+
+    private String addNewType() throws Exception {
+        String typeName = "test" + randomString();
+        AtlasEntityDef classTypeDef = AtlasTypeUtil
+                .createClassTypeDef(typeName, ImmutableSet.<String>of(),
+                        AtlasTypeUtil.createRequiredAttrDef("name", "string"),
+                        AtlasTypeUtil.createRequiredAttrDef("description", "string"));
+        AtlasTypesDef typesDef = new AtlasTypesDef();
+        typesDef.getEntityDefs().add(classTypeDef);
+        createType(typesDef);
+        return typeName;
+    }
+
+    @Test(dependsOnMethods = "testSubmitEntity")
+    public void testGetTraitNames() throws Exception {
+        AtlasClassifications classifications = entitiesClientV2.getClassifications(tableEntity.getGuid());
+        assertNotNull(classifications);
+        assertTrue(classifications.getList().size() > 0);
+        assertEquals(classifications.getList().size(), 8);
+    }
+
+    private void addProperty(String guid, String property, String value) throws AtlasServiceException {
+
+        AtlasEntity entityByGuid = entitiesClientV2.getEntityByGuid(guid);
+        entityByGuid.setAttribute(property, value);
+        EntityMutationResponse response = entitiesClientV2.updateEntity(entityByGuid);
+        assertNotNull(response);
+        assertNotNull(response.getEntitiesByOperation(EntityMutations.EntityOperation.CREATE_OR_UPDATE));
+    }
+
+    private AtlasEntity createHiveDB() {
+        if (dbEntity != null) {
+            return dbEntity;
+        } else {
+            return createHiveDB(DATABASE_NAME);
+        }
+    }
+
+    private AtlasEntity createHiveDB(String dbName) {
+        AtlasEntity hiveDBInstanceV2 = createHiveDBInstanceV2(dbName);
+        AtlasEntityHeader entityHeader = createEntity(hiveDBInstanceV2);
+        assertNotNull(entityHeader);
+        assertNotNull(entityHeader.getGuid());
+        hiveDBInstanceV2.setGuid(entityHeader.getGuid());
+        dbEntity = hiveDBInstanceV2;
+        dbEntityHeader = entityHeader;
+        return hiveDBInstanceV2;
+    }
+
+    private TypeUtils.Pair<AtlasEntity, AtlasEntityWithAssociations> createDBAndTable(String dbName, String tableName) throws Exception {
+        AtlasEntity dbInstanceV2 = createHiveDB(dbName);
+        AtlasEntityWithAssociations hiveTableInstanceV2 = createHiveTable(dbInstanceV2, tableName);
+        return TypeUtils.Pair.of(dbInstanceV2, hiveTableInstanceV2);
+    }
+
+    private AtlasEntityWithAssociations createHiveTable() throws Exception {
+        if (tableEntity != null) {
+            return tableEntity;
+        } else {
+            return createHiveTable(createHiveDB(), TABLE_NAME);
+        }
+    }
+
+    private AtlasEntityWithAssociations createHiveTable(AtlasEntity dbInstanceV2, String tableName) throws Exception {
+        AtlasEntityWithAssociations hiveTableInstanceV2 = createHiveTableInstanceV2(dbInstanceV2, tableName);
+        AtlasEntityHeader createdHeader = createEntity(hiveTableInstanceV2);
+        assertNotNull(createdHeader);
+        assertNotNull(createdHeader.getGuid());
+        hiveTableInstanceV2.setGuid(createdHeader.getGuid());
+        entitiesClientV2.addClassifications(createdHeader.getGuid(), hiveTableInstanceV2.getClassifications());
+        tableEntity = hiveTableInstanceV2;
+        tableEntityHeader = createdHeader;
+        return hiveTableInstanceV2;
+    }
+
+    @Test(dependsOnMethods = "testGetTraitNames")
+    public void testAddTrait() throws Exception {
+        traitName = "PII_Trait" + randomString();
+        AtlasClassificationDef piiTrait =
+                AtlasTypeUtil.createTraitTypeDef(traitName, ImmutableSet.<String>of());
+        AtlasTypesDef typesDef = new AtlasTypesDef();
+        typesDef.getClassificationDefs().add(piiTrait);
+        createType(typesDef);
+
+        entitiesClientV2.addClassifications(tableEntity.getGuid(), ImmutableList.of(new AtlasClassification(piiTrait.getName())));
+
+        assertEntityAudit(tableEntity.getGuid(), EntityAuditEvent.EntityAuditAction.TAG_ADD);
+    }
+
+    @Test(dependsOnMethods = "testSubmitEntity")
+    public void testGetTraitDefinitionForEntity() throws Exception{
+        traitName = "PII_Trait" + randomString();
+        AtlasClassificationDef piiTrait =
+                AtlasTypeUtil.createTraitTypeDef(traitName, ImmutableSet.<String>of());
+        AtlasTypesDef typesDef = new AtlasTypesDef();
+        typesDef.getClassificationDefs().add(piiTrait);
+        createType(typesDef);
+
+        AtlasClassificationDef classificationByName = typedefClientV2.getClassificationByName(traitName);
+        assertNotNull(classificationByName);
+
+        assertEquals(tableEntity.getClassifications().size(), 7);
+
+        AtlasClassification piiClassification = new AtlasClassification(piiTrait.getName());
+
+        entitiesClientV2.addClassifications(tableEntity.getGuid(), Lists.newArrayList(piiClassification));
+
+        AtlasClassifications classifications = entitiesClientV2.getClassifications(tableEntity.getGuid());
+        assertNotNull(classifications);
+        assertTrue(classifications.getList().size() > 0);
+        assertEquals(classifications.getList().size(), 8);
+    }
+
+
+    @Test(dependsOnMethods = "testGetTraitNames")
+    public void testAddTraitWithAttribute() throws Exception {
+        final String traitName = "PII_Trait" + randomString();
+        AtlasClassificationDef piiTrait = AtlasTypeUtil
+                .createTraitTypeDef(traitName, ImmutableSet.<String>of(),
+                        AtlasTypeUtil.createRequiredAttrDef("type", "string"));
+        AtlasTypesDef typesDef = new AtlasTypesDef();
+        typesDef.getClassificationDefs().add(piiTrait);
+        createType(typesDef);
+
+        AtlasClassification traitInstance = new AtlasClassification(traitName);
+        traitInstance.setAttribute("type", "SSN");
+
+        final String guid = tableEntity.getGuid();
+        entitiesClientV2.addClassifications(guid, ImmutableList.of(traitInstance));
+
+        // verify the response
+        AtlasEntityWithAssociations withAssociationByGuid = entitiesClientV2.getEntityWithAssociationByGuid(guid);
+        assertNotNull(withAssociationByGuid);
+        assertFalse(withAssociationByGuid.getClassifications().isEmpty());
+
+        boolean found = false;
+        for (AtlasClassification atlasClassification : withAssociationByGuid.getClassifications()) {
+            String attribute = (String)atlasClassification.getAttribute("type");
+            if (attribute != null && attribute.equals("SSN")) {
+                found = true;
+                break;
+            }
+        }
+        assertTrue(found);
+    }
+
+    @Test(expectedExceptions = AtlasServiceException.class)
+    public void testAddTraitWithNoRegistration() throws Exception {
+        final String traitName = "PII_Trait" + randomString();
+        AtlasClassificationDef piiTrait =
+                AtlasTypeUtil.createTraitTypeDef(traitName, ImmutableSet.<String>of());
+
+        AtlasClassification traitInstance = new AtlasClassification(traitName);
+
+        entitiesClientV2.addClassifications("random", ImmutableList.of(traitInstance));
+    }
+
+    @Test(dependsOnMethods = "testAddTrait")
+    public void testDeleteTrait() throws Exception {
+        final String guid = tableEntity.getGuid();
+
+        try {
+            entitiesClientV2.deleteClassification(guid, traitName);
+        } catch (AtlasServiceException ex) {
+            fail("Deletion should've succeeded");
+        }
+        assertEntityAudit(guid, EntityAuditEvent.EntityAuditAction.TAG_DELETE);
+    }
+
+    @Test
+    public void testDeleteTraitNonExistent() throws Exception {
+        final String traitName = "blah_trait";
+
+        try {
+            entitiesClientV2.deleteClassification("random", traitName);
+            fail("Deletion for bogus names shouldn't have succeeded");
+        } catch (AtlasServiceException ex) {
+            assertNotNull(ex.getStatus());
+//            assertEquals(ex.getStatus(), ClientResponse.Status.NOT_FOUND);
+            assertEquals(ex.getStatus(), ClientResponse.Status.BAD_REQUEST);
+            // Should it be a 400 or 404
+        }
+    }
+
+    @Test(dependsOnMethods = "testSubmitEntity")
+    public void testDeleteExistentTraitNonExistentForEntity() throws Exception {
+
+        final String guid = tableEntity.getGuid();
+        final String traitName = "PII_Trait" + randomString();
+        AtlasClassificationDef piiTrait = AtlasTypeUtil
+                .createTraitTypeDef(traitName, ImmutableSet.<String>of(),
+                        AtlasTypeUtil.createRequiredAttrDef("type", "string"));
+        AtlasTypesDef typesDef = new AtlasTypesDef();
+        typesDef.getClassificationDefs().add(piiTrait);
+        createType(typesDef);
+
+        try {
+            entitiesClientV2.deleteClassification(guid, traitName);
+            fail("Deletion should've failed for non-existent trait association");
+        } catch (AtlasServiceException ex) {
+            Assert.assertNotNull(ex.getStatus());
+            assertEquals(ex.getStatus(), ClientResponse.Status.NOT_FOUND);
+        }
+    }
+
+    private String random() {
+        return RandomStringUtils.random(10);
+    }
+
+    @Test
+    public void testUTF8() throws Exception {
+        String classType = random();
+        String attrName = random();
+        String attrValue = random();
+
+        AtlasEntityDef classTypeDef = AtlasTypeUtil
+                .createClassTypeDef(classType, ImmutableSet.<String>of(),
+                        AtlasTypeUtil.createUniqueRequiredAttrDef(attrName, "string"));
+        AtlasTypesDef atlasTypesDef = new AtlasTypesDef();
+        atlasTypesDef.getEntityDefs().add(classTypeDef);
+        createType(atlasTypesDef);
+
+        AtlasEntity instance = new AtlasEntity(classType);
+        instance.setAttribute(attrName, attrValue);
+        AtlasEntityHeader entity = createEntity(instance);
+        assertNotNull(entity);
+        assertNotNull(entity.getGuid());
+
+        AtlasEntity entityByGuid = entitiesClientV2.getEntityByGuid(entity.getGuid());
+        assertEquals(entityByGuid.getAttribute(attrName), attrValue);
+    }
+
+    @Test(dependsOnMethods = "testSubmitEntity")
+    public void testPartialUpdate() throws Exception {
+        final List<AtlasEntity> columns = new ArrayList<>();
+        Map<String, Object> values = new HashMap<>();
+        values.put("name", "col1");
+        values.put(QUALIFIED_NAME, "qualifiedName.col1");
+        values.put("type", "string");
+        values.put("comment", "col1 comment");
+
+        AtlasEntity ref = new AtlasEntity(BaseResourceIT.COLUMN_TYPE, values);
+        columns.add(ref);
+
+        AtlasEntityWithAssociations tableUpdated = tableEntity;
+        tableEntity.setAttribute("columns", columns);
+
+        LOG.debug("Updating entity= " + tableUpdated);
+        EntityMutationResponse updateResult = entitiesClientV2.updateEntity(tableEntity.getGuid(), tableUpdated);
+        assertNotNull(updateResult);
+        assertNotNull(updateResult.getEntitiesByOperation(EntityMutations.EntityOperation.CREATE_OR_UPDATE));
+        assertTrue(updateResult.getEntitiesByOperation(EntityMutations.EntityOperation.CREATE_OR_UPDATE).size() > 0);
+
+        AtlasEntity entityByGuid = entitiesClientV2.getEntityByGuid(tableEntity.getGuid());
+        assertNotNull(entityByGuid);
+        List<AtlasEntity> columns1 = (List<AtlasEntity>) entityByGuid.getAttribute("columns");
+
+        //Update by unique attribute
+        values.put("type", "int");
+        ref = new AtlasEntity(BaseResourceIT.COLUMN_TYPE, values);
+        columns.set(0, ref);
+        tableUpdated = tableEntity;
+        tableUpdated.setAttribute("columns", columns);
+
+        LOG.debug("Updating entity= " + tableUpdated);
+        EntityMutationResponse updateResponse = entitiesClientV2.updateEntityByAttribute(BaseResourceIT.HIVE_TABLE_TYPE, AtlasClient.REFERENCEABLE_ATTRIBUTE_NAME,
+                (String) tableEntity.getAttribute("name"), tableUpdated);
+        assertNotNull(updateResponse);
+        assertNotNull(updateResponse.getEntitiesByOperation(EntityMutations.EntityOperation.CREATE_OR_UPDATE));
+        assertTrue(updateResponse.getEntitiesByOperation(EntityMutations.EntityOperation.CREATE_OR_UPDATE).size() > 0);
+
+        entityByGuid = entitiesClientV2.getEntityByGuid(tableEntity.getGuid());
+        assertNotNull(entityByGuid);
+        columns1 = (List<AtlasEntity>) entityByGuid.getAttribute("columns");
+    }
+
+    @Test(dependsOnMethods = "testSubmitEntity")
+    public void testCompleteUpdate() throws Exception {
+        final List<AtlasEntity> columns = new ArrayList<>();
+        Map<String, Object> values1 = new HashMap<>();
+        values1.put("name", "col3");
+        values1.put(QUALIFIED_NAME, "qualifiedName.col3");
+        values1.put("type", "string");
+        values1.put("comment", "col3 comment");
+
+        Map<String, Object> values2 = new HashMap<>();
+        values2.put("name", "col4");
+        values2.put(QUALIFIED_NAME, "qualifiedName.col4");
+        values2.put("type", "string");
+        values2.put("comment", "col4 comment");
+
+        AtlasEntity ref1 = new AtlasEntity(BaseResourceIT.COLUMN_TYPE, values1);
+        AtlasEntity ref2 = new AtlasEntity(BaseResourceIT.COLUMN_TYPE, values2);
+        columns.add(ref1);
+        columns.add(ref2);
+        tableEntity.setAttribute("columns", columns);
+        EntityMutationResponse updateEntityResult = entitiesClientV2.updateEntity(tableEntity);
+        assertNotNull(updateEntityResult);
+        assertNotNull(updateEntityResult.getEntitiesByOperation(EntityMutations.EntityOperation.CREATE_OR_UPDATE));
+        assertEquals(updateEntityResult.getEntitiesByOperation(EntityMutations.EntityOperation.CREATE_OR_UPDATE).size(), 3);
+
+        AtlasEntity entityByGuid = entitiesClientV2.getEntityByGuid(tableEntity.getGuid());
+        List<AtlasEntity> refs = (List<AtlasEntity>) entityByGuid.getAttribute("columns");
+        assertEquals(refs.size(), 2);
+    }
+
+    @Test
+    public void testDeleteEntities() throws Exception {
+        // Create 2 database entities
+        AtlasEntity db1 = new AtlasEntity(DATABASE_TYPE);
+        String dbName1 = randomString();
+        db1.setAttribute("name", dbName1);
+        db1.setAttribute(QUALIFIED_NAME, dbName1);
+        db1.setAttribute("clusterName", randomString());
+        db1.setAttribute("description", randomString());
+        AtlasEntityHeader entity1Header = createEntity(db1);
+        AtlasEntity db2 = new AtlasEntity(DATABASE_TYPE);
+        String dbName2 = randomString();
+        db2.setAttribute("name", dbName2);
+        db2.setAttribute(QUALIFIED_NAME, dbName2);
+        db2.setAttribute("clusterName", randomString());
+        db2.setAttribute("description", randomString());
+        AtlasEntityHeader entity2Header = createEntity(db2);
+
+        // Delete the database entities
+        EntityMutationResponse deleteResponse = entitiesClientV2.deleteEntityByGuid(ImmutableList.of(entity1Header.getGuid(), entity2Header.getGuid()));
+
+        // Verify that deleteEntities() response has database entity guids
+        assertNotNull(deleteResponse);
+        assertNotNull(deleteResponse.getEntitiesByOperation(EntityMutations.EntityOperation.DELETE));
+        assertEquals(deleteResponse.getEntitiesByOperation(EntityMutations.EntityOperation.DELETE).size(), 2);
+
+        // Verify entities were deleted from the repository.
+    }
+
+    @Test
+    public void testDeleteEntityByUniqAttribute() throws Exception {
+        // Create database entity
+        AtlasEntity hiveDB = createHiveDB(DATABASE_NAME + random());
+        String qualifiedName = (String) hiveDB.getAttribute(QUALIFIED_NAME);
+
+        // Delete the database entity
+        EntityMutationResponse deleteResponse = entitiesClientV2.deleteEntityByAttribute(DATABASE_TYPE, QUALIFIED_NAME, qualifiedName);
+
+        // Verify that deleteEntities() response has database entity guids
+        assertNotNull(deleteResponse);
+        assertNotNull(deleteResponse.getEntitiesByOperation(EntityMutations.EntityOperation.DELETE));
+        assertEquals(deleteResponse.getEntitiesByOperation(EntityMutations.EntityOperation.DELETE).size(), 1);
+
+        // Verify entities were deleted from the repository.
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/ec1b160a/webapp/src/test/java/org/apache/atlas/web/resources/MetadataDiscoveryJerseyResourceIT.java
----------------------------------------------------------------------
diff --git a/webapp/src/test/java/org/apache/atlas/web/resources/MetadataDiscoveryJerseyResourceIT.java b/webapp/src/test/java/org/apache/atlas/web/resources/MetadataDiscoveryJerseyResourceIT.java
index ed37c3a..b004cb5 100755
--- a/webapp/src/test/java/org/apache/atlas/web/resources/MetadataDiscoveryJerseyResourceIT.java
+++ b/webapp/src/test/java/org/apache/atlas/web/resources/MetadataDiscoveryJerseyResourceIT.java
@@ -22,7 +22,6 @@ import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableSet;
 import com.sun.jersey.api.client.ClientResponse;
 import com.sun.jersey.core.util.MultivaluedMapImpl;
-import org.apache.atlas.AtlasBaseClient;
 import org.apache.atlas.AtlasClient;
 import org.apache.atlas.AtlasServiceException;
 import org.apache.atlas.typesystem.Referenceable;
@@ -43,7 +42,6 @@ import org.testng.annotations.BeforeClass;
 import org.testng.annotations.Test;
 
 import javax.ws.rs.core.MultivaluedMap;
-import javax.ws.rs.core.Response;
 import java.util.List;
 
 import static org.testng.Assert.assertEquals;
@@ -55,10 +53,6 @@ import static org.testng.Assert.fail;
  */
 public class MetadataDiscoveryJerseyResourceIT extends BaseResourceIT {
 
-    private static final String SEARCH_DSL_PATH = "api/atlas/discovery/search/dsl";
-
-    private static final AtlasBaseClient.APIInfo SEARCH_DSL = new AtlasBaseClient.APIInfo(SEARCH_DSL_PATH, "GET", Response.Status.OK);
-    public static final String GREMLIN_SEARCH = "api/atlas/discovery/search/gremlin";
     private String tagName;
     private String dbName;
 
@@ -66,8 +60,8 @@ public class MetadataDiscoveryJerseyResourceIT extends BaseResourceIT {
     public void setUp() throws Exception {
         super.setUp();
         dbName = "db"+randomString();
-
-        createInstance( createHiveDBInstance(dbName) );
+        createTypes();
+        createInstance( createHiveDBInstanceV1(dbName) );
     }
 
     @Test
@@ -75,7 +69,7 @@ public class MetadataDiscoveryJerseyResourceIT extends BaseResourceIT {
         String dslQuery = "from "+ DATABASE_TYPE + " qualifiedName=\"" + dbName + "\"";
         MultivaluedMap<String, String> queryParams = new MultivaluedMapImpl();
         queryParams.add("query", dslQuery);
-        JSONObject response = serviceClient.callAPIWithQueryParams(AtlasClient.API.SEARCH_DSL, queryParams);
+        JSONObject response = atlasClientV1.callAPIWithQueryParams(AtlasClient.API.SEARCH_DSL, queryParams);
 
         Assert.assertNotNull(response);
         Assert.assertNotNull(response.get(AtlasClient.REQUEST_ID));
@@ -84,7 +78,7 @@ public class MetadataDiscoveryJerseyResourceIT extends BaseResourceIT {
         assertEquals(response.getString("queryType"), "dsl");
 
         JSONArray results = response.getJSONArray(AtlasClient.RESULTS);
-        Assert.assertNotNull(results);
+        assertNotNull(results);
         assertEquals(results.length(), 1);
 
         int numRows = response.getInt(AtlasClient.COUNT);
@@ -98,28 +92,28 @@ public class MetadataDiscoveryJerseyResourceIT extends BaseResourceIT {
         String dslQuery = "from "+ DATABASE_TYPE + " qualifiedName=\"" + dbName + "\"";
         MultivaluedMap<String, String> queryParams = new MultivaluedMapImpl();
         queryParams.add("query", dslQuery);
-        JSONObject response = serviceClient.callAPIWithQueryParams(AtlasClient.API.SEARCH_DSL, queryParams);
+        JSONObject response = atlasClientV1.callAPIWithQueryParams(AtlasClient.API.SEARCH_DSL, queryParams);
         assertNotNull(response);
 
         //higher limit, all results returned
-        JSONArray results = serviceClient.searchByDSL(dslQuery, 10, 0);
+        JSONArray results = atlasClientV1.searchByDSL(dslQuery, 10, 0);
         assertEquals(results.length(), 1);
 
         //default limit and offset -1, all results returned
-        results = serviceClient.searchByDSL(dslQuery, -1, -1);
+        results = atlasClientV1.searchByDSL(dslQuery, -1, -1);
         assertEquals(results.length(), 1);
 
         //uses the limit parameter passed
-        results = serviceClient.searchByDSL(dslQuery, 1, 0);
+        results = atlasClientV1.searchByDSL(dslQuery, 1, 0);
         assertEquals(results.length(), 1);
 
         //uses the offset parameter passed
-        results = serviceClient.searchByDSL(dslQuery, 10, 1);
+        results = atlasClientV1.searchByDSL(dslQuery, 10, 1);
         assertEquals(results.length(), 0);
 
         //limit > 0
         try {
-            serviceClient.searchByDSL(dslQuery, 0, 10);
+            atlasClientV1.searchByDSL(dslQuery, 0, 10);
             fail("Expected BAD_REQUEST");
         } catch (AtlasServiceException e) {
             assertEquals(e.getStatus(), ClientResponse.Status.BAD_REQUEST, "Got " + e.getStatus());
@@ -127,7 +121,7 @@ public class MetadataDiscoveryJerseyResourceIT extends BaseResourceIT {
 
         //limit > maxlimit
         try {
-            serviceClient.searchByDSL(dslQuery, Integer.MAX_VALUE, 10);
+            atlasClientV1.searchByDSL(dslQuery, Integer.MAX_VALUE, 10);
             fail("Expected BAD_REQUEST");
         } catch (AtlasServiceException e) {
             assertEquals(e.getStatus(), ClientResponse.Status.BAD_REQUEST, "Got " + e.getStatus());
@@ -135,7 +129,7 @@ public class MetadataDiscoveryJerseyResourceIT extends BaseResourceIT {
 
         //offset >= 0
         try {
-            serviceClient.searchByDSL(dslQuery, 10, -2);
+            atlasClientV1.searchByDSL(dslQuery, 10, -2);
             fail("Expected BAD_REQUEST");
         } catch (AtlasServiceException e) {
             assertEquals(e.getStatus(), ClientResponse.Status.BAD_REQUEST, "Got " + e.getStatus());
@@ -147,8 +141,7 @@ public class MetadataDiscoveryJerseyResourceIT extends BaseResourceIT {
         String dslQuery = "from blah";
         MultivaluedMap<String, String> queryParams = new MultivaluedMapImpl();
         queryParams.add("query", dslQuery);
-        JSONObject response = serviceClient.callAPIWithQueryParams(AtlasClient.API.SEARCH_DSL, queryParams);
-
+        atlasClientV1.callAPIWithQueryParams(AtlasClient.API.SEARCH_DSL, queryParams);
     }
 
     @Test
@@ -157,10 +150,10 @@ public class MetadataDiscoveryJerseyResourceIT extends BaseResourceIT {
         MultivaluedMap<String, String> queryParams = new MultivaluedMapImpl();
         queryParams.add("query", query);
 
-        JSONObject response = serviceClient.callAPIWithQueryParams(AtlasClient.API.GREMLIN_SEARCH, queryParams);
+        JSONObject response = atlasClientV1.callAPIWithQueryParams(AtlasClient.API.GREMLIN_SEARCH, queryParams);
 
         assertNotNull(response);
-        Assert.assertNotNull(response.get(AtlasClient.REQUEST_ID));
+        assertNotNull(response.get(AtlasClient.REQUEST_ID));
 
         assertEquals(response.getString("query"), query);
         assertEquals(response.getString("queryType"), "gremlin");
@@ -172,7 +165,7 @@ public class MetadataDiscoveryJerseyResourceIT extends BaseResourceIT {
         String query = "from "+ DATABASE_TYPE + " qualifiedName=\"" + dbName +"\"";
         MultivaluedMap<String, String> queryParams = new MultivaluedMapImpl();
         queryParams.add("query", query);
-        JSONObject response = serviceClient.callAPIWithQueryParams(AtlasClient.API.SEARCH, queryParams);
+        JSONObject response = atlasClientV1.callAPIWithQueryParams(AtlasClient.API.SEARCH, queryParams);
 
         Assert.assertNotNull(response);
         Assert.assertNotNull(response.get(AtlasClient.REQUEST_ID));
@@ -186,7 +179,7 @@ public class MetadataDiscoveryJerseyResourceIT extends BaseResourceIT {
         String query = "*";
         MultivaluedMap<String, String> queryParams = new MultivaluedMapImpl();
         queryParams.add("query", query);
-        JSONObject response = serviceClient.callAPIWithQueryParams(AtlasClient.API.SEARCH, queryParams);
+        JSONObject response = atlasClientV1.callAPIWithQueryParams(AtlasClient.API.SEARCH, queryParams);
 
         Assert.assertNotNull(response);
         Assert.assertNotNull(response.get(AtlasClient.REQUEST_ID));
@@ -197,8 +190,8 @@ public class MetadataDiscoveryJerseyResourceIT extends BaseResourceIT {
 
     @Test(dependsOnMethods = "testSearchDSLLimits")
     public void testSearchUsingFullText() throws Exception {
-        JSONObject response = serviceClient.searchByFullText(dbName, 10, 0);
-        Assert.assertNotNull(response.get(AtlasClient.REQUEST_ID));
+        JSONObject response = atlasClientV1.searchByFullText(dbName, 10, 0);
+        assertNotNull(response.get(AtlasClient.REQUEST_ID));
 
         assertEquals(response.getString("query"), dbName);
         assertEquals(response.getString("queryType"), "full-text");
@@ -207,9 +200,9 @@ public class MetadataDiscoveryJerseyResourceIT extends BaseResourceIT {
         assertEquals(results.length(), 1, "Results: " + results);
 
         JSONObject row = results.getJSONObject(0);
-        Assert.assertNotNull(row.get("guid"));
+        assertNotNull(row.get("guid"));
         assertEquals(row.getString("typeName"), DATABASE_TYPE);
-        Assert.assertNotNull(row.get("score"));
+        assertNotNull(row.get("score"));
 
         int numRows = response.getInt(AtlasClient.COUNT);
         assertEquals(numRows, 1);
@@ -218,25 +211,25 @@ public class MetadataDiscoveryJerseyResourceIT extends BaseResourceIT {
         String query = dbName;
         MultivaluedMap<String, String> queryParams = new MultivaluedMapImpl();
         queryParams.add("query", query);
-        response = serviceClient.callAPIWithQueryParams(AtlasClient.API.SEARCH_FULL_TEXT, queryParams);
+        response = atlasClientV1.callAPIWithQueryParams(AtlasClient.API.SEARCH_FULL_TEXT, queryParams);
         results = response.getJSONArray(AtlasClient.RESULTS);
         assertEquals(results.length(), 1);
 
         //verify passed in limits and offsets are used
         //higher limit and 0 offset returns all results
-        results = serviceClient.searchByFullText(query, 10, 0).getJSONArray(AtlasClient.RESULTS);
+        results = atlasClientV1.searchByFullText(query, 10, 0).getJSONArray(AtlasClient.RESULTS);
         assertEquals(results.length(), 1);
 
         //offset is used
-        results = serviceClient.searchByFullText(query, 10, 1).getJSONArray(AtlasClient.RESULTS);
+        results = atlasClientV1.searchByFullText(query, 10, 1).getJSONArray(AtlasClient.RESULTS);
         assertEquals(results.length(), 0);
 
         //limit is used
-        results = serviceClient.searchByFullText(query, 1, 0).getJSONArray(AtlasClient.RESULTS);
+        results = atlasClientV1.searchByFullText(query, 1, 0).getJSONArray(AtlasClient.RESULTS);
         assertEquals(results.length(), 1);
 
         //higher offset returns 0 results
-        results = serviceClient.searchByFullText(query, 1, 2).getJSONArray(AtlasClient.RESULTS);
+        results = atlasClientV1.searchByFullText(query, 1, 2).getJSONArray(AtlasClient.RESULTS);
         assertEquals(results.length(), 0);
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/ec1b160a/webapp/src/test/java/org/apache/atlas/web/resources/TypesJerseyResourceIT.java
----------------------------------------------------------------------
diff --git a/webapp/src/test/java/org/apache/atlas/web/resources/TypesJerseyResourceIT.java b/webapp/src/test/java/org/apache/atlas/web/resources/TypesJerseyResourceIT.java
index 87bf9a8..2ef33c3 100755
--- a/webapp/src/test/java/org/apache/atlas/web/resources/TypesJerseyResourceIT.java
+++ b/webapp/src/test/java/org/apache/atlas/web/resources/TypesJerseyResourceIT.java
@@ -76,33 +76,33 @@ public class TypesJerseyResourceIT extends BaseResourceIT {
     public void testSubmit() throws Exception {
         for (HierarchicalTypeDefinition typeDefinition : typeDefinitions) {
             try{
-                serviceClient.getType(typeDefinition.typeName);
+                atlasClientV1.getType(typeDefinition.typeName);
             } catch (AtlasServiceException ase){
                 String typesAsJSON = TypesSerialization.toJson(typeDefinition, false);
                 System.out.println("typesAsJSON = " + typesAsJSON);
 
-            JSONObject response = serviceClient.callAPIWithBody(AtlasClient.API.CREATE_TYPE, typesAsJSON);
-            Assert.assertNotNull(response);
+                JSONObject response = atlasClientV1.callAPIWithBody(AtlasClient.API.CREATE_TYPE, typesAsJSON);
+                Assert.assertNotNull(response);
 
 
-            JSONArray typesAdded = response.getJSONArray(AtlasClient.TYPES);
-            assertEquals(typesAdded.length(), 1);
-            assertEquals(typesAdded.getJSONObject(0).getString("name"), typeDefinition.typeName);
-            Assert.assertNotNull(response.get(AtlasClient.REQUEST_ID));}
+                JSONArray typesAdded = response.getJSONArray(AtlasClient.TYPES);
+                assertEquals(typesAdded.length(), 1);
+                assertEquals(typesAdded.getJSONObject(0).getString(NAME), typeDefinition.typeName);
+                Assert.assertNotNull(response.get(AtlasClient.REQUEST_ID));}
         }
     }
 
     @Test
     public void testDuplicateSubmit() throws Exception {
         HierarchicalTypeDefinition<ClassType> type = TypesUtil.createClassTypeDef(randomString(),
-                ImmutableSet.<String>of(), TypesUtil.createUniqueRequiredAttrDef("name", DataTypes.STRING_TYPE));
+                ImmutableSet.<String>of(), TypesUtil.createUniqueRequiredAttrDef(NAME, DataTypes.STRING_TYPE));
         TypesDef typesDef =
                 TypesUtil.getTypesDef(ImmutableList.<EnumTypeDefinition>of(), ImmutableList.<StructTypeDefinition>of(),
                         ImmutableList.<HierarchicalTypeDefinition<TraitType>>of(), ImmutableList.of(type));
-        serviceClient.createType(typesDef);
+        atlasClientV1.createType(typesDef);
 
         try {
-            serviceClient.createType(typesDef);
+            atlasClientV1.createType(typesDef);
             fail("Expected 409");
         } catch (AtlasServiceException e) {
             assertEquals(e.getStatus().getStatusCode(), Response.Status.CONFLICT.getStatusCode());
@@ -113,24 +113,24 @@ public class TypesJerseyResourceIT extends BaseResourceIT {
     public void testUpdate() throws Exception {
         HierarchicalTypeDefinition<ClassType> typeDefinition = TypesUtil
                 .createClassTypeDef(randomString(), ImmutableSet.<String>of(),
-                        TypesUtil.createUniqueRequiredAttrDef("name", DataTypes.STRING_TYPE));
-        List<String> typesCreated = serviceClient.createType(TypesSerialization.toJson(typeDefinition, false));
+                        TypesUtil.createUniqueRequiredAttrDef(NAME, DataTypes.STRING_TYPE));
+        List<String> typesCreated = atlasClientV1.createType(TypesSerialization.toJson(typeDefinition, false));
         assertEquals(typesCreated.size(), 1);
         assertEquals(typesCreated.get(0), typeDefinition.typeName);
 
         //Add attribute description
         typeDefinition = TypesUtil.createClassTypeDef(typeDefinition.typeName,
-            ImmutableSet.<String>of(),
-                TypesUtil.createUniqueRequiredAttrDef("name", DataTypes.STRING_TYPE),
-                createOptionalAttrDef("description", DataTypes.STRING_TYPE));
+                ImmutableSet.<String>of(),
+                TypesUtil.createUniqueRequiredAttrDef(NAME, DataTypes.STRING_TYPE),
+                createOptionalAttrDef(DESCRIPTION, DataTypes.STRING_TYPE));
         TypesDef typeDef = TypesUtil.getTypesDef(ImmutableList.<EnumTypeDefinition>of(),
                 ImmutableList.<StructTypeDefinition>of(), ImmutableList.<HierarchicalTypeDefinition<TraitType>>of(),
                 ImmutableList.of(typeDefinition));
-        List<String> typesUpdated = serviceClient.updateType(typeDef);
+        List<String> typesUpdated = atlasClientV1.updateType(typeDef);
         assertEquals(typesUpdated.size(), 1);
         Assert.assertTrue(typesUpdated.contains(typeDefinition.typeName));
 
-        TypesDef updatedTypeDef = serviceClient.getType(typeDefinition.typeName);
+        TypesDef updatedTypeDef = atlasClientV1.getType(typeDefinition.typeName);
         assertNotNull(updatedTypeDef);
 
         HierarchicalTypeDefinition<ClassType> updatedType = updatedTypeDef.classTypesAsJavaList().get(0);
@@ -142,7 +142,7 @@ public class TypesJerseyResourceIT extends BaseResourceIT {
         for (HierarchicalTypeDefinition typeDefinition : typeDefinitions) {
             System.out.println("typeName = " + typeDefinition.typeName);
 
-            JSONObject response = serviceClient.callAPIWithBodyAndParams(AtlasClient.API.LIST_TYPES, null, typeDefinition.typeName);
+            JSONObject response = atlasClientV1.callAPIWithBodyAndParams(AtlasClient.API.LIST_TYPES, null, typeDefinition.typeName);
 
             Assert.assertNotNull(response);
             Assert.assertNotNull(response.get(AtlasClient.DEFINITION));
@@ -153,7 +153,7 @@ public class TypesJerseyResourceIT extends BaseResourceIT {
             List<HierarchicalTypeDefinition<ClassType>> hierarchicalTypeDefinitions = typesDef.classTypesAsJavaList();
             for (HierarchicalTypeDefinition<ClassType> classType : hierarchicalTypeDefinitions) {
                 for (AttributeDefinition attrDef : classType.attributeDefinitions) {
-                    if ("name".equals(attrDef.name)) {
+                    if (NAME.equals(attrDef.name)) {
                         assertEquals(attrDef.isIndexable, true);
                         assertEquals(attrDef.isUnique, true);
                     }
@@ -164,12 +164,12 @@ public class TypesJerseyResourceIT extends BaseResourceIT {
 
     @Test(expectedExceptions = AtlasServiceException.class)
     public void testGetDefinitionForNonexistentType() throws Exception {
-        JSONObject response = serviceClient.callAPIWithBodyAndParams(AtlasClient.API.LIST_TYPES, null, "blah");
+        JSONObject response = atlasClientV1.callAPIWithBodyAndParams(AtlasClient.API.LIST_TYPES, null, "blah");
     }
 
     @Test(dependsOnMethods = "testSubmit")
     public void testGetTypeNames() throws Exception {
-        JSONObject response = serviceClient.callAPIWithBodyAndParams(AtlasClient.API.LIST_TYPES, null, (String[]) null);
+        JSONObject response = atlasClientV1.callAPIWithBodyAndParams(AtlasClient.API.LIST_TYPES, null, (String[]) null);
         Assert.assertNotNull(response);
 
         Assert.assertNotNull(response.get(AtlasClient.REQUEST_ID));
@@ -190,7 +190,7 @@ public class TypesJerseyResourceIT extends BaseResourceIT {
         MultivaluedMap<String, String> queryParams = new MultivaluedMapImpl();
         queryParams.add("type", DataTypes.TypeCategory.TRAIT.name());
 
-        JSONObject response = serviceClient.callAPIWithQueryParams(AtlasClient.API.LIST_TYPES, queryParams);
+        JSONObject response = atlasClientV1.callAPIWithQueryParams(AtlasClient.API.LIST_TYPES, queryParams);
         Assert.assertNotNull(response);
 
         Assert.assertNotNull(response.get(AtlasClient.REQUEST_ID));
@@ -212,7 +212,7 @@ public class TypesJerseyResourceIT extends BaseResourceIT {
         String c = createType(TypesSerialization.toJson(
                 TypesUtil.createClassTypeDef("C" + randomString(), ImmutableSet.of(a, b), attr), false)).get(0);
 
-        List<String> results = serviceClient.listTypes(DataTypes.TypeCategory.CLASS, a, b);
+        List<String> results = atlasClientV1.listTypes(DataTypes.TypeCategory.CLASS, a, b);
         assertEquals(results, Arrays.asList(a1), "Results: " + results);
     }
 
@@ -234,20 +234,20 @@ public class TypesJerseyResourceIT extends BaseResourceIT {
 
         HierarchicalTypeDefinition<ClassType> databaseTypeDefinition = TypesUtil
                 .createClassTypeDef("database", ImmutableSet.<String>of(),
-                        TypesUtil.createUniqueRequiredAttrDef("name", DataTypes.STRING_TYPE),
-                        TypesUtil.createRequiredAttrDef("description", DataTypes.STRING_TYPE),
-                        TypesUtil.createRequiredAttrDef("qualifiedName", DataTypes.STRING_TYPE));
+                        TypesUtil.createUniqueRequiredAttrDef(NAME, DataTypes.STRING_TYPE),
+                        TypesUtil.createRequiredAttrDef(DESCRIPTION, DataTypes.STRING_TYPE),
+                        TypesUtil.createRequiredAttrDef(QUALIFIED_NAME, DataTypes.STRING_TYPE));
         typeDefinitions.add(databaseTypeDefinition);
 
         HierarchicalTypeDefinition<ClassType> tableTypeDefinition = TypesUtil
                 .createClassTypeDef("table", ImmutableSet.<String>of(),
-                        TypesUtil.createUniqueRequiredAttrDef("name", DataTypes.STRING_TYPE),
-                        TypesUtil.createRequiredAttrDef("description", DataTypes.STRING_TYPE),
-                        TypesUtil.createRequiredAttrDef("qualifiedName", DataTypes.STRING_TYPE),
+                        TypesUtil.createUniqueRequiredAttrDef(NAME, DataTypes.STRING_TYPE),
+                        TypesUtil.createRequiredAttrDef(DESCRIPTION, DataTypes.STRING_TYPE),
+                        TypesUtil.createRequiredAttrDef(QUALIFIED_NAME, DataTypes.STRING_TYPE),
                         createOptionalAttrDef("columnNames", DataTypes.arrayTypeName(DataTypes.STRING_TYPE)),
                         createOptionalAttrDef("created", DataTypes.DATE_TYPE),
                         createOptionalAttrDef("parameters",
-                                        DataTypes.mapTypeName(DataTypes.STRING_TYPE, DataTypes.STRING_TYPE)),
+                                DataTypes.mapTypeName(DataTypes.STRING_TYPE, DataTypes.STRING_TYPE)),
                         TypesUtil.createRequiredAttrDef("type", DataTypes.STRING_TYPE),
                         new AttributeDefinition("database", "database", Multiplicity.REQUIRED, false, "database"));
         typeDefinitions.add(tableTypeDefinition);


[2/3] incubator-atlas git commit: ATLAS-1311: Integration tests for V2 Entity APIs

Posted by ma...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/ec1b160a/webapp/src/test/java/org/apache/atlas/web/resources/BaseResourceIT.java
----------------------------------------------------------------------
diff --git a/webapp/src/test/java/org/apache/atlas/web/resources/BaseResourceIT.java b/webapp/src/test/java/org/apache/atlas/web/resources/BaseResourceIT.java
index 325c25b..9b56c92 100755
--- a/webapp/src/test/java/org/apache/atlas/web/resources/BaseResourceIT.java
+++ b/webapp/src/test/java/org/apache/atlas/web/resources/BaseResourceIT.java
@@ -24,9 +24,24 @@ import com.google.common.collect.ImmutableSet;
 import kafka.consumer.ConsumerTimeoutException;
 import org.apache.atlas.ApplicationProperties;
 import org.apache.atlas.AtlasClient;
+import org.apache.atlas.AtlasEntitiesClientV2;
 import org.apache.atlas.AtlasServiceException;
+import org.apache.atlas.AtlasTypedefClientV2;
+import org.apache.atlas.model.instance.AtlasClassification;
+import org.apache.atlas.model.instance.AtlasEntity;
+import org.apache.atlas.model.instance.AtlasEntityHeader;
+import org.apache.atlas.model.instance.AtlasEntityWithAssociations;
+import org.apache.atlas.model.instance.AtlasStruct;
+import org.apache.atlas.model.instance.EntityMutationResponse;
+import org.apache.atlas.model.instance.EntityMutations;
+import org.apache.atlas.model.typedef.AtlasClassificationDef;
+import org.apache.atlas.model.typedef.AtlasEntityDef;
+import org.apache.atlas.model.typedef.AtlasEnumDef;
+import org.apache.atlas.model.typedef.AtlasStructDef;
+import org.apache.atlas.model.typedef.AtlasTypesDef;
 import org.apache.atlas.notification.NotificationConsumer;
 import org.apache.atlas.notification.entity.EntityNotification;
+import org.apache.atlas.type.AtlasTypeUtil;
 import org.apache.atlas.typesystem.Referenceable;
 import org.apache.atlas.typesystem.Struct;
 import org.apache.atlas.typesystem.TypesDef;
@@ -45,11 +60,15 @@ import org.slf4j.LoggerFactory;
 import org.testng.Assert;
 import org.testng.annotations.BeforeClass;
 
+import java.util.Arrays;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
-import java.util.Collections;
 import java.util.Map;
 
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertTrue;
+
 /**
  * Base class for integration tests.
  * Sets up the web resource and has helper methods to create type and entity.
@@ -57,7 +76,16 @@ import java.util.Map;
 public abstract class BaseResourceIT {
 
     public static final String ATLAS_REST_ADDRESS = "atlas.rest.address";
-    protected AtlasClient serviceClient;
+    public static final String NAME = "name";
+    public static final String QUALIFIED_NAME = "qualifiedName";
+    public static final String CLUSTER_NAME = "clusterName";
+    public static final String DESCRIPTION = "description";
+
+    // All service clients
+    protected AtlasClient atlasClientV1;
+    protected AtlasTypedefClientV2 typedefClientV2;
+    protected AtlasEntitiesClientV2 entitiesClientV2;
+
     public static final Logger LOG = LoggerFactory.getLogger(BaseResourceIT.class);
     protected static final int MAX_WAIT_TIME = 60000;
     protected String[] atlasUrls;
@@ -73,32 +101,69 @@ public abstract class BaseResourceIT {
         }
 
         if (!AuthenticationUtil.isKerberosAuthenticationEnabled()) {
-            serviceClient = new AtlasClient(atlasUrls, new String[]{"admin", "admin"});
+            atlasClientV1 = new AtlasClient(atlasUrls, new String[]{"admin", "admin"});
+            typedefClientV2 = new AtlasTypedefClientV2(atlasUrls, new String[]{"admin", "admin"});
+            entitiesClientV2 = new AtlasEntitiesClientV2(atlasUrls, new String[]{"admin", "admin"});
         } else {
-            serviceClient = new AtlasClient(atlasUrls);
+            atlasClientV1 = new AtlasClient(atlasUrls);
+            typedefClientV2 = new AtlasTypedefClientV2(atlasUrls);
+            entitiesClientV2 = new AtlasEntitiesClientV2(atlasUrls);
+        }
+    }
+
+    protected void createType(AtlasTypesDef typesDef) {
+        // Since the bulk create bails out on a single failure, this has to be done as a workaround
+        for (AtlasEnumDef enumDef : typesDef.getEnumDefs()) {
+            try {
+                typedefClientV2.createEnumDef(enumDef);
+            } catch (AtlasServiceException ex) {
+                LOG.warn("EnumDef creation failed for {}", enumDef.getName());
+            }
         }
+        for (AtlasStructDef structDef : typesDef.getStructDefs()) {
+            try {
+                typedefClientV2.createStructDef(structDef);
+            } catch (AtlasServiceException ex) {
+                LOG.warn("StructDef creation failed for {}", structDef.getName());
+            }
+        }
+        for (AtlasEntityDef entityDef : typesDef.getEntityDefs()) {
+            try {
+                typedefClientV2.createEntityDef(entityDef);
+            } catch (AtlasServiceException ex) {
+                LOG.warn("EntityDef creation failed for {}", entityDef.getName());
+            }
+        }
+        for (AtlasClassificationDef classificationDef : typesDef.getClassificationDefs()) {
+            try {
+                typedefClientV2.createClassificationDef(classificationDef);
+            } catch (AtlasServiceException ex) {
+                LOG.warn("ClassificationDef creation failed for {}", classificationDef.getName());
+            }
+        }
+
     }
 
     protected void createType(TypesDef typesDef) throws Exception {
         try{
             if ( !typesDef.enumTypes().isEmpty() ){
                 String sampleType = typesDef.enumTypesAsJavaList().get(0).name;
-                serviceClient.getType(sampleType);
+                atlasClientV1.getType(sampleType);
                 LOG.info("Checking enum type existence");
             }
             else if( !typesDef.structTypes().isEmpty()){
                 StructTypeDefinition sampleType = typesDef.structTypesAsJavaList().get(0);
-                serviceClient.getType(sampleType.typeName);
+                atlasClientV1.getType(sampleType.typeName);
                 LOG.info("Checking struct type existence");
             }
             else if( !typesDef.traitTypes().isEmpty()){
                 HierarchicalTypeDefinition<TraitType> sampleType = typesDef.traitTypesAsJavaList().get(0);
-                serviceClient.getType(sampleType.typeName);
+                atlasClientV1.getType(sampleType.typeName);
                 LOG.info("Checking trait type existence");
             }
             else{
                 HierarchicalTypeDefinition<ClassType> sampleType = typesDef.classTypesAsJavaList().get(0);
-                serviceClient.getType(sampleType.typeName);
+                atlasClientV1.getType(sampleType.typeName);
                 LOG.info("Checking class type existence");
             }
             LOG.info("Types already exist. Skipping type creation");
@@ -110,7 +175,7 @@ public abstract class BaseResourceIT {
     }
 
     protected List<String> createType(String typesAsJSON) throws Exception {
-        return serviceClient.createType(TypesSerialization.fromJson(typesAsJSON));
+        return atlasClientV1.createType(TypesSerialization.fromJson(typesAsJSON));
     }
 
     protected Id createInstance(Referenceable referenceable) throws Exception {
@@ -119,7 +184,7 @@ public abstract class BaseResourceIT {
 
         String entityJSON = InstanceSerialization.toJson(referenceable, true);
         System.out.println("Submitting new entity= " + entityJSON);
-        List<String> guids = serviceClient.createEntity(entityJSON);
+        List<String> guids = atlasClientV1.createEntity(entityJSON);
         System.out.println("created instance for type " + typeName + ", guid: " + guids);
 
         // return the reference to created instance with guid
@@ -147,25 +212,51 @@ public abstract class BaseResourceIT {
 
     }
 
+    protected AtlasEntityHeader modifyEntity(AtlasEntity atlasEntity, boolean update) {
+        EntityMutationResponse entity = null;
+        try {
+            if (!update) {
+                entity = entitiesClientV2.createEntity(atlasEntity);
+            } else {
+                entity = entitiesClientV2.updateEntity(atlasEntity);
+            }
+            assertNotNull(entity);
+            assertNotNull(entity.getEntitiesByOperation(EntityMutations.EntityOperation.CREATE_OR_UPDATE));
+            assertTrue(entity.getEntitiesByOperation(EntityMutations.EntityOperation.CREATE_OR_UPDATE).size() > 0);
+            return entity.getEntitiesByOperation(EntityMutations.EntityOperation.CREATE_OR_UPDATE).get(0);
+        } catch (AtlasServiceException e) {
+            LOG.error("Entity {} failed", update ? "update" : "creation", entity);
+        }
+        return null;
+    }
+
+    protected AtlasEntityHeader createEntity(AtlasEntity atlasEntity) {
+        return modifyEntity(atlasEntity, false);
+    }
+
+    protected AtlasEntityHeader updateEntity(AtlasEntity atlasEntity) {
+        return modifyEntity(atlasEntity, true);
+    }
+
     protected static final String DATABASE_TYPE = "hive_db";
     protected static final String HIVE_TABLE_TYPE = "hive_table";
     protected static final String COLUMN_TYPE = "hive_column";
     protected static final String HIVE_PROCESS_TYPE = "hive_process";
 
-    protected void createTypeDefinitions() throws Exception {
+    protected void createTypeDefinitionsV1() throws Exception {
         HierarchicalTypeDefinition<ClassType> dbClsDef = TypesUtil
                 .createClassTypeDef(DATABASE_TYPE, null,
-                        TypesUtil.createUniqueRequiredAttrDef("name", DataTypes.STRING_TYPE),
-                        TypesUtil.createRequiredAttrDef("description", DataTypes.STRING_TYPE),
+                        TypesUtil.createUniqueRequiredAttrDef(NAME, DataTypes.STRING_TYPE),
+                        TypesUtil.createRequiredAttrDef(DESCRIPTION, DataTypes.STRING_TYPE),
                         attrDef("locationUri", DataTypes.STRING_TYPE),
                         attrDef("owner", DataTypes.STRING_TYPE), attrDef("createTime", DataTypes.INT_TYPE));
 
         HierarchicalTypeDefinition<ClassType> columnClsDef = TypesUtil
-                .createClassTypeDef(COLUMN_TYPE, null, attrDef("name", DataTypes.STRING_TYPE),
+                .createClassTypeDef(COLUMN_TYPE, null, attrDef(NAME, DataTypes.STRING_TYPE),
                         attrDef("dataType", DataTypes.STRING_TYPE), attrDef("comment", DataTypes.STRING_TYPE));
 
         StructTypeDefinition structTypeDefinition = new StructTypeDefinition("serdeType",
-                new AttributeDefinition[]{TypesUtil.createRequiredAttrDef("name", DataTypes.STRING_TYPE),
+                new AttributeDefinition[]{TypesUtil.createRequiredAttrDef(NAME, DataTypes.STRING_TYPE),
                         TypesUtil.createRequiredAttrDef("serde", DataTypes.STRING_TYPE)});
 
         EnumValue values[] = {new EnumValue("MANAGED", 1), new EnumValue("EXTERNAL", 2),};
@@ -180,9 +271,9 @@ public abstract class BaseResourceIT {
                         new AttributeDefinition("db", DATABASE_TYPE, Multiplicity.REQUIRED, true, null),
                         new AttributeDefinition("columns", DataTypes.arrayTypeName(COLUMN_TYPE),
                                 Multiplicity.OPTIONAL, true, null),
-                new AttributeDefinition("tableType", "tableType", Multiplicity.OPTIONAL, false, null),
-                new AttributeDefinition("serde1", "serdeType", Multiplicity.OPTIONAL, false, null),
-                new AttributeDefinition("serde2", "serdeType", Multiplicity.OPTIONAL, false, null));
+                        new AttributeDefinition("tableType", "tableType", Multiplicity.OPTIONAL, false, null),
+                        new AttributeDefinition("serde1", "serdeType", Multiplicity.OPTIONAL, false, null),
+                        new AttributeDefinition("serde2", "serdeType", Multiplicity.OPTIONAL, false, null));
 
         HierarchicalTypeDefinition<ClassType> loadProcessClsDef = TypesUtil
                 .createClassTypeDef(HIVE_PROCESS_TYPE, ImmutableSet.of("Process"),
@@ -226,6 +317,80 @@ public abstract class BaseResourceIT {
                 ImmutableList.of(dbClsDef, columnClsDef, tblClsDef, loadProcessClsDef)));
     }
 
+    protected void createTypeDefinitionsV2() throws Exception {
+        AtlasEntityDef dbClsTypeDef = AtlasTypeUtil.createClassTypeDef(
+                DATABASE_TYPE,
+                null,
+                AtlasTypeUtil.createUniqueRequiredAttrDef(NAME, "string"),
+                AtlasTypeUtil.createRequiredAttrDef(DESCRIPTION, "string"),
+                AtlasTypeUtil.createOptionalAttrDef("locationUri", "string"),
+                AtlasTypeUtil.createOptionalAttrDef("owner", "string"),
+                AtlasTypeUtil.createOptionalAttrDef("createTime", "int"));
+
+        AtlasEntityDef columnClsDef = AtlasTypeUtil
+                .createClassTypeDef(COLUMN_TYPE, null,
+                        AtlasTypeUtil.createOptionalAttrDef(NAME, "string"),
+                        AtlasTypeUtil.createOptionalAttrDef("dataType", "string"),
+                        AtlasTypeUtil.createOptionalAttrDef("comment", "string"));
+
+        AtlasStructDef structTypeDef = AtlasTypeUtil.createStructTypeDef("serdeType",
+                AtlasTypeUtil.createRequiredAttrDef(NAME, "string"),
+                AtlasTypeUtil.createRequiredAttrDef("serde", "string")
+        );
+
+        AtlasEnumDef enumDef = new AtlasEnumDef("tableType", DESCRIPTION, Arrays.asList(
+                new AtlasEnumDef.AtlasEnumElementDef("MANAGED", null, 1),
+                new AtlasEnumDef.AtlasEnumElementDef("EXTERNAL", null, 2)
+        ));
+
+        AtlasEntityDef tblClsDef = AtlasTypeUtil
+                .createClassTypeDef(HIVE_TABLE_TYPE,
+                        ImmutableSet.of("DataSet"),
+                        AtlasTypeUtil.createOptionalAttrDef("owner", "string"),
+                        AtlasTypeUtil.createOptionalAttrDef("createTime", "long"),
+                        AtlasTypeUtil.createOptionalAttrDef("lastAccessTime", "date"),
+                        AtlasTypeUtil.createOptionalAttrDef("temporary", "boolean"),
+                        AtlasTypeUtil.createRequiredAttrDef("db", DATABASE_TYPE),
+                        AtlasTypeUtil.createRequiredAttrDef("columns", DataTypes.arrayTypeName(COLUMN_TYPE)),
+                        AtlasTypeUtil.createOptionalAttrDef("tableType", "tableType"),
+                        AtlasTypeUtil.createOptionalAttrDef("serde1", "serdeType"),
+                        AtlasTypeUtil.createOptionalAttrDef("serde2", "serdeType"));
+
+        AtlasEntityDef loadProcessClsDef = AtlasTypeUtil
+                .createClassTypeDef(HIVE_PROCESS_TYPE,
+                        ImmutableSet.of("Process"),
+                        AtlasTypeUtil.createOptionalAttrDef("userName", "string"),
+                        AtlasTypeUtil.createOptionalAttrDef("startTime", "int"),
+                        AtlasTypeUtil.createOptionalAttrDef("endTime", "long"),
+                        AtlasTypeUtil.createRequiredAttrDef("queryText", "string"),
+                        AtlasTypeUtil.createRequiredAttrDef("queryPlan", "string"),
+                        AtlasTypeUtil.createRequiredAttrDef("queryId", "string"),
+                        AtlasTypeUtil.createRequiredAttrDef("queryGraph", "string"));
+
+        AtlasClassificationDef classificationTrait = AtlasTypeUtil
+                .createTraitTypeDef("classification",ImmutableSet.<String>of(),
+                        AtlasTypeUtil.createRequiredAttrDef("tag", "string"));
+        AtlasClassificationDef piiTrait =
+                AtlasTypeUtil.createTraitTypeDef("pii", ImmutableSet.<String>of());
+        AtlasClassificationDef phiTrait =
+                AtlasTypeUtil.createTraitTypeDef("phi", ImmutableSet.<String>of());
+        AtlasClassificationDef pciTrait =
+                AtlasTypeUtil.createTraitTypeDef("pci", ImmutableSet.<String>of());
+        AtlasClassificationDef soxTrait =
+                AtlasTypeUtil.createTraitTypeDef("sox", ImmutableSet.<String>of());
+        AtlasClassificationDef secTrait =
+                AtlasTypeUtil.createTraitTypeDef("sec", ImmutableSet.<String>of());
+        AtlasClassificationDef financeTrait =
+                AtlasTypeUtil.createTraitTypeDef("finance", ImmutableSet.<String>of());
+
+        AtlasTypesDef typesDef = new AtlasTypesDef(ImmutableList.of(enumDef),
+                ImmutableList.of(structTypeDef),
+                ImmutableList.of(classificationTrait, piiTrait, phiTrait, pciTrait, soxTrait, secTrait, financeTrait),
+                ImmutableList.of(dbClsTypeDef, columnClsDef, tblClsDef, loadProcessClsDef));
+
+        createType(typesDef);
+    }
+
     AttributeDefinition attrDef(String name, IDataType dT) {
         return attrDef(name, dT, Multiplicity.OPTIONAL, false, null);
     }
@@ -245,23 +410,22 @@ public abstract class BaseResourceIT {
         return RandomStringUtils.randomAlphanumeric(10);
     }
 
-    protected Referenceable createHiveTableInstance(String dbName, String tableName, Id dbId) throws Exception {
+    protected Referenceable createHiveTableInstanceV1(String dbName, String tableName, Id dbId) throws Exception {
         Map<String, Object> values = new HashMap<>();
-        values.put("name", dbName);
-        values.put("description", "foo database");
+        values.put(NAME, dbName);
+        values.put(DESCRIPTION, "foo database");
         values.put(AtlasClient.REFERENCEABLE_ATTRIBUTE_NAME, dbName);
         values.put("owner", "user1");
-        values.put("clusterName", "cl1");
+        values.put(CLUSTER_NAME, "cl1");
         values.put("parameters", Collections.EMPTY_MAP);
         values.put("location", "/tmp");
         Referenceable databaseInstance = new Referenceable(dbId._getId(), dbId.getTypeName(), values);
-
         Referenceable tableInstance =
                 new Referenceable(HIVE_TABLE_TYPE, "classification", "pii", "phi", "pci", "sox", "sec", "finance");
-        tableInstance.set("name", tableName);
+        tableInstance.set(NAME, tableName);
         tableInstance.set(AtlasClient.REFERENCEABLE_ATTRIBUTE_NAME, tableName);
         tableInstance.set("db", databaseInstance);
-        tableInstance.set("description", "bar table");
+        tableInstance.set(DESCRIPTION, "bar table");
         tableInstance.set("lastAccessTime", "2014-07-11T08:00:00.000Z");
         tableInstance.set("type", "managed");
         tableInstance.set("level", 2);
@@ -272,12 +436,12 @@ public abstract class BaseResourceIT {
         traitInstance.set("tag", "foundation_etl");
 
         Struct serde1Instance = new Struct("serdeType");
-        serde1Instance.set("name", "serde1");
+        serde1Instance.set(NAME, "serde1");
         serde1Instance.set("serde", "serde1");
         tableInstance.set("serde1", serde1Instance);
 
         Struct serde2Instance = new Struct("serdeType");
-        serde2Instance.set("name", "serde2");
+        serde2Instance.set(NAME, "serde2");
         serde2Instance.set("serde", "serde2");
         tableInstance.set("serde2", serde2Instance);
 
@@ -287,20 +451,70 @@ public abstract class BaseResourceIT {
         return tableInstance;
     }
 
-    protected Referenceable createHiveDBInstance(String dbName) {
+    protected AtlasEntityWithAssociations createHiveTableInstanceV2(AtlasEntity databaseInstance, String tableName) throws Exception {
+        AtlasEntityWithAssociations tableInstance =
+                new AtlasEntityWithAssociations(HIVE_TABLE_TYPE);
+        tableInstance.setClassifications(
+                Arrays.asList(new AtlasClassification("classification"),
+                        new AtlasClassification("pii"),
+                        new AtlasClassification("phi"),
+                        new AtlasClassification("pci"),
+                        new AtlasClassification("sox"),
+                        new AtlasClassification("sec"),
+                        new AtlasClassification("finance"))
+        );
+
+        tableInstance.setAttribute(NAME, tableName);
+        tableInstance.setAttribute(AtlasClient.REFERENCEABLE_ATTRIBUTE_NAME, tableName);
+        tableInstance.setAttribute("db", databaseInstance);
+        tableInstance.setAttribute(DESCRIPTION, "bar table");
+        tableInstance.setAttribute("lastAccessTime", "2014-07-11T08:00:00.000Z");
+        tableInstance.setAttribute("type", "managed");
+        tableInstance.setAttribute("level", 2);
+        tableInstance.setAttribute("tableType", 1); // enum
+        tableInstance.setAttribute("compressed", false);
+
+        AtlasClassification classification = tableInstance.getClassifications().get(0);
+        classification.setAttribute("tag", "foundation_etl");
+
+        AtlasStruct serde1Instance = new AtlasStruct("serdeType");
+        serde1Instance.setAttribute(NAME, "serde1");
+        serde1Instance.setAttribute("serde", "serde1");
+        tableInstance.setAttribute("serde1", serde1Instance);
+
+        AtlasStruct serde2Instance = new AtlasStruct("serdeType");
+        serde2Instance.setAttribute(NAME, "serde2");
+        serde2Instance.setAttribute("serde", "serde2");
+        tableInstance.setAttribute("serde2", serde2Instance);
+
+        List<AtlasClassification> traits = tableInstance.getClassifications();
+        Assert.assertEquals(traits.size(), 7);
+
+        return tableInstance;
+    }
+
+    protected Referenceable createHiveDBInstanceV1(String dbName) {
         Referenceable databaseInstance = new Referenceable(DATABASE_TYPE);
-        databaseInstance.set("name", dbName);
-        databaseInstance.set("qualifiedName", dbName);
-        databaseInstance.set("clusterName", randomString());
-        databaseInstance.set("description", "foo database");
-        databaseInstance.set(AtlasClient.REFERENCEABLE_ATTRIBUTE_NAME, dbName);
-        databaseInstance.set("owner", "user1");
-        databaseInstance.set("clusterName", "cl1");
-        databaseInstance.set("parameters", Collections.EMPTY_MAP);
-        databaseInstance.set("location", "/tmp");
+        databaseInstance.set(NAME, dbName);
+        databaseInstance.set(QUALIFIED_NAME, dbName);
+        databaseInstance.set(CLUSTER_NAME, randomString());
+        databaseInstance.set(DESCRIPTION, "foo database");
         return databaseInstance;
     }
 
+    protected AtlasEntity createHiveDBInstanceV2(String dbName) {
+        AtlasEntity atlasEntity = new AtlasEntity(DATABASE_TYPE);
+        atlasEntity.setAttribute(NAME, dbName);
+        atlasEntity.setAttribute(QUALIFIED_NAME, dbName);
+        atlasEntity.setAttribute(DESCRIPTION, "foo database");
+        atlasEntity.setAttribute(AtlasClient.REFERENCEABLE_ATTRIBUTE_NAME, dbName);
+        atlasEntity.setAttribute("owner", "user1");
+        atlasEntity.setAttribute(CLUSTER_NAME, "cl1");
+        atlasEntity.setAttribute("parameters", Collections.EMPTY_MAP);
+        atlasEntity.setAttribute("location", "/tmp");
+        return atlasEntity;
+    }
+
     public interface Predicate {
 
         /**
@@ -381,6 +595,6 @@ public abstract class BaseResourceIT {
     }
 
     protected JSONArray searchByDSL(String dslQuery) throws AtlasServiceException {
-        return serviceClient.searchByDSL(dslQuery, 10, 0);
+        return atlasClientV1.searchByDSL(dslQuery, 10, 0);
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/ec1b160a/webapp/src/test/java/org/apache/atlas/web/resources/DataSetLineageJerseyResourceIT.java
----------------------------------------------------------------------
diff --git a/webapp/src/test/java/org/apache/atlas/web/resources/DataSetLineageJerseyResourceIT.java b/webapp/src/test/java/org/apache/atlas/web/resources/DataSetLineageJerseyResourceIT.java
index 7e4db13..8334e4f 100644
--- a/webapp/src/test/java/org/apache/atlas/web/resources/DataSetLineageJerseyResourceIT.java
+++ b/webapp/src/test/java/org/apache/atlas/web/resources/DataSetLineageJerseyResourceIT.java
@@ -53,13 +53,13 @@ public class DataSetLineageJerseyResourceIT extends BaseResourceIT {
     public void setUp() throws Exception {
         super.setUp();
 
-        createTypeDefinitions();
+        createTypeDefinitionsV1();
         setupInstances();
     }
 
     @Test
     public void testInputsGraph() throws Exception {
-        JSONObject response = serviceClient.callAPIWithBodyAndParams(AtlasClient.API.NAME_LINEAGE_INPUTS_GRAPH, null, salesMonthlyTable, "inputs", "graph");
+        JSONObject response = atlasClientV1.callAPIWithBodyAndParams(AtlasClient.API.NAME_LINEAGE_INPUTS_GRAPH, null, salesMonthlyTable, "inputs", "graph");
         Assert.assertNotNull(response);
         System.out.println("inputs graph = " + response);
 
@@ -78,9 +78,9 @@ public class DataSetLineageJerseyResourceIT extends BaseResourceIT {
 
     @Test
     public void testInputsGraphForEntity() throws Exception {
-        String tableId = serviceClient.getEntity(HIVE_TABLE_TYPE, AtlasClient.REFERENCEABLE_ATTRIBUTE_NAME,
+        String tableId = atlasClientV1.getEntity(HIVE_TABLE_TYPE, AtlasClient.REFERENCEABLE_ATTRIBUTE_NAME,
                 salesMonthlyTable).getId()._getId();
-        JSONObject results = serviceClient.getInputGraphForEntity(tableId);
+        JSONObject results = atlasClientV1.getInputGraphForEntity(tableId);
         Assert.assertNotNull(results);
 
         Struct resultsInstance = InstanceSerialization.fromJsonStruct(results.toString(), true);
@@ -95,7 +95,7 @@ public class DataSetLineageJerseyResourceIT extends BaseResourceIT {
 
     @Test
     public void testOutputsGraph() throws Exception {
-        JSONObject response = serviceClient.callAPIWithBodyAndParams(AtlasClient.API.NAME_LINEAGE_OUTPUTS_GRAPH, null, salesFactTable, "outputs", "graph");
+        JSONObject response = atlasClientV1.callAPIWithBodyAndParams(AtlasClient.API.NAME_LINEAGE_OUTPUTS_GRAPH, null, salesFactTable, "outputs", "graph");
         Assert.assertNotNull(response);
         System.out.println("outputs graph= " + response);
 
@@ -114,9 +114,9 @@ public class DataSetLineageJerseyResourceIT extends BaseResourceIT {
 
     @Test
     public void testOutputsGraphForEntity() throws Exception {
-        String tableId = serviceClient.getEntity(HIVE_TABLE_TYPE, AtlasClient.REFERENCEABLE_ATTRIBUTE_NAME,
+        String tableId = atlasClientV1.getEntity(HIVE_TABLE_TYPE, AtlasClient.REFERENCEABLE_ATTRIBUTE_NAME,
                 salesFactTable).getId()._getId();
-        JSONObject results = serviceClient.getOutputGraphForEntity(tableId);
+        JSONObject results = atlasClientV1.getOutputGraphForEntity(tableId);
         Assert.assertNotNull(results);
 
         Struct resultsInstance = InstanceSerialization.fromJsonStruct(results.toString(), true);
@@ -131,7 +131,7 @@ public class DataSetLineageJerseyResourceIT extends BaseResourceIT {
 
     @Test
     public void testSchema() throws Exception {
-        JSONObject response = serviceClient.callAPIWithBodyAndParams(AtlasClient.API.NAME_LINEAGE_SCHEMA, null, salesFactTable, "schema");
+        JSONObject response = atlasClientV1.callAPIWithBodyAndParams(AtlasClient.API.NAME_LINEAGE_SCHEMA, null, salesFactTable, "schema");
 
         Assert.assertNotNull(response);
         System.out.println("schema = " + response);
@@ -156,8 +156,8 @@ public class DataSetLineageJerseyResourceIT extends BaseResourceIT {
 
     @Test
     public void testSchemaForEntity() throws Exception {
-        String tableId = serviceClient.getEntity(HIVE_TABLE_TYPE, AtlasClient.REFERENCEABLE_ATTRIBUTE_NAME, salesFactTable).getId()._getId();
-        JSONObject results = serviceClient.getSchemaForEntity(tableId);
+        String tableId = atlasClientV1.getEntity(HIVE_TABLE_TYPE, AtlasClient.REFERENCEABLE_ATTRIBUTE_NAME, salesFactTable).getId()._getId();
+        JSONObject results = atlasClientV1.getSchemaForEntity(tableId);
         Assert.assertNotNull(results);
 
         JSONArray rows = results.getJSONArray("rows");
@@ -175,12 +175,12 @@ public class DataSetLineageJerseyResourceIT extends BaseResourceIT {
 
     @Test(expectedExceptions = AtlasServiceException.class)
     public void testSchemaForInvalidTable() throws Exception {
-        JSONObject response = serviceClient.callAPIWithBodyAndParams(AtlasClient.API.NAME_LINEAGE_SCHEMA, null, "blah", "schema");
+        JSONObject response = atlasClientV1.callAPIWithBodyAndParams(AtlasClient.API.NAME_LINEAGE_SCHEMA, null, "blah", "schema");
     }
 
     @Test(expectedExceptions = AtlasServiceException.class)
     public void testSchemaForDB() throws Exception {
-        JSONObject response = serviceClient.callAPIWithBodyAndParams(AtlasClient.API.NAME_LINEAGE_SCHEMA, null, salesDBName, "schema");
+        JSONObject response = atlasClientV1.callAPIWithBodyAndParams(AtlasClient.API.NAME_LINEAGE_SCHEMA, null, salesDBName, "schema");
     }
 
     private void setupInstances() throws Exception {
@@ -238,9 +238,9 @@ public class DataSetLineageJerseyResourceIT extends BaseResourceIT {
     Id database(String name, String description, String owner, String locationUri, String... traitNames)
     throws Exception {
         Referenceable referenceable = new Referenceable(DATABASE_TYPE, traitNames);
-        referenceable.set("name", name);
-        referenceable.set("qualifiedName", name);
-        referenceable.set("clusterName", locationUri + name);
+        referenceable.set(NAME, name);
+        referenceable.set(QUALIFIED_NAME, name);
+        referenceable.set(CLUSTER_NAME, locationUri + name);
         referenceable.set("description", description);
         referenceable.set("owner", owner);
         referenceable.set("locationUri", locationUri);
@@ -251,8 +251,8 @@ public class DataSetLineageJerseyResourceIT extends BaseResourceIT {
 
     Referenceable column(String name, String type, String comment, String... traitNames) throws Exception {
         Referenceable referenceable = new Referenceable(COLUMN_TYPE, traitNames);
-        referenceable.set("name", name);
-        referenceable.set("qualifiedName", name);
+        referenceable.set(NAME, name);
+        referenceable.set(QUALIFIED_NAME, name);
         referenceable.set("type", type);
         referenceable.set("comment", comment);
 

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/ec1b160a/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 22bcc02..e15785d 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
@@ -64,13 +64,12 @@ import org.testng.annotations.Test;
 import javax.ws.rs.core.MultivaluedMap;
 import javax.ws.rs.core.Response;
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.UUID;
 
-import java.util.Collections;
-
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertNotNull;
 import static org.testng.Assert.fail;
@@ -103,8 +102,8 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
     public void setUp() throws Exception {
         super.setUp();
 
-        createTypeDefinitions();
-        Referenceable HiveDBInstance = createHiveDBInstance(DATABASE_NAME);
+        createTypeDefinitionsV1();
+        Referenceable HiveDBInstance = createHiveDBInstanceV1(DATABASE_NAME);
         dbId = createInstance(HiveDBInstance);
 
         List<NotificationConsumer<EntityNotification>> consumers =
@@ -115,7 +114,7 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
 
     @Test
     public void testSubmitEntity() throws Exception {
-        tableInstance = createHiveTableInstance(DATABASE_NAME, TABLE_NAME, dbId);
+        tableInstance = createHiveTableInstanceV1(DATABASE_NAME, TABLE_NAME, dbId);
         tableId = createInstance(tableInstance);
 
         final String guid = tableId._getId();
@@ -131,7 +130,7 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
         Referenceable entity = new Referenceable(DATABASE_TYPE);
         String dbName = randomString();
         entity.set("name", dbName);
-        entity.set("qualifiedName", dbName);
+        entity.set(QUALIFIED_NAME, dbName);
         entity.set("clusterName", randomString());
         entity.set("description", randomString());
         entity.set(AtlasClient.REFERENCEABLE_ATTRIBUTE_NAME, dbName);
@@ -150,7 +149,7 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
         }
         String entityId = localClient.createEntity(entity).get(0);
 
-        List<EntityAuditEvent> events = serviceClient.getEntityAuditEvents(entityId, (short) 10);
+        List<EntityAuditEvent> events = atlasClientV1.getEntityAuditEvents(entityId, (short) 10);
         assertEquals(events.size(), 1);
         assertEquals(events.get(0).getUser(), user);
     }
@@ -161,7 +160,7 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
         Referenceable databaseInstance = new Referenceable(DATABASE_TYPE);
         String dbName = randomString();
         databaseInstance.set("name", dbName);
-        databaseInstance.set("qualifiedName", dbName);
+        databaseInstance.set(QUALIFIED_NAME, dbName);
         databaseInstance.set("clusterName", randomString());
         databaseInstance.set("description", randomString());
         databaseInstance.set(AtlasClient.REFERENCEABLE_ATTRIBUTE_NAME, dbName);
@@ -170,7 +169,7 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
         databaseInstance.set("parameters", Collections.EMPTY_MAP);
         databaseInstance.set("location", "/tmp");
 
-        JSONObject response = serviceClient
+        JSONObject response = atlasClientV1
                 .callAPIWithBody(AtlasClient.API.CREATE_ENTITY, InstanceSerialization.toJson(databaseInstance, true));
         assertNotNull(response);
         Assert.assertNotNull(response.get(AtlasClient.REQUEST_ID));
@@ -184,7 +183,7 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
     public void testEntityDeduping() throws Exception {
         final Referenceable db = new Referenceable(DATABASE_TYPE);
         final String dbName = "db" + randomString();
-        Referenceable HiveDBInstance = createHiveDBInstance(dbName);
+        Referenceable HiveDBInstance = createHiveDBInstanceV1(dbName);
         Id dbIdReference = createInstance(HiveDBInstance);
         final String dbId = dbIdReference._getId();
 
@@ -201,7 +200,7 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
         assertEquals(results.length(), 1);
 
         //create entity again shouldn't create another instance with same unique attribute value
-        List<String> entityResults = serviceClient.createEntity(HiveDBInstance);
+        List<String> entityResults = atlasClientV1.createEntity(HiveDBInstance);
         assertEquals(entityResults.size(), 0);
         try {
             waitForNotification(notificationConsumer, MAX_WAIT_TIME, new NotificationPredicate() {
@@ -221,15 +220,15 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
         //Test the same across references
         Referenceable table = new Referenceable(HIVE_TABLE_TYPE);
         final String tableName = randomString();
-        Referenceable tableInstance = createHiveTableInstance(DATABASE_NAME, tableName, dbIdReference);
-        serviceClient.createEntity(tableInstance);
+        Referenceable tableInstance = createHiveTableInstanceV1(DATABASE_NAME, tableName, dbIdReference);
+        atlasClientV1.createEntity(tableInstance);
         results = searchByDSL(String.format("%s where qualifiedName='%s'", DATABASE_TYPE, dbName));
         assertEquals(results.length(), 1);
     }
 
     private void assertEntityAudit(String dbid, EntityAuditEvent.EntityAuditAction auditAction)
             throws Exception {
-        List<EntityAuditEvent> events = serviceClient.getEntityAuditEvents(dbid, (short) 100);
+        List<EntityAuditEvent> events = atlasClientV1.getEntityAuditEvents(dbid, (short) 100);
         for (EntityAuditEvent event : events) {
             if (event.getAction() == auditAction) {
                 return;
@@ -244,12 +243,12 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
         HierarchicalTypeDefinition<ClassType> typeDefinition = TypesUtil
                 .createClassTypeDef(randomString(), ImmutableSet.<String>of(),
                         TypesUtil.createUniqueRequiredAttrDef("name", DataTypes.STRING_TYPE));
-        serviceClient.createType(TypesSerialization.toJson(typeDefinition, false));
+        atlasClientV1.createType(TypesSerialization.toJson(typeDefinition, false));
 
         //create entity for the type
         Referenceable instance = new Referenceable(typeDefinition.typeName);
         instance.set("name", randomString());
-        String guid = serviceClient.createEntity(instance).get(0);
+        String guid = atlasClientV1.createEntity(instance).get(0);
 
         //update type - add attribute
         typeDefinition = TypesUtil.createClassTypeDef(typeDefinition.typeName, ImmutableSet.<String>of(),
@@ -258,10 +257,10 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
         TypesDef typeDef = TypesUtil.getTypesDef(ImmutableList.<EnumTypeDefinition>of(),
                 ImmutableList.<StructTypeDefinition>of(), ImmutableList.<HierarchicalTypeDefinition<TraitType>>of(),
                 ImmutableList.of(typeDefinition));
-        serviceClient.updateType(typeDef);
+        atlasClientV1.updateType(typeDef);
 
         //Get definition after type update - new attributes should be null
-        Referenceable entity = serviceClient.getEntity(guid);
+        Referenceable entity = atlasClientV1.getEntity(guid);
         Assert.assertNull(entity.get("description"));
         Assert.assertEquals(entity.get("name"), instance.get("name"));
     }
@@ -289,25 +288,25 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
     public void testGetEntityByAttribute() throws Exception {
         Referenceable db1 = new Referenceable(DATABASE_TYPE);
         String dbName = randomString();
-        db1.set("name", dbName);
-        db1.set("description", randomString());
+        db1.set(NAME, dbName);
+        db1.set(DESCRIPTION, randomString());
         db1.set(AtlasClient.REFERENCEABLE_ATTRIBUTE_NAME, dbName);
         db1.set("owner", "user1");
-        db1.set("clusterName", "cl1");
+        db1.set(CLUSTER_NAME, "cl1");
         db1.set("parameters", Collections.EMPTY_MAP);
         db1.set("location", "/tmp");
         createInstance(db1);
 
         //get entity by attribute
-        Referenceable referenceable = serviceClient.getEntity(DATABASE_TYPE, "qualifiedName", dbName);
+        Referenceable referenceable = atlasClientV1.getEntity(DATABASE_TYPE, QUALIFIED_NAME, dbName);
         Assert.assertEquals(referenceable.getTypeName(), DATABASE_TYPE);
-        Assert.assertEquals(referenceable.get("qualifiedName"), dbName);
+        Assert.assertEquals(referenceable.get(QUALIFIED_NAME), dbName);
     }
 
     @Test
     public void testSubmitEntityWithBadDateFormat() throws Exception {
         try {
-            Referenceable tableInstance = createHiveTableInstance("db" + randomString(), "table" + randomString(), dbId);
+            Referenceable tableInstance = createHiveTableInstanceV1("db" + randomString(), "table" + randomString(), dbId);
             tableInstance.set("lastAccessTime", "2014-07-11");
             tableId = createInstance(tableInstance);
             Assert.fail("Was expecting an  exception here ");
@@ -324,7 +323,7 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
         String description = "bar table - new desc";
         addProperty(guid, "description", description);
 
-        JSONObject response = serviceClient.callAPIWithBodyAndParams(AtlasClient.API.GET_ENTITY, null, guid);
+        JSONObject response = atlasClientV1.callAPIWithBodyAndParams(AtlasClient.API.GET_ENTITY, null, guid);
         Assert.assertNotNull(response);
 
         tableInstance.set("description", description);
@@ -340,7 +339,7 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
         String currentTime = String.valueOf(new DateTime() );
         addProperty(guid, "createTime", currentTime);
 
-        response = serviceClient.callAPIWithBodyAndParams(AtlasClient.API.GET_ENTITY, null, guid);
+        response = atlasClientV1.callAPIWithBodyAndParams(AtlasClient.API.GET_ENTITY, null, guid);
         Assert.assertNotNull(response);
 
         tableInstance.set("createTime", currentTime);
@@ -371,13 +370,13 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
         //Create new db instance
         Referenceable databaseInstance = new Referenceable(DATABASE_TYPE);
         String dbName = randomString();
-        databaseInstance.set("name", dbName);
-        databaseInstance.set("qualifiedName", dbName);
-        databaseInstance.set("clusterName", randomString());
+        databaseInstance.set(NAME, dbName);
+        databaseInstance.set(QUALIFIED_NAME, dbName);
+        databaseInstance.set(CLUSTER_NAME, randomString());
         databaseInstance.set("description", "new database");
         databaseInstance.set(AtlasClient.REFERENCEABLE_ATTRIBUTE_NAME, dbName);
         databaseInstance.set("owner", "user1");
-        databaseInstance.set("clusterName", "cl1");
+        databaseInstance.set(CLUSTER_NAME, "cl1");
         databaseInstance.set("parameters", Collections.EMPTY_MAP);
         databaseInstance.set("location", "/tmp");
 
@@ -392,7 +391,7 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
     @Test(dependsOnMethods = "testSubmitEntity")
     public void testGetEntityDefinition() throws Exception {
         final String guid = tableId._getId();
-        JSONObject response = serviceClient.callAPIWithBodyAndParams(AtlasClient.API.GET_ENTITY, null, guid);
+        JSONObject response = atlasClientV1.callAPIWithBodyAndParams(AtlasClient.API.GET_ENTITY, null, guid);
 
         Assert.assertNotNull(response);
         Assert.assertNotNull(response.get(AtlasClient.REQUEST_ID));
@@ -404,7 +403,7 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
     }
 
     private void addProperty(String guid, String property, String value) throws AtlasServiceException {
-        AtlasClient.EntityResult entityResult = serviceClient.updateEntityAttribute(guid, property, value);
+        AtlasClient.EntityResult entityResult = atlasClientV1.updateEntityAttribute(guid, property, value);
         assertEquals(entityResult.getUpdateEntities().size(), 1);
         assertEquals(entityResult.getUpdateEntities().get(0), guid);
     }
@@ -412,7 +411,7 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
     @Test(expectedExceptions = AtlasServiceException.class)
     public void testGetInvalidEntityDefinition() throws Exception {
 
-        JSONObject response = serviceClient.callAPIWithBodyAndParams(AtlasClient.API.GET_ENTITY, null, "blah");
+        JSONObject response = atlasClientV1.callAPIWithBodyAndParams(AtlasClient.API.GET_ENTITY, null, "blah");
 
         Assert.assertNotNull(response);
 
@@ -422,7 +421,7 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
 
     @Test(dependsOnMethods = "testSubmitEntity")
     public void testGetEntityList() throws Exception {
-        List<String> entities = serviceClient.listEntities(HIVE_TABLE_TYPE);
+        List<String> entities = atlasClientV1.listEntities(HIVE_TABLE_TYPE);
         Assert.assertNotNull(entities);
         Assert.assertTrue(entities.contains(tableId._getId()));
     }
@@ -432,7 +431,7 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
         MultivaluedMap<String, String> queryParams = new MultivaluedMapImpl();
         queryParams.add("type", "blah");
 
-        JSONObject response = serviceClient.callAPIWithQueryParams(AtlasClient.API.GET_ENTITY, queryParams);
+        JSONObject response = atlasClientV1.callAPIWithQueryParams(AtlasClient.API.GET_ENTITY, queryParams);
         assertNotNull(response);
         Assert.assertNotNull(response.get(AtlasClient.ERROR));
         Assert.assertNotNull(response.get(AtlasClient.STACKTRACE));
@@ -446,7 +445,7 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
         MultivaluedMap<String, String> queryParams = new MultivaluedMapImpl();
         queryParams.add("type", typeName);
 
-        JSONObject response = serviceClient.callAPIWithQueryParams(AtlasClient.API.GET_ENTITY, queryParams);
+        JSONObject response = atlasClientV1.callAPIWithQueryParams(AtlasClient.API.GET_ENTITY, queryParams);
         assertNotNull(response);
         Assert.assertNotNull(response.get(AtlasClient.REQUEST_ID));
 
@@ -470,7 +469,7 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
     public void testGetTraitNames() throws Exception {
         final String guid = tableId._getId();
 
-        JSONObject response = serviceClient.callAPIWithBodyAndParams(AtlasClient.API.LIST_TRAITS, null, guid, TRAITS);
+        JSONObject response = atlasClientV1.callAPIWithBodyAndParams(AtlasClient.API.LIST_TRAITS, null, guid, TRAITS);
         assertNotNull(response);
         Assert.assertNotNull(response.get(AtlasClient.REQUEST_ID));
 
@@ -492,7 +491,7 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
         LOG.debug("traitInstanceAsJSON = " + traitInstanceAsJSON);
 
         final String guid = tableId._getId();
-        JSONObject response = serviceClient.callAPIWithBodyAndParams(AtlasClient.API.ADD_TRAITS, traitInstanceAsJSON, guid, TRAITS);
+        JSONObject response = atlasClientV1.callAPIWithBodyAndParams(AtlasClient.API.ADD_TRAITS, traitInstanceAsJSON, guid, TRAITS);
         assertNotNull(response);
         Assert.assertNotNull(response.get(AtlasClient.REQUEST_ID));
 
@@ -513,15 +512,15 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
         LOG.debug("traitInstanceAsJSON = " + traitInstanceAsJSON);
 
         final String guid = tableId._getId();
-        JSONObject response = serviceClient.callAPIWithBodyAndParams(AtlasClient.API.ADD_TRAITS, traitInstanceAsJSON, guid, TRAITS);
+        JSONObject response = atlasClientV1.callAPIWithBodyAndParams(AtlasClient.API.ADD_TRAITS, traitInstanceAsJSON, guid, TRAITS);
         assertNotNull(response);
-        Struct traitDef = serviceClient.getTraitDefinition(guid, traitName);
+        Struct traitDef = atlasClientV1.getTraitDefinition(guid, traitName);
         System.out.println(traitDef.toString());
         JSONObject responseAsJSON = new JSONObject(InstanceSerialization.toJson(traitDef, true));
         Assert.assertEquals(responseAsJSON.get("typeName"), traitName);
 
 
-        List<Struct> allTraitDefs = serviceClient.listTraitDefinitions(guid);
+        List<Struct> allTraitDefs = atlasClientV1.listTraitDefinitions(guid);
         System.out.println(allTraitDefs.toString());
         Assert.assertEquals(allTraitDefs.size(), 9);
     }
@@ -535,7 +534,7 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
         LOG.debug("traitInstanceAsJSON = " + traitInstanceAsJSON);
 
         final String guid = tableId._getId();
-        JSONObject response = serviceClient.callAPIWithBodyAndParams(AtlasClient.API.ADD_TRAITS, traitInstanceAsJSON, guid, TRAITS);
+        JSONObject response = atlasClientV1.callAPIWithBodyAndParams(AtlasClient.API.ADD_TRAITS, traitInstanceAsJSON, guid, TRAITS);
         assertNotNull(response);
     }
 
@@ -555,12 +554,12 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
         LOG.debug("traitInstanceAsJSON = " + traitInstanceAsJSON);
 
         final String guid = tableId._getId();
-        JSONObject response = serviceClient.callAPIWithBodyAndParams(AtlasClient.API.ADD_TRAITS, traitInstanceAsJSON, guid, TRAITS);
+        JSONObject response = atlasClientV1.callAPIWithBodyAndParams(AtlasClient.API.ADD_TRAITS, traitInstanceAsJSON, guid, TRAITS);
         assertNotNull(response);
         Assert.assertNotNull(response.get(AtlasClient.REQUEST_ID));
 
         // verify the response
-        response = serviceClient.callAPIWithBodyAndParams(AtlasClient.API.GET_ENTITY, null, guid);
+        response = atlasClientV1.callAPIWithBodyAndParams(AtlasClient.API.GET_ENTITY, null, guid);
         Assert.assertNotNull(response.get(AtlasClient.REQUEST_ID));
 
         final String definition = response.getString(AtlasClient.DEFINITION);
@@ -583,14 +582,14 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
         String traitInstanceAsJSON = InstanceSerialization$.MODULE$.toJson(traitInstance, true);
         LOG.debug("traitInstanceAsJSON = " + traitInstanceAsJSON);
 
-        JSONObject response = serviceClient.callAPIWithBodyAndParams(AtlasClient.API.CREATE_ENTITY, traitInstanceAsJSON, "random", TRAITS);
+        JSONObject response = atlasClientV1.callAPIWithBodyAndParams(AtlasClient.API.CREATE_ENTITY, traitInstanceAsJSON, "random", TRAITS);
     }
 
     @Test(dependsOnMethods = "testAddTrait")
     public void testDeleteTrait() throws Exception {
         final String guid = tableId._getId();
 
-        JSONObject response = serviceClient.callAPIWithBodyAndParams(AtlasClient.API.DELETE_TRAITS, null, guid, TRAITS, traitName);
+        JSONObject response = atlasClientV1.callAPIWithBodyAndParams(AtlasClient.API.DELETE_TRAITS, null, guid, TRAITS, traitName);
         Assert.assertNotNull(response.get(AtlasClient.REQUEST_ID));
         Assert.assertNotNull(response.get("traitName"));
         assertEntityAudit(guid, EntityAuditEvent.EntityAuditAction.TAG_DELETE);
@@ -599,7 +598,7 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
     @Test(expectedExceptions = AtlasServiceException.class)
     public void testDeleteTraitNonExistent() throws Exception {
         final String traitName = "blah_trait";
-        JSONObject response = serviceClient.callAPIWithBodyAndParams(AtlasClient.API.DELETE_TRAITS, null, "random", TRAITS);
+        JSONObject response = atlasClientV1.callAPIWithBodyAndParams(AtlasClient.API.DELETE_TRAITS, null, "random", TRAITS);
 
         Assert.assertNotNull(response.get(AtlasClient.ERROR));
         Assert.assertEquals(response.getString(AtlasClient.ERROR),
@@ -619,7 +618,7 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
         createType(traitDefinitionAsJSON);
 
         try {
-            JSONObject response = serviceClient.callAPIWithBodyAndParams(AtlasClient.API.DELETE_TRAITS, null, guid, TRAITS, traitName);
+            JSONObject response = atlasClientV1.callAPIWithBodyAndParams(AtlasClient.API.DELETE_TRAITS, null, guid, TRAITS, traitName);
             fail("Call should've failed for deletion of invalid trait");
         } catch (AtlasServiceException e) {
             assertNotNull(e);
@@ -650,7 +649,7 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
         instance.set(attrName, attrValue);
         Id guid = createInstance(instance);
 
-        JSONObject response = serviceClient.callAPIWithBodyAndParams(AtlasClient.API.GET_ENTITY, null, guid._getId());
+        JSONObject response = atlasClientV1.callAPIWithBodyAndParams(AtlasClient.API.GET_ENTITY, null, guid._getId());
         Referenceable getReferenceable = InstanceSerialization.fromJsonReferenceable(response.getString(AtlasClient.DEFINITION), true);
         Assert.assertEquals(getReferenceable.get(attrName), attrValue);
     }
@@ -660,9 +659,9 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
         String colName = "col1"+randomString();
         final List<Referenceable> columns = new ArrayList<>();
         Map<String, Object> values = new HashMap<>();
-        values.put("name", colName);
+        values.put(NAME, colName);
         values.put("comment", "col1 comment");
-        values.put("qualifiedName", "default.table.col1@"+colName);
+        values.put(QUALIFIED_NAME, "default.table.col1@"+colName);
         values.put("comment", "col1 comment");
         values.put("type", "string");
         values.put("owner", "user1");
@@ -677,11 +676,11 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
         }});
 
         LOG.debug("Updating entity= " + tableUpdated);
-        AtlasClient.EntityResult entityResult = serviceClient.updateEntity(tableId._getId(), tableUpdated);
+        AtlasClient.EntityResult entityResult = atlasClientV1.updateEntity(tableId._getId(), tableUpdated);
         assertEquals(entityResult.getUpdateEntities().size(), 1);
         assertEquals(entityResult.getUpdateEntities().get(0), tableId._getId());
 
-        JSONObject response = serviceClient.callAPIWithBodyAndParams(AtlasClient.API.GET_ENTITY, null, tableId._getId());
+        JSONObject response = atlasClientV1.callAPIWithBodyAndParams(AtlasClient.API.GET_ENTITY, null, tableId._getId());
         Referenceable getReferenceable = InstanceSerialization.fromJsonReferenceable(response.getString(AtlasClient.DEFINITION), true);
         List<Referenceable> refs = (List<Referenceable>) getReferenceable.get("columns");
 
@@ -696,12 +695,12 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
         }});
 
         LOG.debug("Updating entity= " + tableUpdated);
-        entityResult = serviceClient.updateEntity(BaseResourceIT.HIVE_TABLE_TYPE, AtlasClient.REFERENCEABLE_ATTRIBUTE_NAME,
-                (String) tableInstance.get("qualifiedName"), tableUpdated);
+        entityResult = atlasClientV1.updateEntity(BaseResourceIT.HIVE_TABLE_TYPE, AtlasClient.REFERENCEABLE_ATTRIBUTE_NAME,
+                (String) tableInstance.get(QUALIFIED_NAME), tableUpdated);
         assertEquals(entityResult.getUpdateEntities().size(), 2);
         assertEquals(entityResult.getUpdateEntities().get(0), tableId._getId());
 
-        response = serviceClient.callAPIWithBodyAndParams(AtlasClient.API.GET_ENTITY, null, tableId._getId());
+        response = atlasClientV1.callAPIWithBodyAndParams(AtlasClient.API.GET_ENTITY, null, tableId._getId());
         getReferenceable = InstanceSerialization.fromJsonReferenceable(response.getString(AtlasClient.DEFINITION), true);
         refs = (List<Referenceable>) getReferenceable.get("columns");
 
@@ -713,8 +712,8 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
     public void testCompleteUpdate() throws Exception {
         final List<Referenceable> columns = new ArrayList<>();
         Map<String, Object> values1 = new HashMap<>();
-        values1.put("name", "col3");
-        values1.put("qualifiedName", "default.table.col3@cl1");
+        values1.put(NAME, "col3");
+        values1.put(QUALIFIED_NAME, "default.table.col3@cl1");
         values1.put("comment", "col3 comment");
         values1.put("type", "string");
         values1.put("owner", "user1");
@@ -724,8 +723,8 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
 
 
         Map<String, Object> values2 = new HashMap<>();
-        values2.put("name", "col4");
-        values2.put("qualifiedName", "default.table.col4@cl1");
+        values2.put(NAME, "col4");
+        values2.put(QUALIFIED_NAME, "default.table.col4@cl1");
         values2.put("comment", "col4 comment");
         values2.put("type", "string");
         values2.put("owner", "user2");
@@ -743,7 +742,7 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
         entityArray.put(entityJson);
         LOG.debug("Replacing entity= " + tableInstance);
 
-        JSONObject response = serviceClient.callAPIWithBody(AtlasClient.API.UPDATE_ENTITY, entityArray);
+        JSONObject response = atlasClientV1.callAPIWithBody(AtlasClient.API.UPDATE_ENTITY, entityArray);
 
         // ATLAS-586: verify response entity can be parsed by GSON.
         Gson gson = new Gson();
@@ -754,7 +753,7 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
             Assert.fail("Response entity from not parse-able by GSON", e);
         }
 
-        response = serviceClient.callAPIWithBodyAndParams(AtlasClient.API.GET_ENTITY, null, tableId._getId());
+        response = atlasClientV1.callAPIWithBodyAndParams(AtlasClient.API.GET_ENTITY, null, tableId._getId());
         LOG.info("Response = {}", response.toString());
         Referenceable getReferenceable = InstanceSerialization.fromJsonReferenceable(response.getString(AtlasClient.DEFINITION), true);
         List<Referenceable> refs = (List<Referenceable>) getReferenceable.get("columns");
@@ -780,24 +779,24 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
         // Create 2 database entities
         Referenceable db1 = new Referenceable(DATABASE_TYPE);
         String dbName = randomString();
-        db1.set("name", dbName);
-        db1.set("description", randomString());
+        db1.set(NAME, dbName);
+        db1.set(DESCRIPTION, randomString());
         db1.set(AtlasClient.REFERENCEABLE_ATTRIBUTE_NAME, dbName);
         db1.set("owner", "user1");
-        db1.set("clusterName", "cl1");
+        db1.set(CLUSTER_NAME, "cl1");
         db1.set("parameters", Collections.EMPTY_MAP);
         db1.set("location", "/tmp");
         Id db1Id = createInstance(db1);
 
         Referenceable db2 = new Referenceable(DATABASE_TYPE);
         String dbName2 = randomString();
-        db2.set("name", dbName2);
-        db2.set("qualifiedName", dbName2);
-        db2.set("clusterName", randomString());
-        db2.set("description", randomString());
+        db2.set(NAME, dbName2);
+        db2.set(QUALIFIED_NAME, dbName2);
+        db2.set(CLUSTER_NAME, randomString());
+        db2.set(DESCRIPTION, randomString());
         db2.set(AtlasClient.REFERENCEABLE_ATTRIBUTE_NAME, dbName2);
         db2.set("owner", "user2");
-        db2.set("clusterName", "cl1");
+        db2.set(CLUSTER_NAME, "cl1");
         db2.set("parameters", Collections.EMPTY_MAP);
         db2.set("location", "/tmp");
         Id db2Id = createInstance(db2);
@@ -807,14 +806,14 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
         queryParams.add(AtlasClient.GUID.toLowerCase(), db1Id._getId());
         queryParams.add(AtlasClient.GUID.toLowerCase(), db2Id._getId());
 
-        JSONObject response = serviceClient.callAPIWithQueryParams(AtlasClient.API.DELETE_ENTITIES, queryParams);
+        JSONObject response = atlasClientV1.callAPIWithQueryParams(AtlasClient.API.DELETE_ENTITIES, queryParams);
         List<String> deletedGuidsList = AtlasClient.EntityResult.fromString(response.toString()).getDeletedEntities();
         Assert.assertTrue(deletedGuidsList.contains(db1Id._getId()));
         Assert.assertTrue(deletedGuidsList.contains(db2Id._getId()));
 
         // Verify entities were deleted from the repository.
         for (String guid : deletedGuidsList) {
-            Referenceable entity = serviceClient.getEntity(guid);
+            Referenceable entity = atlasClientV1.getEntity(guid);
             assertEquals(entity.getId().getState(), Id.EntityState.DELETED);
         }
     }
@@ -828,15 +827,15 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
         db1.set("description", randomString());
         db1.set(AtlasClient.REFERENCEABLE_ATTRIBUTE_NAME, dbName);
         db1.set("owner", "user1");
-        db1.set("clusterName", "cl1");
+        db1.set(CLUSTER_NAME, "cl1");
         db1.set("parameters", Collections.EMPTY_MAP);
         db1.set("location", "/tmp");
         Id db1Id = createInstance(db1);
         Referenceable db2 = new Referenceable(DATABASE_TYPE);
         String dbName2 = randomString();
         db2.set("name", dbName2);
-        db2.set("qualifiedName", dbName2);
-        db2.set("clusterName", randomString());
+        db2.set(QUALIFIED_NAME, dbName2);
+        db2.set(CLUSTER_NAME, randomString());
         db2.set("description", randomString());
         db2.set(AtlasClient.REFERENCEABLE_ATTRIBUTE_NAME, dbName2);
         db2.set("owner", "user2");
@@ -847,8 +846,7 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
 
         // Delete the database entities
         List<String> deletedGuidsList =
-                serviceClient.deleteEntities(db1Id._getId(), db2Id._getId()).getDeletedEntities();
-
+                atlasClientV1.deleteEntities(db1Id._getId(), db2Id._getId()).getDeletedEntities();
         // Verify that deleteEntities() response has database entity guids 
         Assert.assertEquals(deletedGuidsList.size(), 2);
         Assert.assertTrue(deletedGuidsList.contains(db1Id._getId()));
@@ -856,7 +854,7 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
 
         // Verify entities were deleted from the repository.
         for (String guid : deletedGuidsList) {
-            Referenceable entity = serviceClient.getEntity(guid);
+            Referenceable entity = atlasClientV1.getEntity(guid);
             assertEquals(entity.getId().getState(), Id.EntityState.DELETED);
         }
     }
@@ -866,19 +864,19 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
         // Create database entity
         Referenceable db1 = new Referenceable(DATABASE_TYPE);
         String dbName = randomString();
-        db1.set("name", dbName);
-        db1.set("qualifiedName", dbName);
-        db1.set("clusterName", randomString());
-        db1.set("description", randomString());
+        db1.set(NAME, dbName);
+        db1.set(QUALIFIED_NAME, dbName);
+        db1.set(CLUSTER_NAME, randomString());
+        db1.set(DESCRIPTION, randomString());
         db1.set(AtlasClient.REFERENCEABLE_ATTRIBUTE_NAME, dbName);
         db1.set("owner", "user1");
-        db1.set("clusterName", "cl1");
+        db1.set(CLUSTER_NAME, "cl1");
         db1.set("parameters", Collections.EMPTY_MAP);
         db1.set("location", "/tmp");
         Id db1Id = createInstance(db1);
 
         // Delete the database entity
-        List<String> deletedGuidsList = serviceClient.deleteEntity(DATABASE_TYPE, "qualifiedName", dbName).getDeletedEntities();
+        List<String> deletedGuidsList = atlasClientV1.deleteEntity(DATABASE_TYPE, QUALIFIED_NAME, dbName).getDeletedEntities();
 
         // Verify that deleteEntities() response has database entity guids
         Assert.assertEquals(deletedGuidsList.size(), 1);
@@ -886,7 +884,7 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
 
         // Verify entities were deleted from the repository.
         for (String guid : deletedGuidsList) {
-            Referenceable entity = serviceClient.getEntity(guid);
+            Referenceable entity = atlasClientV1.getEntity(guid);
             assertEquals(entity.getId().getState(), Id.EntityState.DELETED);
         }
     }

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/ec1b160a/webapp/src/test/java/org/apache/atlas/web/resources/EntityLineageJerseyResourceIT.java
----------------------------------------------------------------------
diff --git a/webapp/src/test/java/org/apache/atlas/web/resources/EntityLineageJerseyResourceIT.java b/webapp/src/test/java/org/apache/atlas/web/resources/EntityLineageJerseyResourceIT.java
index c681a0f..4f8badf 100644
--- a/webapp/src/test/java/org/apache/atlas/web/resources/EntityLineageJerseyResourceIT.java
+++ b/webapp/src/test/java/org/apache/atlas/web/resources/EntityLineageJerseyResourceIT.java
@@ -60,19 +60,19 @@ public class EntityLineageJerseyResourceIT extends DataSetLineageJerseyResourceI
     public void setUp() throws Exception {
         super.setUp();
 
-        createTypeDefinitions();
+        createTypeDefinitionsV1();
         setupInstances();
     }
 
     @Test
     public void testInputLineageInfo() throws Exception {
-        String tableId = serviceClient.getEntity(HIVE_TABLE_TYPE,
+        String tableId = atlasClientV1.getEntity(HIVE_TABLE_TYPE,
                 AtlasClient.REFERENCEABLE_ATTRIBUTE_NAME, salesMonthlyTable).getId()._getId();
 
         MultivaluedMap<String, String> queryParams = new MultivaluedMapImpl();
         queryParams.add(DIRECTION_PARAM, INPUT_DIRECTION);
         queryParams.add(DEPTH_PARAM, "5");
-        JSONObject response = serviceClient.callAPI(LINEAGE_V2_API, JSONObject.class, queryParams, tableId);
+        JSONObject response = atlasClientV1.callAPI(LINEAGE_V2_API, JSONObject.class, queryParams, tableId);
         Assert.assertNotNull(response);
         System.out.println("input lineage info = " + response
         );
@@ -94,13 +94,13 @@ public class EntityLineageJerseyResourceIT extends DataSetLineageJerseyResourceI
 
     @Test
     public void testOutputLineageInfo() throws Exception {
-        String tableId = serviceClient.getEntity(HIVE_TABLE_TYPE,
+        String tableId = atlasClientV1.getEntity(HIVE_TABLE_TYPE,
                 AtlasClient.REFERENCEABLE_ATTRIBUTE_NAME, salesFactTable).getId()._getId();
 
         MultivaluedMap<String, String> queryParams = new MultivaluedMapImpl();
         queryParams.add(DIRECTION_PARAM, OUTPUT_DIRECTION);
         queryParams.add(DEPTH_PARAM, "5");
-        JSONObject response = serviceClient.callAPI(LINEAGE_V2_API, JSONObject.class, queryParams, tableId);
+        JSONObject response = atlasClientV1.callAPI(LINEAGE_V2_API, JSONObject.class, queryParams, tableId);
 
         Assert.assertNotNull(response);
         System.out.println("output lineage info = " + response);
@@ -122,13 +122,13 @@ public class EntityLineageJerseyResourceIT extends DataSetLineageJerseyResourceI
 
     @Test
     public void testLineageInfo() throws Exception {
-        String tableId = serviceClient.getEntity(HIVE_TABLE_TYPE,
+        String tableId = atlasClientV1.getEntity(HIVE_TABLE_TYPE,
                 AtlasClient.REFERENCEABLE_ATTRIBUTE_NAME, salesMonthlyTable).getId()._getId();
 
         MultivaluedMap<String, String> queryParams = new MultivaluedMapImpl();
         queryParams.add(DIRECTION_PARAM, BOTH_DIRECTION);
         queryParams.add(DEPTH_PARAM, "5");
-        JSONObject response = serviceClient.callAPI(LINEAGE_V2_API, JSONObject.class, queryParams, tableId);
+        JSONObject response = atlasClientV1.callAPI(LINEAGE_V2_API, JSONObject.class, queryParams, tableId);
 
         Assert.assertNotNull(response);
         System.out.println("both lineage info = " + response);


[3/3] incubator-atlas git commit: ATLAS-1311: Integration tests for V2 Entity APIs

Posted by ma...@apache.org.
ATLAS-1311: Integration tests for V2 Entity APIs

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


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

Branch: refs/heads/master
Commit: ec1b160ac10cf6e35d764a6c33f337e173f9466f
Parents: 3b1a7d0
Author: apoorvnaik <an...@hortonworks.com>
Authored: Sun Nov 20 22:17:13 2016 -0800
Committer: Madhan Neethiraj <ma...@apache.org>
Committed: Wed Dec 21 08:56:57 2016 -0800

----------------------------------------------------------------------
 .gitignore                                      |   2 +-
 .../org/apache/atlas/hive/hook/HiveHookIT.java  |   2 +-
 .../java/org/apache/atlas/AtlasBaseClient.java  |  28 +-
 .../main/java/org/apache/atlas/AtlasClient.java |   5 +-
 .../org/apache/atlas/AtlasEntitiesClientV2.java |  65 +-
 .../org/apache/atlas/AtlasServiceException.java |   2 +-
 .../org/apache/atlas/AtlasTypedefClientV2.java  |  27 +
 .../org/apache/atlas/model/SearchFilter.java    |   9 +
 .../model/instance/EntityMutationResponse.java  |   1 -
 .../graph/GraphToTypedInstanceMapper.java       |   2 +-
 .../store/graph/v1/AtlasEntityStoreV1.java      |   1 +
 .../java/org/apache/atlas/util/RestUtils.java   |   5 +-
 .../web/adapters/AtlasInstanceRestAdapters.java |   3 +-
 .../apache/atlas/web/resources/BaseService.java |  20 +-
 .../atlas/web/resources/EntityResource.java     |  12 +-
 .../atlas/web/resources/EntityService.java      |  27 +-
 .../atlas/web/resources/TaxonomyService.java    |  15 +-
 .../org/apache/atlas/web/rest/EntitiesREST.java |  51 +-
 .../org/apache/atlas/web/rest/EntityREST.java   |  30 +-
 webapp/src/main/resources/spring-security.xml   |  10 +-
 .../main/webapp/WEB-INF/applicationContext.xml  |  13 +-
 .../org/apache/atlas/examples/QuickStartIT.java |  10 +-
 .../notification/EntityNotificationIT.java      |  20 +-
 .../NotificationHookConsumerIT.java             | 100 +--
 .../NotificationHookConsumerKafkaTest.java      |   9 +-
 .../web/resources/AdminJerseyResourceIT.java    |   2 +-
 .../atlas/web/resources/BaseResourceIT.java     | 290 ++++++--
 .../DataSetLineageJerseyResourceIT.java         |  34 +-
 .../web/resources/EntityJerseyResourceIT.java   | 168 +++--
 .../EntityLineageJerseyResourceIT.java          |  14 +-
 .../web/resources/EntityV2JerseyResourceIT.java | 669 +++++++++++++++++++
 .../MetadataDiscoveryJerseyResourceIT.java      |  59 +-
 .../web/resources/TypesJerseyResourceIT.java    |  60 +-
 33 files changed, 1376 insertions(+), 389 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/ec1b160a/.gitignore
----------------------------------------------------------------------
diff --git a/.gitignore b/.gitignore
index d2fbdc0..cf2ef74 100755
--- a/.gitignore
+++ b/.gitignore
@@ -15,7 +15,7 @@
 # limitations under the License.
 
 # Maven
-target
+target*
 dependency-reduced-pom.xml
 core*.dmp
 pom.xml.releaseBackup

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/ec1b160a/addons/hive-bridge/src/test/java/org/apache/atlas/hive/hook/HiveHookIT.java
----------------------------------------------------------------------
diff --git a/addons/hive-bridge/src/test/java/org/apache/atlas/hive/hook/HiveHookIT.java b/addons/hive-bridge/src/test/java/org/apache/atlas/hive/hook/HiveHookIT.java
index e5bd65a..d640a81 100755
--- a/addons/hive-bridge/src/test/java/org/apache/atlas/hive/hook/HiveHookIT.java
+++ b/addons/hive-bridge/src/test/java/org/apache/atlas/hive/hook/HiveHookIT.java
@@ -1337,7 +1337,7 @@ public class HiveHookIT extends HiveITBase {
          * query = "alter table " + tableName + " STORED AS " + testFormat.toUpperCase();
          * runCommand(query);
 
-         * tableRef = atlasClient.getEntity(tableId);
+         * tableRef = atlasClientV1.getEntity(tableId);
          * sdRef = (Referenceable)tableRef.get(HiveMetaStoreBridge.STORAGE_DESC);
          * Assert.assertEquals(sdRef.get(HiveMetaStoreBridge.STORAGE_DESC_INPUT_FMT), "org.apache.hadoop.hive.ql.io.orc.OrcInputFormat");
          * Assert.assertEquals(sdRef.get(HiveMetaStoreBridge.STORAGE_DESC_OUTPUT_FMT), "org.apache.hadoop.hive.ql.io.orc.OrcOutputFormat");

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/ec1b160a/client/src/main/java/org/apache/atlas/AtlasBaseClient.java
----------------------------------------------------------------------
diff --git a/client/src/main/java/org/apache/atlas/AtlasBaseClient.java b/client/src/main/java/org/apache/atlas/AtlasBaseClient.java
index a95bf32..d055b78 100644
--- a/client/src/main/java/org/apache/atlas/AtlasBaseClient.java
+++ b/client/src/main/java/org/apache/atlas/AtlasBaseClient.java
@@ -27,6 +27,7 @@ import com.sun.jersey.api.client.filter.HTTPBasicAuthFilter;
 import com.sun.jersey.api.json.JSONConfiguration;
 import com.sun.jersey.client.urlconnection.URLConnectionClientHandler;
 import org.apache.atlas.security.SecureClientUtils;
+import org.apache.atlas.type.AtlasType;
 import org.apache.atlas.utils.AuthenticationUtil;
 import org.apache.commons.configuration.Configuration;
 import org.apache.commons.lang.StringUtils;
@@ -276,12 +277,18 @@ public abstract class AtlasBaseClient {
         ClientResponse clientResponse = null;
         int i = 0;
         do {
+            if (LOG.isDebugEnabled()) {
+                LOG.debug("Calling API [ {} : {} ] {}", api.getMethod(), api.getPath(), requestObject != null ? "<== " + requestObject : "");
+            }
             clientResponse = resource
                     .accept(JSON_MEDIA_TYPE)
                     .type(JSON_MEDIA_TYPE)
                     .method(api.getMethod(), ClientResponse.class, requestObject);
 
-            LOG.debug("API {} returned status {}", resource.getURI(), clientResponse.getStatus());
+            if (LOG.isDebugEnabled()) {
+                LOG.debug("API {} returned status {}", resource.getURI(), clientResponse.getStatus());
+            }
+
             if (clientResponse.getStatus() == api.getExpectedStatus().getStatusCode()) {
                 if (null == responseType) {
                     LOG.warn("No response type specified, returning null");
@@ -291,12 +298,16 @@ public abstract class AtlasBaseClient {
                     if (responseType == JSONObject.class) {
                         String stringEntity = clientResponse.getEntity(String.class);
                         try {
-                            return (T) new JSONObject(stringEntity);
+                            JSONObject jsonObject = new JSONObject(stringEntity);
+                            LOG.info("Response = {}", jsonObject);
+                            return (T) jsonObject;
                         } catch (JSONException e) {
                             throw new AtlasServiceException(api, e);
                         }
                     } else {
-                        return clientResponse.getEntity(responseType);
+                        T entity = clientResponse.getEntity(responseType);
+                        LOG.info("Response = {}", AtlasType.toJson(entity));
+                        return entity;
                     }
                 } catch (ClientHandlerException e) {
                     throw new AtlasServiceException(api, e);
@@ -380,8 +391,7 @@ public abstract class AtlasBaseClient {
             WebResource resource = resourceCreator.createResource();
             try {
                 LOG.debug("Using resource {} for {} times", resource.getURI(), i);
-                JSONObject result = callAPIWithResource(api, resource, requestObject, JSONObject.class);
-                return result;
+                return callAPIWithResource(api, resource, requestObject, JSONObject.class);
             } catch (ClientHandlerException che) {
                 if (i == (getNumberOfRetries() - 1)) {
                     throw che;
@@ -399,6 +409,12 @@ public abstract class AtlasBaseClient {
         return callAPIWithResource(api, getResource(api, params), requestObject, responseType);
     }
 
+    public <T> T callAPI(APIInfo api, Object requestBody, Class<T> responseType,
+                         MultivaluedMap<String, String> queryParams, String... params) throws AtlasServiceException {
+        WebResource resource = getResource(api, queryParams, params);
+        return callAPIWithResource(api, resource, requestBody, responseType);
+    }
+
     public <T> T callAPI(APIInfo api, Class<T> responseType, MultivaluedMap<String, String> queryParams, String... params)
             throws AtlasServiceException {
         WebResource resource = getResource(api, queryParams, params);
@@ -476,7 +492,7 @@ public abstract class AtlasBaseClient {
         return resource;
     }
 
-    protected APIInfo formatPath(APIInfo apiInfo, String ... params) {
+    protected APIInfo formatPathForPathParams(APIInfo apiInfo, String ... params) {
         return new APIInfo(String.format(apiInfo.getPath(), params), apiInfo.getMethod(), apiInfo.getExpectedStatus());
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/ec1b160a/client/src/main/java/org/apache/atlas/AtlasClient.java
----------------------------------------------------------------------
diff --git a/client/src/main/java/org/apache/atlas/AtlasClient.java b/client/src/main/java/org/apache/atlas/AtlasClient.java
index 47231a8..154644d 100755
--- a/client/src/main/java/org/apache/atlas/AtlasClient.java
+++ b/client/src/main/java/org/apache/atlas/AtlasClient.java
@@ -108,7 +108,8 @@ public class AtlasClient extends AtlasBaseClient {
     public static final String PROCESS_ATTRIBUTE_OUTPUTS = "outputs";
 
     public static final String REFERENCEABLE_SUPER_TYPE = "Referenceable";
-    public static final String REFERENCEABLE_ATTRIBUTE_NAME = "qualifiedName";
+    public static final String QUALIFIED_NAME = "qualifiedName";
+    public static final String REFERENCEABLE_ATTRIBUTE_NAME = QUALIFIED_NAME;
 
     public static final String UNKNOWN_STATUS = "Unknown status";
 
@@ -593,7 +594,7 @@ public class AtlasClient extends AtlasBaseClient {
         JSONObject response = callAPIWithRetries(api, entityJson, new ResourceCreator() {
             @Override
             public WebResource createResource() {
-                WebResource resource = getResource(api, "qualifiedName");
+                WebResource resource = getResource(api, QUALIFIED_NAME);
                 resource = resource.queryParam(TYPE, entityType);
                 resource = resource.queryParam(ATTRIBUTE_NAME, uniqueAttributeName);
                 resource = resource.queryParam(ATTRIBUTE_VALUE, uniqueAttributeValue);

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/ec1b160a/client/src/main/java/org/apache/atlas/AtlasEntitiesClientV2.java
----------------------------------------------------------------------
diff --git a/client/src/main/java/org/apache/atlas/AtlasEntitiesClientV2.java b/client/src/main/java/org/apache/atlas/AtlasEntitiesClientV2.java
index 16556c8..8d1bfa7 100644
--- a/client/src/main/java/org/apache/atlas/AtlasEntitiesClientV2.java
+++ b/client/src/main/java/org/apache/atlas/AtlasEntitiesClientV2.java
@@ -18,21 +18,23 @@
 package org.apache.atlas;
 
 import com.google.common.annotations.VisibleForTesting;
-
 import com.sun.jersey.api.client.WebResource;
-
+import com.sun.jersey.core.util.MultivaluedMapImpl;
 import org.apache.atlas.model.SearchFilter;
 import org.apache.atlas.model.instance.AtlasClassification;
 import org.apache.atlas.model.instance.AtlasClassification.AtlasClassifications;
 import org.apache.atlas.model.instance.AtlasEntity;
+import org.apache.atlas.model.instance.AtlasEntityWithAssociations;
 import org.apache.atlas.model.instance.EntityMutationResponse;
 import org.apache.commons.configuration.Configuration;
 import org.apache.hadoop.security.UserGroupInformation;
 
-import java.util.List;
-
 import javax.ws.rs.HttpMethod;
+import javax.ws.rs.core.MultivaluedMap;
 import javax.ws.rs.core.Response;
+import java.util.List;
+
+import static org.apache.atlas.model.instance.AtlasEntity.AtlasEntities;
 
 public class AtlasEntitiesClientV2 extends AtlasBaseClient {
 
@@ -40,19 +42,24 @@ public class AtlasEntitiesClientV2 extends AtlasBaseClient {
     public static final String ENTITIES_API = BASE_URI + "v2/entities/";
 
     private static final APIInfo GET_ENTITY_BY_GUID = new APIInfo(ENTITY_API + "guid/", HttpMethod.GET, Response.Status.OK);
+    private static final APIInfo GET_ENTITY_WITH_ASSOCIATION_BY_GUID = new APIInfo(ENTITY_API + "guid/%s/associations", HttpMethod.GET, Response.Status.OK);
     private static final APIInfo CREATE_ENTITY = new APIInfo(ENTITY_API, HttpMethod.POST, Response.Status.OK);
     private static final APIInfo UPDATE_ENTITY = CREATE_ENTITY;
+    private static final APIInfo GET_ENTITY_BY_ATTRIBUTE = new APIInfo(ENTITY_API + "uniqueAttribute/type/%s/attribute/%s", HttpMethod.GET, Response.Status.OK);
+    private static final APIInfo UPDATE_ENTITY_BY_ATTRIBUTE = new APIInfo(ENTITY_API + "uniqueAttribute/type/%s/attribute/%s", HttpMethod.PUT, Response.Status.OK);
+    private static final APIInfo DELETE_ENTITY_BY_ATTRIBUTE = new APIInfo(ENTITY_API + "uniqueAttribute/type/%s/attribute/%s", HttpMethod.DELETE, Response.Status.OK);
     private static final APIInfo UPDATE_ENTITY_BY_GUID = new APIInfo(ENTITY_API + "guid/", HttpMethod.PUT, Response.Status.OK);
     private static final APIInfo DELETE_ENTITY_BY_GUID = new APIInfo(ENTITY_API + "guid/", HttpMethod.DELETE, Response.Status.OK);
+    private static final APIInfo DELETE_ENTITY_BY_GUIDS = new APIInfo(ENTITIES_API + "guids/", HttpMethod.DELETE, Response.Status.OK);
     private static final APIInfo GET_CLASSIFICATIONS = new APIInfo(ENTITY_API + "guid/%s/classifications", HttpMethod.GET, Response.Status.OK);
-    private static final APIInfo ADD_CLASSIFICATIONS = new APIInfo(ENTITY_API + "guid/%s/classifications", HttpMethod.POST, Response.Status.OK);
-    private static final APIInfo UPDATE_CLASSIFICATIONS = new APIInfo(ENTITY_API + "guid/%s/classifications", HttpMethod.PUT, Response.Status.OK);
-    private static final APIInfo DELETE_CLASSIFICATION = new APIInfo(ENTITY_API + "guid/%s/classification/%s", HttpMethod.DELETE, Response.Status.OK);
+    private static final APIInfo ADD_CLASSIFICATIONS = new APIInfo(ENTITY_API + "guid/%s/classifications", HttpMethod.POST, Response.Status.NO_CONTENT);
 
+    private static final APIInfo UPDATE_CLASSIFICATIONS = new APIInfo(ENTITY_API + "guid/%s/classifications", HttpMethod.PUT, Response.Status.OK);
+    private static final APIInfo DELETE_CLASSIFICATION = new APIInfo(ENTITY_API + "guid/%s/classification/%s", HttpMethod.DELETE, Response.Status.NO_CONTENT);
     private static final APIInfo GET_ENTITIES = new APIInfo(ENTITIES_API + "guids/", HttpMethod.GET, Response.Status.OK);
     private static final APIInfo CREATE_ENTITIES = new APIInfo(ENTITIES_API, HttpMethod.POST, Response.Status.OK);
     private static final APIInfo UPDATE_ENTITIES = CREATE_ENTITIES;
-    private static final APIInfo DELETE_ENTITIES = new APIInfo(ENTITIES_API + "guids/", HttpMethod.GET, Response.Status.OK);
+    private static final APIInfo DELETE_ENTITIES = new APIInfo(ENTITIES_API + "guids/", HttpMethod.GET, Response.Status.NO_CONTENT);
     private static final APIInfo SEARCH_ENTITIES = new APIInfo(ENTITIES_API, HttpMethod.GET, Response.Status.OK);
 
     public AtlasEntitiesClientV2(String[] baseUrl, String[] basicAuthUserNamePassword) {
@@ -80,6 +87,32 @@ public class AtlasEntitiesClientV2 extends AtlasBaseClient {
         return callAPI(GET_ENTITY_BY_GUID, null, AtlasEntity.class, guid);
     }
 
+    public AtlasEntities getEntityByGuids(List<String> guids) throws AtlasServiceException {
+        return callAPI(GET_ENTITY_BY_GUID, AtlasEntities.class, "guid", guids);
+    }
+
+    public AtlasEntityWithAssociations getEntityWithAssociationByGuid(String guid) throws AtlasServiceException {
+        return callAPI(formatPathForPathParams(GET_ENTITY_WITH_ASSOCIATION_BY_GUID, guid), null, AtlasEntityWithAssociations.class);
+    }
+
+    public AtlasEntity getEntityByAttribute(String type, String attribute, String value) throws AtlasServiceException {
+        MultivaluedMap<String, String> queryParams = new MultivaluedMapImpl();
+        queryParams.add("value", value);
+        return callAPI(formatPathForPathParams(GET_ENTITY_BY_ATTRIBUTE, type, attribute), AtlasEntity.class, queryParams);
+    }
+
+    public EntityMutationResponse updateEntityByAttribute(String type, String attribute, String value, AtlasEntity entity) throws AtlasServiceException {
+        MultivaluedMap<String, String> queryParams = new MultivaluedMapImpl();
+        queryParams.add("value", value);
+        return callAPI(formatPathForPathParams(UPDATE_ENTITY_BY_ATTRIBUTE, type, attribute), entity, EntityMutationResponse.class, queryParams);
+    }
+
+    public EntityMutationResponse deleteEntityByAttribute(String type, String attribute, String value) throws AtlasServiceException {
+        MultivaluedMap<String, String> queryParams = new MultivaluedMapImpl();
+        queryParams.add("value", value);
+        return callAPI(formatPathForPathParams(DELETE_ENTITY_BY_ATTRIBUTE, type, attribute), null, EntityMutationResponse.class, queryParams);
+    }
+
     public EntityMutationResponse createEntity(AtlasEntity atlasEntity) throws AtlasServiceException {
         return callAPI(CREATE_ENTITY, atlasEntity, EntityMutationResponse.class);
     }
@@ -89,31 +122,35 @@ public class AtlasEntitiesClientV2 extends AtlasBaseClient {
     }
 
     public EntityMutationResponse updateEntity(String guid, AtlasEntity atlasEntity) throws AtlasServiceException {
-        return callAPI(UPDATE_ENTITY, atlasEntity, EntityMutationResponse.class, guid);
+        return callAPI(UPDATE_ENTITY_BY_GUID, atlasEntity, EntityMutationResponse.class, guid);
     }
 
     public AtlasEntity deleteEntityByGuid(String guid) throws AtlasServiceException {
         return callAPI(DELETE_ENTITY_BY_GUID, null, AtlasEntity.class, guid);
     }
 
+    public EntityMutationResponse deleteEntityByGuid(List<String> guids) throws AtlasServiceException {
+        return callAPI(DELETE_ENTITY_BY_GUIDS, EntityMutationResponse.class, "guid", guids);
+    }
+
     public AtlasClassifications getClassifications(String guid) throws AtlasServiceException {
-        return callAPI(formatPath(GET_CLASSIFICATIONS, guid), null, AtlasClassifications.class);
+        return callAPI(formatPathForPathParams(GET_CLASSIFICATIONS, guid), null, AtlasClassifications.class);
     }
 
     public void addClassifications(String guid, List<AtlasClassification> classifications) throws AtlasServiceException {
-        callAPI(formatPath(ADD_CLASSIFICATIONS, guid), classifications, AtlasClassifications.class);
+        callAPI(formatPathForPathParams(ADD_CLASSIFICATIONS, guid), classifications, null, (String[]) null);
     }
 
     public void updateClassifications(String guid, List<AtlasClassification> classifications) throws AtlasServiceException {
-        callAPI(formatPath(UPDATE_CLASSIFICATIONS, guid), classifications, AtlasClassifications.class);
+        callAPI(formatPathForPathParams(UPDATE_CLASSIFICATIONS, guid), classifications, AtlasClassifications.class);
     }
 
     public void deleteClassifications(String guid, List<AtlasClassification> classifications) throws AtlasServiceException {
-        callAPI(formatPath(GET_CLASSIFICATIONS, guid), classifications, AtlasClassifications.class);
+        callAPI(formatPathForPathParams(GET_CLASSIFICATIONS, guid), classifications, AtlasClassifications.class);
     }
 
     public void deleteClassification(String guid, String classificationName) throws AtlasServiceException {
-        callAPI(formatPath(DELETE_CLASSIFICATION, guid, classificationName), null, AtlasClassifications.class);
+        callAPI(formatPathForPathParams(DELETE_CLASSIFICATION, guid, classificationName), null, null);
     }
 
     // Entities operations

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/ec1b160a/client/src/main/java/org/apache/atlas/AtlasServiceException.java
----------------------------------------------------------------------
diff --git a/client/src/main/java/org/apache/atlas/AtlasServiceException.java b/client/src/main/java/org/apache/atlas/AtlasServiceException.java
index 4719e7c..b128f98 100755
--- a/client/src/main/java/org/apache/atlas/AtlasServiceException.java
+++ b/client/src/main/java/org/apache/atlas/AtlasServiceException.java
@@ -32,7 +32,7 @@ public class AtlasServiceException extends Exception {
     }
 
     public AtlasServiceException(AtlasBaseClient.APIInfo api, Exception e) {
-        super("Metadata service API " + api + " failed", e);
+        super("Metadata service API " + api.getMethod() + " : " + api.getPath() + " failed", e);
     }
 
     public AtlasServiceException(AtlasClient.API api, WebApplicationException e) throws JSONException {

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/ec1b160a/client/src/main/java/org/apache/atlas/AtlasTypedefClientV2.java
----------------------------------------------------------------------
diff --git a/client/src/main/java/org/apache/atlas/AtlasTypedefClientV2.java b/client/src/main/java/org/apache/atlas/AtlasTypedefClientV2.java
index a193524..0ce811b 100644
--- a/client/src/main/java/org/apache/atlas/AtlasTypedefClientV2.java
+++ b/client/src/main/java/org/apache/atlas/AtlasTypedefClientV2.java
@@ -37,10 +37,19 @@ import javax.ws.rs.core.Response;
 public class AtlasTypedefClientV2 extends AtlasBaseClient {
 
     private static final String BASE_URI = "api/atlas/v2/types/";
+    private static final String ENUMDEF_URI = BASE_URI + "enumdef/";
+    private static final String STRUCTDEF_URI = BASE_URI + "structdef/";
+    private static final String ENTITYDEF_URI = BASE_URI + "entitydef/";
+    private static final String CLASSIFICATIONDEF_URI = BASE_URI + "classificationdef/";
     private static final String TYPEDEFS_PATH = BASE_URI + "typedefs/";
     private static final String GET_BY_NAME_TEMPLATE = BASE_URI + "%s/name/%s";
     private static final String GET_BY_GUID_TEMPLATE = BASE_URI + "%s/guid/%s";
 
+    private static final APIInfo CREATE_ENUM_DEF = new APIInfo(ENUMDEF_URI, HttpMethod.POST, Response.Status.OK);
+    private static final APIInfo CREATE_STRUCT_DEF = new APIInfo(STRUCTDEF_URI, HttpMethod.POST, Response.Status.OK);
+    private static final APIInfo CREATE_ENTITY_DEF = new APIInfo(ENTITYDEF_URI, HttpMethod.POST, Response.Status.OK);
+    private static final APIInfo CREATE_CLASSIFICATION_DEF = new APIInfo(CLASSIFICATIONDEF_URI, HttpMethod.POST, Response.Status.OK);
+
     private static final APIInfo GET_ALL_TYPE_DEFS = new APIInfo(TYPEDEFS_PATH, HttpMethod.GET, Response.Status.OK);
     private static final APIInfo CREATE_ALL_TYPE_DEFS = new APIInfo(TYPEDEFS_PATH, HttpMethod.POST, Response.Status.OK);
     private static final APIInfo UPDATE_ALL_TYPE_DEFS = new APIInfo(TYPEDEFS_PATH, HttpMethod.PUT, Response.Status.OK);
@@ -108,6 +117,24 @@ public class AtlasTypedefClientV2 extends AtlasBaseClient {
         return getTypeDefByGuid(guid, AtlasEntityDef.class);
     }
 
+    public AtlasEnumDef createEnumDef(AtlasEnumDef enumDef) throws AtlasServiceException {
+        return callAPI(CREATE_ENUM_DEF, AtlasType.toJson(enumDef), AtlasEnumDef.class);
+    }
+
+    public AtlasStructDef createStructDef(AtlasStructDef structDef) throws AtlasServiceException {
+        return callAPI(CREATE_STRUCT_DEF, AtlasType.toJson(structDef), AtlasStructDef.class);
+    }
+
+    public AtlasEntityDef createEntityDef(AtlasEntityDef entityDef) throws AtlasServiceException {
+        return callAPI(CREATE_ENTITY_DEF, AtlasType.toJson(entityDef), AtlasEntityDef.class);
+    }
+
+    public AtlasClassificationDef createClassificationDef(AtlasClassificationDef classificationDef)
+            throws AtlasServiceException {
+        return callAPI(CREATE_CLASSIFICATION_DEF, AtlasType.toJson(classificationDef), AtlasClassificationDef.class);
+    }
+
+
     /**
      * Bulk create APIs for all atlas type definitions, only new definitions will be created.
      * Any changes to the existing definitions will be discarded

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/ec1b160a/intg/src/main/java/org/apache/atlas/model/SearchFilter.java
----------------------------------------------------------------------
diff --git a/intg/src/main/java/org/apache/atlas/model/SearchFilter.java b/intg/src/main/java/org/apache/atlas/model/SearchFilter.java
index 4d8b258..7dccf5e 100644
--- a/intg/src/main/java/org/apache/atlas/model/SearchFilter.java
+++ b/intg/src/main/java/org/apache/atlas/model/SearchFilter.java
@@ -103,6 +103,15 @@ public class SearchFilter {
         }
     }
 
+    public void setParam(String name, List<String> values) {
+        if (name != null) {
+            if (params == null) {
+                params = new MultivaluedMapImpl();
+            }
+            params.put(name, values);
+        }
+    }
+
     public long getStartIndex() {
         return startIndex;
     }

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/ec1b160a/intg/src/main/java/org/apache/atlas/model/instance/EntityMutationResponse.java
----------------------------------------------------------------------
diff --git a/intg/src/main/java/org/apache/atlas/model/instance/EntityMutationResponse.java b/intg/src/main/java/org/apache/atlas/model/instance/EntityMutationResponse.java
index 35f2f14..8aba1fb 100644
--- a/intg/src/main/java/org/apache/atlas/model/instance/EntityMutationResponse.java
+++ b/intg/src/main/java/org/apache/atlas/model/instance/EntityMutationResponse.java
@@ -18,7 +18,6 @@
 package org.apache.atlas.model.instance;
 
 
-import org.apache.atlas.model.instance.AtlasEntityHeader;
 import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.collections.MapUtils;
 import org.codehaus.jackson.annotate.JsonAutoDetect;

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/ec1b160a/repository/src/main/java/org/apache/atlas/repository/graph/GraphToTypedInstanceMapper.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/repository/graph/GraphToTypedInstanceMapper.java b/repository/src/main/java/org/apache/atlas/repository/graph/GraphToTypedInstanceMapper.java
index 1a3c31c..f7b1ff0 100644
--- a/repository/src/main/java/org/apache/atlas/repository/graph/GraphToTypedInstanceMapper.java
+++ b/repository/src/main/java/org/apache/atlas/repository/graph/GraphToTypedInstanceMapper.java
@@ -82,7 +82,7 @@ public final class GraphToTypedInstanceMapper {
 
         LOG.debug("Found createdBy : {} modifiedBy : {} createdTime: {} modifedTime: {}", createdBy, modifiedBy, createdTime, modifiedTime);
 
-        Id id = new Id(guid, (Integer) GraphHelper.getProperty(instanceVertex, Constants.VERSION_PROPERTY_KEY),
+        Id id = new Id(guid, Integer.parseInt(String.valueOf(GraphHelper.getProperty(instanceVertex, Constants.VERSION_PROPERTY_KEY))),
                 typeName, state);
         LOG.debug("Created id {} for instance type {}", id, typeName);
 

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/ec1b160a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityStoreV1.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityStoreV1.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityStoreV1.java
index 6b2b216..e731c11 100644
--- a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityStoreV1.java
+++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityStoreV1.java
@@ -117,6 +117,7 @@ public class AtlasEntityStoreV1 implements AtlasEntityStore {
 
     @Override
     public AtlasEntity.AtlasEntities searchEntities(final SearchFilter searchFilter) throws AtlasBaseException {
+        // TODO: Add checks here to ensure that typename and supertype are mandatory in the requests
         return null;
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/ec1b160a/webapp/src/main/java/org/apache/atlas/util/RestUtils.java
----------------------------------------------------------------------
diff --git a/webapp/src/main/java/org/apache/atlas/util/RestUtils.java b/webapp/src/main/java/org/apache/atlas/util/RestUtils.java
index 7597dcb..5e69262 100644
--- a/webapp/src/main/java/org/apache/atlas/util/RestUtils.java
+++ b/webapp/src/main/java/org/apache/atlas/util/RestUtils.java
@@ -22,15 +22,14 @@ import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableSet;
 import org.apache.atlas.exception.AtlasBaseException;
 import org.apache.atlas.model.TypeCategory;
-import org.apache.atlas.model.instance.AtlasEntity;
 import org.apache.atlas.model.typedef.AtlasClassificationDef;
 import org.apache.atlas.model.typedef.AtlasEntityDef;
 import org.apache.atlas.model.typedef.AtlasEnumDef;
 import org.apache.atlas.model.typedef.AtlasEnumDef.AtlasEnumElementDef;
 import org.apache.atlas.model.typedef.AtlasStructDef;
-import org.apache.atlas.model.typedef.AtlasStructDef.AtlasConstraintDef;
 import org.apache.atlas.model.typedef.AtlasStructDef.AtlasAttributeDef;
 import org.apache.atlas.model.typedef.AtlasStructDef.AtlasAttributeDef.Cardinality;
+import org.apache.atlas.model.typedef.AtlasStructDef.AtlasConstraintDef;
 import org.apache.atlas.model.typedef.AtlasTypeDefHeader;
 import org.apache.atlas.model.typedef.AtlasTypesDef;
 import org.apache.atlas.type.AtlasArrayType;
@@ -63,9 +62,9 @@ import java.util.Set;
 
 import static org.apache.atlas.AtlasErrorCode.INVALID_TYPE_DEFINITION;
 import static org.apache.atlas.model.typedef.AtlasStructDef.AtlasConstraintDef.CONSTRAINT_PARAM_ON_DELETE;
+import static org.apache.atlas.model.typedef.AtlasStructDef.AtlasConstraintDef.CONSTRAINT_PARAM_VAL_CASCADE;
 import static org.apache.atlas.model.typedef.AtlasStructDef.AtlasConstraintDef.CONSTRAINT_TYPE_FOREIGN_KEY;
 import static org.apache.atlas.model.typedef.AtlasStructDef.AtlasConstraintDef.CONSTRAINT_TYPE_MAPPED_FROM_REF;
-import static org.apache.atlas.model.typedef.AtlasStructDef.AtlasConstraintDef.CONSTRAINT_PARAM_VAL_CASCADE;
 import static org.apache.atlas.type.AtlasTypeUtil.isArrayType;
 
 

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/ec1b160a/webapp/src/main/java/org/apache/atlas/web/adapters/AtlasInstanceRestAdapters.java
----------------------------------------------------------------------
diff --git a/webapp/src/main/java/org/apache/atlas/web/adapters/AtlasInstanceRestAdapters.java b/webapp/src/main/java/org/apache/atlas/web/adapters/AtlasInstanceRestAdapters.java
index 5756adb..ad16be7 100644
--- a/webapp/src/main/java/org/apache/atlas/web/adapters/AtlasInstanceRestAdapters.java
+++ b/webapp/src/main/java/org/apache/atlas/web/adapters/AtlasInstanceRestAdapters.java
@@ -40,6 +40,7 @@ import org.apache.atlas.typesystem.ITypedStruct;
 import org.apache.atlas.typesystem.Referenceable;
 import org.apache.atlas.typesystem.Struct;
 import org.apache.atlas.typesystem.exception.EntityNotFoundException;
+import org.apache.atlas.typesystem.exception.TraitNotFoundException;
 import org.apache.atlas.typesystem.exception.TypeNotFoundException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -143,7 +144,7 @@ public class AtlasInstanceRestAdapters {
     }
 
     public static AtlasBaseException toAtlasBaseException(AtlasException e) {
-        if ( e instanceof EntityNotFoundException) {
+        if ( e instanceof EntityNotFoundException || e instanceof TraitNotFoundException) {
             return new AtlasBaseException(AtlasErrorCode.INSTANCE_GUID_NOT_FOUND, e);
         }
 

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/ec1b160a/webapp/src/main/java/org/apache/atlas/web/resources/BaseService.java
----------------------------------------------------------------------
diff --git a/webapp/src/main/java/org/apache/atlas/web/resources/BaseService.java b/webapp/src/main/java/org/apache/atlas/web/resources/BaseService.java
index dfd29b1..fb77b11 100644
--- a/webapp/src/main/java/org/apache/atlas/web/resources/BaseService.java
+++ b/webapp/src/main/java/org/apache/atlas/web/resources/BaseService.java
@@ -18,15 +18,8 @@
 
 package org.apache.atlas.web.resources;
 
-import java.io.UnsupportedEncodingException;
-import java.net.URLDecoder;
-import java.util.Collection;
-import java.util.Map;
-
-import javax.ws.rs.core.Context;
-import javax.ws.rs.core.UriInfo;
-import javax.xml.bind.annotation.XmlRootElement;
-
+import com.google.gson.Gson;
+import com.google.gson.JsonSyntaxException;
 import org.apache.atlas.catalog.JsonSerializer;
 import org.apache.atlas.catalog.Request;
 import org.apache.atlas.catalog.ResourceProvider;
@@ -40,8 +33,13 @@ import org.apache.atlas.repository.graph.AtlasGraphProvider;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import com.google.gson.Gson;
-import com.google.gson.JsonSyntaxException;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.UriInfo;
+import javax.xml.bind.annotation.XmlRootElement;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import java.util.Collection;
+import java.util.Map;
 
 /**
  * Base class for all v1 API services.

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/ec1b160a/webapp/src/main/java/org/apache/atlas/web/resources/EntityResource.java
----------------------------------------------------------------------
diff --git a/webapp/src/main/java/org/apache/atlas/web/resources/EntityResource.java b/webapp/src/main/java/org/apache/atlas/web/resources/EntityResource.java
index 8a663c2..4a57ed2 100755
--- a/webapp/src/main/java/org/apache/atlas/web/resources/EntityResource.java
+++ b/webapp/src/main/java/org/apache/atlas/web/resources/EntityResource.java
@@ -47,17 +47,7 @@ import org.slf4j.LoggerFactory;
 import javax.inject.Inject;
 import javax.inject.Singleton;
 import javax.servlet.http.HttpServletRequest;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.DELETE;
-import javax.ws.rs.DefaultValue;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.PUT;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.QueryParam;
-import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.*;
 import javax.ws.rs.core.Context;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/ec1b160a/webapp/src/main/java/org/apache/atlas/web/resources/EntityService.java
----------------------------------------------------------------------
diff --git a/webapp/src/main/java/org/apache/atlas/web/resources/EntityService.java b/webapp/src/main/java/org/apache/atlas/web/resources/EntityService.java
index ac4f9f1..e3c9e1b 100644
--- a/webapp/src/main/java/org/apache/atlas/web/resources/EntityService.java
+++ b/webapp/src/main/java/org/apache/atlas/web/resources/EntityService.java
@@ -19,7 +19,13 @@
 package org.apache.atlas.web.resources;
 
 import org.apache.atlas.AtlasException;
-import org.apache.atlas.catalog.*;
+import org.apache.atlas.catalog.BaseRequest;
+import org.apache.atlas.catalog.CollectionRequest;
+import org.apache.atlas.catalog.DefaultTypeSystem;
+import org.apache.atlas.catalog.EntityResourceProvider;
+import org.apache.atlas.catalog.EntityTagResourceProvider;
+import org.apache.atlas.catalog.InstanceRequest;
+import org.apache.atlas.catalog.Result;
 import org.apache.atlas.catalog.exception.CatalogException;
 import org.apache.atlas.services.MetadataService;
 import org.apache.atlas.utils.AtlasPerfTracer;
@@ -28,9 +34,22 @@ import org.slf4j.Logger;
 
 import javax.inject.Inject;
 import javax.inject.Singleton;
-import javax.ws.rs.*;
-import javax.ws.rs.core.*;
-import java.util.*;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.GenericEntity;
+import javax.ws.rs.core.HttpHeaders;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriInfo;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
 
 /**
  * Service which handles API requests for v1 entity resources.

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/ec1b160a/webapp/src/main/java/org/apache/atlas/web/resources/TaxonomyService.java
----------------------------------------------------------------------
diff --git a/webapp/src/main/java/org/apache/atlas/web/resources/TaxonomyService.java b/webapp/src/main/java/org/apache/atlas/web/resources/TaxonomyService.java
index cc98207..13b0250 100644
--- a/webapp/src/main/java/org/apache/atlas/web/resources/TaxonomyService.java
+++ b/webapp/src/main/java/org/apache/atlas/web/resources/TaxonomyService.java
@@ -20,7 +20,6 @@ package org.apache.atlas.web.resources;
 
 import org.apache.atlas.AtlasException;
 import org.apache.atlas.catalog.*;
-import org.apache.atlas.catalog.Request;
 import org.apache.atlas.catalog.exception.CatalogException;
 import org.apache.atlas.catalog.exception.InvalidPayloadException;
 import org.apache.atlas.services.MetadataService;
@@ -30,8 +29,18 @@ import org.slf4j.Logger;
 
 import javax.inject.Inject;
 import javax.inject.Singleton;
-import javax.ws.rs.*;
-import javax.ws.rs.core.*;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.HttpHeaders;
+import javax.ws.rs.core.PathSegment;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriInfo;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/ec1b160a/webapp/src/main/java/org/apache/atlas/web/rest/EntitiesREST.java
----------------------------------------------------------------------
diff --git a/webapp/src/main/java/org/apache/atlas/web/rest/EntitiesREST.java b/webapp/src/main/java/org/apache/atlas/web/rest/EntitiesREST.java
index 768ef12..b770143 100644
--- a/webapp/src/main/java/org/apache/atlas/web/rest/EntitiesREST.java
+++ b/webapp/src/main/java/org/apache/atlas/web/rest/EntitiesREST.java
@@ -17,30 +17,24 @@
  */
 package org.apache.atlas.web.rest;
 
-import com.google.inject.Inject;
 import org.apache.atlas.AtlasClient;
 import org.apache.atlas.AtlasErrorCode;
 import org.apache.atlas.AtlasException;
 import org.apache.atlas.exception.AtlasBaseException;
+import org.apache.atlas.model.SearchFilter;
 import org.apache.atlas.model.instance.AtlasEntity;
 import org.apache.atlas.model.instance.AtlasEntityHeader;
-import org.apache.atlas.model.instance.AtlasEntityWithAssociations;
 import org.apache.atlas.model.instance.EntityMutationResponse;
 import org.apache.atlas.repository.store.graph.AtlasEntityStore;
 import org.apache.atlas.services.MetadataService;
-import org.apache.atlas.type.AtlasTypeRegistry;
 import org.apache.atlas.typesystem.ITypedReferenceableInstance;
-import org.apache.atlas.web.adapters.AtlasFormatConverters;
 import org.apache.atlas.web.adapters.AtlasInstanceRestAdapters;
 import org.apache.atlas.web.util.Servlets;
 import org.apache.commons.collections.CollectionUtils;
-import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import static org.apache.atlas.web.adapters.AtlasInstanceRestAdapters.toAtlasBaseException;
-import static org.apache.atlas.web.adapters.AtlasInstanceRestAdapters.toEntityMutationResponse;
-
+import javax.inject.Inject;
 import javax.inject.Singleton;
 import javax.servlet.http.HttpServletRequest;
 import javax.ws.rs.Consumes;
@@ -53,8 +47,13 @@ import javax.ws.rs.Produces;
 import javax.ws.rs.QueryParam;
 import javax.ws.rs.core.Context;
 import java.util.ArrayList;
-import java.util.Collections;
+import java.util.Arrays;
+import java.util.LinkedList;
 import java.util.List;
+import java.util.Map;
+
+import static org.apache.atlas.web.adapters.AtlasInstanceRestAdapters.toAtlasBaseException;
+import static org.apache.atlas.web.adapters.AtlasInstanceRestAdapters.toEntityMutationResponse;
 
 
 @Path("v2/entities")
@@ -67,19 +66,16 @@ public class EntitiesREST {
     @Context
     private HttpServletRequest httpServletRequest;
 
-    @Inject
-    private MetadataService metadataService;
-
-    private AtlasTypeRegistry typeRegistry;
+    private final MetadataService metadataService;
 
-    @Inject
-    AtlasInstanceRestAdapters restAdapters;
+    private final AtlasInstanceRestAdapters restAdapters;
 
     @Inject
-    public EntitiesREST(AtlasEntityStore entitiesStore, AtlasTypeRegistry atlasTypeRegistry) {
+    public EntitiesREST(AtlasEntityStore entitiesStore, MetadataService metadataService, AtlasInstanceRestAdapters restAdapters) {
         LOG.info("EntitiesRest Init");
         this.entitiesStore = entitiesStore;
-        this.typeRegistry = atlasTypeRegistry;
+        this.metadataService = metadataService;
+        this.restAdapters = restAdapters;
     }
 
     /*******
@@ -174,9 +170,24 @@ public class EntitiesREST {
     @GET
     @Produces(Servlets.JSON_MEDIA_TYPE)
     public AtlasEntityHeader.AtlasEntityHeaders searchEntities() throws AtlasBaseException {
-        //SearchFilter searchFilter
-        //TODO: Need to handle getEntitiesByType for older API
-        return null;
+        SearchFilter searchFilter = getSearchFilter();
+        AtlasEntity.AtlasEntities atlasEntities = entitiesStore.searchEntities(searchFilter);
+        AtlasEntityHeader.AtlasEntityHeaders entityHeaders = new AtlasEntityHeader.AtlasEntityHeaders();
+        entityHeaders.setList(new LinkedList<AtlasEntityHeader>());
+        for (AtlasEntity atlasEntity : atlasEntities.getList()) {
+            entityHeaders.getList().add(new AtlasEntityHeader(atlasEntity.getTypeName(), atlasEntity.getAttributes()));
+        }
+        return entityHeaders;
+    }
+
+    private SearchFilter getSearchFilter() {
+        SearchFilter searchFilter = new SearchFilter();
+        if (null != httpServletRequest && null != httpServletRequest.getParameterMap()) {
+            for (Map.Entry<String, String[]> entry : httpServletRequest.getParameterMap().entrySet()) {
+                searchFilter.setParam(entry.getKey(), Arrays.asList(entry.getValue()));
+            }
+        }
+        return searchFilter;
     }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/ec1b160a/webapp/src/main/java/org/apache/atlas/web/rest/EntityREST.java
----------------------------------------------------------------------
diff --git a/webapp/src/main/java/org/apache/atlas/web/rest/EntityREST.java b/webapp/src/main/java/org/apache/atlas/web/rest/EntityREST.java
index 2529f0d..ee1174a 100644
--- a/webapp/src/main/java/org/apache/atlas/web/rest/EntityREST.java
+++ b/webapp/src/main/java/org/apache/atlas/web/rest/EntityREST.java
@@ -17,7 +17,6 @@
  */
 package org.apache.atlas.web.rest;
 
-import com.google.inject.Inject;
 import org.apache.atlas.AtlasClient;
 import org.apache.atlas.AtlasErrorCode;
 import org.apache.atlas.AtlasException;
@@ -42,17 +41,9 @@ import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import javax.inject.Inject;
 import javax.inject.Singleton;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.DELETE;
-import javax.ws.rs.DefaultValue;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.PUT;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.QueryParam;
+import javax.ws.rs.*;
 import javax.ws.rs.core.MediaType;
 import java.util.ArrayList;
 import java.util.List;
@@ -69,14 +60,19 @@ public class EntityREST {
 
     private static final Logger LOG = LoggerFactory.getLogger(EntityREST.class);
 
-    @Inject
-    AtlasTypeRegistry typeRegistry;
+    private final AtlasTypeRegistry typeRegistry;
 
-    @Inject
-    AtlasInstanceRestAdapters restAdapters;
+    private final AtlasInstanceRestAdapters restAdapters;
+
+    private final MetadataService metadataService;
 
     @Inject
-    private MetadataService metadataService;
+    public EntityREST(AtlasTypeRegistry typeRegistry, AtlasInstanceRestAdapters restAdapters, MetadataService metadataService) {
+        this.typeRegistry = typeRegistry;
+        this.restAdapters = restAdapters;
+        this.metadataService = metadataService;
+    }
+
     /**
      * Create or Update an entity if it  already exists
      *
@@ -323,6 +319,8 @@ public class EntityREST {
             final ITypedStruct trait = restAdapters.getTrait(classification);
             try {
                 metadataService.addTrait(guid, trait);
+            } catch (IllegalArgumentException e) {
+                throw new AtlasBaseException(AtlasErrorCode.TYPE_NAME_NOT_FOUND, e);
             } catch (AtlasException e) {
                 throw toAtlasBaseException(e);
             }

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/ec1b160a/webapp/src/main/resources/spring-security.xml
----------------------------------------------------------------------
diff --git a/webapp/src/main/resources/spring-security.xml b/webapp/src/main/resources/spring-security.xml
index 4ba3025..4ed88ec 100644
--- a/webapp/src/main/resources/spring-security.xml
+++ b/webapp/src/main/resources/spring-security.xml
@@ -14,17 +14,15 @@
              xmlns:beans="http://www.springframework.org/schema/beans"
              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xmlns:security="http://www.springframework.org/schema/security"
-             xmlns:util="http://www.springframework.org/schema/util"
-             xmlns:oauth="http://www.springframework.org/schema/security/oauth2"
              xmlns:context="http://www.springframework.org/schema/context"
              xsi:schemaLocation="http://www.springframework.org/schema/beans
     http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
     http://www.springframework.org/schema/security
     http://www.springframework.org/schema/security/spring-security-3.1.xsd
-    http://www.springframework.org/schema/util
-    http://www.springframework.org/schema/util/spring-util-3.1.xsd
-    http://www.springframework.org/schema/security/oauth2
-    http://www.springframework.org/schema/security/spring-security-oauth2-1.0.xsd
+
+
+
+
     http://www.springframework.org/schema/context 
     http://www.springframework.org/schema/context/spring-context-3.1.xsd">
 

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/ec1b160a/webapp/src/main/webapp/WEB-INF/applicationContext.xml
----------------------------------------------------------------------
diff --git a/webapp/src/main/webapp/WEB-INF/applicationContext.xml b/webapp/src/main/webapp/WEB-INF/applicationContext.xml
index 6129605..d4ad14e 100644
--- a/webapp/src/main/webapp/WEB-INF/applicationContext.xml
+++ b/webapp/src/main/webapp/WEB-INF/applicationContext.xml
@@ -11,16 +11,9 @@
     language governing permissions and limitations under the License. -->
 
 <beans xmlns="http://www.springframework.org/schema/beans"
-    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
-    xmlns:mvc="http://www.springframework.org/schema/mvc"
-    xmlns:context="http://www.springframework.org/schema/context"
-    xsi:schemaLocation="
-	http://www.springframework.org/schema/beans     
-	http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
-	http://www.springframework.org/schema/mvc
-    http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd	
-	http://www.springframework.org/schema/context 
-	http://www.springframework.org/schema/context/spring-context-3.1.xsd">
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="http://www.springframework.org/schema/beans
+	http://www.springframework.org/schema/beans/spring-beans-3.1.xsd">
 
         <import resource="classpath:/spring-security.xml" />
 

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/ec1b160a/webapp/src/test/java/org/apache/atlas/examples/QuickStartIT.java
----------------------------------------------------------------------
diff --git a/webapp/src/test/java/org/apache/atlas/examples/QuickStartIT.java b/webapp/src/test/java/org/apache/atlas/examples/QuickStartIT.java
index 01e4d48..06c78be 100644
--- a/webapp/src/test/java/org/apache/atlas/examples/QuickStartIT.java
+++ b/webapp/src/test/java/org/apache/atlas/examples/QuickStartIT.java
@@ -52,7 +52,7 @@ public class QuickStartIT extends BaseResourceIT {
     }
 
     private Referenceable getDB(String dbName) throws AtlasServiceException, JSONException {
-        return serviceClient.getEntity(QuickStart.DATABASE_TYPE, "name", dbName);
+        return atlasClientV1.getEntity(QuickStart.DATABASE_TYPE, "name", dbName);
     }
 
     @Test
@@ -68,7 +68,7 @@ public class QuickStartIT extends BaseResourceIT {
     }
 
     private Referenceable getTable(String tableName) throws AtlasServiceException {
-        return serviceClient.getEntity(QuickStart.TABLE_TYPE, AtlasClient.REFERENCEABLE_ATTRIBUTE_NAME, tableName);
+        return atlasClientV1.getEntity(QuickStart.TABLE_TYPE, AtlasClient.REFERENCEABLE_ATTRIBUTE_NAME, tableName);
     }
 
     private void verifyTrait(Referenceable table) throws JSONException {
@@ -95,7 +95,7 @@ public class QuickStartIT extends BaseResourceIT {
 
     @Test
     public void testProcessIsAdded() throws AtlasServiceException, JSONException {
-        Referenceable loadProcess = serviceClient.getEntity(QuickStart.LOAD_PROCESS_TYPE, AtlasClient.REFERENCEABLE_ATTRIBUTE_NAME,
+        Referenceable loadProcess = atlasClientV1.getEntity(QuickStart.LOAD_PROCESS_TYPE, AtlasClient.REFERENCEABLE_ATTRIBUTE_NAME,
                 QuickStart.LOAD_SALES_DAILY_PROCESS);
 
         assertEquals(QuickStart.LOAD_SALES_DAILY_PROCESS, loadProcess.get(AtlasClient.NAME));
@@ -123,7 +123,7 @@ public class QuickStartIT extends BaseResourceIT {
         String timeDimTableId = getTableId(QuickStart.TIME_DIM_TABLE);
         String salesFactDailyMVId = getTableId(QuickStart.SALES_FACT_DAILY_MV_TABLE);
 
-        JSONObject inputGraph = serviceClient.getInputGraph(QuickStart.SALES_FACT_DAILY_MV_TABLE);
+        JSONObject inputGraph = atlasClientV1.getInputGraph(QuickStart.SALES_FACT_DAILY_MV_TABLE);
         JSONObject vertices = (JSONObject) ((JSONObject) inputGraph.get("values")).get("vertices");
         JSONObject edges = (JSONObject) ((JSONObject) inputGraph.get("values")).get("edges");
 
@@ -142,7 +142,7 @@ public class QuickStartIT extends BaseResourceIT {
     @Test
     public void testViewIsAdded() throws AtlasServiceException, JSONException {
 
-        Referenceable view = serviceClient.getEntity(QuickStart.VIEW_TYPE, AtlasClient.REFERENCEABLE_ATTRIBUTE_NAME, QuickStart.PRODUCT_DIM_VIEW);
+        Referenceable view = atlasClientV1.getEntity(QuickStart.VIEW_TYPE, AtlasClient.REFERENCEABLE_ATTRIBUTE_NAME, QuickStart.PRODUCT_DIM_VIEW);
 
         assertEquals(QuickStart.PRODUCT_DIM_VIEW, view.get(AtlasClient.NAME));
 

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/ec1b160a/webapp/src/test/java/org/apache/atlas/notification/EntityNotificationIT.java
----------------------------------------------------------------------
diff --git a/webapp/src/test/java/org/apache/atlas/notification/EntityNotificationIT.java b/webapp/src/test/java/org/apache/atlas/notification/EntityNotificationIT.java
index ec62112..694f23e 100644
--- a/webapp/src/test/java/org/apache/atlas/notification/EntityNotificationIT.java
+++ b/webapp/src/test/java/org/apache/atlas/notification/EntityNotificationIT.java
@@ -65,8 +65,8 @@ public class EntityNotificationIT extends BaseResourceIT {
     @BeforeClass
     public void setUp() throws Exception {
         super.setUp();
-        createTypeDefinitions();
-        Referenceable HiveDBInstance = createHiveDBInstance(DATABASE_NAME);
+        createTypeDefinitionsV1();
+        Referenceable HiveDBInstance = createHiveDBInstanceV1(DATABASE_NAME);
         dbId = createInstance(HiveDBInstance);
 
         List<NotificationConsumer<EntityNotification>> consumers =
@@ -77,7 +77,7 @@ public class EntityNotificationIT extends BaseResourceIT {
 
     @Test
     public void testCreateEntity() throws Exception {
-        Referenceable tableInstance = createHiveTableInstance(DATABASE_NAME, TABLE_NAME, dbId);
+        Referenceable tableInstance = createHiveTableInstanceV1(DATABASE_NAME, TABLE_NAME, dbId);
         tableId = createInstance(tableInstance);
 
         final String guid = tableId._getId();
@@ -93,7 +93,7 @@ public class EntityNotificationIT extends BaseResourceIT {
 
         final String guid = tableId._getId();
 
-        serviceClient.updateEntityAttribute(guid, property, newValue);
+        atlasClientV1.updateEntityAttribute(guid, property, newValue);
 
         waitForNotification(notificationConsumer, MAX_WAIT_TIME,
                 newNotificationPredicate(EntityNotification.OperationType.ENTITY_UPDATE, HIVE_TABLE_TYPE, guid));
@@ -103,10 +103,10 @@ public class EntityNotificationIT extends BaseResourceIT {
     public void testDeleteEntity() throws Exception {
         final String tableName = "table-" + randomString();
         final String dbName = "db-" + randomString();
-        Referenceable HiveDBInstance = createHiveDBInstance(dbName);
+        Referenceable HiveDBInstance = createHiveDBInstanceV1(dbName);
         Id dbId = createInstance(HiveDBInstance);
 
-        Referenceable tableInstance = createHiveTableInstance(dbName, tableName, dbId);
+        Referenceable tableInstance = createHiveTableInstanceV1(dbName, tableName, dbId);
         final Id tableId = createInstance(tableInstance);
         final String guid = tableId._getId();
 
@@ -115,7 +115,7 @@ public class EntityNotificationIT extends BaseResourceIT {
 
         final String name = (String) tableInstance.get(AtlasClient.REFERENCEABLE_ATTRIBUTE_NAME);
 
-        serviceClient.deleteEntity(HIVE_TABLE_TYPE, AtlasClient.REFERENCEABLE_ATTRIBUTE_NAME, name);
+        atlasClientV1.deleteEntity(HIVE_TABLE_TYPE, AtlasClient.REFERENCEABLE_ATTRIBUTE_NAME, name);
 
         waitForNotification(notificationConsumer, MAX_WAIT_TIME,
             newNotificationPredicate(EntityNotification.OperationType.ENTITY_DELETE, HIVE_TABLE_TYPE, guid));
@@ -138,7 +138,7 @@ public class EntityNotificationIT extends BaseResourceIT {
 
         final String guid = tableId._getId();
 
-        serviceClient.addTrait(guid, traitInstance);
+        atlasClientV1.addTrait(guid, traitInstance);
 
         EntityNotification entityNotification = waitForNotification(notificationConsumer, MAX_WAIT_TIME,
                 newNotificationPredicate(EntityNotification.OperationType.TRAIT_ADD, HIVE_TABLE_TYPE, guid));
@@ -163,7 +163,7 @@ public class EntityNotificationIT extends BaseResourceIT {
         traitInstanceJSON = InstanceSerialization.toJson(traitInstance, true);
         LOG.debug("Trait instance = " + traitInstanceJSON);
 
-        serviceClient.addTrait(guid, traitInstance);
+        atlasClientV1.addTrait(guid, traitInstance);
 
         entityNotification = waitForNotification(notificationConsumer, MAX_WAIT_TIME,
                 newNotificationPredicate(EntityNotification.OperationType.TRAIT_ADD, HIVE_TABLE_TYPE, guid));
@@ -184,7 +184,7 @@ public class EntityNotificationIT extends BaseResourceIT {
     public void testDeleteTrait() throws Exception {
         final String guid = tableId._getId();
 
-        serviceClient.deleteTrait(guid, traitName);
+        atlasClientV1.deleteTrait(guid, traitName);
 
         EntityNotification entityNotification = waitForNotification(notificationConsumer, MAX_WAIT_TIME,
                 newNotificationPredicate(EntityNotification.OperationType.TRAIT_DELETE, HIVE_TABLE_TYPE, guid));

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/ec1b160a/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 de0a459..4a3db88 100644
--- a/webapp/src/test/java/org/apache/atlas/notification/NotificationHookConsumerIT.java
+++ b/webapp/src/test/java/org/apache/atlas/notification/NotificationHookConsumerIT.java
@@ -38,6 +38,10 @@ import static org.testng.Assert.assertEquals;
 public class NotificationHookConsumerIT extends BaseResourceIT {
 
     private static final String TEST_USER = "testuser";
+    public static final String NAME = "name";
+    public static final String DESCRIPTION = "description";
+    public static final String QUALIFIED_NAME = "qualifiedName";
+    public static final String CLUSTER_NAME = "clusterName";
 
     @Inject
     private NotificationInterface kafka;
@@ -45,7 +49,7 @@ public class NotificationHookConsumerIT extends BaseResourceIT {
     @BeforeClass
     public void setUp() throws Exception {
         super.setUp();
-        createTypeDefinitions();
+        createTypeDefinitionsV1();
     }
 
     @AfterClass
@@ -66,16 +70,16 @@ public class NotificationHookConsumerIT extends BaseResourceIT {
         //send valid message
         final Referenceable entity = new Referenceable(DATABASE_TYPE);
         String dbName = "db" + randomString();
-        entity.set("name", dbName);
-        entity.set("description", randomString());
-        entity.set("qualifiedName", dbName);
-        entity.set("clusterName", randomString());
+        entity.set(NAME, dbName);
+        entity.set(DESCRIPTION, randomString());
+        entity.set(QUALIFIED_NAME, dbName);
+        entity.set(CLUSTER_NAME, randomString());
         sendHookMessage(new HookNotification.EntityCreateRequest(TEST_USER, entity));
 
         waitFor(MAX_WAIT_TIME, new Predicate() {
             @Override
             public boolean evaluate() throws Exception {
-                JSONArray results = searchByDSL(String.format("%s where name='%s'", DATABASE_TYPE, entity.get("name")));
+                JSONArray results = searchByDSL(String.format("%s where name='%s'", DATABASE_TYPE, entity.get(NAME)));
                 return results.length() == 1;
             }
         });
@@ -85,25 +89,25 @@ public class NotificationHookConsumerIT extends BaseResourceIT {
     public void testCreateEntity() throws Exception {
         final Referenceable entity = new Referenceable(DATABASE_TYPE);
         String dbName = "db" + randomString();
-        entity.set("name", dbName);
-        entity.set("description", randomString());
-        entity.set("qualifiedName", dbName);
-        entity.set("clusterName", randomString());
+        entity.set(NAME, dbName);
+        entity.set(DESCRIPTION, randomString());
+        entity.set(QUALIFIED_NAME, dbName);
+        entity.set(CLUSTER_NAME, randomString());
 
         sendHookMessage(new HookNotification.EntityCreateRequest(TEST_USER, entity));
 
         waitFor(MAX_WAIT_TIME, new Predicate() {
             @Override
             public boolean evaluate() throws Exception {
-                JSONArray results = searchByDSL(String.format("%s where qualifiedName='%s'", DATABASE_TYPE, entity.get("qualifiedName")));
+                JSONArray results = searchByDSL(String.format("%s where qualifiedName='%s'", DATABASE_TYPE, entity.get(QUALIFIED_NAME)));
                 return results.length() == 1;
             }
         });
 
         //Assert that user passed in hook message is used in audit
-        Referenceable instance = serviceClient.getEntity(DATABASE_TYPE, "qualifiedName", (String) entity.get("qualifiedName"));
+        Referenceable instance = atlasClientV1.getEntity(DATABASE_TYPE, QUALIFIED_NAME, (String) entity.get(QUALIFIED_NAME));
         List<EntityAuditEvent> events =
-                serviceClient.getEntityAuditEvents(instance.getId()._getId(), (short) 1);
+                atlasClientV1.getEntityAuditEvents(instance.getId()._getId(), (short) 1);
         assertEquals(events.size(), 1);
         assertEquals(events.get(0).getUser(), TEST_USER);
     }
@@ -112,47 +116,47 @@ public class NotificationHookConsumerIT extends BaseResourceIT {
     public void testUpdateEntityPartial() throws Exception {
         final Referenceable entity = new Referenceable(DATABASE_TYPE);
         final String dbName = "db" + randomString();
-        entity.set("name", dbName);
-        entity.set("description", randomString());
-        entity.set("qualifiedName", dbName);
-        entity.set("clusterName", randomString());
+        entity.set(NAME, dbName);
+        entity.set(DESCRIPTION, randomString());
+        entity.set(QUALIFIED_NAME, dbName);
+        entity.set(CLUSTER_NAME, randomString());
 
-        serviceClient.createEntity(entity);
+        atlasClientV1.createEntity(entity);
 
         final Referenceable newEntity = new Referenceable(DATABASE_TYPE);
         newEntity.set("owner", randomString());
         sendHookMessage(
-                new HookNotification.EntityPartialUpdateRequest(TEST_USER, DATABASE_TYPE, "qualifiedName", dbName, newEntity));
+                new HookNotification.EntityPartialUpdateRequest(TEST_USER, DATABASE_TYPE, QUALIFIED_NAME, dbName, newEntity));
         waitFor(MAX_WAIT_TIME, new Predicate() {
             @Override
             public boolean evaluate() throws Exception {
-                Referenceable localEntity = serviceClient.getEntity(DATABASE_TYPE, "qualifiedName", dbName);
+                Referenceable localEntity = atlasClientV1.getEntity(DATABASE_TYPE, QUALIFIED_NAME, dbName);
                 return (localEntity.get("owner") != null && localEntity.get("owner").equals(newEntity.get("owner")));
             }
         });
 
         //Its partial update and un-set fields are not updated
-        Referenceable actualEntity = serviceClient.getEntity(DATABASE_TYPE, "qualifiedName", dbName);
-        assertEquals(actualEntity.get("description"), entity.get("description"));
+        Referenceable actualEntity = atlasClientV1.getEntity(DATABASE_TYPE, QUALIFIED_NAME, dbName);
+        assertEquals(actualEntity.get(DESCRIPTION), entity.get(DESCRIPTION));
     }
 
     @Test
     public void testUpdatePartialUpdatingQualifiedName() throws Exception {
         final Referenceable entity = new Referenceable(DATABASE_TYPE);
         final String dbName = "db" + randomString();
-        entity.set("name", dbName);
-        entity.set("description", randomString());
-        entity.set("qualifiedName", dbName);
-        entity.set("clusterName", randomString());
+        entity.set(NAME, dbName);
+        entity.set(DESCRIPTION, randomString());
+        entity.set(QUALIFIED_NAME, dbName);
+        entity.set(CLUSTER_NAME, randomString());
 
-        serviceClient.createEntity(entity);
+        atlasClientV1.createEntity(entity);
 
         final Referenceable newEntity = new Referenceable(DATABASE_TYPE);
         final String newName = "db" + randomString();
-        newEntity.set("qualifiedName", newName);
+        newEntity.set(QUALIFIED_NAME, newName);
 
         sendHookMessage(
-                new HookNotification.EntityPartialUpdateRequest(TEST_USER, DATABASE_TYPE, "qualifiedName", dbName, newEntity));
+                new HookNotification.EntityPartialUpdateRequest(TEST_USER, DATABASE_TYPE, QUALIFIED_NAME, dbName, newEntity));
         waitFor(MAX_WAIT_TIME, new Predicate() {
             @Override
             public boolean evaluate() throws Exception {
@@ -171,19 +175,19 @@ public class NotificationHookConsumerIT extends BaseResourceIT {
     public void testDeleteByQualifiedName() throws Exception {
         Referenceable entity = new Referenceable(DATABASE_TYPE);
         final String dbName = "db" + randomString();
-        entity.set("name", dbName);
-        entity.set("description", randomString());
-        entity.set("qualifiedName", dbName);
-        entity.set("clusterName", randomString());
+        entity.set(NAME, dbName);
+        entity.set(DESCRIPTION, randomString());
+        entity.set(QUALIFIED_NAME, dbName);
+        entity.set(CLUSTER_NAME, randomString());
 
-        final String dbId = serviceClient.createEntity(entity).get(0);
+        final String dbId = atlasClientV1.createEntity(entity).get(0);
 
         sendHookMessage(
-            new HookNotification.EntityDeleteRequest(TEST_USER, DATABASE_TYPE, "qualifiedName", dbName));
+            new HookNotification.EntityDeleteRequest(TEST_USER, DATABASE_TYPE, QUALIFIED_NAME, dbName));
         waitFor(MAX_WAIT_TIME, new Predicate() {
             @Override
             public boolean evaluate() throws Exception {
-                Referenceable getEntity = serviceClient.getEntity(dbId);
+                Referenceable getEntity = atlasClientV1.getEntity(dbId);
                 return getEntity.getId().getState() == Id.EntityState.DELETED;
             }
         });
@@ -193,32 +197,32 @@ public class NotificationHookConsumerIT extends BaseResourceIT {
     public void testUpdateEntityFullUpdate() throws Exception {
         Referenceable entity = new Referenceable(DATABASE_TYPE);
         final String dbName = "db" + randomString();
-        entity.set("name", dbName);
-        entity.set("description", randomString());
-        entity.set("qualifiedName", dbName);
-        entity.set("clusterName", randomString());
+        entity.set(NAME, dbName);
+        entity.set(DESCRIPTION, randomString());
+        entity.set(QUALIFIED_NAME, dbName);
+        entity.set(CLUSTER_NAME, randomString());
 
-        serviceClient.createEntity(entity);
+        atlasClientV1.createEntity(entity);
 
         final Referenceable newEntity = new Referenceable(DATABASE_TYPE);
-        newEntity.set("name", randomString());
-        newEntity.set("description", randomString());
+        newEntity.set(NAME, randomString());
+        newEntity.set(DESCRIPTION, randomString());
         newEntity.set("owner", randomString());
-        newEntity.set("qualifiedName", dbName);
-        newEntity.set("clusterName", randomString());
+        newEntity.set(QUALIFIED_NAME, dbName);
+        newEntity.set(CLUSTER_NAME, randomString());
 
         //updating unique attribute
         sendHookMessage(new HookNotification.EntityUpdateRequest(TEST_USER, newEntity));
         waitFor(MAX_WAIT_TIME, new Predicate() {
             @Override
             public boolean evaluate() throws Exception {
-                JSONArray results = searchByDSL(String.format("%s where qualifiedName='%s'", DATABASE_TYPE, newEntity.get("qualifiedName")));
+                JSONArray results = searchByDSL(String.format("%s where qualifiedName='%s'", DATABASE_TYPE, newEntity.get(QUALIFIED_NAME)));
                 return results.length() == 1;
             }
         });
 
-        Referenceable actualEntity = serviceClient.getEntity(DATABASE_TYPE, "qualifiedName", dbName);
-        assertEquals(actualEntity.get("description"), newEntity.get("description"));
+        Referenceable actualEntity = atlasClientV1.getEntity(DATABASE_TYPE, QUALIFIED_NAME, dbName);
+        assertEquals(actualEntity.get(DESCRIPTION), newEntity.get(DESCRIPTION));
         assertEquals(actualEntity.get("owner"), newEntity.get("owner"));
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/ec1b160a/webapp/src/test/java/org/apache/atlas/notification/NotificationHookConsumerKafkaTest.java
----------------------------------------------------------------------
diff --git a/webapp/src/test/java/org/apache/atlas/notification/NotificationHookConsumerKafkaTest.java b/webapp/src/test/java/org/apache/atlas/notification/NotificationHookConsumerKafkaTest.java
index e37839a..873e562 100644
--- a/webapp/src/test/java/org/apache/atlas/notification/NotificationHookConsumerKafkaTest.java
+++ b/webapp/src/test/java/org/apache/atlas/notification/NotificationHookConsumerKafkaTest.java
@@ -39,6 +39,9 @@ import static org.mockito.Mockito.verify;
 @Guice(modules = NotificationModule.class)
 public class NotificationHookConsumerKafkaTest {
 
+    public static final String NAME = "name";
+    public static final String DESCRIPTION = "description";
+    public static final String QUALIFIED_NAME = "qualifiedName";
     @Inject
     private NotificationInterface notificationInterface;
 
@@ -128,9 +131,9 @@ public class NotificationHookConsumerKafkaTest {
 
     Referenceable createEntity() {
         final Referenceable entity = new Referenceable(AtlasClient.DATA_SET_SUPER_TYPE);
-        entity.set("name", "db" + randomString());
-        entity.set("description", randomString());
-        entity.set("qualifiedName", randomString());
+        entity.set(NAME, "db" + randomString());
+        entity.set(DESCRIPTION, randomString());
+        entity.set(QUALIFIED_NAME, randomString());
         return entity;
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/ec1b160a/webapp/src/test/java/org/apache/atlas/web/resources/AdminJerseyResourceIT.java
----------------------------------------------------------------------
diff --git a/webapp/src/test/java/org/apache/atlas/web/resources/AdminJerseyResourceIT.java b/webapp/src/test/java/org/apache/atlas/web/resources/AdminJerseyResourceIT.java
index 2a4baba..177785c 100755
--- a/webapp/src/test/java/org/apache/atlas/web/resources/AdminJerseyResourceIT.java
+++ b/webapp/src/test/java/org/apache/atlas/web/resources/AdminJerseyResourceIT.java
@@ -37,7 +37,7 @@ public class AdminJerseyResourceIT extends BaseResourceIT {
 
     @Test
     public void testGetVersion() throws Exception {
-        JSONObject response = serviceClient.callAPIWithBodyAndParams(AtlasClient.API.VERSION, null, (String[]) null);
+        JSONObject response = atlasClientV1.callAPIWithBodyAndParams(AtlasClient.API.VERSION, null, (String[]) null);
         Assert.assertNotNull(response);
 
         PropertiesConfiguration buildConfiguration = new PropertiesConfiguration("atlas-buildinfo.properties");