Search in sources :

Example 11 with IRuntimeContext

use of org.pentaho.platform.api.engine.IRuntimeContext in project pentaho-platform by pentaho.

the class JavaScriptResultSetIT method testRSCompareNotOK2.

public void testRSCompareNotOK2() {
    startTest();
    IRuntimeContext context = run("/samples/rules/ResultSetCompareTest_error2.xaction");
    assertEquals(context.getStatus(), IRuntimeContext.RUNTIME_STATUS_FAILURE);
    finishTest();
}
Also used : IRuntimeContext(org.pentaho.platform.api.engine.IRuntimeContext)

Example 12 with IRuntimeContext

use of org.pentaho.platform.api.engine.IRuntimeContext in project pentaho-platform by pentaho.

the class JavaScriptResultSetIT method testRSCompareNotOK1.

public void testRSCompareNotOK1() {
    startTest();
    IRuntimeContext context = run("/samples/rules/ResultSetCompareTest_error1.xaction");
    assertEquals(IRuntimeContext.RUNTIME_STATUS_SUCCESS, context.getStatus());
    finishTest();
}
Also used : IRuntimeContext(org.pentaho.platform.api.engine.IRuntimeContext)

Example 13 with IRuntimeContext

use of org.pentaho.platform.api.engine.IRuntimeContext in project pentaho-platform by pentaho.

the class JavaScriptResultSetIT method testRSCompareNotOK4.

public void testRSCompareNotOK4() {
    startTest();
    IRuntimeContext context = run("/samples/rules/ResultSetCompareTest_error4.xaction");
    assertEquals(context.getStatus(), IRuntimeContext.RUNTIME_CONTEXT_VALIDATE_FAIL);
    finishTest();
}
Also used : IRuntimeContext(org.pentaho.platform.api.engine.IRuntimeContext)

Example 14 with IRuntimeContext

use of org.pentaho.platform.api.engine.IRuntimeContext in project pentaho-platform by pentaho.

the class ResultSetExportComponentIT method testRSExportComponent.

public void testRSExportComponent() {
    startTest();
    // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    IRuntimeContext context = run("/test/rules/ResultSetExportTest.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("EXPORTRESULT");
    // $NON-NLS-1$
    assertNotNull("Result is null", rtn);
    // Check that the data, Eastern, is in the result set
    String content = rtn.getStringValue();
    // $NON-NLS-1$
    assertNotNull("Exported content is null", content);
    // $NON-NLS-1$
    int containsEastern = content.indexOf("Eastern");
    // $NON-NLS-1$
    assertEquals("ResultSet export does not contain 'Eastern'", Math.max(containsEastern, -1), containsEastern);
    finishTest();
}
Also used : IRuntimeContext(org.pentaho.platform.api.engine.IRuntimeContext) IActionParameter(org.pentaho.platform.api.engine.IActionParameter)

Example 15 with IRuntimeContext

use of org.pentaho.platform.api.engine.IRuntimeContext in project pentaho-platform by pentaho.

the class ResultSetExportComponentIT method testRSExportComponent_error1.

/*
   * The test removes the result-set element from the action inputs.
   */
public void testRSExportComponent_error1() {
    startTest();
    // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    IRuntimeContext context = run("/test/rules/ResultSetExportTest_error1.xaction");
    assertEquals(Messages.getInstance().getString("BaseTest.USER_RUNNING_ACTION_SEQUENCE"), IRuntimeContext.RUNTIME_CONTEXT_VALIDATE_FAIL, // $NON-NLS-1$
    context.getStatus());
    finishTest();
}
Also used : IRuntimeContext(org.pentaho.platform.api.engine.IRuntimeContext)

Aggregations

IRuntimeContext (org.pentaho.platform.api.engine.IRuntimeContext)100 ArrayList (java.util.ArrayList)28 HashMap (java.util.HashMap)28 ISolutionEngine (org.pentaho.platform.api.engine.ISolutionEngine)28 IActionParameter (org.pentaho.platform.api.engine.IActionParameter)24 SimpleParameterProvider (org.pentaho.platform.engine.core.solution.SimpleParameterProvider)21 SimpleUrlFactory (org.pentaho.platform.util.web.SimpleUrlFactory)20 SimpleOutputHandler (org.pentaho.platform.engine.core.output.SimpleOutputHandler)17 IPentahoSession (org.pentaho.platform.api.engine.IPentahoSession)14 OutputStream (java.io.OutputStream)12 StandaloneSession (org.pentaho.platform.engine.core.system.StandaloneSession)12 List (java.util.List)10 IPentahoUrlFactory (org.pentaho.platform.api.engine.IPentahoUrlFactory)9 IOException (java.io.IOException)8 Map (java.util.Map)8 IPentahoResultSet (org.pentaho.commons.connection.IPentahoResultSet)8 ByteArrayOutputStream (java.io.ByteArrayOutputStream)7 IOutputHandler (org.pentaho.platform.api.engine.IOutputHandler)7 IParameterProvider (org.pentaho.platform.api.engine.IParameterProvider)6 Document (org.dom4j.Document)5