use of org.teiid.metadata.DuplicateRecordException in project teiid by teiid.
the class TestDynamicImportedMetaData method testDuplicateException.
@Test
public void testDuplicateException() throws Exception {
MetadataFactory mf = createMetadataFactory("x", new Properties());
MetadataFactory mf1 = createMetadataFactory("y", new Properties());
Table dup = mf.addTable("dup");
Table dup1 = mf1.addTable("dup");
mf.addColumn("x", DataTypeManager.DefaultDataTypes.STRING, dup);
mf1.addColumn("x", DataTypeManager.DefaultDataTypes.STRING, dup1);
MetadataStore ms = mf.asMetadataStore();
ms.addSchema(mf1.asMetadataStore().getSchemas().values().iterator().next());
server.deployVDB("test", ms);
// $NON-NLS-1$
Connection conn = server.createConnection("jdbc:teiid:test");
Properties importProperties = new Properties();
mf = getMetadata(importProperties, conn);
Table t = mf.asMetadataStore().getSchemas().get("TEST").getTables().get("TEST.X.DUP");
assertEquals("\"test\".\"x\".\"dup\"", t.getNameInSource());
importProperties.setProperty("importer.useFullSchemaName", Boolean.FALSE.toString());
try {
getMetadata(importProperties, conn);
fail();
} catch (DuplicateRecordException e) {
}
}
Aggregations