Search in sources :

Example 11 with AllowAllAccessControl

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();
}
Also used : AllowAllAccessControl(io.prestosql.security.AllowAllAccessControl) FeaturesConfig(io.prestosql.sql.analyzer.FeaturesConfig) SqlParser(io.prestosql.sql.parser.SqlParser) CatalogManager(io.prestosql.metadata.CatalogManager) BeforeClass(org.testng.annotations.BeforeClass)

Example 12 with AllowAllAccessControl

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();
}
Also used : AccessControlManager(io.prestosql.security.AccessControlManager) ResourceGroupId(io.prestosql.spi.resourcegroups.ResourceGroupId) TransactionManager(io.prestosql.transaction.TransactionManager) InMemoryTransactionManager.createTestTransactionManager(io.prestosql.transaction.InMemoryTransactionManager.createTestTransactionManager) AllowAllAccessControl(io.prestosql.security.AllowAllAccessControl) HeuristicIndexerManager(io.prestosql.heuristicindex.HeuristicIndexerManager) SqlParser(io.prestosql.sql.parser.SqlParser) Prepare(io.prestosql.sql.tree.Prepare) HetuMetaStoreManager(io.prestosql.metastore.HetuMetaStoreManager) NoOpResourceGroupManager(io.prestosql.execution.resourcegroups.NoOpResourceGroupManager) FileSystemClientManager(io.prestosql.filesystem.FileSystemClientManager)

Example 13 with AllowAllAccessControl

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());
}
Also used : TransactionManager(io.prestosql.transaction.TransactionManager) InMemoryTransactionManager.createTestTransactionManager(io.prestosql.transaction.InMemoryTransactionManager.createTestTransactionManager) AllowAllAccessControl(io.prestosql.security.AllowAllAccessControl) HeuristicIndexerManager(io.prestosql.heuristicindex.HeuristicIndexerManager) Rollback(io.prestosql.sql.tree.Rollback) HetuMetaStoreManager(io.prestosql.metastore.HetuMetaStoreManager) Session(io.prestosql.Session) FileSystemClientManager(io.prestosql.filesystem.FileSystemClientManager) Test(org.testng.annotations.Test)

Example 14 with AllowAllAccessControl

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());
}
Also used : TransactionManager(io.prestosql.transaction.TransactionManager) InMemoryTransactionManager(io.prestosql.transaction.InMemoryTransactionManager) InMemoryTransactionManager.createTestTransactionManager(io.prestosql.transaction.InMemoryTransactionManager.createTestTransactionManager) AllowAllAccessControl(io.prestosql.security.AllowAllAccessControl) HeuristicIndexerManager(io.prestosql.heuristicindex.HeuristicIndexerManager) Isolation(io.prestosql.sql.tree.Isolation) HetuMetaStoreManager(io.prestosql.metastore.HetuMetaStoreManager) StartTransaction(io.prestosql.sql.tree.StartTransaction) Session(io.prestosql.Session) FileSystemClientManager(io.prestosql.filesystem.FileSystemClientManager) Test(org.testng.annotations.Test)

Example 15 with AllowAllAccessControl

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());
    });
}
Also used : AllowAllAccessControl(io.prestosql.security.AllowAllAccessControl) TableHandle(io.prestosql.spi.metadata.TableHandle) QualifiedObjectName(io.prestosql.spi.connector.QualifiedObjectName) Test(org.testng.annotations.Test)

Aggregations

AllowAllAccessControl (io.prestosql.security.AllowAllAccessControl)27 Test (org.testng.annotations.Test)23 FileSystemClientManager (io.prestosql.filesystem.FileSystemClientManager)18 HeuristicIndexerManager (io.prestosql.heuristicindex.HeuristicIndexerManager)18 HetuMetaStoreManager (io.prestosql.metastore.HetuMetaStoreManager)18 Session (io.prestosql.Session)15 InMemoryTransactionManager.createTestTransactionManager (io.prestosql.transaction.InMemoryTransactionManager.createTestTransactionManager)15 TransactionManager (io.prestosql.transaction.TransactionManager)15 StartTransaction (io.prestosql.sql.tree.StartTransaction)7 InMemoryTransactionManager (io.prestosql.transaction.InMemoryTransactionManager)7 ColumnDefinition (io.prestosql.sql.tree.ColumnDefinition)4 CreateTable (io.prestosql.sql.tree.CreateTable)4 Commit (io.prestosql.sql.tree.Commit)3 DropCache (io.prestosql.sql.tree.DropCache)3 Rollback (io.prestosql.sql.tree.Rollback)3 NoOpResourceGroupManager (io.prestosql.execution.resourcegroups.NoOpResourceGroupManager)2 CatalogManager (io.prestosql.metadata.CatalogManager)2 SessionPropertyManager (io.prestosql.metadata.SessionPropertyManager)2 AccessControlManager (io.prestosql.security.AccessControlManager)2 QueryId (io.prestosql.spi.QueryId)2