Commit 46b1b36e by apoorvnaik Committed by Madhan Neethiraj

ATLAS-1616: consolidated all V2 clients

parent 84f6923e
...@@ -6,9 +6,9 @@ ...@@ -6,9 +6,9 @@
* to you under the Apache License, Version 2.0 (the * to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance * "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at * with the License. You may obtain a copy of the License at
* * <p>
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* * <p>
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
...@@ -80,7 +80,8 @@ public abstract class AtlasBaseClient { ...@@ -80,7 +80,8 @@ public abstract class AtlasBaseClient {
private AtlasClientContext atlasClientContext; private AtlasClientContext atlasClientContext;
private boolean retryEnabled = false; private boolean retryEnabled = false;
protected AtlasBaseClient() {} protected AtlasBaseClient() {
}
protected AtlasBaseClient(String[] baseUrl, String[] basicAuthUserNamePassword) { protected AtlasBaseClient(String[] baseUrl, String[] basicAuthUserNamePassword) {
if (basicAuthUserNamePassword != null) { if (basicAuthUserNamePassword != null) {
...@@ -158,7 +159,8 @@ public abstract class AtlasBaseClient { ...@@ -158,7 +159,8 @@ public abstract class AtlasBaseClient {
DefaultClientConfig config = new DefaultClientConfig(); DefaultClientConfig config = new DefaultClientConfig();
// Enable POJO mapping feature // Enable POJO mapping feature
config.getFeatures().put(JSONConfiguration.FEATURE_POJO_MAPPING, Boolean.TRUE); config.getFeatures().put(JSONConfiguration.FEATURE_POJO_MAPPING, Boolean.TRUE);
int readTimeout = configuration.getInt("atlas.client.readTimeoutMSecs", 60000);; int readTimeout = configuration.getInt("atlas.client.readTimeoutMSecs", 60000);
;
int connectTimeout = configuration.getInt("atlas.client.connectTimeoutMSecs", 60000); int connectTimeout = configuration.getInt("atlas.client.connectTimeoutMSecs", 60000);
if (configuration.getBoolean(TLS_ENABLED, false)) { if (configuration.getBoolean(TLS_ENABLED, false)) {
// create an SSL properties configuration if one doesn't exist. SSLFactory expects a file, so forced // create an SSL properties configuration if one doesn't exist. SSLFactory expects a file, so forced
...@@ -237,10 +239,10 @@ public abstract class AtlasBaseClient { ...@@ -237,10 +239,10 @@ public abstract class AtlasBaseClient {
activeServerAddress = serverInstance; activeServerAddress = serverInstance;
break; break;
} else { } else {
LOG.info("attempt #{}: Service {} - is not active. status={}", (i+1), serverInstance, adminStatus); LOG.info("attempt #{}: Service {} - is not active. status={}", (i + 1), serverInstance, adminStatus);
} }
} catch (Exception e) { } catch (Exception e) {
LOG.error("attempt #{}: Service {} - could not get status", (i+1), serverInstance, e); LOG.error("attempt #{}: Service {} - could not get status", (i + 1), serverInstance, e);
} }
sleepBetweenRetries(); sleepBetweenRetries();
} }
...@@ -280,7 +282,7 @@ public abstract class AtlasBaseClient { ...@@ -280,7 +282,7 @@ public abstract class AtlasBaseClient {
protected <T> T callAPIWithResource(APIInfo api, WebResource resource, Object requestObject, Class<T> responseType) throws AtlasServiceException { protected <T> T callAPIWithResource(APIInfo api, WebResource resource, Object requestObject, Class<T> responseType) throws AtlasServiceException {
GenericType<T> genericType = null; GenericType<T> genericType = null;
if(responseType != null) { if (responseType != null) {
genericType = new GenericType<>(responseType); genericType = new GenericType<>(responseType);
} }
return callAPIWithResource(api, resource, requestObject, genericType); return callAPIWithResource(api, resource, requestObject, genericType);
...@@ -381,7 +383,7 @@ public abstract class AtlasBaseClient { ...@@ -381,7 +383,7 @@ public abstract class AtlasBaseClient {
* @return Return metrics of the service instance the client is pointing to * @return Return metrics of the service instance the client is pointing to
* @throws AtlasServiceException * @throws AtlasServiceException
*/ */
public AtlasMetrics getAtlasMetrics () throws AtlasServiceException { public AtlasMetrics getAtlasMetrics() throws AtlasServiceException {
return callAPI(METRICS, AtlasMetrics.class, null); return callAPI(METRICS, AtlasMetrics.class, null);
} }
...@@ -423,18 +425,18 @@ public abstract class AtlasBaseClient { ...@@ -423,18 +425,18 @@ public abstract class AtlasBaseClient {
throw new AtlasServiceException(api, new RuntimeException("Could not get response after retries.")); throw new AtlasServiceException(api, new RuntimeException("Could not get response after retries."));
} }
public <T> T callAPI(APIInfo api, Object requestObject, Class<T> responseType, String... params) public <T> T callAPI(APIInfo api, Class<T> responseType, Object requestObject, String... params)
throws AtlasServiceException { throws AtlasServiceException {
return callAPIWithResource(api, getResource(api, params), requestObject, responseType); return callAPIWithResource(api, getResource(api, params), requestObject, responseType);
} }
public <T> T callAPI(APIInfo api, Object requestObject, GenericType<T> responseType, String... params) public <T> T callAPI(APIInfo api, GenericType<T> responseType, Object requestObject, String... params)
throws AtlasServiceException { throws AtlasServiceException {
return callAPIWithResource(api, getResource(api, params), requestObject, responseType); return callAPIWithResource(api, getResource(api, params), requestObject, responseType);
} }
public <T> T callAPI(APIInfo api, Object requestBody, Class<T> responseType, public <T> T callAPI(APIInfo api, Class<T> responseType, Object requestBody,
MultivaluedMap<String, String> queryParams, String... params) throws AtlasServiceException { MultivaluedMap<String, String> queryParams, String... params) throws AtlasServiceException {
WebResource resource = getResource(api, queryParams, params); WebResource resource = getResource(api, queryParams, params);
return callAPIWithResource(api, resource, requestBody, responseType); return callAPIWithResource(api, resource, requestBody, responseType);
...@@ -483,7 +485,7 @@ public abstract class AtlasBaseClient { ...@@ -483,7 +485,7 @@ public abstract class AtlasBaseClient {
return resource; return resource;
} }
protected WebResource getResource(APIInfo api, MultivaluedMap<String, String> queryParams, String ... pathParams) { protected WebResource getResource(APIInfo api, MultivaluedMap<String, String> queryParams, String... pathParams) {
WebResource resource = service.path(api.getPath()); WebResource resource = service.path(api.getPath());
resource = appendPathParams(resource, pathParams); resource = appendPathParams(resource, pathParams);
resource = appendQueryParams(queryParams, resource); resource = appendQueryParams(queryParams, resource);
...@@ -523,7 +525,7 @@ public abstract class AtlasBaseClient { ...@@ -523,7 +525,7 @@ public abstract class AtlasBaseClient {
return resource; return resource;
} }
protected APIInfo formatPathForPathParams(APIInfo apiInfo, String ... params) { protected APIInfo updatePathParameters(APIInfo apiInfo, String... params) {
return new APIInfo(String.format(apiInfo.getPath(), params), apiInfo.getMethod(), apiInfo.getExpectedStatus()); return new APIInfo(String.format(apiInfo.getPath(), params), apiInfo.getMethod(), apiInfo.getExpectedStatus());
} }
......
...@@ -997,12 +997,12 @@ public class AtlasClient extends AtlasBaseClient { ...@@ -997,12 +997,12 @@ public class AtlasClient extends AtlasBaseClient {
@VisibleForTesting @VisibleForTesting
public JSONObject callAPIWithBody(API api, Object requestObject) throws AtlasServiceException { public JSONObject callAPIWithBody(API api, Object requestObject) throws AtlasServiceException {
return callAPI(toAPIInfo(api), requestObject, JSONObject.class, (String[]) null); return callAPI(toAPIInfo(api), JSONObject.class, requestObject, (String[]) null);
} }
@VisibleForTesting @VisibleForTesting
public JSONObject callAPIWithBodyAndParams(API api, Object requestObject, String ... params) throws AtlasServiceException { public JSONObject callAPIWithBodyAndParams(API api, Object requestObject, String ... params) throws AtlasServiceException {
return callAPI(toAPIInfo(api), requestObject, JSONObject.class, params); return callAPI(toAPIInfo(api), JSONObject.class, requestObject, params);
} }
@VisibleForTesting @VisibleForTesting
......
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.atlas;
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.discovery.AtlasSearchResult;
import org.apache.commons.configuration.Configuration;
import org.apache.hadoop.security.UserGroupInformation;
import javax.ws.rs.HttpMethod;
import javax.ws.rs.core.MultivaluedMap;
import javax.ws.rs.core.Response;
import static org.apache.atlas.AtlasClient.LIMIT;
import static org.apache.atlas.AtlasClient.OFFSET;
import static org.apache.atlas.AtlasClient.QUERY;
public class AtlasDiscoveryClientV2 extends AtlasBaseClient {
private static final String DISCOVERY_URI = BASE_URI + "v2/search";
private static final String DSL_URI = DISCOVERY_URI + "/dsl";
private static final String FULL_TEXT_URI = DISCOVERY_URI + "/fulltext";
private static final APIInfo DSL_SEARCH = new APIInfo(DSL_URI, HttpMethod.GET, Response.Status.OK);
private static final APIInfo FULL_TEXT_SEARCH = new APIInfo(FULL_TEXT_URI, HttpMethod.GET, Response.Status.OK);
public AtlasDiscoveryClientV2(String[] baseUrl, String[] basicAuthUserNamePassword) {
super(baseUrl, basicAuthUserNamePassword);
}
public AtlasDiscoveryClientV2(String... baseUrls) throws AtlasException {
super(baseUrls);
}
public AtlasDiscoveryClientV2(UserGroupInformation ugi, String doAsUser, String... baseUrls) {
super(ugi, doAsUser, baseUrls);
}
protected AtlasDiscoveryClientV2() {
super();
}
@VisibleForTesting
AtlasDiscoveryClientV2(WebResource service, Configuration configuration) {
super(service, configuration);
}
public AtlasSearchResult dslSearch(final String query) throws AtlasServiceException {
MultivaluedMap<String, String> queryParams = new MultivaluedMapImpl();
queryParams.add(QUERY, query);
return callAPI(DSL_SEARCH, AtlasSearchResult.class, queryParams);
}
public AtlasSearchResult dslSearchWithParams(final String query, final int limit, final int offset) throws AtlasServiceException {
MultivaluedMap<String, String> queryParams = new MultivaluedMapImpl();
queryParams.add(QUERY, query);
queryParams.add(LIMIT, String.valueOf(limit));
queryParams.add(OFFSET, String.valueOf(offset));
return callAPI(DSL_SEARCH, AtlasSearchResult.class, queryParams);
}
public AtlasSearchResult fullTextSearch(final String query) throws AtlasServiceException {
MultivaluedMap<String, String> queryParams = new MultivaluedMapImpl();
queryParams.add(QUERY, query);
return callAPI(FULL_TEXT_SEARCH, AtlasSearchResult.class, queryParams);
}
public AtlasSearchResult fullTextSearchWithParams(final String query, final int limit, final int offset) throws AtlasServiceException {
MultivaluedMap<String, String> queryParams = new MultivaluedMapImpl();
queryParams.add(QUERY, query);
queryParams.add(LIMIT, String.valueOf(limit));
queryParams.add(OFFSET, String.valueOf(offset));
return callAPI(FULL_TEXT_SEARCH, AtlasSearchResult.class, queryParams);
}
}
\ No newline at end of file
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.atlas;
import java.util.List;
import java.util.Map;
import javax.ws.rs.HttpMethod;
import javax.ws.rs.core.MultivaluedMap;
import javax.ws.rs.core.Response;
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.AtlasEntity.AtlasEntitiesWithExtInfo;
import org.apache.atlas.model.instance.AtlasEntity.AtlasEntityWithExtInfo;
import org.apache.atlas.model.instance.EntityMutationResponse;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.configuration.Configuration;
import org.apache.hadoop.security.UserGroupInformation;
import com.google.common.annotations.VisibleForTesting;
import com.sun.jersey.api.client.WebResource;
import com.sun.jersey.core.util.MultivaluedMapImpl;
public class AtlasEntitiesClientV2 extends AtlasBaseClient {
public static final String ENTITY_API = BASE_URI + "v2/entity/";
private static final APIInfo GET_ENTITY_BY_GUID = new APIInfo(ENTITY_API + "guid/%s", HttpMethod.GET, Response.Status.OK);
private static final APIInfo GET_ENTITY_BY_ATTRIBUTE = new APIInfo(ENTITY_API + "uniqueAttribute/type/%s", HttpMethod.GET, Response.Status.OK);
public static final APIInfo CREATE_ENTITY = new APIInfo(ENTITY_API, HttpMethod.POST, Response.Status.OK);
public static final APIInfo UPDATE_ENTITY = CREATE_ENTITY;
public static final APIInfo UPDATE_ENTITY_BY_ATTRIBUTE = new APIInfo(ENTITY_API + "uniqueAttribute/type/%s", HttpMethod.PUT, Response.Status.OK);
private static final APIInfo DELETE_ENTITY_BY_GUID = new APIInfo(ENTITY_API + "guid/%s", HttpMethod.DELETE, Response.Status.OK);
public static final APIInfo DELETE_ENTITY_BY_ATTRIBUTE = new APIInfo(ENTITY_API + "uniqueAttribute/type/%s", HttpMethod.DELETE, Response.Status.OK);
private static final APIInfo GET_ENTITIES_BY_GUIDS = new APIInfo(ENTITY_API + "bulk/", HttpMethod.GET, Response.Status.OK);
private static final APIInfo CREATE_ENTITIES = new APIInfo(ENTITY_API + "bulk/", HttpMethod.POST, Response.Status.OK);
private static final APIInfo UPDATE_ENTITIES = CREATE_ENTITIES;
private static final APIInfo DELETE_ENTITIES_BY_GUIDS = new APIInfo(ENTITY_API + "bulk/", 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.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);
public static final String PREFIX_ATTR = "attr:";
public AtlasEntitiesClientV2(String[] baseUrl, String[] basicAuthUserNamePassword) {
super(baseUrl, basicAuthUserNamePassword);
}
public AtlasEntitiesClientV2(String... baseUrls) throws AtlasException {
super(baseUrls);
}
public AtlasEntitiesClientV2(UserGroupInformation ugi, String doAsUser, String... baseUrls) {
super(ugi, doAsUser, baseUrls);
}
protected AtlasEntitiesClientV2() {
super();
}
@VisibleForTesting
AtlasEntitiesClientV2(WebResource service, Configuration configuration) {
super(service, configuration);
}
public AtlasEntityWithExtInfo getEntityByGuid(String guid) throws AtlasServiceException {
return callAPI(formatPathForPathParams(GET_ENTITY_BY_GUID, guid), AtlasEntityWithExtInfo.class, null);
}
public AtlasEntityWithExtInfo getEntityByAttribute(String type, Map<String, String> attributes) throws AtlasServiceException {
MultivaluedMap<String, String> queryParams = attributesToQueryParams(attributes);
return callAPI(formatPathForPathParams(GET_ENTITY_BY_ATTRIBUTE, type), AtlasEntityWithExtInfo.class, queryParams);
}
public EntityMutationResponse updateEntityByAttribute(String type, Map<String, String> attributes, AtlasEntity entity) throws AtlasServiceException {
MultivaluedMap<String, String> queryParams = attributesToQueryParams(attributes);
return callAPI(formatPathForPathParams(UPDATE_ENTITY_BY_ATTRIBUTE, type), entity, EntityMutationResponse.class, queryParams);
}
public EntityMutationResponse deleteEntityByAttribute(String type, Map<String, String> attributes) throws AtlasServiceException {
MultivaluedMap<String, String> queryParams = attributesToQueryParams(attributes);
return callAPI(formatPathForPathParams(DELETE_ENTITY_BY_ATTRIBUTE, type), null, EntityMutationResponse.class, queryParams);
}
public EntityMutationResponse createEntity(AtlasEntityWithExtInfo entity) throws AtlasServiceException {
return callAPI(CREATE_ENTITY, entity, EntityMutationResponse.class);
}
public EntityMutationResponse updateEntity(AtlasEntityWithExtInfo entity) throws AtlasServiceException {
return callAPI(UPDATE_ENTITY, entity, EntityMutationResponse.class);
}
public EntityMutationResponse deleteEntityByGuid(String guid) throws AtlasServiceException {
return callAPI(formatPathForPathParams(DELETE_ENTITY_BY_GUID, guid), EntityMutationResponse.class, null);
}
public AtlasEntitiesWithExtInfo getEntitiesByGuids(List<String> guids) throws AtlasServiceException {
MultivaluedMap<String, String> queryParams = new MultivaluedMapImpl();
queryParams.put("guid", guids);
return callAPI(GET_ENTITIES_BY_GUIDS, AtlasEntitiesWithExtInfo.class, queryParams);
}
public EntityMutationResponse createEntities(AtlasEntitiesWithExtInfo atlasEntities) throws AtlasServiceException {
return callAPI(CREATE_ENTITIES, atlasEntities, EntityMutationResponse.class);
}
public EntityMutationResponse updateEntities(AtlasEntitiesWithExtInfo atlasEntities) throws AtlasServiceException {
return callAPI(UPDATE_ENTITIES, atlasEntities, EntityMutationResponse.class);
}
public EntityMutationResponse deleteEntitiesByGuids(List<String> guids) throws AtlasServiceException {
return callAPI(DELETE_ENTITIES_BY_GUIDS, EntityMutationResponse.class, "guid", guids);
}
public AtlasClassifications getClassifications(String guid) throws AtlasServiceException {
return callAPI(formatPathForPathParams(GET_CLASSIFICATIONS, guid), null, AtlasClassifications.class);
}
public void addClassifications(String guid, List<AtlasClassification> classifications) throws AtlasServiceException {
callAPI(formatPathForPathParams(ADD_CLASSIFICATIONS, guid), classifications, (Class<?>)null, (String[]) null);
}
public void updateClassifications(String guid, List<AtlasClassification> classifications) throws AtlasServiceException {
callAPI(formatPathForPathParams(UPDATE_CLASSIFICATIONS, guid), classifications, AtlasClassifications.class);
}
public void deleteClassifications(String guid, List<AtlasClassification> classifications) throws AtlasServiceException {
callAPI(formatPathForPathParams(GET_CLASSIFICATIONS, guid), classifications, AtlasClassifications.class);
}
public void deleteClassification(String guid, String classificationName) throws AtlasServiceException {
callAPI(formatPathForPathParams(DELETE_CLASSIFICATION, guid, classificationName), null, null);
}
// Entities operations
public List<AtlasEntity> getEntities(List<String> entityIds) {
// TODO Map the query params correctly
return null;
}
private MultivaluedMap<String, String> attributesToQueryParams(Map<String, String> attributes) {
return attributesToQueryParams(attributes, null);
}
private MultivaluedMap<String, String> attributesToQueryParams(Map<String, String> attributes,
MultivaluedMap<String, String> queryParams) {
if (queryParams == null) {
queryParams = new MultivaluedMapImpl();
}
if (MapUtils.isNotEmpty(attributes)) {
for (Map.Entry<String, String> e : attributes.entrySet()) {
queryParams.putSingle(PREFIX_ATTR + e.getKey(), e.getValue());
}
}
return queryParams;
}
}
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.atlas;
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.lineage.AtlasLineageInfo;
import org.apache.atlas.model.lineage.AtlasLineageInfo.LineageDirection;
import org.apache.commons.configuration.Configuration;
import org.apache.hadoop.security.UserGroupInformation;
import javax.ws.rs.HttpMethod;
import javax.ws.rs.core.MultivaluedMap;
import javax.ws.rs.core.Response;
public class AtlasLineageClientV2 extends AtlasBaseClient {
private static final String LINEAGE_URI = BASE_URI + "v2/lineage/%s/";
private static final APIInfo LINEAGE_INFO = new APIInfo(LINEAGE_URI, HttpMethod.GET, Response.Status.OK);
public AtlasLineageClientV2(String[] baseUrl, String[] basicAuthUserNamePassword) {
super(baseUrl, basicAuthUserNamePassword);
}
public AtlasLineageClientV2(String... baseUrls) throws AtlasException {
super(baseUrls);
}
public AtlasLineageClientV2(UserGroupInformation ugi, String doAsUser, String... baseUrls) {
super(ugi, doAsUser, baseUrls);
}
protected AtlasLineageClientV2() {
super();
}
@VisibleForTesting
AtlasLineageClientV2(WebResource service, Configuration configuration) {
super(service, configuration);
}
public AtlasLineageInfo getLineageInfo(final String guid, final LineageDirection direction, final int depth) throws AtlasServiceException {
MultivaluedMap<String, String> queryParams = new MultivaluedMapImpl();
queryParams.add("direction", direction.toString());
queryParams.add("depth", String.valueOf(depth));
return callAPI(formatPathForPathParams(LINEAGE_INFO, guid), AtlasLineageInfo.class, queryParams);
}
}
\ No newline at end of file
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.atlas;
import com.google.common.annotations.VisibleForTesting;
import com.sun.jersey.api.client.WebResource;
import org.apache.atlas.model.SearchFilter;
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.type.AtlasType;
import org.apache.commons.configuration.Configuration;
import org.apache.hadoop.security.UserGroupInformation;
import javax.ws.rs.HttpMethod;
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);
private static final APIInfo DELETE_ALL_TYPE_DEFS = new APIInfo(TYPEDEFS_PATH, HttpMethod.DELETE, Response.Status.OK);
public AtlasTypedefClientV2(String[] baseUrl, String[] basicAuthUserNamePassword) {
super(baseUrl, basicAuthUserNamePassword);
}
public AtlasTypedefClientV2(String... baseUrls) throws AtlasException {
super(baseUrls);
}
public AtlasTypedefClientV2(UserGroupInformation ugi, String doAsUser, String... baseUrls) {
super(ugi, doAsUser, baseUrls);
}
protected AtlasTypedefClientV2() {
super();
}
@VisibleForTesting
AtlasTypedefClientV2(WebResource service, Configuration configuration) {
super(service, configuration);
}
/**
* Bulk retrieval API for retrieving all type definitions in Atlas
*
* @return A composite wrapper object with lists of all type definitions
*/
public AtlasTypesDef getAllTypeDefs(SearchFilter searchFilter) throws AtlasServiceException {
return callAPI(GET_ALL_TYPE_DEFS, AtlasTypesDef.class, searchFilter.getParams());
}
public AtlasEnumDef getEnumByName(final String name) throws AtlasServiceException {
return getTypeDefByName(name, AtlasEnumDef.class);
}
public AtlasEnumDef getEnumByGuid(final String guid) throws AtlasServiceException {
return getTypeDefByGuid(guid, AtlasEnumDef.class);
}
public AtlasStructDef getStructByName(final String name) throws AtlasServiceException {
return getTypeDefByName(name, AtlasStructDef.class);
}
public AtlasStructDef getStructByGuid(final String guid) throws AtlasServiceException {
return getTypeDefByGuid(guid, AtlasStructDef.class);
}
public AtlasClassificationDef getClassificationByName(final String name) throws AtlasServiceException {
return getTypeDefByName(name, AtlasClassificationDef.class);
}
public AtlasClassificationDef getClassificationByGuid(final String guid) throws AtlasServiceException {
return getTypeDefByGuid(guid, AtlasClassificationDef.class);
}
public AtlasEntityDef getEntityByName(final String name) throws AtlasServiceException {
return getTypeDefByName(name, AtlasEntityDef.class);
}
public AtlasEntityDef getEntityByGuid(final String guid) throws AtlasServiceException {
return getTypeDefByGuid(guid, AtlasEntityDef.class);
}
@Deprecated
public AtlasEnumDef createEnumDef(AtlasEnumDef enumDef) throws AtlasServiceException {
AtlasTypesDef atlasTypesDef = new AtlasTypesDef();
atlasTypesDef.getEnumDefs().add(enumDef);
AtlasTypesDef created = createAtlasTypeDefs(atlasTypesDef);
assert created != null;
assert created.getEnumDefs() != null;
return created.getEnumDefs().get(0);
}
@Deprecated
public AtlasStructDef createStructDef(AtlasStructDef structDef) throws AtlasServiceException {
AtlasTypesDef atlasTypesDef = new AtlasTypesDef();
atlasTypesDef.getStructDefs().add(structDef);
AtlasTypesDef created = createAtlasTypeDefs(atlasTypesDef);
assert created != null;
assert created.getStructDefs() != null;
return created.getStructDefs().get(0);
}
@Deprecated
public AtlasEntityDef createEntityDef(AtlasEntityDef entityDef) throws AtlasServiceException {
AtlasTypesDef atlasTypesDef = new AtlasTypesDef();
atlasTypesDef.getEntityDefs().add(entityDef);
AtlasTypesDef created = createAtlasTypeDefs(atlasTypesDef);
assert created != null;
assert created.getEntityDefs() != null;
return created.getEntityDefs().get(0);
}
@Deprecated
public AtlasClassificationDef createClassificationDef(AtlasClassificationDef classificationDef)
throws AtlasServiceException {
AtlasTypesDef atlasTypesDef = new AtlasTypesDef();
atlasTypesDef.getClassificationDefs().add(classificationDef);
AtlasTypesDef created = createAtlasTypeDefs(atlasTypesDef);
assert created != null;
assert created.getClassificationDefs() != null;
return created.getClassificationDefs().get(0);
}
/**
* Bulk create APIs for all atlas type definitions, only new definitions will be created.
* Any changes to the existing definitions will be discarded
*
* @param typesDef A composite wrapper object with corresponding lists of the type definition
* @return A composite wrapper object with lists of type definitions that were successfully
* created
*/
public AtlasTypesDef createAtlasTypeDefs(final AtlasTypesDef typesDef) throws AtlasServiceException {
return callAPI(CREATE_ALL_TYPE_DEFS, AtlasType.toJson(typesDef), AtlasTypesDef.class);
}
/**
* Bulk update API for all types, changes detected in the type definitions would be persisted
*
* @param typesDef A composite object that captures all type definition changes
* @return A composite object with lists of type definitions that were updated
*/
public AtlasTypesDef updateAtlasTypeDefs(final AtlasTypesDef typesDef) throws AtlasServiceException {
return callAPI(UPDATE_ALL_TYPE_DEFS, AtlasType.toJson(typesDef), AtlasTypesDef.class);
}
/**
* Bulk delete API for all types
*
* @param typesDef A composite object that captures all types to be deleted
*/
public void deleteAtlasTypeDefs(final AtlasTypesDef typesDef) throws AtlasServiceException {
callAPI(DELETE_ALL_TYPE_DEFS, AtlasType.toJson(typesDef), AtlasTypesDef.class);
}
private <T> T getTypeDefByName(final String name, Class<T> typeDefClass) throws AtlasServiceException {
String atlasPath = getAtlasPath(typeDefClass);
APIInfo apiInfo = new APIInfo(String.format(GET_BY_NAME_TEMPLATE, atlasPath, name), HttpMethod.GET, Response.Status.OK);
return callAPI(apiInfo, null, typeDefClass);
}
private <T> T getTypeDefByGuid(final String guid, Class<T> typeDefClass) throws AtlasServiceException {
String atlasPath = getAtlasPath(typeDefClass);
APIInfo apiInfo = new APIInfo(String.format(GET_BY_GUID_TEMPLATE, atlasPath, guid), HttpMethod.GET, Response.Status.OK);
return callAPI(apiInfo, null, typeDefClass);
}
private <T> String getAtlasPath(Class<T> typeDefClass) {
if (typeDefClass.isAssignableFrom(AtlasEnumDef.class)) {
return "enumdef";
} else if (typeDefClass.isAssignableFrom(AtlasEntityDef.class)) {
return "entitydef";
} else if (typeDefClass.isAssignableFrom(AtlasClassificationDef.class)) {
return "classificationdef";
} else if (typeDefClass.isAssignableFrom(AtlasStructDef.class)) {
return "structdef";
}
// Code should never reach this pion
return "";
}
}
...@@ -24,18 +24,18 @@ import com.google.common.collect.ImmutableSet; ...@@ -24,18 +24,18 @@ import com.google.common.collect.ImmutableSet;
import com.sun.jersey.core.util.MultivaluedMapImpl; import com.sun.jersey.core.util.MultivaluedMapImpl;
import org.apache.atlas.ApplicationProperties; import org.apache.atlas.ApplicationProperties;
import org.apache.atlas.AtlasClient; import org.apache.atlas.AtlasClient;
import org.apache.atlas.AtlasDiscoveryClientV2; import org.apache.atlas.AtlasClientV2;
import org.apache.atlas.AtlasEntitiesClientV2;
import org.apache.atlas.AtlasException; import org.apache.atlas.AtlasException;
import org.apache.atlas.AtlasLineageClientV2;
import org.apache.atlas.AtlasServiceException; import org.apache.atlas.AtlasServiceException;
import org.apache.atlas.AtlasTypedefClientV2;
import org.apache.atlas.model.SearchFilter; import org.apache.atlas.model.SearchFilter;
import org.apache.atlas.model.discovery.AtlasSearchResult; import org.apache.atlas.model.discovery.AtlasSearchResult;
import org.apache.atlas.model.discovery.AtlasSearchResult.AtlasFullTextResult; import org.apache.atlas.model.discovery.AtlasSearchResult.AtlasFullTextResult;
import org.apache.atlas.model.discovery.AtlasSearchResult.AttributeSearchResult; import org.apache.atlas.model.discovery.AtlasSearchResult.AttributeSearchResult;
import org.apache.atlas.model.instance.*; import org.apache.atlas.model.instance.AtlasClassification;
import org.apache.atlas.model.instance.AtlasEntity;
import org.apache.atlas.model.instance.AtlasEntity.AtlasEntityWithExtInfo; import org.apache.atlas.model.instance.AtlasEntity.AtlasEntityWithExtInfo;
import org.apache.atlas.model.instance.AtlasEntityHeader;
import org.apache.atlas.model.instance.EntityMutationResponse;
import org.apache.atlas.model.instance.EntityMutations.EntityOperation; import org.apache.atlas.model.instance.EntityMutations.EntityOperation;
import org.apache.atlas.model.lineage.AtlasLineageInfo; import org.apache.atlas.model.lineage.AtlasLineageInfo;
import org.apache.atlas.model.lineage.AtlasLineageInfo.LineageDirection; import org.apache.atlas.model.lineage.AtlasLineageInfo.LineageDirection;
...@@ -53,11 +53,15 @@ import org.apache.commons.configuration.Configuration; ...@@ -53,11 +53,15 @@ import org.apache.commons.configuration.Configuration;
import org.apache.commons.lang.ArrayUtils; import org.apache.commons.lang.ArrayUtils;
import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.core.MultivaluedMap;
import java.util.*; import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import static org.apache.atlas.model.typedef.AtlasStructDef.AtlasConstraintDef.CONSTRAINT_PARAM_ATTRIBUTE;
import static org.apache.atlas.model.typedef.AtlasStructDef.AtlasConstraintDef.CONSTRAINT_TYPE_INVERSE_REF; import static org.apache.atlas.model.typedef.AtlasStructDef.AtlasConstraintDef.CONSTRAINT_TYPE_INVERSE_REF;
import static org.apache.atlas.model.typedef.AtlasStructDef.AtlasConstraintDef.CONSTRAINT_TYPE_OWNED_REF; import static org.apache.atlas.model.typedef.AtlasStructDef.AtlasConstraintDef.CONSTRAINT_TYPE_OWNED_REF;
import static org.apache.atlas.model.typedef.AtlasStructDef.AtlasConstraintDef.CONSTRAINT_PARAM_ATTRIBUTE;
/** /**
* A driver that sets up sample types and entities using v2 types and entity model for testing purposes. * A driver that sets up sample types and entities using v2 types and entity model for testing purposes.
...@@ -169,23 +173,14 @@ public class QuickStartV2 { ...@@ -169,23 +173,14 @@ public class QuickStartV2 {
return urls; return urls;
} }
private final AtlasTypedefClientV2 typesClient; private final AtlasClientV2 atlasClientV2;
private final AtlasEntitiesClientV2 entitiesClient;
private final AtlasDiscoveryClientV2 discoveryClient;
private final AtlasLineageClientV2 lineageClient;
QuickStartV2(String[] urls, String[] basicAuthUsernamePassword) { QuickStartV2(String[] urls, String[] basicAuthUsernamePassword) {
typesClient = new AtlasTypedefClientV2(urls,basicAuthUsernamePassword); atlasClientV2 = new AtlasClientV2(urls,basicAuthUsernamePassword);
entitiesClient = new AtlasEntitiesClientV2(urls,basicAuthUsernamePassword);
discoveryClient = new AtlasDiscoveryClientV2(urls,basicAuthUsernamePassword);
lineageClient = new AtlasLineageClientV2(urls,basicAuthUsernamePassword);
} }
QuickStartV2(String[] urls) throws AtlasException { QuickStartV2(String[] urls) throws AtlasException {
typesClient = new AtlasTypedefClientV2(urls); atlasClientV2 = new AtlasClientV2(urls);
entitiesClient = new AtlasEntitiesClientV2(urls);
discoveryClient = new AtlasDiscoveryClientV2(urls);
lineageClient = new AtlasLineageClientV2(urls);
} }
...@@ -193,7 +188,7 @@ public class QuickStartV2 { ...@@ -193,7 +188,7 @@ public class QuickStartV2 {
AtlasTypesDef atlasTypesDef = createTypeDefinitions(); AtlasTypesDef atlasTypesDef = createTypeDefinitions();
System.out.println("\nCreating sample types: "); System.out.println("\nCreating sample types: ");
typesClient.createAtlasTypeDefs(atlasTypesDef); atlasClientV2.createAtlasTypeDefs(atlasTypesDef);
verifyTypesCreated(); verifyTypesCreated();
} }
...@@ -341,11 +336,11 @@ public class QuickStartV2 { ...@@ -341,11 +336,11 @@ public class QuickStartV2 {
private AtlasEntity createInstance(AtlasEntity entity, String[] traitNames) throws Exception { private AtlasEntity createInstance(AtlasEntity entity, String[] traitNames) throws Exception {
AtlasEntity ret = null; AtlasEntity ret = null;
EntityMutationResponse response = entitiesClient.createEntity(new AtlasEntityWithExtInfo(entity)); EntityMutationResponse response = atlasClientV2.createEntity(new AtlasEntityWithExtInfo(entity));
List<AtlasEntityHeader> entities = response.getEntitiesByOperation(EntityOperation.CREATE); List<AtlasEntityHeader> entities = response.getEntitiesByOperation(EntityOperation.CREATE);
if (CollectionUtils.isNotEmpty(entities)) { if (CollectionUtils.isNotEmpty(entities)) {
AtlasEntityWithExtInfo getByGuidResponse = entitiesClient.getEntityByGuid(entities.get(0).getGuid()); AtlasEntityWithExtInfo getByGuidResponse = atlasClientV2.getEntityByGuid(entities.get(0).getGuid());
ret = getByGuidResponse.getEntity(); ret = getByGuidResponse.getEntity();
System.out.println("Created entity of type [" + ret.getTypeName() + "], guid: " + ret.getGuid()); System.out.println("Created entity of type [" + ret.getTypeName() + "], guid: " + ret.getGuid());
} }
...@@ -463,7 +458,7 @@ public class QuickStartV2 { ...@@ -463,7 +458,7 @@ public class QuickStartV2 {
searchParams.clear(); searchParams.clear();
searchParams.add(SearchFilter.PARAM_NAME, typeName); searchParams.add(SearchFilter.PARAM_NAME, typeName);
SearchFilter searchFilter = new SearchFilter(searchParams); SearchFilter searchFilter = new SearchFilter(searchParams);
AtlasTypesDef searchDefs = typesClient.getAllTypeDefs(searchFilter); AtlasTypesDef searchDefs = atlasClientV2.getAllTypeDefs(searchFilter);
assert (!searchDefs.isEmpty()); assert (!searchDefs.isEmpty());
System.out.println("Created type [" + typeName + "]"); System.out.println("Created type [" + typeName + "]");
...@@ -516,7 +511,7 @@ public class QuickStartV2 { ...@@ -516,7 +511,7 @@ public class QuickStartV2 {
System.out.println("\nSample DSL Queries: "); System.out.println("\nSample DSL Queries: ");
for (String dslQuery : getDSLQueries()) { for (String dslQuery : getDSLQueries()) {
AtlasSearchResult results = discoveryClient.dslSearchWithParams(dslQuery, 10, 0); AtlasSearchResult results = atlasClientV2.dslSearchWithParams(dslQuery, 10, 0);
if (results != null) { if (results != null) {
List<AtlasEntityHeader> entitiesResult = results.getEntities(); List<AtlasEntityHeader> entitiesResult = results.getEntities();
...@@ -539,7 +534,7 @@ public class QuickStartV2 { ...@@ -539,7 +534,7 @@ public class QuickStartV2 {
private void lineage() throws AtlasServiceException { private void lineage() throws AtlasServiceException {
System.out.println("\nSample Lineage Info: "); System.out.println("\nSample Lineage Info: ");
AtlasLineageInfo lineageInfo = lineageClient.getLineageInfo(getTableId(SALES_FACT_DAILY_MV_TABLE), LineageDirection.BOTH, 0); AtlasLineageInfo lineageInfo = atlasClientV2.getLineageInfo(getTableId(SALES_FACT_DAILY_MV_TABLE), LineageDirection.BOTH, 0);
Set<LineageRelation> relations = lineageInfo.getRelations(); Set<LineageRelation> relations = lineageInfo.getRelations();
Map<String, AtlasEntityHeader> guidEntityMap = lineageInfo.getGuidEntityMap(); Map<String, AtlasEntityHeader> guidEntityMap = lineageInfo.getGuidEntityMap();
...@@ -556,7 +551,7 @@ public class QuickStartV2 { ...@@ -556,7 +551,7 @@ public class QuickStartV2 {
Map<String, String> attributes = new HashMap<>(); Map<String, String> attributes = new HashMap<>();
attributes.put(AtlasClient.REFERENCEABLE_ATTRIBUTE_NAME, tableName); attributes.put(AtlasClient.REFERENCEABLE_ATTRIBUTE_NAME, tableName);
AtlasEntity tableEntity = entitiesClient.getEntityByAttribute(TABLE_TYPE, attributes).getEntity(); AtlasEntity tableEntity = atlasClientV2.getEntityByAttribute(TABLE_TYPE, attributes).getEntity();
return tableEntity.getGuid(); return tableEntity.getGuid();
} }
} }
...@@ -56,10 +56,10 @@ import java.util.concurrent.Executors; ...@@ -56,10 +56,10 @@ import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicBoolean;
import static org.apache.atlas.AtlasEntitiesClientV2.CREATE_ENTITY; import static org.apache.atlas.AtlasClientV2.CREATE_ENTITY;
import static org.apache.atlas.AtlasEntitiesClientV2.DELETE_ENTITY_BY_ATTRIBUTE; import static org.apache.atlas.AtlasClientV2.DELETE_ENTITY_BY_ATTRIBUTE;
import static org.apache.atlas.AtlasEntitiesClientV2.UPDATE_ENTITY; import static org.apache.atlas.AtlasClientV2.UPDATE_ENTITY;
import static org.apache.atlas.AtlasEntitiesClientV2.UPDATE_ENTITY_BY_ATTRIBUTE; import static org.apache.atlas.AtlasClientV2.UPDATE_ENTITY_BY_ATTRIBUTE;
import static org.apache.atlas.notification.hook.HookNotification.EntityCreateRequest; import static org.apache.atlas.notification.hook.HookNotification.EntityCreateRequest;
import static org.apache.atlas.notification.hook.HookNotification.EntityDeleteRequest; import static org.apache.atlas.notification.hook.HookNotification.EntityDeleteRequest;
import static org.apache.atlas.notification.hook.HookNotification.EntityUpdateRequest; import static org.apache.atlas.notification.hook.HookNotification.EntityUpdateRequest;
......
...@@ -61,7 +61,7 @@ public class QuickStartV2IT extends BaseResourceIT { ...@@ -61,7 +61,7 @@ public class QuickStartV2IT extends BaseResourceIT {
private AtlasEntity getDB(String dbName) throws AtlasServiceException, JSONException { private AtlasEntity getDB(String dbName) throws AtlasServiceException, JSONException {
Map<String, String> attributes = new HashMap<>(); Map<String, String> attributes = new HashMap<>();
attributes.put("name", dbName); attributes.put("name", dbName);
AtlasEntity dbEntity = entitiesClientV2.getEntityByAttribute(QuickStartV2.DATABASE_TYPE, attributes).getEntity(); AtlasEntity dbEntity = atlasClientV2.getEntityByAttribute(QuickStartV2.DATABASE_TYPE, attributes).getEntity();
return dbEntity; return dbEntity;
} }
...@@ -80,20 +80,20 @@ public class QuickStartV2IT extends BaseResourceIT { ...@@ -80,20 +80,20 @@ public class QuickStartV2IT extends BaseResourceIT {
private AtlasEntity getTable(String tableName) throws AtlasServiceException { private AtlasEntity getTable(String tableName) throws AtlasServiceException {
Map<String, String> attributes = new HashMap<>(); Map<String, String> attributes = new HashMap<>();
attributes.put(AtlasClient.REFERENCEABLE_ATTRIBUTE_NAME, tableName); attributes.put(AtlasClient.REFERENCEABLE_ATTRIBUTE_NAME, tableName);
AtlasEntity tableEntity = entitiesClientV2.getEntityByAttribute(QuickStartV2.TABLE_TYPE, attributes).getEntity(); AtlasEntity tableEntity = atlasClientV2.getEntityByAttribute(QuickStartV2.TABLE_TYPE, attributes).getEntity();
return tableEntity; return tableEntity;
} }
private AtlasEntity getProcess(String processName) throws AtlasServiceException { private AtlasEntity getProcess(String processName) throws AtlasServiceException {
Map<String, String> attributes = new HashMap<>(); Map<String, String> attributes = new HashMap<>();
attributes.put(AtlasClient.REFERENCEABLE_ATTRIBUTE_NAME, processName); attributes.put(AtlasClient.REFERENCEABLE_ATTRIBUTE_NAME, processName);
AtlasEntity processEntity = entitiesClientV2.getEntityByAttribute(QuickStartV2.LOAD_PROCESS_TYPE, attributes).getEntity(); AtlasEntity processEntity = atlasClientV2.getEntityByAttribute(QuickStartV2.LOAD_PROCESS_TYPE, attributes).getEntity();
return processEntity; return processEntity;
} }
private void verifyTrait(AtlasEntity table) throws AtlasServiceException { private void verifyTrait(AtlasEntity table) throws AtlasServiceException {
AtlasClassification.AtlasClassifications classfications = entitiesClientV2.getClassifications(table.getGuid()); AtlasClassification.AtlasClassifications classfications = atlasClientV2.getClassifications(table.getGuid());
List<AtlasClassification> traits = classfications.getList(); List<AtlasClassification> traits = classfications.getList();
assertNotNull(traits.get(0).getTypeName()); assertNotNull(traits.get(0).getTypeName());
} }
...@@ -126,7 +126,7 @@ public class QuickStartV2IT extends BaseResourceIT { ...@@ -126,7 +126,7 @@ public class QuickStartV2IT extends BaseResourceIT {
public void testProcessIsAdded() throws AtlasServiceException, JSONException { public void testProcessIsAdded() throws AtlasServiceException, JSONException {
Map<String, String> attributes = new HashMap<>(); Map<String, String> attributes = new HashMap<>();
attributes.put(AtlasClient.REFERENCEABLE_ATTRIBUTE_NAME, QuickStartV2.LOAD_SALES_DAILY_PROCESS); attributes.put(AtlasClient.REFERENCEABLE_ATTRIBUTE_NAME, QuickStartV2.LOAD_SALES_DAILY_PROCESS);
AtlasEntity loadProcess = entitiesClientV2.getEntityByAttribute(QuickStartV2.LOAD_PROCESS_TYPE, attributes).getEntity(); AtlasEntity loadProcess = atlasClientV2.getEntityByAttribute(QuickStartV2.LOAD_PROCESS_TYPE, attributes).getEntity();
Map loadProcessAttribs = loadProcess.getAttributes(); Map loadProcessAttribs = loadProcess.getAttributes();
assertEquals(QuickStartV2.LOAD_SALES_DAILY_PROCESS, loadProcessAttribs.get(AtlasClient.NAME)); assertEquals(QuickStartV2.LOAD_SALES_DAILY_PROCESS, loadProcessAttribs.get(AtlasClient.NAME));
...@@ -162,7 +162,7 @@ public class QuickStartV2IT extends BaseResourceIT { ...@@ -162,7 +162,7 @@ public class QuickStartV2IT extends BaseResourceIT {
String salesDailyProcessId = getProcessId(QuickStartV2.LOAD_SALES_DAILY_PROCESS); String salesDailyProcessId = getProcessId(QuickStartV2.LOAD_SALES_DAILY_PROCESS);
String salesMonthlyProcessId = getProcessId(QuickStartV2.LOAD_SALES_MONTHLY_PROCESS); String salesMonthlyProcessId = getProcessId(QuickStartV2.LOAD_SALES_MONTHLY_PROCESS);
AtlasLineageInfo inputLineage = lineageClientV2.getLineageInfo(salesFactDailyMVId, LineageDirection.BOTH, 0); AtlasLineageInfo inputLineage = atlasClientV2.getLineageInfo(salesFactDailyMVId, LineageDirection.BOTH, 0);
List<LineageRelation> relations = new ArrayList<>(inputLineage.getRelations()); List<LineageRelation> relations = new ArrayList<>(inputLineage.getRelations());
Map<String, AtlasEntityHeader> entityMap = inputLineage.getGuidEntityMap(); Map<String, AtlasEntityHeader> entityMap = inputLineage.getGuidEntityMap();
...@@ -181,7 +181,7 @@ public class QuickStartV2IT extends BaseResourceIT { ...@@ -181,7 +181,7 @@ public class QuickStartV2IT extends BaseResourceIT {
public void testViewIsAdded() throws AtlasServiceException, JSONException { public void testViewIsAdded() throws AtlasServiceException, JSONException {
Map<String, String> attributes = new HashMap<>(); Map<String, String> attributes = new HashMap<>();
attributes.put(AtlasClient.REFERENCEABLE_ATTRIBUTE_NAME, QuickStartV2.PRODUCT_DIM_VIEW); attributes.put(AtlasClient.REFERENCEABLE_ATTRIBUTE_NAME, QuickStartV2.PRODUCT_DIM_VIEW);
AtlasEntity view = entitiesClientV2.getEntityByAttribute(QuickStartV2.VIEW_TYPE, attributes).getEntity(); AtlasEntity view = atlasClientV2.getEntityByAttribute(QuickStartV2.VIEW_TYPE, attributes).getEntity();
Map<String, Object> viewAttributes = view.getAttributes(); Map<String, Object> viewAttributes = view.getAttributes();
assertEquals(QuickStartV2.PRODUCT_DIM_VIEW, viewAttributes.get(AtlasClient.NAME)); assertEquals(QuickStartV2.PRODUCT_DIM_VIEW, viewAttributes.get(AtlasClient.NAME));
......
...@@ -63,7 +63,7 @@ public class EntityDiscoveryJerseyResourceIT extends BaseResourceIT { ...@@ -63,7 +63,7 @@ public class EntityDiscoveryJerseyResourceIT extends BaseResourceIT {
public void testSearchByDSL() throws Exception { public void testSearchByDSL() throws Exception {
String dslQuery = "from "+ DATABASE_TYPE_BUILTIN + " " + QUALIFIED_NAME + "=\"" + dbName + "\""; String dslQuery = "from "+ DATABASE_TYPE_BUILTIN + " " + QUALIFIED_NAME + "=\"" + dbName + "\"";
AtlasSearchResult searchResult = discoveryClientV2.dslSearch(dslQuery); AtlasSearchResult searchResult = atlasClientV2.dslSearch(dslQuery);
assertNotNull(searchResult); assertNotNull(searchResult);
assertEquals(searchResult.getQueryText(), dslQuery); assertEquals(searchResult.getQueryText(), dslQuery);
assertEquals(searchResult.getQueryType(), AtlasQueryType.DSL); assertEquals(searchResult.getQueryType(), AtlasQueryType.DSL);
...@@ -84,48 +84,48 @@ public class EntityDiscoveryJerseyResourceIT extends BaseResourceIT { ...@@ -84,48 +84,48 @@ public class EntityDiscoveryJerseyResourceIT extends BaseResourceIT {
@Test @Test
public void testSearchDSLLimits() throws Exception { public void testSearchDSLLimits() throws Exception {
String dslQuery = "from "+ DATABASE_TYPE_BUILTIN + " " + QUALIFIED_NAME + "=\"" + dbName + "\""; String dslQuery = "from "+ DATABASE_TYPE_BUILTIN + " " + QUALIFIED_NAME + "=\"" + dbName + "\"";
AtlasSearchResult searchResult = discoveryClientV2.dslSearch(dslQuery); AtlasSearchResult searchResult = atlasClientV2.dslSearch(dslQuery);
assertNotNull(searchResult); assertNotNull(searchResult);
//higher limit, all results returned //higher limit, all results returned
searchResult = discoveryClientV2.dslSearchWithParams(dslQuery, 10, 0); searchResult = atlasClientV2.dslSearchWithParams(dslQuery, 10, 0);
assertEquals(searchResult.getEntities().size(), 1); assertEquals(searchResult.getEntities().size(), 1);
//default limit and offset -1, all results returned //default limit and offset -1, all results returned
searchResult = discoveryClientV2.dslSearchWithParams(dslQuery, -1, -1); searchResult = atlasClientV2.dslSearchWithParams(dslQuery, -1, -1);
assertEquals(searchResult.getEntities().size(), 1); assertEquals(searchResult.getEntities().size(), 1);
//uses the limit parameter passed //uses the limit parameter passed
searchResult = discoveryClientV2.dslSearchWithParams(dslQuery, 1, 0); searchResult = atlasClientV2.dslSearchWithParams(dslQuery, 1, 0);
assertEquals(searchResult.getEntities().size(), 1); assertEquals(searchResult.getEntities().size(), 1);
//uses the offset parameter passed //uses the offset parameter passed
searchResult = discoveryClientV2.dslSearchWithParams(dslQuery, 10, 1); searchResult = atlasClientV2.dslSearchWithParams(dslQuery, 10, 1);
assertNull(searchResult.getEntities()); assertNull(searchResult.getEntities());
//limit > 0 //limit > 0
searchResult = discoveryClientV2.dslSearchWithParams(dslQuery, 0, 10); searchResult = atlasClientV2.dslSearchWithParams(dslQuery, 0, 10);
assertNull(searchResult.getEntities()); assertNull(searchResult.getEntities());
//limit > maxlimit //limit > maxlimit
searchResult = discoveryClientV2.dslSearchWithParams(dslQuery, Integer.MAX_VALUE, 10); searchResult = atlasClientV2.dslSearchWithParams(dslQuery, Integer.MAX_VALUE, 10);
assertNull(searchResult.getEntities()); assertNull(searchResult.getEntities());
//offset >= 0 //offset >= 0
searchResult = discoveryClientV2.dslSearchWithParams(dslQuery, 10, -2); searchResult = atlasClientV2.dslSearchWithParams(dslQuery, 10, -2);
assertEquals(searchResult.getEntities().size(), 1); assertEquals(searchResult.getEntities().size(), 1);
} }
@Test(expectedExceptions = AtlasServiceException.class) @Test(expectedExceptions = AtlasServiceException.class)
public void testSearchByDSLForUnknownType() throws Exception { public void testSearchByDSLForUnknownType() throws Exception {
String dslQuery = "from blah"; String dslQuery = "from blah";
discoveryClientV2.dslSearch(dslQuery); atlasClientV2.dslSearch(dslQuery);
} }
@Test @Test
public void testSearchUsingDSL() throws Exception { public void testSearchUsingDSL() throws Exception {
String query = "from "+ DATABASE_TYPE_BUILTIN + " " + QUALIFIED_NAME + "=\"" + dbName + "\""; String query = "from "+ DATABASE_TYPE_BUILTIN + " " + QUALIFIED_NAME + "=\"" + dbName + "\"";
AtlasSearchResult searchResult = discoveryClientV2.dslSearch(query); AtlasSearchResult searchResult = atlasClientV2.dslSearch(query);
assertNotNull(searchResult); assertNotNull(searchResult);
assertEquals(searchResult.getQueryText(), query); assertEquals(searchResult.getQueryText(), query);
...@@ -147,7 +147,7 @@ public class EntityDiscoveryJerseyResourceIT extends BaseResourceIT { ...@@ -147,7 +147,7 @@ public class EntityDiscoveryJerseyResourceIT extends BaseResourceIT {
@Test @Test
public void testSearchFullTextOnDSLFailure() throws Exception { public void testSearchFullTextOnDSLFailure() throws Exception {
String query = "*"; String query = "*";
AtlasSearchResult searchResult = discoveryClientV2.fullTextSearch(query); AtlasSearchResult searchResult = atlasClientV2.fullTextSearch(query);
assertNotNull(searchResult); assertNotNull(searchResult);
assertEquals(searchResult.getQueryText(), query); assertEquals(searchResult.getQueryText(), query);
assertEquals(searchResult.getQueryType(), AtlasQueryType.FULL_TEXT); assertEquals(searchResult.getQueryType(), AtlasQueryType.FULL_TEXT);
...@@ -155,7 +155,7 @@ public class EntityDiscoveryJerseyResourceIT extends BaseResourceIT { ...@@ -155,7 +155,7 @@ public class EntityDiscoveryJerseyResourceIT extends BaseResourceIT {
@Test(dependsOnMethods = "testSearchDSLLimits") @Test(dependsOnMethods = "testSearchDSLLimits")
public void testSearchUsingFullText() throws Exception { public void testSearchUsingFullText() throws Exception {
AtlasSearchResult searchResult = discoveryClientV2.fullTextSearchWithParams(dbName, 10, 0); AtlasSearchResult searchResult = atlasClientV2.fullTextSearchWithParams(dbName, 10, 0);
assertNotNull(searchResult); assertNotNull(searchResult);
assertEquals(searchResult.getQueryText(), dbName); assertEquals(searchResult.getQueryText(), dbName);
...@@ -173,25 +173,25 @@ public class EntityDiscoveryJerseyResourceIT extends BaseResourceIT { ...@@ -173,25 +173,25 @@ public class EntityDiscoveryJerseyResourceIT extends BaseResourceIT {
String query = dbName; String query = dbName;
MultivaluedMap<String, String> queryParams = new MultivaluedMapImpl(); MultivaluedMap<String, String> queryParams = new MultivaluedMapImpl();
queryParams.add("query", query); queryParams.add("query", query);
searchResult = discoveryClientV2.fullTextSearch(query); searchResult = atlasClientV2.fullTextSearch(query);
assertNotNull(searchResult); assertNotNull(searchResult);
assertEquals(searchResult.getFullTextResult().size(), 1); assertEquals(searchResult.getFullTextResult().size(), 1);
//verify passed in limits and offsets are used //verify passed in limits and offsets are used
//higher limit and 0 offset returns all results //higher limit and 0 offset returns all results
searchResult = discoveryClientV2.fullTextSearchWithParams(query, 10, 0); searchResult = atlasClientV2.fullTextSearchWithParams(query, 10, 0);
assertEquals(searchResult.getFullTextResult().size(), 1); assertEquals(searchResult.getFullTextResult().size(), 1);
//offset is used //offset is used
searchResult = discoveryClientV2.fullTextSearchWithParams(query, 10, 1); searchResult = atlasClientV2.fullTextSearchWithParams(query, 10, 1);
assertEquals(searchResult.getFullTextResult().size(), 1); assertEquals(searchResult.getFullTextResult().size(), 1);
//limit is used //limit is used
searchResult = discoveryClientV2.fullTextSearchWithParams(query, 1, 0); searchResult = atlasClientV2.fullTextSearchWithParams(query, 1, 0);
assertEquals(searchResult.getFullTextResult().size(), 1); assertEquals(searchResult.getFullTextResult().size(), 1);
//higher offset returns 0 results //higher offset returns 0 results
searchResult = discoveryClientV2.fullTextSearchWithParams(query, 1, 2); searchResult = atlasClientV2.fullTextSearchWithParams(query, 1, 2);
assertEquals(searchResult.getFullTextResult().size(), 1); assertEquals(searchResult.getFullTextResult().size(), 1);
} }
......
...@@ -20,8 +20,8 @@ package org.apache.atlas.web.resources; ...@@ -20,8 +20,8 @@ package org.apache.atlas.web.resources;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
import com.sun.jersey.core.util.MultivaluedMapImpl; import com.sun.jersey.core.util.MultivaluedMapImpl;
import org.apache.atlas.AtlasClientV2;
import org.apache.atlas.AtlasServiceException; import org.apache.atlas.AtlasServiceException;
import org.apache.atlas.AtlasTypedefClientV2;
import org.apache.atlas.model.SearchFilter; import org.apache.atlas.model.SearchFilter;
import org.apache.atlas.model.TypeCategory; import org.apache.atlas.model.TypeCategory;
import org.apache.atlas.model.typedef.AtlasBaseTypeDef; import org.apache.atlas.model.typedef.AtlasBaseTypeDef;
...@@ -57,7 +57,7 @@ public class TypedefsJerseyResourceIT extends BaseResourceIT { ...@@ -57,7 +57,7 @@ public class TypedefsJerseyResourceIT extends BaseResourceIT {
private AtlasTypesDef typeDefinitions; private AtlasTypesDef typeDefinitions;
private AtlasTypedefClientV2 clientV2; private AtlasClientV2 clientV2;
@BeforeClass @BeforeClass
public void setUp() throws Exception { public void setUp() throws Exception {
...@@ -66,9 +66,9 @@ public class TypedefsJerseyResourceIT extends BaseResourceIT { ...@@ -66,9 +66,9 @@ public class TypedefsJerseyResourceIT extends BaseResourceIT {
typeDefinitions = createHiveTypes(); typeDefinitions = createHiveTypes();
if (!AuthenticationUtil.isKerberosAuthenticationEnabled()) { if (!AuthenticationUtil.isKerberosAuthenticationEnabled()) {
clientV2 = new AtlasTypedefClientV2(atlasUrls, new String[]{"admin", "admin"}); clientV2 = new AtlasClientV2(atlasUrls, new String[]{"admin", "admin"});
} else { } else {
clientV2 = new AtlasTypedefClientV2(atlasUrls); clientV2 = new AtlasClientV2(atlasUrls);
} }
} }
...@@ -176,7 +176,7 @@ public class TypedefsJerseyResourceIT extends BaseResourceIT { ...@@ -176,7 +176,7 @@ public class TypedefsJerseyResourceIT extends BaseResourceIT {
@Test @Test
public void testInvalidGets() throws Exception { public void testInvalidGets() throws Exception {
try { try {
AtlasEnumDef byName = clientV2.getEnumByName("blah"); AtlasEnumDef byName = clientV2.getEnumDefByName("blah");
fail("Get for invalid name should have reported a failure"); fail("Get for invalid name should have reported a failure");
} catch (AtlasServiceException e) { } catch (AtlasServiceException e) {
assertEquals(e.getStatus().getStatusCode(), Response.Status.NOT_FOUND.getStatusCode(), assertEquals(e.getStatus().getStatusCode(), Response.Status.NOT_FOUND.getStatusCode(),
...@@ -184,7 +184,7 @@ public class TypedefsJerseyResourceIT extends BaseResourceIT { ...@@ -184,7 +184,7 @@ public class TypedefsJerseyResourceIT extends BaseResourceIT {
} }
try { try {
AtlasEnumDef byGuid = clientV2.getEnumByGuid("blah"); AtlasEnumDef byGuid = clientV2.getEnumDefByGuid("blah");
fail("Get for invalid name should have reported a failure"); fail("Get for invalid name should have reported a failure");
} catch (AtlasServiceException e) { } catch (AtlasServiceException e) {
assertEquals(e.getStatus().getStatusCode(), Response.Status.NOT_FOUND.getStatusCode(), assertEquals(e.getStatus().getStatusCode(), Response.Status.NOT_FOUND.getStatusCode(),
...@@ -192,7 +192,7 @@ public class TypedefsJerseyResourceIT extends BaseResourceIT { ...@@ -192,7 +192,7 @@ public class TypedefsJerseyResourceIT extends BaseResourceIT {
} }
try { try {
AtlasStructDef byName = clientV2.getStructByName("blah"); AtlasStructDef byName = clientV2.getStructDefByName("blah");
fail("Get for invalid name should have reported a failure"); fail("Get for invalid name should have reported a failure");
} catch (AtlasServiceException e) { } catch (AtlasServiceException e) {
assertEquals(e.getStatus().getStatusCode(), Response.Status.NOT_FOUND.getStatusCode(), assertEquals(e.getStatus().getStatusCode(), Response.Status.NOT_FOUND.getStatusCode(),
...@@ -200,7 +200,7 @@ public class TypedefsJerseyResourceIT extends BaseResourceIT { ...@@ -200,7 +200,7 @@ public class TypedefsJerseyResourceIT extends BaseResourceIT {
} }
try { try {
AtlasStructDef byGuid = clientV2.getStructByGuid("blah"); AtlasStructDef byGuid = clientV2.getStructDefByGuid("blah");
fail("Get for invalid name should have reported a failure"); fail("Get for invalid name should have reported a failure");
} catch (AtlasServiceException e) { } catch (AtlasServiceException e) {
assertEquals(e.getStatus().getStatusCode(), Response.Status.NOT_FOUND.getStatusCode(), assertEquals(e.getStatus().getStatusCode(), Response.Status.NOT_FOUND.getStatusCode(),
...@@ -208,7 +208,7 @@ public class TypedefsJerseyResourceIT extends BaseResourceIT { ...@@ -208,7 +208,7 @@ public class TypedefsJerseyResourceIT extends BaseResourceIT {
} }
try { try {
AtlasClassificationDef byName = clientV2.getClassificationByName("blah"); AtlasClassificationDef byName = clientV2.getClassificationDefByName("blah");
fail("Get for invalid name should have reported a failure"); fail("Get for invalid name should have reported a failure");
} catch (AtlasServiceException e) { } catch (AtlasServiceException e) {
assertEquals(e.getStatus().getStatusCode(), Response.Status.NOT_FOUND.getStatusCode(), assertEquals(e.getStatus().getStatusCode(), Response.Status.NOT_FOUND.getStatusCode(),
...@@ -216,7 +216,7 @@ public class TypedefsJerseyResourceIT extends BaseResourceIT { ...@@ -216,7 +216,7 @@ public class TypedefsJerseyResourceIT extends BaseResourceIT {
} }
try { try {
AtlasClassificationDef byGuid = clientV2.getClassificationByGuid("blah"); AtlasClassificationDef byGuid = clientV2.getClassificationDefByGuid("blah");
fail("Get for invalid name should have reported a failure"); fail("Get for invalid name should have reported a failure");
} catch (AtlasServiceException e) { } catch (AtlasServiceException e) {
assertEquals(e.getStatus().getStatusCode(), Response.Status.NOT_FOUND.getStatusCode(), assertEquals(e.getStatus().getStatusCode(), Response.Status.NOT_FOUND.getStatusCode(),
...@@ -224,7 +224,7 @@ public class TypedefsJerseyResourceIT extends BaseResourceIT { ...@@ -224,7 +224,7 @@ public class TypedefsJerseyResourceIT extends BaseResourceIT {
} }
try { try {
AtlasEntityDef byName = clientV2.getEntityByName("blah"); AtlasEntityDef byName = clientV2.getEntityDefByName("blah");
fail("Get for invalid name should have reported a failure"); fail("Get for invalid name should have reported a failure");
} catch (AtlasServiceException e) { } catch (AtlasServiceException e) {
assertEquals(e.getStatus().getStatusCode(), Response.Status.NOT_FOUND.getStatusCode(), assertEquals(e.getStatus().getStatusCode(), Response.Status.NOT_FOUND.getStatusCode(),
...@@ -232,7 +232,7 @@ public class TypedefsJerseyResourceIT extends BaseResourceIT { ...@@ -232,7 +232,7 @@ public class TypedefsJerseyResourceIT extends BaseResourceIT {
} }
try { try {
AtlasEntityDef byGuid = clientV2.getEntityByGuid("blah"); AtlasEntityDef byGuid = clientV2.getEntityDefByGuid("blah");
fail("Get for invalid name should have reported a failure"); fail("Get for invalid name should have reported a failure");
} catch (AtlasServiceException e) { } catch (AtlasServiceException e) {
assertEquals(e.getStatus().getStatusCode(), Response.Status.NOT_FOUND.getStatusCode(), assertEquals(e.getStatus().getStatusCode(), Response.Status.NOT_FOUND.getStatusCode(),
...@@ -312,13 +312,13 @@ public class TypedefsJerseyResourceIT extends BaseResourceIT { ...@@ -312,13 +312,13 @@ public class TypedefsJerseyResourceIT extends BaseResourceIT {
try { try {
AtlasBaseTypeDef byName = null; AtlasBaseTypeDef byName = null;
if (typeDef.getCategory() == TypeCategory.ENUM) { if (typeDef.getCategory() == TypeCategory.ENUM) {
byName = clientV2.getEnumByName(typeDef.getName()); byName = clientV2.getEnumDefByName(typeDef.getName());
} else if (typeDef.getCategory() == TypeCategory.ENTITY) { } else if (typeDef.getCategory() == TypeCategory.ENTITY) {
byName = clientV2.getEntityByName(typeDef.getName()); byName = clientV2.getEntityDefByName(typeDef.getName());
} else if (typeDef.getCategory() == TypeCategory.CLASSIFICATION) { } else if (typeDef.getCategory() == TypeCategory.CLASSIFICATION) {
byName = clientV2.getClassificationByName(typeDef.getName()); byName = clientV2.getClassificationDefByName(typeDef.getName());
} else if (typeDef.getCategory() == TypeCategory.STRUCT) { } else if (typeDef.getCategory() == TypeCategory.STRUCT) {
byName = clientV2.getStructByName(typeDef.getName()); byName = clientV2.getStructDefByName(typeDef.getName());
} }
assertNotNull(byName); assertNotNull(byName);
} catch (AtlasServiceException e) { } catch (AtlasServiceException e) {
...@@ -328,13 +328,13 @@ public class TypedefsJerseyResourceIT extends BaseResourceIT { ...@@ -328,13 +328,13 @@ public class TypedefsJerseyResourceIT extends BaseResourceIT {
try { try {
AtlasBaseTypeDef byGuid = null; AtlasBaseTypeDef byGuid = null;
if (typeDef.getCategory() == TypeCategory.ENUM) { if (typeDef.getCategory() == TypeCategory.ENUM) {
byGuid = clientV2.getEnumByGuid(typeDef.getGuid()); byGuid = clientV2.getEnumDefByGuid(typeDef.getGuid());
} else if (typeDef.getCategory() == TypeCategory.ENTITY) { } else if (typeDef.getCategory() == TypeCategory.ENTITY) {
byGuid = clientV2.getEntityByGuid(typeDef.getGuid()); byGuid = clientV2.getEntityDefByGuid(typeDef.getGuid());
} else if (typeDef.getCategory() == TypeCategory.CLASSIFICATION) { } else if (typeDef.getCategory() == TypeCategory.CLASSIFICATION) {
byGuid = clientV2.getClassificationByGuid(typeDef.getGuid()); byGuid = clientV2.getClassificationDefByGuid(typeDef.getGuid());
} else if (typeDef.getCategory() == TypeCategory.STRUCT) { } else if (typeDef.getCategory() == TypeCategory.STRUCT) {
byGuid = clientV2.getStructByGuid(typeDef.getGuid()); byGuid = clientV2.getStructDefByGuid(typeDef.getGuid());
} }
assertNotNull(byGuid); assertNotNull(byGuid);
} catch (AtlasServiceException e) { } catch (AtlasServiceException e) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment