use of org.pentaho.platform.api.engine.IRuntimeContext in project pentaho-platform by pentaho.
the class ResultsetIT method testResultSetTestWithDifferentDataTypes.
public void testResultSetTestWithDifferentDataTypes() {
startTest();
// $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
IRuntimeContext context = run("/test/rules/ResultSetTestWithDifferentDataTypes.xaction");
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.IRuntimeContext in project pentaho-platform by pentaho.
the class ResultsetIT method testResultSetWithoutColumnHeader.
public void testResultSetWithoutColumnHeader() {
startTest();
// $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
IRuntimeContext context = run("/test/rules/ResultSetTest_without_columnheader.xaction");
assertEquals(Messages.getInstance().getString("BaseTest.USER_RUNNING_ACTION_SEQUENCE"), IRuntimeContext.RUNTIME_STATUS_FAILURE, // $NON-NLS-1$
context.getStatus());
finishTest();
}
use of org.pentaho.platform.api.engine.IRuntimeContext in project pentaho-platform by pentaho.
the class RulesIT method testScriptRuleError2.
public void testScriptRuleError2() {
startTest();
// $NON-NLS-1$
info(Messages.getInstance().getString("RulesTest.USER_ERRORS_EXPECTED_OUTPUT_NOT_DEFINED"));
// $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
IRuntimeContext context = run("/test/rules/script_rule_error2.xaction");
assertEquals(Messages.getInstance().getString("BaseTest.USER_RUNNING_ACTION_SEQUENCE"), IRuntimeContext.RUNTIME_CONTEXT_VALIDATE_FAIL, // $NON-NLS-1$
context.getStatus());
assertEquals(Messages.getInstance().getString("RulesTest.ERROR_0006_RESULT_WHEN_ERROR_EXPECTED"), false, // $NON-NLS-1$//$NON-NLS-2$
context.getOutputNames().contains("rule-result"));
finishTest();
}
use of org.pentaho.platform.api.engine.IRuntimeContext in project pentaho-platform by pentaho.
the class RulesIT method testQueryRule.
public void testQueryRule() {
startTest();
IPentahoResultSet resultSet = null;
try {
// $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
IRuntimeContext context = run("/test/rules/query_rule1.xaction");
// $NON-NLS-1$
assertEquals(Messages.getInstance().getString("BaseTest.USER_RUNNING_ACTION_SEQUENCE"), IRuntimeContext.RUNTIME_STATUS_SUCCESS, context.getStatus());
// $NON-NLS-1$
Object result = context.getOutputParameter("rule-result").getValue();
// $NON-NLS-1$
assertNotNull(Messages.getInstance().getString("RulesTest.ERROR_0001_NULL_RESULT"), result);
// $NON-NLS-1$
assertTrue(Messages.getInstance().getString("RulesTest.ERROR_0007_LOOKUP_RULE_INVALID_RESULT"), (result instanceof IPentahoResultSet));
resultSet = (IPentahoResultSet) result;
IPentahoMetaData metaData = resultSet.getMetaData();
Object[][] columnHeaders = metaData.getColumnHeaders();
String columnHeader = columnHeaders[0][0].toString();
// $NON-NLS-1$ //$NON-NLS-2$
assertEquals(Messages.getInstance().getString("RulesTest.ERROR_0009_LOOKUP_RULE_COLUMN_MISSING"), "POSITIONTITLE", columnHeader);
Object[] row = resultSet.next();
// $NON-NLS-1$
assertNotNull(Messages.getInstance().getString("RulesTest.ERROR_0007_LOOKUP_RULE_INVALID_RESULT"), row);
// $NON-NLS-1$
info(Messages.getInstance().getString("RulesTest.DEBUG_LOOKUP_RULE_SUCCESS", row[0].toString()));
} finally {
if (resultSet != null) {
resultSet.closeConnection();
}
}
finishTest();
}
use of org.pentaho.platform.api.engine.IRuntimeContext in project pentaho-platform by pentaho.
the class RulesIT method testScriptCompoundResult.
public void testScriptCompoundResult() {
startTest();
// $NON-NLS-1$
info(Messages.getInstance().getString("RulesTest.USER_ERRORS_EXPECTED_SCRIPT_INVALID"));
// $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
IRuntimeContext context = run("/test/rules/script_rule3.xaction");
assertEquals(Messages.getInstance().getString("BaseTest.USER_RUNNING_ACTION_SEQUENCE"), IRuntimeContext.RUNTIME_STATUS_SUCCESS, // $NON-NLS-1$
context.getStatus());
// $NON-NLS-1$
assertNotNull(context.getOutputParameter("fruit"));
// $NON-NLS-1$
assertNotNull(context.getOutputParameter("veg"));
// $NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
assertEquals("bad", "apples", context.getOutputParameter("fruit").getStringValue());
// $NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
assertEquals("bad", "carrots", context.getOutputParameter("veg").getStringValue());
finishTest();
}
Aggregations