This is a Java implementation of the movies exercise.
movies-java
was created with educational purposes, to be used as a resource for this meetup: How to build, test and deploy a microservice?
To install the movies microservice just follow these 4 simple steps:
- git clone git@github.com:julianespinel/movies.git
- cd movies-java/scripts
- sh build.sh
- sh start-develop.sh
- sh create-movies.sh
cd movies-java/scripts
sh build.sh
cd movies-java/target/sites/jacoco/
- Open file
index.html
To check if the the microservice is up and running go to http://localhost:9001/movies/admin/ping
.
If you receive pong
as response then it is running.
With the movies microservice you are able to execute the following acitons:
- Create a movie
- Find a specific movie
- Find a set of movies
- Update a movie
- Delete a movie
Each API call is specified below:
Request
Method: GET
URL: http://localhost:9001/movies/admin/ping
Response
pong
Request
Method: POST
URL: http://localhost:9001/movies/api/movies
Body:
{
"imdbId": "tt0133093",
"title": "The Matrix",
"runtimeInMinutes": 136,
"releaseDate": "1999-03-31T00:00",
"filmRating": "R",
"genre": "Action, Sci-Fi",
"director": "The Wachowski brothers",
"plot": "A computer hacker learns from mysterious rebels about the true nature of his reality and his role in the war against its controllers.",
"metascore": 73,
"imdbRating": 8.7,
"imdbVotes": 1023621
}
Response
{
"imdbId": "tt0133093"
}
Request
Method: GET
URL: http://localhost:9001/movies/api/movies/tt0133093
Response
{
"imdbId": "tt0133093",
"title": "The Matrix",
"runtimeInMinutes": 136,
"releaseDate": "1999-03-31T00:00",
"filmRating": "R",
"genre": "Action, Sci-Fi",
"director": "The Wachowski brothers",
"plot": "A computer hacker learns from mysterious rebels about the true nature of his reality and his role in the war against its controllers.",
"metascore": 73,
"imdbRating": 8.7,
"imdbVotes": 1023621
}
Request
Method: GET
URL: http://localhost:9001/movies/api/movies?title=Matrix&runtimeInMinutes=130&metascore=6&imdbRating=7.2&imdbVotes=1000
Response
[
{
"imdbId": "tt0133093",
"title": "The Matrix",
"runtimeInMinutes": 136,
"releaseDate": "1999-03-31T00:00",
"filmRating": "R",
"genre": "Action, Sci-Fi",
"director": "The Wachowski brothers",
"plot": "A computer hacker learns from mysterious rebels about the true nature of his reality and his role in the war against its controllers.",
"metascore": 73,
"imdbRating": 8.7,
"imdbVotes": 1023621
}
]
Request
Method: PUT
URL: http://localhost:9001/movies/api/movies/tt0133093
Body:
{
"imdbId": "tt0133093",
"title": "The Matrix2",
"runtimeInMinutes": 136,
"releaseDate": "1999-03-31T00:00",
"filmRating": "R",
"genre": "Action, Sci-Fi",
"director": "The Wachowski brothers and some others",
"plot": "A computer hacker meets agent Smith.",
"metascore": 83,
"imdbRating": 8.7,
"imdbVotes": 1023621
}
We changed the title, director, plot and the metascore.
Response
{
"imdbId": "tt0133093",
"title": "The Matrix2",
"runtimeInMinutes": 136,
"releaseDate": "1999-03-31T00:00",
"filmRating": "R",
"genre": "Action, Sci-Fi",
"director": "The Wachowski brothers and some others",
"plot": "A computer hacker meets agent Smith.",
"metascore": 83,
"imdbRating": 8.7,
"imdbVotes": 1023621
}
Request
Method: DELETE
URL: http://localhost:9001/movies/api/movies/tt0133093
Response
{
"The movie was deleted?": true
}
This project is under the MIT License. See the LICENSE file for the full license text.