diff --git a/.github/workflows/build-gradle-project.yml b/.github/workflows/build-gradle-project.yml index 37c1667..ab1f6c5 100644 --- a/.github/workflows/build-gradle-project.yml +++ b/.github/workflows/build-gradle-project.yml @@ -6,7 +6,7 @@ on: jobs: build-gradle-project: env: - IMAGE_TAG: 1.3 + IMAGE_TAG: 4.1 runs-on: ubuntu-latest steps: - name: Get branch names @@ -21,12 +21,12 @@ jobs: uses: actions/checkout@v3 - uses: actions/setup-java@v3 with: - java-version: '8' + java-version: '21' distribution: 'temurin' - name: Setup Gradle uses: gradle/gradle-build-action@v2 with: - gradle-version: 7.4 + gradle-version: 8.5 - name: Login to Docker Hub uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a diff --git a/Dockerfile b/Dockerfile index 53c2635..c4a3212 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,8 @@ -FROM alpine +FROM alpine:3.20.0 RUN apk update && \ apk upgrade -RUN apk add openjdk8 +RUN apk add openjdk21 VOLUME /tmp ARG DEPENDENCY=target/dependency diff --git a/build.gradle b/build.gradle index e03e8fa..4cfe2d2 100644 --- a/build.gradle +++ b/build.gradle @@ -3,16 +3,18 @@ buildscript { mavenCentral() } dependencies { - classpath("org.springframework.boot:spring-boot-gradle-plugin:2.6.4") + classpath("org.springframework.boot:spring-boot-gradle-plugin:3.2.5") } } plugins { - id 'com.palantir.docker' version '0.22.1' + id 'java' + id 'com.palantir.docker' version '0.35.0' + id 'org.springframework.boot' version '3.2.5' } group = 'kingstonduo' -version = "latest" +version = "4.1" apply plugin: 'java' apply plugin: 'eclipse' @@ -27,8 +29,7 @@ eclipse { jar { - baseName='eridanus-data' - version= '1.3' + archivesBaseName='eridanus-data' } repositories { @@ -41,16 +42,18 @@ processResources { } } -sourceCompatibility = 1.8 -targetCompatibility = 1.8 +sourceCompatibility = '21' +targetCompatibility = '21' dependencies { implementation("org.springframework.boot:spring-boot-starter-data-mongodb") implementation("org.springframework.boot:spring-boot-starter-web") implementation("com.sun.mail:javax.mail:1.6.2") - testImplementation("org.mockito:mockito-core") - testImplementation("org.springframework.boot:spring-boot-starter-test") - testImplementation 'junit:junit:4.12' + + testImplementation 'org.springframework.boot:spring-boot-starter-test' + testImplementation 'org.mockito:mockito-core' + testImplementation('org.mockito:mockito-junit-jupiter:3.12.4') + testImplementation 'org.springframework:spring-test:5.2.25.RELEASE' } springBoot { @@ -79,7 +82,7 @@ def getCurrentGitBranch() { } catch (e) { } if (gitBranch == "develop" || gitBranch == "master"){ - return jar.version + return project.version }else{ return gitBranch } @@ -87,7 +90,7 @@ def getCurrentGitBranch() { } docker { - name "kingstonduo/${jar.baseName}:" + getCurrentGitBranch() + name "kingstonduo/eridanus-data:" + getCurrentGitBranch() copySpec.from(tasks.unpack.outputs).into("dependency") buildArgs(['DEPENDENCY': "dependency"]) -} \ No newline at end of file +} diff --git a/changelog.md b/changelog.md new file mode 100644 index 0000000..fb37a6f --- /dev/null +++ b/changelog.md @@ -0,0 +1,15 @@ +# Changelog + +## Release 4.1 [unreleased] +Brief summary of what's in this release: +- upgrade to Java 21 + + +### Breaking changes + +Breaking changes include any database updates needed, if we need to edit any files on system (like .env or certs, etc). Things that are outside of the code itself that need changed for the system to work. + + +### Non-breaking changes + +Just a place to keep track of things that have changed in the code that we may want to pay special attention to when smoke testing, etc. diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 669386b..2bbac7d 100755 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists +zipStorePath=wrapper/dists \ No newline at end of file diff --git a/src/main/java/org/kpmp/eridanus/notifications/NotificationController.java b/src/main/java/org/kpmp/eridanus/notifications/NotificationController.java index 9a78ac8..252e577 100644 --- a/src/main/java/org/kpmp/eridanus/notifications/NotificationController.java +++ b/src/main/java/org/kpmp/eridanus/notifications/NotificationController.java @@ -1,7 +1,7 @@ package org.kpmp.eridanus.notifications; import javax.mail.MessagingException; -import javax.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletRequest; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 9d3c167..3ae6aea 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -1,6 +1,4 @@ -libra.data.version=${jar.baseName}-${jar.version} - -server.port=3040 + server.port=3040 spring.main.banner-mode=off spring.data.mongodb.uri=mongodb://mongodb:27017/dataLake diff --git a/src/test/java/org/kpmp/eridanus/notifications/NotificationControllerTest.java b/src/test/java/org/kpmp/eridanus/notifications/NotificationControllerTest.java index 88bd31a..f7f73cf 100644 --- a/src/test/java/org/kpmp/eridanus/notifications/NotificationControllerTest.java +++ b/src/test/java/org/kpmp/eridanus/notifications/NotificationControllerTest.java @@ -1,16 +1,16 @@ package org.kpmp.eridanus.notifications; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.mockito.Mockito.doThrow; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; import javax.mail.MessagingException; -import javax.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletRequest; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.mockito.Mock; import org.mockito.MockitoAnnotations; @@ -20,14 +20,15 @@ public class NotificationControllerTest { private PackageNotificationEventService packageEventService; private NotificationController controller; - @Before + @BeforeEach public void setUp() throws Exception { - MockitoAnnotations.initMocks(this); + MockitoAnnotations.openMocks(this); controller = new NotificationController(packageEventService); } - @After + @AfterEach public void tearDown() throws Exception { + MockitoAnnotations.openMocks(this).close(); controller = null; } diff --git a/src/test/java/org/kpmp/eridanus/notifications/PackageNotificationEventServiceTest.java b/src/test/java/org/kpmp/eridanus/notifications/PackageNotificationEventServiceTest.java index d35cc0a..f85dcdc 100644 --- a/src/test/java/org/kpmp/eridanus/notifications/PackageNotificationEventServiceTest.java +++ b/src/test/java/org/kpmp/eridanus/notifications/PackageNotificationEventServiceTest.java @@ -1,6 +1,6 @@ package org.kpmp.eridanus.notifications; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; import static org.mockito.Mockito.verify; @@ -13,9 +13,9 @@ import javax.mail.MessagingException; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; import org.mockito.Mock; import org.mockito.MockitoAnnotations; @@ -29,17 +29,18 @@ public class PackageNotificationEventServiceTest { @Mock private PackageRepository packageRepository; - @Before + @BeforeEach public void setUp() throws Exception { - MockitoAnnotations.initMocks(this); + MockitoAnnotations.openMocks(this); service = new PackageNotificationEventService(emailer, packageRepository); ReflectionTestUtils.setField(service, "toAddresses", Arrays.asList("rlreamy@umich.edu")); ReflectionTestUtils.setField(service, "uploadSuccess", "success"); ReflectionTestUtils.setField(service, "uploadFail", "fail"); } - @After + @AfterEach public void tearDown() throws Exception { + MockitoAnnotations.openMocks(this).close(); service = null; } diff --git a/src/test/java/org/kpmp/eridanus/notifications/PackageTest.java b/src/test/java/org/kpmp/eridanus/notifications/PackageTest.java index 33082d8..1810c0e 100644 --- a/src/test/java/org/kpmp/eridanus/notifications/PackageTest.java +++ b/src/test/java/org/kpmp/eridanus/notifications/PackageTest.java @@ -1,23 +1,24 @@ package org.kpmp.eridanus.notifications; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import java.util.Date; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + public class PackageTest { private Package pkg; - @Before + @BeforeEach public void setUp() throws Exception { pkg = new Package(); } - @After + @AfterEach public void tearDown() throws Exception { pkg = null; } diff --git a/src/test/java/org/kpmp/eridanus/notifications/StateChangeEventTest.java b/src/test/java/org/kpmp/eridanus/notifications/StateChangeEventTest.java index 100af51..4f562f4 100644 --- a/src/test/java/org/kpmp/eridanus/notifications/StateChangeEventTest.java +++ b/src/test/java/org/kpmp/eridanus/notifications/StateChangeEventTest.java @@ -1,21 +1,21 @@ package org.kpmp.eridanus.notifications; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class StateChangeEventTest extends StateChangeEvent { private StateChangeEvent event; - @Before + @BeforeEach public void setUp() throws Exception { event = new StateChangeEvent(); } - @After + @AfterEach public void tearDown() throws Exception { event = null; } diff --git a/src/test/java/org/kpmp/eridanus/notifications/UserTest.java b/src/test/java/org/kpmp/eridanus/notifications/UserTest.java index cc3a142..861c261 100644 --- a/src/test/java/org/kpmp/eridanus/notifications/UserTest.java +++ b/src/test/java/org/kpmp/eridanus/notifications/UserTest.java @@ -1,21 +1,21 @@ package org.kpmp.eridanus.notifications; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class UserTest { private User user; - @Before + @BeforeEach public void setUp() throws Exception { user = new User(); } - @After + @AfterEach public void tearDown() throws Exception { user = null; }