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());
}
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);
}
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);
}
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;
}
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());
}
Aggregations