use of org.pentaho.platform.api.engine.IRuntimeContext in project pentaho-platform by pentaho.
the class JavaScriptResultSetIT method testRSCompareNotOK5.
public void testRSCompareNotOK5() {
startTest();
IRuntimeContext context = run("/samples/rules/ResultSetCompareTest_error5.xaction");
assertEquals(context.getStatus(), IRuntimeContext.RUNTIME_STATUS_FAILURE);
finishTest();
}
use of org.pentaho.platform.api.engine.IRuntimeContext in project pentaho-platform by pentaho.
the class JavaScriptResultSetIT method testRSCompareOK.
public void testRSCompareOK() {
startTest();
IRuntimeContext context = run("/samples/rules/ResultSetTest.xaction");
assertEquals(IRuntimeContext.RUNTIME_STATUS_SUCCESS, context.getStatus());
IActionParameter rtn = context.getOutputParameter("COMPARERESULT");
assertNotNull(rtn);
String compareResult = rtn.getStringValue();
assertEquals(compareResult, "No Mismatches");
finishTest();
}
use of org.pentaho.platform.api.engine.IRuntimeContext in project pentaho-platform by pentaho.
the class JavaScriptResultSetIT method testRSCompareNotOK3.
public void testRSCompareNotOK3() {
startTest();
IRuntimeContext context = run("/samples/rules/ResultSetCompareTest_error3.xaction");
assertEquals(context.getStatus(), IRuntimeContext.RUNTIME_CONTEXT_VALIDATE_FAIL);
finishTest();
}
use of org.pentaho.platform.api.engine.IRuntimeContext in project pentaho-platform by pentaho.
the class GlobalOutputIT method testEmptyActionSequence.
public void testEmptyActionSequence() {
startTest();
List messages = new ArrayList();
String instanceId = null;
IPentahoSession session = new StandaloneSession("system");
PentahoSessionHolder.setSession(session);
ISolutionEngine solutionEngine = PentahoSystem.get(ISolutionEngine.class);
solutionEngine.setLoggingLevel(ILogger.ERROR);
solutionEngine.init(session);
String baseUrl = PentahoSystem.getApplicationContext().getBaseUrl();
HashMap parameterProviderMap = new HashMap();
IPentahoUrlFactory urlFactory = new SimpleUrlFactory(baseUrl);
try {
File file = new File(getSolutionPath() + "/samples/platform/SetGlobalOutputTest.xaction");
StringBuilder str = new StringBuilder();
Reader 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);
IRuntimeContext runtimeContext = solutionEngine.execute(xactionStr, "SetGlobalOutputTest.xaction", "empty action sequence test", false, true, instanceId, false, parameterProviderMap, null, null, urlFactory, // $NON-NLS-1$ //$NON-NLS-2$
messages);
assertNotNull("RuntimeContext is null", runtimeContext);
assertEquals("Action sequence execution failed", runtimeContext.getStatus(), IRuntimeContext.RUNTIME_STATUS_SUCCESS);
IParameterProvider provider = PentahoSystem.getGlobalParameters();
// $NON-NLS-1$
String parameter = provider.getStringParameter("GLOBAL_TEST", null);
assertNotNull(parameter);
// $NON-NLS-1$
assertEquals("This is a test", parameter);
} catch (Exception e) {
// we should not get here
e.printStackTrace();
assertTrue(e.getMessage(), false);
}
}
use of org.pentaho.platform.api.engine.IRuntimeContext in project pentaho-platform by pentaho.
the class VFSOutputIT method testFileOutput.
public void testFileOutput() {
startTest();
SimpleParameterProvider parameterProvider = new SimpleParameterProvider();
// create a user session
IPentahoSession session = new StandaloneSession("test");
PentahoSessionHolder.setSession(session);
System.out.println("solution.root.dir = " + System.getProperty("solution.root.dir"));
String xaction = "/test/platform/VFSOutputTest_file.xaction";
if (System.getProperty("os.name").startsWith("Windows")) {
xaction = "/test/platform/VFSOutputTestWindows_file.xaction";
}
IRuntimeContext context = // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
run(xaction, parameterProvider, "VFSOutputTest.testFileOutput", ".txt");
assertEquals(Messages.getInstance().getString("BaseTest.USER_RUNNING_ACTION_SEQUENCE"), IRuntimeContext.RUNTIME_STATUS_SUCCESS, // $NON-NLS-1$
context.getStatus());
finishTest();
}
Aggregations