Skip to content

Commit

Permalink
Update eridanus to java 21
Browse files Browse the repository at this point in the history
  • Loading branch information
Dert1129 committed May 30, 2024
1 parent 1366d6e commit 7b4a5b9
Show file tree
Hide file tree
Showing 8 changed files with 53 additions and 52 deletions.
30 changes: 14 additions & 16 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "1.3"

apply plugin: 'java'
apply plugin: 'eclipse'
Expand All @@ -25,12 +27,6 @@ eclipse {
project.natures 'org.eclipse.buildship.core.gradleprojectnature'
}


jar {
baseName='eridanus-data'
version= '1.3'
}

repositories {
mavenCentral()
}
Expand All @@ -41,16 +37,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 {
Expand Down Expand Up @@ -79,15 +77,15 @@ def getCurrentGitBranch() {
} catch (e) {
}
if (gitBranch == "develop" || gitBranch == "master"){
return jar.version
return project.version
}else{
return gitBranch
}
}
}

docker {
name "kingstonduo/${jar.baseName}:" + getCurrentGitBranch()
name "kingstonduo/eridanus-spring" + getCurrentGitBranch()
copySpec.from(tasks.unpack.outputs).into("dependency")
buildArgs(['DEPENDENCY': "dependency"])
}
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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;

Expand All @@ -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;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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;
Expand All @@ -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("[email protected]"));
ReflectionTestUtils.setField(service, "uploadSuccess", "success");
ReflectionTestUtils.setField(service, "uploadFail", "fail");
}

@After
@AfterEach
public void tearDown() throws Exception {
MockitoAnnotations.openMocks(this).close();
service = null;
}

Expand Down
13 changes: 7 additions & 6 deletions src/test/java/org/kpmp/eridanus/notifications/PackageTest.java
Original file line number Diff line number Diff line change
@@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
}
Expand Down
12 changes: 6 additions & 6 deletions src/test/java/org/kpmp/eridanus/notifications/UserTest.java
Original file line number Diff line number Diff line change
@@ -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;
}
Expand Down

0 comments on commit 7b4a5b9

Please sign in to comment.