Search in sources :

Example 1 with TempTableTestHarness

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());
}
Also used : TempTableTestHarness(org.teiid.query.processor.TempTableTestHarness) HardcodedDataManager(org.teiid.query.processor.HardcodedDataManager) DataPolicyMetadata(org.teiid.adminapi.impl.DataPolicyMetadata) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 DataPolicyMetadata (org.teiid.adminapi.impl.DataPolicyMetadata)1 HardcodedDataManager (org.teiid.query.processor.HardcodedDataManager)1 TempTableTestHarness (org.teiid.query.processor.TempTableTestHarness)1