atlas-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mad...@apache.org
Subject [1/7] atlas git commit: ATLAS-2179: Split Atlas client library to avoid unnecessary dependencies
Date Wed, 27 Sep 2017 04:25:37 GMT
Repository: atlas
Updated Branches:
  refs/heads/branch-0.8 eea405089 -> 900bf9eb2


http://git-wip-us.apache.org/repos/asf/atlas/blob/900bf9eb/webapp/src/test/java/org/apache/atlas/web/integration/EntityJerseyResourceIT.java
----------------------------------------------------------------------
diff --git a/webapp/src/test/java/org/apache/atlas/web/integration/EntityJerseyResourceIT.java
b/webapp/src/test/java/org/apache/atlas/web/integration/EntityJerseyResourceIT.java
index 758ed93..065a44d 100755
--- a/webapp/src/test/java/org/apache/atlas/web/integration/EntityJerseyResourceIT.java
+++ b/webapp/src/test/java/org/apache/atlas/web/integration/EntityJerseyResourceIT.java
@@ -27,9 +27,7 @@ import org.apache.atlas.AtlasServiceException;
 import org.apache.atlas.EntityAuditEvent;
 import org.apache.atlas.kafka.NotificationProvider;
 import org.apache.atlas.model.legacy.EntityResult;
-import org.apache.atlas.notification.NotificationConsumer;
 import org.apache.atlas.notification.NotificationInterface;
-import org.apache.atlas.notification.entity.EntityNotification;
 import org.apache.atlas.typesystem.Referenceable;
 import org.apache.atlas.typesystem.Struct;
 import org.apache.atlas.typesystem.TypesDef;
@@ -195,7 +193,7 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
         databaseInstance.set("location", "/tmp");
 
         JSONObject response = atlasClientV1
-                .callAPIWithBody(AtlasClient.API.CREATE_ENTITY, InstanceSerialization.toJson(databaseInstance,
true));
+                .callAPIWithBody(AtlasClient.API_V1.CREATE_ENTITY, InstanceSerialization.toJson(databaseInstance,
true));
         assertNotNull(response);
         Assert.assertNotNull(response.get(AtlasClient.REQUEST_ID));
 
@@ -345,7 +343,7 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
         String description = "bar table - new desc";
         addProperty(guid, "description", description);
 
-        JSONObject response = atlasClientV1.callAPIWithBodyAndParams(AtlasClient.API.GET_ENTITY,
null, guid);
+        JSONObject response = atlasClientV1.callAPIWithBodyAndParams(AtlasClient.API_V1.GET_ENTITY,
null, guid);
         Assert.assertNotNull(response);
 
         referenceable.set("description", description);
@@ -363,7 +361,7 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
         // updating date attribute as string not supported in v2
         // addProperty(guid, "createTime", currentTime);
 
-        response = atlasClientV1.callAPIWithBodyAndParams(AtlasClient.API.GET_ENTITY, null,
guid);
+        response = atlasClientV1.callAPIWithBodyAndParams(AtlasClient.API_V1.GET_ENTITY,
null, guid);
         Assert.assertNotNull(response);
 
         referenceable.set("createTime", currentTime);
@@ -480,7 +478,7 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
     @Test(expectedExceptions = AtlasServiceException.class)
     public void testGetInvalidEntityDefinition() throws Exception {
 
-        JSONObject response = atlasClientV1.callAPIWithBodyAndParams(AtlasClient.API.GET_ENTITY,
null, "blah");
+        JSONObject response = atlasClientV1.callAPIWithBodyAndParams(AtlasClient.API_V1.GET_ENTITY,
null, "blah");
 
         Assert.assertNotNull(response);
 
@@ -513,7 +511,7 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
         MultivaluedMap<String, String> queryParams = new MultivaluedMapImpl();
         queryParams.add("type", "blah");
 
-        JSONObject response = atlasClientV1.callAPIWithQueryParams(AtlasClient.API.GET_ENTITY,
queryParams);
+        JSONObject response = atlasClientV1.callAPIWithQueryParams(AtlasClient.API_V1.GET_ENTITY,
queryParams);
         assertNotNull(response);
         Assert.assertNotNull(response.get(AtlasClient.ERROR));
     }
@@ -526,7 +524,7 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
         MultivaluedMap<String, String> queryParams = new MultivaluedMapImpl();
         queryParams.add("type", typeName);
 
