This Java
based desktop commandline app to simulate real time vehicle(s) connected with IoT cloud
. The app can run in parallel with this repo .
The simulator app is developed in Java. It can be run in two modes. i-e 1)- Execute for Specific time based on user input. 2)- Default simulation time is 10 minutes. Its major functionality is given below.
- It is multithreaded application and is used to post random data against each vehicle to backend.
- User can provide simulation duration, as command arguments, in Seconds, Minutes and Hours. Input should follow pattern i-e Number with Suffix[S/s, H/h, M/m] e.g 1H, 30m etc.
- Default simulation interval is 10 minutes.
- Config API is first called to retrieve number of vehicles.
- In case of failures the backend is check for 5 times at 10 second intervals each time. After that Exception can be thrown.
- Each vehicle data is randomly generated.
- Disconnect is simulated using random float number of its threshold is 0.1 i-e 10%.
- Gradle is used as build tool
- The project is dockerised and third party tool i-e gradle-docker for docker implementation.
State machine diagram is given below.
Sample unit tests are written using Junit frameworks. These tests can be exected using ./gradlew test
. These are tests are automated with Travis CI.
The project can be build using gradle and can be auatomated with Travis easily.
Static code analysis is carried out once commit is made on master repo.
The multi stage tarvis script is developed. The travis job cycle is composed in travis.yml
file.
Custom Jenkins based job pipeline script is also written and is given in custom-jenkins.yml
The appliactions are fully dockerised and common docker attributes are implemented i-e Proper hierarchy, dependencies and automation is fully supported. The entire proecss, build steps are written in docker-compose.yml
The project is Gradle based but Docker Image can also be generated by runing the following scripts.
sh docker-build.sh
The project can be build using gradle utility and via this script sh gradle-build.sh
By default 3 stages are defined and automatated with Travis CI
. These steps are unit-test
, build
and release
. In the final step the compiled binary i-e VehicleSimulator-1.0.0.jar
is deployed to github release and can be found at this link
Output jar file can be executed from command line (with/without CMD Args). Sample commandline scripts for Mac/*nix operating systems are.
-
java -jar VehicleSimulator.jar
(w/o command line args, default simulation time is 10 minutes)OR
-
java -jar VehicleSimulator.jar 20m
(Simulation time is 20 minutes)OR
-
java -jar VehicleSimulator.jar 1H
(Simulation time is 1 hour) etc...