use of com.sun.jersey.core.util.MultivaluedMapImpl in project incubator-atlas by apache.
the class EntityJerseyResourceIT method testGetEntityListForNoInstances.
@Test
public void testGetEntityListForNoInstances() throws Exception {
String typeName = addNewType();
MultivaluedMap<String, String> queryParams = new MultivaluedMapImpl();
queryParams.add("type", typeName);
JSONObject response = atlasClientV1.callAPIWithQueryParams(AtlasClient.API.GET_ENTITY, queryParams);
assertNotNull(response);
Assert.assertNotNull(response.get(AtlasClient.REQUEST_ID));
final JSONArray list = response.getJSONArray(AtlasClient.RESULTS);
Assert.assertEquals(list.length(), 0);
}
use of com.sun.jersey.core.util.MultivaluedMapImpl in project incubator-atlas by apache.
the class EntityLineageJerseyResourceIT method testInputLineageInfo.
@Test
public void testInputLineageInfo() throws Exception {
String tableId = atlasClientV1.getEntity(HIVE_TABLE_TYPE, AtlasClient.REFERENCEABLE_ATTRIBUTE_NAME, salesMonthlyTable).getId()._getId();
MultivaluedMap<String, String> queryParams = new MultivaluedMapImpl();
queryParams.add(DIRECTION_PARAM, INPUT_DIRECTION);
queryParams.add(DEPTH_PARAM, "5");
JSONObject response = atlasClientV1.callAPI(LINEAGE_V2_API, JSONObject.class, queryParams, tableId);
Assert.assertNotNull(response);
System.out.println("input lineage info = " + response);
AtlasLineageInfo inputLineageInfo = gson.fromJson(response.toString(), AtlasLineageInfo.class);
Map<String, AtlasEntityHeader> entities = inputLineageInfo.getGuidEntityMap();
Assert.assertNotNull(entities);
Set<AtlasLineageInfo.LineageRelation> relations = inputLineageInfo.getRelations();
Assert.assertNotNull(relations);
Assert.assertEquals(entities.size(), 6);
Assert.assertEquals(relations.size(), 5);
Assert.assertEquals(inputLineageInfo.getLineageDirection(), AtlasLineageInfo.LineageDirection.INPUT);
Assert.assertEquals(inputLineageInfo.getLineageDepth(), 5);
Assert.assertEquals(inputLineageInfo.getBaseEntityGuid(), tableId);
}
use of com.sun.jersey.core.util.MultivaluedMapImpl in project incubator-atlas by apache.
the class MetadataDiscoveryJerseyResourceIT method testSearchUsingDSL.
@Test
public void testSearchUsingDSL() throws Exception {
//String query = "from dsl_test_type";
String query = "from " + DATABASE_TYPE + " name=\"" + dbName + "\"";
MultivaluedMap<String, String> queryParams = new MultivaluedMapImpl();
queryParams.add("query", query);
JSONObject response = atlasClientV1.callAPIWithQueryParams(AtlasClient.API.SEARCH, queryParams);
Assert.assertNotNull(response);
Assert.assertNotNull(response.get(AtlasClient.REQUEST_ID));
assertEquals(response.getString("query"), query);
assertEquals(response.getString("queryType"), "dsl");
}
use of com.sun.jersey.core.util.MultivaluedMapImpl in project incubator-atlas by apache.
the class MetadataDiscoveryJerseyResourceIT method testSearchUsingGremlin.
@Test
public void testSearchUsingGremlin() throws Exception {
String query = "g.V.has('type', '" + BaseResourceIT.HIVE_TABLE_TYPE + "').toList()";
MultivaluedMap<String, String> queryParams = new MultivaluedMapImpl();
queryParams.add("query", query);
JSONObject response = atlasClientV1.callAPIWithQueryParams(AtlasClient.API.GREMLIN_SEARCH, queryParams);
assertNotNull(response);
assertNotNull(response.get(AtlasClient.REQUEST_ID));
assertEquals(response.getString("query"), query);
assertEquals(response.getString("queryType"), "gremlin");
}
use of com.sun.jersey.core.util.MultivaluedMapImpl in project incubator-atlas by apache.
the class MetadataDiscoveryJerseyResourceIT method testSearchByDSL.
@Test
public void testSearchByDSL() throws Exception {
String dslQuery = "from " + DATABASE_TYPE + " name=\"" + dbName + "\"";
MultivaluedMap<String, String> queryParams = new MultivaluedMapImpl();
queryParams.add("query", dslQuery);
JSONObject response = atlasClientV1.callAPIWithQueryParams(AtlasClient.API.SEARCH_DSL, queryParams);
Assert.assertNotNull(response);
Assert.assertNotNull(response.get(AtlasClient.REQUEST_ID));
assertEquals(response.getString("query"), dslQuery);
assertEquals(response.getString("queryType"), "dsl");
JSONArray results = response.getJSONArray(AtlasClient.RESULTS);
assertNotNull(results);
assertEquals(results.length(), 1);
int numRows = response.getInt(AtlasClient.COUNT);
assertEquals(numRows, 1);
}
Aggregations