Skip to content

Commit

Permalink
Update to Java21
Browse files Browse the repository at this point in the history
General changes:
- updated spring boot, spring versions
- updated test framework to junit-jupiter
- updated maven compiler
- updated other dependencies as needed to support java21

Signed-off-by: Angelica Ochoa <[email protected]>

Update messaging lib and commons versions

Signed-off-by: Angelica Ochoa <[email protected]>
  • Loading branch information
ao508 committed Nov 13, 2024
1 parent b120d8b commit c0ae1f0
Show file tree
Hide file tree
Showing 11 changed files with 135 additions and 118 deletions.
6 changes: 3 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
defaults: &defaults
docker:
- image: cimg/openjdk:8.0.275
- image: cimg/openjdk:21.0

version: 2.1

orbs:
maven: circleci/maven@1.0.3
maven: circleci/maven@1.4.1

jobs:
run_checkstyle:
Expand All @@ -25,7 +25,7 @@ jobs:
git checkout ${SMILE_COMMONS_VERSION}
- run:
name: "Build project..."
command: mvn clean install
command: mvn clean install -U
- run:
name: "Run checkstyle plugin..."
command: mvn checkstyle:checkstyle
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
FROM maven:3.6.1-jdk-11-slim
FROM maven:3.8.8
RUN mkdir /request-filter
ADD . /request-filter
WORKDIR /request-filter
RUN mvn clean install

FROM openjdk:11-slim
FROM openjdk:21
COPY --from=0 /request-filter/target/smile_request_filter.jar /request-filter/smile_request_filter.jar
ENTRYPOINT ["java"]
9 changes: 9 additions & 0 deletions jitpack.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
jdk:
- openjdk21

before_install:
- sdk install maven 3.8.8
- sdk use maven 3.8.8
- sdk install java 21.0.2-open
- sdk use java 21.0.2-open
- sdk update
54 changes: 24 additions & 30 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.3.3.RELEASE</version>
<version>3.3.3</version>
</parent>

<repositories>
Expand All @@ -29,18 +29,17 @@
</pluginRepositories>

<properties>
<java.version>1.8</java.version>
<maven.compiler.version>1.8</maven.compiler.version>
<spring.version>5.2.6.RELEASE</spring.version>
<spring.boot.version>2.3.3.RELEASE</spring.boot.version>
<slf4j.version>1.7.30</slf4j.version>
<jackson.version>2.11.2</jackson.version>
<java.version>21</java.version>
<maven.compiler.version>3.11.0</maven.compiler.version>
<spring.version>6.1.12</spring.version>
<spring.boot.version>3.3.3</spring.boot.version>
<jackson.version>2.17.2</jackson.version>
<!-- smile messaging -->
<smile_messaging_java.group>com.github.mskcc</smile_messaging_java.group>
<smile_messaging_java.version>1.4.1.RELEASE</smile_messaging_java.version>
<smile_messaging_java.version>java-v21-beta-RC-4</smile_messaging_java.version>
<!-- smile commons centralized config properties -->
<smile_commons.group>com.github.mskcc</smile_commons.group>
<smile_commons.version>1.4.1.RELEASE</smile_commons.version>
<smile_commons.version>java-v21-beta-RC-4</smile_commons.version>
</properties>

<dependencies>
Expand All @@ -58,20 +57,15 @@
</dependency>
<!-- testing -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${spring.version}</version>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-test</artifactId>
<version>${spring.boot.version}</version>
<scope>test</scope>
<type>jar</type>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>3.3.3</version>
<scope>test</scope>
<type>jar</type>
</dependency>
Expand All @@ -85,19 +79,19 @@
<dependency>
<groupId>org.skyscreamer</groupId>
<artifactId>jsonassert</artifactId>
<version>1.5.0</version>
<version>1.5.3</version>
</dependency>
<!-- string utils -->
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>19.0</version>
<type>jar</type>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.3.4</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.11</version>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.10.3</version>
<scope>test</scope>
<type>jar</type>
</dependency>
</dependencies>

