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.

Thanks...

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
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to