use of org.pentaho.platform.api.engine.IRuntimeContext in project pentaho-platform by pentaho.
the class IPreparedComponentIT method testIPreparedComponentXQueryAvailable.
/*
* public void testIPreparedComponentSQLTempTables() { startTest();
* info("Expected: Successful execution with one row of data"); //$NON-NLS-1$ IRuntimeContext context = run("test",
* "ipreparedcomponents", "ipreparedcomponent_sql_temptables.xaction"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
* assertEquals( Messages.getInstance().getString("BaseTest.USER_RUNNING_ACTION_SEQUENCE"),
* IRuntimeContext.RUNTIME_STATUS_SUCCESS, context.getStatus()); //$NON-NLS-1$
*
* IActionParameter rtn1 = context.getOutputParameter("a_result"); //$NON-NLS-1$ assertNotNull(rtn1); IPentahoResultSet
* resultset1 = (IPentahoResultSet) rtn1.getValue(); assertEquals(1, resultset1.getRowCount()); assertEquals(
* "Expected first row of 'a_result' to contain a 1 in the first column.", new Integer(1), resultset1.getValueAt(0,
* 0)); //$NON-NLS-1$
*
* IActionParameter rtn2 = context.getOutputParameter("no_results"); //$NON-NLS-1$ assertNotNull(rtn2);
* IPentahoResultSet resultset2 = (IPentahoResultSet) rtn2.getValue(); assertEquals(1, resultset2.getRowCount());
* assertEquals( "Expected first row of 'no_results' to contain a 0 in the first column.", new Integer(0),
* resultset2.getValueAt(0, 0)); //$NON-NLS-1$
*
* finishTest(); }
*/
/*
* public void testIPreparedComponentSQLPrepareLater() { startTest();
* info("Expected: Successful execution with object available"); //$NON-NLS-1$ IRuntimeContext context = run("test",
* "ipreparedcomponents", "ipreparedcomponent_sql_preparelater.xaction"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
* assertEquals( Messages.getInstance().getString("BaseTest.USER_RUNNING_ACTION_SEQUENCE"),
* IRuntimeContext.RUNTIME_STATUS_SUCCESS, context.getStatus()); //$NON-NLS-1$
*
* IActionParameter rtn1 = context.getOutputParameter("prepared_component"); //$NON-NLS-1$ assertNotNull(rtn1);
* IPreparedComponent preparedComponent1 = (IPreparedComponent) rtn1.getValue(); assertNotNull(preparedComponent1);
* IPentahoResultSet resultset1 = preparedComponent1.executePrepared(null); assertEquals(1, resultset1.getRowCount());
* Number val1 = (Number) resultset1.getValueAt(0, 0);
*
* IActionParameter rtn2 = context.getOutputParameter("second_prepared_component"); //$NON-NLS-1$ assertNotNull(rtn2);
* IPreparedComponent preparedComponent2 = (IPreparedComponent) rtn2.getValue(); assertNotNull(preparedComponent2);
* HashMap map = new HashMap(); map.put("DEPARTMENT", "Sales"); //$NON-NLS-1$ //$NON-NLS-2$ map.put("REGION",
* "Eastern"); //$NON-NLS-1$ //$NON-NLS-2$ IPentahoResultSet resultset2 = preparedComponent2.executePrepared(map);
* assertEquals(1, resultset2.getRowCount()); Number val2 = (Number) resultset2.getValueAt(0, 0);
*
* assertEquals("Values from the first and second query should be equal", val1, val2); //$NON-NLS-1$
*
* finishTest(); }
*/
/*
* public void testIPreparedComponentMDXAvailable() { startTest();
* info("Expected: Successful execution with object available"); //$NON-NLS-1$ IRuntimeContext context = run("test",
* "ipreparedcomponents", "ipreparedcomponent_mdx_available.xaction"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
* assertEquals( Messages.getInstance().getString("BaseTest.USER_RUNNING_ACTION_SEQUENCE"),
* IRuntimeContext.RUNTIME_STATUS_SUCCESS, context.getStatus()); //$NON-NLS-1$
*
* IActionParameter rtn = context.getOutputParameter("prepared_component"); //$NON-NLS-1$ assertNotNull(rtn);
* IPreparedComponent preparedComponent = (IPreparedComponent) rtn.getValue();
*
* assertNotNull(preparedComponent);
*
* finishTest(); }
*/
/*
* public void testIPreparedComponentMDXShareConnection() { startTest();
* info("Expected: Successful execution with object available"); //$NON-NLS-1$ IRuntimeContext context = run("test",
* "ipreparedcomponents", "ipreparedcomponent_mdx_shareconn.xaction"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
* assertEquals( Messages.getInstance().getString("BaseTest.USER_RUNNING_ACTION_SEQUENCE"),
* IRuntimeContext.RUNTIME_STATUS_SUCCESS, context.getStatus()); //$NON-NLS-1$
*
* IActionParameter rtn = context.getOutputParameter("prepared_component"); //$NON-NLS-1$ assertNotNull(rtn);
* IPreparedComponent preparedComponent = (IPreparedComponent) rtn.getValue();
*
* assertNotNull(preparedComponent);
*
* IPentahoResultSet resultset = preparedComponent.executePrepared(null); assertNotNull(resultset);
* assertTrue(resultset.getRowCount() >= 1); Object val1 = resultset.getValueAt(0, 0); assertNotNull(val1);
*
* finishTest(); }
*/
/*
* public void testIPreparedComponentMDXPrepareLater() { startTest();
* info("Expected: Successful execution with object available"); //$NON-NLS-1$ IRuntimeContext context = run("test",
* "ipreparedcomponents", "ipreparedcomponent_mdx_preparelater.xaction"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
* assertEquals( Messages.getInstance().getString("BaseTest.USER_RUNNING_ACTION_SEQUENCE"),
* IRuntimeContext.RUNTIME_STATUS_SUCCESS, context.getStatus()); //$NON-NLS-1$
*
* IActionParameter rtn1 = context.getOutputParameter("prepared_component"); //$NON-NLS-1$ assertNotNull(rtn1);
* IPreparedComponent preparedComponent1 = (IPreparedComponent) rtn1.getValue(); assertNotNull(preparedComponent1);
* IPentahoResultSet resultset1 = preparedComponent1.executePrepared(null); assertNotNull(resultset1);
* assertTrue(resultset1.getRowCount() >= 1); Object val1 = resultset1.getValueAt(0, 0);
*
* IActionParameter rtn2 = context.getOutputParameter("second_prepared_component"); //$NON-NLS-1$ assertNotNull(rtn2);
* IPreparedComponent preparedComponent2 = (IPreparedComponent) rtn2.getValue(); assertNotNull(preparedComponent2);
* HashMap map = new HashMap(); map.put("productline", "Classic Cars"); //$NON-NLS-1$ //$NON-NLS-2$ IPentahoResultSet
* resultset2 = preparedComponent2.executePrepared(map); assertTrue(resultset2.getRowCount() >= 1);
* assertEquals(resultset1.getRowCount(), resultset2.getRowCount());
*
* Object val2 = resultset2.getValueAt(0, 0);
*
* assertEquals("Values from the first and second query should be equal", val1, val2); //$NON-NLS-1$
*
* finishTest(); }
*/
public void testIPreparedComponentXQueryAvailable() {
startTest();
// $NON-NLS-1$
info("Expected: Successful execution with object available");
// $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
IRuntimeContext context = run("/test/ipreparedcomponents/ipreparedcomponent_xquery_available.xaction");
assertEquals(Messages.getInstance().getString("BaseTest.USER_RUNNING_ACTION_SEQUENCE"), IRuntimeContext.RUNTIME_STATUS_SUCCESS, // $NON-NLS-1$
context.getStatus());
// $NON-NLS-1$
IActionParameter rtn = context.getOutputParameter("prepared_component");
assertNotNull(rtn);
IPreparedComponent preparedComponent = (IPreparedComponent) rtn.getValue();
assertNotNull(preparedComponent);
finishTest();
}
use of org.pentaho.platform.api.engine.IRuntimeContext in project pentaho-platform by pentaho.
the class JFreeReportIT method testJFreeReportParameterPage2.
public void testJFreeReportParameterPage2() {
startTest();
SimpleParameterProvider parameterProvider = new SimpleParameterProvider();
// $NON-NLS-1$ //$NON-NLS-2$
parameterProvider.setParameter("type", "html");
// $NON-NLS-1$ //$NON-NLS-2$
OutputStream outputStream = getOutputStream("ReportingTest.testJFreeReportParameterPage2", ".html");
SimpleOutputHandler outputHandler = new SimpleOutputHandler(outputStream, true);
StandaloneSession session = // $NON-NLS-1$
new StandaloneSession(Messages.getInstance().getString("BaseTest.DEBUG_JUNIT_SESSION"));
IRuntimeContext context = run("/test/reporting/jfreereport-reports-test-param2.xaction", null, false, parameterProvider, outputHandler, // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
session);
assertEquals(Messages.getInstance().getString("BaseTest.USER_RUNNING_ACTION_SEQUENCE"), IRuntimeContext.RUNTIME_STATUS_SUCCESS, // $NON-NLS-1$
context.getStatus());
// TODO need some validation of success
finishTest();
}
use of org.pentaho.platform.api.engine.IRuntimeContext in project pentaho-platform by pentaho.
the class JFreeReportIT method testJFreeReportParameterPage1.
/*
* public void testJFreeReportMondrian() { startTest(); SimpleParameterProvider parameterProvider = new
* SimpleParameterProvider(); parameterProvider.setParameter("type", "html"); //$NON-NLS-1$ //$NON-NLS-2$ OutputStream
* outputStream = getOutputStream("ReportingTest.testJFreeReportMondrian", ".html"); //$NON-NLS-1$ //$NON-NLS-2$
* SimpleOutputHandler outputHandler = new SimpleOutputHandler(outputStream, true); StandaloneSession session = new
* StandaloneSession(Messages.getInstance().getString("BaseTest.DEBUG_JUNIT_SESSION")); //$NON-NLS-1$ IRuntimeContext
* context = run( "/test/reporting/MDX_report.xaction", null, false, parameterProvider, outputHandler, session);
* //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ assertEquals(
* Messages.getInstance().getString("BaseTest.USER_RUNNING_ACTION_SEQUENCE"), IRuntimeContext.RUNTIME_STATUS_SUCCESS,
* context.getStatus()); //$NON-NLS-1$ // TODO need some validation of success finishTest(); }
*/
public void testJFreeReportParameterPage1() {
startTest();
SimpleParameterProvider parameterProvider = new SimpleParameterProvider();
// $NON-NLS-1$ //$NON-NLS-2$
parameterProvider.setParameter("type", "html");
// $NON-NLS-1$ //$NON-NLS-2$
OutputStream outputStream = getOutputStream("ReportingTest.testJFreeReportParameterPage", ".html");
SimpleOutputHandler outputHandler = new SimpleOutputHandler(outputStream, true);
StandaloneSession session = // $NON-NLS-1$
new StandaloneSession(Messages.getInstance().getString("BaseTest.DEBUG_JUNIT_SESSION"));
IRuntimeContext context = run("/test/reporting/jfreereport-reports-test-param.xaction", null, false, parameterProvider, outputHandler, // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
session);
assertEquals(Messages.getInstance().getString("BaseTest.USER_RUNNING_ACTION_SEQUENCE"), IRuntimeContext.RUNTIME_STATUS_SUCCESS, // $NON-NLS-1$
context.getStatus());
// TODO need some validation of success
finishTest();
}
use of org.pentaho.platform.api.engine.IRuntimeContext in project pentaho-platform by pentaho.
the class KettleIT method testKettleMissingTransform.
public void testKettleMissingTransform() {
IRuntimeContext context = run("/test/etl/SampleTransformationMissingKTR.xaction", null, false, parameterProvider, outputHandler, session);
assertEquals(IRuntimeContext.RUNTIME_STATUS_FAILURE, context.getStatus());
assertFailResult(context);
}
use of org.pentaho.platform.api.engine.IRuntimeContext in project pentaho-platform by pentaho.
the class KettleIT method testKettleSuccessResult.
public void testKettleSuccessResult() {
assertNotNull(session);
IRuntimeContext context = run("/test/etl/SampleTransformation.xaction", null, false, parameterProvider, outputHandler, session);
assertEquals(IRuntimeContext.RUNTIME_STATUS_SUCCESS, context.getStatus());
assertSuccessResult(context, new Object[][] { { "Central", "Sales", "District Manager", "Hello, District Manager" }, { "Central", "Sales", "Senior Sales Rep", "Hello, Senior Sales Rep" } });
}
Aggregations