Expand Down Expand Up @@ -130,10 +124,10 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.1</version>
<version>${maven.compiler.version}</version>
<configuration>
<source>${maven.compiler.version}</source>
<target>${maven.compiler.version}</target>
<source>${java.version}</source>
<target>${java.version}</target>
<compilerArgument>-Xlint:deprecation</compilerArgument>
</configuration>
</plugin>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import com.fasterxml.jackson.databind.ObjectMapper;
import io.nats.client.Message;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.Map;
import java.util.concurrent.BlockingQueue;
Expand All @@ -29,16 +28,16 @@
@Service
public class PromotedRequestMsgHandlingServiceImpl implements PromotedRequestMsgHandlingService {

@Value("${igo.validate_promoted_request_topic}")
@Value("${igo.validate_promoted_request_topic:}")
private String VALIDATE_PROMOTED_REQUEST_TOPIC;

@Value("${igo.cmo_promoted_label_topic}")
@Value("${igo.cmo_promoted_label_topic:}")
private String CMO_PROMOTED_LABEL_TOPIC;

@Value("${igo.promoted_request_topic}")
@Value("${igo.promoted_request_topic:}")
private String IGO_PROMOTED_REQUEST_TOPIC;

@Value("${num.promoted_request_handler_threads}")
@Value("${num.promoted_request_handler_threads:1}")
private int NUM_PROMOTED_REQUEST_HANDLERS;

@Autowired
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import com.fasterxml.jackson.databind.ObjectMapper;
import io.nats.client.Message;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.CountDownLatch;
Expand All @@ -28,16 +27,16 @@
@Service
public class RequestFilterMsgHandlingServiceIml implements RequestFilterMessageHandlingService {

@Value("${igo.request_filter_topic}")
@Value("${igo.request_filter_topic:}")
private String IGO_REQUEST_FILTER_TOPIC;

@Value("${igo.cmo_label_generator_topic}")
@Value("${igo.cmo_label_generator_topic:}")
private String CMO_LABEL_GENERATOR_TOPIC;

@Value("${igo.new_request_topic}")
@Value("${igo.new_request_topic:}")
private String IGO_NEW_REQUEST_TOPIC;

@Value("${num.new_request_handler_threads}")
@Value("${num.new_request_handler_threads:1}")
private int NUM_NEW_REQUEST_HANDLERS;

@Autowired
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,11 @@
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.logging.log4j.util.Strings;
import org.mskcc.smile.commons.enums.CmoSampleClass;
import org.mskcc.smile.commons.enums.SampleOrigin;
import org.mskcc.smile.commons.enums.SampleType;
import org.mskcc.smile.commons.enums.SpecimenType;
import org.mskcc.smile.service.ValidRequestChecker;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

Expand Down Expand Up @@ -611,7 +609,7 @@ private Boolean requestHasSamples(String requestJson) throws JsonProcessingExcep
}

private Boolean isBlank(String value) {
return (Strings.isBlank(value) || value.equals("null"));
return (StringUtils.isBlank(value) || value.equals("null"));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,22 @@

@Service
public class ValidateUpdatesMsgHandlingServiceImpl implements ValidateUpdatesMessageHandlingService {
@Value("${igo.validate_request_update_topic}")
@Value("${igo.validate_request_update_topic:}")
private String VALIDATOR_REQUEST_UPDATE_TOPIC;

@Value("${igo.validate_sample_update_topic}")
@Value("${igo.validate_sample_update_topic:}")
private String VALIDATOR_SAMPLE_UPDATE_TOPIC;

@Value("${igo.cmo_label_update_topic}")
@Value("${igo.cmo_label_update_topic:}")
private String CMO_LABEL_UPDATE_TOPIC;

@Value("${smile.request_update_topic}")
@Value("${smile.request_update_topic:}")
private String SERVER_REQUEST_UPDATE_TOPIC;

@Value("${smile.sample_update_topic}")
@Value("${smile.sample_update_topic:}")
private String SERVER_SAMPLE_UPDATE_TOPIC;

@Value("${num.new_request_handler_threads}")
@Value("${num.new_request_handler_threads:1}")
private int NUM_NEW_REQUEST_HANDLERS;

@Autowired
Expand Down
30 changes: 30 additions & 0 deletions src/test/java/org/mskcc/smile/SmileRequestFilterTestApp.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package org.mskcc.smile;

import org.mskcc.cmo.messaging.Gateway;
import org.mskcc.smile.service.impl.PromotedRequestMsgHandlingServiceImpl;
import org.mskcc.smile.service.impl.ValidRequestCheckerImpl;
import org.mskcc.smile.service.impl.ValidateUpdatesMsgHandlingServiceImpl;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.context.annotation.Bean;

/**
*
* @author laptop
*/
@SpringBootApplication(scanBasePackages = {"org.mskcc.smile.service", "org.mskcc.smile.commons.*"})
public class SmileRequestFilterTestApp {
@Bean
public ValidRequestCheckerImpl validRequestCheckerImpl() {
return new ValidRequestCheckerImpl();
}

@MockBean
public Gateway messagingGateway;

@MockBean
public PromotedRequestMsgHandlingServiceImpl promotedRequestMsgHandlingService;

@MockBean
public ValidateUpdatesMsgHandlingServiceImpl validateUpdatesMsgHandlingService;
}
Loading

0 comments on commit c0ae1f0

Please sign in to comment.