Package org.apache.shale.test.mock

Examples of org.apache.shale.test.mock.MockExternalContext


        FactoryFinder.releaseFactories();
        FactoryFinder.setFactory("javax.faces.application.ApplicationFactory", "org.apache.shale.test.mock.MockApplicationFactory");
        FactoryFinder.setFactory("javax.faces.context.FacesContextFactory", "org.apache.shale.test.mock.MockFacesContextFactory");
        FactoryFinder.setFactory("javax.faces.lifecycle.LifecycleFactory", "org.apache.shale.test.mock.MockLifecycleFactory");
        FactoryFinder.setFactory("javax.faces.render.RenderKitFactory", "org.apache.shale.test.mock.MockRenderKitFactory");
        externalContext = new MockExternalContext(servletContext, request, response);
        lifecycleFactory = (MockLifecycleFactory)FactoryFinder.getFactory("javax.faces.lifecycle.LifecycleFactory");
        lifecycle = (MockLifecycle)lifecycleFactory.getLifecycle("DEFAULT");
        facesContextFactory = (MockFacesContextFactory)FactoryFinder.getFactory("javax.faces.context.FacesContextFactory");
        facesContext = (MockFacesContext)facesContextFactory.getFacesContext(servletContext, request, response, lifecycle);
        externalContext = (MockExternalContext)facesContext.getExternalContext();
View Full Code Here


        FactoryFinder.setFactory(FactoryFinder.LIFECYCLE_FACTORY,
                "org.apache.shale.test.mock.MockLifecycleFactory");
        FactoryFinder.setFactory(FactoryFinder.RENDER_KIT_FACTORY,
                "org.apache.shale.test.mock.MockRenderKitFactory");

        externalContext = new MockExternalContext(servletContext, request, response);
        lifecycleFactory = (MockLifecycleFactory) FactoryFinder.getFactory(FactoryFinder.LIFECYCLE_FACTORY);
        lifecycle = (MockLifecycle) lifecycleFactory.getLifecycle(LifecycleFactory.DEFAULT_LIFECYCLE);
        facesContextFactory = (MockFacesContextFactory) FactoryFinder.getFactory(FactoryFinder.FACES_CONTEXT_FACTORY);
        facesContext = (MockFacesContext)
                facesContextFactory.getFacesContext(servletContext, request, response, lifecycle);
View Full Code Here

        "org.apache.shale.test.mock.MockLifecycleFactory");
        FactoryFinder.setFactory(FactoryFinder.RENDER_KIT_FACTORY,
        "org.apache.shale.test.mock.MockRenderKitFactory");

        externalContext =
            new MockExternalContext(servletContext, request, response);
        lifecycleFactory = (MockLifecycleFactory)
        FactoryFinder.getFactory(FactoryFinder.LIFECYCLE_FACTORY);
        lifecycle = (MockLifecycle)
        lifecycleFactory.getLifecycle(LifecycleFactory.DEFAULT_LIFECYCLE);
        facesContextFactory = (MockFacesContextFactory)
View Full Code Here

    if (FacesContext.getCurrentInstance() != null
        && FacesContext.getCurrentInstance() instanceof MockBaseFacesContext) {
      return FacesContext.getCurrentInstance();
    } else {

      ExternalContext ext = new MockExternalContext((ServletContext) context, (HttpServletRequest) request,
          (HttpServletResponse) response);

      return new MockBaseFacesContext(ext, lifecycle);
    }
  }
View Full Code Here

          .setFactory(FactoryFinder.LIFECYCLE_FACTORY, "org.apache.shale.test.mock.MockLifecycleFactory");
      FactoryFinder.setFactory(FactoryFinder.RENDER_KIT_FACTORY,
          "org.apache.shale.test.mock.MockRenderKitFactory");

      application = new MockApplication();
      externalContext = new MockExternalContext(servletContext, request, response);
      lifecycleFactory = (MockLifecycleFactory) FactoryFinder.getFactory(FactoryFinder.LIFECYCLE_FACTORY);
      lifecycle = (MockLifecycle) lifecycleFactory.getLifecycle(LifecycleFactory.DEFAULT_LIFECYCLE);
      facesContextFactory = (FacesContextFactory) FactoryFinder.getFactory(FactoryFinder.FACES_CONTEXT_FACTORY);
      facesContext = facesContextFactory.getFacesContext(servletContext, request, response, lifecycle);
      externalContext = (MockExternalContext) facesContext.getExternalContext();
