atlas-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mad...@apache.org
Subject [2/3] incubator-atlas git commit: ATLAS-1311: Integration tests for V2 Entity APIs
Date Wed, 21 Dec 2016 18:20:31 GMT
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);


Mime
View raw message