/** * 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()); } }
@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); }
@Ignore public void testAddNewHospital() 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); input.put("hospital", person.getHospital()); startFlow(input, context); assertFlowExecutionActive(); assertCurrentStateEquals(ENTER_PERSON_INFO); context.setEventId("addHospital"); resumeFlow(context); assertFlowExecutionActive(); assertCurrentStateEquals(NEW_HOSPITAL); }
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); }
/** * 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); }
/** * 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); }
/** * 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); }
/** * 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); }