use of org.pentaho.platform.engine.core.output.SimpleOutputHandler 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.engine.core.output.SimpleOutputHandler 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.engine.core.output.SimpleOutputHandler in project pentaho-platform by pentaho.
the class KettleIT method setUp.
@Override
public void setUp() {
super.setUp();
startTest();
parameterProvider = new SimpleParameterProvider();
parameterProvider.setParameter("type", "html");
OutputStream outputStream = getOutputStream("KettleTest.testKettle", ".html");
assertNotNull(outputStream);
outputHandler = new SimpleOutputHandler(outputStream, true);
assertNotNull(outputHandler);
session = new StandaloneSession("test");
assertNotNull(session);
}
use of org.pentaho.platform.engine.core.output.SimpleOutputHandler in project pentaho-platform by pentaho.
the class TemplateIT method testTemplate3.
public void testTemplate3() {
startTest();
SimpleParameterProvider parameterProvider = new SimpleParameterProvider();
// $NON-NLS-1$ //$NON-NLS-2$
parameterProvider.setParameter("type", "html");
// $NON-NLS-1$ //$NON-NLS-2$
OutputStream outputStream = getOutputStream("TemplateTest.testTemplate3", ".svg");
SimpleOutputHandler outputHandler = new SimpleOutputHandler(outputStream, true);
StandaloneSession session = // $NON-NLS-1$
new StandaloneSession(Messages.getInstance().getString("BaseTest.DEBUG_JUNIT_SESSION"));
IRuntimeContext context = // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
run("/test/template/europemap.xaction", null, false, parameterProvider, outputHandler, session);
assertEquals(Messages.getInstance().getString("BaseTest.USER_RUNNING_ACTION_SEQUENCE"), IRuntimeContext.RUNTIME_STATUS_SUCCESS, // $NON-NLS-1$
context.getStatus());
// $NON-NLS-1$ //$NON-NLS-2$
assertNotNull("", context.getOutputParameter("svg"));
finishTest();
}
use of org.pentaho.platform.engine.core.output.SimpleOutputHandler in project pentaho-platform by pentaho.
the class ActionDelegateTest method execute.
@SuppressWarnings("unchecked")
private void execute(String actionSequenceFile, boolean exceptionOnError, IAction... actions) throws ActionSequenceException {
TestPluginManager pm = (TestPluginManager) PentahoSystem.get(IPluginManager.class);
for (IAction action : actions) {
pm.addAction(action);
}
// content outputs will write to this stream
out = new ByteArrayOutputStream();
// create SimpleOutputHandler (to handle outputs of type "response.content")
outputHandler = new SimpleOutputHandler(out, false);
outputHandler.setOutputPreference(IOutputHandler.OUTPUT_TYPE_DEFAULT);
IPentahoSession session = new StandaloneSession("system");
ISolutionEngine solutionEngine = ServiceTestHelper.getSolutionEngine();
outputHandler.setSession(session);
String xactionStr = ServiceTestHelper.getXAction("src/test/resources/solution/test/ActionDelegateTest", actionSequenceFile);
// execute the action sequence, providing the outputHandler created above
IRuntimeContext rc = solutionEngine.execute(xactionStr, actionSequenceFile, "action sequence to test the TestAction", false, true, null, false, new HashMap(), outputHandler, null, new SimpleUrlFactory(""), new ArrayList());
int status = rc.getStatus();
if (status == IRuntimeContext.PARAMETERS_FAIL || status == IRuntimeContext.RUNTIME_CONTEXT_RESOLVE_FAIL || status == IRuntimeContext.RUNTIME_STATUS_FAILURE || status == IRuntimeContext.RUNTIME_STATUS_INITIALIZE_FAIL || status == IRuntimeContext.RUNTIME_STATUS_SETUP_FAIL) {
throw new ActionSequenceException("Action sequence failed!");
}
}
Aggregations