use of io.trino.plugin.jdbc.credential.ExtraCredentialConfig in project trino by trinodb.
the class TestCachingJdbcClient method testDifferentIdentityKeys.
@Test
public void testDifferentIdentityKeys() {
CachingJdbcClient cachingJdbcClient = new CachingJdbcClient(database.getJdbcClient(), SESSION_PROPERTIES_PROVIDERS, new ExtraCredentialsBasedIdentityCacheMapping(new ExtraCredentialConfig().setUserCredentialName("user").setPasswordCredentialName("password")), FOREVER, true, 10000);
ConnectorSession alice = createUserSession("alice");
ConnectorSession bob = createUserSession("bob");
JdbcTableHandle table = createTable(new SchemaTableName(schema, "table"));
assertTableNamesCache(cachingJdbcClient).loads(2).misses(2).afterRunning(() -> {
assertThat(cachingJdbcClient.getTableNames(alice, Optional.empty())).contains(table.getRequiredNamedRelation().getSchemaTableName());
assertThat(cachingJdbcClient.getTableNames(bob, Optional.empty())).contains(table.getRequiredNamedRelation().getSchemaTableName());
});
assertTableNamesCache(cachingJdbcClient).hits(2).afterRunning(() -> {
assertThat(cachingJdbcClient.getTableNames(alice, Optional.empty())).contains(table.getRequiredNamedRelation().getSchemaTableName());
assertThat(cachingJdbcClient.getTableNames(bob, Optional.empty())).contains(table.getRequiredNamedRelation().getSchemaTableName());
});
// Drop tables by not using caching jdbc client
jdbcClient.dropTable(SESSION, table);
}
Aggregations