Examples of Booking


Examples of org.jboss.seam.example.jpa.Booking

         {
            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();
     
      new FacesRequest("/book.xhtml", id) {

         @Override
         protected void processValidations() throws Exception
         {
            validateValue("#{booking.creditCard}", "123");
            assert isValidationFailure();
         }

         @Override
         protected void renderResponse()
         {
            Iterator messages = FacesContext.getCurrentInstance().getMessages();
            assert messages.hasNext();
            assert ( (FacesMessage) messages.next() ).getSummary().equals("Credit card number must 16 digits long");
            assert !messages.hasNext();
            assert Manager.instance().isLongRunningConversation();
         }
        
         @Override
         protected void afterRequest()
         {
            assert !isInvokeApplicationBegun();
         }
        
      }.run();
     
      new FacesRequest("/book.xhtml", id) {

         @Override
         protected void processValidations() throws Exception
         {
            validateValue("#{booking.creditCardName}", "");
            assert isValidationFailure();
         }

         @Override
         protected void renderResponse()
         {
            Iterator messages = FacesContext.getCurrentInstance().getMessages();
            assert messages.hasNext();
            assert ( (FacesMessage) messages.next() ).getSummary().equals("Credit card name is required");
            assert !messages.hasNext();
            assert Manager.instance().isLongRunningConversation();
         }
        
         @Override
         protected void afterRequest()
         {
            assert !isInvokeApplicationBegun();
         }
        
      }.run();
     
      new FacesRequest("/book.xhtml", id) {
        
         @Override @SuppressWarnings("deprecation")
         protected void updateModelValues() throws Exception
        
            setValue("#{booking.creditCard}", "1234567891021234");
            setValue("#{booking.creditCardName}", "GAVIN KING");
            setValue("#{booking.beds}", 2);
            Date now = new Date();
            setValue("#{booking.checkinDate}", now);
            setValue("#{booking.checkoutDate}", now);
         }

         @Override
         protected void invokeApplication()
         {
            assert invokeAction("#{hotelBooking.setBookingDetails}")==null;
         }

         @Override
         protected void renderResponse()
         {
            Iterator messages = FacesContext.getCurrentInstance().getMessages();
            assert messages.hasNext();
            FacesMessage message = (FacesMessage) messages.next();
            assert message.getSummary().equals("Check out date must be later than check in date");
            assert !messages.hasNext();
            assert Manager.instance().isLongRunningConversation();
         }
        
         @Override
         protected void afterRequest()
         {
            assert isInvokeApplicationComplete();
         }
        
      }.run();
     
      new FacesRequest("/book.xhtml", id) {
        
         @Override @SuppressWarnings("deprecation")
         protected void updateModelValues() throws Exception
         {
            Calendar cal = Calendar.getInstance();
            cal.add(Calendar.DAY_OF_MONTH, 2);
            setValue("#{booking.checkoutDate}", cal.getTime() );
         }

         @Override
         protected void invokeApplication()
         {
            invokeAction("#{hotelBooking.setBookingDetails}");
         }

         @Override
         protected void renderResponse()
         {
            assert Manager.instance().isLongRunningConversation();
         }
        
         @Override
         protected void afterRequest()
         {
            assert isInvokeApplicationComplete();
         }
        
      }.run();
     
      new FacesRequest("/confirm.xhtml", id) {

         @Override
         protected void invokeApplication()
         {
            invokeAction("#{hotelBooking.confirm}");
         }
        
         @Override
         protected void afterRequest()
         {
            assert isInvokeApplicationComplete();
         }
        
      }.run();
     
      new NonFacesRequest("/main.xhtml") {

         @Override
         protected void renderResponse()
         {
            ListDataModel bookings = (ListDataModel) getInstance("bookings");
            assert bookings.getRowCount()==1;
            bookings.setRowIndex(0);
            Booking booking = (Booking) bookings.getRowData();
            assert booking.getHotel().getCity().equals("NY");
            assert booking.getUser().getUsername().equals("gavin");
            assert !Manager.instance().isLongRunningConversation();
         }
        
      }.run();
     
View Full Code Here

