use of io.prestosql.security.AllowAllAccessControl in project hetu-core by openlookeng.
the class TestCreateTableTask method testCreateTableNotExistsTrue.
@Test
public void testCreateTableNotExistsTrue() {
CreateTable statement = new CreateTable(QualifiedName.of("test_table"), ImmutableList.of(new ColumnDefinition(identifier("a"), "BIGINT", true, emptyList(), Optional.empty())), true, ImmutableList.of(), Optional.empty());
getFutureValue(new CreateTableTask().internalExecute(statement, metadata, new AllowAllAccessControl(), testSession, emptyList()));
assertEquals(metadata.getCreateTableCallCount(), 1);
}
use of io.prestosql.security.AllowAllAccessControl in project hetu-core by openlookeng.
the class TestCreateTableTask method testCreateTableNotExistsFalse.
@Test
public void testCreateTableNotExistsFalse() {
CreateTable statement = new CreateTable(QualifiedName.of("test_table"), ImmutableList.of(new ColumnDefinition(identifier("a"), "BIGINT", true, emptyList(), Optional.empty())), false, ImmutableList.of(), Optional.empty());
try {
getFutureValue(new CreateTableTask().internalExecute(statement, metadata, new AllowAllAccessControl(), testSession, emptyList()));
fail("expected exception");
} catch (RuntimeException e) {
// Expected
assertTrue(e instanceof PrestoException);
PrestoException prestoException = (PrestoException) e;
assertEquals(prestoException.getErrorCode(), ALREADY_EXISTS.toErrorCode());
}
assertEquals(metadata.getCreateTableCallCount(), 1);
}
use of io.prestosql.security.AllowAllAccessControl in project hetu-core by openlookeng.
the class TestCreateTableTask method testCreateWithUnsupportedConnectorThrowsWhenNotNull.
@Test(expectedExceptions = SemanticException.class, expectedExceptionsMessageRegExp = ".*does not support non-null column for column name 'b'")
public void testCreateWithUnsupportedConnectorThrowsWhenNotNull() {
List<TableElement> inputColumns = ImmutableList.of(new ColumnDefinition(identifier("a"), "DATE", true, emptyList(), Optional.empty()), new ColumnDefinition(identifier("b"), "VARCHAR", false, emptyList(), Optional.empty()), new ColumnDefinition(identifier("c"), "VARBINARY", false, emptyList(), Optional.empty()));
CreateTable statement = new CreateTable(QualifiedName.of("test_table"), inputColumns, true, ImmutableList.of(), Optional.empty());
getFutureValue(new CreateTableTask().internalExecute(statement, metadata, new AllowAllAccessControl(), testSession, emptyList()));
}
use of io.prestosql.security.AllowAllAccessControl in project hetu-core by openlookeng.
the class TestDropCacheTask method testDropWithNonQualifiedName.
@Test
public void testDropWithNonQualifiedName() {
QualifiedName tableName = QualifiedName.of(table3);
QualifiedName fullName = QualifiedName.of(CATALOG_NAME, schema, table3);
DropCache statement = new DropCache(tableName, true);
Session session = testSessionBuilder().setTransactionId(transactionManager.beginTransaction(false)).setCatalog(CATALOG_NAME).setSchema(schema).build();
QueryStateMachine queryStateMachine = createQueryStateMachine("START TRANSACTION", session, transactionManager);
getFutureValue(new DropCacheTask().execute(statement, createTestTransactionManager(), metadata, new AllowAllAccessControl(), queryStateMachine, Collections.emptyList(), new HeuristicIndexerManager(new FileSystemClientManager(), new HetuMetaStoreManager())));
assertFalse(SplitCacheMap.getInstance().cacheExists(fullName));
}
use of io.prestosql.security.AllowAllAccessControl in project hetu-core by openlookeng.
the class TestRollbackTask method testNoTransactionRollback.
@Test
public void testNoTransactionRollback() {
TransactionManager transactionManager = createTestTransactionManager();
Session session = sessionBuilder().build();
QueryStateMachine stateMachine = createQueryStateMachine("ROLLBACK", session, transactionManager);
assertPrestoExceptionThrownBy(() -> getFutureValue((Future<?>) new RollbackTask().execute(new Rollback(), transactionManager, metadata, new AllowAllAccessControl(), stateMachine, emptyList(), new HeuristicIndexerManager(new FileSystemClientManager(), new HetuMetaStoreManager())))).hasErrorCode(NOT_IN_TRANSACTION);
assertFalse(stateMachine.getQueryInfo(Optional.empty()).isClearTransactionId());
assertFalse(stateMachine.getQueryInfo(Optional.empty()).getStartedTransactionId().isPresent());
assertTrue(transactionManager.getAllTransactionInfos().isEmpty());
}
Aggregations