use of org.apache.druid.server.security.Resource in project druid by druid-io.
the class DruidPlannerResourceAnalyzeTest method testTable.
@Test
public void testTable() {
final String sql = "SELECT COUNT(*) FROM foo WHERE foo.dim1 <> 'z'";
Set<ResourceAction> requiredResources = analyzeResources(PLANNER_CONFIG_DEFAULT, sql, CalciteTests.REGULAR_USER_AUTH_RESULT);
Assert.assertEquals(ImmutableSet.of(new ResourceAction(new Resource("foo", ResourceType.DATASOURCE), Action.READ)), requiredResources);
}
use of org.apache.druid.server.security.Resource in project druid by druid-io.
the class DruidPlannerResourceAnalyzeTest method testJoinView.
@Test
public void testJoinView() {
final String sql = "SELECT COUNT(*) FROM view.cview as aview INNER JOIN numfoo ON aview.dim2 = numfoo.dim2 WHERE numfoo.dim1 <> 'z'";
Set<ResourceAction> requiredResources = analyzeResources(PLANNER_CONFIG_DEFAULT, sql, CalciteTests.REGULAR_USER_AUTH_RESULT);
Assert.assertEquals(ImmutableSet.of(new ResourceAction(new Resource("cview", ResourceType.VIEW), Action.READ), new ResourceAction(new Resource("numfoo", ResourceType.DATASOURCE), Action.READ)), requiredResources);
}
use of org.apache.druid.server.security.Resource in project druid by druid-io.
the class DruidPlannerResourceAnalyzeTest method testConfusingTable.
@Test
public void testConfusingTable() {
final String sql = "SELECT COUNT(*) FROM foo as druid WHERE druid.dim1 <> 'z'";
Set<ResourceAction> requiredResources = analyzeResources(PLANNER_CONFIG_DEFAULT, sql, CalciteTests.REGULAR_USER_AUTH_RESULT);
Assert.assertEquals(ImmutableSet.of(new ResourceAction(new Resource("foo", ResourceType.DATASOURCE), Action.READ)), requiredResources);
}
Aggregations