-        JSONObject response = atlasClientV1.callAPIWithQueryParams(AtlasClient.API.GET_ENTITY,
queryParams);
+        JSONObject response = atlasClientV1.callAPIWithQueryParams(AtlasClient.API_V1.GET_ENTITY,
queryParams);
         assertNotNull(response);
         Assert.assertNotNull(response.get(AtlasClient.REQUEST_ID));
 
@@ -713,7 +711,7 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
         String traitInstanceAsJSON = InstanceSerialization$.MODULE$.toJson(traitInstance,
true);
         LOG.debug("traitInstanceAsJSON = {}", traitInstanceAsJSON);
 
-        atlasClientV1.callAPIWithBodyAndParams(AtlasClient.API.CREATE_ENTITY, traitInstanceAsJSON,
"random", TRAITS);
+        atlasClientV1.callAPIWithBodyAndParams(AtlasClient.API_V1.CREATE_ENTITY, traitInstanceAsJSON,
"random", TRAITS);
     }
 
     @Test
@@ -832,7 +830,7 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
         instance.set(attrName, attrValue);
         Id guid = createInstance(instance);
 
-        JSONObject response = atlasClientV1.callAPIWithBodyAndParams(AtlasClient.API.GET_ENTITY,
null, guid._getId());
+        JSONObject response = atlasClientV1.callAPIWithBodyAndParams(AtlasClient.API_V1.GET_ENTITY,
null, guid._getId());
         Referenceable getReferenceable = InstanceSerialization.fromJsonReferenceable(response.getString(AtlasClient.DEFINITION),
true);
         Assert.assertEquals(getReferenceable.get(attrName), attrValue);
     }
@@ -1026,7 +1024,7 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
         queryParams.add(AtlasClient.GUID.toLowerCase(), db1Id._getId());
         queryParams.add(AtlasClient.GUID.toLowerCase(), db2Id._getId());
 
-        JSONObject response = atlasClientV1.callAPIWithQueryParams(AtlasClient.API.DELETE_ENTITIES,
queryParams);
+        JSONObject response = atlasClientV1.callAPIWithQueryParams(AtlasClient.API_V1.DELETE_ENTITIES,
queryParams);
         List<String> deletedGuidsList = EntityResult.fromString(response.toString()).getDeletedEntities();
         Assert.assertTrue(deletedGuidsList.contains(db1Id._getId()));
         Assert.assertTrue(deletedGuidsList.contains(db2Id._getId()));

http://git-wip-us.apache.org/repos/asf/atlas/blob/900bf9eb/webapp/src/test/java/org/apache/atlas/web/integration/EntityLineageJerseyResourceIT.java
----------------------------------------------------------------------
diff --git a/webapp/src/test/java/org/apache/atlas/web/integration/EntityLineageJerseyResourceIT.java
b/webapp/src/test/java/org/apache/atlas/web/integration/EntityLineageJerseyResourceIT.java
index 55c56c2..3811390 100644
--- a/webapp/src/test/java/org/apache/atlas/web/integration/EntityLineageJerseyResourceIT.java
+++ b/webapp/src/test/java/org/apache/atlas/web/integration/EntityLineageJerseyResourceIT.java
@@ -21,6 +21,7 @@ package org.apache.atlas.web.integration;
 import com.google.common.collect.ImmutableList;
 import com.google.gson.Gson;
 import com.sun.jersey.core.util.MultivaluedMapImpl;
+import org.apache.atlas.AtlasBaseClient;
 import org.apache.atlas.AtlasClient;
 import org.apache.atlas.model.instance.AtlasEntityHeader;
 import org.apache.atlas.model.lineage.AtlasLineageInfo;
