Examples of FlowExecution


Examples of org.springframework.webflow.execution.FlowExecution

        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

Examples of org.springframework.webflow.execution.FlowExecution

    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

Examples of org.springframework.webflow.execution.FlowExecution

  }

  public void testPutFlowExecution() {
    FlowExecutionImplFactory factory = new FlowExecutionImplFactory();
    factory.setExecutionKeyFactory(repository);
    FlowExecution execution = factory.createFlowExecution(flow);
    execution.start(null, new MockExternalContext());
    assertNotNull(execution.getKey());
    repository.putFlowExecution(execution);
    String key = execution.getKey().toString();
    FlowExecutionKey parsedKey = repository.parseFlowExecutionKey(key);
    FlowExecution execution2 = repository.getFlowExecution(parsedKey);
    assertSame(execution.getDefinition(), execution2.getDefinition());
    assertEquals(execution.getActiveSession().getState().getId(), execution2.getActiveSession().getState().getId());
  }
View Full Code Here

Examples of org.springframework.webflow.execution.FlowExecution

    assertEquals(execution.getActiveSession().getState().getId(), execution2.getActiveSession().getState().getId());
  }

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

Examples of org.springframework.webflow.execution.FlowExecution

  }

  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 {
      repository.getFlowExecution(execution.getKey());
      fail("Should have failed");
    } catch (NoSuchFlowExecutionException e) {

    }
  }
View Full Code Here

Examples of org.springframework.webflow.execution.FlowExecution

    }
  }

  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

Examples of org.springframework.webflow.execution.FlowExecution

  }

  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");
    } catch (NoSuchFlowExecutionException e) {
View Full Code Here

Examples of org.springframework.webflow.execution.FlowExecution

              "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);
    assertTrue(((TestBeanValidator) action.getValidator()).getInvoked());
  }
View Full Code Here

Examples of org.springframework.webflow.execution.FlowExecution

    public void testUniquePerRequest() throws Exception {
        final CasFlowExecutionKeyFactory keyFactory = new CasFlowExecutionKeyFactory(
            this.mockConversationManager,
            mock(FlowExecutionSnapshotFactory.class));
        keyFactory.setAlwaysGenerateNewNextKey(true);
        final FlowExecution execution = newMockExecution(createSimpleFlow("test"));
        final FlowExecutionKey key1 = keyFactory.getKey(execution);
        final FlowExecutionKey key2 = keyFactory.getKey(execution);
        assertFalse(key1.equals(key2));
    }
View Full Code Here

Examples of org.springframework.webflow.execution.FlowExecution

        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());
        assertEquals("view", execution.getActiveSession().getScope().get("renderCalled"));
        final FlowExecutionKey key1 = execution.getKey();
        assertNotNull(key1);
        assertEquals(key1, keyFactory.parseFlowExecutionKey(key1.toString()));
      
        final MockExternalContext context1 = new MockExternalContext();
        context1.setEventId("submit");
        execution.resume(context1);

        // Flow state: rendered parent view (following subflow termination)
        assertTrue(execution.isActive());
        assertEquals("parentview", execution.getActiveSession().getScope().get("renderCalled"));
        final FlowExecutionKey key2 = execution.getKey();
        assertNotNull(key2);
        assertFalse(key1.equals(key2));
        assertEquals(key2, keyFactory.parseFlowExecutionKey(key2.toString()));

        final MockExternalContext context2 = new MockExternalContext();
        context2.setEventId("submit");
        execution.resume(context2);

        // Flow state: completed
        assertTrue(execution.hasEnded());
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.