diff --git a/Dockerfile b/Dockerfile
index 6246591..e518137 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,8 +1,8 @@
-FROM dockerfile/java:oracle-java8
+FROM openjdk:8-jdk-alpine
WORKDIR /opt/onyx-scheduler
COPY target/onyx-scheduler.jar /opt/onyx-scheduler/onyx-scheduler.jar
-EXPOSE 8080
+EXPOSE 28080
CMD ["java", "-jar", "onyx-scheduler.jar"]
diff --git a/Readme.md b/Readme.md
index f09c320..3589118 100644
--- a/Readme.md
+++ b/Readme.md
@@ -34,7 +34,7 @@ If you want to run it with a provided mysql database which already contains quar
####Docker preconditions
- [Docker installed](https://docs.docker.com/installation/)
-A `Dockerfile` is provided so if you want to build it (after running `mvn package`) you can do something like `docker build -t onyx-scheduler .` and then `docker run -p 8080:8080 onyx-scheduler` to run the container. If you use [boot2docker](http://boot2docker.io/) remember to use the docker ip (`boot2docker ip` will display it) instead of localhost from the host machine to access the API.
+A `Dockerfile` is provided so if you want to build it (after running `mvn package`) you can do something like `docker build -t onyx-scheduler .` and then `docker run -e SPRING_PROFILES_ACTIVE=mysql-jobstore -e MYSQL_URL="jdbc:mysql://host.docker.internal:3306/onyx" -e MYSQL_USERNAME=onyx -e MYSQL_PASSWORD='onyx' -p 8080:8080 onyx-scheduler` to run the container. If you use [boot2docker](http://boot2docker.io/) remember to use the docker ip (`boot2docker ip` will display it) instead of localhost from the host machine to access the API.
###docker-compose
diff --git a/pom.xml b/pom.xml
index ff683b4..9f8da65 100644
--- a/pom.xml
+++ b/pom.xml
@@ -32,14 +32,14 @@
org.springframework.boot
spring-boot-starter-parent
- 1.2.2.RELEASE
+ 2.3.5.RELEASE
1.8
- 2.2.1
- 17.0
- 1.48
+ 2.3.2
+ 30.0-jre
+ 2.27.2
@@ -110,6 +110,18 @@
freemarker
test
+
+
+ javax.validation
+ validation-api
+ 2.0.1.Final
+
+
+
+ org.hibernate.validator
+ hibernate-validator
+ 6.1.6.Final
+
diff --git a/src/main/java/com/onyxscheduler/OnyxSchedulerApplication.java b/src/main/java/com/onyxscheduler/OnyxSchedulerApplication.java
index e0a09a0..8922046 100644
--- a/src/main/java/com/onyxscheduler/OnyxSchedulerApplication.java
+++ b/src/main/java/com/onyxscheduler/OnyxSchedulerApplication.java
@@ -22,6 +22,7 @@
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.datatype.jsr310.JSR310Module;
+import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
@@ -50,7 +51,7 @@ public MappingJackson2HttpMessageConverter jacksonConverter() {
mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
mapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);
- mapper.registerModule(new JSR310Module());
+ mapper.registerModule(new JavaTimeModule());
return new MappingJackson2HttpMessageConverter(mapper);
}
diff --git a/src/main/java/com/onyxscheduler/domain/HttpJob.java b/src/main/java/com/onyxscheduler/domain/HttpJob.java
index a0a2fe3..45a036f 100644
--- a/src/main/java/com/onyxscheduler/domain/HttpJob.java
+++ b/src/main/java/com/onyxscheduler/domain/HttpJob.java
@@ -181,7 +181,7 @@ public boolean equals(Object obj) {
@Override
public String toString() {
- return com.google.common.base.Objects.toStringHelper(this)
+ return com.google.common.base.MoreObjects.toStringHelper(this)
.add("id", id)
.add("group", group)
.add("name", name)
@@ -210,7 +210,7 @@ private HttpAuditRecord(
@Override
public String toString() {
- return com.google.common.base.Objects.toStringHelper(this)
+ return com.google.common.base.MoreObjects.toStringHelper(this)
.add("request", request)
.add("responseCode", responseCode)
.add("responseBody", responseBody)
diff --git a/src/main/java/com/onyxscheduler/domain/JobKey.java b/src/main/java/com/onyxscheduler/domain/JobKey.java
index 13e7b80..2d17ea8 100644
--- a/src/main/java/com/onyxscheduler/domain/JobKey.java
+++ b/src/main/java/com/onyxscheduler/domain/JobKey.java
@@ -72,7 +72,7 @@ public boolean equals(Object obj) {
@Override
public String toString() {
- return com.google.common.base.Objects.toStringHelper(this)
+ return com.google.common.base.MoreObjects.toStringHelper(this)
.add("name", name)
.add("group", group)
.toString();
diff --git a/src/main/java/com/onyxscheduler/domain/Trigger.java b/src/main/java/com/onyxscheduler/domain/Trigger.java
index 03286ff..a9ca74a 100644
--- a/src/main/java/com/onyxscheduler/domain/Trigger.java
+++ b/src/main/java/com/onyxscheduler/domain/Trigger.java
@@ -109,7 +109,7 @@ public boolean equals(Object obj) {
@Override
public String toString() {
- return com.google.common.base.Objects.toStringHelper(this)
+ return com.google.common.base.MoreObjects.toStringHelper(this)
.add("when", when)
.add("cron", cron)
.toString();
diff --git a/src/main/java/com/onyxscheduler/quartz/QuartzProperties.java b/src/main/java/com/onyxscheduler/quartz/QuartzProperties.java
index ee14c11..1126123 100644
--- a/src/main/java/com/onyxscheduler/quartz/QuartzProperties.java
+++ b/src/main/java/com/onyxscheduler/quartz/QuartzProperties.java
@@ -63,7 +63,6 @@ public Properties buildQuartzProperties() {
public Properties buildQuartzProperties() {
Properties props = new Properties();
//skip the check to don't bother with quartz updates
- props.setProperty(StdSchedulerFactory.PROP_SCHED_SKIP_UPDATE_CHECK, Boolean.toString(true));
props.setProperty(StdSchedulerFactory.PROP_SCHED_INSTANCE_ID,
StdSchedulerFactory.AUTO_GENERATE_INSTANCE_ID);
if (threadCount != null) {
diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml
index 0b0497a..94c5380 100644
--- a/src/main/resources/application.yml
+++ b/src/main/resources/application.yml
@@ -1,14 +1,12 @@
info:
build:
- artifact: @project.artifactId@
- name: @project.name@
- description: @project.description@
- version: @project.version@
+ artifact: '@project.artifactId@'
+ name: '@project.name@'
+ description: '@project.description@'
+ version: '@project.version@'
-security:
- user:
- name: admin
- password: admin
+server:
+ port : ${SERVER_PORT:28080}
quartz:
threadCount: 15
@@ -17,11 +15,14 @@ quartz:
quartz:
jobstore:
- clustered: false
+ isClustered: {$CLUSTERED:true}
spring:
profiles: mysql-jobstore
datasource:
- url: "jdbc:mysql://mysql/onyx"
- username: onyx
- password: onyx
+ url: ${MYSQL_URL:jdbc:mysql://mysql/onyx}
+ username: ${MYSQL_USERNAME:onyx}
+ password: ${MYSQL_PASSWORD:onyx}
+ autoconfigure:
+ exclude[0]: org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration
+ exclude[1]: org.springframework.boot.actuate.autoconfigure.security.servlet.ManagementWebSecurityAutoConfiguration
diff --git a/src/test/java/com/onyxscheduler/OnyxSchedulerIT.java b/src/test/java/com/onyxscheduler/OnyxSchedulerIT.java
index bbf9ded..270e29a 100644
--- a/src/test/java/com/onyxscheduler/OnyxSchedulerIT.java
+++ b/src/test/java/com/onyxscheduler/OnyxSchedulerIT.java
@@ -29,9 +29,8 @@
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
-import org.springframework.boot.test.IntegrationTest;
-import org.springframework.boot.test.SpringApplicationConfiguration;
-import org.springframework.boot.test.TestRestTemplate;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.boot.test.web.client.TestRestTemplate;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
@@ -65,9 +64,8 @@
import static org.junit.Assert.assertThat;
@RunWith(SpringJUnit4ClassRunner.class)
-@SpringApplicationConfiguration(classes = OnyxSchedulerApplication.class)
+@SpringBootTest(classes = OnyxSchedulerApplication.class, webEnvironment=SpringBootTest.WebEnvironment.DEFINED_PORT)
@WebAppConfiguration
-@IntegrationTest({"server.port=0"})
public class OnyxSchedulerIT {
public static final String PORT_TEMPLATE_PROPERTY_KEY = "port";
@@ -92,7 +90,7 @@ public class OnyxSchedulerIT {
@Rule
public WireMockClassRule wireMockRule = wireMockClassRule;
- private RestTemplate restTemplate;
+ private TestRestTemplate restTemplate;
private String appUrl;
diff --git a/src/test/java/com/onyxscheduler/domain/HttpJobExecutionIT.java b/src/test/java/com/onyxscheduler/domain/HttpJobExecutionIT.java
index c82e366..89afae0 100644
--- a/src/test/java/com/onyxscheduler/domain/HttpJobExecutionIT.java
+++ b/src/test/java/com/onyxscheduler/domain/HttpJobExecutionIT.java
@@ -26,7 +26,7 @@
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
-import org.springframework.boot.test.SpringApplicationConfiguration;
+import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
@@ -49,7 +49,7 @@
@RunWith(SpringJUnit4ClassRunner.class)
@Configuration
-@SpringApplicationConfiguration(classes = OnyxSchedulerApplication.class)
+@SpringBootTest(classes = OnyxSchedulerApplication.class)
public class HttpJobExecutionIT {
public static final String TEST_PATH = "/test";
diff --git a/src/test/java/com/onyxscheduler/domain/HttpJobJsonSerializationIT.java b/src/test/java/com/onyxscheduler/domain/HttpJobJsonSerializationIT.java
index 6a03e92..cd91fc9 100644
--- a/src/test/java/com/onyxscheduler/domain/HttpJobJsonSerializationIT.java
+++ b/src/test/java/com/onyxscheduler/domain/HttpJobJsonSerializationIT.java
@@ -29,7 +29,7 @@
import org.skyscreamer.jsonassert.JSONAssert;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
-import org.springframework.boot.test.SpringApplicationConfiguration;
+import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.Resource;
import org.springframework.http.HttpMethod;
@@ -48,7 +48,7 @@
@RunWith(SpringJUnit4ClassRunner.class)
@Configuration
-@SpringApplicationConfiguration(classes = OnyxSchedulerApplication.class)
+@SpringBootTest(classes = OnyxSchedulerApplication.class)
public class HttpJobJsonSerializationIT {
@Autowired
diff --git a/src/test/java/com/onyxscheduler/domain/SchedulerIT.java b/src/test/java/com/onyxscheduler/domain/SchedulerIT.java
index 421a9da..06d5b15 100644
--- a/src/test/java/com/onyxscheduler/domain/SchedulerIT.java
+++ b/src/test/java/com/onyxscheduler/domain/SchedulerIT.java
@@ -25,7 +25,7 @@
import org.junit.runner.RunWith;
import org.quartz.SchedulerException;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.SpringApplicationConfiguration;
+import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@@ -50,7 +50,7 @@
*/
@RunWith(SpringJUnit4ClassRunner.class)
@Configuration
-@SpringApplicationConfiguration(classes = OnyxSchedulerApplication.class)
+@SpringBootTest(classes = OnyxSchedulerApplication.class)
public class SchedulerIT {
public static final int FIRE_THRESHOLD_TIMEOUT_IN_MILLIS = 5000;
@@ -178,7 +178,7 @@ public boolean equals(Object obj) {
@Override
public String toString() {
- return com.google.common.base.Objects.toStringHelper(this)
+ return com.google.common.base.MoreObjects.toStringHelper(this)
.add("id", id)
.add("group", group)
.add("name", name)
diff --git a/src/test/java/com/onyxscheduler/web/JobControllerIT.java b/src/test/java/com/onyxscheduler/web/JobControllerIT.java
index 5977962..17db1cf 100644
--- a/src/test/java/com/onyxscheduler/web/JobControllerIT.java
+++ b/src/test/java/com/onyxscheduler/web/JobControllerIT.java
@@ -23,18 +23,16 @@
import org.junit.runner.RunWith;
import org.mockito.Mockito;
import org.springframework.beans.factory.annotation.Value;
-import org.springframework.boot.test.IntegrationTest;
-import org.springframework.boot.test.SpringApplicationConfiguration;
-import org.springframework.boot.test.TestRestTemplate;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.boot.test.web.client.TestRestTemplate;
import org.springframework.context.annotation.Bean;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.web.WebAppConfiguration;
import org.springframework.web.client.RestTemplate;
@RunWith(SpringJUnit4ClassRunner.class)
-@SpringApplicationConfiguration(classes = OnyxSchedulerApplication.class)
+@SpringBootTest(classes = OnyxSchedulerApplication.class, webEnvironment=SpringBootTest.WebEnvironment.DEFINED_PORT)
@WebAppConfiguration
-@IntegrationTest({"server.port=0"})
public class JobControllerIT {
//TODO verify proper handling of exceptions, validations, and expected responses (status and body)
@@ -47,7 +45,7 @@ public class JobControllerIT {
@Value("${security.user.password}")
String password;
- private RestTemplate restTemplate;
+ private TestRestTemplate restTemplate;
private String appUrl;