This service stores entities defined as:
- customerId -> int
- externalId -> string
- createdAt -> date
It expose two endpoints with a POST and GET operations.
-
POST endpoint take as parameter the
customerId
and thecreatedAt
, store it in a in-memory database pairing it with an externalId. TheexternalId
is generated the service itself. The date is expected to be valid with formatyyyy-mm-dd
and can't be in the future. -
GET endpoint returns the
externalId
of a givencustomerId
mvn clean package
You can execute both junit tests than integration tests by:
mvn clean test
After the project is built you can run it locally:
java -jar target/customer-mapper-service-0.0.1-SNAPSHOT.jar
Alternatively you can use the Spring Boot Maven plugin like so:
mvn spring-boot:run
You can access and use the api easily by the swagger once the service is running
mvn spring-boot:run
http://localhost:8080/swagger-ui/index.html#
If you want run it in Docker you can build the image and then run it
docker build -t customer-mapper-service .
docker run -it --rm -p8080:8080 customer-mapper-service
http://localhost:8080/swagger-ui/index.html#