use of org.teiid.query.metadata.NativeMetadataRepository in project teiid by teiid.
the class TestDynamicImportedMetaData method testImportFunction.
@Test
public void testImportFunction() throws Exception {
MetadataFactory mf = createMetadataFactory("x", new Properties());
Table dup = mf.addTable("dup");
mf.addColumn("x", DataTypeManager.DefaultDataTypes.STRING, dup);
MetadataStore ms = mf.asMetadataStore();
server.deployVDB("test", ms);
// $NON-NLS-1$
Connection conn = server.createConnection("jdbc:teiid:test");
Properties importProperties = new Properties();
importProperties.setProperty(NativeMetadataRepository.IMPORT_PUSHDOWN_FUNCTIONS, Boolean.TRUE.toString());
mf = createMetadataFactory("test", importProperties);
NativeMetadataRepository nmr = new NativeMetadataRepository();
OracleExecutionFactory oef = new OracleExecutionFactory();
oef.start();
DataSource ds = Mockito.mock(DataSource.class);
Mockito.stub(ds.getConnection()).toReturn(conn);
nmr.loadMetadata(mf, oef, ds);
Map<String, FunctionMethod> functions = mf.asMetadataStore().getSchemas().get("TEST").getFunctions();
assertEquals(18, functions.size());
}
Aggregations