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

Java 21 Support #1440

Merged
merged 24 commits into from
Jun 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
7dda5a5
Switch back to Mojo aspectj plugin for Java 21 support
eshryane Apr 10, 2024
82bdc49
Update AspectJ
eshryane Apr 10, 2024
411619e
Update Jacoco plugin to support Java 21
eshryane Apr 10, 2024
8a9fb76
Update to Mockito 5 for Java 21 support
eshryane Apr 11, 2024
3504e95
Merge branch 'master' into java_21
eshryane Apr 11, 2024
c55945c
Merge branch 'master' into java_21
eshryane May 13, 2024
3e97471
Merge branch 'master' into java_21
eshryane May 15, 2024
6f2fddf
update dependencies
eshryane May 15, 2024
de3d056
Merge branch 'master' into java_21
eshryane May 30, 2024
a9d4a64
feat: use java 21 image
MiguelAHM May 30, 2024
175720e
Update spring framework dependency
eshryane May 30, 2024
9dea9b1
Explicitly enable annotation processing during compilation.
eshryane May 30, 2024
bdc5df2
Mock and Spy integration test components
eshryane May 30, 2024
55562df
Rename duplicate classes
eshryane May 31, 2024
b2ae757
Fix Tag import
eshryane May 31, 2024
e0dd7af
Use MockFactoryBean everywhere
eshryane May 31, 2024
87aa5c4
Upgraded shedlock to latest
eshryane May 31, 2024
ba440ba
Shedlock breaks with latest Spring
eshryane May 31, 2024
97601e8
Specify aspectj mode for cache configuration
eshryane May 31, 2024
682ce7e
Specify aspectj mode for scheduler config
eshryane May 31, 2024
16b75e5
Updated Spring by applying AOP workaround suggested in https://github…
eshryane May 31, 2024
306b266
Replace deprecated thread.getId() with threadId().
eshryane May 31, 2024
169ad2d
Merge branch 'master' into java_21
eshryane Jun 3, 2024
9cea9c5
use whois-build:v0.0.5 - java21, amazoncorretto, node18, firefox114
eshryane Jun 3, 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
2 changes: 1 addition & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
image: $CI_REGISTRY/swe-database-team/gitlab-ci/whois-build:21fc0efa
image: $CI_REGISTRY/swe-database-team/gitlab-ci/whois-build:v0.0.5

variables:
MAVEN_OPTS: "-Dmaven.repo.local=.m2/repository"
Expand Down
19 changes: 10 additions & 9 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

<!-- JAVA version -->
<java.version>17</java.version>
<java.version>21</java.version>

<!-- dependencies -->

<aspectj.version>1.9.21.1</aspectj.version>
<aspectj.version>1.9.22.1</aspectj.version>
<awaitility.version>4.2.0</awaitility.version>

<bouncycastle.version>1.77</bouncycastle.version>
Expand Down Expand Up @@ -80,7 +80,7 @@
<mail.version>2.0.3</mail.version>
<!-- TODO: update mariadb to 3.x -->
<mariadb-java-client.version>2.7.12</mariadb-java-client.version>
<mockito.version>3.12.4</mockito.version>
<mockito.version>5.12.0</mockito.version>

<netty.version>4.1.107.Final</netty.version>

Expand All @@ -89,10 +89,10 @@
<proprot.version>1.0</proprot.version>

<sentry.version>6.26.0</sentry.version>
<shedlock.version>4.46.0</shedlock.version>
<shedlock.version>5.13.0</shedlock.version>
<slf4j.version>2.0.12</slf4j.version>
<solrj.version>1.4.1</solrj.version>
<spring.version>6.1.4</spring.version>
<spring.version>6.1.8</spring.version>
<spock.version>2.3-groovy-3.0</spock.version>
<stax-utils.version>20070216</stax-utils.version>

