This repository holds code part of airplane seating algorithm
- This is a core spring boot application which has layered and structured like web, model, service
- Modularized and test cases were added
- configuration with application properties
- spring fox swagger is used in this application for rest api visualization
- Output visualization JSON response as list of clusters
- passengerId == 0 means no passenger allocated
- Each seat is indicated with corresponding row, col indices along with clusterId, passengerId
- Maven
- SpringBoot
- Java 8
You will need:
- SquareShiftCodeChallenge source code
- Java JDK
- Apache Maven
- A Unix/Linux shell environment OR the Windows command line
From the top level directory in the airplaneseatingservice application you can build, test and run airplaneseatingservice service using the ./run shell script , or using the compile.bat and run.bat script from the Windows command line.
If you are working from the Windows command line you must also install a Java JDK, and set the JAVA_HOME environment variable (please ensure it points to the JDK, and not the JRE) and the MVN_HOME environment variable. You may need to reboot your machine after setting these environment variables.
Ensure that you set your MAVEN_HOME environment variable, for example:
MAVEN_HOME=E:\Downloads\apache-maven-3.5.4-bin\apache-maven-3.5.4\
NOTE:
- You can use Maven directly
- Before running the applications, redis server has to be installed https://drive.google.com/drive/folders/16_yhz6dewCMWIYk8PB2f3h2ihVNHzBc4 and extract the redis package and up the server. default port is 6379. if you choose different port, please change the configuration in application.properties of the application
- application.properties has the db details and port number
and for any permission related item, Please use chmod command to give the permission in linux or mac machines in the terminal.
To build the application from source clone or unzip the application and from navigate to the root directory.
mvn clean install -DskipTests
To run airplaneseatingservice from the command line (assuming you have been able to build from the source code successfully)
java -jar target\squareshift-0.0.1-SNAPSHOT.jar
Application: http://localhost:8090/swagger-ui.html
airplaneseatingservice' source comes with Maven configuration files which are recognized by Eclipse if the Eclipse Maven plugin (m2e) is installed.
At the command line, go to a directory not under your Eclipse workspace directory and check out the source:
https://github.com/selvapuram/squareshiftcodechallenge
As airplaneseatingservice comes with some jars that need to be installed in Maven, mvn clean install to install these first. (This only needs to be done once on your system.)
Then in Eclipse, invoke the Import...
command and select Existing Maven Projects
. After all jars are set up and classpath is setup and containers are ready, start run using Spring Boot Dashboard.
Choose the root directory of your clone of the sourcecode.
To run and debug airplaneseatingservice from STS(Spring Tool Suite), spring boot dashboard has everything to run and debug.