Skip to content

Commit

Permalink
Update Spring, Java, Gradle and dependencies to newest versions; adju…
Browse files Browse the repository at this point in the history
…st code and tests for new dependencies

Co-authored-by: Micha Regel <[email protected]>
Co-authored-by: Stefan Lier <[email protected]>
  • Loading branch information
micharegel1111 and Stefan Lier committed Aug 28, 2018
1 parent 64fb712 commit bf053df
Show file tree
Hide file tree
Showing 19 changed files with 85 additions and 37 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,5 @@ health/health.iml
example/example.iml
.gitconfig
classes
gradlew*
gradlew/
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
language: java

jdk:
- oraclejdk8
- oraclejdk10

install: /bin/true # skip gradle assemble

Expand Down
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
# Release Notes

## 2.0.0-m2-SNAPSHOT

* Updated to Spring Boot 2.0.4.RELEASE

* Updated to Spring framework 5.0.8.RELEASE

* Updated to Gradle 4.9

* Changed to Java 10 SDKe

* Updated dependencies to latest versions

* Added Testconfiguration for TogglzTest



## 2.0.0-m1-SNAPSHOT

**Breaking Changes:**
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ feature toggles.

## Setup

Make sure you have Java 1.8 or later and gradle 4.x installed on your computer.
Make sure you have Java 10 or later and gradle 4.x installed on your computer.

### Testing

