Added a spring-faces project (SWF-388)

This commit is contained in:
Ben Hale
2007-08-16 15:44:17 +00:00
parent c15289cc05
commit 5fd6a00945
11 changed files with 532 additions and 1 deletions

View File

@@ -22,12 +22,13 @@ import junit.framework.TestCase;
import org.springframework.beans.factory.support.StaticListableBeanFactory;
import org.springframework.core.io.ClassPathResource;
import org.springframework.webflow.definition.registry.FlowDefinitionRegistry;
import org.springframework.webflow.definition.registry.NamespaceMapping;
public class XmlFlowRegistryFactoryBeanTests extends TestCase {
private XmlFlowRegistryFactoryBean factoryBean = new XmlFlowRegistryFactoryBean();
public void testCreateFromLocations() throws Exception {
ClassPathResource[] locations = new ClassPathResource[] { new ClassPathResource("flow.xml", getClass()) };
ClassPathResource[] locations = new ClassPathResource[] { getLocation() };
factoryBean.setFlowLocations(locations);
factoryBean.setBeanFactory(new StaticListableBeanFactory());
factoryBean.afterPropertiesSet();
@@ -36,6 +37,16 @@ public class XmlFlowRegistryFactoryBeanTests extends TestCase {
assertEquals("flow", registry.getFlowDefinition("flow").getId());
}
public void testCreateFromNamespaceMappings() throws Exception {
NamespaceMapping[] namespaceMappings = new NamespaceMapping[] { getNamespaceMapping() };
factoryBean.setFlowNamespaceMappings(namespaceMappings);
factoryBean.setBeanFactory(new StaticListableBeanFactory());
factoryBean.afterPropertiesSet();
FlowDefinitionRegistry registry = (FlowDefinitionRegistry) factoryBean.getObject();
assertEquals(1, registry.getFlowDefinitionCount());
assertEquals("flow", registry.getFlowDefinition("/namespace/flow").getId());
}
public void testCreateFromDefinitions() throws Exception {
Properties properties = new Properties();
properties.put("foo", "classpath:/org/springframework/webflow/engine/builder/xml/flow.xml");
@@ -46,4 +57,12 @@ public class XmlFlowRegistryFactoryBeanTests extends TestCase {
assertEquals(1, registry.getFlowDefinitionCount());
assertEquals("foo", registry.getFlowDefinition("foo").getId());
}
private ClassPathResource getLocation() {
return new ClassPathResource("flow.xml", getClass());
}
private NamespaceMapping getNamespaceMapping() {
return new NamespaceMapping("/namespace", getLocation());
}
}