View Full Code Here

        FactoryFinder.setFactory(FactoryFinder.LIFECYCLE_FACTORY,
                "org.apache.shale.test.mock.MockLifecycleFactory");
        FactoryFinder.setFactory(FactoryFinder.RENDER_KIT_FACTORY,
                "org.apache.shale.test.mock.MockRenderKitFactory");

        externalContext = new MockExternalContext(servletContext, request, response);
        lifecycleFactory = (MockLifecycleFactory) FactoryFinder.getFactory(FactoryFinder.LIFECYCLE_FACTORY);
        lifecycle = (MockLifecycle) lifecycleFactory.getLifecycle(LifecycleFactory.DEFAULT_LIFECYCLE);
        facesContextFactory = (MockFacesContextFactory) FactoryFinder.getFactory(FactoryFinder.FACES_CONTEXT_FACTORY);
        facesContext = (MockFacesContext)
                facesContextFactory.getFacesContext(servletContext, request, response, lifecycle);
View Full Code Here

        FactoryFinder.setFactory(FactoryFinder.LIFECYCLE_FACTORY,
                "org.apache.shale.test.mock.MockLifecycleFactory");
        FactoryFinder.setFactory(FactoryFinder.RENDER_KIT_FACTORY,
                "org.apache.shale.test.mock.MockRenderKitFactory");

        externalContext = new MockExternalContext(servletContext, request,
                response);
        lifecycleFactory = (MockLifecycleFactory) FactoryFinder
                .getFactory(FactoryFinder.LIFECYCLE_FACTORY);
        lifecycle = (MockLifecycle) lifecycleFactory
                .getLifecycle(LifecycleFactory.DEFAULT_LIFECYCLE);
View Full Code Here

        response = new MockHttpServletResponse();

        setupFactories();
       
        externalContext =
            new MockExternalContext(servletContext, request, response);
        lifecycleFactory = (MockLifecycleFactory)
        FactoryFinder.getFactory(FactoryFinder.LIFECYCLE_FACTORY);
        lifecycle = (MockLifecycle)
        lifecycleFactory.getLifecycle(LifecycleFactory.DEFAULT_LIFECYCLE);
        facesContextFactory = (MockFacesContextFactory)
View Full Code Here

  /**
   * Test method for {@link org.richfaces.renderkit.html.SelectionRendererContributor#decode(javax.faces.context.FacesContext, javax.faces.component.UIComponent, org.richfaces.renderkit.CompositeRenderer)}.
   */
  public void testDecode() {
    MockExternalContext mockExternalContext =
      (MockExternalContext) facesContext.getExternalContext();
    String name =
      SelectionRendererContributor.getSelectionInputName(facesContext, (UIScrollableDataTable) component);
   
    String value = "";
   
    mockExternalContext.addRequestParameterMap(name, value);
   
    contributor.decode(facesContext, component, renderer);
   
    Object selection = component.getSelection();
   
View Full Code Here

        applicationContext);
    MockHttpServletRequest request = new MockHttpServletRequest(
        servletContext);
    MockHttpServletResponse response = new MockHttpServletResponse();

    ExternalContext externalContext = new MockExternalContext(
        servletContext, request, response);
    externalContext.getApplicationMap().put(
        WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE,
        applicationContext);
    FacesContext facesContext = new MockFacesContext(externalContext);
    MockFacesContext.setCurrentInstance(facesContext);
  }
View Full Code Here

TOP

Related Classes of org.apache.shale.test.mock.MockExternalContext

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.