Search in sources :

Example 41 with MetadataFactory

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

the class TestMetadataValidator method testSkipDocumentModel.

@Test
public void testSkipDocumentModel() throws Exception {
    ModelMetaData model = new ModelMetaData();
    model.setName("xmlstuff");
    model.setModelType(Model.Type.VIRTUAL);
    vdb.addModel(model);
    MetadataFactory mf = new MetadataFactory("myVDB", 1, "xmlstuff", TestDDLParser.getDataTypes(), new Properties(), null);
    mf.getSchema().setPhysical(false);
    Table t = mf.addTable("xmldoctable");
    t.setTableType(Table.Type.Document);
    mf.addColumn("c1", "string", t);
    t.setSelectTransformation("some dummy stuff, should not be validated");
    t.setVirtual(true);
    Table t2 = mf.addTable("xmldoctable2");
    t2.setTableType(Table.Type.XmlMappingClass);
    mf.addColumn("c1", "string", t2);
    t2.setSelectTransformation("some dummy stuff, should not be validated");
    t2.setVirtual(true);
    mf.mergeInto(store);
    buildTransformationMetadata();
    ValidatorReport report = new MetadataValidator().validate(this.vdb, this.store);
    assertFalse(printError(report), report.hasItems());
}
Also used : Table(org.teiid.metadata.Table) MetadataFactory(org.teiid.metadata.MetadataFactory) Properties(java.util.Properties) ValidatorReport(org.teiid.query.validator.ValidatorReport) ModelMetaData(org.teiid.adminapi.impl.ModelMetaData) Test(org.junit.Test)

Example 42 with MetadataFactory

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

the class TestHotrodExecution method setup.

@BeforeClass
public static void setup() throws Exception {
    TimestampWithTimezone.resetCalendar(TimeZone.getTimeZone("GMT-5"));
    SERVER = new HotRodTestServer(PORT);
    MetadataFactory mf = TestProtobufMetadataProcessor.protoMatadata("tables.proto");
    EF = new InfinispanExecutionFactory();
    TransformationMetadata tm = TestProtobufMetadataProcessor.getTransformationMetadata(mf, EF);
    // String ddl = DDLStringVisitor.getDDLString(mf.getSchema(), null, null);
    // System.out.println(ddl);
    METADATA = new RuntimeMetadataImpl(tm);
    UTILITY = new TranslationUtility(tm);
    InfinispanConnection connection = SERVER.getConnection();
    // only use G2 & G4 as cache only support single id
    connection.registerProtobufFile(new ProtobufResource("tables.proto", ObjectConverterUtil.convertFileToString(UnitTestUtil.getTestDataFile("tables.proto"))));
    EC = Mockito.mock(ExecutionContext.class);
    Mockito.stub(EC.getBatchSize()).toReturn(512);
}
Also used : TransformationMetadata(org.teiid.query.metadata.TransformationMetadata) ExecutionContext(org.teiid.translator.ExecutionContext) MetadataFactory(org.teiid.metadata.MetadataFactory) RuntimeMetadataImpl(org.teiid.dqp.internal.datamgr.RuntimeMetadataImpl) HotRodTestServer(org.teiid.infinispan.api.HotRodTestServer) TranslationUtility(org.teiid.cdk.api.TranslationUtility) InfinispanConnection(org.teiid.infinispan.api.InfinispanConnection) ProtobufResource(org.teiid.infinispan.api.ProtobufResource) BeforeClass(org.junit.BeforeClass)

Example 43 with MetadataFactory

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

the class TestIckleConversionVisitor method helpUpdate.

private void helpUpdate(String query, String expected) throws Exception {
    MetadataFactory mf = TestProtobufMetadataProcessor.protoMatadata("tables.proto");
    // String ddl = DDLStringVisitor.getDDLString(mf.getSchema(), null, null);
    helpUpdate(mf, query, expected);
}
Also used : MetadataFactory(org.teiid.metadata.MetadataFactory)

Example 44 with MetadataFactory

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

the class TestProtobufMetadataProcessor method protoMatadata.

