Search in sources :

Example 81 with Procedure

use of org.teiid.metadata.Procedure in project teiid by teiid.

the class TestProcedure method testProcedureWithResultSet.

public void testProcedureWithResultSet() throws Exception {
    // $NON-NLS-1$
    Procedure proc = getProcedure("ConnectorMetadata.TestProc2", 1, CONNECTOR_METADATA_UTILITY);
    assertEquals(null, proc.getNameInSource());
    String[] nameInSource = new String[] { null };
    ProcedureParameter.Type[] direction = new ProcedureParameter.Type[] { ProcedureParameter.Type.In };
    int[] index = new int[] { 1 };
    Class<?>[] type = new Class[] { String.class };
    checkParams(proc, nameInSource, direction, index, type);
    List<Column> rsCols = proc.getResultSet().getColumns();
    // Check first column of result set
    assertEquals(2, rsCols.size());
    Column elemID = rsCols.get(0);
    // $NON-NLS-1$
    assertEquals("RSCol1", elemID.getName());
    // $NON-NLS-1$
    assertEquals("ConnectorMetadata.TestProc2.RSParam.RSCol1", elemID.getFullName());
    // $NON-NLS-1$
    assertEquals("Result set column name in source", elemID.getNameInSource());
    assertEquals(java.sql.Timestamp.class, elemID.getJavaType());
    assertEquals(1, elemID.getPosition());
    Column elemID2 = rsCols.get(1);
    // $NON-NLS-1$
    assertEquals("RSCol2", elemID2.getName());
    // $NON-NLS-1$
    assertEquals("ConnectorMetadata.TestProc2.RSParam.RSCol2", elemID2.getFullName());
    assertEquals(null, elemID2.getNameInSource());
    assertEquals(String.class, elemID2.getJavaType());
    assertEquals(2, elemID2.getPosition());
    Properties props = new Properties();
    // $NON-NLS-1$ //$NON-NLS-2$
    props.put("ColProp", "defaultvalue");
// failing because default extension properties aren't in the VDB file
// assertEquals(props, e2.getProperties());
}
Also used : Column(org.teiid.metadata.Column) Procedure(org.teiid.metadata.Procedure) Properties(java.util.Properties)

Example 82 with Procedure

use of org.teiid.metadata.Procedure in project teiid by teiid.

the class TestDynamicImportedMetaData method testProcImport.

@Test
public void testProcImport() throws Exception {
    server.deployVDB("vdb", UnitTestUtil.getTestDataPath() + "/TestCase3473/test.vdb");
    // $NON-NLS-1$
    Connection conn = server.createConnection("jdbc:teiid:vdb");
    Properties importProperties = new Properties();
    importProperties.setProperty("importer.importProcedures", Boolean.TRUE.toString());
    MetadataFactory mf = getMetadata(importProperties, conn);
    Procedure p = mf.asMetadataStore().getSchemas().get("TEST").getProcedures().get("VDB.SYS.GETXMLSCHEMAS");
    assertEquals(1, p.getResultSet().getColumns().size());
}
Also used : MetadataFactory(org.teiid.metadata.MetadataFactory) Connection(java.sql.Connection) Procedure(org.teiid.metadata.Procedure) Properties(java.util.Properties) Test(org.junit.Test)

Aggregations

Procedure (org.teiid.metadata.Procedure)82 ProcedureParameter (org.teiid.metadata.ProcedureParameter)36 Test (org.junit.Test)35 MetadataFactory (org.teiid.metadata.MetadataFactory)30 RealMetadataFactory (org.teiid.query.unittest.RealMetadataFactory)27 Schema (org.teiid.metadata.Schema)16 Column (org.teiid.metadata.Column)14 MetadataStore (org.teiid.metadata.MetadataStore)11 Properties (java.util.Properties)10 TransformationMetadata (org.teiid.query.metadata.TransformationMetadata)10 Table (org.teiid.metadata.Table)9 QueryNode (org.teiid.query.mapping.relational.QueryNode)8 List (java.util.List)6 QueryMetadataInterface (org.teiid.query.metadata.QueryMetadataInterface)6 TempMetadataStore (org.teiid.query.metadata.TempMetadataStore)5 TranslatorException (org.teiid.translator.TranslatorException)5 ODataType (org.teiid.translator.odata4.ODataMetadataProcessor.ODataType)5 ArrayList (java.util.ArrayList)4 Call (org.teiid.language.Call)4 ByteArrayInputStream (java.io.ByteArrayInputStream)3