Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial investigation of Java 21 spring boot 3 #295

Draft
wants to merge 26 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
4dbbfef
Maven surefire wasn't running and failing test and warnings
pricem14pc Oct 11, 2024
a29b92d
Initial upgrade to java 21
pricem14pc Oct 13, 2024
9eada40
Updates to fix and break!
pricem14pc Oct 14, 2024
7787050
Fix formatting
pricem14pc Oct 14, 2024
58116f6
JDK 21 for GHA
pricem14pc Oct 14, 2024
3b663aa
WireMock change, but still failing locally!
pricem14pc Oct 14, 2024
6544cf2
Skipping failed tests for the purposes of build
pricem14pc Oct 14, 2024
38dcabb
auto patch increment
ras-rm-pr-bot Oct 14, 2024
a3e829a
Adding TODO: for Java 21 Spring Boot 3 tests
pricem14pc Oct 14, 2024
4411432
Merge branch 'java-21-spring-boot-3' of github.com:ONSdigital/rm-case…
pricem14pc Oct 14, 2024
1fd5dab
Postgres and hibernate
pricem14pc Oct 14, 2024
ad4d474
Google cloud and Pub/Sub
pricem14pc Oct 14, 2024
c3ddb41
Java 21 base image
pricem14pc Oct 14, 2024
48c2ca9
Adding parmater true to Maven compiler
pricem14pc Oct 15, 2024
1080e9f
Some additional changes
pricem14pc Oct 16, 2024
6221b8b
Assuming this will fail
pricem14pc Oct 29, 2024
ed06ff6
Merge branch 'main' into java-21-spring-boot-3
pricem14pc Oct 29, 2024
147fa9b
Revert again to pass
pricem14pc Oct 29, 2024
406ff45
auto patch increment
ras-rm-pr-bot Oct 29, 2024
7050195
Some TODO: info
pricem14pc Oct 30, 2024
a59f93d
Tidy up comments
pricem14pc Oct 30, 2024
de1bc3b
Removing hibernate-types-5
pricem14pc Oct 30, 2024
f031c5e
Reinstate tomakehurst direct
pricem14pc Oct 30, 2024
7d38a2c
fiddling with IT
pricem14pc Oct 30, 2024
3b7736c
Adding a RestClient strategy but seeing Class versions V1_5 or less m…
pricem14pc Oct 31, 2024
6d5601d
Some anaysis and extra work on the issue
pricem14pc Nov 1, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ jobs:
with:
fetch-depth: '0'
token: ${{ secrets.BOT_TOKEN }}
- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v1
with:
java-version: 17
java-version: 21

- uses: actions/cache@v1
with:
Expand Down
1 change: 1 addition & 0 deletions .java-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
21
2 changes: 1 addition & 1 deletion _infra/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM eclipse-temurin:17-jre-alpine
FROM eclipse-temurin:21-jre-alpine

ARG JAR_FILE=case.jar

Expand Down
4 changes: 2 additions & 2 deletions _infra/helm/case/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ type: application

# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
version: 12.0.23
version: 12.0.24

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application.
appVersion: 12.0.23
appVersion: 12.0.24
7 changes: 7 additions & 0 deletions checkstyle-suppressions.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suppressions PUBLIC
"-//Checkstyle//DTD SuppressionFilter Configuration 1.2//EN"
"https://checkstyle.org/dtds/suppressions_1_2.dtd">
<suppressions>
<suppress files="." checks="javadoc*"/>
</suppressions>
2 changes: 1 addition & 1 deletion checkstyle.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.3//EN"
"http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
"https://checkstyle.org/dtds/configuration_1_3.dtd">

<!--
This configuration file was written by the eclipse-cs plugin configuration editor
Expand Down
78 changes: 63 additions & 15 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,15 @@
<description>CaseService</description>

<properties>
<springboot.version>2.7.18</springboot.version>
<springboot.version>3.3.3</springboot.version>
<common.version>10.49.4</common.version>
<jackson.version>2.16.1</jackson.version>
<java.version>17</java.version>
<java.version>21</java.version>
<surefire.version>3.2.5</surefire.version>
<godaddylogging.version>1.2.5</godaddylogging.version>
<!-- godaddylogging.version>1.2.5</godaddylogging.version -->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<failsafe.skipITs>true</failsafe.skipITs>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To allow me to control the tests during development. This will of course be false when delivered.

