use of org.pentaho.platform.api.engine.IRuntimeContext in project pentaho-platform by pentaho.
the class SubActionComponentIT method testChildConnectionNotSharing.
/**
* parent action creates a connection, used by sub-action parent then re-uses connection
*/
/*
* public void testParentConnectionSharing() {
*
* startTest(); info("Expected: Successful execution with object available"); //$NON-NLS-1$ IRuntimeContext context =
* run("test", "platform", "SubActionConnectionTest4.xaction"); //$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$
*
* IActionParameter rtn = context.getOutputParameter("query-results"); //$NON-NLS-1$ assertNotNull(rtn);
* IPentahoResultSet resultSet = (IPentahoResultSet) rtn.getValue(); assertNotNull(resultSet);
*
* try { assertEquals(5, resultSet.getRowCount()); } catch (Exception e) { e.printStackTrace(); fail(); }
*
* finishTest(); }
*/
/**
* sub-action creates connection, passes result set on to parent action
*/
/*
* public void testChildResultSetSharing() {
*
* startTest(); info("Expected: Successful execution with object available"); //$NON-NLS-1$ IRuntimeContext context =
* run("test", "platform", "SubActionConnectionTest3.xaction"); //$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$
*
* IActionParameter rtn = context.getOutputParameter("query-results"); //$NON-NLS-1$ assertNotNull(rtn);
* IPentahoResultSet resultSet = (IPentahoResultSet) rtn.getValue(); assertNotNull(resultSet);
*
* try { // if row count is zero, that means the native connection has been closed. assertEquals(5,
* resultSet.getRowCount()); } catch (Exception e) { e.printStackTrace(); fail(); }
*
* finishTest(); }
*/
/**
* sub-action creates result set, uses, and passes nothing to parent action
*/
public void testChildConnectionNotSharing() {
startTest();
// $NON-NLS-1$
info("Expected: Failed execution with object not available");
// $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
IRuntimeContext context = run("/test/platform/SubActionConnectionTest2.xaction");
// xaction should fail, because connection isn't available
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 TemplateIT method testTemplate1.
public void testTemplate1() {
startTest();
SimpleParameterProvider parameterProvider = new SimpleParameterProvider();
// $NON-NLS-1$ //$NON-NLS-2$
parameterProvider.setParameter("customer", "Acme");
// $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
IRuntimeContext context = run("/test/template/template1.xaction", parameterProvider);
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("output"));
// $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
assertEquals("", "Customer 'Acme' is in region West", context.getOutputParameter("output").getStringValue());
finishTest();
}
use of org.pentaho.platform.api.engine.IRuntimeContext 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.api.engine.IRuntimeContext in project pentaho-platform by pentaho.
the class TemplateIT method testTemplate2.
public void testTemplate2() {
startTest();
SimpleParameterProvider parameterProvider = new SimpleParameterProvider();
// $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
IRuntimeContext context = run("/test/template/template2.xaction", parameterProvider);
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("output"));
assertEquals("", "Eastern is 120000 with a color of #00ff00, Western is 90000 with a color of #ffff00, Southern is 75000 with a color of #ff0000", // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
context.getOutputParameter("output").getStringValue());
finishTest();
}
use of org.pentaho.platform.api.engine.IRuntimeContext in project pentaho-platform by pentaho.
the class ResultSetCompareComponentTest method createResultSetCompareComponent.
private static ResultSetCompareComponent createResultSetCompareComponent() {
ResultSetCompareComponent rscc = new ResultSetCompareComponent();
IRuntimeContext context = mock(IRuntimeContext.class);
rscc.setRuntimeContext(context);
rscc.setSession(mock(IPentahoSession.class));
rscc.setComponentDefinition(mock(Node.class));
rscc.setInstanceId("TEST_ID");
rscc.setProcessId("TEST_PROCESS_ID");
rscc.setActionName("TEST_ACTION_NAME");
return rscc;
}
Aggregations