DATAREST-1509 - Polishing.
Reduce Jenkins build to Java 8 + 14 for jackson-next profile. Simplify assertion style. Convert space indents to tabs. Original pull request: #374.
This commit is contained in:
19
Jenkinsfile
vendored
19
Jenkinsfile
vendored
@@ -104,25 +104,6 @@ pipeline {
|
||||
sh 'MAVEN_OPTS="-Duser.name=jenkins -Duser.home=/tmp/jenkins-home" ./mvnw -Pjava11 clean dependency:list test -Dsort -U -B -Pit,spring52-next,jackson-next'
|
||||
}
|
||||
}
|
||||
stage("test: spring52/jackson-next (jdk11)") {
|
||||
agent {
|
||||
docker {
|
||||
image 'springci/spring-data-openjdk11-with-mongodb-4.2.0:latest'
|
||||
label 'data'
|
||||
args '-v $HOME:/tmp/jenkins-home'
|
||||
}
|
||||
}
|
||||
options { timeout(time: 30, unit: 'MINUTES') }
|
||||
steps {
|
||||
sh 'rm -rf ?'
|
||||
sh 'mkdir -p /tmp/mongodb/db /tmp/mongodb/log'
|
||||
sh 'mongod --dbpath /tmp/mongodb/db --replSet rs0 --fork --logpath /tmp/mongodb/log/mongod.log &'
|
||||
sh 'sleep 10'
|
||||
sh 'mongo --eval "rs.initiate({_id: \'rs0\', members:[{_id: 0, host: \'127.0.0.1:27017\'}]});"'
|
||||
sh 'sleep 15'
|
||||
sh 'MAVEN_OPTS="-Duser.name=jenkins -Duser.home=/tmp/jenkins-home" ./mvnw -Pjava11 clean dependency:list test -Dsort -U -B -Pit,spring52-next,jackson-next'
|
||||
}
|
||||
}
|
||||
stage("test: spring52/jackson-next (jdk14)") {
|
||||
agent {
|
||||
docker {
|
||||
|
||||
@@ -16,24 +16,19 @@
|
||||
package org.springframework.data.rest.webmvc.config;
|
||||
|
||||
import static org.assertj.core.api.Assertions.*;
|
||||
import static org.springframework.data.domain.ExampleMatcher.GenericPropertyMatchers.*;
|
||||
import static org.springframework.data.rest.webmvc.util.AssertionUtils.*;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.TimeZone;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import javax.naming.Name;
|
||||
import javax.naming.ldap.LdapName;
|
||||
|
||||
import org.assertj.core.api.Condition;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
@@ -50,10 +45,8 @@ import org.springframework.data.rest.webmvc.RepositoryLinksResource;
|
||||
import org.springframework.data.rest.webmvc.RestMediaTypes;
|
||||
import org.springframework.data.rest.webmvc.alps.AlpsJsonHttpMessageConverter;
|
||||
import org.springframework.data.rest.webmvc.json.PersistentEntityJackson2Module;
|
||||
import org.springframework.data.rest.webmvc.util.AssertionUtils;
|
||||
import org.springframework.data.web.HateoasPageableHandlerMethodArgumentResolver;
|
||||
import org.springframework.data.web.PageableHandlerMethodArgumentResolver;
|
||||
import org.springframework.format.datetime.DateFormatter;
|
||||
import org.springframework.hateoas.MediaTypes;
|
||||
import org.springframework.hateoas.client.LinkDiscoverers;
|
||||
import org.springframework.hateoas.server.core.DefaultLinkRelationProvider;
|
||||
@@ -134,10 +127,9 @@ public class RepositoryRestMvConfigurationIntegrationTests {
|
||||
|
||||
String result = JsonPath.read(mapper.writeValueAsString(sample), "$.date");
|
||||
|
||||
assertThat(result).is(anyOf( //
|
||||
new Condition<>(endsWith("+00"), "ISO-8601-TZ1"), //
|
||||
new Condition<>(endsWith("+0000"), "ISO-8601-TZ2"), //
|
||||
new Condition<>(endsWith("+00:00"), "ISO-8601-TZ3")));
|
||||
assertThat(result).matches(suffix("+00") //
|
||||
.or(suffix("+0000")) //
|
||||
.or(suffix("+00:00")), "ISO-8601-TZ1, ISO-8601-TZ2, or ISO-8601-TZ3");
|
||||
}
|
||||
|
||||
@Test(expected = NoSuchBeanDefinitionException.class) // DATAREST-362
|
||||
|
||||
@@ -9,14 +9,13 @@ import java.util.function.Predicate;
|
||||
*/
|
||||
public final class AssertionUtils {
|
||||
|
||||
|
||||
/**
|
||||
* {@link Predicate} to verify a given string ends in a certain pattern.
|
||||
*
|
||||
* @param pattern
|
||||
* @return
|
||||
*/
|
||||
public static Predicate<String> endsWith(String pattern) {
|
||||
return s -> s.endsWith(pattern);
|
||||
}
|
||||
/**
|
||||
* {@link Predicate} to verify a given string ends in a certain suffix.
|
||||
*
|
||||
* @param suffix
|
||||
* @return
|
||||
*/
|
||||
public static Predicate<String> suffix(String suffix) {
|
||||
return s -> s.endsWith(suffix);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user