Commit 074211db by Suma Shivaprasad

BUG_36056 - Fixed all issues in ITs

parent bbc46662
...@@ -52,29 +52,31 @@ public class MetadataServiceClient { ...@@ -52,29 +52,31 @@ public class MetadataServiceClient {
service = client.resource(UriBuilder.fromUri(baseUrl).build()); service = client.resource(UriBuilder.fromUri(baseUrl).build());
} }
private static final String BASE_URI = "api/metadata/";
static enum API { static enum API {
//Type operations //Type operations
CREATE_TYPE("api/metadata/types/submit", HttpMethod.POST), CREATE_TYPE(BASE_URI + "types", HttpMethod.POST),
GET_TYPE("api/metadata/types/definition", HttpMethod.GET), GET_TYPE(BASE_URI + "types", HttpMethod.GET),
LIST_TYPES("api/metadata/types/list", HttpMethod.GET), LIST_TYPES(BASE_URI + "types", HttpMethod.GET),
LIST_TRAIT_TYPES("api/metadata/types/traits/list", HttpMethod.GET), LIST_TRAIT_TYPES(BASE_URI + "types?type=trait", HttpMethod.GET),
//Entity operations //Entity operations
CREATE_ENTITY("api/metadata/entities/submit", HttpMethod.POST), CREATE_ENTITY(BASE_URI + "entities", HttpMethod.POST),
GET_ENTITY("api/metadata/entities/definition", HttpMethod.GET), GET_ENTITY(BASE_URI + "entities", HttpMethod.GET),
UPDATE_ENTITY("api/metadata/entities/update", HttpMethod.PUT), UPDATE_ENTITY(BASE_URI + "entities", HttpMethod.PUT),
LIST_ENTITY("api/metadata/entities/list", HttpMethod.GET), LIST_ENTITY(BASE_URI + "entities", HttpMethod.GET),
//Trait operations //Trait operations
ADD_TRAITS("api/metadata/traits/add", HttpMethod.POST), ADD_TRAITS(BASE_URI + "traits", HttpMethod.POST),
DELETE_TRAITS("api/metadata/traits/delete", HttpMethod.PUT), DELETE_TRAITS(BASE_URI + "traits", HttpMethod.DELETE),
LIST_TRAITS("api/metadata/traits/list", HttpMethod.GET), LIST_TRAITS(BASE_URI + "traits", HttpMethod.GET),
//Search operations //Search operations
SEARCH("api/metadata/discovery/search", HttpMethod.GET), SEARCH(BASE_URI + "discovery/search", HttpMethod.GET),
SEARCH_DSL("api/metadata/discovery/search/dsl", HttpMethod.GET), SEARCH_DSL(BASE_URI + "discovery/search/dsl", HttpMethod.GET),
SEARCH_GREMLIN("api/metadata/discovery/search/gremlin", HttpMethod.GET), SEARCH_GREMLIN(BASE_URI + "discovery/search/gremlin", HttpMethod.GET),
SEARCH_FULL_TEXT("api/metadata/discovery/search/fulltext", HttpMethod.GET); SEARCH_FULL_TEXT(BASE_URI + "discovery/search/fulltext", HttpMethod.GET);
private final String method; private final String method;
private final String path; private final String path;
......
...@@ -150,7 +150,7 @@ public class EntityResource { ...@@ -150,7 +150,7 @@ public class EntityResource {
*/ */
@GET @GET
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
public Response getEntityList(@QueryParam("type") String entityType, public Response getEntityListByType(@QueryParam("type") String entityType,
@DefaultValue("0") @QueryParam("offset") Integer offset, @DefaultValue("0") @QueryParam("offset") Integer offset,
@QueryParam("numResults") Integer resultsPerPage) { @QueryParam("numResults") Integer resultsPerPage) {
Preconditions.checkNotNull(entityType, "Entity type cannot be null"); Preconditions.checkNotNull(entityType, "Entity type cannot be null");
......
...@@ -219,7 +219,8 @@ public class EntityJerseyResourceIT extends BaseResourceIT { ...@@ -219,7 +219,8 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
@Test @Test
public void testGetEntityListForBadEntityType() throws Exception { public void testGetEntityListForBadEntityType() throws Exception {
ClientResponse clientResponse = service ClientResponse clientResponse = service
.path("api/metadata/entities/blah") .path("api/metadata/entities")
.queryParam("type", "blah")
.accept(MediaType.APPLICATION_JSON) .accept(MediaType.APPLICATION_JSON)
.type(MediaType.APPLICATION_JSON) .type(MediaType.APPLICATION_JSON)
.method(HttpMethod.GET, ClientResponse.class); .method(HttpMethod.GET, ClientResponse.class);
...@@ -235,7 +236,8 @@ public class EntityJerseyResourceIT extends BaseResourceIT { ...@@ -235,7 +236,8 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
addNewType(); addNewType();
ClientResponse clientResponse = service ClientResponse clientResponse = service
.path("api/metadata/entities/test") .path("api/metadata/entities")
.queryParam("type", "test")
.accept(MediaType.APPLICATION_JSON) .accept(MediaType.APPLICATION_JSON)
.type(MediaType.APPLICATION_JSON) .type(MediaType.APPLICATION_JSON)
.method(HttpMethod.GET, ClientResponse.class); .method(HttpMethod.GET, ClientResponse.class);
......
...@@ -53,6 +53,8 @@ import java.util.List; ...@@ -53,6 +53,8 @@ import java.util.List;
*/ */
public class HiveLineageJerseyResourceIT extends BaseResourceIT { public class HiveLineageJerseyResourceIT extends BaseResourceIT {
private static final String BASE_URI = "api/metadata/lineage/hive/table/";
@BeforeClass @BeforeClass
public void setUp() throws Exception { public void setUp() throws Exception {
super.setUp(); super.setUp();
...@@ -64,8 +66,9 @@ public class HiveLineageJerseyResourceIT extends BaseResourceIT { ...@@ -64,8 +66,9 @@ public class HiveLineageJerseyResourceIT extends BaseResourceIT {
@Test @Test
public void testInputs() throws Exception { public void testInputs() throws Exception {
WebResource resource = service WebResource resource = service
.path("api/metadata/lineage/hive/inputs") .path(BASE_URI)
.path("sales_fact_monthly_mv"); .path("sales_fact_monthly_mv")
.path("inputs");
ClientResponse clientResponse = resource ClientResponse clientResponse = resource
.accept(MediaType.APPLICATION_JSON) .accept(MediaType.APPLICATION_JSON)
...@@ -94,8 +97,9 @@ public class HiveLineageJerseyResourceIT extends BaseResourceIT { ...@@ -94,8 +97,9 @@ public class HiveLineageJerseyResourceIT extends BaseResourceIT {
@Test @Test
public void testOutputs() throws Exception { public void testOutputs() throws Exception {
WebResource resource = service WebResource resource = service
.path("api/metadata/lineage/hive/outputs") .path(BASE_URI)
.path("sales_fact"); .path("sales_fact")
.path("outputs");
ClientResponse clientResponse = resource ClientResponse clientResponse = resource
.accept(MediaType.APPLICATION_JSON) .accept(MediaType.APPLICATION_JSON)
...@@ -124,8 +128,9 @@ public class HiveLineageJerseyResourceIT extends BaseResourceIT { ...@@ -124,8 +128,9 @@ public class HiveLineageJerseyResourceIT extends BaseResourceIT {
@Test @Test
public void testSchema() throws Exception { public void testSchema() throws Exception {
WebResource resource = service WebResource resource = service
.path("api/metadata/lineage/hive/schema") .path(BASE_URI)
.path("sales_fact"); .path("sales_fact")
.path("schema");
ClientResponse clientResponse = resource ClientResponse clientResponse = resource
.accept(MediaType.APPLICATION_JSON) .accept(MediaType.APPLICATION_JSON)
......
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