PortletUrlHelperTestpublic class PortletUrlHelperTest extends TestCase
Fields Summary |
---|
javax.portlet.RenderResponse | renderResponse | javax.portlet.RenderRequest | renderRequest | javax.portlet.PortletURL | url | org.easymock.MockControl | renderResponseControl | org.easymock.MockControl | renderRequestControl | org.easymock.MockControl | portletUrlControl |
Methods Summary |
---|
public void | setUp()
super.setUp();
renderRequestControl = MockControl.createControl(RenderRequest.class);
renderResponseControl = MockControl.createControl(RenderResponse.class);
portletUrlControl = MockControl.createControl(PortletURL.class);
renderRequest = (RenderRequest) renderRequestControl.getMock();
renderResponse = (RenderResponse) renderResponseControl.getMock();
url = (PortletURL) portletUrlControl.getMock();
renderRequestControl.expectAndDefaultReturn(renderRequest
.getPortletMode(), PortletMode.VIEW);
renderRequestControl.expectAndDefaultReturn(renderRequest
.getWindowState(), WindowState.NORMAL);
Map modeNamespaceMap = new HashMap();
modeNamespaceMap.put("view", "/view");
modeNamespaceMap.put("edit", "/edit");
modeNamespaceMap.put("help", "/help");
Map context = new HashMap();
context.put(PortletActionContext.REQUEST, renderRequest);
context.put(PortletActionContext.RESPONSE, renderResponse);
context.put(PortletActionContext.PHASE,
PortletActionContext.RENDER_PHASE);
context.put(PortletActionContext.MODE_NAMESPACE_MAP, modeNamespaceMap);
ActionContext.setContext(new ActionContext(context));
| public void | testCreateActionUrl()
renderResponseControl.expectAndReturn(renderResponse.createActionURL(),
url);
url.setPortletMode(PortletMode.VIEW);
url.setWindowState(WindowState.NORMAL);
url.setParameters(null);
portletUrlControl.setMatcher(MockControl.ALWAYS_MATCHER);
renderRequestControl.replay();
renderResponseControl.replay();
portletUrlControl.replay();
PortletUrlHelper.buildUrl("testAction", null,
new HashMap(), "action", null, null);
portletUrlControl.verify();
renderRequestControl.verify();
renderResponseControl.verify();
| public void | testCreateRenderUrlWithDifferentPortletMode()
renderResponseControl.expectAndReturn(renderResponse.createRenderURL(),
url);
url.setPortletMode(PortletMode.EDIT);
url.setWindowState(WindowState.NORMAL);
url.setParameters(null);
portletUrlControl.setMatcher(MockControl.ALWAYS_MATCHER);
renderRequestControl.replay();
renderResponseControl.replay();
portletUrlControl.replay();
PortletUrlHelper.buildUrl("testAction", null,
new HashMap(), null, "edit", null);
portletUrlControl.verify();
renderRequestControl.verify();
renderResponseControl.verify();
| public void | testCreateRenderUrlWithDifferentWindowState()
renderResponseControl.expectAndReturn(renderResponse.createRenderURL(),
url);
url.setPortletMode(PortletMode.VIEW);
url.setWindowState(WindowState.MAXIMIZED);
url.setParameters(null);
portletUrlControl.setMatcher(MockControl.ALWAYS_MATCHER);
renderRequestControl.replay();
renderResponseControl.replay();
portletUrlControl.replay();
PortletUrlHelper.buildUrl("testAction", null,
new HashMap(), null, null, "maximized");
portletUrlControl.verify();
renderRequestControl.verify();
renderResponseControl.verify();
| public void | testCreateRenderUrlWithNoModeOrState()
renderResponseControl.expectAndReturn(renderResponse.createRenderURL(),
url);
url.setPortletMode(PortletMode.VIEW);
url.setWindowState(WindowState.NORMAL);
url.setParameters(null);
portletUrlControl.setMatcher(MockControl.ALWAYS_MATCHER);
renderRequestControl.replay();
renderResponseControl.replay();
portletUrlControl.replay();
PortletUrlHelper.buildUrl("testAction", null,
new HashMap(), null, null, null);
portletUrlControl.verify();
renderRequestControl.verify();
renderResponseControl.verify();
|
|