@@ -37,19 +38,17 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
-import static org.apache.atlas.AtlasBaseClient.APIInfo;
-
 /**
  * Entity Lineage v2 Integration Tests.
  */
 public class EntityLineageJerseyResourceIT extends DataSetLineageJerseyResourceIT {
-    private static final String BASE_URI = "api/atlas/v2/lineage";
-    private static final APIInfo LINEAGE_V2_API = new APIInfo(BASE_URI, "GET", Response.Status.OK);
-    private static final String INPUT_DIRECTION = "INPUT";
-    private static final String OUTPUT_DIRECTION = "OUTPUT";
-    private static final String BOTH_DIRECTION = "BOTH";
-    private static final String DIRECTION_PARAM = "direction";
-    private static final String DEPTH_PARAM = "depth";
+    private static final String              BASE_URI         = "api/atlas/v2/lineage";
+    private static final AtlasBaseClient.API LINEAGE_V2_API   = new AtlasBaseClient.API(BASE_URI,
"GET", Response.Status.OK);
+    private static final String              INPUT_DIRECTION  = "INPUT";
+    private static final String              OUTPUT_DIRECTION = "OUTPUT";
+    private static final String              BOTH_DIRECTION   = "BOTH";
+    private static final String              DIRECTION_PARAM  = "direction";
+    private static final String              DEPTH_PARAM      = "depth";
 
     private String salesFactTable;
     private String salesMonthlyTable;

http://git-wip-us.apache.org/repos/asf/atlas/blob/900bf9eb/webapp/src/test/java/org/apache/atlas/web/integration/MetadataDiscoveryJerseyResourceIT.java
----------------------------------------------------------------------
diff --git a/webapp/src/test/java/org/apache/atlas/web/integration/MetadataDiscoveryJerseyResourceIT.java
b/webapp/src/test/java/org/apache/atlas/web/integration/MetadataDiscoveryJerseyResourceIT.java
index 3fa85b1..a13f069 100755
--- a/webapp/src/test/java/org/apache/atlas/web/integration/MetadataDiscoveryJerseyResourceIT.java
+++ b/webapp/src/test/java/org/apache/atlas/web/integration/MetadataDiscoveryJerseyResourceIT.java
@@ -69,7 +69,7 @@ public class MetadataDiscoveryJerseyResourceIT extends BaseResourceIT {
         String dslQuery = "from "+ DATABASE_TYPE + " name=\"" + dbName + "\"";
         MultivaluedMap<String, String> queryParams = new MultivaluedMapImpl();
         queryParams.add("query", dslQuery);
-        JSONObject response = atlasClientV1.callAPIWithQueryParams(AtlasClient.API.SEARCH_DSL,
queryParams);
+        JSONObject response = atlasClientV1.callAPIWithQueryParams(AtlasClient.API_V1.SEARCH_DSL,
queryParams);
 
         Assert.assertNotNull(response);
         Assert.assertNotNull(response.get(AtlasClient.REQUEST_ID));
@@ -92,7 +92,7 @@ public class MetadataDiscoveryJerseyResourceIT extends BaseResourceIT {
         String dslQuery = "from "+ DATABASE_TYPE + " name=\"" + dbName + "\"";
         MultivaluedMap<String, String> queryParams = new MultivaluedMapImpl();
         queryParams.add("query", dslQuery);
-        JSONObject response = atlasClientV1.callAPIWithQueryParams(AtlasClient.API.SEARCH_DSL,
queryParams);
+        JSONObject response = atlasClientV1.callAPIWithQueryParams(AtlasClient.API_V1.SEARCH_DSL,
queryParams);
         assertNotNull(response);
 
         //higher limit, all results returned
@@ -141,7 +141,7 @@ public class MetadataDiscoveryJerseyResourceIT extends BaseResourceIT
{
         String dslQuery = "from blah";
         MultivaluedMap<String, String> queryParams = new MultivaluedMapImpl();
         queryParams.add("query", dslQuery);
-        atlasClientV1.callAPIWithQueryParams(AtlasClient.API.SEARCH_DSL, queryParams);
+        atlasClientV1.callAPIWithQueryParams(AtlasClient.API_V1.SEARCH_DSL, queryParams);
     }
 
     @Test
@@ -150,7 +150,7 @@ public class MetadataDiscoveryJerseyResourceIT extends BaseResourceIT
{
         MultivaluedMap<String, String> queryParams = new MultivaluedMapImpl();
         queryParams.add("query", query);
 
-        JSONObject response = atlasClientV1.callAPIWithQueryParams(AtlasClient.API.GREMLIN_SEARCH,
queryParams);
+        JSONObject response = atlasClientV1.callAPIWithQueryParams(AtlasClient.API_V1.GREMLIN_SEARCH,
queryParams);
 
         assertNotNull(response);
         assertNotNull(response.get(AtlasClient.REQUEST_ID));
@@ -165,7 +165,7 @@ public class MetadataDiscoveryJerseyResourceIT extends BaseResourceIT
{
         String query = "from "+ DATABASE_TYPE + " name=\"" + dbName +"\"";
         MultivaluedMap<String, String> queryParams = new MultivaluedMapImpl();
         queryParams.add("query", query);
-        JSONObject response = atlasClientV1.callAPIWithQueryParams(AtlasClient.API.SEARCH,
queryParams);
+        JSONObject response = atlasClientV1.callAPIWithQueryParams(AtlasClient.API_V1.SEARCH,
queryParams);
 
         Assert.assertNotNull(response);
         Assert.assertNotNull(response.get(AtlasClient.REQUEST_ID));
@@ -179,7 +179,7 @@ public class MetadataDiscoveryJerseyResourceIT extends BaseResourceIT
{
         String query = "*";
         MultivaluedMap<String, String> queryParams = new MultivaluedMapImpl();
         queryParams.add("query", query);
-        JSONObject response = atlasClientV1.callAPIWithQueryParams(AtlasClient.API.SEARCH,
queryParams);
+        JSONObject response = atlasClientV1.callAPIWithQueryParams(AtlasClient.API_V1.SEARCH,
queryParams);
 
         Assert.assertNotNull(response);
         Assert.assertNotNull(response.get(AtlasClient.REQUEST_ID));
@@ -211,7 +211,7 @@ public class MetadataDiscoveryJerseyResourceIT extends BaseResourceIT
{
         String query = dbName;
         MultivaluedMap<String, String> queryParams = new MultivaluedMapImpl();
         queryParams.add("query", query);
-        response = atlasClientV1.callAPIWithQueryParams(AtlasClient.API.SEARCH_FULL_TEXT,
queryParams);
+        response = atlasClientV1.callAPIWithQueryParams(AtlasClient.API_V1.SEARCH_FULL_TEXT,
queryParams);
         results = response.getJSONArray(AtlasClient.RESULTS);
         assertEquals(results.length(), 1);
 

http://git-wip-us.apache.org/repos/asf/atlas/blob/900bf9eb/webapp/src/test/java/org/apache/atlas/web/integration/TypesJerseyResourceIT.java
----------------------------------------------------------------------
diff --git a/webapp/src/test/java/org/apache/atlas/web/integration/TypesJerseyResourceIT.java
b/webapp/src/test/java/org/apache/atlas/web/integration/TypesJerseyResourceIT.java
index 54db3c0..351e5ae 100755
--- a/webapp/src/test/java/org/apache/atlas/web/integration/TypesJerseyResourceIT.java
+++ b/webapp/src/test/java/org/apache/atlas/web/integration/TypesJerseyResourceIT.java
@@ -81,7 +81,7 @@ public class TypesJerseyResourceIT extends BaseResourceIT {
                 String typesAsJSON = TypesSerialization.toJson(typeDefinition, false);
                 System.out.println("typesAsJSON = " + typesAsJSON);
 
-                JSONObject response = atlasClientV1.callAPIWithBody(AtlasClient.API.CREATE_TYPE,
typesAsJSON);
+                JSONObject response = atlasClientV1.callAPIWithBody(AtlasClient.API_V1.CREATE_TYPE,
typesAsJSON);
                 Assert.assertNotNull(response);
 
 
@@ -142,7 +142,7 @@ public class TypesJerseyResourceIT extends BaseResourceIT {
         for (HierarchicalTypeDefinition typeDefinition : typeDefinitions) {
             System.out.println("typeName = " + typeDefinition.typeName);
 
-            JSONObject response = atlasClientV1.callAPIWithBodyAndParams(AtlasClient.API.LIST_TYPES,
null, typeDefinition.typeName);
+            JSONObject response = atlasClientV1.callAPIWithBodyAndParams(AtlasClient.API_V1.LIST_TYPES,
null, typeDefinition.typeName);
 
             Assert.assertNotNull(response);
             Assert.assertNotNull(response.get(AtlasClient.DEFINITION));
@@ -164,12 +164,12 @@ public class TypesJerseyResourceIT extends BaseResourceIT {
 
     @Test(expectedExceptions = AtlasServiceException.class)
     public void testGetDefinitionForNonexistentType() throws Exception {
-        JSONObject response = atlasClientV1.callAPIWithBodyAndParams(AtlasClient.API.LIST_TYPES,
null, "blah");
+        JSONObject response = atlasClientV1.callAPIWithBodyAndParams(AtlasClient.API_V1.LIST_TYPES,
null, "blah");
     }
 
     @Test(dependsOnMethods = "testSubmit")
     public void testGetTypeNames() throws Exception {
-        JSONObject response = atlasClientV1.callAPIWithBodyAndParams(AtlasClient.API.LIST_TYPES,
null, (String[]) null);
+        JSONObject response = atlasClientV1.callAPIWithBodyAndParams(AtlasClient.API_V1.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 = atlasClientV1.callAPIWithQueryParams(AtlasClient.API.LIST_TYPES,
queryParams);
+        JSONObject response = atlasClientV1.callAPIWithQueryParams(AtlasClient.API_V1.LIST_TYPES,
queryParams);
         Assert.assertNotNull(response);
 
         Assert.assertNotNull(response.get(AtlasClient.REQUEST_ID));


Mime
View raw message