SWF-389 - Encapsulate the recommended default Web Flow configuration for a JSF environment.

This commit is contained in:
Jeremy Grelle
2008-02-21 19:46:04 +00:00
parent f63b5907eb
commit f76fb0b39f
8 changed files with 238 additions and 0 deletions

View File

@@ -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);
}
}

View File

@@ -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>