From 040c4e9dc08cfaaa93e01cd3e29da2b673028c26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20B=C3=A9gaudeau?= Date: Thu, 21 Sep 2023 22:00:38 +0200 Subject: [PATCH] [256] Switch to Java 21 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bug: https://github.com/svalyn/svalyn-studio/issues/256 Signed-off-by: Stéphane Bégaudeau --- .github/workflows/continuous_integration.yml | 8 +++--- backend/svalyn-studio-application/pom.xml | 4 +-- .../services/account/AccountService.java | 26 ++++++------------- backend/svalyn-studio-domain/pom.xml | 4 +-- backend/svalyn-studio-infrastructure/pom.xml | 4 +-- backend/svalyn-studio-message/pom.xml | 4 +-- backend/svalyn-studio-parent/pom.xml | 8 +++--- backend/svalyn-studio-test-coverage/pom.xml | 4 +-- backend/svalyn-studio/pom.xml | 4 +-- 9 files changed, 28 insertions(+), 38 deletions(-) diff --git a/.github/workflows/continuous_integration.yml b/.github/workflows/continuous_integration.yml index 53a5d98c..529b544e 100644 --- a/.github/workflows/continuous_integration.yml +++ b/.github/workflows/continuous_integration.yml @@ -14,20 +14,20 @@ jobs: if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4.0.0 - name: Setup Node SDK - uses: actions/setup-node@v3 + uses: actions/setup-node@v3.8.1 with: node-version: '18.x' cache: 'npm' cache-dependency-path: frontend/svalyn-studio-app/package-lock.json - name: Setup Java SDK - uses: actions/setup-java@v3 + uses: actions/setup-java@v3.13.0 with: distribution: 'temurin' - java-version: 20 + java-version: 21 cache: 'maven' - name: Build the frontend diff --git a/backend/svalyn-studio-application/pom.xml b/backend/svalyn-studio-application/pom.xml index f4f70542..91e0ad2b 100644 --- a/backend/svalyn-studio-application/pom.xml +++ b/backend/svalyn-studio-application/pom.xml @@ -35,8 +35,8 @@ 2023.10.0-SNAPSHOT - 20 - 20 + 21 + 21 UTF-8 diff --git a/backend/svalyn-studio-application/src/main/java/com/svalyn/studio/application/services/account/AccountService.java b/backend/svalyn-studio-application/src/main/java/com/svalyn/studio/application/services/account/AccountService.java index ed673636..7b53f41d 100644 --- a/backend/svalyn-studio-application/src/main/java/com/svalyn/studio/application/services/account/AccountService.java +++ b/backend/svalyn-studio-application/src/main/java/com/svalyn/studio/application/services/account/AccountService.java @@ -107,30 +107,20 @@ public Page findAll(int page, int rowsPerPage) { @Override @Transactional public IPayload createAccount(CreateAccountInput input) { - IPayload payload = null; - var result = this.accountCreationService.createAccount(input.name(), input.email(), input.username(), input.password()); - if (result instanceof Failure failure) { - payload = new ErrorPayload(input.id(), failure.message()); - } else if (result instanceof Success success) { - payload = new CreateAccountSuccessPayload(input.id(), this.toDTO(success.data())); - } - - return payload; + return switch (result) { + case Failure failure -> new ErrorPayload(input.id(), failure.message()); + case Success success -> new CreateAccountSuccessPayload(input.id(), this.toDTO(success.data())); + }; } @Override @Transactional public IPayload deleteAccount(DeleteAccountInput input) { - IPayload payload = null; - var result = this.accountDeletionService.deleteAccount(input.username()); - if (result instanceof Failure failure) { - payload = new ErrorPayload(input.id(), failure.message()); - } else if (result instanceof Success) { - payload = new SuccessPayload(input.id()); - } - - return payload; + return switch (result) { + case Failure failure -> new ErrorPayload(input.id(), failure.message()); + case Success success -> new SuccessPayload(input.id()); + }; } } diff --git a/backend/svalyn-studio-domain/pom.xml b/backend/svalyn-studio-domain/pom.xml index fdb13bfc..ad72b6f2 100644 --- a/backend/svalyn-studio-domain/pom.xml +++ b/backend/svalyn-studio-domain/pom.xml @@ -35,8 +35,8 @@ 2023.10.0-SNAPSHOT - 20 - 20 + 21 + 21 UTF-8 diff --git a/backend/svalyn-studio-infrastructure/pom.xml b/backend/svalyn-studio-infrastructure/pom.xml index e713a415..139d9dcb 100644 --- a/backend/svalyn-studio-infrastructure/pom.xml +++ b/backend/svalyn-studio-infrastructure/pom.xml @@ -35,8 +35,8 @@ 2023.10.0-SNAPSHOT - 20 - 20 + 21 + 21 UTF-8 diff --git a/backend/svalyn-studio-message/pom.xml b/backend/svalyn-studio-message/pom.xml index 46a963bc..bd27dd62 100644 --- a/backend/svalyn-studio-message/pom.xml +++ b/backend/svalyn-studio-message/pom.xml @@ -35,8 +35,8 @@ 2023.10.0-SNAPSHOT - 20 - 20 + 21 + 21 UTF-8 diff --git a/backend/svalyn-studio-parent/pom.xml b/backend/svalyn-studio-parent/pom.xml index 5338f104..39a6faf6 100644 --- a/backend/svalyn-studio-parent/pom.xml +++ b/backend/svalyn-studio-parent/pom.xml @@ -36,8 +36,8 @@ pom - 20 - 20 + 21 + 21 UTF-8 @@ -57,7 +57,7 @@ - 20 + 21 temurin @@ -92,7 +92,7 @@ org.jacoco jacoco-maven-plugin - 0.8.9 + 0.8.10 diff --git a/backend/svalyn-studio-test-coverage/pom.xml b/backend/svalyn-studio-test-coverage/pom.xml index f259f57f..4468cdae 100644 --- a/backend/svalyn-studio-test-coverage/pom.xml +++ b/backend/svalyn-studio-test-coverage/pom.xml @@ -28,8 +28,8 @@ 2023.10.0-SNAPSHOT - 20 - 20 + 21 + 21 UTF-8 diff --git a/backend/svalyn-studio/pom.xml b/backend/svalyn-studio/pom.xml index 6d0d1b0f..d232cdd3 100644 --- a/backend/svalyn-studio/pom.xml +++ b/backend/svalyn-studio/pom.xml @@ -35,8 +35,8 @@ 2023.10.0-SNAPSHOT - 20 - 20 + 21 + 21 UTF-8