Expand Down
2 changes: 1 addition & 1 deletion bin/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.2.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-bin.zip
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ subprojects {
// DO NOT FORGET TO DOCUMENT CHANGES IN CHANGELOG.md
//
// Add a GitHub release for every new release: https://github.com/otto-de/edison-microservice/releases
version = '2.0.0-m1-SNAPSHOT'
version = '2.0.0-m2-SNAPSHOT'
group = 'de.otto.edison'

repositories {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ public void shouldAppendMessageToJobInfo() throws Exception {

assertThat(jobInfoFromRepo.getMessages().size(), is(1));
assertThat(jobInfoFromRepo.getMessages().get(0), is(igelMessage));
assertThat(jobInfoFromRepo.getLastUpdated(), is(now));
assertThat(jobInfoFromRepo.getLastUpdated(), is(now.truncatedTo(ChronoUnit.MILLIS)));

}

Expand Down
2 changes: 1 addition & 1 deletion edison-testsupport/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
dependencies {
compileOnly libraries.togglz_servlet
compileOnly libraries.togglz_console
compileOnly libraries.togglz_spring_web
compileOnly libraries.togglz_spring_boot_starter
compileOnly test_libraries.togglz_testing

compile libraries.spring_boot
Expand Down
1 change: 0 additions & 1 deletion edison-togglz/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
dependencies {
compile project(":edison-core")
compile libraries.togglz_servlet
compile libraries.togglz_console
compile libraries.togglz_spring_web
compile libraries.unboundid_ldapsdk_minimal_edition
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
import java.lang.annotation.Annotation;
import java.util.regex.Pattern;

public class SafeIdValidator implements ConstraintValidator<Annotation, String> {
public class SafeIdValidator implements ConstraintValidator<SafeId, String> {

private static final Pattern IdPattern = Pattern.compile("[a-zA-Z0-9\\-_]*");

@Override
public void initialize(Annotation annotation) {
public void initialize(SafeId safeId) {
// do nothing
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
package de.otto.edison.validation.web;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import de.otto.edison.hal.HalRepresentation;

import java.util.*;

import static com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL;
import static de.otto.edison.hal.Link.profile;
import static de.otto.edison.hal.Links.linkingTo;

Expand All @@ -18,9 +20,10 @@ public class ErrorHalRepresentation extends HalRepresentation {
private final Map<String, List<Map<String, String>>> errors;

private ErrorHalRepresentation(Builder builder) {
super(linkingTo(
profile(PROFILE_ERROR)
));
super(linkingTo()
.array(profile(PROFILE_ERROR))
.build()
);
this.errors = builder.errors;
this.errorMessage = builder.errorMessage;
}
Expand Down Expand Up @@ -63,6 +66,7 @@ public String getErrorMessage() {
}

@JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(NON_NULL)
public static final class Builder {
private Map<String, List<Map<String, String>>> errors = new HashMap<>();
private String errorMessage;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package de.otto.edison.validation.web;

import com.jayway.restassured.RestAssured;
import com.jayway.restassured.http.ContentType;
import de.otto.edison.validation.validators.SafeId;
import io.restassured.RestAssured;
import io.restassured.http.ContentType;
import org.hamcrest.Matchers;
import org.junit.Before;
import org.junit.Test;
Expand All @@ -24,7 +24,7 @@
import javax.servlet.ServletContext;
import java.util.Collections;

import static com.jayway.restassured.RestAssured.given;
import static io.restassured.RestAssured.given;
import static org.hamcrest.Matchers.is;
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;

Expand Down Expand Up @@ -59,7 +59,7 @@ public void shouldValidateAndProduceErrorRepresentation() {
.put("/testing")
.then()
.assertThat()
.statusCode(422).and()
.statusCode(is(422)).and()
.header("Content-type", Matchers.containsString(";charset=utf-8"))
.content("errors.id[0].key", Collections.emptyList(), is("id.invalid"))
.content("errors.id[0].message", Collections.emptyList(), is("Ungueltiger Id-Wert."))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@

import static org.springframework.boot.SpringApplication.run;

@SpringBootApplication
@EnableScheduling
@PropertySource("version.properties")
@ComponentScan("de.otto.edison")
@SpringBootApplication(scanBasePackages = "de.otto.edison")
public class ExampleTogglzServer {

public static void main(String[] args) {
Expand Down
1 change: 1 addition & 0 deletions examples/example-togglz/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ edison:
description: Example service to show how to use edison-togglz in your microservices
title: Example Togglz
togglz:
enabled: true
cache-ttl: 100
console:
enabled: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package de.otto.edison.example;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.togglz.core.user.FeatureUser;
import org.togglz.core.user.SimpleFeatureUser;
import org.togglz.core.user.UserProvider;

@Configuration
public class TogglzTestConfiguration {

@Bean
public UserProvider userProvider() {
return new UserProvider() {
@Override
public FeatureUser getCurrentUser() {
return new SimpleFeatureUser("someName", false);
}
};
}

}
36 changes: 18 additions & 18 deletions gradle/dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,35 +4,35 @@
*/
ext {
versions = [
spring_boot : '2.0.2.RELEASE',
spring : '5.0.6.RELEASE',
async_http_client : '2.4.9',
spring_boot : '2.0.4.RELEASE',
spring : '5.0.8.RELEASE',
async_http_client : '2.5.2',
jcip_annotations : '1.0',
logback_classic : '1.2.3',
metrics : '3.2.5',
metrics_spring : '3.1.3',
javax_servlet_api : '3.1.0',
togglz : '2.5.0.Final',
mongodb_driver : '3.5.0',
togglz : '2.6.1.Final',
mongodb_driver : '3.8.1',
caffeine : '2.5.6',
json_path : '2.4.0',
unboundid_ldapsdk_minimal_edition: '3.2.1',
hibernate_validator : '6.0.7.Final',
edison_hal : '1.0.0',
hibernate_validator : '6.0.12.Final',
edison_hal : '2.0.1',
validator_collection : '2.2.0',
java_validation_api : '2.0.0.Final'
java_validation_api : '2.0.1.Final'
]
test_versions = [
junit : '4.12',
hamcrest : '1.3',
mockito_core : '2.10.0',
jsonassert : '1.5.0',
rest_assured : '2.9.0',
embedded_mongo: '2.1.1'
junit : '5.2.0',
hamcrest : '1.3',
mockito_core : '2.21.0',
jsonassert : '1.5.0',
rest_assured : '3.1.1',
embedded_mongo : '2.1.1'
]
plugin_versions = [
versions : '0.15.0',
jacoco : '0.7.9',
jacoco : '0.8.2',
nexus_staging: '0.11.0'
]

Expand All @@ -56,9 +56,9 @@ ext {
metrics_spring : "com.ryantenney.metrics:metrics-spring:${versions.metrics_spring}",
spring_context_support : "org.springframework:spring-context-support:${versions.spring}",
javax_servlet_api : "javax.servlet:javax.servlet-api:${versions.javax_servlet_api}",
togglz_servlet : "org.togglz:togglz-servlet:${versions.togglz}",
togglz_console : "org.togglz:togglz-console:${versions.togglz}",
togglz_spring_web : "org.togglz:togglz-spring-web:${versions.togglz}",
togglz_spring_boot_starter : "org.togglz:togglz-spring-boot-starter:${versions.togglz}",
mongodb_driver : "org.mongodb:mongodb-driver:${versions.mongodb_driver}",
caffeine : "com.github.ben-manes.caffeine:caffeine:${versions.caffeine}",
unboundid_ldapsdk_minimal_edition : "com.unboundid:unboundid-ldapsdk-minimal-edition:${versions.unboundid_ldapsdk_minimal_edition}",
Expand All @@ -68,7 +68,7 @@ ext {
validator_collection : "cz.jirutka.validator:validator-collection:${versions.validator_collection}"
]
test_libraries = [
junit : "junit:junit:${test_versions.junit}",
junit : "org.junit.jupiter:junit-jupiter-api:${test_versions.junit}",
hamcrest_core : "org.hamcrest:hamcrest-core:${test_versions.hamcrest}",
hamcrest_library : "org.hamcrest:hamcrest-library:${test_versions.hamcrest}",
mockito_core : "org.mockito:mockito-core:${test_versions.mockito_core}", /* Can not update to current 2.2.28 release because of Spring is still depending on this version... */
Expand All @@ -78,7 +78,7 @@ ext {
togglz_testing : "org.togglz:togglz-testing:${versions.togglz}",
embedded_mongo : "de.flapdoodle.embed:de.flapdoodle.embed.mongo:${test_versions.embedded_mongo}",
json_path : "com.jayway.jsonpath:json-path:${versions.json_path}",
rest_assured : "com.jayway.restassured:rest-assured:${test_versions.rest_assured}"
rest_assured : "io.rest-assured:rest-assured:${test_versions.rest_assured}"
]
gradle_plugins = [
versions : "com.github.ben-manes:gradle-versions-plugin:${plugin_versions.versions}",
Expand Down
2 changes: 1 addition & 1 deletion gradle/root/idea.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apply plugin: 'idea'

idea {
project {
languageLevel = '1.8'
languageLevel = '10'
ipr.withXml { provider ->
provider.node.component.find { it.@name == 'VcsDirectoryMappings' }.mapping.@vcs = 'Git'
}
Expand Down
Binary file added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
5 changes: 5 additions & 0 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.8-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

0 comments on commit bf053df

Please sign in to comment.