</properties>

<scm>
Expand All @@ -40,14 +41,14 @@
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>libraries-bom</artifactId>
<version>26.29.0</version>
<version>26.47.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>spring-cloud-gcp-dependencies</artifactId>
<version>3.7.8</version>
<version>5.6.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Expand Down Expand Up @@ -133,6 +134,12 @@
<artifactId>spring-cloud-gcp-starter-pubsub</artifactId>
</dependency>

<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
</dependency>

<!-- SPRING END -->

<!-- third party libraries -->
Expand All @@ -157,15 +164,30 @@
<version>1.18.30</version>
</dependency>
<dependency>
<!-- Required to fix unit tests but breaks IT tests -->
<!-- due to exception in wiremock.jetty9.JettyHttpServer.createServerConnector -->
<groupId>com.github.tomakehurst</groupId>
<artifactId>wiremock</artifactId>
<version>2.27.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.vladmihalcea</groupId>
<artifactId>hibernate-types-5</artifactId>
<version>2.21.1</version>
<!-- <dependency>-->
<!-- &lt;!&ndash; required to fix IT tests but breaks unit tests &ndash;&gt;-->
<!-- &lt;!&ndash; with Class versions V1_5 or less must use F_NEW frames in godaddy logging &ndash;&gt;-->
<!-- <groupId>org.wiremock</groupId>-->
<!-- <artifactId>wiremock-standalone</artifactId>-->
<!-- <version>3.9.1</version>-->
<!-- <scope>test</scope>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>com.vladmihalcea</groupId>-->
<!-- <artifactId>hibernate-types-5</artifactId>-->
<!-- <version>2.21.1</version>-->
<!-- </dependency>-->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>6.5.2.Final</version>
</dependency>
<dependency>
<groupId>org.liquibase</groupId>
Expand All @@ -184,7 +206,7 @@
<dependency>
<groupId>net.logstash.logback</groupId>
<artifactId>logstash-logback-encoder</artifactId>
<version>6.6</version>
<version>8.0</version>
</dependency>

<dependency>
Expand Down Expand Up @@ -213,7 +235,7 @@
<dependency>
<groupId>com.godaddy</groupId>
<artifactId>logging</artifactId>
<version>${godaddylogging.version}</version>
<version>1.2.5</version>
</dependency>

<dependency>
Expand Down Expand Up @@ -287,14 +309,14 @@
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>5.5.0</version>
<version>5.14.1</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>net.bytebuddy</groupId>
<artifactId>byte-buddy</artifactId>
<version>1.14.8</version>
<version>1.15.3</version>
</dependency>

<dependency>
Expand Down Expand Up @@ -333,6 +355,7 @@
<plugin>
<artifactId>exec-maven-plugin</artifactId>
<groupId>org.codehaus.mojo</groupId>
<version>3.4.1</version>
<executions>
<execution>
<id>pre-stop</id>
Expand Down Expand Up @@ -372,21 +395,37 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.12.1</version>
<version>3.8.1</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
<parameters>true</parameters>
Copy link
Contributor Author

@pricem14pc pricem14pc Oct 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Required to fix failing CaseGroupEndpointUnitTest tests.

Error "Name for argument of type [java.util.UUID] not specified, and parameter name information not found in class file either"

with spring 3 upgrade when using org.springframework.test.web.servlet.MockMvc

