Backed out inadvertant change

This commit is contained in:
Ben Hale
2007-08-16 15:52:42 +00:00
parent 5fd6a00945
commit cbb76bee53

View File

@@ -1,68 +1,50 @@
/*
* Copyright 2004-2007 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.webflow.engine.builder.xml;
import java.util.Properties;
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[] { getLocation() };
factoryBean.setFlowLocations(locations);
factoryBean.setBeanFactory(new StaticListableBeanFactory());
factoryBean.afterPropertiesSet();
FlowDefinitionRegistry registry = (FlowDefinitionRegistry) factoryBean.getObject();
assertEquals(1, registry.getFlowDefinitionCount());
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");
factoryBean.setFlowDefinitions(properties);
factoryBean.setBeanFactory(new StaticListableBeanFactory());
factoryBean.afterPropertiesSet();
FlowDefinitionRegistry registry = (FlowDefinitionRegistry) factoryBean.getObject();
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());
}
}
/*
* Copyright 2004-2007 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.webflow.engine.builder.xml;
import java.util.Properties;
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[] { getLocation() };
factoryBean.setFlowLocations(locations);
factoryBean.setBeanFactory(new StaticListableBeanFactory());
factoryBean.afterPropertiesSet();
FlowDefinitionRegistry registry = (FlowDefinitionRegistry) factoryBean.getObject();
assertEquals(1, registry.getFlowDefinitionCount());
assertEquals("flow", registry.getFlowDefinition("flow").getId());
}
public void testCreateFromDefinitions() throws Exception {
Properties properties = new Properties();
properties.put("foo", "classpath:/org/springframework/webflow/engine/builder/xml/flow.xml");
factoryBean.setFlowDefinitions(properties);
factoryBean.setBeanFactory(new StaticListableBeanFactory());
factoryBean.afterPropertiesSet();
FlowDefinitionRegistry registry = (FlowDefinitionRegistry) factoryBean.getObject();
assertEquals(1, registry.getFlowDefinitionCount());
assertEquals("foo", registry.getFlowDefinition("foo").getId());
}
}