MyRetail RESTful service provides the API to:
- Retrieve Product information from multiple sources by Product Id.
- Modify the price information in the NoSQL database.
- Java 8 installed
- Maven 3 installed
- Git Client Intalled
- SoapUI/Any REST Client
- Spring Boot - https://projects.spring.io/spring-boot/
- Amazon DynamoDB - https://aws.amazon.com/dynamodb/
- Maven - https://maven.apache.org/
- Clone The Repository from Git Hub to a local workstation -- git clone https://github.com/pnamburi/myRetail-RESTFul-service.git
- Open Command Prompt/Terminal and Change Directory Location to the project directory -- cd /myRetail-RESTFul-service
- Build the project using Maven - mvn clean install
- Setup and run Local DynamoDB database -- mvn exec:java -Dexec.mainClass="com.myretail.product.config.SetupLocalDynamoDB" -Dexec.classpathScope="test" -Psetup-db
- Note: The DinamoDB service keep printing the message "18:06:00.431 [pool-4-thread-3] DEBUG com.amazonaws.services.dynamodbv2.local.shared.access.sqlite.SQLiteDBAccess - SELECT TableName, TableInfo FROM dm;", just ignore that and keep the service running
- Open another Command Prompt/Terminal and Change Directory Location to the project directory -- cd <WORKSTATION_PATH>/myRetail-RESTFul-service
- Run the Spring boot app with the jar create from Maven install in Step 3 -- java -jar -Dspring.profiles.active=local target/myRetail-RESTFul-service-1.0.0-SNAPSHOT.jar
- Test the get product API from the browser -- http://localhost:8080/products/13860428
- Test the update product API with SOAP UI or any REST client --- http://localhost:8080/products/13860428 -- JSON Input : { "id": 13860428, "name": "The Big Lebowski (Blu-ray)", "current_price": { "value": 17.44, "currency_code": "USD" }}
- Additionally import the sample SoapUI project located in test resources directory for Integration testing(Can be Automated) -- <WORKSTATION_PATH>/myRetail-RESTFul-service/src/test/resources.
- Setup Amazon DunamoDB credentials as described in the developer huide https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/CodeSamples.Java.html#CodeSamples.Java.Credentials
- Copy/deploy the release build project jar to the production servers
- Run the Spring boot application from the jar create -- java -jar -Dspring.profiles.active=prod <JAR_LOCATION>/myRetail-RESTFul-service-1.0.0-RELEASE.jar
curl -X GET --header 'Accept: application/json' 'http://localhost:8080/products/13860428'
{"id":13860428,"name":"The Big Lebowski (Blu-ray)","current_price":{"value":17.44,"currency_code":"USD"}}
curl -X PUT --header 'Content-Type: application/json' --header 'Accept: application/json' -d '{"id":13860428,"name":"The Big Lebowski (Blu-ray) (Widescreen)","current_price":{"value": 14.99,"currency_code":"USD"}} \ ' 'http://localhost:8080/products/13860428'
Empty Response with HTTP 200 success code