Examples of org.jboss.seam.example.spring.Booking

      protected void renderResponse() {
        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();

    new FacesRequest("/book.xhtml", id) {

      @Override
      @SuppressWarnings("deprecation")
      protected void updateModelValues() throws Exception {
        setValue("#{booking.creditCard}", "1234567891021234");
        setValue("#{booking.creditCardName}", "GAVIN KING");
        setValue("#{booking.beds}", 2);
        Date now = new Date();
        setValue("#{booking.checkinDate}", now);
        setValue("#{booking.checkoutDate}", now);
      }

      @Override
      protected void invokeApplication() {
        assert invokeAction("#{hotelBooking.setBookingDetails}") == null;
      }

      @Override
      protected void renderResponse() {
        Iterator messages = FacesContext.getCurrentInstance().getMessages();
        assert messages.hasNext();
        FacesMessage message = (FacesMessage) messages.next();
        assert message.getSummary().equals("Check out date must be later than check in date");
        assert !messages.hasNext();
        assert Manager.instance().isLongRunningConversation();
      }

      @Override
      protected void afterRequest() {
        assert isInvokeApplicationComplete();
      }

    }.run();

    new FacesRequest("/book.xhtml", id) {

      @Override
      @SuppressWarnings("deprecation")
      protected void updateModelValues() throws Exception {
        Calendar cal = Calendar.getInstance();
        cal.add(Calendar.DAY_OF_MONTH, 2);
        setValue("#{booking.checkoutDate}", cal.getTime());
      }

      @Override
      protected void invokeApplication() {
        invokeAction("#{hotelBooking.setBookingDetails}");
      }

      @Override
      protected void renderResponse() {
        assert Manager.instance().isLongRunningConversation();
      }

      @Override
      protected void afterRequest() {
        assert isInvokeApplicationComplete();
      }

    }.run();

    new FacesRequest("/confirm.xhtml", id) {

      @Override
      protected void invokeApplication() {
        invokeAction("#{hotelBooking.confirm}");
      }

      @Override
      protected void afterRequest() {
        assert isInvokeApplicationComplete();
      }

    }.run();

    new NonFacesRequest("/main.xhtml") {

      @Override
      protected void renderResponse() {
        ListDataModel bookings = (ListDataModel) getInstance("bookings");
        assert bookings.getRowCount() == 1;
        bookings.setRowIndex(0);
        Booking booking = (Booking) bookings.getRowData();
        assert booking.getHotel().getName().equals(HibernateTestService.HIBERNATE_HOTEL_NAME);
        assert booking.getUser().getUsername().equals("gavin");
      }

    }.run();
  }
View Full Code Here

