Package org.springframework.webflow.execution

Examples of org.springframework.webflow.execution.FlowExecution


    @Override
    @SuppressWarnings("unchecked")
    public Object getReferenceInFlowScope(String flowExecutionKey, String referenceName, HttpServletRequest request) {
        ExternalContextHolder.setExternalContext(new ServletExternalContext(servletContext, request, null));
        FlowExecutionRepository executionRepository =  ((FlowExecutorImpl) flowExecutor).getExecutionRepository();
        FlowExecution flowExecution = executionRepository.getFlowExecution(executionRepository.parseFlowExecutionKey(flowExecutionKey));
        FlowSession flowSession = flowExecution.getActiveSession();
        return flowSession.getScope().get(referenceName);
    }
View Full Code Here


        assertTrue(context.getFlashScope().get("rootCauseException") instanceof TestException);
      }
    };
    FlowExecutionImplFactory factory = new FlowExecutionImplFactory();
    factory.setExecutionListenerLoader(new StaticFlowExecutionListenerLoader(listener));
    FlowExecution execution = factory.createFlowExecution(flow);
    execution.start(null, new MockExternalContext());
    assertTrue("Should have ended", !execution.isActive());
  }
View Full Code Here

  public void testStateExceptionHandlingTransitionNoSuchState() {
    TransitionExecutingFlowExecutionExceptionHandler handler = new TransitionExecutingFlowExecutionExceptionHandler();
    handler.add(TestException.class, "end");
    flow.getExceptionHandlerSet().add(handler);
    FlowExecution execution = new FlowExecutionImplFactory().createFlowExecution(flow);
    try {
      execution.start(null, new MockExternalContext());
      fail("Should have failed no such state");
    } catch (IllegalArgumentException e) {
    }
  }
View Full Code Here

    } catch (IllegalArgumentException e) {
    }
  }

  public void testStateExceptionHandlingRethrow() {
    FlowExecution execution = new FlowExecutionImplFactory().createFlowExecution(flow);
    try {
      execution.start(null, new MockExternalContext());
      fail("Should have rethrown");
    } catch (FlowExecutionException e) {
      // expected
    }
  }
View Full Code Here

      public Flow createFlow() throws FlowBuilderException {
        return Flow.create(getContext().getFlowId(), getContext().getFlowAttributes());
      }
    };
    Flow flow = new FlowAssembler(builder, new MockFlowBuilderContext("flow")).assembleFlow();
    FlowExecution execution = new FlowExecutionImplFactory().createFlowExecution(flow);
    execution.start(null, new MockExternalContext());
    assertTrue(execution.isActive());
  }
View Full Code Here

    flowDefinition = new Flow("flow");
    new EndState(flowDefinition, "end");
  }

  public void testCreate() {
    FlowExecution execution = factory.createFlowExecution(flowDefinition);
    assertSame(flowDefinition, execution.getDefinition());
    assertFalse(execution.hasStarted());
    assertFalse(execution.isActive());
  }
View Full Code Here

  public void testCreateWithExecutionAttributes() {
    MutableAttributeMap attributes = new LocalAttributeMap();
    attributes.put("foo", "bar");
    factory.setExecutionAttributes(attributes);
    FlowExecution execution = factory.createFlowExecution(flowDefinition);
    assertEquals(attributes, execution.getAttributes());
  }
View Full Code Here

      public void sessionStarting(RequestContext context, FlowSession session, MutableAttributeMap input) {
        starting = true;
      }
    };
    factory.setExecutionListenerLoader(new StaticFlowExecutionListenerLoader(listener1));
    FlowExecution execution = factory.createFlowExecution(flowDefinition);
    assertFalse(execution.isActive());
    execution.start(null, new MockExternalContext());
    assertTrue(starting);
  }
View Full Code Here

        context.removeAllFlowExecutionSnapshots();
      }
    };
    flowDefinition.setStartState(state);
    factory.setExecutionKeyFactory(new MockFlowExecutionKeyFactory());
    FlowExecution execution = factory.createFlowExecution(flowDefinition);
    execution.start(null, new MockExternalContext());
    assertTrue(getKeyCalled);
    assertTrue(removeAllSnapshotsCalled);
    assertTrue(removeSnapshotCalled);
    assertTrue(updateSnapshotCalled);
    assertNull(execution.getKey());
  }
View Full Code Here

    model.setStates(doubleList(end, notReached));

    Flow flow = getFlow(model);
    FlowExecutionImplFactory factory = new FlowExecutionImplFactory();
    FlowExecution execution = factory.createFlowExecution(flow);
    MockExternalContext context = new MockExternalContext();
    MutableAttributeMap map = new LocalAttributeMap();
    map.put("foo", "bar");
    map.put("number", "3");
    map.put("required", "9");
    execution.start(map, context);
    FlowExecutionOutcome outcome = execution.getOutcome();
    assertEquals("end", outcome.getId());
    assertEquals("bar", outcome.getOutput().get("foo"));
    assertEquals("bar", outcome.getOutput().get("differentName"));
    assertEquals(new Integer(3), outcome.getOutput().get("number"));
    assertEquals(new Integer(3), outcome.getOutput().get("required"));
View Full Code Here

TOP

Related Classes of org.springframework.webflow.execution.FlowExecution

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.