Search in sources :

Example 6 with MetadataFactory

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

the class TestCouchbaseMetadataProcessor method testCustomerWithDuplicatedTypedName.

@Test
public void testCustomerWithDuplicatedTypedName() throws ResourceException {
    CouchbaseMetadataProcessor mp = new CouchbaseMetadataProcessor();
    mp.setTypeNameList("`test`:`type`,`test2`:`type`");
    MetadataFactory mf = new MetadataFactory("vdb", 1, "couchbase", SystemMetadata.getInstance().getRuntimeTypeMap(), new Properties(), null);
    String typedName = "Customer";
    String keyspace1 = "test";
    String keyspace2 = "test2";
    Table table1 = createTable(mf, keyspace1, typedName);
    mp.scanRow("test", KEYSPACE_SOURCE, formCustomer(), mf, table1, table1.getName(), false, new Dimension());
    Table table2 = createTable(mf, keyspace2, typedName);
    mp.scanRow("test2", "`test2`", formCustomer(), mf, table2, table2.getName(), false, new Dimension());
    helpTest("customerDuplicatedTypedName.expected", mf);
}
Also used : Table(org.teiid.metadata.Table) MetadataFactory(org.teiid.metadata.MetadataFactory) CouchbaseMetadataProcessor(org.teiid.translator.couchbase.CouchbaseMetadataProcessor) Dimension(org.teiid.translator.couchbase.CouchbaseMetadataProcessor.Dimension) CouchbaseProperties(org.teiid.translator.couchbase.CouchbaseProperties) Properties(java.util.Properties) Test(org.junit.Test)

Example 7 with MetadataFactory

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

the class TestCouchbaseMetadataProcessor method testNestedJsonWithTypedName.

@Test
public void testNestedJsonWithTypedName() throws ResourceException {
    CouchbaseMetadataProcessor mp = new CouchbaseMetadataProcessor();
    MetadataFactory mf = new MetadataFactory("vdb", 1, "couchbase", SystemMetadata.getInstance().getRuntimeTypeMap(), new Properties(), null);
    Table table = createTable(mf, KEYSPACE, "Sample");
    mp.scanRow(KEYSPACE, KEYSPACE_SOURCE, nestedJson(), mf, table, "Sample", false, new Dimension());
    helpTest("nestedJsonTypedName.expected", mf);
}
Also used : Table(org.teiid.metadata.Table) MetadataFactory(org.teiid.metadata.MetadataFactory) CouchbaseMetadataProcessor(org.teiid.translator.couchbase.CouchbaseMetadataProcessor) Dimension(org.teiid.translator.couchbase.CouchbaseMetadataProcessor.Dimension) CouchbaseProperties(org.teiid.translator.couchbase.CouchbaseProperties) Properties(java.util.Properties) Test(org.junit.Test)

Example 8 with MetadataFactory

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

the class TestCouchbaseMetadataProcessor method testMoreTypedNameInOneKeyspace.

