use of io.trino.security.AllowAllAccessControl in project trino by trinodb.
the class FunctionAssertions method assertCachedInstanceHasBoundedRetainedSize.
public void assertCachedInstanceHasBoundedRetainedSize(String projection) {
transaction(runner.getTransactionManager(), new AllowAllAccessControl()).singleStatement().execute(session, txSession -> {
// metadata.getCatalogHandle() registers the catalog for the transaction
txSession.getCatalog().ifPresent(catalog -> getMetadata().getCatalogHandle(txSession, catalog));
assertCachedInstanceHasBoundedRetainedSizeInTx(projection, txSession);
return null;
});
}
use of io.trino.security.AllowAllAccessControl in project trino by trinodb.
the class TestCallTask method testExecute.
@Test
public void testExecute() {
executeCallTask(methodHandle(TestCallTask.class, "testingMethod"), transactionManager -> new AllowAllAccessControl());
assertThat(invoked).isTrue();
}
use of io.trino.security.AllowAllAccessControl in project trino by trinodb.
the class TestCreateMaterializedViewTask method testCreateMaterializedViewIfNotExists.
@Test
public void testCreateMaterializedViewIfNotExists() {
CreateMaterializedView statement = new CreateMaterializedView(Optional.empty(), QualifiedName.of("test_mv"), simpleQuery(selectList(new AllColumns()), table(QualifiedName.of("catalog", "schema", "mock_table"))), false, true, ImmutableList.of(), Optional.empty());
getFutureValue(new CreateMaterializedViewTask(plannerContext, new AllowAllAccessControl(), parser, analyzerFactory, materializedViewPropertyManager, new FeaturesConfig()).execute(statement, queryStateMachine, ImmutableList.of(), WarningCollector.NOOP));
assertEquals(metadata.getCreateMaterializedViewCallCount(), 1);
}
use of io.trino.security.AllowAllAccessControl in project trino by trinodb.
the class TestCreateTableTask method testCreateWithNotNullColumns.
@Test
public void testCreateWithNotNullColumns() {
metadata.setConnectorCapabilities(NOT_NULL_COLUMN_CONSTRAINT);
List<TableElement> inputColumns = ImmutableList.of(new ColumnDefinition(identifier("a"), toSqlType(DATE), true, emptyList(), Optional.empty()), new ColumnDefinition(identifier("b"), toSqlType(VARCHAR), false, emptyList(), Optional.empty()), new ColumnDefinition(identifier("c"), toSqlType(VARBINARY), false, emptyList(), Optional.empty()));
CreateTable statement = new CreateTable(QualifiedName.of("test_table"), inputColumns, true, ImmutableList.of(), Optional.empty());
CreateTableTask createTableTask = new CreateTableTask(plannerContext, new AllowAllAccessControl(), columnPropertyManager, tablePropertyManager);
getFutureValue(createTableTask.internalExecute(statement, testSession, emptyList(), output -> {
}));
assertEquals(metadata.getCreateTableCallCount(), 1);
List<ColumnMetadata> columns = metadata.getReceivedTableMetadata().get(0).getColumns();
assertEquals(columns.size(), 3);
assertEquals(columns.get(0).getName(), "a");
assertEquals(columns.get(0).getType().getDisplayName().toUpperCase(ENGLISH), "DATE");
assertTrue(columns.get(0).isNullable());
assertEquals(columns.get(1).getName(), "b");
assertEquals(columns.get(1).getType().getDisplayName().toUpperCase(ENGLISH), "VARCHAR");
assertFalse(columns.get(1).isNullable());
assertEquals(columns.get(2).getName(), "c");
assertEquals(columns.get(2).getType().getDisplayName().toUpperCase(ENGLISH), "VARBINARY");
assertFalse(columns.get(2).isNullable());
}
use of io.trino.security.AllowAllAccessControl in project trino by trinodb.
the class TestCreateTableTask method testCreateLike.
@Test
public void testCreateLike() {
CreateTable statement = getCreatleLikeStatement(false);
CreateTableTask createTableTask = new CreateTableTask(plannerContext, new AllowAllAccessControl(), columnPropertyManager, tablePropertyManager);
getFutureValue(createTableTask.internalExecute(statement, testSession, List.of(), output -> {
}));
assertEquals(metadata.getCreateTableCallCount(), 1);
assertThat(metadata.getReceivedTableMetadata().get(0).getColumns()).isEqualTo(PARENT_TABLE.getColumns());
assertThat(metadata.getReceivedTableMetadata().get(0).getProperties()).isEmpty();
}
Aggregations