</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${surefire.version}</version>
<version>3.2.5</version>
<dependencies>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-junit47</artifactId>
<version>3.2.5</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>3.3.1</version>
<configuration>
<!-- configLocation>checkstyle.xml</configLocation -->
<!-- https://checkstyle.sourceforge.io/google_style.html -->
<consoleOutput>true</consoleOutput>
<!-- configLocation>google_checks.xml</configLocation -->
<suppressionsLocation>checkstyle-suppressions.xml</suppressionsLocation>
<suppressionsFileExpression>checkstyle.suppressions.file</suppressionsFileExpression>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
Expand All @@ -412,6 +451,15 @@
source. This seemed to be the only solution -->
<configuration>
<argLine>--add-opens java.base/java.util=ALL-UNNAMED</argLine>
<skipITs>${failsafe.skipITs}</skipITs>
<!-- for local development when investigating individual ITs -->
<!-- <excludes>-->
<!-- <exclude>**/CaseActionEventIT.java</exclude>-->
<!-- <exclude>**/CaseReceiptReceiverIT.java</exclude>-->
<!-- <exclude>**/CaseActionEventIT.java</exclude>-->
<!-- <exclude>**/CaseEndpointIT.java</exclude>-->
<!-- <exclude>**/CaseIACEndpointIT.java</exclude>-->
<!-- </excludes>-->
</configuration>
<executions>
<execution>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public CustomSpringLiquibase liquibase() {
liquibase.setDefaultSchema(liquibaseProperties.getDefaultSchema());
liquibase.setDropFirst(liquibaseProperties.isDropFirst());
liquibase.setShouldRun(true);
liquibase.setLabels(liquibaseProperties.getLabels());
// liquibase.setLabels(liquibaseProperties.getLabels());
liquibase.setChangeLogParameters(liquibaseProperties.getParameters());
liquibase.setLiquibaseSchema(liquibaseProperties.getLiquibaseSchema());
return new CustomSpringLiquibase(liquibase);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
package uk.gov.ons.ctp.response.casesvc.domain.model;

import jakarta.persistence.CascadeType;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.EnumType;
import jakarta.persistence.Enumerated;
import jakarta.persistence.FetchType;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.OneToMany;
import jakarta.persistence.PostLoad;
import jakarta.persistence.Table;
import jakarta.persistence.Transient;
import jakarta.persistence.Version;
import java.io.Serializable;
import java.sql.Timestamp;
import java.util.List;
import java.util.UUID;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.PostLoad;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.persistence.Version;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package uk.gov.ons.ctp.response.casesvc.domain.model;

import jakarta.persistence.*;
import jakarta.validation.constraints.NotNull;
import java.io.Serializable;
import java.math.BigInteger;
import java.sql.Timestamp;
import java.util.UUID;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package uk.gov.ons.ctp.response.casesvc.domain.model;

import jakarta.persistence.*;
import jakarta.validation.constraints.NotNull;
import java.io.Serializable;
import java.math.BigInteger;
import java.sql.Timestamp;
import java.util.UUID;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package uk.gov.ons.ctp.response.casesvc.domain.model;

import jakarta.persistence.*;
import jakarta.validation.constraints.NotNull;
import java.io.Serializable;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,26 +1,19 @@
package uk.gov.ons.ctp.response.casesvc.domain.model;

import com.vladmihalcea.hibernate.type.json.JsonBinaryType;
// import com.vladmihalcea.hibernate.type.json.JsonBinaryType;

import jakarta.persistence.*;
import java.io.Serializable;
import java.sql.Timestamp;
import java.util.Map;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.JdbcTypeCode;
import org.hibernate.annotations.Parameter;
import org.hibernate.annotations.Type;
import org.hibernate.annotations.TypeDef;
import org.hibernate.annotations.TypeDefs;
import org.hibernate.type.SqlTypes;
import uk.gov.ons.ctp.response.casesvc.representation.CategoryDTO;

/** Domain model object. */
Expand All @@ -29,7 +22,8 @@
@Builder
@AllArgsConstructor
@NoArgsConstructor
@TypeDefs({@TypeDef(name = "jsonb", typeClass = JsonBinaryType.class)})
// @TypeDefs({@TypeDef(name = "jsonb", typeClass = JsonBinaryType.class)})
// @Convert(attributeName = "entityAttrName", converter = JsonBinaryType.class)
@Table(name = "caseevent", schema = "casesvc")
public class CaseEvent implements Serializable {

Expand Down Expand Up @@ -66,6 +60,7 @@ public class CaseEvent implements Serializable {
private String subCategory;

@Column(name = "metadata")
@Type(type = "jsonb")
// @Type(type = "jsonb")
@JdbcTypeCode(SqlTypes.JSON)
private Map<String, String> metadata;
}
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
package uk.gov.ons.ctp.response.casesvc.domain.model;

import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.EnumType;
import jakarta.persistence.Enumerated;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.Table;
import java.io.Serializable;
import java.sql.Timestamp;
import java.util.UUID;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
Expand Down
Loading
Loading