public static MetadataFactory protoMatadata(String protoFile) throws TranslatorException {
    ProtobufMetadataProcessor processor = new ProtobufMetadataProcessor();
    processor.setProtoFilePath(UnitTestUtil.getTestDataPath() + "/" + protoFile);
    Properties props = new Properties();
    MetadataFactory mf = new MetadataFactory("proto", 1, "model", SystemMetadata.getInstance().getRuntimeTypeMap(), props, null);
    processor.process(mf, null);
    return mf;
}
Also used : RealMetadataFactory(org.teiid.query.unittest.RealMetadataFactory) MetadataFactory(org.teiid.metadata.MetadataFactory) Properties(java.util.Properties)

Example 45 with MetadataFactory

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

the class TestProtobufMetadataProcessor method testTableWireFormat.

@Test
public void testTableWireFormat() throws Exception {
    MetadataFactory mf = protoMatadata("tables.proto");
    InfinispanExecutionFactory ef = new InfinispanExecutionFactory();
    TransformationMetadata metadata = getTransformationMetadata(mf, ef);
    TreeMap<Integer, TableWireFormat> map = MarshallerBuilder.getWireMap(mf.getSchema().getTable("G2"), new RuntimeMetadataImpl(metadata));
    String expected = "{8=TableWireFormat [expectedTag=8, attributeName=e1, nested=null], " + "18=TableWireFormat [expectedTag=18, attributeName=e2, nested=null], " + "42=TableWireFormat [expectedTag=42, attributeName=pm1.G3, nested={" + "8=TableWireFormat [expectedTag=8, attributeName=pm1.G2/pm1.G3/e1, nested=null], " + "18=TableWireFormat [expectedTag=18, attributeName=pm1.G2/pm1.G3/e2, nested=null]}], " + "50=TableWireFormat [expectedTag=50, attributeName=pm1.G4, nested={" + "8=TableWireFormat [expectedTag=8, attributeName=pm1.G2/pm1.G4/e1, nested=null], " + "18=TableWireFormat [expectedTag=18, attributeName=pm1.G2/pm1.G4/e2, nested=null]}], " + "58=TableWireFormat [expectedTag=58, attributeName=e5, nested=null], " + "65=TableWireFormat [expectedTag=65, attributeName=e6, nested=null]}";
    assertEquals(expected, map.toString());
}
Also used : TransformationMetadata(org.teiid.query.metadata.TransformationMetadata) RealMetadataFactory(org.teiid.query.unittest.RealMetadataFactory) MetadataFactory(org.teiid.metadata.MetadataFactory) RuntimeMetadataImpl(org.teiid.dqp.internal.datamgr.RuntimeMetadataImpl) TableWireFormat(org.teiid.infinispan.api.TableWireFormat) Test(org.junit.Test)

Aggregations

MetadataFactory (org.teiid.metadata.MetadataFactory)159 Test (org.junit.Test)116 RealMetadataFactory (org.teiid.query.unittest.RealMetadataFactory)91 Properties (java.util.Properties)74 Table (org.teiid.metadata.Table)59 TransformationMetadata (org.teiid.query.metadata.TransformationMetadata)35 Procedure (org.teiid.metadata.Procedure)30 ModelMetaData (org.teiid.adminapi.impl.ModelMetaData)21 Column (org.teiid.metadata.Column)20 Connection (java.sql.Connection)18 FunctionTree (org.teiid.query.function.FunctionTree)15 UDFSource (org.teiid.query.function.UDFSource)14 CouchbaseMetadataProcessor (org.teiid.translator.couchbase.CouchbaseMetadataProcessor)14 Dimension (org.teiid.translator.couchbase.CouchbaseMetadataProcessor.Dimension)14 CouchbaseProperties (org.teiid.translator.couchbase.CouchbaseProperties)14 TranslationUtility (org.teiid.cdk.api.TranslationUtility)13 ValidatorReport (org.teiid.query.validator.ValidatorReport)13 XMLMetadata (org.apache.olingo.client.api.edm.xml.XMLMetadata)12 ClientCsdlXMLMetadata (org.apache.olingo.client.core.edm.ClientCsdlXMLMetadata)12 ForeignKey (org.teiid.metadata.ForeignKey)12