use of org.teiid.query.processor.TempTableTestHarness in project teiid by teiid.
the class TestAuthorizationValidationVisitor method testCreateForeignTemp.
@Test
public void testCreateForeignTemp() throws Exception {
DataPolicyMetadata dpm = exampleAuthSvc1();
dpm.setAllowCreateTemporaryTables(false);
// $NON-NLS-1$ //$NON-NLS-2$
helpTest("create foreign temporary table x (id string) on bqt1", RealMetadataFactory.exampleBQTCached(), new String[] { "x" }, RealMetadataFactory.exampleBQTVDB(), dpm);
// $NON-NLS-1$ //$NON-NLS-2$
helpTest("create foreign temporary table x (id string) on bqt1", RealMetadataFactory.exampleBQTCached(), new String[] {}, RealMetadataFactory.exampleBQTVDB(), examplePolicyBQT());
TempTableTestHarness harness = new TempTableTestHarness();
harness.setUp(RealMetadataFactory.exampleBQTCached(), new HardcodedDataManager());
harness.execute("create foreign temporary table x (id string) on bqt1", new List[] { Arrays.asList(0) });
helpTest("insert into x (id) values ('a')", harness.getMetadata(), new String[] { "x.id" }, RealMetadataFactory.exampleBQTVDB(), dpm);
// we have create on bqt1
helpTest("insert into x (id) values ('a')", harness.getMetadata(), new String[] {}, RealMetadataFactory.exampleBQTVDB(), examplePolicyBQT());
// we don't have read on bqt1
helpTest("select * from x", harness.getMetadata(), new String[] { "x.id" }, RealMetadataFactory.exampleBQTVDB(), examplePolicyBQT());
}
Aggregations