use of org.teiid.query.validator.ValidatorReport in project teiid by teiid.
the class TestMetadataValidator method testCrossReferenceFKNoPKonRefTable.
@Test
public void testCrossReferenceFKNoPKonRefTable() throws Exception {
// note here the unique here does not matter for non-existent reference columns, only primary key counted.
String ddl = "CREATE FOREIGN TABLE G1(g1e1 integer, g1e2 varchar, UNIQUE(g1e1, g1e2));";
String ddl2 = "CREATE FOREIGN TABLE G2( g2e1 integer, g2e2 varchar, PRIMARY KEY(g2e1, g2e2), FOREIGN KEY (g2e1, g2e2) REFERENCES pm1.G1)";
buildModel("pm1", true, this.vdb, this.store, ddl);
buildModel("pm2", true, this.vdb, this.store, ddl2);
buildTransformationMetadata();
ValidatorReport report = new ValidatorReport();
report = new MetadataValidator().validate(this.vdb, this.store);
assertTrue(printError(report), report.hasItems());
}
use of org.teiid.query.validator.ValidatorReport in project teiid by teiid.
the class TestMetadataValidator method testProcWithOutOfOrderReturn.
@Test(expected = ParseException.class)
public void testProcWithOutOfOrderReturn() throws Exception {
String ddl = "create foreign procedure x (out param1 string, out param2 string result); ";
buildModel("pm1", true, this.vdb, this.store, ddl);
buildTransformationMetadata();
ValidatorReport report = new MetadataValidator().validate(vdb, store);
assertTrue(printError(report), report.hasItems());
}
use of org.teiid.query.validator.ValidatorReport in project teiid by teiid.
the class TestMetadataValidator method testResolveMetadataError.
@Test
public void testResolveMetadataError() throws Exception {
buildModel("vm1", false, this.vdb, this.store, "create view g1 (e1 integer, e2 varchar(12)) AS select * from pm1.g1; create view g2 AS select * from pm1.g1;");
buildTransformationMetadata();
ValidatorReport report = new ValidatorReport();
new MetadataValidator.ResolveQueryPlans().execute(vdb, store, report, new MetadataValidator());
assertTrue(printError(report), report.hasItems());
}
use of org.teiid.query.validator.ValidatorReport in project teiid by teiid.
the class TestMetadataValidator method testProcWithMultipleReturn.
@Test(expected = ParseException.class)
public void testProcWithMultipleReturn() throws Exception {
String ddl = "create foreign procedure x (out param1 string result, out param2 string result); ";
buildModel("pm1", true, this.vdb, this.store, ddl);
buildTransformationMetadata();
ValidatorReport report = new MetadataValidator().validate(vdb, store);
assertTrue(printError(report), report.hasItems());
}
use of org.teiid.query.validator.ValidatorReport in project teiid by teiid.
the class TestMetadataValidator method testCrossReferenceFK.
@Test
public void testCrossReferenceFK() throws Exception {
String ddl = "CREATE FOREIGN TABLE G1(g1e1 integer, g1e2 varchar, PRIMARY KEY(g1e1, g1e2));";
String ddl2 = "CREATE FOREIGN TABLE G2( g2e1 integer, g2e2 varchar, PRIMARY KEY(g2e1, g2e2), FOREIGN KEY (g2e1, g2e2) REFERENCES pm1.G1(g1e1, g1e2))";
buildModel("pm1", true, this.vdb, this.store, ddl);
buildModel("pm2", true, this.vdb, this.store, ddl2);
buildTransformationMetadata();
ValidatorReport report = new ValidatorReport();
report = new MetadataValidator().validate(this.vdb, this.store);
assertFalse(printError(report), report.hasItems());
assertNotNull(this.store.getSchema("pm2").getTable("G2").getForeignKeys().get(0).getReferenceKey());
assertEquals(2, this.store.getSchema("pm2").getTable("G2").getForeignKeys().get(0).getReferenceKey().getColumns().size());
assertEquals("g1e1", this.store.getSchema("pm2").getTable("G2").getForeignKeys().get(0).getReferenceKey().getColumns().get(0).getName());
}
Aggregations