use of org.pentaho.platform.engine.core.solution.SimpleParameterProvider 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.engine.core.solution.SimpleParameterProvider 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.engine.core.solution.SimpleParameterProvider in project pentaho-platform by pentaho.
the class FilterDefinitionIT method setGlobalParams.
private void setGlobalParams() {
IPentahoResultSet rs = getFakeResultSet();
SimpleParameterProvider spp = (SimpleParameterProvider) PentahoSystem.getGlobalParameters();
// $NON-NLS-1$
spp.setParameter("customerNamesList", rs);
}
use of org.pentaho.platform.engine.core.solution.SimpleParameterProvider in project pentaho-platform by pentaho.
the class SimpleParameterProviderTest method testConstructors.
public void testConstructors() {
SimpleParameterProvider params = new SimpleParameterProvider();
params.setParameter("param", "value");
assertEquals("param value if wrong", "value", params.getStringParameter("param", null));
Map map = new HashMap();
map.put("param2", "value2");
params = new SimpleParameterProvider(map);
assertEquals("param value if wrong", "value2", params.getStringParameter("param2", null));
assertTrue(params.hasParameter("param2"));
assertFalse(params.hasParameter("bogus"));
params = new SimpleParameterProvider(null);
assertEquals("param value if wrong", null, params.getStringParameter("param2", null));
}
use of org.pentaho.platform.engine.core.solution.SimpleParameterProvider in project pentaho-platform by pentaho.
the class SimpleParameterProviderTest method testArrays.
public void testArrays() {
Map<String, Object> paramMap = new HashMap<String, Object>();
paramMap.put("int-1", new Object[] { new Integer(100) });
paramMap.put("int-2", new Object[] { new Integer(100), new Integer(999) });
SimpleParameterProvider params = new SimpleParameterProvider();
params.copyAndConvertParameters(paramMap);
assertEquals("param value is wrong", "100", params.getStringParameter("int-1", null));
assertEquals("param value is wrong", 100, params.getLongParameter("int-1", -1));
assertEquals("param value is wrong", "100", params.getStringParameter("int-2", null));
assertEquals("param value is wrong", 100, params.getLongParameter("int-2", -1));
assertEquals("param value is wrong", -1, params.getLongParameter("int-3", -1));
Object[] val = params.getArrayParameter("int-2", null);
assertNotNull("param value is wrong", val);
assertEquals("param value is wrong", 100, val[0]);
assertEquals("param value is wrong", 999, val[1]);
Object[][] value2 = new Object[0][0];
params.setParameter("2darray", value2);
assertEquals("param value is wrong", value2, params.getParameter("2darray"));
assertEquals("param value is wrong", null, params.getStringParameter("2darray", null));
}
Aggregations