Examples of MockActionRequest


Examples of org.jboss.portletbridge.MockActionRequest

     * @see org.ajax4jsf.tests.AbstractAjax4JsfTestCase#setUp()
     */
    public void setUp() throws Exception {
   super.setUp();
   portletContext=new MockPortletContext(servletContext);
   portletRequest = new MockActionRequest(portletContext);
   portletResponse = new MockActionResponse();
   PortletStateHolder portletStateHolder = PortletStateHolder.init(new MockPortletContext(servletContext));
   PortletWindowState portletState = new PortletWindowState(){

  @Override
View Full Code Here

Examples of org.jboss.portletbridge.MockActionRequest

         * {@link org.jboss.portletbridge.context.FacesContextFactoryImpl#getFacesContext(java.lang.Object, java.lang.Object, java.lang.Object, javax.faces.lifecycle.Lifecycle)}.
         */
    public void testGetFacesContextPortlet() {
   FacesContextFactoryImpl factory = new FacesContextFactoryImpl(facesContextFactory);
   MockPortletContext portletContext = new MockPortletContext(servletContext);
   MockActionRequest portletRequest = new MockActionRequest(portletContext);
   MockActionResponse portletResponse = new MockActionResponse();
   PortletStateHolder portletStateHolder = PortletStateHolder.init(new MockPortletContext(servletContext));
   PortletWindowState portletState = new PortletWindowState(){

  @Override
  public BridgeConfig getBridgeConfig() {
    return new BridgeConfig(){

      public Map<String, String> getDefaultViewIdMap() {
        HashMap<String, String> viewIdMap = new HashMap<String,String>();
        viewIdMap.put("view", "/foo.xhtml");
        return viewIdMap;
      }

      public Set<ExcludedRequestAttribute> getExcludedAttributes() {
        // TODO Auto-generated method stub
        return null;
      }

      public List<String> getFacesServletMappings() {
        // TODO Auto-generated method stub
        return null;
      }

      public String getInitParameter(String name) {
        // TODO Auto-generated method stub
        return null;
      }

      public PortletConfig getPortletConfig() {
        // TODO Auto-generated method stub
        return null;
      }

      public String getPortletName() {
        // TODO Auto-generated method stub
        return null;
      }

      public boolean isPreserveActionParams() {
        // TODO Auto-generated method stub
        return false;
      }

      public Map<Class<? extends Throwable>, String> getErrorPages() {
        // TODO Auto-generated method stub
        return null;
      }

         public Lifecycle getFacesLifecycle() {
            return null;
         }

      };
  }
    
   };
   portletStateHolder.addWindowState(STATE_ID, portletState);
   PortletBridgeContext bridgeContext = portletState.createBridgeContext();
   portletRequest.setAttribute(PortletBridgeContext.REQUEST_PARAMETER_NAME, bridgeContext);
   FacesContext context = factory.getFacesContext(portletContext,
      portletRequest, portletResponse, lifecycle);
   assertTrue((context instanceof FacesContextImpl));
   assertTrue((context.getExternalContext() instanceof AbstractExternalContext));
   assertSame(FacesContext.getCurrentInstance(),context);
View Full Code Here

Examples of org.jboss.portletbridge.MockActionRequest

         * {@link org.jboss.portletbridge.context.FacesContextFactoryImpl#getFacesContext(java.lang.Object, java.lang.Object, java.lang.Object, javax.faces.lifecycle.Lifecycle)}.
         */
    public void testGetFacesContextPortlet() {
   FacesContextFactoryImpl factory = new FacesContextFactoryImpl(facesContextFactory);
   MockPortletContext portletContext = new MockPortletContext(servletContext);
   MockActionRequest portletRequest = new MockActionRequest(portletContext);
   MockActionResponse portletResponse = new MockActionResponse();
   RequestScopeManager portletStateHolder = RequestScopeManager.getInstance(facesContext);
   BridgeRequestScope portletState = new BridgeRequestScope();
   portletStateHolder.saveRequestScope(STATE_ID, portletState);
   PortletBridgeContext bridgeContext = new PortletBridgeContext(getBridgeConfig());
   portletRequest.setAttribute(PortletBridgeContext.REQUEST_PARAMETER_NAME, bridgeContext);
   portletRequest.setAttribute(Bridge.PORTLET_LIFECYCLE_PHASE, Bridge.PortletPhase.ACTION_PHASE);
   FacesContext context = factory.getFacesContext(portletContext,
      portletRequest, portletResponse, lifecycle);
   assertTrue((context instanceof FacesContextImpl));
   assertTrue((context.getExternalContext() instanceof AbstractExternalContext));
   assertSame(FacesContext.getCurrentInstance(),context);
View Full Code Here

Examples of org.jboss.portletbridge.MockActionRequest

     * @see org.ajax4jsf.tests.AbstractAjax4JsfTestCase#setUp()
     */
    public void setUp() throws Exception {
   super.setUp();
   portletContext=new MockPortletContext(servletContext);
   portletRequest = new MockActionRequest(portletContext);
   portletResponse = new MockActionResponse();
   RequestScopeManager portletStateHolder = RequestScopeManager.getInstance(facesContext);
   BridgeRequestScope portletState = new BridgeRequestScope(){
    
   };
View Full Code Here

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

    controller.setApplicationContext(new StaticWebApplicationContext());
    portletContext = new MockPortletContext();
    controller.setPortletContext(portletContext);
    controller.afterPropertiesSet();

    actionRequest = new MockActionRequest();
    actionResponse = new MockActionResponse();
    renderRequest = new MockRenderRequest();
    renderResponse = new MockRenderResponse();
    actionContext = new PortletExternalContext(portletContext, actionRequest, actionResponse, controller
        .getFlowUrlHandler());
View Full Code Here

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

  private PortletExternalContext renderContext;

  protected void setUp() {
    portletContext = new MockPortletContext();
    request = new MockActionRequest();
    response = new MockActionResponse();
    context = new PortletExternalContext(portletContext, request, response);
    renderRequest = new MockRenderRequest();
    renderResponse = new MockRenderResponse();
    renderContext = new PortletExternalContext(portletContext, renderRequest, renderResponse);
View Full Code Here

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

                   scriptPortlet.getScriptSourceLastEvaluated() > scriptSourceLastEvaluated);
    }
   
    public void testProcessAction() throws Exception
    {
        MockActionRequest request = new MockActionRequest(portletContext);
        MockPortletPreferences preferences = new MockPortletPreferences();
       
        if (scriptPortlet.getValidatorInstance() != null)
        {
            preferences.setPreferencesValidator(scriptPortlet.getValidatorInstance());
        }
       
        request.setPreferences(preferences);
        request.addLocale(Locale.ENGLISH);
       
        MockActionResponse response = new MockActionResponse();
       
        try
        {
            scriptPortlet.processAction(request, response);
            fail("Validator exception should occur here!!!");
        }
        catch (Exception e)
        {
            // expected ...
        }
       
        request.addParameter("message", "hello");
       
        scriptPortlet.processAction(request, response);
    }
View Full Code Here

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

    assertEquals("Expiration-cache should be set to 30 seconds", "30", cacheProperty);
  }
 
  public void testActionRequest() throws Exception {
    TestController tc = new TestController();
    MockActionRequest request = new MockActionRequest();
    MockActionResponse response = new MockActionResponse();
    tc.handleActionRequest(request, response);
    TestBean command = (TestBean)request.getPortletSession().getAttribute(tc.getRenderCommandSessionAttributeName());
    assertTrue(command.isJedi());
  }
View Full Code Here

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

      }
    }.runTest();
  }

  public void testPassAllParametersToRenderPhase() throws Exception {
    MockActionRequest request = new MockActionRequest();
    request.setParameter("William", "Baskerville");
    request.setParameter("Adso", "Melk");
    MockActionResponse response = new MockActionResponse();
    PortletUtils.passAllParametersToRenderPhase(request, response);
    assertEquals("The render parameters map is obviously not being populated with the request parameters.",
        request.getParameterMap().size(), response.getRenderParameterMap().size());
  }
View Full Code Here

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

      }
    }.runTest();
  }

  public void testPassAllParametersToRenderPhaseDoesNotPropagateExceptionIfRedirectAlreadySentAtTimeOfCall() throws Exception {
    MockActionRequest request = new MockActionRequest();
    request.setParameter("William", "Baskerville");
    request.setParameter("Adso", "Melk");
    MockActionResponse response = new MockActionResponse() {
      public void setRenderParameter(String key, String[] values) {
        throw new IllegalStateException();
      }
    };
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.