Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update libraries with latest #4

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any particular reason to change the default port?

CMD ["java", "-jar", "onyx-scheduler.jar"]
2 changes: 1 addition & 1 deletion Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason to be explicit in all environment variables? I would rather prefer keeping the example simple and used default provided options, and users can later on (if they need) how to change any of the provided settings. Another option is leaving the simple example and then add some section on how to change the default configuration


###docker-compose

Expand Down
20 changes: 16 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.2.2.RELEASE</version>
<version>2.3.5.RELEASE</version>
</parent>

<properties>
<java.version>1.8</java.version>
<quartz.version>2.2.1</quartz.version>
<guava.version>17.0</guava.version>
<wiremock.version>1.48</wiremock.version>
<quartz.version>2.3.2</quartz.version>
<guava.version>30.0-jre</guava.version>
<wiremock.version>2.27.2</wiremock.version>
</properties>

<repositories>
Expand Down Expand Up @@ -110,6 +110,18 @@
<artifactId>freemarker</artifactId>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/javax.validation/validation-api -->
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>2.0.1.Final</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.hibernate.validator/hibernate-validator -->
<dependency>
<groupId>org.hibernate.validator</groupId>
<artifactId>hibernate-validator</artifactId>
<version>6.1.6.Final</version>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/onyxscheduler/domain/HttpJob.java
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/onyxscheduler/domain/JobKey.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/onyxscheduler/domain/Trigger.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
25 changes: 13 additions & 12 deletions src/main/resources/application.yml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any particular reason to disable security?

exclude[0]: org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration
exclude[1]: org.springframework.boot.actuate.autoconfigure.security.servlet.ManagementWebSecurityAutoConfiguration
10 changes: 4 additions & 6 deletions src/test/java/com/onyxscheduler/OnyxSchedulerIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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";
Expand All @@ -92,7 +90,7 @@ public class OnyxSchedulerIT {
@Rule
public WireMockClassRule wireMockRule = wireMockClassRule;

private RestTemplate restTemplate;
private TestRestTemplate restTemplate;

private String appUrl;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -48,7 +48,7 @@

@RunWith(SpringJUnit4ClassRunner.class)
@Configuration
@SpringApplicationConfiguration(classes = OnyxSchedulerApplication.class)
@SpringBootTest(classes = OnyxSchedulerApplication.class)
public class HttpJobJsonSerializationIT {

@Autowired
Expand Down
6 changes: 3 additions & 3 deletions src/test/java/com/onyxscheduler/domain/SchedulerIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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)
Expand Down
10 changes: 4 additions & 6 deletions src/test/java/com/onyxscheduler/web/JobControllerIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -47,7 +45,7 @@ public class JobControllerIT {
@Value("${security.user.password}")
String password;

private RestTemplate restTemplate;
private TestRestTemplate restTemplate;

private String appUrl;

Expand Down