use of org.pentaho.platform.api.engine.ISolutionEngine in project pentaho-platform by pentaho.
the class RuntimeIT method testForcePrompt.
public void testForcePrompt() {
startTest();
SimpleParameterProvider parameterProvider = new SimpleParameterProvider();
// $NON-NLS-1$ //$NON-NLS-2$
OutputStream outputStream = getOutputStream("RuntimeTest.testForcePrompt", ".html");
SimpleOutputHandler outputHandler = new SimpleOutputHandler(outputStream, true);
outputHandler.setOutputPreference(IOutputHandler.OUTPUT_TYPE_PARAMETERS);
StandaloneSession session = // $NON-NLS-1$
new StandaloneSession(Messages.getInstance().getString("BaseTest.DEBUG_JUNIT_SESSION"));
ISolutionEngine solutionEngine = PentahoSystem.get(ISolutionEngine.class, session);
solutionEngine.setLoggingLevel(getLoggingLevel());
solutionEngine.init(session);
solutionEngine.setForcePrompt(true);
IRuntimeContext context = run(solutionEngine, "/test/reporting/jfreereport-reports-test-param.xaction", null, false, parameterProvider, // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
outputHandler);
assertEquals(Messages.getInstance().getString("BaseTest.USER_RUNNING_ACTION_SEQUENCE"), IRuntimeContext.RUNTIME_STATUS_SUCCESS, // $NON-NLS-1$
context.getStatus());
finishTest();
}
use of org.pentaho.platform.api.engine.ISolutionEngine in project pentaho-platform by pentaho.
the class BaseTest method run.
public IRuntimeContext run(String actionPath, String instanceId, boolean persisted, IParameterProvider parameterProvider, IOutputHandler outputHandler, IPentahoSession session) {
assertTrue(initOk);
ISolutionEngine solutionEngine = PentahoSystem.get(ISolutionEngine.class, session);
solutionEngine.setLoggingLevel(getLoggingLevel());
solutionEngine.init(session);
return run(solutionEngine, actionPath, instanceId, persisted, parameterProvider, outputHandler);
}
use of org.pentaho.platform.api.engine.ISolutionEngine in project pentaho-platform by pentaho.
the class BaseTestCase method run.
public IRuntimeContext run(String actionSequencePath, String actionSequence, IParameterProvider parameterProvider, IOutputHandler outputHandler) {
List messages = new ArrayList();
String instanceId = null;
ISolutionEngine solutionEngine = PentahoSystem.get(ISolutionEngine.class, session);
solutionEngine.setLoggingLevel(ILogger.ERROR);
solutionEngine.init(session);
HashMap parameterProviderMap = new HashMap();
IPentahoUrlFactory urlFactory = new SimpleUrlFactory("");
IRuntimeContext runtimeContext = null;
Reader reader = null;
try {
File file = new File(actionSequencePath + actionSequence);
StringBuilder str = new StringBuilder();
reader = new FileReader(file);
char[] buffer = new char[4096];
int n = reader.read(buffer);
while (n != -1) {
str.append(buffer, 0, n);
n = reader.read(buffer);
}
String xactionStr = str.toString();
solutionEngine.setSession(session);
runtimeContext = // $NON-NLS-1$
solutionEngine.execute(// $NON-NLS-1$
xactionStr, // $NON-NLS-1$
actionSequence, // $NON-NLS-1$
"action sequence test", // $NON-NLS-1$
false, // $NON-NLS-1$
true, // $NON-NLS-1$
instanceId, // $NON-NLS-1$
false, parameterProviderMap, null, null, urlFactory, messages);
} catch (Exception e) {
// we should not get here
e.printStackTrace();
assertTrue(e.getMessage(), false);
} finally {
if (reader != null) {
try {
reader.close();
} catch (Exception ex) {
ex.printStackTrace();
assertTrue(ex.getMessage(), false);
}
}
}
return runtimeContext;
}
use of org.pentaho.platform.api.engine.ISolutionEngine in project pentaho-platform by pentaho.
the class GenericPentahoTest method getSolutionEngine.
public ISolutionEngine getSolutionEngine(String path) {
// $NON-NLS-1$
StandaloneApplicationContext applicationContext = new StandaloneApplicationContext(path, "");
if (!PentahoSystem.getInitializedOK()) {
PentahoSystem.init(applicationContext);
// $NON-NLS-1$
assertTrue("PentahoSystem did not initialize", PentahoSystem.getInitializedOK());
}
// $NON-NLS-1$
IPentahoSession session = new StandaloneSession("system");
ISolutionEngine solutionEngine = PentahoSystem.get(ISolutionEngine.class, session);
// $NON-NLS-1$
assertNotNull("SolutionEngine is null", solutionEngine);
solutionEngine.setLoggingLevel(ILogger.ERROR);
solutionEngine.init(session);
try {
solutionEngine.setSession(session);
return solutionEngine;
} catch (Exception e) {
// we should not get here
e.printStackTrace();
assertTrue(e.getMessage(), false);
}
return null;
}
use of org.pentaho.platform.api.engine.ISolutionEngine in project pentaho-platform by pentaho.
the class MultiOutputTest method testMultiOutput.
public void testMultiOutput() {
startTest();
ISolutionEngine solutionEngine = ServiceTestHelper.getSolutionEngine();
String xactionStr = ServiceTestHelper.getXAction(SOLUTION_PATH, "services/MultiOutputTest.xaction");
IRuntimeContext runtimeContext = // $NON-NLS-1$ //$NON-NLS-2$
solutionEngine.execute(// $NON-NLS-1$ //$NON-NLS-2$
xactionStr, // $NON-NLS-1$ //$NON-NLS-2$
"test1a.xaction", // $NON-NLS-1$ //$NON-NLS-2$
"empty action sequence test", // $NON-NLS-1$ //$NON-NLS-2$
false, // $NON-NLS-1$ //$NON-NLS-2$
true, // $NON-NLS-1$ //$NON-NLS-2$
null, // $NON-NLS-1$ //$NON-NLS-2$
false, new HashMap(), null, null, new SimpleUrlFactory(""), new ArrayList());
finishTest();
}
Aggregations