Package javax.faces.context

Examples of javax.faces.context.FacesContext


      Manager.instance().beginNestedConversation();
     
      assert Manager.instance().isLongRunningConversation();
      assert Manager.instance().isNestedConversation();
     
      FacesContext facesContext = FacesContext.getCurrentInstance();

      facesContext.getViewRoot().setViewId("/end-conversation-test.xhtml");
      Pages.instance().preRender(facesContext);
     
      // nested conversation should be demoted to temporary
      assert !Manager.instance().isLongRunningConversation();
      assert Manager.instance().isNestedConversation();
View Full Code Here


   public void testBeginAndEndRootConversation() {
      Manager.instance().beginConversation();
     
      assert Manager.instance().isLongRunningConversation();
     
      FacesContext facesContext = FacesContext.getCurrentInstance();

      facesContext.getViewRoot().setViewId("/end-root-conversation-test.xhtml");
      Pages.instance().preRender(facesContext);
     
      assert !Manager.instance().isLongRunningConversation();
   }
View Full Code Here

      assert !Manager.instance().getCurrentConversationId().equals(rootConversationId);
      assert Manager.instance().isLongRunningConversation();
      assert Manager.instance().isNestedConversation();
     
      FacesContext facesContext = FacesContext.getCurrentInstance();

      facesContext.getViewRoot().setViewId("/end-root-conversation-test.xhtml");
      Pages.instance().preRender(facesContext);

      assert Manager.instance().getCurrentConversationId().equals(rootConversationId);
      assert !Manager.instance().isLongRunningConversation();
      assert !Manager.instance().isNestedConversation();
View Full Code Here

   @Test
   public void testExpressionResolvedInFacesELContext()
   {
      Map<String, String> params = new HashMap<String, String>();
      params.put("foo", "bar");
      FacesContext facesContext = setupFacesContextToAccessRequestParams(params);
      String expr = "#{param.foo}";
     
      // the control
      assertEquals(facesContext.getApplication().evaluateExpressionGet(facesContext, expr, Object.class), "bar");
     
      // the test
      FacesLifecycle.setPhaseId(PhaseId.INVOKE_APPLICATION);
      Expressions expressions = new FacesExpressions();
      assert expressions.getELContext().getContext(FacesContext.class) != null;
View Full Code Here

         }
      }
      ExternalContext extContext = new MockExternalContext(request);
      Application application = new MockApplication();
      application.addELResolver(new ImplicitObjectELResolver());
      FacesContext facesCtx = new MockFacesContext(extContext, application).setCurrent();
      assert FacesContext.getCurrentInstance() != null;
      return facesCtx;
   }
View Full Code Here

         if (prop == null) throw new PropertyNotFoundException("No such property " + prop);

         int idx = Arrays.binarySearch(IMPLICIT_OBJECT_NAMES, prop);
         if (idx < 0) return null;
        
         FacesContext facesCtx = (FacesContext) elCtx.getContext(FacesContext.class);
         ExternalContext extCtx = facesCtx.getExternalContext();
        
         if (prop.equals(PARAM))
         {
            elCtx.setPropertyResolved(true);
            return extCtx.getRequestParameterMap();
View Full Code Here

    * two parts of the test are equivalent.
    */
   @Test(enabled = true)
   public void testShortCircuitOnNonNullOutcome()
   {
      FacesContext facesContext = FacesContext.getCurrentInstance();
      TestActions testActions = TestActions.instance();

      facesContext.getViewRoot().setViewId("/action-test01a.xhtml");
      Pages.instance().preRender(facesContext);
      assertViewId(facesContext, "/pageA.xhtml");
      assertActionCalls(testActions, new String[] { "nonNullActionA" });

      testActions = TestActions.instance();

      facesContext.getViewRoot().setViewId("/action-test01b.xhtml");
      Pages.instance().preRender(facesContext);
      assertViewId(facesContext, "/pageA.xhtml");
      assertActionCalls(testActions, new String[] { "nonNullActionA" });
   }
View Full Code Here

    * not called because of the navigation on the second action.
    */
   @Test(enabled = true)
   public void testShortCircuitInMiddle()
   {
      FacesContext facesContext = FacesContext.getCurrentInstance();
      TestActions testActions = TestActions.instance();

      facesContext.getViewRoot().setViewId("/action-test02.xhtml");
      Pages.instance().preRender(facesContext);
      assertViewId(facesContext, "/pageB.xhtml");
      assertActionCalls(testActions, new String[] { "nonNullActionA", "nonNullActionB" });
   }
View Full Code Here

    * a navigation rule is matched, not what the return value is.
    */
   @Test(enabled = true)
   public void testShortCircuitOnNullOutcome()
   {
      FacesContext facesContext = FacesContext.getCurrentInstance();
      TestActions testActions = TestActions.instance();

      facesContext.getViewRoot().setViewId("/action-test03.xhtml");
      Pages.instance().preRender(facesContext);
      assertViewId(facesContext, "/pageA.xhtml");
      assertActionCalls(testActions, new String[] { "nullActionA" });
   }
View Full Code Here

    * will short circuit the action calls.
    */
   @Test(enabled = true)
   public void testShortCircuitOnNonNullOutcomeToSamePage()
   {
      FacesContext facesContext = FacesContext.getCurrentInstance();
      TestActions testActions = TestActions.instance();

      facesContext.getViewRoot().setViewId("/action-test04.xhtml");
      Pages.instance().preRender(facesContext);
      assertViewId(facesContext, "/action-test04.xhtml");
      assertActionCalls(testActions, new String[] { "nullActionA", "nonNullActionB" });
   }
View Full Code Here

TOP

Related Classes of javax.faces.context.FacesContext

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.