[jboss-cvs] jboss-seam/src/main/org/jboss/seam/mock ...

Gavin King gavin.king at jboss.com
Wed Oct 18 14:48:07 EDT 2006


  User: gavin   
  Date: 06/10/18 14:48:07

  Modified:    src/main/org/jboss/seam/mock  SeamTest.java
  Log:
  improve seamtest lifecycle
  
  Revision  Changes    Path
  1.43      +43 -20    jboss-seam/src/main/org/jboss/seam/mock/SeamTest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: SeamTest.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/mock/SeamTest.java,v
  retrieving revision 1.42
  retrieving revision 1.43
  diff -u -b -r1.42 -r1.43
  --- SeamTest.java	18 Oct 2006 18:32:08 -0000	1.42
  +++ SeamTest.java	18 Oct 2006 18:48:07 -0000	1.43
  @@ -40,7 +40,7 @@
    * 
    * @author Gavin King
    * @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
  - * @version $Revision: 1.42 $
  + * @version $Revision: 1.43 $
    */
   public class SeamTest
   {
  @@ -213,7 +213,7 @@
            phases.beforePhase( new PhaseEvent(facesContext, PhaseId.RESTORE_VIEW, MockLifecycle.INSTANCE) );
            phases.afterPhase( new PhaseEvent(facesContext, PhaseId.RESTORE_VIEW, MockLifecycle.INSTANCE) );
   
  -         if ( !isGetRequest() )
  +         if ( !isGetRequest() && !skipToRender() )
            {
            
               phases.beforePhase( new PhaseEvent(facesContext, PhaseId.APPLY_REQUEST_VALUES, MockLifecycle.INSTANCE) );
  @@ -221,13 +221,17 @@
               applyRequestValues();
         
               phases.afterPhase( new PhaseEvent(facesContext, PhaseId.APPLY_REQUEST_VALUES, MockLifecycle.INSTANCE) );
  +            
  +            if ( !skipToRender() )
  +            {
  +            
               phases.beforePhase( new PhaseEvent(facesContext, PhaseId.PROCESS_VALIDATIONS, MockLifecycle.INSTANCE) );
               
               processValidations();
               
               phases.afterPhase( new PhaseEvent(facesContext, PhaseId.PROCESS_VALIDATIONS, MockLifecycle.INSTANCE) );
   
  -            if ( !FacesContext.getCurrentInstance().getRenderResponse() )
  +               if ( !skipToRender() )
               {
            
                  phases.beforePhase( new PhaseEvent(facesContext, PhaseId.UPDATE_MODEL_VALUES, MockLifecycle.INSTANCE) );
  @@ -235,6 +239,10 @@
                  updateModelValues();
            
                  phases.afterPhase( new PhaseEvent(facesContext, PhaseId.UPDATE_MODEL_VALUES, MockLifecycle.INSTANCE) );
  +   
  +                  if ( !skipToRender() )
  +                  {
  +               
                  phases.beforePhase( new PhaseEvent(facesContext, PhaseId.INVOKE_APPLICATION, MockLifecycle.INSTANCE) );
                  
                  invokeApplication();
  @@ -248,7 +256,11 @@
               
            }
            
  -         if ( !FacesContext.getCurrentInstance().getResponseComplete() )
  +            }
  +            
  +         }
  +         
  +         if ( !skipRender() )
            {
            
               phases.beforePhase( new PhaseEvent(facesContext, PhaseId.RENDER_RESPONSE, MockLifecycle.INSTANCE) );
  @@ -280,6 +292,17 @@
            return conversationId;
         }
         
  +      private boolean skipRender()
  +      {
  +         return FacesContext.getCurrentInstance().getResponseComplete();
  +      }
  +
  +      protected boolean skipToRender()
  +      {
  +         return FacesContext.getCurrentInstance().getRenderResponse() || 
  +               FacesContext.getCurrentInstance().getResponseComplete();
  +      }
  +      
      }
      
      @Configuration(beforeTestMethod=true)
  
  
  



More information about the jboss-cvs-commits mailing list