use of org.pentaho.platform.api.engine.IMessageFormatter in project pentaho-platform by pentaho.
the class UIServletIT method setUp.
public void setUp() {
// $NON-NLS-1$
StandaloneApplicationContext applicationContext = new StandaloneApplicationContext(getSolutionPath(), "");
PentahoSystem.init(applicationContext, getRequiredListeners());
IMessageFormatter msgFormatter = new MessageFormatter();
PentahoSystem.registerObject(msgFormatter);
}
use of org.pentaho.platform.api.engine.IMessageFormatter in project pentaho-platform by pentaho.
the class ViewActionServletIT method testBackgroundExecutionNoExecutor.
/**
* This test covers execution without background parameter. In that case <code>servlet.error()</code>
* wouldn't be executed.
*
* @throws ServletException
* @throws IOException
*/
@Test
public void testBackgroundExecutionNoExecutor() throws ServletException, IOException {
when(request.getParameter(eq("background"))).thenReturn(Boolean.TRUE.toString());
final String actionPath = "test-path";
when(request.getParameter(eq("path"))).thenReturn(actionPath);
final String instanceID = "instance-id";
when(request.getParameter(eq("instance-id"))).thenReturn(instanceID);
final ServletOutputStream outputStream = mock(ServletOutputStream.class);
when(response.getOutputStream()).thenReturn(outputStream);
final ISolutionEngine solutionEngine = mock(ISolutionEngine.class);
final IRuntimeContext runtime = mock(IRuntimeContext.class);
when(runtime.getStatus()).thenReturn(IRuntimeContext.RUNTIME_STATUS_SUCCESS);
when(solutionEngine.execute(eq(actionPath), eq(servlet.getClass().getName()), eq(false), eq(true), eq(instanceID), eq(true), any(Map.class), any(IOutputHandler.class), any(IActionCompleteListener.class), any(IPentahoUrlFactory.class), any(List.class))).thenReturn(runtime);
mp.defineInstance(ISolutionEngine.class, solutionEngine);
final IMessageFormatter messageFormatter = mock(IMessageFormatter.class);
mp.defineInstance(IMessageFormatter.class, messageFormatter);
servlet.service(request, response);
verify(servlet).error(matches(".*ERROR_0001.*"));
verify(outputStream).write(any(byte[].class));
verify(messageFormatter).formatSuccessMessage(eq("text/html"), eq(runtime), any(StringBuffer.class), anyBoolean(), anyBoolean());
}
Aggregations