This code has been developed as a part of XXXXX Hiring Challenge conducted on YYYY Platform.
This application provides the backend APIs for the connect4 game.
To know more or get your hands dirty, please visit - https://www.mathsisfun.com/games/connect4.html
- The API request to make moves accepts the column where the coin is dropped. Valid column values are from 0-6.
- This is a 2 player game with player labelled as - "RED" & "YELLOW" where "YELLOW" takes the first move.
- To start the game, create a session token using Token endpoint and use it in subsequent Move endpoint calls.
Please use the following minimum version of java and maven
Java version: 1.8.0_181
Apache Maven 3.6.1
To run the unit/integration test cases before running the application -
mvn test
This is a standard Spring Framework project. To run the project directly -
mvn spring-boot:run
To build a jar and run it -
mvn clean package
cd target/
java -Dserver.port=8080 -jar connect4-0.0.1.jar
There are 4 endpoints the application provides -
- Start game
- Submit player's moves
- Fetch sequence of moves taken in the game by both players
- Heartbeat API to perform health check of the application
http://localhost:8080/swagger-ui
curl --request POST 'http://localhost:8080/v1/connect4/start' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'X-C4-TrackingId: postman-start-test' \
--data-raw ''
curl --request POST 'http://localhost:8080/v1/connect4/move' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'X-C4-TrackingId: postman-start-move' \
--data-raw '{
"sessionId": "000f6e6a-cd3c-4341-8dd1-14aff64ef21a",
"player": "YELLOW",
"position": 1
}'
curl --request POST 'http://localhost:8080/v1/connect4/view' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'X-C4-TrackingId: postman-heartbeat' \
--data-raw '{
"sessionId": "a1c088d1-08d2-494b-b80c-e334bf82c491"
}'
curl --request GET 'http://localhost:8080/v1/connect4/heartbeat' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'X-C4-TrackingId: postman-heartbeat' \
--data-raw ''
- Java & Spring Basics
- Strategy design pattern
- Builder design pattern
- Java Generics
- Constant & enum usages
- Exception declaration & management
- Object 2 Json conversions & vice-versa
- Project package structure
- Utility class usages
- Utility class usages
- Java 8 Optional & Streams
- Placement of code comments & documentation blocks
- Usage of spring application lifecycle events
- Documentation
- .gitignore usage
- ReadMe.md & documentation formats
- Changelog format
- Database Related
- Hibernate ORM
- Table joins & @Formula usages
- Hibernate enum converter
- H2 Database usage
- Spring transaction management
- Rest APIs with spring-boot
- REST API
- @Controller Advice Usage
- HTTP Request Interceptor
- Swagger setup
- API payload validations
- API Security
- HTTP request response log capture
- Enterprise Application practices
- Log4j2 Implementation
- Log4j2 patterns & appenders
- Spring profiles
- Application health monitoring using spring-actuators
- Unit & Integration Testing
- Unit Testing with JUnit5
- Declaration of separate resources for test scope
- Mocks & Stubs usages
- REST API unit testing
- Maven surefire plugin usages
- jacoco code coverage
- Deployment & Automation pipelines
- Build scripts
- Dockerfile
- Jenkinsfile
- Kubernetes deployment scripts