From adf3666430e9a8e722c12f020d23290a9c729c40 Mon Sep 17 00:00:00 2001 From: Jan Date: Fri, 6 Feb 2026 14:37:54 +0100 Subject: [PATCH] wip: input data fixed --- .gitea/workflows/test.yml | 74 ++++++++ pom.xml | 27 ++- .../lcc/e2e/testdata/TestCaseExpected.java | 2 +- .../de/avatic/lcc/e2e/testdata/TestCases.java | 172 +++++++++--------- src/test/resources/master_data/users.sql | 4 + 5 files changed, 191 insertions(+), 88 deletions(-) create mode 100644 .gitea/workflows/test.yml diff --git a/.gitea/workflows/test.yml b/.gitea/workflows/test.yml new file mode 100644 index 0000000..4e187eb --- /dev/null +++ b/.gitea/workflows/test.yml @@ -0,0 +1,74 @@ +name: Tests + +on: + push: + branches: [main, dev] + pull_request: + branches: [main] + +env: + ALLURE_SERVER: "http://10.80.0.6:5050" + ALLURE_PROJECT: "lcc" + +jobs: + test: + runs-on: ubuntu-latest + container: + image: catthehacker/ubuntu:act-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Java 23 + uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: '23' + cache: 'maven' + + - name: Run Tests + run: mvn verify -B --no-transfer-progress + env: + TESTCONTAINERS_RYUK_DISABLED: "true" + + - name: Prepare Allure Results + if: always() + run: | + cat > target/allure-results/executor.json << EOF + { + "name": "Gitea Actions", + "type": "gitea", + "buildName": "#${{ gitea.run_number }}", + "buildOrder": ${{ gitea.run_number }}, + "buildUrl": "${{ gitea.server_url }}/${{ gitea.repository }}/actions/runs/${{ gitea.run_id }}" + } + EOF + + - name: Upload to Allure + if: always() + run: | + # Projekt anlegen falls nicht vorhanden + curl -s -o /dev/null \ + -u admin:${{ secrets.ALLURE_PASSWORD }} \ + -X POST "${ALLURE_SERVER}/allure-docker-service/projects" \ + -H "Content-Type: application/json" \ + -d '{"id": "'${ALLURE_PROJECT}'"}' || true + + # Results aufräumen + curl -s \ + -u admin:${{ secrets.ALLURE_PASSWORD }} \ + "${ALLURE_SERVER}/allure-docker-service/clean-results?project_id=${ALLURE_PROJECT}" + + # Results hochladen + for f in target/allure-results/*; do + [ -f "$f" ] && curl -s \ + -u admin:${{ secrets.ALLURE_PASSWORD }} \ + -X POST "${ALLURE_SERVER}/allure-docker-service/send-results?project_id=${ALLURE_PROJECT}" \ + -F "results[]=@$f" + done + + # Report generieren + curl -s \ + -u admin:${{ secrets.ALLURE_PASSWORD }} \ + "${ALLURE_SERVER}/allure-docker-service/generate-report?project_id=${ALLURE_PROJECT}" \ No newline at end of file diff --git a/pom.xml b/pom.xml index 012aec4..eb8de9f 100644 --- a/pom.xml +++ b/pom.xml @@ -33,6 +33,13 @@ 11.18.0 + + + io.qameta.allure + allure-junit5 + 2.29.0 + test + org.springframework.boot spring-boot-starter-jdbc @@ -244,6 +251,13 @@ test + + org.aspectj + aspectjweaver + 1.9.21 + test + + @@ -259,6 +273,7 @@ + org.codehaus.mojo versions-maven-plugin @@ -284,15 +299,25 @@ - org.apache.maven.plugins maven-surefire-plugin 3.5.4 -javaagent:${settings.localRepository}/org/mockito/mockito-core/${mockito.version}/mockito-core-${mockito.version}.jar + -javaagent:${settings.localRepository}/org/aspectj/aspectjweaver/1.9.22/aspectjweaver-1.9.22.jar + + ${project.build.directory}/allure-results + + + + org.aspectj + aspectjweaver + 1.9.21 + + org.springframework.boot diff --git a/src/test/java/de/avatic/lcc/e2e/testdata/TestCaseExpected.java b/src/test/java/de/avatic/lcc/e2e/testdata/TestCaseExpected.java index 6d92d4c..a2a5c5e 100644 --- a/src/test/java/de/avatic/lcc/e2e/testdata/TestCaseExpected.java +++ b/src/test/java/de/avatic/lcc/e2e/testdata/TestCaseExpected.java @@ -68,7 +68,7 @@ public record TestCaseExpected( return this; } - public Builder d2d(double d2d) { + public Builder d2d(Double d2d) { this.d2d = d2d; return this; } diff --git a/src/test/java/de/avatic/lcc/e2e/testdata/TestCases.java b/src/test/java/de/avatic/lcc/e2e/testdata/TestCases.java index 2ee70b1..431ce97 100644 --- a/src/test/java/de/avatic/lcc/e2e/testdata/TestCases.java +++ b/src/test/java/de/avatic/lcc/e2e/testdata/TestCases.java @@ -53,18 +53,18 @@ public final class TestCases { .build(), TestCaseExpected.builder() .mekA(8.0) - .logisticCost(33.75985361256046) - .mekB(41.75985361256046) + .logisticCost(33.76) + .mekB(41.76) .fcaFee(0.0) - .transportation(4.29165) + .transportation(4.29) .d2d(0.0) .airFreight(0.0) .custom(0.0) .repackaging(0.0) .handling(4.392) .disposal(0.0) - .space(24.952728074399992) - .capital(0.12347553816046966) + .space(24.95) + .capital(0.12) .safetyStock(10) .destinations(List.of( DestinationExpected.builder() @@ -128,18 +128,18 @@ public final class TestCases { .build(), TestCaseExpected.builder() .mekA(230.0) - .logisticCost(1.413250548826279) - .mekB(231.41325054882628) + .logisticCost(1.41) + .mekB(231.41) .fcaFee(0.46) - .transportation(0.022133802105263157) + .transportation(0.02) .d2d(0.0) .airFreight(0.0) .custom(0.0) - .repackaging(0.001613157894736842) - .handling(0.001530701754385965) - .disposal(0.003907894736842105) - .space(0.009627000252631579) - .capital(0.9144379920824194) + .repackaging(0.00) + .handling(0.00) + .disposal(0.00) + .space(0.01) + .capital(0.91) .safetyStock(10) .destinations(List.of( DestinationExpected.builder() @@ -214,18 +214,18 @@ public final class TestCases { .build(), TestCaseExpected.builder() .mekA(11.0) - .logisticCost(0.33018468622916425) - .mekB(11.330184686229165) + .logisticCost(0.33) + .mekB(11.33) .fcaFee(0.022) - .transportation(0.05941010149411764) + .transportation(0.06) .d2d(0.0) .airFreight(0.0) - .custom(0.2058839717254) - .repackaging(0.003) - .handling(0.004015905882352942) - .disposal(0.001411764705882353) - .space(0.007002467458823528) - .capital(0.02746047496258778) + .custom(0.21) + .repackaging(0.00) + .handling(0.00) + .disposal(0.00) + .space(0.00) + .capital(0.03) .safetyStock(10) .destinations(List.of( DestinationExpected.builder() @@ -290,18 +290,18 @@ public final class TestCases { .build(), TestCaseExpected.builder() .mekA(11.0) - .logisticCost(0.33666333119914466) - .mekB(11.336663331199144) - .fcaFee(0.022) - .transportation(0.0644631867) + .logisticCost(0.34) + .mekB(11.34) + .fcaFee(0.02) + .transportation(0.06) .d2d(0.0) .airFreight(0.0) - .custom(0.2094698741739) + .custom(0.21) .repackaging(0.0) - .handling(0.0054199999999999995) + .handling(0.01) .disposal(0.0) - .space(0.0057600941999999995) - .capital(0.029550176125244645) + .space(0.01) + .capital(0.03) .safetyStock(10) .destinations(List.of( DestinationExpected.builder() @@ -354,18 +354,18 @@ public final class TestCases { .build(), TestCaseExpected.builder() .mekA(56.87) - .logisticCost(2.5379307573423042) - .mekB(59.4079307573423) + .logisticCost(2.54) + .mekB(59.41) .fcaFee(0.0) .transportation(0.0) - .d2d(0.026309523809523814) + .d2d(0.026) .airFreight(0.0) - .custom(1.7083476190476192) + .custom(1.71) .repackaging(0.0) - .handling(0.0008798333333333333) - .disposal(0.0006) - .space(0.0010396970030999997) - .capital(0.8007540841487281) + .handling(0.00) + .disposal(0.00) + .space(0.00) + .capital(0.80) .safetyStock(10) .destinations(List.of( DestinationExpected.builder() @@ -433,18 +433,18 @@ public final class TestCases { .build(), TestCaseExpected.builder() .mekA(8.0) - .logisticCost(8.612428329367493) - .mekB(16.612428329367493) - .fcaFee(0.016) + .logisticCost(8.61) + .mekB(16.61) + .fcaFee(0.02) .transportation(0.0) .d2d(8.0) .airFreight(0.0) .custom(0.0) - .repackaging(0.039999999999999994) + .repackaging(0.04) .handling(0.245) - .disposal(0.0028333333333333335) - .space(0.16635152049599994) - .capital(0.1422434755381605) + .disposal(0.00) + .space(0.17) + .capital(0.14) .safetyStock(10) .destinations(List.of( DestinationExpected.builder() @@ -525,18 +525,18 @@ public final class TestCases { .build(), TestCaseExpected.builder() .mekA(18.2) - .logisticCost(0.3853939170089231) - .mekB(18.585393917008922) + .logisticCost(0.36) + .mekB(18.59) .fcaFee(0.0) .transportation(0.0) - .d2d(0.06923307692307692) + .d2d(0.07) .airFreight(0.0) .custom(0.0) - .repackaging(0.0025984615384615386) - .handling(0.007116923076923077) - .disposal(0.002653846153846154) - .space(0.028791609316615382) - .capital(0.275) + .repackaging(0.00) + .handling(0.01) + .disposal(0.00) + .space(0.03) + .capital(0.28) .safetyStock(10) .destinations(List.of( DestinationExpected.builder() @@ -603,18 +603,18 @@ public final class TestCases { .build(), TestCaseExpected.builder() .mekA(56.87) - .logisticCost(5.227211225310775) - .mekB(62.09721122531077) - .fcaFee(0.11374) + .logisticCost(5.23) + .mekB(62.10) + .fcaFee(0.11) .transportation(0.0) .d2d(0.39) - .airFreight(0.0115344) - .custom(1.7247122) - .repackaging(0.00034144) - .handling(0.00047695999999999996) - .disposal(0.0006) - .space(0.007485818422319998) - .capital(2.9783204068884546) + .airFreight(0.01) + .custom(1.72) + .repackaging(0.00) + .handling(0.00) + .disposal(0.00) + .space(0.01) + .capital(2.98) .safetyStock(100) .destinations(List.of( DestinationExpected.builder() @@ -667,18 +667,18 @@ public final class TestCases { .build(), TestCaseExpected.builder() .mekA(18.2) - .logisticCost(2.9027159030831053) - .mekB(21.102715903083105) + .logisticCost(2.90) + .mekB(21.10) .fcaFee(0.0) .transportation(0.0) .d2d(0.9) .airFreight(0.0) .custom(0.58) - .repackaging(0.05173333333333333) - .handling(0.049493333333333334) + .repackaging(0.05) + .handling(0.05) .disposal(0.04) - .space(0.3302454007999999) - .capital(0.9512438356164384) + .space(0.33) + .capital(0.95) .safetyStock(55) .destinations(List.of( DestinationExpected.builder() @@ -729,18 +729,18 @@ public final class TestCases { .build(), TestCaseExpected.builder() .mekA(8.0) - .logisticCost(866.0954912837934) - .mekB(874.0954912837934) + .logisticCost(866.10) + .mekB(874.10) .fcaFee(0.0) .transportation(836.22) .d2d(0.0) .airFreight(0.0) .custom(0.0) - .repackaging(0.388) - .handling(4.392) + .repackaging(0.39) + .handling(4.39) .disposal(0.0) - .space(24.952728074399992) - .capital(0.14276320939334639) + .space(24.95) + .capital(0.14) .safetyStock(10) .destinations(List.of( DestinationExpected.builder() @@ -794,18 +794,18 @@ public final class TestCases { .build(), TestCaseExpected.builder() .mekA(8.0) - .logisticCost(108.85563974511213) - .mekB(116.85563974511213) - .fcaFee(0.016) - .transportation(104.5275) + .logisticCost(108.86) + .mekB(116.86) + .fcaFee(0.02) + .transportation(104.53) .d2d(0.0) .airFreight(0.0) .custom(0.0) .repackaging(0.3) .handling(0.45) .disposal(0.3) - .space(3.119091009299999) - .capital(0.1430487358121331) + .space(3.12) + .capital(0.14) .safetyStock(10) .destinations(List.of( DestinationExpected.builder() @@ -856,13 +856,13 @@ public final class TestCases { .build(), TestCaseExpected.builder() .mekA(8.0) - .logisticCost(11.186192) - .mekB(19.186192) - .fcaFee(0.016) + .logisticCost(11.19) + .mekB(19.19) + .fcaFee(0.02) .transportation(7.3) .d2d(0.0) - .airFreight(3.4603200000000007) - .custom(0.40987200000000007) + .airFreight(3.46) + .custom(0.41) .repackaging(0.0) .handling(0.0) .disposal(0.0) diff --git a/src/test/resources/master_data/users.sql b/src/test/resources/master_data/users.sql index 3b280e6..5a180f8 100644 --- a/src/test/resources/master_data/users.sql +++ b/src/test/resources/master_data/users.sql @@ -12,6 +12,10 @@ INSERT INTO sys_user_group_mapping (group_id, user_id) VALUES ((SELECT id FROM sys_group WHERE group_name = 'super'), (SELECT id FROM sys_user WHERE email = 'john.doe@company.com')); +INSERT INTO sys_user_group_mapping (group_id, user_id) +VALUES ((SELECT id FROM sys_group WHERE group_name = 'right-management'), + (SELECT id FROM sys_user WHERE email = 'john.doe@company.com')); + INSERT INTO sys_user_group_mapping (group_id, user_id) VALUES ((SELECT id FROM sys_group WHERE group_name = 'basic'), (SELECT id FROM sys_user WHERE email = 'sarah.smith@company.com'));