use of com.facebook.presto.security.AllowAllAccessControl in project urban-eureka by errir503.
the class TestDropFunctionTask method executeAndGetRemovedSessionFunctions.
private Set<SqlFunctionId> executeAndGetRemovedSessionFunctions(String sqlString, Session session) {
SqlParser parser = new SqlParser();
DropFunction statement = (DropFunction) parser.createStatement(sqlString, ParsingOptions.builder().build());
TransactionManager tm = createTestTransactionManager();
QueryStateMachine stateMachine = createQueryStateMachine(sqlString, session, false, tm, executorService, metadataManager);
WarningCollector warningCollector = stateMachine.getWarningCollector();
DropFunctionTask dropFunctionTask = new DropFunctionTask(parser);
dropFunctionTask.execute(statement, tm, metadataManager, new AllowAllAccessControl(), session, emptyList(), warningCollector);
return dropFunctionTask.getRemovedSessionFunctions();
}
use of com.facebook.presto.security.AllowAllAccessControl in project urban-eureka by errir503.
the class TestMinimalFunctionality method testTableExists.
@Test
public void testTableExists() {
QualifiedObjectName name = new QualifiedObjectName("redis", "default", tableName);
transaction(queryRunner.getTransactionManager(), new AllowAllAccessControl()).singleStatement().execute(SESSION, session -> {
Optional<TableHandle> handle = queryRunner.getServer().getMetadata().getTableHandle(session, name);
assertTrue(handle.isPresent());
});
}
use of com.facebook.presto.security.AllowAllAccessControl in project urban-eureka by errir503.
the class TestQuerySessionSupplier method testCreateSession.
@Test
public void testCreateSession() {
HttpRequestSessionContext context = new HttpRequestSessionContext(TEST_REQUEST, new SqlParserOptions());
QuerySessionSupplier sessionSupplier = new QuerySessionSupplier(createTestTransactionManager(), new AllowAllAccessControl(), new SessionPropertyManager(), new SqlEnvironmentConfig());
Session session = sessionSupplier.createSession(new QueryId("test_query_id"), context);
assertEquals(session.getQueryId(), new QueryId("test_query_id"));
assertEquals(session.getUser(), "testUser");
assertEquals(session.getSource().get(), "testSource");
assertEquals(session.getCatalog().get(), "testCatalog");
assertEquals(session.getSchema().get(), "testSchema");
assertEquals(session.getLocale(), Locale.TAIWAN);
assertEquals(session.getTimeZoneKey(), getTimeZoneKey("Asia/Taipei"));
assertEquals(session.getRemoteUserAddress().get(), "testRemote");
assertEquals(session.getClientInfo().get(), "client-info");
assertEquals(session.getClientTags(), ImmutableSet.of("tag1", "tag2", "tag3"));
assertEquals(session.getSystemProperties(), ImmutableMap.<String, String>builder().put(QUERY_MAX_MEMORY, "1GB").put(JOIN_DISTRIBUTION_TYPE, "partitioned").put(HASH_PARTITION_COUNT, "43").build());
assertEquals(session.getPreparedStatements(), ImmutableMap.<String, String>builder().put("query1", "select * from foo").put("query2", "select * from bar").build());
assertEquals(session.getSessionFunctions(), ImmutableMap.of(SQL_FUNCTION_ID_ADD, SQL_FUNCTION_ADD));
}
use of com.facebook.presto.security.AllowAllAccessControl in project urban-eureka by errir503.
the class TestQuerySessionSupplier method testInvalidTimeZone.
@Test(expectedExceptions = TimeZoneNotSupportedException.class)
public void testInvalidTimeZone() {
HttpServletRequest request = new MockHttpServletRequest(ImmutableListMultimap.<String, String>builder().put(PRESTO_USER, "testUser").put(PRESTO_TIME_ZONE, "unknown_timezone").build(), "testRemote");
HttpRequestSessionContext context = new HttpRequestSessionContext(request, new SqlParserOptions());
QuerySessionSupplier sessionSupplier = new QuerySessionSupplier(createTestTransactionManager(), new AllowAllAccessControl(), new SessionPropertyManager(), new SqlEnvironmentConfig());
sessionSupplier.createSession(new QueryId("test_query_id"), context);
}
use of com.facebook.presto.security.AllowAllAccessControl in project urban-eureka by errir503.
the class TestTransactionManager method registerConnector.
private static void registerConnector(CatalogManager catalogManager, TransactionManager transactionManager, String catalogName, ConnectorId connectorId, Connector connector) {
ConnectorId systemId = createSystemTablesConnectorId(connectorId);
InternalNodeManager nodeManager = new InMemoryNodeManager();
MetadataManager metadata = MetadataManager.createTestMetadataManager(catalogManager);
catalogManager.registerCatalog(new Catalog(catalogName, connectorId, connector, createInformationSchemaConnectorId(connectorId), new InformationSchemaConnector(catalogName, nodeManager, metadata, new AllowAllAccessControl(), ImmutableList.of()), systemId, new SystemConnector(systemId, nodeManager, connector.getSystemTables(), transactionId -> transactionManager.getConnectorTransaction(transactionId, connectorId))));
}
Aggregations