How to deploy - adarrivi/pascal-triangle GitHub Wiki
Deploy the server
- Clone the repository (or download the zip file) from here, at the lower right part of the screen.
- Go to the project's root folder:
cd <your-download-path>/pascal-triangle-master/pascal-triangle
- Run Maven package (this will run all the unit tests and create the auto-executable jar):
mvn package
(...)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 12.083s
[INFO] Finished at: Sun Oct 20 12:26:08 BST 2013
[INFO] Final Memory: 13M/164M
[INFO] ------------------------------------------------------------------------
- Go to the target folder
cd target
- Run the jar
java -jar pascal-triangle.jar
12:28:36,405 DEBUG NettyHttpServer:54 - Http server started
12:28:36,419 DEBUG Main:33 - Application context loaded
Test it
The server will be waiting for requests at localhost:8080. You can open a browse window and try the following url:
http://localhost:8080/humanEdgeWeight?level=6&index=5
The result in the browser should be:
142.1875
While in the server you should see:
12:28:36,405 DEBUG NettyHttpServer:54 - Http server started
12:28:36,419 DEBUG Main:33 - Application context loaded
12:29:55,309 DEBUG HumanPyramidServiceDefaultImpl:38 - The getHumanWeight operation took 0 milliseconds
The server caches the service calls, so if you try again the same operation, nothing will appear in the server log.
Also takes into consideration missing parameters:
http://localhost:8080/humanEdgeWeight?index=5
The parameter level is mandatory
Or invalid ones:
http://localhost:8080/humanEdgeWeight?level=6&index=string
Expected an integer value for the parameter index
http://localhost:8080/humanEdgeWeight?level=6&index=10
Invalid index 10 for the given row 6. Must equals or lower than 6