use of io.prestosql.spi.type.VarcharType in project ranger by apache.
the class RangerSystemAccessControlTest method testMisc.
@Test
@SuppressWarnings("PMD")
public void testMisc() {
assertEquals(accessControlManager.filterViewQueryOwnedBy(context(alice), queryOwners), queryOwners);
// check {type} / {col} replacement
final VarcharType varcharType = VarcharType.createVarcharType(20);
Optional<ViewExpression> ret = accessControlManager.getColumnMask(context(alice), aliceTable, "cast_me", varcharType);
assertNotNull(ret.get());
assertEquals(ret.get().getExpression(), "cast cast_me as varchar(20)");
ret = accessControlManager.getColumnMask(context(alice), aliceTable, "do-not-cast-me", varcharType);
assertFalse(ret.isPresent());
ret = accessControlManager.getRowFilter(context(alice), aliceTable);
assertFalse(ret.isPresent());
accessControlManager.checkCanExecuteFunction(context(alice), functionName);
accessControlManager.checkCanGrantExecuteFunctionPrivilege(context(alice), functionName, new PrestoPrincipal(USER, "grantee"), true);
accessControlManager.checkCanExecuteProcedure(context(alice), aliceProcedure);
}
Aggregations