Fixing jdk16
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
set -e
|
||||
|
||||
WRAPPER_VERSION="7.0"
|
||||
WRAPPER_VERSION="7.1"
|
||||
GRADLE_BIN_DIR="gradle-${WRAPPER_VERSION}-bin"
|
||||
GRADLE_WRAPPER_DIR="${HOME}/.gradle/wrapper/dists/${GRADLE_BIN_DIR}"
|
||||
CURRENT_DIR="$( pwd )"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
org.gradle.daemon=false
|
||||
verifierVersion=3.0.4-SNAPSHOT
|
||||
springBootVersion=2.4.7
|
||||
camelVersion=3.4.3
|
||||
verifierVersion=3.1.0-SNAPSHOT
|
||||
springBootVersion=2.6.0-SNAPSHOT
|
||||
camelVersion=3.11.0
|
||||
51
pom.xml
51
pom.xml
@@ -23,10 +23,9 @@
|
||||
<inceptionYear>2016</inceptionYear>
|
||||
|
||||
<properties>
|
||||
<!-- Align it also in Docker image -->
|
||||
<camel.version>3.6.0</camel.version>
|
||||
<checkstyle.version>2.17</checkstyle.version>
|
||||
<pact.version>4.0.10</pact.version>
|
||||
<!-- Align it also in Docker image under [docker/spring-cloud-contract-docker/project/gradle.properties] -->
|
||||
<camel.version>3.11.0</camel.version>
|
||||
<pact.version>4.2.7</pact.version>
|
||||
<jsch-agent.version>0.0.9</jsch-agent.version>
|
||||
<spring-cloud-build.version>3.1.0-SNAPSHOT</spring-cloud-build.version>
|
||||
<spring-cloud-zookeeper.version>3.1.0-SNAPSHOT</spring-cloud-zookeeper.version>
|
||||
@@ -43,12 +42,10 @@
|
||||
<handlebars.version>4.2.0</handlebars.version>
|
||||
<jgit.version>5.5.1.201910021850-r</jgit.version>
|
||||
<javax-inject.version>1</javax-inject.version>
|
||||
<mockito.version>3.4.6</mockito.version>
|
||||
<json-unit-assertj.version>2.19.0</json-unit-assertj.version>
|
||||
<json-unit-assertj.version>2.27.0</json-unit-assertj.version>
|
||||
|
||||
<junit-platform.version>1.3.2</junit-platform.version>
|
||||
<junit-vintage.version>5.6.2</junit-vintage.version>
|
||||
<junit-jupiter.version>5.5.2</junit-jupiter.version>
|
||||
<junit-vintage.version>5.7.2</junit-vintage.version>
|
||||
<junit-jupiter.version>5.7.2</junit-jupiter.version>
|
||||
<gmavenplus-plugin.version>1.12.1</gmavenplus-plugin.version>
|
||||
|
||||
<!-- We need to have compatibility with Gradle -->
|
||||
@@ -63,7 +60,7 @@
|
||||
<exec-maven-plugin.version>1.6.0</exec-maven-plugin.version>
|
||||
<InMemoryJavaCompiler.version>1.3.0</InMemoryJavaCompiler.version>
|
||||
<!-- Aligned with Gradle, otherwise Gradle based projects won't work well -->
|
||||
<contract.kotlin.version>1.4.0</contract.kotlin.version>
|
||||
<contract.kotlin.version>1.4.31</contract.kotlin.version>
|
||||
<commons-beanutils.version>1.9.4</commons-beanutils.version>
|
||||
|
||||
<javadoc.failOnError>true</javadoc.failOnError>
|
||||
@@ -210,8 +207,8 @@
|
||||
<version>${commons-text.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>au.com.dius</groupId>
|
||||
<artifactId>pact-jvm-consumer-java8</artifactId>
|
||||
<groupId>au.com.dius.consumer</groupId>
|
||||
<artifactId>pact-jvm-consumer</artifactId>
|
||||
<version>${pact.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
@@ -225,7 +222,7 @@
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>au.com.dius</groupId>
|
||||
<groupId>au.com.dius.provider</groupId>
|
||||
<artifactId>pact-jvm-provider-junit</artifactId>
|
||||
<version>${pact.version}</version>
|
||||
<exclusions>
|
||||
@@ -459,27 +456,9 @@
|
||||
<artifactId>kotlin-compiler-embeddable</artifactId>
|
||||
<version>${contract.kotlin.version}</version>
|
||||
</dependency>
|
||||
<!-- TODO: If not provided explicitly will cause a wrong version to be loaded -->
|
||||
<dependency>
|
||||
<groupId>org.mockito</groupId>
|
||||
<artifactId>mockito-core</artifactId>
|
||||
<version>${mockito.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.junit.vintage</groupId>
|
||||
<artifactId>junit-vintage-engine</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<prerequisites>
|
||||
<maven>[3.2.1,)</maven>
|
||||
</prerequisites>
|
||||
|
||||
<organization>
|
||||
<name>Spring</name>
|
||||
<url>https://spring.io/</url>
|
||||
@@ -494,17 +473,17 @@
|
||||
<developer>
|
||||
<id>marcingrzejszczak</id>
|
||||
<name>Marcin Grzejszczak</name>
|
||||
<email>mgrzejszczak@pivotal.io</email>
|
||||
<email>mgrzejszczak@vmware.com</email>
|
||||
</developer>
|
||||
<developer>
|
||||
<id>dsyer</id>
|
||||
<name>David Syer</name>
|
||||
<email>dsyer@pivotal.io</email>
|
||||
<email>dsyer@vmware.com</email>
|
||||
</developer>
|
||||
<developer>
|
||||
<id>OlgaMaciaszek</id>
|
||||
<name>Olga Maciaszek-Sharma</name>
|
||||
<email>omaciaszeksharma@pivotal.io</email>
|
||||
<email>omaciaszeksharma@vmware.com</email>
|
||||
</developer>
|
||||
</developers>
|
||||
|
||||
@@ -524,8 +503,8 @@
|
||||
</issueManagement>
|
||||
|
||||
<ciManagement>
|
||||
<system>CircleCi</system>
|
||||
<url>https://circleci.com/gh/spring-cloud/spring-cloud-contract</url>
|
||||
<system>Github Actions</system>
|
||||
<url>https://github.com/spring-cloud/spring-cloud-contract/actions</url>
|
||||
</ciManagement>
|
||||
|
||||
<build>
|
||||
|
||||
@@ -22,10 +22,10 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.assertj.core.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
public class XegerTest {
|
||||
|
||||
@@ -35,7 +35,7 @@ public class XegerTest {
|
||||
Xeger generator = new Xeger(regex);
|
||||
for (int i = 0; i < 100; i++) {
|
||||
String text = generator.generate();
|
||||
assertTrue(text.matches(regex));
|
||||
assertThat(text.matches(regex)).isTrue();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ public class XegerTest {
|
||||
Xeger generator = new Xeger(regex);
|
||||
for (int i = 0; i < 100; i++) {
|
||||
String text = generator.generate();
|
||||
assertTrue(text.length() == 1);
|
||||
assertThat(text.length() == 1).isTrue();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ public class XegerTest {
|
||||
Xeger generator = new Xeger(regex);
|
||||
for (int i = 0; i < 100; i++) {
|
||||
String text = generator.generate();
|
||||
assertTrue(text.matches(regex));
|
||||
assertThat(text.matches(regex)).isTrue();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ public class XegerTest {
|
||||
Xeger generator = new Xeger(regex);
|
||||
for (int i = 0; i < 100; i++) {
|
||||
String text = generator.generate();
|
||||
assertTrue(text.matches(regex));
|
||||
assertThat(text.matches(regex)).isTrue();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ public class XegerTest {
|
||||
Xeger generator = new Xeger(regex);
|
||||
for (int i = 0; i < 100; i++) {
|
||||
String text = generator.generate();
|
||||
assertTrue(text.matches(regex));
|
||||
assertThat(text.matches(regex)).isTrue();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ public class XegerTest {
|
||||
List<String> secondRegexList = generateRegex(generator2, 100);
|
||||
|
||||
for (int i = 0; i < firstRegexList.size(); i++) {
|
||||
assertEquals("Index mismatch: " + i, firstRegexList.get(i), secondRegexList.get(i));
|
||||
assertThat(firstRegexList.get(i)).isEqualTo(secondRegexList.get(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,10 +20,9 @@ package repackaged.nl.flotsam.xeger;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import org.hamcrest.Matchers;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
public class XegerUtilsTest {
|
||||
|
||||
@@ -32,8 +31,7 @@ public class XegerUtilsTest {
|
||||
Random random = new Random();
|
||||
for (int i = 0; i < 100; i++) {
|
||||
int number = Xeger.getRandomInt(3, 7, random);
|
||||
assertThat(number, Matchers.greaterThanOrEqualTo(3));
|
||||
assertThat(number, Matchers.lessThanOrEqualTo(7));
|
||||
assertThat(number).isGreaterThanOrEqualTo(3).isLessThanOrEqualTo(7);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
package org.springframework.cloud.contract.spec.internal;
|
||||
|
||||
import org.assertj.core.api.BDDAssertions;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* @author Marcin Grzejszczak
|
||||
|
||||
@@ -39,11 +39,11 @@
|
||||
<artifactId>groovy-nio</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>au.com.dius</groupId>
|
||||
<artifactId>pact-jvm-consumer-java8</artifactId>
|
||||
<groupId>au.com.dius.consumer</groupId>
|
||||
<artifactId>pact-jvm-consumer</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>au.com.dius</groupId>
|
||||
<groupId>au.com.dius.provider</groupId>
|
||||
<artifactId>pact-jvm-provider-junit</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
||||
@@ -22,8 +22,10 @@ import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFilter;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
@@ -36,6 +38,11 @@ import com.fasterxml.jackson.databind.ser.PropertyWriter;
|
||||
import com.fasterxml.jackson.databind.ser.impl.SimpleBeanPropertyFilter;
|
||||
import com.fasterxml.jackson.databind.ser.impl.SimpleFilterProvider;
|
||||
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.config.YamlPropertiesFactoryBean;
|
||||
import org.springframework.boot.context.properties.bind.Binder;
|
||||
import org.springframework.boot.context.properties.source.MapConfigurationPropertySource;
|
||||
import org.springframework.core.io.ByteArrayResource;
|
||||
import org.springframework.util.ReflectionUtils;
|
||||
|
||||
/**
|
||||
@@ -80,11 +87,29 @@ public final class MetadataUtil {
|
||||
if (patch == null) {
|
||||
return objectToMerge;
|
||||
}
|
||||
byte[] bytes = new byte[0];
|
||||
try {
|
||||
byte[] bytes = MAPPER.writer().writeValueAsBytes(patch);
|
||||
bytes = MAPPER.writer().writeValueAsBytes(patch);
|
||||
return MAPPER.readerForUpdating(objectToMerge).readValue(bytes);
|
||||
}
|
||||
catch (Exception e) {
|
||||
if (e.getClass().toString().contains("InaccessibleObjectException") && patch instanceof Map) {
|
||||
try {
|
||||
YamlPropertiesFactoryBean yamlProcessor = new YamlPropertiesFactoryBean();
|
||||
yamlProcessor.setResources(new ByteArrayResource(bytes));
|
||||
Properties properties = yamlProcessor.getObject();
|
||||
T props = (T) new Binder(
|
||||
new MapConfigurationPropertySource(properties.entrySet().stream()
|
||||
.collect(Collectors.toMap(entry -> entry.getKey().toString(),
|
||||
entry -> entry.getValue().toString())))).bind("", objectToMerge.getClass())
|
||||
.get();
|
||||
BeanUtils.copyProperties(props, objectToMerge);
|
||||
return objectToMerge;
|
||||
}
|
||||
catch (Exception ex) {
|
||||
throw new IllegalStateException(ex);
|
||||
}
|
||||
}
|
||||
throw new IllegalStateException(e);
|
||||
}
|
||||
}
|
||||
@@ -207,23 +232,27 @@ class MyFilter extends SimpleBeanPropertyFilter implements Serializable {
|
||||
writer.serializeAsField(pojo, jgen, provider);
|
||||
return;
|
||||
}
|
||||
Object defaultInstance = CACHE.computeIfAbsent(pojo.getClass(), this::defaultInstance);
|
||||
Object defaultInstance = defaultInstance(pojo);
|
||||
if (defaultInstance instanceof CantInstantiateThisClass
|
||||
|| !valueSameAsDefault(pojo, defaultInstance, writer.getName())) {
|
||||
writer.serializeAsField(pojo, jgen, provider);
|
||||
}
|
||||
}
|
||||
|
||||
Object defaultInstance(Object pojo) {
|
||||
return CACHE.computeIfAbsent(pojo.getClass(), this::defaultInstance);
|
||||
}
|
||||
|
||||
private Object defaultInstance(Class aClass) {
|
||||
try {
|
||||
return aClass.newInstance();
|
||||
return aClass.getDeclaredConstructor().newInstance();
|
||||
}
|
||||
catch (Exception e) {
|
||||
return new CantInstantiateThisClass();
|
||||
}
|
||||
}
|
||||
|
||||
private boolean valueSameAsDefault(Object pojo, Object defaultInstance, String fieldName) {
|
||||
boolean valueSameAsDefault(Object pojo, Object defaultInstance, String fieldName) {
|
||||
Field field = ReflectionUtils.findField(pojo.getClass(), fieldName);
|
||||
if (field == null) {
|
||||
return false;
|
||||
|
||||
@@ -225,7 +225,7 @@ class SpringTestMethodBodyBuildersSpec extends Specification implements WireMock
|
||||
}
|
||||
|
||||
private String singleTestGenerator(Contract contractDsl) {
|
||||
return singleTestGenerator([contractDsl])
|
||||
return singleTestGenerator(Collections.singletonList(contractDsl))
|
||||
}
|
||||
|
||||
private String singleTestGenerator(Collection<Contract> contractDsls) {
|
||||
@@ -245,7 +245,7 @@ class SpringTestMethodBodyBuildersSpec extends Specification implements WireMock
|
||||
}
|
||||
})
|
||||
}
|
||||
}.buildClass(configProperties, [contractMetadata(contractDsls)], "foo", generatedClassData)
|
||||
}.buildClass(configProperties, Collections.singletonList(contractMetadata(contractDsls)), "foo", generatedClassData)
|
||||
}
|
||||
|
||||
ContractMetadata contractMetadata(Collection<Contract> contractDsls) {
|
||||
|
||||
@@ -136,22 +136,22 @@ class YamlContractConverterSpec extends Specification {
|
||||
contract.request.url.clientValue == "/foo"
|
||||
contract.request.cookies.entries.find { it.key == "foo" && it.serverValue == "bar" }
|
||||
contract.request.cookies.entries.find {
|
||||
it.key == "fooRegex" && ((Pattern) it.clientValue).pattern == "reg" && it.serverValue == "reg"
|
||||
it.key == "fooRegex" && ((Pattern) it.clientValue).pattern() == "reg" && it.serverValue == "reg"
|
||||
}
|
||||
contract.request.cookies.entries.find {
|
||||
it.key == "fooPredefinedRegex" && ((Pattern) it.clientValue).pattern == "(true|false)" && it.serverValue == true
|
||||
it.key == "fooPredefinedRegex" && ((Pattern) it.clientValue).pattern() == "(true|false)" && it.serverValue == true
|
||||
}
|
||||
and:
|
||||
contract.response.status.clientValue == 200
|
||||
contract.response.cookies.entries.find { it.key == "foo" && it.clientValue == "baz" }
|
||||
contract.response.cookies.entries.find {
|
||||
it.key == "fooRegex" && ((Pattern) it.serverValue).pattern == "[0-9]+" && it.clientValue == 123
|
||||
it.key == "fooRegex" && ((Pattern) it.serverValue).pattern() == "[0-9]+" && it.clientValue == 123
|
||||
}
|
||||
contract.response.cookies.entries.find {
|
||||
it.key == "source" && ((Pattern) it.serverValue).pattern == "ip_address" && it.clientValue == "ip_address"
|
||||
it.key == "source" && ((Pattern) it.serverValue).pattern() == "ip_address" && it.clientValue == "ip_address"
|
||||
}
|
||||
contract.response.cookies.entries.find {
|
||||
it.key == "fooPredefinedRegex" && ((Pattern) it.serverValue).pattern == "(true|false)" && it.clientValue == true
|
||||
it.key == "fooPredefinedRegex" && ((Pattern) it.serverValue).pattern() == "(true|false)" && it.clientValue == true
|
||||
}
|
||||
MapConverter.getStubSideValues(contract.response.body) == ["status": "OK"]
|
||||
}
|
||||
@@ -178,7 +178,7 @@ class YamlContractConverterSpec extends Specification {
|
||||
contract.request.method.clientValue == "PUT"
|
||||
contract.request.headers.entries.find {
|
||||
it.name == "foo" &&
|
||||
((Pattern) it.clientValue).pattern == "bar" && it.serverValue == "bar"
|
||||
((Pattern) it.clientValue).pattern() == "bar" && it.serverValue == "bar"
|
||||
}
|
||||
contract.request.headers.entries.find {
|
||||
it.name == "fooReq" &&
|
||||
@@ -198,7 +198,7 @@ class YamlContractConverterSpec extends Specification {
|
||||
}
|
||||
contract.response.headers.entries.find {
|
||||
it.name == "foo2" &&
|
||||
((Pattern) it.serverValue).pattern == "bar" && it.clientValue == "bar"
|
||||
((Pattern) it.serverValue).pattern() == "bar" && it.clientValue == "bar"
|
||||
}
|
||||
contract.response.headers.entries.find {
|
||||
it.name == "foo3" &&
|
||||
@@ -269,7 +269,7 @@ class YamlContractConverterSpec extends Specification {
|
||||
Contract contract = contracts.first()
|
||||
contract.request.headers.entries.find {
|
||||
it.name == "Content-Type" &&
|
||||
((Pattern) it.clientValue).pattern == "application/json.*" && it.serverValue == "application/json"
|
||||
((Pattern) it.clientValue).pattern() == "application/json.*" && it.serverValue == "application/json"
|
||||
}
|
||||
((Pattern) contract.request.urlPath.clientValue).pattern() == "/get/[0-9]"
|
||||
contract.request.urlPath.serverValue == "/get/1"
|
||||
@@ -404,7 +404,7 @@ class YamlContractConverterSpec extends Specification {
|
||||
Contract contract = contracts.first()
|
||||
contract.input.messageHeaders.entries.find {
|
||||
it.name == "contentType" &&
|
||||
((Pattern) it.clientValue).pattern == "application/json.*" && it.serverValue == "application/json"
|
||||
((Pattern) it.clientValue).pattern() == "application/json.*" && it.serverValue == "application/json"
|
||||
}
|
||||
contract.input.bodyMatchers.matchers[0].path() == '$.duck'
|
||||
contract.input.bodyMatchers.matchers[0].matchingType() == REGEX
|
||||
@@ -539,7 +539,7 @@ class YamlContractConverterSpec extends Specification {
|
||||
contract.input.triggeredBy.toString() == "foo()"
|
||||
contract.input.messageHeaders.entries.find {
|
||||
it.name == "foo" &&
|
||||
((Pattern) it.clientValue).pattern == "bar" && it.serverValue == "bar"
|
||||
((Pattern) it.clientValue).pattern() == "bar" && it.serverValue == "bar"
|
||||
}
|
||||
contract.input.messageBody.clientValue == [foo: "bar"]
|
||||
contract.input.bodyMatchers.matchers[0].path() == '$.bar'
|
||||
@@ -549,7 +549,7 @@ class YamlContractConverterSpec extends Specification {
|
||||
contract.outputMessage.assertThat.toString() == "baz()"
|
||||
contract.outputMessage.headers.entries.find {
|
||||
it.name == "foo2" &&
|
||||
((Pattern) it.serverValue).pattern == "bar" && it.clientValue == "bar"
|
||||
((Pattern) it.serverValue).pattern() == "bar" && it.clientValue == "bar"
|
||||
}
|
||||
contract.outputMessage.headers.entries.find {
|
||||
it.name == "foo3" &&
|
||||
|
||||
@@ -25,7 +25,7 @@ import static org.assertj.core.api.BDDAssertions.then;
|
||||
class AmqpMetadataTests {
|
||||
|
||||
YAMLMapper mapper = new YAMLMapper();
|
||||
|
||||
|
||||
@Test
|
||||
void should_parse_the_metadata_entry() throws JsonProcessingException {
|
||||
// @formatter:off
|
||||
|
||||
Reference in New Issue
Block a user