use of io.prestosql.sql.tree.SetRole in project hetu-core by openlookeng.
the class TestSqlParser method testSetRole.
@Test
public void testSetRole() {
assertStatement("SET ROLE ALL", new SetRole(SetRole.Type.ALL, Optional.empty()));
assertStatement("SET ROLE NONE", new SetRole(SetRole.Type.NONE, Optional.empty()));
assertStatement("SET ROLE role", new SetRole(SetRole.Type.ROLE, Optional.of(new Identifier("role"))));
assertStatement("SET ROLE \"role\"", new SetRole(SetRole.Type.ROLE, Optional.of(new Identifier("role"))));
}
use of io.prestosql.sql.tree.SetRole in project hetu-core by openlookeng.
the class TestSetRoleTask method assertSetRole.
private void assertSetRole(String statement, Map<String, SelectedRole> expected) {
SetRole setRole = (SetRole) parser.createStatement(statement);
QueryStateMachine stateMachine = QueryStateMachine.begin(statement, Optional.empty(), testSessionBuilder().setCatalog(CATALOG_NAME).build(), URI.create("fake://uri"), new ResourceGroupId("test"), new NoOpResourceGroupManager(), false, transactionManager, accessControl, executor, metadata, WarningCollector.NOOP);
new SetRoleTask().execute(setRole, transactionManager, metadata, accessControl, stateMachine, ImmutableList.of(), new HeuristicIndexerManager(new FileSystemClientManager(), new HetuMetaStoreManager()));
QueryInfo queryInfo = stateMachine.getQueryInfo(Optional.empty());
assertEquals(queryInfo.getSetRoles(), expected);
}
Aggregations