use of org.teiid.query.processor.FakeDataManager in project teiid by teiid.
the class TestProcedureProcessor method testTempTableTypeConversion.
@Test
public void testTempTableTypeConversion() throws Exception {
// $NON-NLS-1$
String procedure = "CREATE VIRTUAL PROCEDURE\n";
// $NON-NLS-1$
procedure += "BEGIN\n";
// $NON-NLS-1$
procedure += "CREATE local temporary table temp (x string, y integer);\n";
// $NON-NLS-1$
procedure += "Select pm1.g1.e2 as e1, pm1.g1.e2 into temp from pm1.g1 order by pm1.g1.e2 limit 1;\n";
// $NON-NLS-1$
procedure += "Select x from temp;\n";
// $NON-NLS-1$
procedure += "END\n";
QueryMetadataInterface metadata = createProcedureMetadata(procedure);
// $NON-NLS-1$
String userUpdateStr = "EXEC pm1.sq1()";
FakeDataManager dataMgr = exampleDataManager(metadata);
ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
helpTestProcess(plan, new List[] { // $NON-NLS-1$
Arrays.asList(new Object[] { "5" }) }, dataMgr, metadata);
}
use of org.teiid.query.processor.FakeDataManager in project teiid by teiid.
the class TestProcedureProcessor method testDynamicCommandWithParameter.
@Test
public void testDynamicCommandWithParameter() throws Exception {
TransformationMetadata metadata = RealMetadataFactory.example1();
addProc(metadata, "sq2", // $NON-NLS-1$ //$NON-NLS-2$
"CREATE VIRTUAL PROCEDURE BEGIN\n" + "execute string 'SELECT e1, e2 FROM pm1.g1 WHERE e1=pm1.sq2.in' as e1 string, e2 integer; END", new String[] { "e1", "e2" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER }, new String[] { "in" }, new String[] { DataTypeManager.DefaultDataTypes.STRING });
// $NON-NLS-1$
String userUpdateStr = "EXEC pm1.sq2('First')";
FakeDataManager dataMgr = exampleDataManager(metadata);
ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
// Create expected results
List[] expected = new List[] { // $NON-NLS-1$
Arrays.asList(new Object[] { "First", Integer.valueOf(5) }) };
helpTestProcess(plan, expected, dataMgr, metadata);
}
use of org.teiid.query.processor.FakeDataManager in project teiid by teiid.
the class TestProcedureProcessor method testDefect16649_2.
@Test
public void testDefect16649_2() throws Exception {
// $NON-NLS-1$
String userUpdateStr = "EXEC pm1.vsp39()";
QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
// Set up data
FakeDataManager dataMgr = exampleDataManager(metadata);
// Create expected results
List[] expected = new List[] { // $NON-NLS-1$
Arrays.asList(new Object[] { "Second" }) };
helpTestProcess(plan, expected, dataMgr, metadata);
}
use of org.teiid.query.processor.FakeDataManager in project teiid by teiid.
the class TestProcedureProcessor method testCreateWithoutDrop.
@Test
public void testCreateWithoutDrop() throws Exception {
TransformationMetadata metadata = RealMetadataFactory.example1();
// $NON-NLS-1$
StringBuffer procedure = new StringBuffer("CREATE VIRTUAL PROCEDURE \n");
// $NON-NLS-1$
procedure.append("BEGIN\n");
// $NON-NLS-1$
procedure.append("create local temporary table t1 (e1 integer);\n");
// $NON-NLS-1$
procedure.append("create local temporary table T1 (e1 integer);\n");
// $NON-NLS-1$
procedure.append("SELECT cast(e1 as string) from t1;\n");
// $NON-NLS-1$
procedure.append("END");
addProc(metadata, procedure.toString());
// $NON-NLS-1$
String userUpdateStr = "EXEC pm1.sq2()";
FakeDataManager dataMgr = exampleDataManager(metadata);
ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
// $NON-NLS-1$
helpTestProcessFailure(plan, dataMgr, "TEIID30229 Temporary table \"T1\" already exists.", metadata);
}
use of org.teiid.query.processor.FakeDataManager in project teiid by teiid.
the class TestProcedureProcessor method testVirtualProcedureDefect14282.
@Test
public void testVirtualProcedureDefect14282() throws Exception {
// $NON-NLS-1$
String userUpdateStr = "EXEC pm1.vsp24()";
QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
FakeDataManager dataMgr = exampleDataManager(metadata);
ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
// Create expected results
List[] expected = new List[] { // $NON-NLS-1$
Arrays.asList(new Object[] { "Second" }) };
helpTestProcess(plan, expected, dataMgr, metadata);
}
Aggregations