Examples of MockExternalContext


Examples of org.jboss.seam.mock.MockExternalContext

         Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
        
         // If a FacesContext isn't available, set one up
         if (FacesContext.getCurrentInstance() == null)
         {
            MockFacesContext mockFacesContext = new MockFacesContext(new MockExternalContext())
                     .setCurrent();
            mockFacesContext.createViewRoot();
         }
        
         FacesContext facesContext = FacesContext.getCurrentInstance();
View Full Code Here

Examples of org.jboss.seam.mock.MockExternalContext

      }
   }
  
   private MockFacesContext createFacesContext(HttpServletRequest request, HttpServletResponse response)
   {
      MockFacesContext mockFacesContext = new MockFacesContext( new MockExternalContext(getServletContext(), request, response), new MockApplication() );
      mockFacesContext.setViewRoot( new UIViewRoot() );
      return mockFacesContext;
   }
View Full Code Here

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

Examples of org.springframework.webflow.test.MockExternalContext

    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

Examples of org.springframework.webflow.test.MockExternalContext

    }

    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

Examples of org.springframework.webflow.test.MockExternalContext

  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

Examples of org.springframework.webflow.test.MockExternalContext

  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

Examples of org.springframework.webflow.test.MockExternalContext

  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

Examples of org.springframework.webflow.test.MockExternalContext

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

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

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

Examples of org.springframework.webflow.test.MockExternalContext

    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
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.