use of io.prestosql.security.AllowAllAccessControl in project hetu-core by openlookeng.
the class TestSetRoleTask method setUp.
@BeforeClass
public void setUp() {
CatalogManager catalogManager = new CatalogManager();
transactionManager = createTestTransactionManager(catalogManager);
accessControl = new AllowAllAccessControl();
metadata = createTestMetadataManager(transactionManager, new FeaturesConfig());
catalogManager.registerCatalog(createBogusTestingCatalog(CATALOG_NAME));
executor = newCachedThreadPool(daemonThreadsNamed("test-set-role-task-executor-%s"));
parser = new SqlParser();
}
use of io.prestosql.security.AllowAllAccessControl in project hetu-core by openlookeng.
the class TestPrepareTask method executePrepare.
private Map<String, String> executePrepare(String statementName, Statement statement, String sqlString, Session session) {
TransactionManager transactionManager = createTestTransactionManager();
QueryStateMachine stateMachine = QueryStateMachine.begin(sqlString, Optional.empty(), session, URI.create("fake://uri"), new ResourceGroupId("test"), new NoOpResourceGroupManager(), false, transactionManager, new AccessControlManager(transactionManager), executor, metadata, WarningCollector.NOOP);
Prepare prepare = new Prepare(identifier(statementName), statement);
new PrepareTask(new SqlParser()).execute(prepare, transactionManager, metadata, new AllowAllAccessControl(), stateMachine, emptyList(), new HeuristicIndexerManager(new FileSystemClientManager(), new HetuMetaStoreManager()));
return stateMachine.getAddedPreparedStatements();
}
use of io.prestosql.security.AllowAllAccessControl in project hetu-core by openlookeng.
the class TestRollbackTask method testUnknownTransactionRollback.
@Test
public void testUnknownTransactionRollback() {
TransactionManager transactionManager = createTestTransactionManager();
Session session = sessionBuilder().setTransactionId(// Use a random transaction ID that is unknown to the system
TransactionId.create()).build();
QueryStateMachine stateMachine = createQueryStateMachine("ROLLBACK", session, transactionManager);
getFutureValue(new RollbackTask().execute(new Rollback(), transactionManager, metadata, new AllowAllAccessControl(), stateMachine, emptyList(), new HeuristicIndexerManager(new FileSystemClientManager(), new HetuMetaStoreManager())));
// Still issue clear signal
assertTrue(stateMachine.getQueryInfo(Optional.empty()).isClearTransactionId());
assertFalse(stateMachine.getQueryInfo(Optional.empty()).getStartedTransactionId().isPresent());
assertTrue(transactionManager.getAllTransactionInfos().isEmpty());
}
use of io.prestosql.security.AllowAllAccessControl in project hetu-core by openlookeng.
the class TestStartTransactionTask method testStartTransactionTooManyIsolationLevels.
@Test
public void testStartTransactionTooManyIsolationLevels() {
Session session = sessionBuilder().setClientTransactionSupport().build();
TransactionManager transactionManager = createTestTransactionManager();
QueryStateMachine stateMachine = createQueryStateMachine("START TRANSACTION", session, transactionManager);
assertFalse(stateMachine.getSession().getTransactionId().isPresent());
assertSemanticExceptionThrownBy(() -> getFutureValue(new StartTransactionTask().execute(new StartTransaction(ImmutableList.of(new Isolation(Isolation.Level.READ_COMMITTED), new Isolation(Isolation.Level.READ_COMMITTED))), transactionManager, metadata, new AllowAllAccessControl(), stateMachine, emptyList(), new HeuristicIndexerManager(new FileSystemClientManager(), new HetuMetaStoreManager())))).hasErrorCode(INVALID_TRANSACTION_MODE);
assertTrue(transactionManager.getAllTransactionInfos().isEmpty());
assertFalse(stateMachine.getQueryInfo(Optional.empty()).isClearTransactionId());
assertFalse(stateMachine.getQueryInfo(Optional.empty()).getStartedTransactionId().isPresent());
}
use of io.prestosql.security.AllowAllAccessControl in project hetu-core by openlookeng.
the class TestMinimalFunctionality method testTopicExists.
@Test
public void testTopicExists() {
QualifiedObjectName name = new QualifiedObjectName("kafka", "default", topicName);
transaction(queryRunner.getTransactionManager(), new AllowAllAccessControl()).singleStatement().execute(SESSION, session -> {
Optional<TableHandle> handle = queryRunner.getServer().getMetadata().getTableHandle(session, name);
assertTrue(handle.isPresent());
});
}
Aggregations