diff --git a/spring-faces/src/main/java/org/springframework/faces/config/spring-faces-2.0.xsd b/spring-faces/src/main/java/org/springframework/faces/config/spring-faces-2.0.xsd index be8815bf..bb858b26 100644 --- a/spring-faces/src/main/java/org/springframework/faces/config/spring-faces-2.0.xsd +++ b/spring-faces/src/main/java/org/springframework/faces/config/spring-faces-2.0.xsd @@ -13,8 +13,9 @@ @@ -25,7 +26,16 @@ be used by a flow definition registry. + + + + + + + @@ -34,8 +44,7 @@ The idref of the conversion service that should be used. If not provided, the d @@ -44,8 +53,7 @@ will be used. diff --git a/spring-faces/src/test/java/org/springframework/faces/config/FacesFlowBuilderServicesBeanDefinitionParserTests.java b/spring-faces/src/test/java/org/springframework/faces/config/FacesFlowBuilderServicesBeanDefinitionParserTests.java index 58423990..923a03c8 100644 --- a/spring-faces/src/test/java/org/springframework/faces/config/FacesFlowBuilderServicesBeanDefinitionParserTests.java +++ b/spring-faces/src/test/java/org/springframework/faces/config/FacesFlowBuilderServicesBeanDefinitionParserTests.java @@ -2,12 +2,21 @@ package org.springframework.faces.config; import junit.framework.TestCase; +import org.springframework.binding.convert.ConversionException; +import org.springframework.binding.convert.ConversionExecutor; +import org.springframework.binding.convert.ConversionService; +import org.springframework.binding.expression.Expression; +import org.springframework.binding.expression.ExpressionParser; +import org.springframework.binding.format.Formatter; +import org.springframework.binding.format.FormatterRegistry; import org.springframework.context.support.ClassPathXmlApplicationContext; import org.springframework.faces.model.converter.FacesConversionService; import org.springframework.faces.webflow.JSFMockHelper; import org.springframework.faces.webflow.JsfManagedBeanAwareELExpressionParser; import org.springframework.faces.webflow.JsfViewFactoryCreator; +import org.springframework.webflow.engine.builder.ViewFactoryCreator; import org.springframework.webflow.engine.builder.support.FlowBuilderServices; +import org.springframework.webflow.execution.ViewFactory; import org.springframework.webflow.expression.el.WebFlowELExpressionParser; public class FacesFlowBuilderServicesBeanDefinitionParserTests extends TestCase { @@ -40,4 +49,60 @@ public class FacesFlowBuilderServicesBeanDefinitionParserTests extends TestCase assertTrue(builderServices.getViewFactoryCreator() instanceof JsfViewFactoryCreator); assertTrue(builderServices.getConversionService() instanceof FacesConversionService); } + + public void testFlowBuilderServicesCustomized() { + builderServices = (FlowBuilderServices) context.getBean("flowBuilderServicesCustom"); + assertNotNull(builderServices); + assertNotNull(builderServices.getExpressionParser()); + assertTrue(builderServices.getViewFactoryCreator() instanceof TestViewFactoryCreator); + assertTrue(builderServices.getConversionService() instanceof TestConversionService); + assertTrue(builderServices.getFormatterRegistry() instanceof TestFormatterRegistry); + } + + public static class TestViewFactoryCreator implements ViewFactoryCreator { + + public ViewFactory createViewFactory(Expression viewIdExpression, ExpressionParser expressionParser, + FormatterRegistry formatterRegistry) { + throw new UnsupportedOperationException("Auto-generated method stub"); + } + + public String getViewIdByConvention(String viewStateId) { + return viewStateId; + } + + } + + public static class TestConversionService implements ConversionService { + + public Class getClassByAlias(String alias) throws ConversionException { + throw new UnsupportedOperationException("Auto-generated method stub"); + } + + public ConversionExecutor getConversionExecutor(Class sourceClass, Class targetClass) + throws ConversionException { + throw new UnsupportedOperationException("Auto-generated method stub"); + } + + public ConversionExecutor getConversionExecutorByTargetAlias(Class sourceClass, String targetAlias) + throws ConversionException { + throw new UnsupportedOperationException("Auto-generated method stub"); + } + + public ConversionExecutor[] getConversionExecutorsForSource(Class sourceClass) throws ConversionException { + throw new UnsupportedOperationException("Auto-generated method stub"); + } + + } + + public static class TestFormatterRegistry implements FormatterRegistry { + + public Formatter getFormatter(Class clazz) { + throw new UnsupportedOperationException("Auto-generated method stub"); + } + + public Formatter getFormatter(String id) { + throw new UnsupportedOperationException("Auto-generated method stub"); + } + + } } diff --git a/spring-faces/src/test/java/org/springframework/faces/config/flow-builder-services.xml b/spring-faces/src/test/java/org/springframework/faces/config/flow-builder-services.xml index 41c7c634..af4fc0af 100644 --- a/spring-faces/src/test/java/org/springframework/faces/config/flow-builder-services.xml +++ b/spring-faces/src/test/java/org/springframework/faces/config/flow-builder-services.xml @@ -11,5 +11,19 @@ + + + + + + + + + + \ No newline at end of file diff --git a/spring-webflow/src/main/java/org/springframework/webflow/config/spring-webflow-config-2.0.xsd b/spring-webflow/src/main/java/org/springframework/webflow/config/spring-webflow-config-2.0.xsd index 189b7b64..97eb3a57 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/config/spring-webflow-config-2.0.xsd +++ b/spring-webflow/src/main/java/org/springframework/webflow/config/spring-webflow-config-2.0.xsd @@ -69,8 +69,8 @@ Registers a custom FlowBuilder implementation in this registry. @@ -213,7 +213,7 @@ The default value 'flowRegistry'. @@ -221,29 +221,38 @@ This tag is only needed when you wish to plugin custom implementations. - + - + - + + + + + + + + @@ -254,7 +263,7 @@ The custom ConversionService implementation to use. - + + conversion-service="customConversionService" + formatter-registry="customFormatterRegistry"/> + + \ No newline at end of file