-
- Install Java if it's not installed on your system.
-
Download the project from GitHub (click the Green "Clone or download" button on the right, and download as a ZIP)
-
Download Postman
-
Import the 2 folders (currency-conversion-service and currency-exchange-service) into Eclipse.
- File -> Import -> Maven -> Existing Maven Project -> Select one of the folders, and repeat for the other one.
-
Once imported, right click currency-conversion-service and in the menu:
- Properties -> Java Build Path -> Libraries tab -> Add External JARs -> json-simple-1.1.1.jar
Once the 2 folders are imported as Maven projects into Eclipse
-
Go into the
currency-exchange-service
folder - src/main/java - expand all folders inside- Look for the
CurrencyExchangeServiceApplication.java
file. - Right click that -> Run As -> Java Application
- Look for the
-
Go into the currency-conversion-service folder - src/main/java - expand all folders inside
- Look for the
CurrencyConversionServiceApplication.java
file. - Right click that -> Run As -> Java Application.
- Look for the
-
Accept any Windows Firewall prompts you get. Now the webservice should be up and running.
-
Open Postman. You'll need an account, but you can use your Google account to sign up.
-
Now you can issue GET and POST requests. The database of currency exchange values is already populated. Below are some sample requests with some input that you can use. To perform a currency conversion, Postman should already be set to GET requests (a GET button next to the request box). Enter the following lines into the text box and press Send (one at a time)
- http://localhost:8100/currency-converter/from/USD/to/INR/quantity/900
- http://localhost:8100/currency-converter/from/EUR/to/INR/quantity/45
- http://localhost:8100/currency-converter/from/AUD/to/EUR/quantity/70
These 3 examples should be enough for a demo
-
Now, you can make POST requests to save the user's input so far, as well as the output they received. This will get logged under "log_vX.json" file in the
currency-conversion-service
folder. To do this, make sure Postman is set to POST (change the GET button to POST) and enter the following request:Now all the requests made so far, along with their output, are stored into the JSON file.
There are 2 changes to make to move to version 1.
We want to introduce a small logical bug in CurrencyConversionController.java
, and update the version number in CurrencyConversionServiceApplication.java
-
In
CurrencyConversionController.java
, comment out line 59 (underv0 code
) and un-comment line 61 (underv1 code
). This is the bug. -
In
CurrencyConversionServiceApplication.java
, change line 16 tocontroller.currentVersion = 1;
Save both files. The program should automatically reload and run the previous input/output against the current version, and report on any discrepancies.