Search in sources :

Example 6 with Dimension

use of org.teiid.translator.couchbase.CouchbaseMetadataProcessor.Dimension 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 7 with Dimension

use of org.teiid.translator.couchbase.CouchbaseMetadataProcessor.Dimension 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 8 with Dimension

use of org.teiid.translator.couchbase.CouchbaseMetadataProcessor.Dimension 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 9 with Dimension

use of org.teiid.translator.couchbase.CouchbaseMetadataProcessor.Dimension in project teiid by teiid.

the class TestVisitor method queryMetadataInterface.

private static TransformationMetadata queryMetadataInterface() {
    try {
        ModelMetaData mmd = new ModelMetaData();
        mmd.setName("couchbase");
        CouchbaseMetadataProcessor mp = new CouchbaseMetadataProcessor();
        MetadataFactory mf = new MetadataFactory("couchbase", 1, SystemMetadata.getInstance().getRuntimeTypeMap(), mmd);
        Table customer = createTable(mf, KEYSPACE, "Customer");
        mp.scanRow(KEYSPACE, KEYSPACE_SOURCE, formCustomer(), mf, customer, customer.getName(), false, new Dimension());
        Table order = createTable(mf, KEYSPACE, "Oder");
        mp.scanRow(KEYSPACE, KEYSPACE_SOURCE, formOder(), mf, order, order.getName(), false, new Dimension());
        Table t2 = createTable(mf, "T2", "T2");
        mp.scanRow("T2", "`T2`", formDataTypeJson(), mf, t2, t2.getName(), false, new Dimension());
        Table t3 = createTable(mf, "T3", "T3");
        mp.scanRow("T3", "`T3`", nestedJson(), mf, t3, t3.getName(), false, new Dimension());
        mp.scanRow("T3", "`T3`", nestedArray(), mf, t3, t3.getName(), false, new Dimension());
        mp.addProcedures(mf, null);
        TransformationMetadata tm = RealMetadataFactory.createTransformationMetadata(mf.asMetadataStore(), "x");
        ValidatorReport report = new MetadataValidator().validate(tm.getVdbMetaData(), tm.getMetadataStore());
        if (report.hasItems()) {
            throw new RuntimeException(report.getFailureMessage());
        }
        return tm;
    } catch (MetadataException e) {
        throw new RuntimeException(e);
    }
}
Also used : TransformationMetadata(org.teiid.query.metadata.TransformationMetadata) Table(org.teiid.metadata.Table) RealMetadataFactory(org.teiid.query.unittest.RealMetadataFactory) MetadataFactory(org.teiid.metadata.MetadataFactory) TestCouchbaseMetadataProcessor(org.teiid.translator.couchbase.TestCouchbaseMetadataProcessor) MetadataValidator(org.teiid.query.metadata.MetadataValidator) Dimension(org.teiid.translator.couchbase.CouchbaseMetadataProcessor.Dimension) ValidatorReport(org.teiid.query.validator.ValidatorReport) MetadataException(org.teiid.metadata.MetadataException) ModelMetaData(org.teiid.adminapi.impl.ModelMetaData)

Example 10 with Dimension

use of org.teiid.translator.couchbase.CouchbaseMetadataProcessor.Dimension in project teiid by teiid.

the class TestCouchbaseMetadataProcessor method testDataType.

@Test
public void testDataType() throws ResourceException {
    /* 10 potential types: String, Integer, Long, Double, Boolean, BigInteger, BigDecimal, JsonObject, JsonArray, null */
    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, formDataTypeJson(), mf, table, KEYSPACE, false, new Dimension());
    helpTest("dataTypeJson.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)

Aggregations

MetadataFactory (org.teiid.metadata.MetadataFactory)14 Table (org.teiid.metadata.Table)14 Dimension (org.teiid.translator.couchbase.CouchbaseMetadataProcessor.Dimension)14 Properties (java.util.Properties)13 Test (org.junit.Test)13 CouchbaseMetadataProcessor (org.teiid.translator.couchbase.CouchbaseMetadataProcessor)13 CouchbaseProperties (org.teiid.translator.couchbase.CouchbaseProperties)13 JsonObject (com.couchbase.client.java.document.json.JsonObject)1 Ignore (org.junit.Ignore)1 ModelMetaData (org.teiid.adminapi.impl.ModelMetaData)1 MetadataException (org.teiid.metadata.MetadataException)1 MetadataValidator (org.teiid.query.metadata.MetadataValidator)1 TransformationMetadata (org.teiid.query.metadata.TransformationMetadata)1 RealMetadataFactory (org.teiid.query.unittest.RealMetadataFactory)1 ValidatorReport (org.teiid.query.validator.ValidatorReport)1 TestCouchbaseMetadataProcessor (org.teiid.translator.couchbase.TestCouchbaseMetadataProcessor)1