Methods Summary |
---|
public static void | main(java.lang.String[] args)
TestRunner.run(PortletActionContextTest.class);
|
public void | setUp()
super.setUp();
mockRenderRequest = mock(RenderRequest.class);
mockRenderResponse = mock(RenderResponse.class);
mockActionRequest = mock(ActionRequest.class);
mockActionResponse = mock(ActionResponse.class);
mockPortletConfig = mock(PortletConfig.class);
renderRequest = (RenderRequest)mockRenderRequest.proxy();
renderResponse = (RenderResponse)mockRenderResponse.proxy();
actionRequest = (ActionRequest)mockActionRequest.proxy();
actionResponse = (ActionResponse)mockActionResponse.proxy();
portletConfig = (PortletConfig)mockPortletConfig.proxy();
ActionContext.setContext(new ActionContext(context));
|
public void | tearDown()
ActionContext.setContext(null);
super.tearDown();
|
public void | testGetActionRequestAndResponse()
context.put(PortletActionConstants.REQUEST, actionRequest);
context.put(PortletActionConstants.RESPONSE, actionResponse);
context.put(PortletActionConstants.PHASE, PortletActionConstants.EVENT_PHASE);
assertSame(actionRequest, PortletActionContext.getActionRequest());
assertSame(actionResponse, PortletActionContext.getActionResponse());
assertSame(actionRequest, PortletActionContext.getRequest());
assertSame(actionResponse, PortletActionContext.getResponse());
|
public void | testGetActionRequestAndResponseInRenderPhase()
context.put(PortletActionConstants.REQUEST, actionRequest);
context.put(PortletActionConstants.RESPONSE, actionResponse);
context.put(PortletActionConstants.PHASE, PortletActionConstants.RENDER_PHASE);
try {
PortletActionContext.getActionRequest();
fail("Should throw IllegalStateException!");
}
catch(IllegalStateException e) {
assertTrue(true);
}
try {
PortletActionContext.getActionResponse();
fail("Should throw IllegalStateException!");
}
catch(IllegalStateException e) {
assertTrue(true);
}
|
public void | testGetDefaultActionForMode()
ActionMapping mapping = new ActionMapping();
context.put(PortletActionConstants.DEFAULT_ACTION_FOR_MODE, mapping);
assertEquals(mapping, PortletActionContext.getDefaultActionForMode());
|
public void | testGetNamespace()
context.put(PortletActionConstants.PORTLET_NAMESPACE, "testNamespace");
assertEquals("testNamespace", PortletActionContext.getPortletNamespace());
|
public void | testGetPhase()
context.put(PortletActionConstants.PHASE, PortletActionConstants.RENDER_PHASE);
assertEquals(PortletActionConstants.RENDER_PHASE, PortletActionContext.getPhase());
|
public void | testGetPortletConfig()
context.put(PortletActionConstants.PORTLET_CONFIG, portletConfig);
assertSame(portletConfig, PortletActionContext.getPortletConfig());
|
public void | testGetRenderRequestAndResponse()
context.put(PortletActionConstants.REQUEST, renderRequest);
context.put(PortletActionConstants.RESPONSE, renderResponse);
context.put(PortletActionConstants.PHASE, PortletActionConstants.RENDER_PHASE);
assertSame(renderRequest, PortletActionContext.getRenderRequest());
assertSame(renderResponse, PortletActionContext.getRenderResponse());
assertSame(renderRequest, PortletActionContext.getRequest());
assertSame(renderResponse, PortletActionContext.getResponse());
|
public void | testGetRenderRequestAndResponseInEventPhase()
context.put(PortletActionConstants.REQUEST, renderRequest);
context.put(PortletActionConstants.RESPONSE, renderResponse);
context.put(PortletActionConstants.PHASE, PortletActionConstants.EVENT_PHASE);
try {
PortletActionContext.getRenderRequest();
fail("Should throw IllegalStateException!");
}
catch(IllegalStateException e) {
assertTrue(true);
}
try {
PortletActionContext.getRenderResponse();
fail("Should throw IllegalStateException!");
}
catch(IllegalStateException e) {
assertTrue(true);
}
|
public void | testIsEvent()
context.put(PortletActionConstants.PHASE, PortletActionConstants.EVENT_PHASE);
assertTrue(PortletActionContext.isEvent());
assertFalse(PortletActionContext.isRender());
|
public void | testIsRender()
context.put(PortletActionConstants.PHASE, PortletActionConstants.RENDER_PHASE);
assertTrue(PortletActionContext.isRender());
assertFalse(PortletActionContext.isEvent());
|