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

Gavin King gavin.king at jboss.com
Wed Oct 25 17:40:46 EDT 2006


  User: gavin   
  Date: 06/10/25 17:40:46

  Modified:    src/main/org/jboss/seam/mock  SeamTest.java
  Log:
  fix bug with pageflows
  
  Revision  Changes    Path
  1.44      +18 -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.43
  retrieving revision 1.44
  diff -u -b -r1.43 -r1.44
  --- SeamTest.java	18 Oct 2006 18:48:07 -0000	1.43
  +++ SeamTest.java	25 Oct 2006 21:40:46 -0000	1.44
  @@ -40,7 +40,7 @@
    * 
    * @author Gavin King
    * @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
  - * @version $Revision: 1.43 $
  + * @version $Revision: 1.44 $
    */
   public class SeamTest
   {
  @@ -51,7 +51,7 @@
      private SeamPhaseListener phases;
      private MockFacesContext facesContext;
      private MockHttpSession session;
  -   private Map<String, ConversationState> conversationStates;
  +   private Map<String, Map> conversationViewRootAttributes;
      
      protected HttpSession getSession()
      {
  @@ -101,6 +101,11 @@
            return false;
         }
         
  +      /**
  +       * The JSF view id of the form that is being submitted
  +       * (override if you need page actions to be called,
  +       * and page parameters applied)
  +       */
         protected String getViewId()
         {
            return null;
  @@ -195,14 +200,12 @@
            externalContext = new MockExternalContext(servletContext, session);
            facesContext = new MockFacesContext( externalContext, application );
            facesContext.setCurrent();
  -         Map viewRootAttributes = facesContext.getViewRoot().getAttributes();
  -         
            if ( !isGetRequest() && conversationId!=null ) 
            {
  -            if ( conversationStates.containsKey(conversationId) )
  +            if ( conversationViewRootAttributes.containsKey(conversationId) )
               {
  -               Map state = conversationStates.get(conversationId).state;
  -               viewRootAttributes.putAll(state);
  +               Map state = conversationViewRootAttributes.get(conversationId);
  +               facesContext.getViewRoot().getAttributes().putAll(state);
               }
            }
                     
  @@ -281,12 +284,13 @@
               
            }
   
  -         if (viewRootAttributes!=null)
  +         Map attributes = facesContext.getViewRoot().getAttributes();
  +         if (attributes!=null)
            {
  -            conversationId = (String) viewRootAttributes.get(Manager.CONVERSATION_ID);
  -            ConversationState conversationState = new ConversationState();
  -            conversationState.state.putAll( viewRootAttributes );
  -            conversationStates.put(conversationId, conversationState);
  +            conversationId = (String) attributes.get(Manager.CONVERSATION_ID);
  +            Map conversationState = new HashMap();
  +            conversationState.putAll(attributes);
  +            conversationViewRootAttributes.put(conversationId, conversationState);
            }
   
            return conversationId;
  @@ -341,7 +345,7 @@
         new Initialization(servletContext).init();
         Lifecycle.setServletContext(servletContext);
   
  -      conversationStates = new HashMap<String, ConversationState>();
  +      conversationViewRootAttributes = new HashMap<String, Map>();
      }
   
      @Configuration(afterTestClass=true)
  @@ -349,8 +353,7 @@
      {
         Lifecycle.endApplication(servletContext);
         externalContext = null;
  -      conversationStates.clear();
  -      conversationStates = null;
  +      conversationViewRootAttributes = null;
      }
      
      /**
  @@ -358,11 +361,6 @@
       */
      public void initServletContext(Map initParams) {}
   
  -   private class ConversationState
  -   {
  -      Map state = new HashMap();
  -   }
  -   
      protected InitialContext getInitialContext() throws NamingException {
         return Naming.getInitialContext();
      }
  
  
  



More information about the jboss-cvs-commits mailing list