use of org.pentaho.platform.engine.core.solution.SimpleParameterProvider in project pentaho-platform by pentaho.
the class DashboardWidgetIT method testWidget1.
public void testWidget1() {
startTest();
// $NON-NLS-1$
SimpleUrlFactory urlFactory = new SimpleUrlFactory("/testurl?");
ArrayList messages = new ArrayList();
DashboardWidgetComponent widget = new DashboardWidgetComponent(DashboardWidgetComponent.TYPE_DIAL, getSolutionPath() + "/samples/charts/dashboardwidget1.dial.xml", 300, 300, urlFactory, // $NON-NLS-1$
messages);
widget.setLoggingLevel(getLoggingLevel());
widget.setValue(72.5);
// $NON-NLS-1$
widget.setTitle("test widget 1");
// $NON-NLS-1$
widget.setUnits("$");
// $NON-NLS-1$//$NON-NLS-2$
OutputStream outputStream = getOutputStream("DashboardWidgetTest.testWidget1", ".html");
// $NON-NLS-1$
String contentType = "text/html";
SimpleParameterProvider requestParameters = new SimpleParameterProvider();
SimpleParameterProvider sessionParameters = new SimpleParameterProvider();
HashMap parameterProviders = new HashMap();
parameterProviders.put(HttpRequestParameterProvider.SCOPE_REQUEST, requestParameters);
parameterProviders.put(HttpSessionParameterProvider.SCOPE_SESSION, sessionParameters);
// $NON-NLS-1$
StandaloneSession session = new StandaloneSession("BaseTest.DEBUG_JUNIT_SESSION");
SimpleOutputHandler outputHandler = new SimpleOutputHandler(outputStream, false);
BaseRequestHandler requestHandler = new BaseRequestHandler(session, null, outputHandler, null, urlFactory);
try {
widget.validate(session, requestHandler);
widget.handleRequest(outputStream, requestHandler, contentType, parameterProviders);
} catch (IOException e) {
e.printStackTrace();
}
finishTest();
}
use of org.pentaho.platform.engine.core.solution.SimpleParameterProvider 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();
}
use of org.pentaho.platform.engine.core.solution.SimpleParameterProvider in project pentaho-platform by pentaho.
the class SessionIT method testUserSessionWithOutAuthentication.
public void testUserSessionWithOutAuthentication() {
startTest();
SimpleParameterProvider parameters = new SimpleParameterProvider();
// $NON-NLS-1$ //$NON-NLS-2$
parameters.setParameter("actionname", "ViewAction");
// $NON-NLS-1$
UserSession usession = new UserSession("Admin", Locale.US, parameters);
Log log = usession.getLogger();
usession.setActionName("ViewAction");
usession.doStartupActions(parameters);
// $NON-NLS-1$
log.info("Session is active");
// $NON-NLS-1$
assertEquals(usession.getActionName(), "ViewAction");
finishTest();
}
use of org.pentaho.platform.engine.core.solution.SimpleParameterProvider in project pentaho-platform by pentaho.
the class SessionIT method testStandAloneSession.
public void testStandAloneSession() {
startTest();
SimpleParameterProvider parameters = new SimpleParameterProvider();
// $NON-NLS-1$ //$NON-NLS-2$
parameters.setParameter("actionname", "ViewAction");
// $NON-NLS-1$
StandaloneSession session = new StandaloneSession("BaseTest.DEBUG_JUNIT_SESSION");
Log log = session.getLogger();
// $NON-NLS-1$
System.out.println("Action Name for the Session is " + session.getActionName());
session.setNotAuthenticated();
// $NON-NLS-1$
log.info("Session is active");
session.destroy();
assertTrue(true);
finishTest();
}
use of org.pentaho.platform.engine.core.solution.SimpleParameterProvider in project pentaho-platform by pentaho.
the class SubActionComponentIT method testSuccessPaths.
public void testSuccessPaths() {
startTest();
// $NON-NLS-1$
String testName = CO_TEST_NAME + "string_" + System.currentTimeMillis();
SimpleParameterProvider parameterProvider = new SimpleParameterProvider();
parameterProvider.setParameter(SOLUTION_NAME_PARAM, SOLUTION_NAME);
parameterProvider.setParameter(SOLUTION_PATH_PARAM, "platform");
parameterProvider.setParameter(SUBACTION_PARAM, SUBACTION);
parameterProvider.setParameter(TEST_INPUT_PARAM, TEST_STRING);
IRuntimeContext context = run("/" + SOLUTION_NAME + "/platform/" + TEST_XACTION, parameterProvider, testName, CO_TEST_EXTN);
assertEquals(Messages.getInstance().getString("BaseTest.USER_RUNNING_ACTION_SEQUENCE"), IRuntimeContext.RUNTIME_STATUS_SUCCESS, // $NON-NLS-1$
context.getStatus());
IActionParameter rtn = context.getOutputParameter(TEST_OUTPUT_PARAM);
Object value = rtn.getValue();
assertEquals(TEST_STRING, value);
finishTest();
}
Aggregations