use of org.teiid.query.processor.FakeDataManager in project teiid by teiid.
the class TestProcedureProcessor method testLoopsWithBreak.
@Test
public void testLoopsWithBreak() 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("declare integer VARIABLES.e2_total=0;\n");
// $NON-NLS-1$
procedure.append("loop on (select e2 as x from pm1.g1) as mycursor\n");
// $NON-NLS-1$
procedure.append("BEGIN\n");
// $NON-NLS-1$
procedure.append("e2_total=e2_total+mycursor.x;\n");
// $NON-NLS-1$
procedure.append("break;\n");
// $NON-NLS-1$
procedure.append("END\n");
// $NON-NLS-1$
procedure.append("loop on (select e2 as x from pm1.g1) as mycursor\n");
// $NON-NLS-1$
procedure.append("BEGIN\n");
// $NON-NLS-1$
procedure.append("e2_total=e2_total+mycursor.x;");
// $NON-NLS-1$
procedure.append("END\n");
// $NON-NLS-1$
procedure.append("SELECT cast(VARIABLES.e2_total as string);\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);
// Create expected results
List[] expected = new List[] { Arrays.asList("76") };
helpTestProcess(plan, expected, dataMgr, metadata);
}
use of org.teiid.query.processor.FakeDataManager in project teiid by teiid.
the class TestProcedureProcessor method testVirtualProcedure13.
// Defect17447_testVirtualProcedure13
@Test
public void testVirtualProcedure13() throws Exception {
// $NON-NLS-1$
String userUpdateStr = "EXEC pm1.vsp16()";
QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
// Set up data
FakeDataManager dataMgr = exampleDataManager(metadata);
ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
dataMgr.registerTuples(metadata, "pm1.g2", new List[] { // $NON-NLS-1$
Arrays.asList(new Object[] { "First", Integer.valueOf(5), new Boolean(true), new Double(1.003) }), // $NON-NLS-1$
Arrays.asList(new Object[] { "Third", Integer.valueOf(51), new Boolean(true), new Double(3.003) }) });
// Create expected results
List[] expected = new List[] { // $NON-NLS-1$
Arrays.asList(new Object[] { "First" }), // $NON-NLS-1$
Arrays.asList(new Object[] { "Third" }) };
helpTestProcess(plan, expected, dataMgr, metadata);
}
use of org.teiid.query.processor.FakeDataManager in project teiid by teiid.
the class TestProcedureProcessor method testDefect16193.
@Test
public void testDefect16193() throws Exception {
// $NON-NLS-1$
String userUpdateStr = "EXEC pm1.vsp35(51)";
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[] { "Third" }) };
helpTestProcess(plan, expected, dataMgr, metadata);
}
use of org.teiid.query.processor.FakeDataManager in project teiid by teiid.
the class TestProcedureProcessor method testVirtualProcedure46.
// Defect 17447
@Test
public void testVirtualProcedure46() throws Exception {
// $NON-NLS-1$
String userUpdateStr = "EXEC pm1.vsp46()";
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[] { "First" }), // $NON-NLS-1$
Arrays.asList(new Object[] { "Second" }), // $NON-NLS-1$
Arrays.asList(new Object[] { "Third" }) };
helpTestProcess(plan, expected, dataMgr, metadata);
}
use of org.teiid.query.processor.FakeDataManager in project teiid by teiid.
the class TestProcedureProcessor method testVirtualProcedure14.
@Test
public void testVirtualProcedure14() throws Exception {
// $NON-NLS-1$
String userUpdateStr = "EXEC pm1.vsp17()";
QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
// Set up data
FakeDataManager dataMgr = exampleDataManager(metadata);
ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
// Create expected results
List[] expected = new List[] { // $NON-NLS-1$
Arrays.asList(new Object[] { "Third" }) };
helpTestProcess(plan, expected, dataMgr, metadata);
}
Aggregations