本文整理汇总了Java中org.springframework.mock.web.portlet.MockActionRequest.setPortletMode方法的典型用法代码示例。如果您正苦于以下问题:Java MockActionRequest.setPortletMode方法的具体用法?Java MockActionRequest.setPortletMode怎么用?Java MockActionRequest.setPortletMode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.mock.web.portlet.MockActionRequest
的用法示例。
在下文中一共展示了MockActionRequest.setPortletMode方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: portletModeParameterMappingHelp1
import org.springframework.mock.web.portlet.MockActionRequest; //导入方法依赖的package包/类
@Test
public void portletModeParameterMappingHelp1() throws Exception {
MockActionRequest request = new MockActionRequest();
MockActionResponse response = new MockActionResponse();
request.setPortletMode(PortletMode.HELP);
request.setParameter("action", "help1");
complexDispatcherPortlet.processAction(request, response);
String param = response.getRenderParameter("param");
assertEquals("help1 was here", param);
}
示例2: portletModeParameterMappingHelp2
import org.springframework.mock.web.portlet.MockActionRequest; //导入方法依赖的package包/类
@Test
public void portletModeParameterMappingHelp2() throws Exception {
MockActionRequest request = new MockActionRequest();
MockActionResponse response = new MockActionResponse();
request.setPortletMode(PortletMode.HELP);
request.setParameter("action", "help2");
complexDispatcherPortlet.processAction(request, response);
String param = response.getRenderParameter("param");
assertEquals("help2 was here", param);
}
示例3: portletModeParameterMappingInvalidHelpActionRequest
import org.springframework.mock.web.portlet.MockActionRequest; //导入方法依赖的package包/类
@Test
public void portletModeParameterMappingInvalidHelpActionRequest() throws Exception {
MockActionRequest request = new MockActionRequest();
MockActionResponse response = new MockActionResponse();
request.setPortletMode(PortletMode.HELP);
request.setParameter("action", "help3");
complexDispatcherPortlet.processAction(request, response);
String exceptionParam = response.getRenderParameter(DispatcherPortlet.ACTION_EXCEPTION_RENDER_PARAMETER);
assertNotNull(exceptionParam);
assertTrue(exceptionParam.startsWith(NoHandlerFoundException.class.getName()));
}
示例4: portletModeMappingValidEditActionRequest
import org.springframework.mock.web.portlet.MockActionRequest; //导入方法依赖的package包/类
@Test
public void portletModeMappingValidEditActionRequest() throws Exception {
MockActionRequest request = new MockActionRequest();
MockActionResponse response = new MockActionResponse();
request.setPortletMode(PortletMode.EDIT);
request.addUserRole("role1");
request.setParameter("action", "not mapped");
request.setParameter("myParam", "not mapped");
complexDispatcherPortlet.processAction(request, response);
assertEquals("edit was here", response.getRenderParameter("param"));
}
示例5: portletModeMappingEditActionRequestWithUnauthorizedUserRole
import org.springframework.mock.web.portlet.MockActionRequest; //导入方法依赖的package包/类
@Test
public void portletModeMappingEditActionRequestWithUnauthorizedUserRole() throws Exception {
MockActionRequest request = new MockActionRequest();
MockActionResponse response = new MockActionResponse();
request.setPortletMode(PortletMode.EDIT);
request.addUserRole("role3");
request.setParameter("action", "not mapped");
request.setParameter("myParam", "not mapped");
complexDispatcherPortlet.processAction(request, response);
String exception = response.getRenderParameter(DispatcherPortlet.ACTION_EXCEPTION_RENDER_PARAMETER);
assertNotNull(exception);
String name = PortletSecurityException.class.getName();
assertTrue(exception.startsWith(name));
}
示例6: parameterMappingValidActionRequest
import org.springframework.mock.web.portlet.MockActionRequest; //导入方法依赖的package包/类
@Test
public void parameterMappingValidActionRequest() throws Exception {
MockActionRequest request = new MockActionRequest();
MockActionResponse response = new MockActionResponse();
request.setPortletMode(PortletMode.EDIT);
request.setParameter("action", "not mapped");
request.setParameter("myParam", "test1");
complexDispatcherPortlet.processAction(request, response);
assertEquals("test1-action", response.getRenderParameter("result"));
}
示例7: noDetectAllHandlerMappingsWithPortletModeActionRequest
import org.springframework.mock.web.portlet.MockActionRequest; //导入方法依赖的package包/类
@Test
public void noDetectAllHandlerMappingsWithPortletModeActionRequest() throws Exception {
DispatcherPortlet complexDispatcherPortlet = new DispatcherPortlet();
complexDispatcherPortlet.setContextClass(ComplexPortletApplicationContext.class);
complexDispatcherPortlet.setNamespace("test");
complexDispatcherPortlet.setDetectAllHandlerMappings(false);
complexDispatcherPortlet.init(new MockPortletConfig(getPortletContext(), "complex"));
MockActionRequest request = new MockActionRequest();
MockActionResponse response = new MockActionResponse();
request.setPortletMode(PortletMode.EDIT);
complexDispatcherPortlet.processAction(request, response);
String exceptionParam = response.getRenderParameter(DispatcherPortlet.ACTION_EXCEPTION_RENDER_PARAMETER);
assertNotNull(exceptionParam);
assertTrue(exceptionParam.startsWith(NoHandlerFoundException.class.getName()));
}
示例8: existingMultipartRequest
import org.springframework.mock.web.portlet.MockActionRequest; //导入方法依赖的package包/类
@Test
public void existingMultipartRequest() throws Exception {
MockActionRequest request = new MockActionRequest();
MockActionResponse response = new MockActionResponse();
request.setPortletMode(PortletMode.EDIT);
ComplexPortletApplicationContext.MockMultipartResolver multipartResolver =
(ComplexPortletApplicationContext.MockMultipartResolver)
complexDispatcherPortlet.getPortletApplicationContext().getBean("portletMultipartResolver");
MultipartActionRequest multipartRequest = multipartResolver.resolveMultipart(request);
complexDispatcherPortlet.processAction(multipartRequest, response);
multipartResolver.cleanupMultipart(multipartRequest);
assertNotNull(request.getAttribute("cleanedUp"));
}
示例9: multipartResolutionFailed
import org.springframework.mock.web.portlet.MockActionRequest; //导入方法依赖的package包/类
@Test
public void multipartResolutionFailed() throws Exception {
MockActionRequest request = new MockActionRequest();
MockActionResponse response = new MockActionResponse();
request.setPortletMode(PortletMode.EDIT);
request.addUserRole("role1");
request.setAttribute("fail", Boolean.TRUE);
complexDispatcherPortlet.processAction(request, response);
String exception = response.getRenderParameter(DispatcherPortlet.ACTION_EXCEPTION_RENDER_PARAMETER);
assertTrue(exception.startsWith(MaxUploadSizeExceededException.class.getName()));
}
示例10: parameterMappingInterceptorWithCorrectParam
import org.springframework.mock.web.portlet.MockActionRequest; //导入方法依赖的package包/类
@Test
public void parameterMappingInterceptorWithCorrectParam() throws Exception {
MockActionRequest request = new MockActionRequest();
MockActionResponse response = new MockActionResponse();
request.setPortletMode(PortletMode.VIEW);
request.addUserRole("role1");
request.addParameter("interceptingParam", "test1");
complexDispatcherPortlet.processAction(request, response);
assertEquals("test1", response.getRenderParameter("interceptingParam"));
}
示例11: parameterMappingInterceptorWithIncorrectParam
import org.springframework.mock.web.portlet.MockActionRequest; //导入方法依赖的package包/类
@Test
public void parameterMappingInterceptorWithIncorrectParam() throws Exception {
MockActionRequest request = new MockActionRequest();
MockActionResponse response = new MockActionResponse();
request.setPortletMode(PortletMode.VIEW);
request.addUserRole("role1");
request.addParameter("incorrect", "test1");
complexDispatcherPortlet.processAction(request, response);
assertNull(response.getRenderParameter("incorrect"));
assertNull(response.getRenderParameter("interceptingParam"));
}
示例12: testPortletModeParameterMappingHelp1
import org.springframework.mock.web.portlet.MockActionRequest; //导入方法依赖的package包/类
public void testPortletModeParameterMappingHelp1() throws Exception {
MockActionRequest request = new MockActionRequest();
MockActionResponse response = new MockActionResponse();
request.setPortletMode(PortletMode.HELP);
request.setParameter("action", "help1");
complexDispatcherPortlet.processAction(request, response);
String param = response.getRenderParameter("param");
assertEquals("help1 was here", param);
}
示例13: testPortletModeParameterMappingHelp2
import org.springframework.mock.web.portlet.MockActionRequest; //导入方法依赖的package包/类
public void testPortletModeParameterMappingHelp2() throws Exception {
MockActionRequest request = new MockActionRequest();
MockActionResponse response = new MockActionResponse();
request.setPortletMode(PortletMode.HELP);
request.setParameter("action", "help2");
complexDispatcherPortlet.processAction(request, response);
String param = response.getRenderParameter("param");
assertEquals("help2 was here", param);
}
示例14: testPortletModeParameterMappingInvalidHelpActionRequest
import org.springframework.mock.web.portlet.MockActionRequest; //导入方法依赖的package包/类
public void testPortletModeParameterMappingInvalidHelpActionRequest() throws Exception {
MockActionRequest request = new MockActionRequest();
MockActionResponse response = new MockActionResponse();
request.setPortletMode(PortletMode.HELP);
request.setParameter("action", "help3");
complexDispatcherPortlet.processAction(request, response);
String exceptionParam = response.getRenderParameter(DispatcherPortlet.ACTION_EXCEPTION_RENDER_PARAMETER);
assertNotNull(exceptionParam);
assertTrue(exceptionParam.startsWith(NoHandlerFoundException.class.getName()));
}
示例15: testPortletModeMappingValidEditActionRequest
import org.springframework.mock.web.portlet.MockActionRequest; //导入方法依赖的package包/类
public void testPortletModeMappingValidEditActionRequest() throws Exception {
MockActionRequest request = new MockActionRequest();
MockActionResponse response = new MockActionResponse();
request.setPortletMode(PortletMode.EDIT);
request.addUserRole("role1");
request.setParameter("action", "not mapped");
request.setParameter("myParam", "not mapped");
complexDispatcherPortlet.processAction(request, response);
assertEquals("edit was here", response.getRenderParameter("param"));
}