use of org.teiid.query.processor.FakeDataManager in project teiid by teiid.
the class TestProcedureProcessor method testVirtualProcedure3.
@Test
public void testVirtualProcedure3() throws Exception {
// $NON-NLS-1$
String userUpdateStr = "EXEC pm1.vsp4()";
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[] { "First" }) };
helpTestProcess(plan, expected, dataMgr, metadata);
}
use of org.teiid.query.processor.FakeDataManager in project teiid by teiid.
the class TestProcedureProcessor method testVirtualProcedureWithCreateAndDrop.
@Test
public void testVirtualProcedureWithCreateAndDrop() throws Exception {
// $NON-NLS-1$
String userUpdateStr = "EXEC pm1.vsp61()";
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[] { "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 testVirtualProcedure11.
@Test
public void testVirtualProcedure11() throws Exception {
// $NON-NLS-1$
String userUpdateStr = "EXEC pm1.vsp14()";
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[] { "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 testReferenceForwarding.
/**
* This is a slight variation of TestProcessor.testVariableInExecParam, where the proc wrapper can be
* removed after rewrite
*/
@Test
public void testReferenceForwarding() throws Exception {
// Create query
// $NON-NLS-1$
String sql = "EXEC pm1.vsp49()";
TransformationMetadata metadata = RealMetadataFactory.example1();
addProc(metadata, "sq2", "CREATE VIRTUAL PROCEDURE BEGIN if (1 = 2) begin declare integer x = 1; end SELECT e1, e2 FROM pm1.g1 WHERE e1=pm1.sq2.in; END", new String[] { "e1", "e2" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER }, new String[] { "in" }, // $NON-NLS-1$
new String[] { DataTypeManager.DefaultDataTypes.STRING });
// Create expected results
List[] expected = new List[] { // $NON-NLS-1$
Arrays.asList(new Object[] { "b", Integer.valueOf(2) }) };
// Construct data manager with data
FakeDataManager dataManager = new FakeDataManager();
TestProcessor.sampleData1(dataManager);
// Plan query
ProcessorPlan plan = getProcedurePlan(sql, metadata);
// Run query
helpTestProcess(plan, expected, dataManager, metadata);
}
use of org.teiid.query.processor.FakeDataManager in project teiid by teiid.
the class TestProcedureProcessor method exampleDataManagerPm5.
private FakeDataManager exampleDataManagerPm5(QueryMetadataInterface metadata) throws TeiidException {
FakeDataManager dataMgr = new FakeDataManager();
dataMgr.registerTuples(metadata, "pm5.g3", new List[] { // $NON-NLS-1$
Arrays.asList(new Object[] { "First", new Short((short) 5), new Boolean(true), new Double(1.003) }), // $NON-NLS-1$
Arrays.asList(new Object[] { "Second", new Short((short) 15), new Boolean(true), new Double(2.003) }), // $NON-NLS-1$
Arrays.asList(new Object[] { "Third", new Short((short) 51), new Boolean(true), new Double(3.003) }) });
return dataMgr;
}
Aggregations