SWF-389 - Encapsulate the recommended default Web Flow configuration for a JSF environment.
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
package org.springframework.faces.config;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
import org.springframework.faces.expression.LegacyJSFELExpressionParser;
|
||||
import org.springframework.faces.model.converter.FacesConversionService;
|
||||
import org.springframework.faces.webflow.JSFMockHelper;
|
||||
import org.springframework.faces.webflow.JsfViewFactoryCreator;
|
||||
import org.springframework.webflow.core.expression.el.WebFlowELExpressionParser;
|
||||
import org.springframework.webflow.engine.builder.support.FlowBuilderServices;
|
||||
|
||||
public class FacesFlowBuilderServicesBeanDefinitionParserTests extends TestCase {
|
||||
|
||||
private ClassPathXmlApplicationContext context;
|
||||
private FlowBuilderServices builderServices;
|
||||
private JSFMockHelper jsf = new JSFMockHelper();
|
||||
|
||||
public void setUp() throws Exception {
|
||||
jsf.setUp();
|
||||
context = new ClassPathXmlApplicationContext("org/springframework/faces/config/flow-builder-services.xml");
|
||||
}
|
||||
|
||||
protected void tearDown() throws Exception {
|
||||
jsf.tearDown();
|
||||
}
|
||||
|
||||
public void testConfigureDefaults() {
|
||||
builderServices = (FlowBuilderServices) context.getBean("flowBuilderServicesDefault");
|
||||
assertNotNull(builderServices);
|
||||
assertTrue(builderServices.getExpressionParser() instanceof WebFlowELExpressionParser);
|
||||
assertTrue(builderServices.getViewFactoryCreator() instanceof JsfViewFactoryCreator);
|
||||
assertTrue(builderServices.getConversionService() instanceof FacesConversionService);
|
||||
}
|
||||
|
||||
public void testEnableManagedBeans() {
|
||||
builderServices = (FlowBuilderServices) context.getBean("flowBuilderServicesLegacy");
|
||||
assertNotNull(builderServices);
|
||||
assertTrue(builderServices.getExpressionParser() instanceof LegacyJSFELExpressionParser);
|
||||
assertTrue(builderServices.getViewFactoryCreator() instanceof JsfViewFactoryCreator);
|
||||
assertTrue(builderServices.getConversionService() instanceof FacesConversionService);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:faces="http://www.springframework.org/schema/faces-config"
|
||||
xsi:schemaLocation="
|
||||
http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
|
||||
http://www.springframework.org/schema/faces-config
|
||||
http://www.springframework.org/schema/faces-config/spring-faces-config-2.0.xsd">
|
||||
|
||||
<faces:flow-builder-services id="flowBuilderServicesDefault"/>
|
||||
|
||||
<faces:flow-builder-services id="flowBuilderServicesLegacy" enable-managed-beans="true"/>
|
||||
|
||||
</beans>
|
||||
Reference in New Issue
Block a user