Package org.springframework.webflow.engine.impl

Examples of org.springframework.webflow.engine.impl.FlowExecutionImplFactory


    }
  }

  public void testRemoveFlowExecution() {
    FlowExecutionImplFactory factory = new FlowExecutionImplFactory();
    factory.setExecutionKeyFactory(repository);
    FlowExecution execution = factory.createFlowExecution(flow);
    execution.start(null, new MockExternalContext());
    assertNotNull(execution.getKey());
    repository.putFlowExecution(execution);
    repository.removeFlowExecution(execution);
    try {
View Full Code Here


    }
  }

  public void testRemoveKeyNotSet() {
    FlowExecutionImplFactory factory = new FlowExecutionImplFactory();
    FlowExecution execution = factory.createFlowExecution(flow);
    try {
      repository.removeFlowExecution(execution);
      fail("Should have failed");
    } catch (IllegalStateException e) {
View Full Code Here

    }
  }

  public void testRemoveNoSuchFlowExecution() {
    FlowExecutionImplFactory factory = new FlowExecutionImplFactory();
    factory.setExecutionKeyFactory(repository);
    FlowExecution execution = factory.createFlowExecution(flow);
    execution.start(null, new MockExternalContext());
    try {
      repository.removeFlowExecution(execution);
      repository.removeFlowExecution(execution);
      fail("Should have failed");
View Full Code Here

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

        assertFalse(key1.equals(key2));
    }

    @Test
    public void testSubflow() throws Exception {
        final FlowExecutionImplFactory executionFactory = new FlowExecutionImplFactory();
        final Flow flow = createFlowWithSubflow("parent", "child");
        final CasFlowExecutionKeyFactory keyFactory = new CasFlowExecutionKeyFactory(
            this.mockConversationManager,
            new SimpleFlowExecutionSnapshotFactory(executionFactory, newMockFlowLocator(flow)));
        keyFactory.setAlwaysGenerateNewNextKey(true);
        executionFactory.setExecutionKeyFactory(keyFactory);
        final FlowExecution execution = executionFactory.createFlowExecution(flow);

        execution.start(null, new MockExternalContext());

        // Flow state: rendered subflow view
        assertTrue(execution.isActive());
View Full Code Here

   * flow execution factory or custom configuration of the flow execution factory, registering flow execution
   * listeners for instance. The default implementation just returns a {@link FlowExecutionImplFactory} instance.
   * @return the flow execution factory
   */
  protected FlowExecutionFactory createFlowExecutionFactory() {
    return new FlowExecutionImplFactory();
  }
View Full Code Here

    Assert.notNull(flowDefinitionLocator, "The flow definition locator property is required");
    if (conversionService == null) {
      conversionService = new DefaultConversionService();
    }
    MutableAttributeMap executionAttributes = createFlowExecutionAttributes();
    FlowExecutionImplFactory executionFactory = createFlowExecutionFactory(executionAttributes);
    DefaultFlowExecutionRepository executionRepository = createFlowExecutionRepository(executionFactory);
    executionFactory.setExecutionKeyFactory(executionRepository);
    flowExecutor = new FlowExecutorImpl(flowDefinitionLocator, executionFactory, executionRepository);
  }
View Full Code Here

      return new SerializedFlowExecutionSnapshotFactory(executionFactory, flowDefinitionLocator);
    }
  }

  private FlowExecutionImplFactory createFlowExecutionFactory(AttributeMap executionAttributes) {
    FlowExecutionImplFactory executionFactory = new FlowExecutionImplFactory();
    executionFactory.setExecutionAttributes(executionAttributes);
    if (flowExecutionListenerLoader != null) {
      executionFactory.setExecutionListenerLoader(flowExecutionListenerLoader);
    }
    return executionFactory;
  }
View Full Code Here

        assertTrue(context.getFlashScope().contains("flowExecutionException"));
        assertTrue(context.getFlashScope().contains("rootCauseException"));
        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

TOP

Related Classes of org.springframework.webflow.engine.impl.FlowExecutionImplFactory

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.