Fixing build.

This commit is contained in:
Jeremy Grelle
2008-02-21 20:16:03 +00:00
parent f76fb0b39f
commit 631f0667ea
4 changed files with 117 additions and 2 deletions

View File

@@ -32,7 +32,14 @@ public class LegacyJSFELExpressionParser extends ELExpressionParser {
}
public LegacyJSFELExpressionParser() {
this(ExpressionFactory.newInstance());
this(getDefaultExpressionFactory());
}
private static ExpressionFactory getDefaultExpressionFactory() {
if (!System.getProperties().containsKey("javax.el.ExpressionFactory")) {
System.setProperty("javax.el.ExpressionFactory", "org.jboss.el.ExpressionFactoryImpl");
}
return ExpressionFactory.newInstance();
}
private static class RequestContextELContextFactory implements ELContextFactory {

View File

@@ -30,7 +30,14 @@ public class WebFlowELExpressionParser extends ELExpressionParser {
}
public WebFlowELExpressionParser() {
this(ExpressionFactory.newInstance());
this(getDefaultExpressionFactory());
}
private static ExpressionFactory getDefaultExpressionFactory() {
if (!System.getProperties().containsKey("javax.el.ExpressionFactory")) {
System.setProperty("javax.el.ExpressionFactory", "org.jboss.el.ExpressionFactoryImpl");
}
return ExpressionFactory.newInstance();
}
private static class RequestContextELContextFactory implements ELContextFactory {

View File

@@ -0,0 +1,77 @@
package org.springframework.webflow.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.convert.support.DefaultConversionService;
import org.springframework.binding.expression.Expression;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.core.io.ResourceLoader;
import org.springframework.webflow.core.expression.el.WebFlowELExpressionParser;
import org.springframework.webflow.engine.builder.ViewFactoryCreator;
import org.springframework.webflow.engine.builder.support.FlowBuilderServices;
import org.springframework.webflow.execution.Action;
import org.springframework.webflow.execution.ViewFactory;
import org.springframework.webflow.mvc.MvcViewFactoryCreator;
public class FlowBuilderServicesBeanDefinitionParserTests extends TestCase {
private ClassPathXmlApplicationContext context;
private FlowBuilderServices builderServices;
public void setUp() {
context = new ClassPathXmlApplicationContext("org/springframework/webflow/config/flow-builder-services.xml");
}
public void testFlowBuilderServicesDefaultConfig() {
builderServices = (FlowBuilderServices) context.getBean("flowBuilderServicesDefault");
assertNotNull(builderServices);
assertNotNull(builderServices.getExpressionParser());
assertTrue(builderServices.getViewFactoryCreator() instanceof MvcViewFactoryCreator);
assertTrue(builderServices.getConversionService() instanceof DefaultConversionService);
}
public void testFlowBuilderServicesCustomized() {
builderServices = (FlowBuilderServices) context.getBean("flowBuilderServicesCustom");
assertNotNull(builderServices);
assertTrue(builderServices.getExpressionParser() instanceof WebFlowELExpressionParser);
assertTrue(builderServices.getViewFactoryCreator() instanceof TestViewFactoryCreator);
assertTrue(builderServices.getConversionService() instanceof TestConversionService);
}
public static class TestViewFactoryCreator implements ViewFactoryCreator {
public Action createFinalResponseAction(Expression viewId, ResourceLoader viewResourceLoader) {
throw new UnsupportedOperationException("Auto-generated method stub");
}
public ViewFactory createViewFactory(Expression viewId, ResourceLoader viewResourceLoader) {
throw new UnsupportedOperationException("Auto-generated method stub");
}
}
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");
}
}
}

View File

@@ -0,0 +1,24 @@
<?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:web="http://www.springframework.org/schema/webflow-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/webflow-config
http://www.springframework.org/schema/webflow-config/spring-webflow-config-2.0.xsd">
<web:flow-builder-services id="flowBuilderServicesDefault"/>
<web:flow-builder-services id="flowBuilderServicesCustom"
expression-parser="customExpressionParser"
view-factory-creator="customViewFactoryCreator"
conversion-service="customConversionService"/>
<bean id="customExpressionParser" class="org.springframework.webflow.core.expression.el.WebFlowELExpressionParser"/>
<bean id="customViewFactoryCreator" class="org.springframework.webflow.config.FlowBuilderServicesBeanDefinitionParserTests$TestViewFactoryCreator"/>
<bean id="customConversionService" class="org.springframework.webflow.config.FlowBuilderServicesBeanDefinitionParserTests$TestConversionService"/>
</beans>