use of com.facebook.presto.sql.tree.SetRole in project presto by prestodb.
the class TestSqlParser method testSetRole.
@Test
public void testSetRole() throws Exception {
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 com.facebook.presto.sql.tree.SetRole in project presto by prestodb.
the class TestSetRoleTask method assertSetRole.
private void assertSetRole(String statement, Map<String, SelectedRole> expected) {
SetRole setRole = (SetRole) parser.createStatement(statement);
Session session = testSessionBuilder().setCatalog(CATALOG_NAME).build();
QueryStateMachine stateMachine = createQueryStateMachine(statement, session, false, transactionManager, executor, metadata);
SetRoleTask setRoleTask = new SetRoleTask();
setRoleTask.execute(setRole, transactionManager, metadata, accessControl, stateMachine, ImmutableList.of());
QueryInfo queryInfo = stateMachine.getQueryInfo(Optional.empty());
assertEquals(queryInfo.getSetRoles(), expected);
}
Aggregations