These are the tasks for the very difficult coding challenge.
Check out the source code from this git repository:
https://github.com/reiz/analytics_ms-0
Take a look at the project and install all the dependencies with the package manager which is used in the project.
Create meta files for your desired IDE through the package manager.
Open the project in your favorite IDE. Your favorite IDE is either Eclipse or IntelliJ IDEA.
Compile the project with mvn. If it doesn't compile, fix it!
Package the project into a JAR file, without running the tests.
Run the JAR file. If the application doesn't come up correctly, fix it!
The application has a dependency to MongoDB. Make sure that a MongoDB instance is running. If that is not the case, you can start a MongoBD Docker Container with this command:
docker run --name mongodb -p 27017:27017 -p 28017:28017 -d versioneye/mongodb:3.4.6
You don't have to use MongoDB in Docker. If you have MongoDB already installed natively,
you can use that installation as well.
After you fixed the application and make it run successfully,
you can reach it in the browser under http://localhost:8080
.
There are 2 Endpoints available:
http://localhost:8080/logs
http://localhost:8080/logs/count
Add another Endpoint which is available under http://localhost:8080/logs/
through HTTP POST.
The Endpoint should accept a JSON payload in the HTTP Body, build a Log
Model out of it
and create a new entry in the database. In the case of success, this Endpoint should return the newly created ID
of the submitted Entity.
You can use Postman to build and fire an HTTP POST Request.
Add another Endpoint which is available under http://localhost:8080/logs/{id}
.
The last part should be the primary ID of the Log entity in the database.
The Endpoint should load the corresponding object from the database and
return it's JSON representation via HTTP Response.
Build another Endpoint which alows the manipulation of an existing Entity. Choose the URI path by yourself and follow the best practices of REST APIs.
There is a class ScheduledTask
with the method runBackgroundJob()
.
Configure the application that way, that the method is executed every 5 seconds in the background.
Build a Docker image with the application in it and call it liveperson/spring:0.0.1
.
Run the Docker container that way that the application is available under http://localhost:8080
on the Host system.