bringing faces in-line with binding

This commit is contained in:
Keith Donald
2008-06-30 19:47:35 +00:00
parent ad0cee22bb
commit b181862cfb
9 changed files with 86 additions and 91 deletions

View File

@@ -7,8 +7,6 @@ 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;
@@ -56,13 +54,12 @@ public class FacesFlowBuilderServicesBeanDefinitionParserTests extends TestCase
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) {
ConversionService conversionService) {
throw new UnsupportedOperationException("Auto-generated method stub");
}
@@ -94,16 +91,4 @@ public class FacesFlowBuilderServicesBeanDefinitionParserTests extends TestCase
}
}
public static class TestFormatterRegistry implements FormatterRegistry {
public Formatter getFormatter(Class clazz) {
throw new UnsupportedOperationException("Auto-generated method stub");
}
public Formatter getFormatter(Class clazz, String id) {
throw new UnsupportedOperationException("Auto-generated method stub");
}
}
}

View File

@@ -15,8 +15,7 @@
<faces:flow-builder-services id="flowBuilderServicesCustom"
expression-parser="customExpressionParser"
view-factory-creator="customViewFactoryCreator"
conversion-service="customConversionService"
formatter-registry="customFormatterRegistry"/>
conversion-service="customConversionService"/>
<bean id="customExpressionParser" class="org.springframework.webflow.expression.DefaultExpressionParserFactory" factory-method="getExpressionParser"/>
@@ -24,6 +23,4 @@
<bean id="customConversionService" class="org.springframework.faces.config.FacesFlowBuilderServicesBeanDefinitionParserTests$TestConversionService"/>
<bean id="customFormatterRegistry" class="org.springframework.faces.config.FacesFlowBuilderServicesBeanDefinitionParserTests$TestFormatterRegistry"/>
</beans>

View File

@@ -9,7 +9,7 @@ import javax.faces.model.ListDataModel;
import junit.framework.TestCase;
import org.springframework.binding.convert.Converter;
import org.springframework.binding.convert.converters.Converter;
import org.springframework.faces.model.SerializableListDataModel;
public class DataModelConverterTests extends TestCase {
@@ -19,7 +19,7 @@ public class DataModelConverterTests extends TestCase {
public void testConvertListToDataModel() throws Exception {
List sourceList = new ArrayList();
DataModel resultModel = (DataModel) converter.convert(sourceList, DataModel.class, null);
DataModel resultModel = (DataModel) converter.convertSourceToTargetClass(sourceList, DataModel.class);
assertNotNull(resultModel);
assertSame(sourceList, resultModel.getWrappedData());
@@ -28,7 +28,7 @@ public class DataModelConverterTests extends TestCase {
public void testConvertListToListDataModel() throws Exception {
List sourceList = new ArrayList();
DataModel resultModel = (DataModel) converter.convert(sourceList, ListDataModel.class, null);
DataModel resultModel = (DataModel) converter.convertSourceToTargetClass(sourceList, ListDataModel.class);
assertNotNull(resultModel);
assertSame(sourceList, resultModel.getWrappedData());
@@ -37,7 +37,8 @@ public class DataModelConverterTests extends TestCase {
public void testConvertListToSerializableListDataModel() throws Exception {
List sourceList = new ArrayList();
DataModel resultModel = (DataModel) converter.convert(sourceList, SerializableListDataModel.class, null);
DataModel resultModel = (DataModel) converter.convertSourceToTargetClass(sourceList,
SerializableListDataModel.class);
assertNotNull(resultModel);
assertSame(sourceList, resultModel.getWrappedData());
@@ -47,7 +48,8 @@ public class DataModelConverterTests extends TestCase {
public void testConvertListToSerializableListDataModelNullSource() throws Exception {
List sourceList = null;
DataModel resultModel = (DataModel) converter.convert(sourceList, SerializableListDataModel.class, null);
DataModel resultModel = (DataModel) converter.convertSourceToTargetClass(sourceList,
SerializableListDataModel.class);
assertNotNull(resultModel);
assertTrue(resultModel instanceof Serializable);