Package org.springframework.mock.web.portlet

Examples of org.springframework.mock.web.portlet.MockPortletContext


  public void testRender() throws Exception {
    RenderRequest request = new MockRenderRequest();
    RenderResponse response = new MockRenderResponse();
    MockRequestContext context = new MockRequestContext();
    context.getMockExternalContext().setNativeContext(new MockPortletContext());
    context.getMockExternalContext().setNativeRequest(request);
    context.getMockExternalContext().setNativeResponse(response);
    context.getMockFlowExecutionContext().setKey(new MockFlowExecutionKey("c1v1"));
    org.springframework.web.servlet.View mvcView = EasyMock.createMock(org.springframework.web.servlet.View.class);
    AbstractMvcView view = new PortletMvcView(mvcView, context);
View Full Code Here


    super.setUp();

    context = ActionContext.getContext();
    stack = context.getValueStack();

    portletContext = new MockPortletContext();
    renderRequest = new MockRenderRequest();
    renderRequest.setAttribute(ServletActionContext.STRUTS_VALUESTACK_KEY, stack);
    renderUrl = new MockPortletUrl("render");
    actionUrl = new MockPortletUrl("action");
    renderResponse = new MockRenderResponse() {
View Full Code Here

    mockInvocation.stubs().method("getStack").will(returnValue(stack));

  }

  public void testParseConfigWithBang() {
    MockPortletContext portletContext = new MockPortletContext();
    MockPortletConfig portletConfig = new MockPortletConfig(portletContext);

    portletConfig.addInitParameter("viewNamespace", "/view");
    portletConfig.addInitParameter("defaultViewAction", "index!input");
View Full Code Here

  private PortletServletRequest request;
 
  protected void setUp() throws Exception {
    super.setUp();
    portletRequest = new MockPortletRequest();
    portletContext = new MockPortletContext();
    request = new PortletServletRequest(portletRequest, portletContext);
  }
View Full Code Here

  ValueStack stack;

  public void setUp() throws Exception {
    super.setUp();
    renderer = new PortletUrlRenderer();
    context = new MockPortletContext();
    renderUrl = new MockPortletURL(
        new MockPortalContext(), "render");
    actionUrl = new MockPortletURL(
        new MockPortalContext(), "action");
    request = new MockRenderRequest();
View Full Code Here

        mockInvocation.stubs().method("getStack").will(returnValue(stack));

    }
   
    public void testParseConfigWithBang() {
      MockPortletContext portletContext = new MockPortletContext();
      MockPortletConfig portletConfig = new MockPortletConfig(portletContext);

      portletConfig.addInitParameter("viewNamespace", "/view");
      portletConfig.addInitParameter("defaultViewAction", "index!input");
     
View Full Code Here

        super.setUp();

        ActionProxy actionProxy = getActionProxy("/portlettest/test"); // creates new empty ActionContext
        ActionContext.getContext().put(ActionContext.ACTION_INVOCATION, actionProxy.getInvocation());

        PortletContext portletCtx = new MockPortletContext();
        ActionContext.getContext().put(StrutsStatics.STRUTS_PORTLET_CONTEXT, portletCtx);
        ActionContext.getContext().put(PortletConstants.REQUEST, new MockPortletRequest(portletCtx));
        ActionContext.getContext().put(PortletConstants.RESPONSE, new MockMimeResponse());
        ActionContext.getContext().put(PortletConstants.MODE_NAMESPACE_MAP, Collections.emptyMap());
View Full Code Here

    registerSingleton("portletMultipartResolver", MockMultipartResolver.class);
    registerSingleton("portletPostProcessor", SimplePortletPostProcessor.class);
    registerSingleton("testListener", TestApplicationListener.class);

    ConstructorArgumentValues cvs = new ConstructorArgumentValues();
    cvs.addIndexedArgumentValue(0, new MockPortletContext());
    cvs.addIndexedArgumentValue(1, "complex");
    registerBeanDefinition("portletConfig", new RootBeanDefinition(MockPortletConfig.class, cvs, null));

    UserRoleAuthorizationInterceptor userRoleInterceptor = new UserRoleAuthorizationInterceptor();
    userRoleInterceptor.setAuthorizedRoles(new String[] {"role1", "role2"});
View Full Code Here

* @author Mark Fisher
*/
public class PortletContextAwareProcessorTests extends TestCase {

  public void testPortletContextAwareWithPortletContext() {
    PortletContext portletContext = new MockPortletContext();
    PortletContextAwareProcessor processor = new PortletContextAwareProcessor(portletContext);
    PortletContextAwareBean bean = new PortletContextAwareBean();
    assertNull(bean.getPortletContext());
    processor.postProcessBeforeInitialization(bean, "testBean");
    assertNotNull("PortletContext should have been set", bean.getPortletContext());
View Full Code Here

    assertNotNull("PortletContext should have been set", bean.getPortletContext());
    assertEquals(portletContext, bean.getPortletContext());
  }

  public void testPortletContextAwareWithPortletConfig() {
    PortletContext portletContext = new MockPortletContext();
    PortletConfig portletConfig = new MockPortletConfig(portletContext);
    PortletContextAwareProcessor processor = new PortletContextAwareProcessor(portletConfig);
    PortletContextAwareBean bean = new PortletContextAwareBean();
    assertNull(bean.getPortletContext());
    processor.postProcessBeforeInitialization(bean, "testBean");
View Full Code Here

TOP

Related Classes of org.springframework.mock.web.portlet.MockPortletContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.