SWF-301 - Make JSF managed beans accessible inside a flow definition using EL expressions.

This commit is contained in:
Jeremy Grelle
2008-04-22 20:45:22 +00:00
parent 84a43f2f26
commit cffd1889a5
2 changed files with 80 additions and 21 deletions

View File

@@ -0,0 +1,37 @@
package org.springframework.faces.webflow;
import junit.framework.TestCase;
import org.jboss.el.ExpressionFactoryImpl;
import org.springframework.binding.expression.Expression;
import org.springframework.binding.expression.ExpressionParser;
import org.springframework.binding.expression.support.FluentParserContext;
import org.springframework.webflow.execution.RequestContext;
import org.springframework.webflow.execution.RequestContextHolder;
import org.springframework.webflow.test.MockRequestContext;
public class JsfManagedBeanAwareELExpressionParserTests extends TestCase {
JSFMockHelper jsfMock = new JSFMockHelper();
RequestContext requestContext = new MockRequestContext();
ExpressionParser parser;
protected void setUp() throws Exception {
jsfMock.setUp();
RequestContextHolder.setRequestContext(requestContext);
parser = new JsfManagedBeanAwareELExpressionParser(new ExpressionFactoryImpl());
}
protected void tearDown() throws Exception {
jsfMock.tearDown();
}
public void testGetJSFBean() {
jsfMock.externalContext().getRequestMap().put("myJsfBean", new Object());
Expression expr = parser.parseExpression("myJsfBean", new FluentParserContext().evaluate(RequestContext.class));
Object result = expr.getValue(requestContext);
assertNotNull("The JSF Bean should not be null.", result);
}
}