Lab 9

RestAPI client testing of backend services

Lab Goal

To test all backend integration services with RestAPI call through web client and determine if travel bookings are receiving hotel, car, flight and discounts.

ARCHITECTURE

RestAPI client testing of backend services

TESTING INTEGRATION

You finished the setup of OpenShift Container Platform, then built and deployed the backend consisting of Hotel, Flights, Cars, Discount Rules and Integration services. The final check is to make sure the integration endpoint is available and processing the services correctly.

This requires the use of a REST client, for example in the lab images here, it will be done from the Firefox browser using a plugin called RESTClient. You may use your own or install the same one.

INTEGRATION ENDPOINT

  • The integration endpoint is used to query the Destinasia backend systems only produces results if it receives a REST query that it expects, but is available here:

    • http://fusetravelagency-appdev-in-cloud.192.168.99.100.nip.io/rest/book


  • To test the services you can push the payload (request) to this endpoint, which is provided on the next slide.

INTEGRATION PAYLOAD

  • The payload to be put into your REST client (red text only):

    • Method: POST
    • Header: Content-Type application/json
    • URL: http://fusetravelagency-appdev-in-cloud.192.168.99.100.nip.io/rest/book
    • Body: {"flightReq":{"flightFrom":"SIN","flightTo":"PEK","flightDate":"03/08/2017","flightPassengers":2,"flightNo":"SIN22"},"hotelReq":{"hotelArrivalDate":"03/08/2017","hotelNights":33,"hotelCity":"PEK","hotelId":"Marriott"},"carReq":{"carCity":"PEK","carRentalCo":"Hertz","carType":"Econ","carStartDate":"03/08/2017","carDays":33}}

REST CLIENT URL

Install or use your own REST Client, starting by selecting the Method and URL:

  • Method: POST
  • URL: http://fusetravelagency-appdev-in-cloud.192.168.99.100.nip.io/rest/book

REST CLIENT HEADERS

Insert this Header:

  • Header: Content-Type application/json

REST CLIENT BODY

Insert this Body, ensure there are no line feed (returns):

  • Body: {"flightReq":{"flightFrom":"SIN","flightTo":"PEK","flightDate":"03/08/2017","flightPassengers":2,"flightNo":"SIN22"},"hotelReq":{"hotelArrivalDate":"03/08/2017","hotelNights":33,"hotelCity":"PEK","hotelId":"Marriott"},"carReq":{"carCity":"PEK","carRentalCo":"Hertz","carType":"Econ","carStartDate":"03/08/2017","carDays":33}}

REST CLIENT RESULTS

Submit the request via the Save button and examine the Response Body:

Flight, hotel and car backend services are working. Next up, testing discount rules by changing the car information.

REST CLIENT DISCOUNTS

In the Body, modify the carRentalCo to anything other than Hertz:

Send the request and see next slide to verify if the discount changes in the Response Body

REST CLIENT TESTED

Did the car company discount response change from 15 for HERTZ to 0 for any others?

DESTINASIA SERVICES HERO

You are now the hero of the development team for delivering the Cloud hosted containerized application services for end-to-end testing. Everyone is very happy with the automation and repeatability for installing OpenShift Container Platform (OCP), JBoss Enterprise Application Platform (EAP), JBoss Business Rules Management System (BRMS), several containerized web services and test the end-to-end solution using a REST client.

Time to take a well deserved break...

END LAB 9

QUESTIONS?

Eric D. Schabell
Portfolio Architect Director
@ericschabell
http://schabell.org

BACK TO WORKSHOPS


Head back to workshops...