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:32 UTC
[3/3] incubator-atlas git commit: ATLAS-1311: Integration tests for
V2 Entity APIs
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");