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

Peter Muir peter at bleepbleep.org.uk
Sat May 5 12:43:01 EDT 2007


  User: pmuir   
  Date: 07/05/05 12:43:01

  Modified:    src/main/org/jboss/seam/mock   MockFacesContext.java
                        MockApplication.java
  Log:
  Mock context methods for JSF 1.2 (JBSEAM-1278)
  
  Revision  Changes    Path
  1.15      +6 -28     jboss-seam/src/main/org/jboss/seam/mock/MockFacesContext.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: MockFacesContext.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/mock/MockFacesContext.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -b -r1.14 -r1.15
  --- MockFacesContext.java	11 Mar 2007 15:30:37 -0000	1.14
  +++ MockFacesContext.java	5 May 2007 16:43:01 -0000	1.15
  @@ -27,16 +27,18 @@
   import javax.faces.render.RenderKit;
   import javax.faces.render.RenderKitFactory;
   
  +import org.jboss.seam.util.EL;
  +
  +import com.sun.faces.el.ELContextImpl;
  +
   /**
    * @author Gavin King
    * @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
  - * @version $Revision: 1.14 $
  + * @version $Revision: 1.15 $
    */
   public class MockFacesContext extends FacesContext
   {
   
  -   private static final String JSF_12_ELCONTEXT = "com.sun.faces.el.ELContextImpl";
  -
      private UIViewRoot viewRoot;// = new UIViewRoot();
   
      private Map<FacesMessage, String> messages = new HashMap<FacesMessage, String>();
  @@ -221,33 +223,9 @@
         return this;
      }
   
  -   /**
  -    * @since 1.2
  -    */
  -   // This probably only works for the RI.
      public ELContext getELContext()
      {
  -      if (elContext == null)
  -      {
  -         try
  -         {
  -            Class elContextClass = FacesContext.class.forName(JSF_12_ELCONTEXT);
  -            Constructor<ELContext> constructor = elContextClass.getConstructor(ELResolver.class);
  -            Method m = getApplication().getClass().getMethod("getELResolver", new Class[0]);
  -            elContext = constructor.newInstance(m.invoke(getApplication(), new Object[0]));
  -            elContext.putContext(FacesContext.class, this);
  -            UIViewRoot root = this.getViewRoot();
  -            if (null != root)
  -            {
  -               elContext.setLocale(root.getLocale());
  -            }
  -         }
  -         catch (Exception e)
  -         {
  -            throw new UnsupportedOperationException();
  -         }
  -      }
  -      return elContext;
  +      return EL.EL_CONTEXT;
      }
   
   }
  
  
  
  1.12      +9 -2      jboss-seam/src/main/org/jboss/seam/mock/MockApplication.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: MockApplication.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/mock/MockApplication.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -b -r1.11 -r1.12
  --- MockApplication.java	27 Apr 2007 22:02:23 -0000	1.11
  +++ MockApplication.java	5 May 2007 16:43:01 -0000	1.12
  @@ -9,6 +9,7 @@
   import java.util.Locale;
   import java.util.Map;
   
  +import javax.el.ExpressionFactory;
   import javax.faces.FacesException;
   import javax.faces.application.Application;
   import javax.faces.application.NavigationHandler;
  @@ -35,8 +36,9 @@
   import javax.faces.event.ActionListener;
   import javax.faces.validator.Validator;
   
  -import org.jboss.seam.util.UnifiedELMethodBinding;
  +import org.jboss.seam.util.EL;
   import org.jboss.seam.util.Reflections;
  +import org.jboss.seam.util.UnifiedELMethodBinding;
   import org.jboss.seam.util.UnifiedELValueBinding;
   
   public class MockApplication extends Application
  @@ -313,4 +315,9 @@
         return new UnifiedELValueBinding(valueExpression);
      }
   
  +   public ExpressionFactory getExpressionFactory()
  +   {
  +      return EL.EXPRESSION_FACTORY;
  +   }
  +   
   }
  
  
  



More information about the jboss-cvs-commits mailing list