A simple project that compares two different input that receive two encoded in Base 64.
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
In order to run the application you only need Java 1.8
Lombok is java a library that allow you to never write another getter, setter or equals method again
Set it under:
->Preferences (Cmd + ,)
-->Build, Execution, Deployment
--->Compiler
---->Annotation Processors
------>Enable annotation processing
And install Lombok plugin for IntelliJ:
->Preferences -> Plugins
-->Search for "Lombok Plugin"
--->Click Browse repositories...
---->Choose Lombok Plugin
----->Install
------>Restart IntelliJ
You can build it using gradle wrapper
./gradlew build
You can run it with
java -jar build/libs/diff-1.0-SNAPSHOT.jar
You can view the documentation in the following endpoint:
<host>/doc
Note: if you are running in localhost the endpoint will be
localhost:8080/doc
Documentation can be regenerated using aglio
aglio -i src/main/java/com/joaera/diff/doc/docA.apib -o src/main/resources/templates/docs.html
It provides two endpoint for uploading via POST both string:
<host>/v1/diff/<ID>/left
And:
<host>/v1/diff/<ID>/right
Both endpoints receive the same JSON structure:
{"data":<any Base 64 content>}
For example:
curl -X POST -H 'Content-Type: application/json' -d '{"data":"This is an example"}' localhost:8989/v1/diff/1/right
curl -X POST -H 'Content-Type: application/json' -d '{"data":"This is 4n 3xampl3"}' localhost:8989/v1/diff/1/left
Note: You can upload as many different data as you want providing different IDs.
You can compare data using the following endpoint
<host>/v1/diff/<ID>/
This endpoint will compare left data and right data loading with the ID.
Following the example, the response will be:
{
"message": "Data is different",
"difference": {
"offsets": [
8,
11,
17
],
"length": 18
}
}
- Spring Boot - The web framework used
- Gradle - Dependency Management
- Lombok - Used to generate automatic setters and getters
- Mockito - For testing framework
- H2 Databse - Used for storing data
- Apiary - Used for documentation