use of com.yahoo.elide.async.export.formatter.JSONExportFormatter in project elide by yahoo.
the class GraphQLTableExportOperationTest method testProcessMultipleQuery.
@Test
public void testProcessMultipleQuery() {
TableExport queryObj = new TableExport();
String query = "{\"query\":\"{ tableExport { edges { node { principalName } } } } { asyncQuery { edges { node { principalName } } } }\",\"variables\":null}";
String id = "edc4a871-dff2-4094-804e-d80075cf827d";
queryObj.setId(id);
queryObj.setQuery(query);
queryObj.setQueryType(QueryType.GRAPHQL_V1_0);
queryObj.setResultType(ResultType.CSV);
GraphQLTableExportOperation graphQLOperation = new GraphQLTableExportOperation(new JSONExportFormatter(elide), asyncExecutorService, queryObj, requestScope, engine);
TableExportResult queryResultObj = (TableExportResult) graphQLOperation.call();
assertEquals(200, queryResultObj.getHttpStatus());
assertEquals("Export is only supported for single Query with one root projection.", queryResultObj.getMessage());
assertNull(queryResultObj.getRecordCount());
assertNull(queryResultObj.getUrl());
}
use of com.yahoo.elide.async.export.formatter.JSONExportFormatter in project elide by yahoo.
the class GraphQLTableExportOperationTest method testProcessQuery.
@Test
public void testProcessQuery() throws IOException {
dataPrep();
TableExport queryObj = new TableExport();
String query = "{\"query\":\"{ tableExport { edges { node { id principalName} } } }\",\"variables\":null}";
String id = "edc4a871-dff2-4054-804e-d80075cf827d";
queryObj.setId(id);
queryObj.setQuery(query);
queryObj.setQueryType(QueryType.GRAPHQL_V1_0);
queryObj.setResultType(ResultType.CSV);
GraphQLTableExportOperation graphQLOperation = new GraphQLTableExportOperation(new JSONExportFormatter(elide), asyncExecutorService, queryObj, requestScope, engine);
TableExportResult queryResultObj = (TableExportResult) graphQLOperation.call();
assertEquals(200, queryResultObj.getHttpStatus());
assertEquals("https://elide.io/export/edc4a871-dff2-4054-804e-d80075cf827d", queryResultObj.getUrl().toString());
assertEquals(1, queryResultObj.getRecordCount());
}
use of com.yahoo.elide.async.export.formatter.JSONExportFormatter in project elide by yahoo.
the class GraphQLTableExportOperationTest method testProcessBadEntityQuery.
@Test
public void testProcessBadEntityQuery() throws IOException {
dataPrep();
TableExport queryObj = new TableExport();
String query = "{\"query\":\"{ tableExportInvalid { edges { node { id principalName} } } }\",\"variables\":null}";
String id = "edc4a871-dff2-4054-804e-d80075cf827d";
queryObj.setId(id);
queryObj.setQuery(query);
queryObj.setQueryType(QueryType.GRAPHQL_V1_0);
queryObj.setResultType(ResultType.CSV);
GraphQLTableExportOperation graphQLOperation = new GraphQLTableExportOperation(new JSONExportFormatter(elide), asyncExecutorService, queryObj, requestScope, engine);
TableExportResult queryResultObj = (TableExportResult) graphQLOperation.call();
assertEquals(200, queryResultObj.getHttpStatus());
assertEquals("Bad Request Body'Unknown entity {tableExportInvalid}.'", queryResultObj.getMessage());
}
use of com.yahoo.elide.async.export.formatter.JSONExportFormatter in project elide by yahoo.
the class JsonAPITableExportOperationTest method testProcessQuery.
@Test
public void testProcessQuery() throws IOException {
dataPrep();
TableExport queryObj = new TableExport();
String query = "/tableExport?sort=principalName&fields=principalName";
String id = "edc4a871-dff2-4054-804e-d80075cf827d";
queryObj.setId(id);
queryObj.setQuery(query);
queryObj.setQueryType(QueryType.JSONAPI_V1_0);
queryObj.setResultType(ResultType.CSV);
JSONAPITableExportOperation jsonAPIOperation = new JSONAPITableExportOperation(new JSONExportFormatter(elide), asyncExecutorService, queryObj, requestScope, engine);
TableExportResult queryResultObj = (TableExportResult) jsonAPIOperation.call();
assertEquals(200, queryResultObj.getHttpStatus());
assertEquals("https://elide.io/export/edc4a871-dff2-4054-804e-d80075cf827d.csv", queryResultObj.getUrl().toString());
assertEquals(1, queryResultObj.getRecordCount());
assertNull(queryResultObj.getMessage());
}
use of com.yahoo.elide.async.export.formatter.JSONExportFormatter in project elide by yahoo.
the class JsonAPITableExportOperationTest method testProcessBadEntityQuery.
@Test
public void testProcessBadEntityQuery() throws IOException {
dataPrep();
TableExport queryObj = new TableExport();
String query = "/tableExportInvalid?sort=principalName&fields=principalName";
String id = "edc4a871-dff2-4054-804e-d80075cf827d";
queryObj.setId(id);
queryObj.setQuery(query);
queryObj.setQueryType(QueryType.JSONAPI_V1_0);
queryObj.setResultType(ResultType.CSV);
JSONAPITableExportOperation jsonAPIOperation = new JSONAPITableExportOperation(new JSONExportFormatter(elide), asyncExecutorService, queryObj, requestScope, engine);
TableExportResult queryResultObj = (TableExportResult) jsonAPIOperation.call();
assertEquals(200, queryResultObj.getHttpStatus());
assertEquals("Unknown collection tableExportInvalid", queryResultObj.getMessage());
}
Aggregations