Examples of FacesView


Examples of org.springframework.springfaces.mvc.servlet.view.FacesView

    assertIsWrappedFacesContext(this.facesContextCaptor.getValue());
  }

  @Test
  public void shouldRenderFacesView() throws Exception {
    FacesView view = mock(FacesView.class);
    given(view.getViewArtifact()).willReturn(new ViewArtifact("artifact"));
    Map<String, Object> model = new HashMap<String, Object>();
    Lifecycle lifecycle = mock(Lifecycle.class);
    given(this.lifecycleAccessor.getLifecycle()).willReturn(lifecycle);
    this.springFacesContext.render(view, model);
    verify(lifecycle).execute(this.facesContextCaptor.capture());
View Full Code Here

Examples of org.springframework.springfaces.mvc.servlet.view.FacesView

    assertThat(this.springFacesContext.getRendering(), is(nullValue()));
  }

  @Test
  public void shouldHaveRenderingWhenRendering() throws Exception {
    FacesView view = mock(FacesView.class);
    given(view.getViewArtifact()).willReturn(new ViewArtifact("artifact"));
    Map<String, Object> model = new HashMap<String, Object>();
    final ModelAndViewArtifact modelAndViewArtifact = new ModelAndViewArtifact("artifact", model);
    Lifecycle lifecycle = mock(Lifecycle.class);
    given(this.lifecycleAccessor.getLifecycle()).willReturn(lifecycle);
    willAnswer(new Answer<Object>() {
View Full Code Here

Examples of org.springframework.springfaces.mvc.servlet.view.FacesView

    assertThat(this.springFacesContext.getRendering(), is(nullValue()));
  }

  @Test
  public void shouldClearRenderingEvenOnException() throws Exception {
    FacesView view = mock(FacesView.class);
    given(view.getViewArtifact()).willReturn(new ViewArtifact("theartifact"));
    Map<String, Object> model = new HashMap<String, Object>();
    Lifecycle lifecycle = mock(Lifecycle.class);
    given(this.lifecycleAccessor.getLifecycle()).willReturn(lifecycle);
    willThrow(new IllegalStateException()).given(lifecycle).render((FacesContext) any());
    this.thrown.expect(IllegalStateException.class);
View Full Code Here

Examples of org.springframework.springfaces.mvc.servlet.view.FacesView

    this.springFacesContext.render(view, model);
  }

  @Test
  public void shouldSetViewRootIfDoubleRendering() throws Exception {
    FacesView view = mock(FacesView.class);
    given(view.getViewArtifact()).willReturn(new ViewArtifact("theartifact"));
    final Map<String, Object> model = new HashMap<String, Object>();

    Application application = mock(Application.class);
    ViewHandler viewHandler = mock(ViewHandler.class);
    final UIViewRoot newViewRoot = mock(UIViewRoot.class);
    given(this.facesContext.getApplication()).willReturn(application);
    given(application.getViewHandler()).willReturn(viewHandler);
    given(viewHandler.createView(any(FacesContext.class), eq("newartifact"))).willReturn(newViewRoot);

    Lifecycle lifecycle = mock(Lifecycle.class);
    given(this.lifecycleAccessor.getLifecycle()).willReturn(lifecycle);
    willAnswer(new Answer<Object>() {
      public Object answer(InvocationOnMock invocation) throws Throwable {
        FacesView view2 = mock(FacesView.class);
        given(view2.getViewArtifact()).willReturn(new ViewArtifact("newartifact"));
        DefaultSpringFacesContextTest.this.springFacesContext.render(view2, model);
        verify(DefaultSpringFacesContextTest.this.facesContext).setViewRoot(newViewRoot);
        return null;
      }
    }).given(lifecycle).render((FacesContext) any());
View Full Code Here

Examples of org.springframework.springfaces.mvc.servlet.view.FacesView

  }

  @RequestMapping("/requestmapping/modelandview")
  public ModelAndView modelAndView() {
    // You can also return a FacesView for complete control
    View view = new FacesView("/WEB-INF/pages/requestmapping/modelandview.xhtml");
    Map<String, ?> model = new HashMap<String, Object>();
    return new ModelAndView(view, model);
  }
View Full Code Here

Examples of org.springframework.springfaces.mvc.servlet.view.FacesView

  public ModelAndView handle(final HttpServletRequest request, HttpServletResponse response, final Object handler)
      throws Exception {
    Assert.state(supports(handler), "The specified handler is not supported");
    ViewArtifact viewArtifact = ((Postback) handler).getViewArtifact();
    SpringFacesContext.getCurrentInstance(true).render(new FacesView(viewArtifact), null);
    return null;
  }
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.