Package org.springframework.webflow.engine

Examples of org.springframework.webflow.engine.Flow


    assertTrue(avf.getAction() instanceof ExternalRedirectAction);
  }

  public void testResourceBackedFlowBuilder() {
    ClassPathResource resource = new ClassPathResource("flow-endstate.xml", XmlFlowModelBuilderTests.class);
    Flow flow = getFlow(resource);
    assertEquals("flow", flow.getId());
    assertEquals("end", flow.getStartState().getId());
  }
View Full Code Here


    assertEquals("end", flow.getStartState().getId());
  }

  public void testResourceBackedFlowBuilderWithMessages() {
    ClassPathResource resource = new ClassPathResource("resources/flow.xml", FlowModelFlowBuilderTests.class);
    Flow flow = getFlow(resource);
    assertNotNull(flow.getApplicationContext());
    assertEquals("bar", flow.getApplicationContext().getMessage("foo", null, null));
  }
View Full Code Here

    };
    FlowModelFlowBuilder builder = new FlowModelFlowBuilder(new StaticFlowModelHolder(model));
    MockFlowBuilderContext context = new MockFlowBuilderContext("foo");
    context.registerBean("exceptionHandler", handler);
    FlowAssembler assembler = new FlowAssembler(builder, context);
    Flow flow = assembler.assembleFlow();
    assertEquals(1, flow.getExceptionHandlerSet().size());
  }
View Full Code Here

    RequestContext ctx = getRequestContext();
    assertFalse("Criterion should evaluate to false", criterion.test(ctx));
  }

  private MockRequestContext getRequestContext() {
    Flow flow = new Flow("id");
    MockRequestContext ctx = new MockRequestContext(flow);
    RequestContextHolder.setRequestContext(ctx);
    ctx.getFlowScope().put("foo", "bar");
    ctx.setCurrentEvent(new Event(this, "sample"));
    return ctx;
View Full Code Here

  public void testGetFlowExecutorBasicConfig() throws Exception {
    factoryBean.setFlowDefinitionLocator(new FlowDefinitionLocator() {
      public FlowDefinition getFlowDefinition(String id) throws NoSuchFlowDefinitionException,
          FlowDefinitionConstructionException {
        Flow flow = new Flow(id);
        ViewState view = new ViewState(flow, "view", new StubViewFactory());
        view.getTransitionSet().add(new Transition(new DefaultTargetStateResolver("end")));
        new EndState(flow, "end");
        return flow;
      }
View Full Code Here

  public void testGetFlowExecutorOptionsSpecified() throws Exception {
    factoryBean.setFlowDefinitionLocator(new FlowDefinitionLocator() {
      public FlowDefinition getFlowDefinition(String id) throws NoSuchFlowDefinitionException,
          FlowDefinitionConstructionException {
        Flow flow = new Flow(id);
        ViewState view = new ViewState(flow, "view", new StubViewFactory());
        view.getTransitionSet().add(new Transition(new DefaultTargetStateResolver("end")));
        new EndState(flow, "end");
        return flow;
      }
View Full Code Here

    resumeFlow(context);
    assertCurrentStateEquals("displayResults");
  }

  protected void configureFlowBuilderContext(MockFlowBuilderContext builderContext) {
    Flow mockDetailFlow = new Flow("detail-flow");
    mockDetailFlow.setInputMapper(new Mapper() {
      public MappingResults map(Object source, Object target) {
        assertEquals("id of value 1 not provided as input by calling search flow", new Long(1),
            ((AttributeMap) source).get("id"));
        return null;
      }
View Full Code Here

  protected Flow createFlow() {
    String flowId = getContext().getFlowId();
    AttributeMap flowAttributes = parseFlowMetaAttributes(flowModel);
    flowAttributes = getContext().getFlowAttributes().union(flowAttributes);
    Flow flow = getLocalContext().getFlowArtifactFactory().createFlow(flowId, flowAttributes);
    flow.setApplicationContext(getLocalContext().getApplicationContext());
    return flow;
  }
View Full Code Here

  private Flow flow;
  private ConversationManager conversationManager;
  private DefaultFlowExecutionRepository repository;

  protected void setUp() throws Exception {
    flow = new Flow("myFlow");
    new State(flow, "state") {
      protected void doEnter(RequestControlContext context) throws FlowExecutionException {
        context.assignFlowExecutionKey();
      }
    };
View Full Code Here

    ClassPathResource resource = new ClassPathResource("flow-formaction-validatormethod.xml", getClass());
    XmlFlowModelBuilder builder = new XmlFlowModelBuilder(resource, registry);
    DefaultFlowModelHolder holder = new DefaultFlowModelHolder(builder);
    FlowModelFlowBuilder flowBuilder = new FlowModelFlowBuilder(holder);
    FlowAssembler assembler = new FlowAssembler(flowBuilder, new MockFlowBuilderContext("flow"));
    Flow flow = assembler.assembleFlow();
    FlowExecutionImplFactory factory = new FlowExecutionImplFactory();
    factory.setExecutionListenerLoader(new StaticFlowExecutionListenerLoader(new FlowExecutionListenerAdapter() {
      public void viewRendering(RequestContext context, View view, StateDefinition viewState) {
        if (context.getCurrentEvent() != null && context.getCurrentEvent().getId().equals("submit")) {
          BindingResult result = (BindingResult) context.getFlashScope().get(
              "org.springframework.validation.BindingResult.formBean");
          assertEquals(1, result.getErrorCount());
        }
      }

      public void viewRendered(RequestContext context, View view, StateDefinition viewState) {
        if (context.getCurrentEvent() != null && context.getCurrentEvent().getId().equals("submit")) {
          BindingResult result = (BindingResult) context.getFlashScope().get(
              "org.springframework.validation.BindingResult.formBean");
          assertNull(result);
        }
      }
    }));
    FlowExecution execution = factory.createFlowExecution(flow);
    FormAction action = (FormAction) flow.getApplicationContext().getBean("formAction");
    assertFalse(((TestBeanValidator) action.getValidator()).getInvoked());
    execution.start(null, new MockExternalContext());
    MockExternalContext context = new MockExternalContext();
    context.setEventId("submit");
    execution.resume(context);
View Full Code Here

TOP

Related Classes of org.springframework.webflow.engine.Flow

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.