Expand Down Expand Up @@ -818,7 +818,7 @@
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.8</version>
<version>0.8.12</version>
eshryane marked this conversation as resolved.
Show resolved Hide resolved
<executions>
<execution>
<id>before-unit-test-execution</id>
Expand Down Expand Up @@ -926,6 +926,8 @@
<arg>-Xlint:-processing</arg>
<arg>--add-modules</arg>
<arg>java.sql,java.xml</arg>
<!-- explicitly enable annotation processing. -->
<arg>-proc:full</arg>
</compilerArgs>
<showWarnings>true</showWarnings>
<showDeprecation>true</showDeprecation>
Expand Down Expand Up @@ -1036,10 +1038,9 @@
</executions>
</plugin>
<plugin>
<!-- Plugin forked from mojohaus project to add Java 11 support -->
<groupId>io.starter</groupId>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.12.9</version>
<version>1.15.0</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
Expand Down
4 changes: 2 additions & 2 deletions whois-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,9 @@
</resources>
<plugins>
<plugin>
<groupId>io.starter</groupId>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.12.9</version>
<version>1.15.0</version>
<configuration>
<aspectLibraries>
<aspectLibrary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public MailMessageDaoJdbc(
@CheckForNull
public String claimMessage() {
final String uuid = UUID.randomUUID().toString();
LOGGER.debug("[{}] about to claim message with uuid {}", Thread.currentThread().getId(), uuid);
LOGGER.debug("[{}] about to claim message with uuid {}", Thread.currentThread().threadId(), uuid);
final int rows = jdbcTemplate.update("" +
"update mailupdates " +
"set status = ?, changed = ?, claim_host = ?, claim_uuid = ? " +
Expand All @@ -62,7 +62,7 @@ public String claimMessage() {
case 0:
return null;
case 1:
LOGGER.debug("[{}] claimed message with uuid {}", Thread.currentThread().getId(), uuid);
LOGGER.debug("[{}] claimed message with uuid {}", Thread.currentThread().threadId(), uuid);
return uuid;
default:
throw new IllegalStateException("Should never claim more than 1 row");
Expand All @@ -88,7 +88,7 @@ public void addMessage(final MimeMessage message) {

@Override
public MimeMessage getMessage(final String messageUuid) {
LOGGER.debug("[{}] get message with uuid {}", Thread.currentThread().getId(), messageUuid);
LOGGER.debug("[{}] get message with uuid {}", Thread.currentThread().threadId(), messageUuid);

final byte[] bytes = jdbcTemplate.queryForObject("select message from mailupdates where claim_uuid = ?", byte[].class, messageUuid);

Expand All @@ -101,7 +101,7 @@ public MimeMessage getMessage(final String messageUuid) {

@Override
public void deleteMessage(final String messageUuid) {
LOGGER.debug("[{}] delete message with uuid {}", Thread.currentThread().getId(), messageUuid);
LOGGER.debug("[{}] delete message with uuid {}", Thread.currentThread().threadId(), messageUuid);

int rows = jdbcTemplate.update("delete from mailupdates where claim_uuid = ?", messageUuid);
if (rows != 1) {
Expand All @@ -111,7 +111,7 @@ public void deleteMessage(final String messageUuid) {

@Override
public void setStatus(final String messageUuid, final DequeueStatus status) {
LOGGER.debug("[{}] set status uuid {} status {}", Thread.currentThread().getId(), messageUuid, status);
LOGGER.debug("[{}] set status uuid {} status {}", Thread.currentThread().threadId(), messageUuid, status);

final int rows = jdbcTemplate.update(
"update mailupdates set status = ?, changed = ? where claim_uuid = ?",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@
location="classpath:whois.version.properties,classpath:whois.properties"
system-properties-mode="OVERRIDE"/>

<bean id="messageDequeue" class="org.mockito.Mockito" factory-method="mock" primary="true">
<constructor-arg value="net.ripe.db.whois.api.mail.dequeue.MessageDequeue"/>
<bean id="messageDequeue" class="net.ripe.db.whois.query.support.MockFactoryBean" primary="true">
eshryane marked this conversation as resolved.
Show resolved Hide resolved
<constructor-arg name="mock" value="net.ripe.db.whois.api.mail.dequeue.MessageDequeue" />
</bean>


</beans>
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
location="classpath:whois.version.properties,classpath:whois.properties"
system-properties-mode="OVERRIDE"/>

<bean id="updateRequestHandler" class="org.mockito.Mockito" factory-method="mock" primary="true">
<constructor-arg value="net.ripe.db.whois.update.handler.UpdateRequestHandler"/>
<bean id="updateRequestHandler" class="net.ripe.db.whois.query.support.MockFactoryBean" primary="true">
eshryane marked this conversation as resolved.
Show resolved Hide resolved
<constructor-arg name="mock" value="net.ripe.db.whois.update.handler.UpdateRequestHandler" />
</bean>

</beans>
2 changes: 1 addition & 1 deletion whois-commons/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.8</version>
<version>0.8.12</version>
<!-- TODO: Including this in jacoco plugin throws Can't add different class with same name: org/apache/commons/collections/ArrayStack
I tried to exclude this file, package and dependency also still from some other dependency tree it gets included
-->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:cache="http://www.springframework.org/schema/cache"
xmlns:cache="http://www.springframework.org/schema/cache" xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/cache
http://www.springframework.org/schema/cache/spring-cache.xsd">
http://www.springframework.org/schema/cache/spring-cache.xsd http://www.springframework.org/schema/aop https://www.springframework.org/schema/aop/spring-aop.xsd">

<!-- TODO: this is loaded many many times on context init, which slows down startup process -->
<!-- @Transactional CAN be used on private methods with mode="aspectj". However, annotations on interfaces will NOT work! -->
Expand All @@ -21,7 +21,9 @@
<context:component-scan base-package="net.ripe.db.whois.common"/>

<context:annotation-config/>
<cache:annotation-driven/>
<cache:annotation-driven mode="aspectj"/>
eshryane marked this conversation as resolved.
Show resolved Hide resolved

<!-- <aop:aspectj-autoproxy proxy-target-class="true"/>-->

<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="sourceAwareDataSource"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import java.util.concurrent.atomic.AtomicInteger;

@Component
@RetryFor(value = IOException.class, attempts = RetryForAspectIntegrationTest.ATTEMPTS, intervalMs = 0)
@RetryFor(value = IOException.class, attempts = RetryForAspectMethodTypeIntegrationTest.ATTEMPTS, intervalMs = 0)
class RetryForAspectMethodImpl implements RetryForAspectMethod {
@Override
public void incrementAndThrowException(final AtomicInteger counter, final Exception e) throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import static org.junit.jupiter.api.Assertions.fail;

@Tag("IntegrationTest")
public class RetryForAspectIntegrationTest extends AbstractDaoIntegrationTest {
public class RetryForAspectMethodTypeIntegrationTest extends AbstractDaoIntegrationTest {
static final int ATTEMPTS = 5;

AtomicInteger attemptCounter;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
import java.util.concurrent.atomic.AtomicInteger;

public interface RetryForAspectType {
@RetryFor(value = IOException.class, attempts = RetryForAspectIntegrationTest.ATTEMPTS, intervalMs = 0)
@RetryFor(value = IOException.class, attempts = RetryForAspectMethodTypeIntegrationTest.ATTEMPTS, intervalMs = 0)
void incrementAndThrowException(AtomicInteger counter, Exception e) throws Exception;
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
@Component
class RetryForAspectTypeImpl implements RetryForAspectType {
@Override
@RetryFor(value = IOException.class, attempts = RetryForAspectIntegrationTest.ATTEMPTS, intervalMs = 0)
@RetryFor(value = IOException.class, attempts = RetryForAspectMethodTypeIntegrationTest.ATTEMPTS, intervalMs = 0)
public void incrementAndThrowException(final AtomicInteger counter, final Exception e) throws Exception {
counter.incrementAndGet();
throw e;
Expand Down
4 changes: 2 additions & 2 deletions whois-db/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,9 @@
<build>
<plugins>
<plugin>
<groupId>io.starter</groupId>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.12.9</version>
<version>1.15.0</version>
<configuration>
<aspectLibraries>
<aspectLibrary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

@Tag("IntegrationTest")
@ContextConfiguration(locations = {"classpath:applicationContext-whois-test.xml"})
public class RetryForAspectIntegrationTest extends AbstractDaoIntegrationTest {
public class RetryForAspectClassIntegrationTest extends AbstractDaoIntegrationTest {
static final int ATTEMPTS = 5;

AtomicInteger attemptCounter;
Expand Down Expand Up @@ -90,7 +90,7 @@ private void retryForAnnotatedType(final Exception e, final int expectedAttempts
assertThat(attemptCounter.get(), is(expectedAttempts));
}

@RetryFor(value = IOException.class, attempts = RetryForAspectIntegrationTest.ATTEMPTS, intervalMs = 0)
@RetryFor(value = IOException.class, attempts = RetryForAspectClassIntegrationTest.ATTEMPTS, intervalMs = 0)
public void incrementAndThrowException(final AtomicInteger counter, final Exception e) throws Exception {
counter.incrementAndGet();
throw e;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import java.util.concurrent.atomic.AtomicInteger;

@Component
@RetryFor(value = IOException.class, attempts = RetryForAspectIntegrationTest.ATTEMPTS, intervalMs = 0)
@RetryFor(value = IOException.class, attempts = RetryForAspectClassIntegrationTest.ATTEMPTS, intervalMs = 0)
class RetryForAspectOnClass {
public void incrementAndThrowException(final AtomicInteger counter, final Exception e) throws Exception {
counter.incrementAndGet();
Expand Down
4 changes: 2 additions & 2 deletions whois-endtoend/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,9 @@
<build>
<plugins>
<plugin>
<groupId>io.starter</groupId>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.12.9</version>
<version>1.15.0</version>
<configuration>
<skip>true</skip>
<aspectLibraries>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ package net.ripe.db.whois.spec.update.lireditable


import net.ripe.db.whois.spec.BaseQueryUpdateSpec
import org.junit.jupiter.api.Tag

@org.junit.jupiter.api.Tag("IntegrationTest")
eshryane marked this conversation as resolved.
Show resolved Hide resolved
@Tag("IntegrationTest")
class BaseLirEditableAttributes extends BaseQueryUpdateSpec {

def createMandatory(String type,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package net.ripe.db.whois.spec.update.lireditable

import org.junit.jupiter.api.Tag


@org.junit.jupiter.api.Tag("IntegrationTest")
@Tag("IntegrationTest")
class LirEditableAllocation6AttributeValidationSpec extends BaseLirEditableAttributeValidation {

// data for tests
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package net.ripe.db.whois.spec.update.lireditable

import org.junit.jupiter.api.Tag


@org.junit.jupiter.api.Tag("IntegrationTest")
@Tag("IntegrationTest")
class LirEditableAllocationAttributeValidationSpec extends BaseLirEditableAttributeValidation {

// data for tests
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package net.ripe.db.whois.spec.update.lireditable

import org.junit.jupiter.api.Tag


@org.junit.jupiter.api.Tag("IntegrationTest")
@Tag("IntegrationTest")
class LirEditableInet6numAssignedAttributeValidationSpec extends BaseLirEditableAttributeValidation {

// data for tests
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package net.ripe.db.whois.spec.update.lireditable

import org.junit.jupiter.api.Tag


@org.junit.jupiter.api.Tag("IntegrationTest")
@Tag("IntegrationTest")
class LirEditableInet6numAssignedPiAttributeValidationSpec extends BaseLirEditableAttributeValidation {

// data for tests
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package net.ripe.db.whois.spec.update.lireditable

@org.junit.jupiter.api.Tag("IntegrationTest")
import org.junit.jupiter.api.Tag

@Tag("IntegrationTest")
class LirEditableInetnumAssignedPaAttributeValidationSpec extends BaseLirEditableAttributeValidation {

// data for tests
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package net.ripe.db.whois.spec.update.lireditable

import org.junit.jupiter.api.Tag


@org.junit.jupiter.api.Tag("IntegrationTest")
@Tag("IntegrationTest")
class LirEditableInetnumAssignedPiAttributeValidationSpec extends BaseLirEditableAttributeValidation {

// data for tests
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package net.ripe.db.whois.spec.update.lireditable

import org.junit.jupiter.api.Tag


@org.junit.jupiter.api.Tag("IntegrationTest")
@Tag("IntegrationTest")
class LirEditableLegacyAttributeValidationSpec extends BaseLirEditableAttributeValidation {

// data for tests
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ package net.ripe.db.whois.spec.update.lireditable


import net.ripe.db.whois.spec.BaseQueryUpdateSpec
import org.junit.jupiter.api.Tag


@org.junit.jupiter.api.Tag("IntegrationTest")
@Tag("IntegrationTest")
class LirEditableOrganisationAttributeValidationSpec extends BaseQueryUpdateSpec {

@Override
Expand Down
4 changes: 2 additions & 2 deletions whois-nrtm/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@
</resources>
<plugins>
<plugin>
<groupId>io.starter</groupId>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.12.9</version>
<version>1.15.0</version>
<configuration>
<aspectLibraries>
<aspectLibrary>
Expand Down
4 changes: 2 additions & 2 deletions whois-nrtm4/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@
<build>
<plugins>
<plugin>
<groupId>io.starter</groupId>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.12.9</version>
<version>1.15.0</version>
<configuration>
<aspectLibraries>
<aspectLibrary>
Expand Down
Loading