Package org.springframework.webflow.execution

Examples of org.springframework.webflow.execution.FlowExecutionListenerAdapter


  public void testFlowStateExceptionHandlingTransition() {
    new EndState(flow, "end");
    TransitionExecutingFlowExecutionExceptionHandler handler = new TransitionExecutingFlowExecutionExceptionHandler();
    handler.add(TestException.class, "end");
    flow.getExceptionHandlerSet().add(handler);
    FlowExecutionListener listener = new FlowExecutionListenerAdapter() {
      public void sessionEnding(RequestContext context, FlowSession session, MutableAttributeMap output) {
        assertTrue(context.getFlashScope().contains("flowExecutionException"));
        assertTrue(context.getFlashScope().contains("rootCauseException"));
        assertTrue(context.getFlashScope().get("rootCauseException") instanceof TestException);
      }
View Full Code Here


    FlowExecution execution = factory.createFlowExecution(flowDefinition);
    assertEquals(attributes, execution.getAttributes());
  }

  public void testCreateWithExecutionListener() {
    FlowExecutionListener listener1 = new FlowExecutionListenerAdapter() {
      public void sessionStarting(RequestContext context, FlowSession session, MutableAttributeMap input) {
        starting = true;
      }
    };
    factory.setExecutionListenerLoader(new StaticFlowExecutionListenerLoader(listener1));
View Full Code Here

  public void testRestoreExecutionState() {
    FlowExecutionImpl flowExecution = (FlowExecutionImpl) factory.createFlowExecution(flowDefinition);
    LocalAttributeMap executionAttributes = new LocalAttributeMap();
    factory.setExecutionAttributes(executionAttributes);
    FlowExecutionListener listener = new FlowExecutionListenerAdapter() {
    };
    factory.setExecutionListenerLoader(new StaticFlowExecutionListenerLoader(listener));
    MockFlowExecutionKeyFactory keyFactory = new MockFlowExecutionKeyFactory();
    factory.setExecutionKeyFactory(keyFactory);
    FlowExecutionKey flowExecutionKey = new MockFlowExecutionKey("e1s1");
View Full Code Here

  }

  public void testStartExceptionThrownBeforeFirstSessionCreated() {
    Flow flow = new Flow("flow");
    new EndState(flow, "end");
    FlowExecutionListener mockListener = new FlowExecutionListenerAdapter() {
      public void sessionStarting(RequestContext context, FlowSession session, MutableAttributeMap input) {
        throw new IllegalStateException("Oops");
      }
    };
    FlowExecutionListener[] listeners = new FlowExecutionListener[] { mockListener };
View Full Code Here

      }
    });
    Set attributes = new HashSet();
    attributes.add(new FlowElementAttribute("foo", "bar", null));
    factoryBean.setFlowExecutionAttributes(attributes);
    FlowExecutionListener listener = new FlowExecutionListenerAdapter() {

    };
    factoryBean.setFlowExecutionListenerLoader(new StaticFlowExecutionListenerLoader(listener));
    factoryBean.setMaxFlowExecutionSnapshots(2);
    factoryBean.setMaxFlowExecutions(1);
View Full Code Here

    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());
View Full Code Here

  public void testFlowStateExceptionHandlingTransition() {
    new EndState(flow, "end");
    TransitionExecutingFlowExecutionExceptionHandler handler = new TransitionExecutingFlowExecutionExceptionHandler();
    handler.add(TestException.class, "end");
    flow.getExceptionHandlerSet().add(handler);
    FlowExecutionListener listener = new FlowExecutionListenerAdapter() {
      @SuppressWarnings("unused")
      public void sessionEnding(RequestContext context, FlowSession session, MutableAttributeMap<?> output) {
        assertTrue(context.getFlashScope().contains("flowExecutionException"));
        assertTrue(context.getFlashScope().contains("rootCauseException"));
        assertTrue(context.getFlashScope().get("rootCauseException") instanceof TestException);
View Full Code Here

    assertEquals(attributes, execution.getAttributes());
    assertSame("Flow execution attributes are global", attributes.asMap(), execution.getAttributes().asMap());
  }

  public void testCreateWithExecutionListener() {
    FlowExecutionListener listener1 = new FlowExecutionListenerAdapter() {
      public void sessionStarting(RequestContext context, FlowSession session, MutableAttributeMap<?> input) {
        starting = true;
      }
    };
    factory.setExecutionListenerLoader(new StaticFlowExecutionListenerLoader(listener1));
View Full Code Here

  public void testRestoreExecutionState() {
    FlowExecutionImpl flowExecution = (FlowExecutionImpl) factory.createFlowExecution(flowDefinition);
    LocalAttributeMap<Object> executionAttributes = new LocalAttributeMap<Object>();
    factory.setExecutionAttributes(executionAttributes);
    FlowExecutionListener listener = new FlowExecutionListenerAdapter() {
    };
    factory.setExecutionListenerLoader(new StaticFlowExecutionListenerLoader(listener));
    MockFlowExecutionKeyFactory keyFactory = new MockFlowExecutionKeyFactory();
    factory.setExecutionKeyFactory(keyFactory);
    FlowExecutionKey flowExecutionKey = new MockFlowExecutionKey("e1s1");
View Full Code Here

    assertEquals(0, loader.getListeners(new Flow("foo")).length);
    assertEquals(0, loader.getListeners(null).length);
  }

  public void testStaticListener() {
    final FlowExecutionListener listener1 = new FlowExecutionListenerAdapter() {
    };
    loader = new StaticFlowExecutionListenerLoader(listener1);
    assertEquals(listener1, loader.getListeners(new Flow("foo"))[0]);
  }
View Full Code Here

TOP

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

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.