@Test
  public void testStart() throws Exception {
    MockExternalContext context = new MockExternalContext();
    when(hospitalManager.findAll()).thenReturn(new ArrayList<>());
    PersonObjectModel person = createMockPerson();
    MutableAttributeMap input = new LocalAttributeMap<>();
    input.put("person", person);

    startFlow(input, context);
    assertFlowExecutionActive();
    assertCurrentStateEquals(ENTER_PERSON_INFO);
  }
 /**
  * Add all needed items to a Spring WebFlow View Scope.
  *
  * @param viewScope the viewScope to add to
  */
 public void addGlobalModelItems(MutableAttributeMap viewScope) {
   Map<String, Object> items = new HashMap<>();
   addGlobalModelItems(items);
   for (Entry<String, Object> entry : items.entrySet()) {
     viewScope.put(entry.getKey(), entry.getValue());
   }
 }
  public void testStartBookingFlow() {
    Booking booking = createTestBooking();

    EasyMock.expect(bookingService.createBooking(1L, "keith")).andReturn(booking);

    EasyMock.replay(bookingService);

    MutableAttributeMap input = new LocalAttributeMap();
    input.put("hotelId", "1");
    MockExternalContext context = new MockExternalContext();
    context.setCurrentUser("keith");
    startFlow(input, context);

    assertCurrentStateEquals("enterBookingDetails");
    assertResponseWrittenEquals("enterBookingDetails", context);
    assertTrue(getRequiredFlowAttribute("booking") instanceof Booking);

    EasyMock.verify(bookingService);
  }
 public void requestFlowDefinitionRedirect(String flowId, MutableAttributeMap<?> input)
     throws IllegalStateException {
   assertRedirectResponseAllowed();
   flowDefinitionRedirectFlowId = flowId;
   flowDefinitionRedirectFlowInput = new LocalAttributeMap<Object>();
   if (input != null) {
     flowDefinitionRedirectFlowInput.putAll(input);
   }
   recordResponseComplete();
 }
  @Test
  public void testEnterIdentityCard() throws Exception {
    MockExternalContext context = new MockExternalContext();

    when(hospitalManager.findAll()).thenReturn(new ArrayList<>());
    when(personService.isNewPerson(any(PersonObjectModel.class))).thenReturn(true);

    PersonObjectModel person = createMockPerson();
    MutableAttributeMap input = new LocalAttributeMap<>();
    input.put("person", person);

    startFlow(input, context);
    assertFlowExecutionActive();
    assertCurrentStateEquals(ENTER_PERSON_INFO);

    context.setEventId("next");
    resumeFlow(context);
    assertFlowExecutionActive();
    assertCurrentStateEquals(ENTER_IC_INFO);
  }
Esempio n. 6
0
 /**
  * Put csrf into scope.
  *
  * @param csrf the csrf
  * @param context the context
  */
 public static void putCsrfIntoScope(final Object csrf, final MutableAttributeMap context) {
   context.put("csrf", csrf);
 }
Esempio n. 7
0
 /**
  * Put oidc response into scope.
  *
  * @param response the response
  * @param context the context
  */
 public static void putOIDCResponseIntoScope(
     final OIDCResponse response, final MutableAttributeMap context) {
   context.put("oidcResponse", response);
 }
Esempio n. 8
0
 /**
  * Put authorization request into scope.
  *
  * @param authorizationRequest the authorization request
  * @param context the context
  */
 public static void putAuthorizationRequestIntoScope(
     final AuthorizationRequest authorizationRequest, final MutableAttributeMap context) {
   context.put("authorizationRequest", authorizationRequest);
 }
Esempio n. 9
0
 /**
  * Put post authorization attributes into scope.
  *
  * @param attributes the attributes
  * @param context the context
  */
 public static void putPostAuthorizationAttributesIntoScope(
     final Map attributes, final MutableAttributeMap context) {
   context.put("postAuthorizationAttributes", attributes);
 }