/** * Creates a new mock flow service locator. */ public MockFlowBuilderContext(String flowId, AttributeMap<Object> attributes) { super(flowId, attributes, new FlowDefinitionRegistryImpl(), TestFlowBuilderServicesFactory.getServices()); }
public static FlowBuilderServices getServices() { FlowBuilderServices services = new FlowBuilderServices() { // The SpEL parser must use the currently configured conversion service. public void setConversionService(ConversionService conversionService) { super.setConversionService(conversionService); setExpressionParser(new WebFlowSpringELExpressionParser(new SpelExpressionParser(), conversionService)); } }; services.setViewFactoryCreator(new MockViewFactoryCreator()); services.setConversionService(new DefaultConversionService()); services.setApplicationContext(createTestApplicationContext()); return services; }
/** * Creates a new mock flow service locator. */ public MockFlowBuilderContext(String flowId, AttributeMap<Object> attributes) { super(flowId, attributes, new FlowDefinitionRegistryImpl(), TestFlowBuilderServicesFactory.getServices()); }
public static FlowBuilderServices getServices() { FlowBuilderServices services = new FlowBuilderServices() { // The SpEL parser must use the currently configured conversion service. public void setConversionService(ConversionService conversionService) { super.setConversionService(conversionService); setExpressionParser(new WebFlowSpringELExpressionParser(new SpelExpressionParser(), conversionService)); } }; services.setViewFactoryCreator(new MockViewFactoryCreator()); services.setConversionService(new DefaultConversionService()); services.setApplicationContext(createTestApplicationContext()); return services; }
/** * Creates a new mock flow service locator. */ public MockFlowBuilderContext(String flowId, AttributeMap attributes) { super(flowId, attributes, new FlowDefinitionRegistryImpl(), TestFlowBuilderServicesFactory.getServices()); }
public static FlowBuilderServices getServices() { FlowBuilderServices services = new FlowBuilderServices(); services.setViewFactoryCreator(new MockViewFactoryCreator()); services.setConversionService(new DefaultConversionService()); services.setExpressionParser(DefaultExpressionParserFactory.getExpressionParser()); services.setApplicationContext(createTestApplicationContext()); return services; }
public void testGetFlowRegistry() throws Exception { HashSet<FlowElementAttribute> attributes = new HashSet<>(); attributes.add(new FlowElementAttribute("foo", "bar", null)); attributes.add(new FlowElementAttribute("bar", "2", "integer")); FlowLocation location1 = new FlowLocation("flow1", "org/springframework/webflow/config/flow.xml", attributes); FlowLocation location2 = new FlowLocation("flow2", "org/springframework/webflow/config/flow.xml", attributes); FlowLocation[] flowLocations = new FlowLocation[] { location1, location2 }; factoryBean.setFlowBuilderServices(TestFlowBuilderServicesFactory.getServices()); factoryBean.setFlowLocations(flowLocations); factoryBean.afterPropertiesSet(); FlowDefinitionRegistry registry = factoryBean.getObject(); FlowDefinition def = registry.getFlowDefinition("flow1"); assertNotNull(def); assertEquals("flow1", def.getId()); assertEquals("bar", def.getAttributes().get("foo")); assertEquals(new Integer(2), def.getAttributes().getInteger("bar")); def = registry.getFlowDefinition("flow2"); assertNotNull(def); assertEquals("flow2", def.getId()); }
public void testGetFlowRegistryCustomFlowServices() throws Exception { FlowLocation location1 = new FlowLocation(null, "org/springframework/webflow/config/flow.xml", null); FlowLocation[] flowLocations = new FlowLocation[] { location1 }; factoryBean.setFlowLocations(flowLocations); factoryBean.setFlowBuilderServices(TestFlowBuilderServicesFactory.getServices()); factoryBean.afterPropertiesSet(); FlowDefinitionRegistry registry = factoryBean.getObject(); FlowDefinition def = registry.getFlowDefinition("flow"); assertNotNull(def); assertEquals("flow", def.getId()); assertTrue(def.getAttributes().isEmpty()); } }
public void testGetFlowRegistryGeneratedFlowId() throws Exception { FlowLocation location1 = new FlowLocation(null, "org/springframework/webflow/config/flow.xml", null); FlowLocation[] flowLocations = new FlowLocation[] { location1 }; factoryBean.setFlowBuilderServices(TestFlowBuilderServicesFactory.getServices()); factoryBean.setFlowLocations(flowLocations); factoryBean.afterPropertiesSet(); FlowDefinitionRegistry registry = factoryBean.getObject(); FlowDefinition def = registry.getFlowDefinition("flow"); assertNotNull(def); assertEquals("flow", def.getId()); assertTrue(def.getAttributes().isEmpty()); }