Package org.springframework.webflow.test

Examples of org.springframework.webflow.test.MockExternalContext


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


    public void testEnterBookingDetails_Proceed() {
  setCurrentState("enterBookingDetails");
  getFlowScope().put("booking", createTestBooking());

  MockExternalContext context = new MockExternalContext();
  context.setEventId("proceed");
  resumeFlow(context);

  assertCurrentStateEquals("reviewBooking");
  assertResponseWrittenEquals("reviewBooking", context);
    }
View Full Code Here

    }

    public void testReviewBooking_Confirm() {
  setCurrentState("reviewBooking");
  getFlowScope().put("booking", createTestBooking());
  MockExternalContext context = new MockExternalContext();
  context.setEventId("confirm");
  resumeFlow(context);
  assertFlowExecutionEnded();
  assertFlowExecutionOutcomeEquals("bookingConfirmed");
    }
View Full Code Here

  List<Booking> bookings = new ArrayList<Booking>();
  bookings.add(new Booking(new Hotel(), new User("keith", "password", "Keith Donald")));
  EasyMock.expect(bookingService.findBookings("keith")).andReturn(bookings);
  EasyMock.replay(bookingService);

  MockExternalContext context = new MockExternalContext();
  context.setCurrentUser("keith");
  startFlow(context);
  assertCurrentStateEquals("enterSearchCriteria");
  assertResponseWrittenEquals("enterSearchCriteria", context);
  assertTrue(getRequiredFlowAttribute("searchCriteria") instanceof SearchCriteria);
  assertTrue(getRequiredViewAttribute("bookings") instanceof DataModel);
View Full Code Here

  List<Hotel> hotels = new ArrayList<Hotel>();
  hotels.add(new Hotel());
  EasyMock.expect(bookingService.findHotels(criteria)).andReturn(hotels);
  EasyMock.replay(bookingService);

  MockExternalContext context = new MockExternalContext();
  context.setEventId("search");
  resumeFlow(context);

  EasyMock.verify(bookingService);

  assertCurrentStateEquals("reviewHotels");
View Full Code Here

  hotels.add(hotel);
  OneSelectionTrackingListDataModel dataModel = new OneSelectionTrackingListDataModel(hotels);
  dataModel.select(hotel);
  getViewScope().put("hotels", dataModel);

  MockExternalContext context = new MockExternalContext();
  context.setEventId("select");
  resumeFlow(context);

  assertCurrentStateEquals("reviewHotel");
  assertNull(getFlowAttribute("hotels"));
  assertSame(hotel, getFlowAttribute("hotel"));
View Full Code Here

      }
  });
  new EndState(mockBookingFlow, "bookingConfirmed");
  getFlowDefinitionRegistry().registerFlowDefinition(mockBookingFlow);

  MockExternalContext context = new MockExternalContext();
  context.setEventId("book");
  resumeFlow(context);

  assertFlowExecutionEnded();
  assertFlowExecutionOutcomeEquals("finish");
    }
View Full Code Here

    factory.setExecutionListenerLoader(new StaticFlowExecutionListenerLoader(hibernateListener));
    flowExecution = factory.createFlowExecution(flow);
  }

  public void testFlowWithSubflow() {
    MockExternalContext context = new MockExternalContext();
    flowExecution.start(null, context);
    context.setEventId("subflow");
    flowExecution.resume(context);
    context.setEventId("finish");
    flowExecution.resume(context);
  }
View Full Code Here

    context.setEventId("finish");
    flowExecution.resume(context);
  }

  public void testManagedFlowWithUnmanagedSubflow() {
    MockExternalContext context = new MockExternalContext();
    flowExecution.start(null, context);
    context.setEventId("notmanaged");
    flowExecution.resume(context);
  }
View Full Code Here

    factory.setExecutionListenerLoader(new StaticFlowExecutionListenerLoader(jpaListener));
    flowExecution = factory.createFlowExecution(flow);
  }

  public void testManagedFlowWithManagedSubflow() {
    MockExternalContext context = new MockExternalContext();
    flowExecution.start(null, context);
    context.setEventId("subflow");
    flowExecution.resume(context);
    context.setEventId("finish");
    flowExecution.resume(context);
  }
View Full Code Here

TOP

Related Classes of org.springframework.webflow.test.MockExternalContext

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.