[jboss-user] [JBoss Seam] - Does SeamTest.invokeMethod work with parameters in your EL e

costeen21 do-not-reply at jboss.com
Tue Jan 2 14:54:25 EST 2007

I'm trying to write a test that uses the invokeMethod function with a parameter passed into it.  Similiar to the following:

String id = new FacesRequest("/myPage.xhtml")
  | {
  | @Override @SuppressWarnings("deprecation")
  |    protected void updateModelValues() throws Exception
  |    {
  |       setValue("#{myBean}", myBean);
  |    }
  |    @Override
  |    protected void invokeApplication()
  |    {
  |       assert invokeMethod("#{myAction.myMethod(myBean)}")=="Success";
  |    }      
  | }.run();

Should this work?  I see that SeamTest.invokeMethod makes the following call (notice args is set to null) :

  |       protected Object invokeMethod(String methodExpression)
  |       {
  |          return application.createMethodBinding(methodExpression, null).invoke(facesContext, null);
  |       }

MockApplication.createMethodBinding then makes the following call:

  |    @Override
  |    public MethodBinding createMethodBinding(final String methodExpression, final Class[] args)
  |          throws ReferenceSyntaxException {
  |       return new UnifiedELMethodBinding(methodExpression, args);
  |    }

Then UnifiedELMethodBinding calls

  |    public UnifiedELMethodBinding(String expression, Class[] args)
  |    {
  |       me = EXPRESSION_FACTORY.createMethodExpression(EL_CONTEXT, expression, Object.class, args);
  |    }

EXPRESSION_FACTORY is set to com.sun.el.ExpressionFactoryImpl which does not seem to be available with a simple Google search...(I'm still looking for it).

So, invokeMethod is calling createMethodBinding with args set to null.  At this point should the parameters be parsed out and passed into createMethodBinding in args or will com.sun.el.ExpressionFactoryImpl parsed the expression properly.

I don't think SeamExpressionFactory is being used.  If it was...it looks from the code like this would work.


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3997350#3997350

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3997350

More information about the jboss-user mailing list