- Java 1.8
- Vagrant (1.6.3) and VirtualBox (4.3.30) for callback mock.
-
Vagrant must be used to start virtual machine with callback mock server
vagrant plugin install vagrant-vbguest vagrant up
NB: be sure to have virtualization enabled in BIOS or otherwise Virtualbox will fail
-
start application from command line
-
Unix
./gradlew bootRun
-
Windows
./gradlew.bat bootRun
(not tested) -
External service is at http://localhost:8080/service/method url
- File -> import project
- choose build.gradle
- run
./gradlew test
- check unit tests output from console or "build/reports/test/" folder
- test code coverage can be seen after running
./gradlew test jacocoTestReport
from "build/reports/jacoco/" directory
To package the application as a (exuctable) WAR, type:
./gradlew bootRepackage
This will generate two files:
- "build/libs/asyncapi-0.0.1.war" - This one is an executable WAR file. Instead of deploying on an application server, many people find it easier to just have an exectuable WAR file (which includes Jetty/Tomcat 8, in fact).
to run executable war
java -jar asyncapi-0.0.1.war
- "asyncapi-0.0.1.war.original" - usual WAR without Jetty/Tomcat libs. Use this to deploy on separate application server
p.s. to override properties in production read http://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-external-config.html#boot-features-external-config-application-property-files
p.s.s. if you need to change Spring profile start app as java -jar asyncapi-0.0.1.war --spring.profiles.active=node2
.
vagrant up
start virtualmachine with callback api mock./gradlew bootRepackage
build and package application./gradlew.bat bootRun
start application first instance (default 8080 port)java -jar build/libs/asyncapi-0.0.1.war --spring.profiles.active=node2
start second instance of application on 8081 port- query second application extenal api http://localhost:8081/service/method This should make call to backend server (inside virtualmachine) and it will post data back after random delay (1ms to 6s) to first application service http://yourhost:8080/callback.service/method. As callback responses are replicated between application your second instance should show you correct response.