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

Gavin King gavin.king at jboss.com
Thu Oct 26 13:42:24 EDT 2006


  User: gavin   
  Date: 06/10/26 13:42:24

  Modified:    src/main/org/jboss/seam/mock   MockApplication.java
                        MockFacesContext.java
  Log:
  EL in test harness
  
  Revision  Changes    Path
  1.7       +16 -7     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.6
  retrieving revision 1.7
  diff -u -b -r1.6 -r1.7
  --- MockApplication.java	19 Apr 2006 22:20:53 -0000	1.6
  +++ MockApplication.java	26 Oct 2006 17:42:24 -0000	1.7
  @@ -1,5 +1,8 @@
   package org.jboss.seam.mock;
   
  +import static org.jboss.seam.util.EL.EL_CONTEXT;
  +import static org.jboss.seam.util.EL.EXPRESSION_FACTORY;
  +
   import java.math.BigDecimal;
   import java.math.BigInteger;
   import java.util.Collection;
  @@ -9,6 +12,8 @@
   import java.util.Locale;
   import java.util.Map;
   
  +import javax.el.MethodExpression;
  +import javax.el.ValueExpression;
   import javax.faces.FacesException;
   import javax.faces.application.Application;
   import javax.faces.application.NavigationHandler;
  @@ -217,10 +222,12 @@
      }
   
      @Override
  -   public MethodBinding createMethodBinding(final String methodExpression, Class[] args)
  +   public MethodBinding createMethodBinding(final String methodExpression, final Class[] args)
            throws ReferenceSyntaxException {
         return new MethodBinding() {
   
  +         private MethodExpression me = EXPRESSION_FACTORY.createMethodExpression(EL_CONTEXT, methodExpression, Object.class, args);
  +
            @Override
            public String getExpressionString()
            {
  @@ -230,13 +237,13 @@
            @Override
            public Class getType(FacesContext ctx) throws MethodNotFoundException
            {
  -            throw new UnsupportedOperationException();
  +            return me.getMethodInfo(EL_CONTEXT).getReturnType();
            }
   
            @Override
            public Object invoke(FacesContext ctx, Object[] args) throws EvaluationException, MethodNotFoundException
            {
  -            return null; //TODO: big big todo!!
  +            return me.invoke(EL_CONTEXT, args);
            }
            
         };
  @@ -272,6 +279,8 @@
            throws ReferenceSyntaxException {
         return new ValueBinding() {
   
  +         private ValueExpression ve = EXPRESSION_FACTORY.createValueExpression(EL_CONTEXT, valueExpression, Object.class);
  +
      		@Override
            public String getExpressionString()
            {
  @@ -280,22 +289,22 @@
   
            @Override
      		public Class getType(FacesContext ctx) throws EvaluationException, PropertyNotFoundException {
  -            throw new UnsupportedOperationException();
  +            return ve.getType(EL_CONTEXT);
      		}
      
      		@Override
      		public Object getValue(FacesContext ctx) throws EvaluationException, PropertyNotFoundException {
  -   			return valueExpression; //TODO: big todo!
  +   			return ve.getValue(EL_CONTEXT);
      		}
      
      		@Override
      		public boolean isReadOnly(FacesContext ctx) throws EvaluationException, PropertyNotFoundException {
  -   			return false;
  +   			return ve.isReadOnly(EL_CONTEXT);
      		}
      
      		@Override
      		public void setValue(FacesContext ctx, Object value) throws EvaluationException, PropertyNotFoundException {
  -            //TODO: big todo!
  +            ve.setValue(EL_CONTEXT, value);
      		}
       	  
         };
  
  
  
  1.10      +9 -2      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.9
  retrieving revision 1.10
  diff -u -b -r1.9 -r1.10
  --- MockFacesContext.java	25 Oct 2006 23:29:14 -0000	1.9
  +++ MockFacesContext.java	26 Oct 2006 17:42:24 -0000	1.10
  @@ -25,7 +25,7 @@
   /**
    * @author Gavin King
    * @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
  - * @version $Revision: 1.9 $
  + * @version $Revision: 1.10 $
    */
   public class MockFacesContext extends FacesContext
   {
  @@ -173,9 +173,16 @@
         responseComplete = true;
      }
      
  -   public void setCurrent()
  +   public MockFacesContext setCurrent()
      {
         setCurrentInstance(this);
  +      return this;
  +   }
  +   
  +   public MockFacesContext createViewRoot()
  +   {
  +      viewRoot = new UIViewRoot();
  +      return this;
      }
   
   }
  
  
  



More information about the jboss-cvs-commits mailing list