Skip to content

Commit

Permalink
Merge branch 'develop' into KPMP-4940_update_version
Browse files Browse the repository at this point in the history
  • Loading branch information
rlreamy authored Jun 12, 2024
2 parents 69ebb28 + 9412d02 commit 5c315e3
Show file tree
Hide file tree
Showing 11 changed files with 58 additions and 53 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build-gradle-project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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
Expand Down
24 changes: 14 additions & 10 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +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 = "4.1"

apply plugin: 'java'
apply plugin: 'eclipse'
Expand All @@ -27,7 +30,6 @@ eclipse {

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

repositories {
Expand All @@ -40,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 {
Expand Down Expand Up @@ -78,15 +82,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-data:" + 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
4 changes: 1 addition & 3 deletions src/main/resources/application.properties
Original file line number Diff line number Diff line change
@@ -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
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 5c315e3

Please sign in to comment.