0 Replies Latest reply on Apr 15, 2009 6:30 PM by dcernahoschi

    SeamTest bug - visible with the booking example application

    dcernahoschi

      I've tried to run the TestNG tests that come together with the classic booking application. It seems that the renderResponse() method is not invoked for all FacesRequest objects.


      For example in the BookingTest class.


      
      String id = new FacesRequest("/main.xhtml") {
               
               @Override
               protected void invokeApplication() throws Exception {
                  HotelBooking hotelBooking = (HotelBooking) getInstance("hotelBooking");
                  DataModel hotels = (DataModel) Contexts.getSessionContext().get("hotels");
                  assert hotels.getRowCount()==1;
                  hotelBooking.selectHotel( (Hotel) hotels.getRowData() );
               }
      
               @Override
               protected void renderResponse()
               {
               System.out.println(">>> is really renderResponse running ? -- from main <<<");
                  Hotel hotel = (Hotel) Contexts.getConversationContext().get("hotel");
                  assert hotel.getCity().equals("NY");
                  assert hotel.getZip().equals("10011");
                  assert Manager.instance().isLongRunningConversation();
               }
               
            }.run();
      
      



      The above method is invoked.


      
      id = new FacesRequest("/hotel.xhtml", id) {
      
               @Override
               protected void invokeApplication()
               {
                  invokeAction("#{hotelBooking.bookHotel}");
               }
      
               @Override
               protected void renderResponse()
               {
               System.out.println(">>> is really renderResponse running ? -- from hotel <<<");
                  assert getValue("#{booking.user}")!=null;
                  assert getValue("#{booking.hotel}")!=null;
                  assert getValue("#{booking.creditCard}")==null;
                  assert getValue("#{booking.creditCardName}")==null;
                  Booking booking = (Booking) Contexts.getConversationContext().get("booking");
                  assert booking.getHotel()==Contexts.getConversationContext().get("hotel");
                  assert booking.getUser()==Contexts.getSessionContext().get("user");
                  assert Manager.instance().isLongRunningConversation();
               }
               
            }.run()
      
      



      But the one above is not invoked.


      It seems to me that the way the action is invoked makes the difference.


      Thank you.