Skip to content

Commit

Permalink
Update SMILE dependencies to 2.0.0.RELEASE (#81)
Browse files Browse the repository at this point in the history
* Update to java21

General updates:
- Support java21
- Spring framework and spring boot updates
- Updated test layer to junit-jupiter
- Updated circleci config

Signed-off-by: Angelica Ochoa <15623749+ao508@users.noreply.github.com>

* Update SMILE dependencies to 2.0.0.RELEASE

Signed-off-by: Angelica Ochoa <15623749+ao508@users.noreply.github.com>

---------

Signed-off-by: Angelica Ochoa <15623749+ao508@users.noreply.github.com>
  • Loading branch information
ao508 authored Nov 15, 2024
1 parent 8dea13d commit 27cacfe
Show file tree
Hide file tree
Showing 9 changed files with 118 additions and 102 deletions.
4 changes: 2 additions & 2 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 Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
FROM maven:3.6.1-jdk-11-slim
FROM maven:3.8.8
# create working directory and set
RUN mkdir /label-generator
ADD . /label-generator
WORKDIR /label-generator
RUN mvn clean install

# copy jar and set entrypoint
FROM openjdk:11-slim
FROM openjdk:21
COPY --from=0 /label-generator/target/smile_label_generator.jar /label-generator/smile_label_generator.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
52 changes: 20 additions & 32 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,21 +29,20 @@
</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 and shared entities dependency versions -->
<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>2.0.0.RELEASE</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>2.0.0.RELEASE</smile_commons.version>
<!-- smile server model module -->
<smile_server.group>com.github.mskcc.smile-server</smile_server.group>
<smile_server.version>1.6.0.RELEASE</smile_server.version>
<smile_server.version>2.0.0.RELEASE</smile_server.version>
</properties>

<dependencies>
Expand Down Expand Up @@ -72,20 +71,21 @@
</dependency>
<!-- testing -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.10.3</version>
<scope>test</scope>
<type>jar</type>
</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>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>3.3.3</version>
<scope>test</scope>
<type>jar</type>
</dependency>
Expand All @@ -99,19 +99,7 @@
<dependency>
<groupId>org.skyscreamer</groupId>
<artifactId>jsonassert</artifactId>
<version>1.5.0</version>
</dependency>
<!-- string utils -->
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>19.0</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.11</version>
<version>1.5.3</version>
</dependency>
</dependencies>

Expand Down Expand Up @@ -144,10 +132,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 @@ -39,31 +39,31 @@
@Service
public class LabelGenMessageHandlingServiceImpl implements MessageHandlingService {

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

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

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

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

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

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

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

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

@Value("${request_reply.patient_samples_topic}")
@Value("${request_reply.patient_samples_topic:}")
private String PATIENT_SAMPLES_REQUEST_TOPIC;

@Autowired
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@
@Service
public class RequestReplyHandlingServiceImpl implements RequestReplyHandlingService {

@Value("${request_reply.cmo_label_generator_topic}")
@Value("${request_reply.cmo_label_generator_topic:}")
private String CMO_LABEL_GENERATOR_REQREPLY_TOPIC;

@Value("${request_reply.patient_samples_topic}")
@Value("${request_reply.patient_samples_topic:}")
private String PATIENT_SAMPLES_REQUEST_TOPIC;

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

@Autowired
Expand Down
55 changes: 26 additions & 29 deletions src/test/java/org/mskcc/smile/CmoLabelGeneratorServiceTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import junit.framework.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.mskcc.smile.commons.enums.NucleicAcid;
import org.mskcc.smile.commons.enums.SpecimenType;
import org.mskcc.smile.config.TestConfiguration;
Expand All @@ -19,13 +18,11 @@
import org.mskcc.smile.model.igo.IgoSampleManifest;
import org.mskcc.smile.service.CmoLabelGeneratorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.context.annotation.Import;

@ContextConfiguration(classes = TestConfiguration.class)
@RunWith(SpringJUnit4ClassRunner.class)
@ComponentScan("org.mskcc.smile.service")
@SpringBootTest(classes = LabelGeneratorTestApp.class)
@Import(TestConfiguration.class)
public class CmoLabelGeneratorServiceTest {
private final ObjectMapper mapper = new ObjectMapper();

Expand All @@ -40,7 +37,7 @@ public class CmoLabelGeneratorServiceTest {
*/
@Test
public void testMockedRequestJsonDataLoading() {
Assert.assertNotNull(mockedRequestJsonDataMap);
Assertions.assertNotNull(mockedRequestJsonDataMap);
}

/**
Expand All @@ -52,7 +49,7 @@ public void testValidRequestJson() throws Exception {
MockJsonTestData requestJson = mockedRequestJsonDataMap
.get("mockIncomingRequest1JsonDataWith2T2N");
String modifiedRequestJson = requestJson.getJsonString();
Assert.assertNotNull(modifiedRequestJson);
Assertions.assertNotNull(modifiedRequestJson);
}

/**
Expand Down Expand Up @@ -89,12 +86,12 @@ public void testCmoLabelGenForSampleUpdate() throws JsonProcessingException,
String newCmoLabel = cmoLabelGeneratorService.generateCmoSampleLabel(
updatedSample, existingSamples);
// if the cmo label before the update is C-MP789JR-X001-d
Assert.assertEquals("C-MP789JR-P003-d02", newCmoLabel);
Assertions.assertEquals("C-MP789JR-P003-d02", newCmoLabel);

Status sampleStatus = cmoLabelGeneratorService.generateSampleStatus(
updatedSample, existingSamples);
Assert.assertEquals(Boolean.TRUE, sampleStatus.getValidationStatus());
Assert.assertEquals(sampleStatus.getValidationReport(), (new HashMap()).toString());
Assertions.assertEquals(Boolean.TRUE, sampleStatus.getValidationStatus());
Assertions.assertEquals(sampleStatus.getValidationReport(), (new HashMap()).toString());
}

/**
Expand Down Expand Up @@ -135,12 +132,12 @@ public void testCmoLabelGenForSampleWithPatientCorrection()
updatedSample, existingSamples);

// if the cmo label before the update is C-MP789JR-X001-d
Assert.assertEquals("C-newPatient-X003-d02", newCmoLabel);
Assertions.assertEquals("C-newPatient-X003-d02", newCmoLabel);

Status sampleStatus = cmoLabelGeneratorService.generateSampleStatus(
updatedSample, existingSamples);
Assert.assertEquals(Boolean.TRUE, sampleStatus.getValidationStatus());
Assert.assertEquals(sampleStatus.getValidationReport(), (new HashMap()).toString());
Assertions.assertEquals(Boolean.TRUE, sampleStatus.getValidationStatus());
Assertions.assertEquals(sampleStatus.getValidationReport(), (new HashMap()).toString());
}

/**
Expand Down Expand Up @@ -180,13 +177,13 @@ public void testCmoLabelGenForExistingSampleWithPatientCorrection()
updatedSample, existingSamples);

// if the cmo label before the update is C-MP789JR-X001-d
Assert.assertEquals("C-newPatient-X001-d02", newCmoLabel);
Assertions.assertEquals("C-newPatient-X001-d02", newCmoLabel);


Status sampleStatus = cmoLabelGeneratorService.generateSampleStatus(
updatedSample, existingSamples);
Assert.assertEquals(Boolean.TRUE, sampleStatus.getValidationStatus());
Assert.assertEquals(sampleStatus.getValidationReport(), (new HashMap()).toString());
Assertions.assertEquals(Boolean.TRUE, sampleStatus.getValidationStatus());
Assertions.assertEquals(sampleStatus.getValidationReport(), (new HashMap()).toString());
}

/**
Expand Down Expand Up @@ -226,12 +223,12 @@ public void testCmoLabelGenForSampleWithOtherSpecimenType()
// should return null string
String newCmoLabel = cmoLabelGeneratorService.generateCmoSampleLabel(
updatedSample, existingSamples);
Assert.assertEquals("C-MP789JR-F001-d01", newCmoLabel);
Assertions.assertEquals("C-MP789JR-F001-d01", newCmoLabel);

Status sampleStatus = cmoLabelGeneratorService.generateSampleStatus(
updatedSample, existingSamples);
Assert.assertEquals(Boolean.FALSE, sampleStatus.getValidationStatus());
Assert.assertNotSame(sampleStatus.getValidationReport(), (new HashMap()).toString());
Assertions.assertEquals(Boolean.FALSE, sampleStatus.getValidationStatus());
Assertions.assertNotSame(sampleStatus.getValidationReport(), (new HashMap()).toString());
}

@Test
Expand All @@ -245,7 +242,7 @@ public void testCmoCelllineLabelGenerationUpdates() {
String sampleLabel = cmoLabelGeneratorService.generateCmoSampleLabel(requestId,
sample, existingSamples);
String sampleExpectedLabel = "AMP1-86793T";
Assert.assertEquals("AMP1-86793T", sampleLabel);
Assertions.assertEquals("AMP1-86793T", sampleLabel);

// test label generated with new investigator id and assert
// that the sample would require a label update
Expand All @@ -254,9 +251,9 @@ public void testCmoCelllineLabelGenerationUpdates() {
String sampleUpdatedInvestigatorIdLabel = cmoLabelGeneratorService.generateCmoSampleLabel(requestId,
sampleUpdatedInvestigatorId, existingSamples);
String expectedLabelWithInvestiagorIdUpdate = "MIP2-86793T";
Assert.assertEquals(expectedLabelWithInvestiagorIdUpdate, sampleUpdatedInvestigatorIdLabel);
Assertions.assertEquals(expectedLabelWithInvestiagorIdUpdate, sampleUpdatedInvestigatorIdLabel);
// assert that the sample would require a label update
Assert.assertTrue(cmoLabelGeneratorService.igoSampleRequiresLabelUpdate(
Assertions.assertTrue(cmoLabelGeneratorService.igoSampleRequiresLabelUpdate(
sampleUpdatedInvestigatorIdLabel, sampleLabel));

// test label generated with same investigator id as original sample
Expand All @@ -265,16 +262,16 @@ public void testCmoCelllineLabelGenerationUpdates() {
SpecimenType.CELLLINE, NucleicAcid.CFDNA, "AMP1");
String sampleUpdatedNaExtractLabel = cmoLabelGeneratorService.generateCmoSampleLabel(requestId,
sampleUpdatedNaExtract, existingSamples);
Assert.assertEquals(sampleExpectedLabel, sampleUpdatedNaExtractLabel);
Assert.assertFalse(cmoLabelGeneratorService.igoSampleRequiresLabelUpdate(
Assertions.assertEquals(sampleExpectedLabel, sampleUpdatedNaExtractLabel);
Assertions.assertFalse(cmoLabelGeneratorService.igoSampleRequiresLabelUpdate(
sampleUpdatedNaExtractLabel, sampleExpectedLabel));
}

@Test
public void testDefaultSampleTypeAbbreviation() {
String sampleTypeAbbrev = cmoLabelGeneratorService.resolveSampleTypeAbbreviation("RapidAutopsy",
"Cerebrospinal Fluid", "Other");
Assert.assertTrue(sampleTypeAbbrev.equals("F"));
Assertions.assertTrue(sampleTypeAbbrev.equals("F"));
}

private IgoSampleManifest getSampleMetadata(String igoId, String cmoPatientId,
Expand Down
23 changes: 23 additions & 0 deletions src/test/java/org/mskcc/smile/LabelGeneratorTestApp.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package org.mskcc.smile;

import org.mskcc.cmo.messaging.Gateway;
import org.mskcc.smile.service.impl.LabelGenMessageHandlingServiceImpl;
import org.mskcc.smile.service.impl.RequestReplyHandlingServiceImpl;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.test.mock.mockito.MockBean;

/**
*
* @author laptop
*/
@SpringBootApplication(scanBasePackages = {"org.mskcc.smile.service", "org.mskcc.smile.commons.*"})
public class LabelGeneratorTestApp {
@MockBean
public Gateway messagingGateway;

@MockBean
public LabelGenMessageHandlingServiceImpl labelGenMessageHandlingServiceImpl;

@MockBean
public RequestReplyHandlingServiceImpl requestReplyMessageHandlingServiceImpl;
}
Loading

0 comments on commit 27cacfe

Please sign in to comment.