Examples of org.jboss.seam.example.wicket.action.Booking

      {

         @Override
         protected void populateItem(Item item)
         {
            final Booking booking = (Booking) item.getModelObject();
            item.add(new Label("hotelName", booking.getHotel().getName()));
            item.add(new Label("hotelAddress", booking.getHotel().getAddress()));
            item.add(new Label("hotelCityStateCountry", booking.getHotel().getCity() + ", " + booking.getHotel().getState() + ", " + booking.getHotel().getState()));
            item.add(new Label("hotelCheckInDate", booking.getCheckinDate().toString()));
            item.add(new Label("hotelCheckOutDate", booking.getCheckoutDate().toString()));
            item.add(new Label("hotelConfirmationNumber", booking.getId().toString()));
            item.add(new Link("cancel")
            {

               @Override
               public void onClick()
View Full Code Here

Examples of org.jboss.seam.examples.booking.model.Booking

            log.hotelSelected(user != null ? user.getName() : "Anonymous", hotelSelection.getName(), hotelSelection.getCity());
        }
    }

    public void bookHotel() {
        booking = new Booking(hotelSelection, user, 7, 2);
        hotelSelection = null;

        // for demo convenience
        booking.setCreditCardNumber("1111222233334444");
        log.bookingInitiated(user.getName(), booking.getHotel().getName());
View Full Code Here

Examples of org.qi4j.sample.rental.domain.Booking

        {
            Document dom = context.dom();
            Element result = dom.createElementNS( Page.XHTML, "div" );
            String bookingId = context.path();
            UnitOfWork uow = uowf.currentUnitOfWork();
            Booking booking = uow.get( Booking.class, bookingId );
            Car car = booking.car().get();
            createChildNode( dom, result, car.model().get() );
            createChildNode( dom, result, car.licensePlate().get() );
            createChildNode( dom, result, car.category().get().name().get() );
            return result;
        }
View Full Code Here

Examples of org.sample.booking.models.Booking

  @View
  @Route("/hotels/{id}/booking")
  public Response.Content book(String id, @Mapped Booking booking) {
    Hotel hotel = Hotel.findById(id);
    if (booking == null) {
      booking = new Booking();
    }
    return book.with().hotel(hotel).booking(booking).ok();
  }
View Full Code Here

Examples of org.springframework.webflow.samples.booking.Booking

  executeSearch();
  return "reviewHotels";
    }

    public void cancelBookingListener(ActionEvent event) {
  Booking booking = (Booking) bookings.getRowData();
  bookingService.cancelBooking(booking);
  ((List) bookings.getWrappedData()).remove(booking);
    }
View Full Code Here

Examples of uk.org.woodcraft.bookings.datamodel.Booking

  }

  protected List<Object> renderRow(List<Method> reportedMethods, Object data) {
    List<Object> cells = new ArrayList<Object>();
   
    Booking b = (Booking) data;
    Village v = b.getVillage();
    if (v != null)
      cells.add(v.getName());
    else
      cells.add(null);
   
    cells.add(b.getUnit().getName());
    cells.add(b.getName());
   
    Diet d = b.getDiet();
    if (d != null)
      cells.add(b.getDiet().name());
    else
      cells.add(null);
   
    cells.add(b.getArrivalDate());
    cells.add(b.getDepartureDate());
    cells.add(b.getAgeGroup().name());
    cells.add(b.getOver18().toString());
   
    return cells;
  }
View Full Code Here

Examples of uk.org.woodcraft.bookings.datamodel.Booking

    Organisation testOrg = CannedQueries.orgByName(TestConstants.ORG1_NAME);
    Unit testUnit = CannedQueries.unitByName(TestConstants.UNIT1_NAME, testOrg);
   
    TestClock testClock = new TestClock(BasicVCampTestDataFixture.DATE_BEFORE_DEADLINE);
   
    Booking regularBooking = Booking.create(testUnit, vcamp, testClock);
    regularBooking.setArrivalDate(DateUtils.getDate(2013, 7, 3));
    regularBooking.setDepartureDate(DateUtils.getDate(2013, 7, 11));
    assertEquals("Regular bookings are 112", 112d, pricer.priceOf(regularBooking), 0);
   
    Booking bookingWithPreAndPostCamp = Booking.create(testUnit, vcamp, testClock);
    bookingWithPreAndPostCamp.setArrivalDate(DateUtils.getDate(2013, 6, 30));
    bookingWithPreAndPostCamp.setDepartureDate(DateUtils.getDate(2011, 7, 15));
    assertEquals("Bookings capped at 112 including pre and post camp", 112d, pricer.priceOf(bookingWithPreAndPostCamp), 0);
   
    Booking booking = Booking.create(testUnit, vcamp, testClock);
    booking.setArrivalDate(DateUtils.getDate(2013, 7, 3));
    booking.setDepartureDate(DateUtils.getDate(2013, 7, 4));
    assertEquals("1 night", 10 + 13d, pricer.priceOf(booking), 0);
   
    booking.setArrivalDate(DateUtils.getDate(2013, 7, 3));
    booking.setDepartureDate(DateUtils.getDate(2013, 7, 5));
    assertEquals("2 nights", 10d + (2*13), pricer.priceOf(booking), 0);

    booking.setArrivalDate(DateUtils.getDate(2013, 7, 3));
    booking.setDepartureDate(DateUtils.getDate(2013, 7, 10));
    assertEquals("7 nights", 101d, pricer.priceOf(booking), 0);
   
   
    Clock clockAfterDeadline = new TestClock(BasicVCampTestDataFixture.DATE_AFTER_DEADLINE_BEFORE_AMMENDMENT)
    Booking lateBooking = Booking.create(testUnit,vcamp, clockAfterDeadline);
    lateBooking.setArrivalDate(DateUtils.getDate(2013, 7, 3));
    lateBooking.setDepartureDate(DateUtils.getDate(2013, 7, 11));
    assertEquals("Bookings after the deadline cost more", 122, pricer.priceOf(lateBooking), 0);

    Clock clockAfterEventStart = new TestClock(BasicVCampTestDataFixture.VCAMP_START)
    Booking atEventBooking = Booking.create(testUnit,vcamp, clockAfterEventStart);
    atEventBooking.setArrivalDate(DateUtils.getDate(2013, 7, 3));
    atEventBooking.setDepartureDate(DateUtils.getDate(2013, 7, 11));
    assertEquals("Bookings made at camp cost even more", 142, pricer.priceOf(atEventBooking), 0);

   
    Booking lateUpdatedBooking = Booking.create(testUnit,vcamp, testClock);
    lateUpdatedBooking.setArrivalDate(DateUtils.getDate(2013, 7, 3));
    lateUpdatedBooking.setDepartureDate(DateUtils.getDate(2013, 7, 11));
    lateUpdatedBooking.setBookingUnlockDate(BasicVCampTestDataFixture.DATE_AFTER_AMMENDMENT_DEADLINE)
    assertEquals("Bookings unlocked for updating after the amendment deadline cost more", 117d, pricer.priceOf(lateUpdatedBooking), 0);
   
   
   
   
    Booking woodchipBooking = Booking.create(testUnit, vcamp, testClock);
    woodchipBooking.setArrivalDate(DateUtils.getDate(2013, 7, 3));
    woodchipBooking.setDepartureDate(DateUtils.getDate(2013, 7, 11));
    woodchipBooking.setDob(DateUtils.getDate(2007, 7, 3)); // Earliest possible date to be 5 at start of camp
    assertEquals("Elfins are not free", 112d, pricer.priceOf(woodchipBooking), 0);
   
    woodchipBooking.setDob(DateUtils.getDate(2007, 7, 4)); // Latest possible date to be 4 at start of camp
    assertEquals("Woodchips are free", 0d, pricer.priceOf(woodchipBooking), 0);
   
    Booking missingDOBBooking = Booking.create(testUnit, vcamp, testClock);
    missingDOBBooking.setDob(null);
    assertEquals("Those without a DOB are regular price", 112d, pricer.priceOf(missingDOBBooking), 0);
   
    woodchipBooking.setBookingCreationDate(BasicVCampTestDataFixture.DATE_AFTER_DEADLINE_BEFORE_AMMENDMENT);
    assertEquals("Late woodchip bookings have an admin fee", 10d, pricer.priceOf(woodchipBooking), 0)

View Full Code Here

Examples of uk.org.woodcraft.bookings.datamodel.Booking

    Organisation testOrg = CannedQueries.orgByName(TestConstants.ORG1_NAME);
    Unit testUnit = CannedQueries.unitByName(TestConstants.UNIT1_NAME, testOrg);
   
    TestClock testClock = new TestClock(BasicVCampTestDataFixture.DATE_BEFORE_DEADLINE);
   
    Booking regularBooking = Booking.create(testUnit, vcamp, testClock);
    regularBooking.setArrivalDate(DateUtils.getDate(2013, 7, 3));
    regularBooking.setDepartureDate(DateUtils.getDate(2013, 7, 11));
    assertEquals("Regular bookings are 112", 112d, pricer.priceOf(regularBooking), 0);
   
    regularBooking.setCancellationDate(BasicVCampTestDataFixture.DATE_BEFORE_DEADLINE);
    assertEquals("Cancelled bookings before the deadline are �0", 0d, pricer.priceOf(regularBooking), 0);

    regularBooking.setCancellationDate(BasicVCampTestDataFixture.DATE_AFTER_DEADLINE_BEFORE_AMMENDMENT);
    assertEquals("Cancelled bookings after the deadline are �50", 50d, pricer.priceOf(regularBooking), 0);
   
    regularBooking.setArrivalDate(DateUtils.getDate(2013, 7, 3));
    regularBooking.setDepartureDate(DateUtils.getDate(2013, 7, 4));
    assertEquals("Cancelled bookings which cost less than �50 are capped at their cost if cancelled after the deadline", 10d + 13, pricer.priceOf(regularBooking), 0);
   
    Booking woodchipBooking = Booking.create(testUnit, vcamp, testClock);
    woodchipBooking.setArrivalDate(DateUtils.getDate(2013, 7, 3));
    woodchipBooking.setDepartureDate(DateUtils.getDate(2013, 7, 11))
    woodchipBooking.setDob(DateUtils.getDate(2007, 7, 4)); // Latest possible date to be 5 at start of camp
    assertEquals("Woodchips are free", 0d, pricer.priceOf(woodchipBooking), 0);
   
    woodchipBooking.setCancellationDate(BasicVCampTestDataFixture.DATE_BEFORE_DEADLINE);
    assertEquals("Cancelled woodchip bookings before the deadline are free", 0d, pricer.priceOf(woodchipBooking), 0);
   
    woodchipBooking.setCancellationDate(BasicVCampTestDataFixture.DATE_AFTER_DEADLINE_BEFORE_AMMENDMENT);
    assertEquals("Woodchip bookings made before the deadline and cancelled after the deadline are �0", 0d, pricer.priceOf(woodchipBooking), 0);
   
    woodchipBooking.setBookingCreationDate(BasicVCampTestDataFixture.DATE_AFTER_DEADLINE_BEFORE_AMMENDMENT);
    assertEquals("Woodchip bookings made after the deadline (hence �10) and cancelled after the deadline are �10", 10d, pricer.priceOf(woodchipBooking), 0);
   
    woodchipBooking.setBookingCreationDate(BasicVCampTestDataFixture.DATE_AFTER_EVENT_START);
    assertEquals("Woodchip bookings made after the start of camp (hence �30) and cancelled after the start of camp are �30", 30d, pricer.priceOf(woodchipBooking), 0);
  }
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.