use of org.teiid.query.processor.FakeDataManager in project teiid by teiid.
the class TestProcedureProcessor method testDynamicCommandWithVariableOnly.
@Test
public void testDynamicCommandWithVariableOnly() throws Exception {
// Tests dynamic query with only a variable that represents thte entire dynamic query.
TransformationMetadata metadata = RealMetadataFactory.example1();
addProc(metadata, "sq1", // $NON-NLS-1$ //$NON-NLS-2$
"CREATE VIRTUAL PROCEDURE BEGIN\n" + "DECLARE string VARIABLES.CRIT = 'select e1, e2 from pm5.g3 where e2=using.id'; execute string VARIABLES.CRIT USING ID = pm1.sq1.param; END", new String[] { "e1", "e2" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.SHORT }, new String[] { "param" }, // $NON-NLS-1$
new String[] { DataTypeManager.DefaultDataTypes.SHORT });
// $NON-NLS-1$
String userUpdateStr = "EXEC pm1.sq1(convert(5,short))";
FakeDataManager dataMgr = exampleDataManagerPm5(metadata);
ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
// Create expected results
// $NON-NLS-1$
List[] expected = new List[] { Arrays.asList(new Object[] { "First", new Short((short) 5) }) };
helpTestProcess(plan, expected, dataMgr, metadata);
}
use of org.teiid.query.processor.FakeDataManager in project teiid by teiid.
the class TestProcedureProcessor method testCase174806.
@Test
public void testCase174806() throws Exception {
// $NON-NLS-1$
String userUpdateStr = "EXEC pm1.vsp63()";
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[] { "c" }) };
helpTestProcess(plan, expected, dataMgr, metadata);
}
use of org.teiid.query.processor.FakeDataManager in project teiid by teiid.
the class TestProcedureProcessor method testVirtualProcedure19WithBlockedException.
@Test
public void testVirtualProcedure19WithBlockedException() throws Exception {
// $NON-NLS-1$
String userUpdateStr = "EXEC pm1.vsp23(7)";
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[] { "Second", Integer.valueOf(15) }) };
helpTestProcess(plan, expected, dataMgr, metadata);
}
use of org.teiid.query.processor.FakeDataManager in project teiid by teiid.
the class TestProcedureProcessor method testVirtualProcedure12.
@Test
public void testVirtualProcedure12() throws Exception {
// $NON-NLS-1$
String userUpdateStr = "EXEC pm1.vsp15()";
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 testInsertAfterCreate.
@Test
public void testInsertAfterCreate() throws Exception {
TransformationMetadata metadata = RealMetadataFactory.example1();
StringBuffer procedure = // $NON-NLS-1$
new StringBuffer("CREATE VIRTUAL PROCEDURE \n").append(// $NON-NLS-1$
"BEGIN\n").append(// $NON-NLS-1$
"\n create local temporary table #temp (e1 string, e2 string);").append(// $NON-NLS-1$
"\n insert into #temp (e1) values ('a');").append(// $NON-NLS-1$
"\n insert into #temp (e2) values ('b');").append(// $NON-NLS-1$
"SELECT e2 as e1 from #temp;\n").append(// $NON-NLS-1$
"END");
addProc(metadata, procedure.toString());
// $NON-NLS-1$
String userUpdateStr = "EXEC pm1.sq2()";
FakeDataManager dataMgr = exampleDataManager(metadata);
ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
helpTestProcess(plan, new List[] { Arrays.asList(new Object[] { null }), Arrays.asList(new Object[] { "b" }) }, dataMgr, // $NON-NLS-1$
metadata);
}
Aggregations