Search in sources :

Example 16 with ValidatorReport

use of org.teiid.query.validator.ValidatorReport in project teiid by teiid.

the class TestMetadataValidator method testMinimalDataNoColumns.

@Test
public void testMinimalDataNoColumns() throws Exception {
    buildModel("pm1", true, this.vdb, this.store, "create foreign table g1;");
    ValidatorReport report = new ValidatorReport();
    new MetadataValidator.MinimalMetadata().execute(vdb, store, report, new MetadataValidator());
    assertTrue(printError(report), report.hasItems());
}
Also used : ValidatorReport(org.teiid.query.validator.ValidatorReport) Test(org.junit.Test)

Example 17 with ValidatorReport

use of org.teiid.query.validator.ValidatorReport in project teiid by teiid.

the class TestMetadataValidator method testExternalMaterializationValidateColumns.

@Test
public void testExternalMaterializationValidateColumns() throws Exception {
    String ddl = "CREATE FOREIGN TABLE G1(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 (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());
}
Also used : ValidatorReport(org.teiid.query.validator.ValidatorReport) Test(org.junit.Test)

Example 18 with ValidatorReport

use of org.teiid.query.validator.ValidatorReport in project teiid by teiid.

the class TestMetadataValidator method testProcWithDuplicateParam.

@Test
public void testProcWithDuplicateParam() throws Exception {
    String ddl = "create foreign procedure x (out param1 string, out param1 string); ";
    buildModel("pm1", true, this.vdb, this.store, ddl);
    buildTransformationMetadata();
    ValidatorReport report = new MetadataValidator().validate(vdb, store);
    assertTrue(printError(report), report.hasItems());
}
Also used : ValidatorReport(org.teiid.query.validator.ValidatorReport) Test(org.junit.Test)

Example 19 with ValidatorReport

use of org.teiid.query.validator.ValidatorReport in project teiid by teiid.

the class TestMetadataValidator method testProcMetadataValidationError.

@Test
public void testProcMetadataValidationError() throws Exception {
    String ddl = "create virtual procedure proc1(IN e1 varchar) RETURNS (e1 integer, e2 varchar(12)) AS begin create local temporary table x (e1 integer, e2 varchar not null); insert into x (e1) values (1); select * from x; end;";
    buildModel("vm1", false, this.vdb, this.store, ddl);
    buildTransformationMetadata();
    ValidatorReport report = new ValidatorReport();
    new MetadataValidator.ResolveQueryPlans().execute(vdb, store, report, new MetadataValidator());
    assertEquals("TEIID31080 vm1.proc1 validation error: Element x.e2 of x is neither nullable nor has a default value. A value must be specified in the insert.", report.getItems().iterator().next().toString());
}
Also used : ValidatorReport(org.teiid.query.validator.ValidatorReport) Test(org.junit.Test)

Example 20 with ValidatorReport

use of org.teiid.query.validator.ValidatorReport in project teiid by teiid.

the class TestMetadataValidator method testInvalidView.

@Test
public void testInvalidView() throws Exception {
    String ddl = "create view g1 (e1 integer, e2 varchar(12)) AS select 'a';";
    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());
}
Also used : ValidatorReport(org.teiid.query.validator.ValidatorReport) Test(org.junit.Test)

Aggregations

ValidatorReport (org.teiid.query.validator.ValidatorReport)70 Test (org.junit.Test)40 MetadataValidator (org.teiid.query.metadata.MetadataValidator)20 TransformationMetadata (org.teiid.query.metadata.TransformationMetadata)16 MetadataFactory (org.teiid.metadata.MetadataFactory)13 RealMetadataFactory (org.teiid.query.unittest.RealMetadataFactory)12 UDFSource (org.teiid.query.function.UDFSource)11 ModelMetaData (org.teiid.adminapi.impl.ModelMetaData)10 FunctionTree (org.teiid.query.function.FunctionTree)10 Command (org.teiid.query.sql.lang.Command)8 ValidatorFailure (org.teiid.query.validator.ValidatorFailure)6 QueryParser (org.teiid.query.parser.QueryParser)5 GroupSymbol (org.teiid.query.sql.symbol.GroupSymbol)5 FileReader (java.io.FileReader)4 Properties (java.util.Properties)4 EdmxFormatParser (org.odata4j.format.xml.EdmxFormatParser)4 VDBMetaData (org.teiid.adminapi.impl.VDBMetaData)4 TranslationUtility (org.teiid.cdk.api.TranslationUtility)4 MetadataException (org.teiid.metadata.MetadataException)4 Table (org.teiid.metadata.Table)4