use of com.amazonaws.athena.connector.lambda.metadata.ListSchemasResponse in project aws-athena-query-federation by awslabs.
the class DynamoDBMetadataHandlerTest method doListSchemaNamesGlue.
@Test
public void doListSchemaNamesGlue() throws Exception {
GetDatabasesResult result = new GetDatabasesResult().withDatabaseList(new Database().withName(DEFAULT_SCHEMA), new Database().withName("ddb").withLocationUri(DYNAMO_DB_FLAG), new Database().withName("s3").withLocationUri("blah"));
when(glueClient.getDatabases(any())).thenReturn(result);
ListSchemasRequest req = new ListSchemasRequest(TEST_IDENTITY, TEST_QUERY_ID, TEST_CATALOG_NAME);
ListSchemasResponse res = handler.doListSchemaNames(allocator, req);
logger.info("doListSchemas - {}", res.getSchemas());
assertThat(res.getSchemas().size(), equalTo(2));
assertThat(res.getSchemas().contains("default"), is(true));
assertThat(res.getSchemas().contains("ddb"), is(true));
}
use of com.amazonaws.athena.connector.lambda.metadata.ListSchemasResponse in project aws-athena-query-federation by awslabs.
the class HbaseMetadataHandler method doListSchemaNames.
/**
* List namespaces in your HBase instance treating each as a 'schema' (aka database)
*
* @see GlueMetadataHandler
*/
@Override
public ListSchemasResponse doListSchemaNames(BlockAllocator blockAllocator, ListSchemasRequest request) throws IOException {
List<String> schemas = new ArrayList<>();
NamespaceDescriptor[] namespaces = getOrCreateConn(request).listNamespaceDescriptors();
for (int i = 0; i < namespaces.length; i++) {
NamespaceDescriptor namespace = namespaces[i];
schemas.add(namespace.getName());
}
return new ListSchemasResponse(request.getCatalogName(), schemas);
}
use of com.amazonaws.athena.connector.lambda.metadata.ListSchemasResponse in project aws-athena-query-federation by awslabs.
the class ListSchemasResponseSerDeTest method deserialize.
@Test
public void deserialize() throws IOException {
logger.info("deserialize: enter");
InputStream input = new ByteArrayInputStream(expectedSerDeText.getBytes());
ListSchemasResponse actual = (ListSchemasResponse) mapper.readValue(input, FederationResponse.class);
logger.info("deserialize: deserialized[{}]", actual);
assertEquals(expected, actual);
logger.info("deserialize: exit");
}
use of com.amazonaws.athena.connector.lambda.metadata.ListSchemasResponse in project aws-athena-query-federation by awslabs.
the class ListSchemasResponseSerDeTest method beforeTest.
@Before
public void beforeTest() throws IOException {
expected = new ListSchemasResponse("test-catalog", ImmutableList.of("schema1", "schema2"));
String expectedSerDeFile = utils.getResourceOrFail("serde/v2", "ListSchemasResponse.json");
expectedSerDeText = utils.readAllAsString(expectedSerDeFile).trim();
}
use of com.amazonaws.athena.connector.lambda.metadata.ListSchemasResponse in project aws-athena-query-federation by awslabs.
the class TPCDSMetadataHandlerTest method doListSchemaNames.
@Test
public void doListSchemaNames() {
logger.info("doListSchemas - enter");
ListSchemasRequest req = new ListSchemasRequest(identity, "queryId", "default");
ListSchemasResponse res = handler.doListSchemaNames(allocator, req);
logger.info("doListSchemas - {}", res.getSchemas());
assertTrue(res.getSchemas().size() == 5);
logger.info("doListSchemas - exit");
}
Aggregations