use of org.teiid.metadata.Table in project teiid by teiid.
the class TestCouchbaseMetadataProcessor method testCustomerOrderMultiple.
@Test
public void testCustomerOrderMultiple() 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, formCustomer(), mf, table, KEYSPACE, false, new Dimension());
mp.scanRow(KEYSPACE, KEYSPACE_SOURCE, formOder(), mf, table, KEYSPACE, false, new Dimension());
mp.scanRow(KEYSPACE, KEYSPACE_SOURCE, formCustomer(), mf, table, KEYSPACE, false, new Dimension());
mp.scanRow(KEYSPACE, KEYSPACE_SOURCE, formOder(), mf, table, KEYSPACE, false, new Dimension());
helpTest("customerOrder.expected", mf);
}
use of org.teiid.metadata.Table 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);
}
use of org.teiid.metadata.Table in project teiid by teiid.
the class TestCouchbaseMetadataProcessor method createTable.
static Table createTable(MetadataFactory mf, String keyspace, String typedKey, String tableName) {
if (mf.getSchema().getTable(tableName) != null && !tableName.equals(keyspace)) {
tableName = keyspace + UNDERSCORE + tableName;
}
Table table = mf.addTable(tableName);
table.setNameInSource(WAVE + keyspace + WAVE);
table.setSupportsUpdate(true);
table.setProperty(IS_ARRAY_TABLE, FALSE_VALUE);
if (!tableName.equals(keyspace)) {
table.setProperty(NAMED_TYPE_PAIR, buildNamedTypePair("`" + typedKey + "`", tableName));
}
mf.addColumn(DOCUMENTID, STRING, table);
// $NON-NLS-1$
mf.addPrimaryKey("PK0", Arrays.asList(DOCUMENTID), table);
return table;
}
use of org.teiid.metadata.Table 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);
}
use of org.teiid.metadata.Table 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);
}
Aggregations