-
Notifications
You must be signed in to change notification settings - Fork 2
Lab Assignment 8: Cloud Rest App
Class Id: 8
Student Id: 16234180
Student Name: Moulika Chadalavada
The main aim of this tutorial is to develop a application with atleast two REST Service using Tomcat Server. Testing of the application is done using JUNIT. This application is used to fetch latitude & longitude from Address and Address from Latitude & Longitude.
Eclipse,Java,WebStorm,JSP,HTML,CSS,Bootstrap,Tomcat Server,Mongo DB
Implemented 2 Rest Services to fetch Address from Latitude&Longitude and Latitude&Longitude from Address.The GUI is created in Webstrom where the Address/Latitude & Longitude is given to fetch respective details. Initially the GUI screen is displayed as below.
If the address is entered in the text field and clicks on **Get Latitude Longitude**, then the REST service is invoked using below link and based on address Latitude and Longitude is fetched by invoking **AddressConverter** class.
$http.get("http://localhost:8091/RESTExample/restexample/AddressConverter/"+h);
In AddressConverter class using below link Google Maps API is invoked and the JSON is fetched, and using ObjectMapper the JSON file is read and latitude and longitude is fetched.
maps.googleapis.com/maps/api/geocode/json?address=University of Missouri Kansas City&sensor=true
Screen that shows how Google Maps API is invoked

Screen that shows the JSON file of Google API

Screen that shows how latitude and longitude is passed to JSON Object

$scope.cal={"address":data.address,"latitude":data.latitude,"location":data.location, "longitude":data.longitude};
Screen that displays latitude and longitude from address

If the latitude and longitude is entered in the text field and clicks on **Get Address**, then the REST service is invoked using below link and based on address Latitude and Longitude is fetched by invoking **LatLngConverter** class.
$http.get("http://localhost:8091/RESTExample/restexample/LatLngConverter/"+lat+"/"+lng);
In LatLngConverter class using below link Google Maps API is invoked and the JSON is fetched, and using ObjectMapper the JSON file is read and address is fetched.
maps.googleapis.com/maps/api/geocode/json?latlng=28.6353080,77.2249600&sensor=true
Screen that shows how Google Maps API invocation and JSON parsing

Screen that shows the JSON file of Google API

$scope.cal={"address":data.address,"latitude":data.latitude,"location":data.location, "longitude":data.longitude};
Screen that displays latitude and longitude from address

In CalculateTest.java the expected values are given and the logic class file is invoked from where for given address latitude and longitude is fetched. Using assertEquals() the given and extracted values are compared & results are displayed.
JUNIT failure scenario for Address to Lat & Long

JUNIT success scenario which gives Lat & Long for given Address

JUNIT success scenario which gives Address for Lat & Long

https://github.com/cmoulika009/ASE-Lab-Assignments/wiki/MONGO-CRUD-OPERATIONS
ASE Tutorial 8