Search in sources :

Example 6 with ODataType

use of org.teiid.translator.odata4.ODataMetadataProcessor.ODataType in project teiid by teiid.

the class TestODataMetadataProcessor method testFunction.

@Test
public void testFunction() throws Exception {
    CsdlReturnType returnType = new CsdlReturnType();
    returnType.setType("Edm.String");
    MetadataFactory mf = functionMetadata("invoke", returnType, null);
    Procedure p = mf.getSchema().getProcedure("invoke");
    assertNotNull(p);
    assertEquals(3, p.getParameters().size());
    assertNull(p.getResultSet());
    assertNotNull(getReturnParameter(p));
    ProcedureParameter pp = getReturnParameter(p);
    assertEquals("string", pp.getRuntimeType());
    ODataType type = ODataType.valueOf(p.getProperty(ODataMetadataProcessor.ODATA_TYPE, false));
    assertEquals(ODataType.FUNCTION, type);
}
Also used : ProcedureParameter(org.teiid.metadata.ProcedureParameter) RealMetadataFactory(org.teiid.query.unittest.RealMetadataFactory) MetadataFactory(org.teiid.metadata.MetadataFactory) ODataType(org.teiid.translator.odata4.ODataMetadataProcessor.ODataType) Procedure(org.teiid.metadata.Procedure) Test(org.junit.Test)

Aggregations

ODataType (org.teiid.translator.odata4.ODataMetadataProcessor.ODataType)6 Test (org.junit.Test)5 MetadataFactory (org.teiid.metadata.MetadataFactory)5 Procedure (org.teiid.metadata.Procedure)5 RealMetadataFactory (org.teiid.query.unittest.RealMetadataFactory)5 ProcedureParameter (org.teiid.metadata.ProcedureParameter)3 InputStream (java.io.InputStream)1 JsonDeserializer (org.apache.olingo.client.core.serialization.JsonDeserializer)1 Property (org.apache.olingo.commons.api.data.Property)1 HttpStatusCode (org.apache.olingo.commons.api.http.HttpStatusCode)1 TranslatorException (org.teiid.translator.TranslatorException)1 DocumentNode (org.teiid.translator.document.DocumentNode)1