From 5f77dc7deaa0013dffc1a87aa241bc04b7cb21ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nagy=20Bal=C3=A1zs?= <144285305+rebalino@users.noreply.github.com> Date: Mon, 11 Mar 2024 16:00:00 +0100 Subject: [PATCH 01/14] Create maven.yml --- .github/workflows/maven.yml | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 .github/workflows/maven.yml diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml new file mode 100644 index 000000000..f7367e0d4 --- /dev/null +++ b/.github/workflows/maven.yml @@ -0,0 +1,35 @@ +# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven + +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. + +name: Java CI with Maven + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Set up JDK 11 + uses: actions/setup-java@v3 + with: + java-version: '11' + distribution: 'temurin' + cache: maven + - name: Build with Maven + run: mvn -B package --file pom.xml + + # Optional: Uploads the full dependency graph to GitHub to improve the quality of Dependabot alerts this repository can receive + - name: Update dependency graph + uses: advanced-security/maven-dependency-submission-action@571e99aab1055c2e71a1e2309b9691de18d6b7d6 From 3f73bc21e94147c1d5bb72ba59401e2c1eb86478 Mon Sep 17 00:00:00 2001 From: Rebalino Date: Mon, 11 Mar 2024 16:08:38 +0100 Subject: [PATCH 02/14] 3.3 first commit --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index e26e034fc..13ebd59f9 100644 --- a/README.md +++ b/README.md @@ -62,3 +62,11 @@ The figure below illustrates this behavior using an example. 1. As the joystick remains at a positive value, the reference speed is incremented again. 1. However, it reaches the speed limit so in the next step it is not incremented even though the joystick still has a positive value. 1. Later, the joystick is set to a negative position for one time unit, making the reference speed to decrease as well. + + +### Change readme +1. Line one +2. Line two +3. Line three +[where does it lead to](www.imgur.com/a/G6rU8) +*Asterisk* From ce99c96cca8ebc893cde829bf48ba00f9faa9bf9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nagy=20Bal=C3=A1zs?= Date: Mon, 11 Mar 2024 16:34:49 +0100 Subject: [PATCH 03/14] 4.10 Implemented Emgergency Brake --- Developer | 0 .../train/controller/TrainControllerImpl.java | 6 ++ .../compile/default-compile/createdFiles.lst | 1 + .../compile/default-compile/inputFiles.lst | 1 + .../mit/train/interfaces/TrainController.java | 2 + .../compile/default-compile/createdFiles.lst | 3 + .../compile/default-compile/inputFiles.lst | 3 + .../compile/default-compile/createdFiles.lst | 1 + .../compile/default-compile/inputFiles.lst | 1 + .../default-testCompile/createdFiles.lst | 1 + .../default-testCompile/inputFiles.lst | 1 + ...u.bme.mit.train.sensor.TrainSensorTest.xml | 64 ++++++++++++++++++ ...u.bme.mit.train.sensor.TrainSensorTest.txt | 4 ++ .../compile/default-compile/createdFiles.lst | 1 + .../compile/default-compile/inputFiles.lst | 1 + .../default-testCompile/createdFiles.lst | 1 + .../default-testCompile/inputFiles.lst | 1 + ...u.bme.mit.train.system.TrainSystemTest.xml | 65 +++++++++++++++++++ ...u.bme.mit.train.system.TrainSystemTest.txt | 4 ++ .../compile/default-compile/createdFiles.lst | 1 + .../compile/default-compile/inputFiles.lst | 1 + 21 files changed, 163 insertions(+) create mode 100644 Developer create mode 100644 train-controller/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst create mode 100644 train-controller/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst create mode 100644 train-interfaces/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst create mode 100644 train-interfaces/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst create mode 100644 train-sensor/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst create mode 100644 train-sensor/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst create mode 100644 train-sensor/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst create mode 100644 train-sensor/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst create mode 100644 train-sensor/target/surefire-reports/TEST-hu.bme.mit.train.sensor.TrainSensorTest.xml create mode 100644 train-sensor/target/surefire-reports/hu.bme.mit.train.sensor.TrainSensorTest.txt create mode 100644 train-system/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst create mode 100644 train-system/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst create mode 100644 train-system/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst create mode 100644 train-system/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst create mode 100644 train-system/target/surefire-reports/TEST-hu.bme.mit.train.system.TrainSystemTest.xml create mode 100644 train-system/target/surefire-reports/hu.bme.mit.train.system.TrainSystemTest.txt create mode 100644 train-user/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst create mode 100644 train-user/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst diff --git a/Developer b/Developer new file mode 100644 index 000000000..e69de29bb diff --git a/train-controller/src/main/java/hu/bme/mit/train/controller/TrainControllerImpl.java b/train-controller/src/main/java/hu/bme/mit/train/controller/TrainControllerImpl.java index 06649d278..66c5495e7 100644 --- a/train-controller/src/main/java/hu/bme/mit/train/controller/TrainControllerImpl.java +++ b/train-controller/src/main/java/hu/bme/mit/train/controller/TrainControllerImpl.java @@ -46,4 +46,10 @@ public void setJoystickPosition(int joystickPosition) { this.step = joystickPosition; } + @Override + public void emergencyBrake(){ + referenceSpeed = 0; + } + + } diff --git a/train-controller/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst b/train-controller/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst new file mode 100644 index 000000000..7f5a1ef4a --- /dev/null +++ b/train-controller/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst @@ -0,0 +1 @@ +hu/bme/mit/train/controller/TrainControllerImpl.class diff --git a/train-controller/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/train-controller/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst new file mode 100644 index 000000000..ef45cbc94 --- /dev/null +++ b/train-controller/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst @@ -0,0 +1 @@ +/home/cloud/ReteLabMIT2/train-controller/src/main/java/hu/bme/mit/train/controller/TrainControllerImpl.java diff --git a/train-interfaces/src/main/java/hu/bme/mit/train/interfaces/TrainController.java b/train-interfaces/src/main/java/hu/bme/mit/train/interfaces/TrainController.java index c8adca066..e4e11ab92 100644 --- a/train-interfaces/src/main/java/hu/bme/mit/train/interfaces/TrainController.java +++ b/train-interfaces/src/main/java/hu/bme/mit/train/interfaces/TrainController.java @@ -10,4 +10,6 @@ public interface TrainController { void setJoystickPosition(int joystickPosition); + void emergencyBrake(); + } diff --git a/train-interfaces/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst b/train-interfaces/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst new file mode 100644 index 000000000..248759f35 --- /dev/null +++ b/train-interfaces/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst @@ -0,0 +1,3 @@ +hu/bme/mit/train/interfaces/TrainController.class +hu/bme/mit/train/interfaces/TrainSensor.class +hu/bme/mit/train/interfaces/TrainUser.class diff --git a/train-interfaces/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/train-interfaces/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst new file mode 100644 index 000000000..8aa37be92 --- /dev/null +++ b/train-interfaces/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst @@ -0,0 +1,3 @@ +/home/cloud/ReteLabMIT2/train-interfaces/src/main/java/hu/bme/mit/train/interfaces/TrainController.java +/home/cloud/ReteLabMIT2/train-interfaces/src/main/java/hu/bme/mit/train/interfaces/TrainSensor.java +/home/cloud/ReteLabMIT2/train-interfaces/src/main/java/hu/bme/mit/train/interfaces/TrainUser.java diff --git a/train-sensor/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst b/train-sensor/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst new file mode 100644 index 000000000..5c6a37510 --- /dev/null +++ b/train-sensor/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst @@ -0,0 +1 @@ +hu/bme/mit/train/sensor/TrainSensorImpl.class diff --git a/train-sensor/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/train-sensor/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst new file mode 100644 index 000000000..bf677bbd9 --- /dev/null +++ b/train-sensor/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst @@ -0,0 +1 @@ +/home/cloud/ReteLabMIT2/train-sensor/src/main/java/hu/bme/mit/train/sensor/TrainSensorImpl.java diff --git a/train-sensor/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst b/train-sensor/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst new file mode 100644 index 000000000..0ad3f3de4 --- /dev/null +++ b/train-sensor/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst @@ -0,0 +1 @@ +hu/bme/mit/train/sensor/TrainSensorTest.class diff --git a/train-sensor/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst b/train-sensor/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst new file mode 100644 index 000000000..3969807bf --- /dev/null +++ b/train-sensor/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst @@ -0,0 +1 @@ +/home/cloud/ReteLabMIT2/train-sensor/src/test/java/hu/bme/mit/train/sensor/TrainSensorTest.java diff --git a/train-sensor/target/surefire-reports/TEST-hu.bme.mit.train.sensor.TrainSensorTest.xml b/train-sensor/target/surefire-reports/TEST-hu.bme.mit.train.sensor.TrainSensorTest.xml new file mode 100644 index 000000000..83944a414 --- /dev/null +++ b/train-sensor/target/surefire-reports/TEST-hu.bme.mit.train.sensor.TrainSensorTest.xml @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/train-sensor/target/surefire-reports/hu.bme.mit.train.sensor.TrainSensorTest.txt b/train-sensor/target/surefire-reports/hu.bme.mit.train.sensor.TrainSensorTest.txt new file mode 100644 index 000000000..d9ed6a05d --- /dev/null +++ b/train-sensor/target/surefire-reports/hu.bme.mit.train.sensor.TrainSensorTest.txt @@ -0,0 +1,4 @@ +------------------------------------------------------------------------------- +Test set: hu.bme.mit.train.sensor.TrainSensorTest +------------------------------------------------------------------------------- +Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.082 sec diff --git a/train-system/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst b/train-system/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst new file mode 100644 index 000000000..104d0eff5 --- /dev/null +++ b/train-system/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst @@ -0,0 +1 @@ +hu/bme/mit/train/system/TrainSystem.class diff --git a/train-system/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/train-system/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst new file mode 100644 index 000000000..4f8770c3f --- /dev/null +++ b/train-system/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst @@ -0,0 +1 @@ +/home/cloud/ReteLabMIT2/train-system/src/main/java/hu/bme/mit/train/system/TrainSystem.java diff --git a/train-system/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst b/train-system/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst new file mode 100644 index 000000000..f347beb05 --- /dev/null +++ b/train-system/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst @@ -0,0 +1 @@ +hu/bme/mit/train/system/TrainSystemTest.class diff --git a/train-system/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst b/train-system/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst new file mode 100644 index 000000000..0df0d9e41 --- /dev/null +++ b/train-system/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst @@ -0,0 +1 @@ +/home/cloud/ReteLabMIT2/train-system/src/test/java/hu/bme/mit/train/system/TrainSystemTest.java diff --git a/train-system/target/surefire-reports/TEST-hu.bme.mit.train.system.TrainSystemTest.xml b/train-system/target/surefire-reports/TEST-hu.bme.mit.train.system.TrainSystemTest.xml new file mode 100644 index 000000000..599d6e8c1 --- /dev/null +++ b/train-system/target/surefire-reports/TEST-hu.bme.mit.train.system.TrainSystemTest.xml @@ -0,0 +1,65 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/train-system/target/surefire-reports/hu.bme.mit.train.system.TrainSystemTest.txt b/train-system/target/surefire-reports/hu.bme.mit.train.system.TrainSystemTest.txt new file mode 100644 index 000000000..32fb2a65c --- /dev/null +++ b/train-system/target/surefire-reports/hu.bme.mit.train.system.TrainSystemTest.txt @@ -0,0 +1,4 @@ +------------------------------------------------------------------------------- +Test set: hu.bme.mit.train.system.TrainSystemTest +------------------------------------------------------------------------------- +Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.114 sec diff --git a/train-user/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst b/train-user/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst new file mode 100644 index 000000000..f84f69174 --- /dev/null +++ b/train-user/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst @@ -0,0 +1 @@ +hu/bme/mit/train/user/TrainUserImpl.class diff --git a/train-user/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/train-user/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst new file mode 100644 index 000000000..0f90dde27 --- /dev/null +++ b/train-user/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst @@ -0,0 +1 @@ +/home/cloud/ReteLabMIT2/train-user/src/main/java/hu/bme/mit/train/user/TrainUserImpl.java From 37743cdfc69adeea00bb2bcb8deadb42310e763c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nagy=20Bal=C3=A1zs?= Date: Mon, 11 Mar 2024 16:48:29 +0100 Subject: [PATCH 04/14] 5.2 change branch-A --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 13ebd59f9..41ede3dfb 100644 --- a/README.md +++ b/README.md @@ -66,7 +66,7 @@ The figure below illustrates this behavior using an example. ### Change readme 1. Line one -2. Line two +2. Line not the one you need 3. Line three [where does it lead to](www.imgur.com/a/G6rU8) *Asterisk* From 8a848e04a35043c0cf6945b90b2c973d07d42d30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nagy=20Bal=C3=A1zs?= Date: Mon, 11 Mar 2024 16:49:27 +0100 Subject: [PATCH 05/14] 5.3 change branch-B --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 13ebd59f9..953391c60 100644 --- a/README.md +++ b/README.md @@ -66,7 +66,7 @@ The figure below illustrates this behavior using an example. ### Change readme 1. Line one -2. Line two +2. Branch-B supremacy 3. Line three [where does it lead to](www.imgur.com/a/G6rU8) *Asterisk* From c2a713f0a477a6c6580fb4e34bc90dee31b6a3b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nagy=20Bal=C3=A1zs?= Date: Mon, 11 Mar 2024 17:02:58 +0100 Subject: [PATCH 06/14] 6.10 Generating build issues for fun --- .../java/hu/bme/mit/train/controller/TrainControllerImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/train-controller/src/main/java/hu/bme/mit/train/controller/TrainControllerImpl.java b/train-controller/src/main/java/hu/bme/mit/train/controller/TrainControllerImpl.java index 66c5495e7..65d41f190 100644 --- a/train-controller/src/main/java/hu/bme/mit/train/controller/TrainControllerImpl.java +++ b/train-controller/src/main/java/hu/bme/mit/train/controller/TrainControllerImpl.java @@ -52,4 +52,4 @@ public void emergencyBrake(){ } -} + From 83eb84e07e6877a51b02fe9142cb97dc32cc6d08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nagy=20Bal=C3=A1zs?= Date: Mon, 11 Mar 2024 17:14:06 +0100 Subject: [PATCH 07/14] 6.11 Added UnitTest to emergencyBrake --- .../hu/bme/mit/train/controller/TrainControllerImpl.java | 6 ++++-- .../hu.bme.mit.train.sensor.TrainSensorTest.txt | 2 +- .../test/java/hu/bme/mit/train/system/TrainSystemTest.java | 7 +++++++ .../TEST-hu.bme.mit.train.system.TrainSystemTest.xml | 7 ++++--- .../hu.bme.mit.train.system.TrainSystemTest.txt | 2 +- 5 files changed, 17 insertions(+), 7 deletions(-) diff --git a/train-controller/src/main/java/hu/bme/mit/train/controller/TrainControllerImpl.java b/train-controller/src/main/java/hu/bme/mit/train/controller/TrainControllerImpl.java index 65d41f190..f1886d6b2 100644 --- a/train-controller/src/main/java/hu/bme/mit/train/controller/TrainControllerImpl.java +++ b/train-controller/src/main/java/hu/bme/mit/train/controller/TrainControllerImpl.java @@ -48,8 +48,10 @@ public void setJoystickPosition(int joystickPosition) { @Override public void emergencyBrake(){ - referenceSpeed = 0; + if(step < -10){ + referenceSpeed = 0; + } } - +} diff --git a/train-sensor/target/surefire-reports/hu.bme.mit.train.sensor.TrainSensorTest.txt b/train-sensor/target/surefire-reports/hu.bme.mit.train.sensor.TrainSensorTest.txt index d9ed6a05d..14a3e545e 100644 --- a/train-sensor/target/surefire-reports/hu.bme.mit.train.sensor.TrainSensorTest.txt +++ b/train-sensor/target/surefire-reports/hu.bme.mit.train.sensor.TrainSensorTest.txt @@ -1,4 +1,4 @@ ------------------------------------------------------------------------------- Test set: hu.bme.mit.train.sensor.TrainSensorTest ------------------------------------------------------------------------------- -Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.082 sec +Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.105 sec diff --git a/train-system/src/test/java/hu/bme/mit/train/system/TrainSystemTest.java b/train-system/src/test/java/hu/bme/mit/train/system/TrainSystemTest.java index 04ae3dac0..7d370fffc 100644 --- a/train-system/src/test/java/hu/bme/mit/train/system/TrainSystemTest.java +++ b/train-system/src/test/java/hu/bme/mit/train/system/TrainSystemTest.java @@ -50,5 +50,12 @@ public void OverridingJoystickPositionToNegative_SetsReferenceSpeedToZero() { Assert.assertEquals(0, controller.getReferenceSpeed()); } + @Test + public void EmergencyBrakeFunctions(){ + controller.setJoystickPosition(-10); + controller.emergencyBrake(); + Assert.assertEquals(0, controller.getReferenceSpeed()); + } + } diff --git a/train-system/target/surefire-reports/TEST-hu.bme.mit.train.system.TrainSystemTest.xml b/train-system/target/surefire-reports/TEST-hu.bme.mit.train.system.TrainSystemTest.xml index 599d6e8c1..c9aa47bd2 100644 --- a/train-system/target/surefire-reports/TEST-hu.bme.mit.train.system.TrainSystemTest.xml +++ b/train-system/target/surefire-reports/TEST-hu.bme.mit.train.system.TrainSystemTest.xml @@ -1,5 +1,5 @@ - + @@ -60,6 +60,7 @@ - - + + + \ No newline at end of file diff --git a/train-system/target/surefire-reports/hu.bme.mit.train.system.TrainSystemTest.txt b/train-system/target/surefire-reports/hu.bme.mit.train.system.TrainSystemTest.txt index 32fb2a65c..1d6654b1f 100644 --- a/train-system/target/surefire-reports/hu.bme.mit.train.system.TrainSystemTest.txt +++ b/train-system/target/surefire-reports/hu.bme.mit.train.system.TrainSystemTest.txt @@ -1,4 +1,4 @@ ------------------------------------------------------------------------------- Test set: hu.bme.mit.train.system.TrainSystemTest ------------------------------------------------------------------------------- -Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.114 sec +Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.066 sec From c4cd1697925baf2cb067e66b63a0d183a77f369f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nagy=20Bal=C3=A1zs?= Date: Mon, 11 Mar 2024 18:22:12 +0100 Subject: [PATCH 08/14] 7.5 Table worked well --- pom.xml | 8 +++++ .../bme/mit/train/interfaces/TrainSensor.java | 11 +++++++ .../bme/mit/train/sensor/TrainSensorImpl.java | 30 +++++++++++++++++++ .../bme/mit/train/sensor/TrainSensorTest.java | 13 +++++--- .../bme/mit/train/system/TrainSystemTest.java | 8 ++++- ...u.bme.mit.train.system.TrainSystemTest.xml | 7 +++-- ...u.bme.mit.train.system.TrainSystemTest.txt | 2 +- 7 files changed, 70 insertions(+), 9 deletions(-) diff --git a/pom.xml b/pom.xml index 2be9fb5f5..bf1e14ce9 100644 --- a/pom.xml +++ b/pom.xml @@ -39,6 +39,14 @@ 0.8.7 test + + + + com.google.guava + guava + 33.0.0-jre + + diff --git a/train-interfaces/src/main/java/hu/bme/mit/train/interfaces/TrainSensor.java b/train-interfaces/src/main/java/hu/bme/mit/train/interfaces/TrainSensor.java index 298173025..7027f9798 100644 --- a/train-interfaces/src/main/java/hu/bme/mit/train/interfaces/TrainSensor.java +++ b/train-interfaces/src/main/java/hu/bme/mit/train/interfaces/TrainSensor.java @@ -1,4 +1,6 @@ package hu.bme.mit.train.interfaces; +import com.google.common.collect.Table; +import java.time.LocalTime; public interface TrainSensor { @@ -6,4 +8,13 @@ public interface TrainSensor { void overrideSpeedLimit(int speedLimit); + LocalTime getCurrentTime(); + + int getJoystickPosition(); + + int getReferenceSpeed(); + + void addToTable(); + + int getTableSize(); } diff --git a/train-sensor/src/main/java/hu/bme/mit/train/sensor/TrainSensorImpl.java b/train-sensor/src/main/java/hu/bme/mit/train/sensor/TrainSensorImpl.java index 4a640d1dd..3813d12f0 100644 --- a/train-sensor/src/main/java/hu/bme/mit/train/sensor/TrainSensorImpl.java +++ b/train-sensor/src/main/java/hu/bme/mit/train/sensor/TrainSensorImpl.java @@ -4,11 +4,16 @@ import hu.bme.mit.train.interfaces.TrainSensor; import hu.bme.mit.train.interfaces.TrainUser; +import com.google.common.collect.Table; +import com.google.common.collect.HashBasedTable; +import java.time.LocalTime; + public class TrainSensorImpl implements TrainSensor { private TrainController controller; private TrainUser user; private int speedLimit = 5; + private Table table = HashBasedTable.create(); public TrainSensorImpl(TrainController controller, TrainUser user) { this.controller = controller; @@ -26,4 +31,29 @@ public void overrideSpeedLimit(int speedLimit) { controller.setSpeedLimit(speedLimit); } + @Override + public LocalTime getCurrentTime(){ + return LocalTime.now(); + } + + @Override + public int getJoystickPosition(){ + return user.getJoystickPosition(); + } + + @Override + public int getReferenceSpeed(){ + return controller.getReferenceSpeed(); + } + + @Override + public void addToTable(){ + table.put(getCurrentTime(), getJoystickPosition(), getReferenceSpeed()); + } + + @Override + public int getTableSize(){ + return table.size(); + } + } diff --git a/train-sensor/src/test/java/hu/bme/mit/train/sensor/TrainSensorTest.java b/train-sensor/src/test/java/hu/bme/mit/train/sensor/TrainSensorTest.java index ae5dee21b..c28cca4a4 100644 --- a/train-sensor/src/test/java/hu/bme/mit/train/sensor/TrainSensorTest.java +++ b/train-sensor/src/test/java/hu/bme/mit/train/sensor/TrainSensorTest.java @@ -5,15 +5,20 @@ import org.junit.Test; import static org.mockito.Mockito.*; +import com.google.common.collect.HashBasedTable; +import com.google.common.collect.Table; +import java.time.LocalTime; + public class TrainSensorTest { + /* @Before public void before() { - // TODO Add initializations + } @Test - public void ThisIsAnExampleTestStub() { - // TODO Delete this and add test cases based on the issues - } + public void TableRowAddedTest() { + + }*/ } diff --git a/train-system/src/test/java/hu/bme/mit/train/system/TrainSystemTest.java b/train-system/src/test/java/hu/bme/mit/train/system/TrainSystemTest.java index 7d370fffc..a7aa66ad5 100644 --- a/train-system/src/test/java/hu/bme/mit/train/system/TrainSystemTest.java +++ b/train-system/src/test/java/hu/bme/mit/train/system/TrainSystemTest.java @@ -57,5 +57,11 @@ public void EmergencyBrakeFunctions(){ Assert.assertEquals(0, controller.getReferenceSpeed()); } - + @Test + public void TableRowAddedTest() { + sensor.addToTable(); + Assert.assertEquals(1, sensor.getTableSize()); + sensor.addToTable(); + Assert.assertEquals(2, sensor.getTableSize()); + } } diff --git a/train-system/target/surefire-reports/TEST-hu.bme.mit.train.system.TrainSystemTest.xml b/train-system/target/surefire-reports/TEST-hu.bme.mit.train.system.TrainSystemTest.xml index c9aa47bd2..870f87c75 100644 --- a/train-system/target/surefire-reports/TEST-hu.bme.mit.train.system.TrainSystemTest.xml +++ b/train-system/target/surefire-reports/TEST-hu.bme.mit.train.system.TrainSystemTest.xml @@ -1,5 +1,5 @@ - + @@ -60,7 +60,8 @@ - + - + + \ No newline at end of file diff --git a/train-system/target/surefire-reports/hu.bme.mit.train.system.TrainSystemTest.txt b/train-system/target/surefire-reports/hu.bme.mit.train.system.TrainSystemTest.txt index 1d6654b1f..a9eacf699 100644 --- a/train-system/target/surefire-reports/hu.bme.mit.train.system.TrainSystemTest.txt +++ b/train-system/target/surefire-reports/hu.bme.mit.train.system.TrainSystemTest.txt @@ -1,4 +1,4 @@ ------------------------------------------------------------------------------- Test set: hu.bme.mit.train.system.TrainSystemTest ------------------------------------------------------------------------------- -Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.066 sec +Tests run: 4, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.178 sec From c266a73474c0710be171cf4f63d370992183acc9 Mon Sep 17 00:00:00 2001 From: rebalino Date: Mon, 25 Mar 2024 16:11:34 +0100 Subject: [PATCH 09/14] idozito implementalasa --- .../hu/bme/mit/train/controller/TrainControllerImpl.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/train-controller/src/main/java/hu/bme/mit/train/controller/TrainControllerImpl.java b/train-controller/src/main/java/hu/bme/mit/train/controller/TrainControllerImpl.java index f1886d6b2..de73a95c8 100644 --- a/train-controller/src/main/java/hu/bme/mit/train/controller/TrainControllerImpl.java +++ b/train-controller/src/main/java/hu/bme/mit/train/controller/TrainControllerImpl.java @@ -7,6 +7,12 @@ public class TrainControllerImpl implements TrainController { private int step = 0; private int referenceSpeed = 0; private int speedLimit = 0; + TimerTask task = new TimerTask(){ + public void run(){ + followSpeed(); + } + }; + Timer timer = new Timer(task, 500); @Override public void followSpeed() { @@ -43,7 +49,7 @@ private void enforceSpeedLimit() { @Override public void setJoystickPosition(int joystickPosition) { - this.step = joystickPosition; + this.step = joystickPosition; } @Override @@ -53,5 +59,4 @@ public void emergencyBrake(){ } } - } From 8254fb740f07f591140303d9400199d8b8a77b14 Mon Sep 17 00:00:00 2001 From: rebalino Date: Mon, 25 Mar 2024 16:43:19 +0100 Subject: [PATCH 10/14] implemt --- .../java/hu/bme/mit/train/controller/TrainControllerImpl.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/train-controller/src/main/java/hu/bme/mit/train/controller/TrainControllerImpl.java b/train-controller/src/main/java/hu/bme/mit/train/controller/TrainControllerImpl.java index de73a95c8..d68c40304 100644 --- a/train-controller/src/main/java/hu/bme/mit/train/controller/TrainControllerImpl.java +++ b/train-controller/src/main/java/hu/bme/mit/train/controller/TrainControllerImpl.java @@ -1,6 +1,8 @@ package hu.bme.mit.train.controller; import hu.bme.mit.train.interfaces.TrainController; +import java.lang.Timer +import jav.lang.TimerTask public class TrainControllerImpl implements TrainController { From f090d3047ce72d23d25d37ca021e7b25fe8566fa Mon Sep 17 00:00:00 2001 From: rebalino Date: Mon, 25 Mar 2024 17:00:09 +0100 Subject: [PATCH 11/14] import changed --- .../java/hu/bme/mit/train/controller/TrainControllerImpl.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/train-controller/src/main/java/hu/bme/mit/train/controller/TrainControllerImpl.java b/train-controller/src/main/java/hu/bme/mit/train/controller/TrainControllerImpl.java index d68c40304..e44705f9d 100644 --- a/train-controller/src/main/java/hu/bme/mit/train/controller/TrainControllerImpl.java +++ b/train-controller/src/main/java/hu/bme/mit/train/controller/TrainControllerImpl.java @@ -1,8 +1,8 @@ package hu.bme.mit.train.controller; import hu.bme.mit.train.interfaces.TrainController; -import java.lang.Timer -import jav.lang.TimerTask +import java.util.Timer; +import jav.util.TimerTask; public class TrainControllerImpl implements TrainController { From c20a223f27241900661d27cf10b0db03cd301cbd Mon Sep 17 00:00:00 2001 From: rebalino Date: Mon, 25 Mar 2024 17:01:23 +0100 Subject: [PATCH 12/14] import changed --- .../java/hu/bme/mit/train/controller/TrainControllerImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/train-controller/src/main/java/hu/bme/mit/train/controller/TrainControllerImpl.java b/train-controller/src/main/java/hu/bme/mit/train/controller/TrainControllerImpl.java index e44705f9d..ebd54c23d 100644 --- a/train-controller/src/main/java/hu/bme/mit/train/controller/TrainControllerImpl.java +++ b/train-controller/src/main/java/hu/bme/mit/train/controller/TrainControllerImpl.java @@ -2,7 +2,7 @@ import hu.bme.mit.train.interfaces.TrainController; import java.util.Timer; -import jav.util.TimerTask; +import java.util.TimerTask; public class TrainControllerImpl implements TrainController { From 92542a4400b3e438948fe822a609d0936c67dcbc Mon Sep 17 00:00:00 2001 From: rebalino Date: Mon, 25 Mar 2024 17:06:57 +0100 Subject: [PATCH 13/14] import changed --- .../java/hu/bme/mit/train/controller/TrainControllerImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/train-controller/src/main/java/hu/bme/mit/train/controller/TrainControllerImpl.java b/train-controller/src/main/java/hu/bme/mit/train/controller/TrainControllerImpl.java index ebd54c23d..9ed83dba1 100644 --- a/train-controller/src/main/java/hu/bme/mit/train/controller/TrainControllerImpl.java +++ b/train-controller/src/main/java/hu/bme/mit/train/controller/TrainControllerImpl.java @@ -14,7 +14,7 @@ public void run(){ followSpeed(); } }; - Timer timer = new Timer(task, 500); + Timer timer = new Timer("newTimer").schedule(task, 500); @Override public void followSpeed() { From 426432ef4992583bd3d939f5025d78e454845cf7 Mon Sep 17 00:00:00 2001 From: rebalino Date: Mon, 25 Mar 2024 17:27:46 +0100 Subject: [PATCH 14/14] fixed timer --- .../mit/train/controller/TrainControllerImpl.java | 7 +++++-- .../compile/default-compile/createdFiles.lst | 1 + .../compile/default-compile/inputFiles.lst | 6 +++--- .../compile/default-compile/inputFiles.lst | 2 +- .../TEST-hu.bme.mit.train.system.TrainSystemTest.xml | 12 ++++++------ .../hu.bme.mit.train.system.TrainSystemTest.txt | 2 +- .../compile/default-compile/inputFiles.lst | 2 +- 7 files changed, 18 insertions(+), 14 deletions(-) diff --git a/train-controller/src/main/java/hu/bme/mit/train/controller/TrainControllerImpl.java b/train-controller/src/main/java/hu/bme/mit/train/controller/TrainControllerImpl.java index 9ed83dba1..43ac663f9 100644 --- a/train-controller/src/main/java/hu/bme/mit/train/controller/TrainControllerImpl.java +++ b/train-controller/src/main/java/hu/bme/mit/train/controller/TrainControllerImpl.java @@ -14,7 +14,7 @@ public void run(){ followSpeed(); } }; - Timer timer = new Timer("newTimer").schedule(task, 500); + Timer timer = null; @Override public void followSpeed() { @@ -27,7 +27,10 @@ public void followSpeed() { referenceSpeed = 0; } } - + if(timer == null){ + timer = new Timer(); + timer.schedule(task, 0, 500); + } enforceSpeedLimit(); } diff --git a/train-controller/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst b/train-controller/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst index 7f5a1ef4a..fd81f58cf 100644 --- a/train-controller/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst +++ b/train-controller/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst @@ -1 +1,2 @@ hu/bme/mit/train/controller/TrainControllerImpl.class +hu/bme/mit/train/controller/TrainControllerImpl$1.class diff --git a/train-interfaces/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/train-interfaces/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst index 8aa37be92..d4a6e4df1 100644 --- a/train-interfaces/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst +++ b/train-interfaces/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst @@ -1,3 +1,3 @@ -/home/cloud/ReteLabMIT2/train-interfaces/src/main/java/hu/bme/mit/train/interfaces/TrainController.java -/home/cloud/ReteLabMIT2/train-interfaces/src/main/java/hu/bme/mit/train/interfaces/TrainSensor.java -/home/cloud/ReteLabMIT2/train-interfaces/src/main/java/hu/bme/mit/train/interfaces/TrainUser.java +/home/cloud/yjrrbk/ReteLabMIT2/train-interfaces/src/main/java/hu/bme/mit/train/interfaces/TrainSensor.java +/home/cloud/yjrrbk/ReteLabMIT2/train-interfaces/src/main/java/hu/bme/mit/train/interfaces/TrainController.java +/home/cloud/yjrrbk/ReteLabMIT2/train-interfaces/src/main/java/hu/bme/mit/train/interfaces/TrainUser.java diff --git a/train-sensor/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/train-sensor/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst index bf677bbd9..c609fe074 100644 --- a/train-sensor/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst +++ b/train-sensor/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst @@ -1 +1 @@ -/home/cloud/ReteLabMIT2/train-sensor/src/main/java/hu/bme/mit/train/sensor/TrainSensorImpl.java +/home/cloud/yjrrbk/ReteLabMIT2/train-sensor/src/main/java/hu/bme/mit/train/sensor/TrainSensorImpl.java diff --git a/train-system/target/surefire-reports/TEST-hu.bme.mit.train.system.TrainSystemTest.xml b/train-system/target/surefire-reports/TEST-hu.bme.mit.train.system.TrainSystemTest.xml index 870f87c75..9428d0f86 100644 --- a/train-system/target/surefire-reports/TEST-hu.bme.mit.train.system.TrainSystemTest.xml +++ b/train-system/target/surefire-reports/TEST-hu.bme.mit.train.system.TrainSystemTest.xml @@ -1,10 +1,10 @@ - + - + @@ -13,7 +13,7 @@ - + @@ -60,8 +60,8 @@ - + - - + + \ No newline at end of file diff --git a/train-system/target/surefire-reports/hu.bme.mit.train.system.TrainSystemTest.txt b/train-system/target/surefire-reports/hu.bme.mit.train.system.TrainSystemTest.txt index a9eacf699..276aeb512 100644 --- a/train-system/target/surefire-reports/hu.bme.mit.train.system.TrainSystemTest.txt +++ b/train-system/target/surefire-reports/hu.bme.mit.train.system.TrainSystemTest.txt @@ -1,4 +1,4 @@ ------------------------------------------------------------------------------- Test set: hu.bme.mit.train.system.TrainSystemTest ------------------------------------------------------------------------------- -Tests run: 4, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.178 sec +Tests run: 4, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.123 sec diff --git a/train-user/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/train-user/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst index 0f90dde27..8664864ab 100644 --- a/train-user/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst +++ b/train-user/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst @@ -1 +1 @@ -/home/cloud/ReteLabMIT2/train-user/src/main/java/hu/bme/mit/train/user/TrainUserImpl.java +/home/cloud/yjrrbk/ReteLabMIT2/train-user/src/main/java/hu/bme/mit/train/user/TrainUserImpl.java