use of org.teiid.query.validator.ValidatorReport in project teiid by teiid.
the class TestMetadataValidator method testResolveMetadata.
@Test
public void testResolveMetadata() throws Exception {
String ddl = "create view g1 (e1 integer, e2 varchar(12)) AS select * from pm1.g1; " + "create view g2 AS select * from pm1.g1; " + "create trigger on g1 INSTEAD OF UPDATE AS FOR EACH ROW BEGIN ATOMIC END; " + "create virtual procedure proc1(IN e1 varchar) RETURNS (e1 integer, e2 varchar(12)) AS select * from foo; ";
buildModel("pm1", true, this.vdb, this.store, "create foreign table g1(e1 integer, e2 varchar(12));");
buildModel("vm1", false, this.vdb, this.store, ddl);
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 testExternalMaterializationValidate.
@Test
public void testExternalMaterializationValidate() throws Exception {
String ddl = "CREATE FOREIGN TABLE G1(e1 integer, e2 varchar);" + "create foreign table status (VDBNAME STRING, VDBVERSION STRING, " + " SCHEMANAME STRING, NAME STRING, TARGETSCHEMANAME STRING, TARGETNAME STRING, " + " VALID BOOLEAN, LOADSTATE STRING, CARDINALITY LONG, UPDATED TIMESTAMP, LOADNUMBER LONG, NODENAME STRING, STALECOUNT LONG)";
String ddl2 = "CREATE VIEW G2 OPTIONS (MATERIALIZED 'true', MATERIALIZED_TABLE 'pm1.G1', \"teiid_rel:MATVIEW_STATUS_TABLE\" 'pm1.status', \"teiid_rel:MATVIEW_LOAD_SCRIPT\" 'begin end') AS SELECT * FROM pm1.G1";
buildModel("pm1", true, this.vdb, this.store, ddl);
buildModel("vm1", false, this.vdb, this.store, ddl2);
buildTransformationMetadata();
ValidatorReport report = new ValidatorReport();
report = new MetadataValidator().validate(this.vdb, this.store);
assertFalse(printError(report), report.hasItems());
assertNotNull("pm1.G1", store.getSchema("vm1").getTable("G2").getMaterializedTable());
assertEquals("G1", store.getSchema("vm1").getTable("G2").getMaterializedTable().getName());
}
use of org.teiid.query.validator.ValidatorReport in project teiid by teiid.
the class TestMetadataValidator method testExternalMaterializationValidateLoadScripts.
@Test
public void testExternalMaterializationValidateLoadScripts() throws Exception {
String ddl = "CREATE FOREIGN TABLE G1(e1 integer, e2 varchar); CREATE FOREIGN TABLE status(e1 integer, e2 varchar);";
String ddl2 = "CREATE VIEW G2 OPTIONS (MATERIALIZED 'true', MATERIALIZED_TABLE 'pm1.G1', \"teiid_rel:MATVIEW_STATUS_TABLE\" 'status' , \"teiid_rel:MATVIEW_BEFORE_LOAD_SCRIPT\" '----') AS SELECT * FROM pm1.G1";
buildModel("pm1", true, this.vdb, this.store, ddl);
buildModel("vm1", false, 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 testExternalMaterializationValidateColumnTypes.
@Test
public void testExternalMaterializationValidateColumnTypes() throws Exception {
String ddl = "CREATE FOREIGN TABLE G1(e1 integer, e2 integer);" + "create foreign table status (VDBNAME STRING, VDBVERSION STRING, " + " SCHEMANAME STRING, NAME STRING, TARGETSCHEMANAME STRING, TARGETNAME STRING, " + " VALID BOOLEAN, LOADSTATE STRING, CARDINALITY LONG, UPDATED TIMESTAMP, LOADNUMBER LONG, NODENAME STRING, STALECOUNT STRING)";
String ddl2 = "CREATE VIEW G2 (e1 integer, e2 varchar) OPTIONS (MATERIALIZED 'true', MATERIALIZED_TABLE 'pm1.G1', \"teiid_rel:MATVIEW_STATUS_TABLE\" 'pm1.status', \"teiid_rel:MATVIEW_LOAD_SCRIPT\" 'begin end') AS SELECT 1, 'a' FROM pm1.G1";
buildModel("pm1", true, this.vdb, this.store, ddl);
buildModel("vm1", false, 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 testViewModelArtifacts.
@Test
public void testViewModelArtifacts() throws Exception {
String ddl = "create foreign table g1(e1 integer, e2 varchar(12)); create view g2(e1 integer, e2 varchar(12)) AS select * from foo;";
buildModel("vm1", false, this.vdb, this.store, ddl);
ValidatorReport report = new ValidatorReport();
new MetadataValidator.SourceModelArtifacts().execute(vdb, store, report, new MetadataValidator());
assertTrue(printError(report), report.hasItems());
}
Aggregations