Package com.ean.wsapi.hotel.v3

Examples of com.ean.wsapi.hotel.v3.HotelServicesImplService


     *                        will be contained within this object. See our
     *                        exceptions overview for details on this object.
     */
    public final S call() throws EanWsException {
        S response = response();
        final EanWsError error = response.getEanWsError();
        if (error == null) {
            return response;
        } else {
            throw new EanWsException(error);
        }
View Full Code Here


                    .locale(LocaleType.EN_US)
                    .customer(uuid, uuid, uuid)
                    .call();
        } catch (EanWsException fault) {
            // CHECK ERROR MESSAGE PROPERTIES
            final EanWsError error = fault.getError();
            assertThat("Itinerary IDs should be the same.",
                    error.getItineraryId(), is(equalTo((long) -1)));
            assertThat("Error handling behaviours should be the same.",
                    error.getHandling(), is(equalTo(ErrorHandling.RECOVERABLE)));
            assertThat("Error categories should be the same.",
                    error.getCategory(),
                    is(equalTo(ErrorCategory.DATA_VALIDATION)));
            assertThat("Exception condition IDs should be the same.",
                    error.getExceptionConditionId(), is(equalTo(-1)));
            final String message = "Data in this request could not be validated: "
                    + "Specified city could not be resolved as valid location.";
            assertThat("Presentation messages should be the same.",
                    error.getPresentationMessage(), is(equalTo(message)));
            assertThat("Verbose messages should be the same.",
                    error.getVerboseMessage(), is(equalTo(message)));

            // SERVER INFO ATTRIBUTES
            final ServerInfo info = error.getServerInfo();
            assertThat("Server time should not be empty.",
                    info.getServerTime(), is(notNullValue()));
            assertThat("Timestamp should not be empty.",
                    info.getTimestamp(), is(notNullValue()));
            assertThat("Server instance should not be empty.",
View Full Code Here

    /**
     * An empty constructor with request initialization.
     */
    public GetHotelListBuilder() {
        request = new HotelListRequest();
        baseHotelInit(request);
    }
View Full Code Here

     * Verify that api key was converted.
     */
    @Test
    public void shouldBuildStringWithApiKey()
            throws UnsupportedEncodingException {
        final HotelListRequest request = new HotelListRequest();
        request.setApiKey("apiKey");
        final StringBuilder builder = new StringBuilder();
        JsonFormBodyWriter.writeTo(request.getClass(), request, builder);
        assertThat("Result strings should be the same.",
                builder.toString(), is(equalTo("&apiKey=apiKey&cid=0")));
    }
View Full Code Here

     * Verify that locale was converted correctly.
     */
    @Test
    public void shouldBuildStringWithLocale()
            throws UnsupportedEncodingException {
        final HotelListRequest request = new HotelListRequest();
        request.setLocale(LocaleType.EN_US);
        final StringBuilder builder = new StringBuilder();
        JsonFormBodyWriter.writeTo(request.getClass(), request, builder);
        assertThat("Result strings should be the same.",
                builder.toString(), is(equalTo("&cid=0&locale=en_US")));
    }
View Full Code Here

     * for the number of children - each age value is assumed to belong to
     * a child.
     */
    @Test
    public void shouldBuildStringWithRoomFormatForREST() {
        final HotelListRequest request = new HotelListRequest();
        final RoomGroup group = new RoomGroup();
        request.setRoomGroup(group);

        final Room room1 = new Room();
        room1.setNumberOfAdults(1);
        group.getRoom().add(room1);

        final StringBuilder builder1 = new StringBuilder();
        JsonFormBodyWriter.writeTo(request.getClass(), request, builder1);
        assertThat("Result strings should be the same.",
                builder1.toString(), is(equalTo("&cid=0&room1=1")));

        final Room room2 = new Room();
        room2.setNumberOfAdults(2);
        room2.setNumberOfChildren(2);
        room2.getChildAges().add(5);
        room2.getChildAges().add(12);
        group.getRoom().add(room2);

        final StringBuilder builder2 = new StringBuilder();
        JsonFormBodyWriter.writeTo(request.getClass(), request, builder2);
        assertThat("Result strings should be the same.",
                builder2.toString(),
                is(equalTo("&cid=0&room1=1&room2=2,5,12")));

    }
View Full Code Here

     * Verify that array was converted.
     */
    @Test
    public void shouldBuildStringWithArray()
            throws UnsupportedEncodingException {
        final HotelListRequest request = new HotelListRequest();
        request.getHotelIdList().add((long) 1);
        request.getHotelIdList().add((long) 2);
        final StringBuilder builder = new StringBuilder();
        JsonFormBodyWriter.writeTo(request.getClass(), request, builder);
        assertThat("Result strings should be the same.",
                builder.toString(), is(equalTo("&cid=0&hotelIdList=1,2,")));
    }
View Full Code Here

        calendar.add(Calendar.DATE, 1);
        final Date afterTomorrow = calendar.getTime();

        final DateFormat format = new SimpleDateFormat("MM/dd/YYYY");

        final HotelListResponse response =
                Expedia.getHotelList()
                        .locale(LocaleType.EN_US)
                        .currency("USD")
                        .customer(uuid, uuid, uuid)
                        .dates(
                                format.format(tomorrow),
                                format.format(afterTomorrow))
                        .room(1)
                        .search("Kiev", null, null)
                        .numberOfResults(20)
                        .include(false, false)
                        .call();

        assertThat("Customer session IDs should be the same.",
                response.getCustomerSessionId(), is(equalTo(uuid)));
        assertThat("Hotel list should exists.",
                response.getHotelList(), is(notNullValue()));
        assertThat("Hotel summary should exists.",
                response.getHotelList().getHotelSummary().size(),
                is(greaterThan(5)));
    }
View Full Code Here

        calendar.add(Calendar.DATE, 1);
        final Date afterTomorrow = calendar.getTime();

        final DateFormat format = new SimpleDateFormat("MM/dd/YYYY");

        final HotelListResponse response =
                Expedia.getHotelList()
                        .locale(LocaleType.EN_US)
                        .currency("USD")
                        .customer(uuid, uuid, uuid)
                        .dates(
                                format.format(tomorrow),
                                format.format(afterTomorrow))
                        .room(1)
                        .searchByDestination("Kiev,UA")
                        .numberOfResults(20)
                        .include(false, false)
                        .call();

        assertThat("Customer session IDs should be the same.",
                response.getCustomerSessionId(), is(equalTo(uuid)));
        assertThat("Hotel list should exists.",
                response.getHotelList(), is(notNullValue()));
        assertThat("Hotel summary should exists.",
                response.getHotelList().getHotelSummary().size(),
                is(greaterThan(5)));
    }
View Full Code Here

        calendar.add(Calendar.DATE, 1);
        final Date afterTomorrow = calendar.getTime();

        final DateFormat format = new SimpleDateFormat("MM/dd/YYYY");

        final HotelListResponse response =
                Expedia.getHotelList()
                        .locale(LocaleType.EN_US)
                        .currency("USD")
                        .customer(uuid, uuid, uuid)
                        .dates(
                                format.format(tomorrow),
                                format.format(afterTomorrow))
                        .room(1)
                        .searchById("47CC53D2-98A6-486B-8106-8783749CA665")
                        .numberOfResults(20)
                        .include(false, false)
                        .call();

        assertThat("Customer session IDs should be the same.",
                response.getCustomerSessionId(), is(equalTo(uuid)));
        assertThat("Hotel list should exists.",
                response.getHotelList(), is(notNullValue()));
        assertThat("Hotel summary should exists.",
                response.getHotelList().getHotelSummary().size(),
                is(greaterThan(5)));
    }
View Full Code Here

TOP

Related Classes of com.ean.wsapi.hotel.v3.HotelServicesImplService

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.