@Test
public void testMoreTypedNameInOneKeyspace() throws ResourceException {
    CouchbaseMetadataProcessor mp = new CouchbaseMetadataProcessor();
    mp.setTypeNameList("`test`:`type`,`test`:`name`,`test`:`category`");
    MetadataFactory mf = new MetadataFactory("vdb", 1, "couchbase", SystemMetadata.getInstance().getRuntimeTypeMap(), new Properties(), null);
    Table ea = createTable(mf, KEYSPACE, "name", "ExampleA");
    mp.scanRow("test", KEYSPACE_SOURCE, JsonObject.create().put("name", "ExampleA"), mf, ea, ea.getName(), false, new Dimension());
    Table eb = createTable(mf, KEYSPACE, "name", "ExampleB");
    mp.scanRow("test", KEYSPACE_SOURCE, JsonObject.create().put("name", "ExampleB"), mf, eb, eb.getName(), false, new Dimension());
    Table sa = createTable(mf, KEYSPACE, "type", "SampleA");
    mp.scanRow("test", KEYSPACE_SOURCE, JsonObject.create().put("type", "SampleA"), mf, sa, sa.getName(), false, new Dimension());
    Table sb = createTable(mf, KEYSPACE, "type", "SampleB");
    mp.scanRow("test", KEYSPACE_SOURCE, JsonObject.create().put("type", "SampleB"), mf, sb, sb.getName(), false, new Dimension());
    Table qa = createTable(mf, KEYSPACE, "category", "QuickstartA");
    mp.scanRow("test", KEYSPACE_SOURCE, JsonObject.create().put("category", "QuickstartA"), mf, qa, qa.getName(), false, new Dimension());
    Table qb = createTable(mf, KEYSPACE, "type", "QuickstartB");
    mp.scanRow("test", KEYSPACE_SOURCE, JsonObject.create().put("type", "QuickstartB").put("name", "SampleC").put("category", "ExampleC"), mf, qb, qb.getName(), false, new Dimension());
    helpTest("moreTypedNameInOneKeyspace.expected", mf);
}
Also used : Table(org.teiid.metadata.Table) MetadataFactory(org.teiid.metadata.MetadataFactory) CouchbaseMetadataProcessor(org.teiid.translator.couchbase.CouchbaseMetadataProcessor) Dimension(org.teiid.translator.couchbase.CouchbaseMetadataProcessor.Dimension) CouchbaseProperties(org.teiid.translator.couchbase.CouchbaseProperties) Properties(java.util.Properties) Test(org.junit.Test)

Example 9 with MetadataFactory

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

the class TestCouchbaseMetadataProcessor method testNestedJson.

@Test
public void testNestedJson() throws ResourceException {
    CouchbaseMetadataProcessor mp = new CouchbaseMetadataProcessor();
    MetadataFactory mf = new MetadataFactory("vdb", 1, "couchbase", SystemMetadata.getInstance().getRuntimeTypeMap(), new Properties(), null);
    Table table = createTable(mf, KEYSPACE, KEYSPACE);
    mp.scanRow(KEYSPACE, KEYSPACE_SOURCE, nestedJson(), mf, table, KEYSPACE, false, new Dimension());
    helpTest("nestedJson.expected", mf);
}
Also used : Table(org.teiid.metadata.Table) MetadataFactory(org.teiid.metadata.MetadataFactory) CouchbaseMetadataProcessor(org.teiid.translator.couchbase.CouchbaseMetadataProcessor) Dimension(org.teiid.translator.couchbase.CouchbaseMetadataProcessor.Dimension) CouchbaseProperties(org.teiid.translator.couchbase.CouchbaseProperties) Properties(java.util.Properties) Test(org.junit.Test)

Example 10 with MetadataFactory

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

the class TestSimpleDBSQLVisitor method testEveryNotNull.

@Test
public void testEveryNotNull() throws Exception {
    SimpleDBExecutionFactory translator = new SimpleDBExecutionFactory();
    translator.start();
    MetadataFactory mf = TestDDLParser.helpParse("create foreign table item (\"itemName()\" integer, attribute string[]);", "y");
    TransformationMetadata metadata = RealMetadataFactory.createTransformationMetadata(mf.asMetadataStore(), "x", new FunctionTree("foo", new UDFSource(translator.getPushDownFunctions())));
    TranslationUtility tu = new TranslationUtility(metadata);
    Command c = tu.parseCommand("select * from item where simpledb.every(attribute) is not null");
    SimpleDBSQLVisitor visitor = new SimpleDBSQLVisitor();
    visitor.append(c);
    assertEquals("SELECT attribute FROM item WHERE SIMPLEDB.EVERY(attribute) IS NOT NULL", visitor.toString());
}
Also used : UDFSource(org.teiid.query.function.UDFSource) TransformationMetadata(org.teiid.query.metadata.TransformationMetadata) FunctionTree(org.teiid.query.function.FunctionTree) RealMetadataFactory(org.teiid.query.unittest.RealMetadataFactory) MetadataFactory(org.teiid.metadata.MetadataFactory) Command(org.teiid.language.Command) SimpleDBSQLVisitor(org.teiid.translator.simpledb.SimpleDBSQLVisitor) TranslationUtility(org.teiid.cdk.api.TranslationUtility) SimpleDBExecutionFactory(org.teiid.translator.simpledb.SimpleDBExecutionFactory) 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