From 98d5b4a92d148d9e853cd4366f125dc55bbd2059 Mon Sep 17 00:00:00 2001 From: "Carlos E. Feria Vila" Date: Mon, 10 Jan 2022 11:40:45 +0100 Subject: [PATCH] Upgrade to Quarkus 2.5.4.Final (#169) * comment tests * Fix tests * Fix tests * Restore main code and upgrade quarkus * Upgrade commons-rest version --- pom.xml | 17 ++++++++---- .../pathfinder/services/AssessmentSvc.java | 2 +- src/main/resources/application.properties | 2 ++ .../controllers/AssessmentsResourceTest.java | 3 ++- .../services/AssessmentSvcTest.java | 26 +++++++++++++------ 5 files changed, 35 insertions(+), 15 deletions(-) diff --git a/pom.xml b/pom.xml index 3691ef15..a4c029aa 100644 --- a/pom.xml +++ b/pom.xml @@ -12,10 +12,10 @@ 11 UTF-8 UTF-8 - 1.12.2.Final + 2.5.4.Final quarkus-universe-bom io.quarkus - 1.12.2.Final + 2.5.4.Final 3.0.0-M5 1.4.2.Final 1.18.20 @@ -105,12 +105,12 @@ com.github.konveyor.tackle-commons-rest commons-rest - 0.0.1 + 0.0.2 com.github.konveyor.tackle-commons-rest commons-rest-test - 0.0.1 + 0.0.2 test @@ -251,7 +251,7 @@ native ${quarkus.application.version:latest}-native - registry.access.redhat.com/ubi8-minimal@sha256:4d6547bbb7c5fe0f0d37b491c0c1975ff96bf4cf1c26dd665e3a5d70918b5564 + quay.io/quarkus/ubi-quarkus-mandrel:21.3-java11 @@ -289,6 +289,13 @@ + + container-image + + true + registry.access.redhat.com/ubi8-minimal@sha256:4d6547bbb7c5fe0f0d37b491c0c1975ff96bf4cf1c26dd665e3a5d70918b5564 + + podman diff --git a/src/main/java/io/tackle/pathfinder/services/AssessmentSvc.java b/src/main/java/io/tackle/pathfinder/services/AssessmentSvc.java index 75c07f30..d272d645 100644 --- a/src/main/java/io/tackle/pathfinder/services/AssessmentSvc.java +++ b/src/main/java/io/tackle/pathfinder/services/AssessmentSvc.java @@ -362,7 +362,7 @@ public AssessmentHeaderDto copyAssessment(@NotNull Long assessmentId, @NotNull L } @Transactional - private AssessmentQuestionnaire copyQuestionnaireBetweenAssessments(Assessment sourceAssessment, Assessment targetAssessment) { + protected AssessmentQuestionnaire copyQuestionnaireBetweenAssessments(Assessment sourceAssessment, Assessment targetAssessment) { AssessmentQuestionnaire questionnaire = AssessmentQuestionnaire.builder() .assessment(targetAssessment) .questionnaire(sourceAssessment.assessmentQuestionnaire.questionnaire) diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index e53aabc1..cfd1529c 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -32,6 +32,8 @@ quarkus.oidc.auth-server-url=http://keycloak:8080/auth/realms/quarkus quarkus.oidc.client-id=backend-service quarkus.oidc.credentials.secret=secret quarkus.oidc.tls.verification=none +quarkus.oidc.discovery-enabled=false +quarkus.oidc.jwks-path=protocol/openid-connect/certs # Kubernetes / Openshift quarkus.kubernetes.part-of=tackle diff --git a/src/test/java/io/tackle/pathfinder/controllers/AssessmentsResourceTest.java b/src/test/java/io/tackle/pathfinder/controllers/AssessmentsResourceTest.java index c20f0fab..132cb5d0 100644 --- a/src/test/java/io/tackle/pathfinder/controllers/AssessmentsResourceTest.java +++ b/src/test/java/io/tackle/pathfinder/controllers/AssessmentsResourceTest.java @@ -20,6 +20,7 @@ import io.tackle.pathfinder.model.questionnaire.Questionnaire; import io.tackle.pathfinder.services.AssessmentSvc; import lombok.extern.java.Log; +import org.eclipse.microprofile.config.ConfigProvider; import org.eclipse.microprofile.context.ManagedExecutor; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -1333,7 +1334,7 @@ public void given_ApplicationsAssessed_When_Confidence_Then_ResultIsTheExpected( @Test public void given_AssessmentAndTranslations_when_TranslationDeleted_then_ThatConceptHasTheNotTranslatedVallue() { - String KEYCLOAK_SERVER_URL = System.getProperty("quarkus.oidc.auth-server-url", "http://localhost:8180/auth"); + String KEYCLOAK_SERVER_URL = ConfigProvider.getConfig().getOptionalValue("quarkus.oidc.auth-server-url", String.class).orElse("http://localhost:8180/auth"); String ACCESS_TOKEN_JDOE = RestAssured.given().relaxedHTTPSValidation() .auth().preemptive() .basic("backend-service", "secret") diff --git a/src/test/java/io/tackle/pathfinder/services/AssessmentSvcTest.java b/src/test/java/io/tackle/pathfinder/services/AssessmentSvcTest.java index 981fcfb6..6b8e0128 100644 --- a/src/test/java/io/tackle/pathfinder/services/AssessmentSvcTest.java +++ b/src/test/java/io/tackle/pathfinder/services/AssessmentSvcTest.java @@ -250,7 +250,7 @@ public void given_CreatedAssessment_When_UpdateWithStakeholdersEmpty_Then_ItDele } @Transactional - private boolean getCheckedForOption(Assessment assessment, Long categoryId, Long questionId, Long optionId) { + public boolean getCheckedForOption(Assessment assessment, Long categoryId, Long questionId, Long optionId) { log.info("categories to check " + assessment.assessmentQuestionnaire.categories.size()); log.info("categories to check " + assessment.assessmentQuestionnaire.categories.stream().map(e -> e.id.toString()).collect(Collectors.joining(" ## "))); @@ -266,7 +266,7 @@ private boolean getCheckedForOption(Assessment assessment, Long categoryId, Long } @Transactional - private void addStakeholdersToAssessment(Assessment assessment) { + public void addStakeholdersToAssessment(Assessment assessment) { AssessmentStakeholder stakeholder = AssessmentStakeholder.builder().assessment(assessment).stakeholderId(100L).build(); stakeholder.persist(); assessment.stakeholders.add(stakeholder); @@ -300,8 +300,13 @@ public void given_SameApplication_when_SeveralAssessmentCreation_should_ThrowExc Assessment assessment = createAssessment(questionnaire, 57L); transaction.commit(); return assessment; - } catch (Exception exc) { - return null; + } catch (Throwable exc) { + try { + transaction.rollback(); + } catch (SystemException e) { + e.printStackTrace(); + } + throw new CompletionException(exc); } }); Thread.sleep(500); @@ -311,7 +316,12 @@ public void given_SameApplication_when_SeveralAssessmentCreation_should_ThrowExc Assessment assessment = createAssessment(questionnaire, 57L); transaction.commit(); return assessment; - } catch (Exception exc) { + } catch (Throwable exc) { + try { + transaction.rollback(); + } catch (SystemException e) { + e.printStackTrace(); + } throw new CompletionException(exc); } }); @@ -558,7 +568,7 @@ public Questionnaire createQuestionnaire(String title) { } @Transactional - private Category createCategory(Questionnaire questionnaire, int order) { + public Category createCategory(Questionnaire questionnaire, int order) { Category category = Category.builder() .name("category-" + order) .order(order) @@ -572,7 +582,7 @@ private Category createCategory(Questionnaire questionnaire, int order) { } @Transactional - private Question createQuestion(Category category, int i) { + public Question createQuestion(Category category, int i) { Question question = Question.builder() .name("question-" + i) .order(i) @@ -590,7 +600,7 @@ private Question createQuestion(Category category, int i) { } @Transactional - private SingleOption createSingleOption(Question question, int i) { + public SingleOption createSingleOption(Question question, int i) { SingleOption single = SingleOption.builder() .option("option-" + i) .order(i)