use of com.amazonaws.athena.connector.lambda.metadata.ListTablesRequest in project aws-athena-query-federation by awslabs.
the class ListTablesRequestSerDeTest method beforeTest.
@Before
public void beforeTest() throws IOException {
expected = new ListTablesRequest(federatedIdentity, "test-query-id", "test-catalog", "test-schema", "table4", 25);
String expectedSerDeFile = utils.getResourceOrFail("serde/v2", "ListTablesRequest.json");
expectedSerDeText = utils.readAllAsString(expectedSerDeFile).trim();
}
use of com.amazonaws.athena.connector.lambda.metadata.ListTablesRequest in project aws-athena-query-federation by awslabs.
the class ListTablesRequestSerDeTest method deserialize.
@Test
public void deserialize() throws IOException {
logger.info("deserialize: enter");
InputStream input = new ByteArrayInputStream(expectedSerDeText.getBytes());
ListTablesRequest actual = (ListTablesRequest) mapper.readValue(input, FederationRequest.class);
logger.info("deserialize: deserialized[{}]", actual);
assertEquals(expected, actual);
logger.info("deserialize: exit");
}
use of com.amazonaws.athena.connector.lambda.metadata.ListTablesRequest in project aws-athena-query-federation by awslabs.
the class HiveMuxMetadataHandlerTest method doListTables.
@Test
public void doListTables() {
ListTablesRequest listTablesRequest = Mockito.mock(ListTablesRequest.class);
Mockito.when(listTablesRequest.getCatalogName()).thenReturn("metaHive");
this.jdbcMetadataHandler.doListTables(this.allocator, listTablesRequest);
Mockito.verify(this.hiveMetadataHandler, Mockito.times(1)).doListTables(Mockito.eq(this.allocator), Mockito.eq(listTablesRequest));
}
use of com.amazonaws.athena.connector.lambda.metadata.ListTablesRequest in project aws-athena-query-federation by awslabs.
the class JdbcMetadataHandlerTest method doListTablesEscapedException.
@Test(expected = IllegalArgumentException.class)
public void doListTablesEscapedException() throws SQLException {
Mockito.when(connection.getMetaData().getSearchStringEscape()).thenReturn("_");
this.jdbcMetadataHandler.doListTables(this.blockAllocator, new ListTablesRequest(this.federatedIdentity, "testQueryId", "testCatalog", "test_Schema", null, UNLIMITED_PAGE_SIZE_VALUE));
}
use of com.amazonaws.athena.connector.lambda.metadata.ListTablesRequest in project aws-athena-query-federation by awslabs.
the class JdbcMetadataHandlerTest method doListTablesEscaped.
@Test
public void doListTablesEscaped() throws SQLException {
String[] schema = { "TABLE_SCHEM", "TABLE_NAME" };
Object[][] values = { { "test_Schema", "testTable" }, { "test_Schema", "testtable2" } };
TableName[] expected = { new TableName("test_Schema", "testTable"), new TableName("test_Schema", "testtable2") };
AtomicInteger rowNumber = new AtomicInteger(-1);
ResultSet resultSet = mockResultSet(schema, values, rowNumber);
Mockito.when(connection.getMetaData().getTables("testCatalog", "test\\_Schema", null, new String[] { "TABLE", "VIEW", "EXTERNAL TABLE" })).thenReturn(resultSet);
Mockito.when(connection.getCatalog()).thenReturn("testCatalog");
Mockito.when(connection.getMetaData().getSearchStringEscape()).thenReturn("\\");
ListTablesResponse listTablesResponse = this.jdbcMetadataHandler.doListTables(this.blockAllocator, new ListTablesRequest(this.federatedIdentity, "testQueryId", "testCatalog", "test_Schema", null, UNLIMITED_PAGE_SIZE_VALUE));
Assert.assertArrayEquals(expected, listTablesResponse.getTables().toArray());
}
Aggregations