From 4589280520d3d4fa9fcbbca0777eb8bee8b011be Mon Sep 17 00:00:00 2001 From: Mathias Mouly Date: Thu, 19 Dec 2024 11:51:57 +0100 Subject: [PATCH] Jakarta (#63) * Prepare IFixes release 9.0.0.1 (#59) * Decisions convergence (#48) * Implement support for both Decisions products and refactoring - Made service compatible with ODM and ADS - Integrated metering model for simplified dependencies - Renamed packages, options, produced jar file - Adapted, refactored and reviewed documentation accordingly * Update copyright notices * Deliver next release - 8.12.0 (#45) * Switch to the next version * Change copyright year: DBACLD-90119 * Pre delivery 812 (#44) * Prepare new release. * increase time to run test * Change liberty version for the next release * Use a pre-deploy ruleset * Adapt test after moving to the new rule set * Prepare next delivery * Update Chart.yaml - Fix bad odm version * fix bad version * Update test.sh * Update docker-compose.yml Try to add network * Update docker-compose.yml - Remove network * Update build-and-test.yml * Update build-and-test.yml debug * Update test.sh * Update test.sh * Take the new jar file name into account * Trigger new action build --------- Co-authored-by: Anthony Acremann * Prepare next release * Update Liberty version * Update build-and-test.yml * Update build-and-test.yml * Update build-and-test.yml - Revert * Bad reference url * Update build-and-test.yml - Change Liberty version * Change for the next release * Update build-and-test.yml * Try to workaround issue DBACLD-118818 * Fix location * Update Chart.yaml * Update values.yaml * Update values.yaml * Move to the new release name 9.0.0 * Linter failed * DBACLD-125217 Metering service does not store correctly the metrics * Override delivery to fix issue * New description for the dockerjub * DBACLD-125376 Change copyright * Dbacld 125217 (#50) * Fix configuration of the service * DBACLD-125217 * Try to fix Github action * Fix initVariable syntax * Fix shell syntax. * no message * Debug * Fix metrics check * Move to JDK 17 * improve logging * DBACLD-134790 Change License for the next release * Prepare next release * Preprare next release * Prepare next release * Update README_ODM.md * Update Chart.yaml * Update kuberentes version * Fix Kubernetes requirement * Change home url + Kubernetes version * Try to add artifacthub verified status * Add markdown link check (#53) * DBACLD-139987 - Put in place checker link * ignore some broken links * ignore broken links with localhost URL --------- Co-authored-by: Frederic Mercier * Fix broken link * Fix broken link * prepare next release 24.1.0 (#55) * DBACLD-148300 Enable detect secret * DBACLD-148300 Enable detect secret * Update README.md * add GitHub action running detect-secrets * send notification to Slack if detect-secrets failed * Prep delivery - First pass fix linter (#56) * Prepare next release * Move to a CV new version * Try to fix build. Improve certification level. * Fix remaining linter issues * Fix ODM version to be able to test * Prep delivery (#57) * Prepare next release * Move to a CV new version * Try to fix build. Improve certification level. * Fix remaining linter issues * Fix ODM version to be able to test * Switch Java version to jdk 17 + update the linter version. * Remove duplicate entry * Fix liberty location image * Prep delivery 2401 (#58) * Switch Java version to jdk 17 + update the linter version. * Remove duplicate entry * Fix liberty location image * Preparing new delivery of the helm charts --------- Co-authored-by: Anthony Acremann Co-authored-by: Frederic Mercier Co-authored-by: Frederic Mercier Co-authored-by: siasin * move to spring-boot-2.7.18 * move to spring-boot-2.7.18 * Value too long for column issue * move to spring-boot-3.0 * uses java 17 * sprint boot 3.1.5 * sprint boot 3.1.12 * issue on hibernate * tentative null comparison * move to SB 3.40 * remove deprecation --------- Co-authored-by: Laurent GRATEAU Co-authored-by: Anthony Acremann Co-authored-by: Frederic Mercier Co-authored-by: Frederic Mercier Co-authored-by: siasin --- .github/workflows/build-and-test.yml | 3 +++ docker/config/featureManager.xml | 4 ++-- docker/installscripts/installFeatures.sh | 2 +- .../registration/RegistrationRequest.java | 4 ++-- .../ilmt/model/usage/UsageRequest.java | 4 ++-- pom.xml | 6 +++--- service/pom.xml | 20 ++++++++++--------- .../application/CustomErrorController.java | 7 +++---- .../application/ExceptionController.java | 2 +- .../application/GlobalErrorHandler.java | 4 ++-- .../application/ILMTBackupController.java | 2 +- .../MeteringServiceApplication.java | 2 +- .../metric/repository/MetricEntity.java | 8 ++++---- .../repository/RegistrationEntity.java | 13 +++++++----- .../reporting/repository/ReportEntity.java | 8 ++++---- .../service/usage/repository/UsageEntity.java | 10 ++++++---- .../usage/repository/UsageRepository.java | 4 ++-- .../service/application/EndpointsTest.java | 2 +- 18 files changed, 57 insertions(+), 48 deletions(-) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index d5d33b3..8c8ebd1 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -38,6 +38,9 @@ jobs: ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }} ARTIFACTORY_USER: ${{ secrets.ARTIFACTORY_USER }} ODM_URL: ${{ secrets.ODM_URL }} + - uses: actions/setup-java@v1 + with: + java-version: 17 - run: bash build.sh - run: echo "${{ secrets.ARTIFACTORY_PASSWORD }}" | docker login ${{ secrets.ARTIFACTORY_URL }} --username ${{ secrets.ARTIFACTORY_USER }} --password-stdin - run: sudo docker-compose build diff --git a/docker/config/featureManager.xml b/docker/config/featureManager.xml index a078db5..fe53f49 100644 --- a/docker/config/featureManager.xml +++ b/docker/config/featureManager.xml @@ -1,8 +1,8 @@ - servlet-4.0 - springBoot-2.0 + servlet-6.0 + springBoot-3.0 transportSecurity-1.0 diff --git a/docker/installscripts/installFeatures.sh b/docker/installscripts/installFeatures.sh index b3e6aa8..c78484b 100755 --- a/docker/installscripts/installFeatures.sh +++ b/docker/installscripts/installFeatures.sh @@ -3,7 +3,7 @@ set -x # Install the driver for Derby echo "Install the feature list for ODM on Liberty" ROOTFEATUREDIR=/opt/wlppackage -PACKAGELIST="servlet-4.0 springBoot-2.0 transportSecurity-1.0" +PACKAGELIST="servlet-6.0 springBoot-3.0 transportSecurity-1.0" ls /opt/wlppackage/ rm /opt/wlppackage/.donotremoved if [ ! -d $ROOTFEATUREDIR/features ]; then diff --git a/model/src/main/java/com/ibm/decision/metering/ilmt/model/registration/RegistrationRequest.java b/model/src/main/java/com/ibm/decision/metering/ilmt/model/registration/RegistrationRequest.java index f5f50fe..fa4e500 100644 --- a/model/src/main/java/com/ibm/decision/metering/ilmt/model/registration/RegistrationRequest.java +++ b/model/src/main/java/com/ibm/decision/metering/ilmt/model/registration/RegistrationRequest.java @@ -232,8 +232,8 @@ public int hashCode() { + (operatingSystemVersion == null ? 0 : operatingSystemVersion .hashCode()) + (cloudServicesUsed == null ? 0 : cloudServicesUsed.hashCode()) - + new Long(startTime).hashCode() - + new Long(sendTime).hashCode() + + Long.valueOf(startTime).hashCode() + + Long.valueOf(sendTime).hashCode() + (customerTagData == null ? 0 : customerTagData.hashCode()) + (products == null ? 0 : products.hashCode()) + (metrics == null ? 0 : metrics.hashCode()) diff --git a/model/src/main/java/com/ibm/decision/metering/ilmt/model/usage/UsageRequest.java b/model/src/main/java/com/ibm/decision/metering/ilmt/model/usage/UsageRequest.java index f70c284..7a66c68 100644 --- a/model/src/main/java/com/ibm/decision/metering/ilmt/model/usage/UsageRequest.java +++ b/model/src/main/java/com/ibm/decision/metering/ilmt/model/usage/UsageRequest.java @@ -146,8 +146,8 @@ public boolean equals(Object object) { public int hashCode() { return 37 + super.hashCode() - + new Long(startTime).hashCode() - + new Long(endTime).hashCode() + + Long.valueOf(startTime).hashCode() + + Long.valueOf(endTime).hashCode() + (environmentType == null ? 0 : environmentType.hashCode()) + (usageList == null ? 0 : usageList.hashCode()) + (productSpecificData == null ? 0 : productSpecificData diff --git a/pom.xml b/pom.xml index 1ce511c..0ca8e59 100644 --- a/pom.xml +++ b/pom.xml @@ -11,12 +11,12 @@ UTF-8 UTF-8 - 8 - 8 + 17 + 17 model service - \ No newline at end of file + diff --git a/service/pom.xml b/service/pom.xml index 664bd23..7476910 100644 --- a/service/pom.xml +++ b/service/pom.xml @@ -4,7 +4,7 @@ org.springframework.boot spring-boot-starter-parent - 2.2.4.RELEASE + 3.4.0 com.ibm.decision @@ -16,7 +16,7 @@ UTF-8 UTF-8 - 1.8 + 17 ${env.ODMHOME} ${env.ILMT_JAR_PATH} @@ -63,6 +63,12 @@ org.springframework.boot spring-boot-starter + + + org.yaml + snakeyaml + + org.springframework.boot @@ -76,14 +82,10 @@ org.springframework.boot spring-boot-starter-data-jpa - - org.springframework.boot - spring-boot-starter-actuator - com.h2database h2 - 1.4.200 + 2.2.224 runtime @@ -116,7 +118,7 @@ com.fasterxml.jackson.dataformat jackson-dataformat-xml - 2.9.6 + 2.15.2 test @@ -168,4 +170,4 @@ metering-service-no-dependencies - \ No newline at end of file + diff --git a/service/src/main/java/com/ibm/decision/metering/ilmt/service/application/CustomErrorController.java b/service/src/main/java/com/ibm/decision/metering/ilmt/service/application/CustomErrorController.java index d093939..7d07551 100644 --- a/service/src/main/java/com/ibm/decision/metering/ilmt/service/application/CustomErrorController.java +++ b/service/src/main/java/com/ibm/decision/metering/ilmt/service/application/CustomErrorController.java @@ -17,7 +17,7 @@ */ package com.ibm.decision.metering.ilmt.service.application; -import javax.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletRequest; import org.springframework.boot.web.servlet.error.ErrorController; import org.springframework.stereotype.Controller; @@ -33,8 +33,7 @@ public String handleError(HttpServletRequest request) { return GlobalErrorHandler.handleError(request, null); } - @Override public String getErrorPath() { - return "/error"; + return null; } -} \ No newline at end of file +} diff --git a/service/src/main/java/com/ibm/decision/metering/ilmt/service/application/ExceptionController.java b/service/src/main/java/com/ibm/decision/metering/ilmt/service/application/ExceptionController.java index 4cda15f..f00448d 100644 --- a/service/src/main/java/com/ibm/decision/metering/ilmt/service/application/ExceptionController.java +++ b/service/src/main/java/com/ibm/decision/metering/ilmt/service/application/ExceptionController.java @@ -17,7 +17,7 @@ */ package com.ibm.decision.metering.ilmt.service.application; -import javax.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletRequest; import org.springframework.web.bind.annotation.ControllerAdvice; import org.springframework.web.bind.annotation.ExceptionHandler; diff --git a/service/src/main/java/com/ibm/decision/metering/ilmt/service/application/GlobalErrorHandler.java b/service/src/main/java/com/ibm/decision/metering/ilmt/service/application/GlobalErrorHandler.java index 2158f5f..0cff17e 100644 --- a/service/src/main/java/com/ibm/decision/metering/ilmt/service/application/GlobalErrorHandler.java +++ b/service/src/main/java/com/ibm/decision/metering/ilmt/service/application/GlobalErrorHandler.java @@ -17,8 +17,8 @@ */ package com.ibm.decision.metering.ilmt.service.application; -import javax.servlet.RequestDispatcher; -import javax.servlet.http.HttpServletRequest; +import jakarta.servlet.RequestDispatcher; +import jakarta.servlet.http.HttpServletRequest; import org.slf4j.Logger; diff --git a/service/src/main/java/com/ibm/decision/metering/ilmt/service/application/ILMTBackupController.java b/service/src/main/java/com/ibm/decision/metering/ilmt/service/application/ILMTBackupController.java index c2cb4aa..07499d3 100644 --- a/service/src/main/java/com/ibm/decision/metering/ilmt/service/application/ILMTBackupController.java +++ b/service/src/main/java/com/ibm/decision/metering/ilmt/service/application/ILMTBackupController.java @@ -25,7 +25,7 @@ import java.util.zip.ZipEntry; import java.util.zip.ZipOutputStream; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpServletResponse; import org.slf4j.Logger; import org.springframework.beans.factory.annotation.Value; diff --git a/service/src/main/java/com/ibm/decision/metering/ilmt/service/application/MeteringServiceApplication.java b/service/src/main/java/com/ibm/decision/metering/ilmt/service/application/MeteringServiceApplication.java index fd57bb8..593a166 100644 --- a/service/src/main/java/com/ibm/decision/metering/ilmt/service/application/MeteringServiceApplication.java +++ b/service/src/main/java/com/ibm/decision/metering/ilmt/service/application/MeteringServiceApplication.java @@ -23,7 +23,7 @@ import java.util.Properties; import java.util.stream.Collectors; -import javax.annotation.PostConstruct; +import jakarta.annotation.PostConstruct; import org.slf4j.Logger; import org.springframework.beans.factory.annotation.Value; diff --git a/service/src/main/java/com/ibm/decision/metering/ilmt/service/metric/repository/MetricEntity.java b/service/src/main/java/com/ibm/decision/metering/ilmt/service/metric/repository/MetricEntity.java index b1e134e..4847b07 100644 --- a/service/src/main/java/com/ibm/decision/metering/ilmt/service/metric/repository/MetricEntity.java +++ b/service/src/main/java/com/ibm/decision/metering/ilmt/service/metric/repository/MetricEntity.java @@ -19,10 +19,10 @@ import java.util.UUID; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.Table; +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.Id; +import jakarta.persistence.Table; @Entity @Table(name = "METRIC") diff --git a/service/src/main/java/com/ibm/decision/metering/ilmt/service/registration/repository/RegistrationEntity.java b/service/src/main/java/com/ibm/decision/metering/ilmt/service/registration/repository/RegistrationEntity.java index 4a8f9a2..b7310db 100644 --- a/service/src/main/java/com/ibm/decision/metering/ilmt/service/registration/repository/RegistrationEntity.java +++ b/service/src/main/java/com/ibm/decision/metering/ilmt/service/registration/repository/RegistrationEntity.java @@ -17,10 +17,11 @@ */ package com.ibm.decision.metering.ilmt.service.registration.repository; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.Table; +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.Id; +import jakarta.persistence.Lob; +import jakarta.persistence.Table; import org.slf4j.Logger; @@ -34,13 +35,15 @@ public class RegistrationEntity { private final static Logger LOGGER = Environment.getLogger(); - @Id + @Id @Column(name="ID") private String id; + @Column(name="LAST_UPDATE") private long lastUpdate; + @Lob @Column(name="DEFINITION") private String definition; diff --git a/service/src/main/java/com/ibm/decision/metering/ilmt/service/reporting/repository/ReportEntity.java b/service/src/main/java/com/ibm/decision/metering/ilmt/service/reporting/repository/ReportEntity.java index f195159..404972d 100644 --- a/service/src/main/java/com/ibm/decision/metering/ilmt/service/reporting/repository/ReportEntity.java +++ b/service/src/main/java/com/ibm/decision/metering/ilmt/service/reporting/repository/ReportEntity.java @@ -20,10 +20,10 @@ import java.time.Instant; import java.util.UUID; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.Table; +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.Id; +import jakarta.persistence.Table; @Entity @Table(name = "REPORT") diff --git a/service/src/main/java/com/ibm/decision/metering/ilmt/service/usage/repository/UsageEntity.java b/service/src/main/java/com/ibm/decision/metering/ilmt/service/usage/repository/UsageEntity.java index 6f0fc5b..fbe136c 100644 --- a/service/src/main/java/com/ibm/decision/metering/ilmt/service/usage/repository/UsageEntity.java +++ b/service/src/main/java/com/ibm/decision/metering/ilmt/service/usage/repository/UsageEntity.java @@ -20,10 +20,11 @@ import java.time.Instant; import java.util.UUID; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.Table; +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.Id; +import jakarta.persistence.Lob; +import jakarta.persistence.Table; import org.slf4j.Logger; @@ -46,6 +47,7 @@ public class UsageEntity { @Column(name="TIMESTAMP") private long timestamp; + @Lob @Column(name="DEFINITION") private String definition; diff --git a/service/src/main/java/com/ibm/decision/metering/ilmt/service/usage/repository/UsageRepository.java b/service/src/main/java/com/ibm/decision/metering/ilmt/service/usage/repository/UsageRepository.java index aac1b27..28d4d31 100644 --- a/service/src/main/java/com/ibm/decision/metering/ilmt/service/usage/repository/UsageRepository.java +++ b/service/src/main/java/com/ibm/decision/metering/ilmt/service/usage/repository/UsageRepository.java @@ -29,10 +29,10 @@ public interface UsageRepository extends CrudRepository { @Query("SELECT u FROM UsageEntity u WHERE u.id = ?1") List findByInstanceId(String instanceId); - @Query("SELECT m FROM UsageEntity m WHERE m.instanceId = ?1 AND m.report = null") + @Query("SELECT m FROM UsageEntity m WHERE m.instanceId = ?1 AND m.report IS null") List findByInstanceIdWhereNoReport(String instanceId); - @Query("SELECT m FROM UsageEntity m WHERE m.report = null") + @Query("SELECT m FROM UsageEntity m WHERE m.report IS null") List finAllUsagesNotReported(); @Query("SELECT m FROM UsageEntity m WHERE m.report IS NOT null") diff --git a/service/src/test/java/com/ibm/decision/metering/ilmt/service/application/EndpointsTest.java b/service/src/test/java/com/ibm/decision/metering/ilmt/service/application/EndpointsTest.java index ec64a60..65a8689 100644 --- a/service/src/test/java/com/ibm/decision/metering/ilmt/service/application/EndpointsTest.java +++ b/service/src/test/java/com/ibm/decision/metering/ilmt/service/application/EndpointsTest.java @@ -37,7 +37,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; -import org.springframework.boot.web.server.LocalServerPort; +import org.springframework.boot.test.web.server.LocalServerPort; import org.springframework.test.context.junit4.SpringRunner; import com.ibm.decision.metering.ilmt.service.application.util.RequestFactory;