Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2f5d63a061 | ||
|
|
14929cbfee |
+1
-1
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-openfeign</artifactId>
|
||||
<version>2.2.4.BUILD-SNAPSHOT</version>
|
||||
<version>2.2.4.RELEASE</version>
|
||||
</parent>
|
||||
<artifactId>spring-cloud-openfeign-docs</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
@@ -4,14 +4,14 @@
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>spring-cloud-openfeign</artifactId>
|
||||
<version>2.2.4.BUILD-SNAPSHOT</version>
|
||||
<version>2.2.4.RELEASE</version>
|
||||
<packaging>pom</packaging>
|
||||
<name>Spring Cloud OpenFeign</name>
|
||||
<description>Spring Cloud OpenFeign</description>
|
||||
<parent>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-build</artifactId>
|
||||
<version>2.3.1.BUILD-SNAPSHOT</version>
|
||||
<version>2.3.1.RELEASE</version>
|
||||
<relativePath/>
|
||||
</parent>
|
||||
<scm>
|
||||
@@ -26,8 +26,8 @@
|
||||
<properties>
|
||||
<main.basedir>${basedir}</main.basedir>
|
||||
<jackson.version>2.7.3</jackson.version>
|
||||
<spring-cloud-commons.version>2.2.4.BUILD-SNAPSHOT</spring-cloud-commons.version>
|
||||
<spring-cloud-netflix.version>2.2.4.BUILD-SNAPSHOT</spring-cloud-netflix.version>
|
||||
<spring-cloud-commons.version>2.2.4.RELEASE</spring-cloud-commons.version>
|
||||
<spring-cloud-netflix.version>2.2.4.RELEASE</spring-cloud-netflix.version>
|
||||
|
||||
<!-- Plugin versions -->
|
||||
<maven-compiler-plugin.version>3.6.1</maven-compiler-plugin.version>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-openfeign</artifactId>
|
||||
<version>2.2.4.BUILD-SNAPSHOT</version>
|
||||
<version>2.2.4.RELEASE</version>
|
||||
<relativePath>..</relativePath> <!-- lookup parent from repository -->
|
||||
</parent>
|
||||
<artifactId>spring-cloud-openfeign-core</artifactId>
|
||||
@@ -231,12 +231,6 @@
|
||||
<artifactId>spring-cloud-loadbalancer</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>pl.pragmatists</groupId>
|
||||
<artifactId>JUnitParams</artifactId>
|
||||
<version>1.1.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<profiles>
|
||||
<profile>
|
||||
|
||||
+10
-7
@@ -173,14 +173,15 @@ public class SpringMvcContract extends Contract.BaseContract
|
||||
if (clz.getInterfaces().length == 0) {
|
||||
RequestMapping classAnnotation = findMergedAnnotation(clz,
|
||||
RequestMapping.class);
|
||||
if (classAnnotation != null && classAnnotation.value().length > 0) {
|
||||
if (classAnnotation != null) {
|
||||
// Prepend path from class annotation if specified
|
||||
String pathValue = emptyToNull(classAnnotation.value()[0]);
|
||||
if (pathValue != null) {
|
||||
if (classAnnotation.value().length > 0) {
|
||||
String pathValue = emptyToNull(classAnnotation.value()[0]);
|
||||
pathValue = resolve(pathValue);
|
||||
if (!pathValue.equals("/")) {
|
||||
data.template().uri(pathValue);
|
||||
if (!pathValue.startsWith("/")) {
|
||||
pathValue = "/" + pathValue;
|
||||
}
|
||||
data.template().uri(pathValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -240,9 +241,11 @@ public class SpringMvcContract extends Contract.BaseContract
|
||||
String pathValue = emptyToNull(methodMapping.value()[0]);
|
||||
if (pathValue != null) {
|
||||
pathValue = resolve(pathValue);
|
||||
if (!pathValue.equals("/")) {
|
||||
data.template().uri(pathValue, true);
|
||||
// Append path from @RequestMapping if value is present on method
|
||||
if (!pathValue.startsWith("/") && !data.template().path().endsWith("/")) {
|
||||
pathValue = "/" + pathValue;
|
||||
}
|
||||
data.template().uri(pathValue, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
-85
@@ -31,11 +31,8 @@ import java.util.Map;
|
||||
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
||||
import feign.MethodMetadata;
|
||||
import feign.Param;
|
||||
import junitparams.JUnitParamsRunner;
|
||||
import junitparams.Parameters;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.springframework.cloud.openfeign.CollectionFormat;
|
||||
import org.springframework.cloud.openfeign.SpringQueryMap;
|
||||
@@ -75,7 +72,6 @@ import static org.junit.Assume.assumeTrue;
|
||||
* @author Artyom Romanenko
|
||||
* @author Olga Maciaszek-Sharma
|
||||
*/
|
||||
@RunWith(JUnitParamsRunner.class)
|
||||
public class SpringMvcContractTests {
|
||||
|
||||
private static final Class<?> EXECUTABLE_TYPE;
|
||||
@@ -602,53 +598,6 @@ public class SpringMvcContractTests {
|
||||
"{Accept}");
|
||||
}
|
||||
|
||||
private Class[] doubleMappingClassesProvider() {
|
||||
return new Class[] { TestTemplate_RequestMapping_Empty_Class.class,
|
||||
TestTemplate_RequestMapping_Empty_Method.class };
|
||||
}
|
||||
|
||||
@Test
|
||||
@Parameters(method = "doubleMappingClassesProvider")
|
||||
public void testDoubleRequestMapping_root(Class clazz) throws NoSuchMethodException {
|
||||
Method method = clazz.getDeclaredMethod("root");
|
||||
MethodMetadata data = contract
|
||||
.parseAndValidateMetadata(method.getDeclaringClass(), method);
|
||||
|
||||
assertThat(data.template().url()).isEqualTo("/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@Parameters(method = "doubleMappingClassesProvider")
|
||||
public void testDoubleRequestMapping_rootReverse(Class clazz)
|
||||
throws NoSuchMethodException {
|
||||
Method method = clazz.getDeclaredMethod("rootReverse");
|
||||
MethodMetadata data = contract
|
||||
.parseAndValidateMetadata(method.getDeclaringClass(), method);
|
||||
|
||||
assertThat(data.template().url()).isEqualTo("/");
|
||||
}
|
||||
|
||||
@Test
|
||||
@Parameters(method = "doubleMappingClassesProvider")
|
||||
public void testDoubleRequestMapping_sub(Class clazz) throws NoSuchMethodException {
|
||||
Method method = clazz.getDeclaredMethod("sub");
|
||||
MethodMetadata data = contract
|
||||
.parseAndValidateMetadata(method.getDeclaringClass(), method);
|
||||
|
||||
assertThat(data.template().url()).isEqualTo("/sub");
|
||||
}
|
||||
|
||||
@Test
|
||||
@Parameters(method = "doubleMappingClassesProvider")
|
||||
public void testDoubleRequestMapping_subEmpty(Class clazz)
|
||||
throws NoSuchMethodException {
|
||||
Method method = clazz.getDeclaredMethod("subEmpty");
|
||||
MethodMetadata data = contract
|
||||
.parseAndValidateMetadata(method.getDeclaringClass(), method);
|
||||
|
||||
assertThat(data.template().url()).isEqualTo("/subEmpty");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMultipleRequestPartAnnotations() throws NoSuchMethodException {
|
||||
Method method = TestTemplate_RequestPart.class.getDeclaredMethod(
|
||||
@@ -841,40 +790,6 @@ public class SpringMvcContractTests {
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping("")
|
||||
public interface TestTemplate_RequestMapping_Empty_Class {
|
||||
|
||||
@RequestMapping("/")
|
||||
String root();
|
||||
|
||||
@RequestMapping("")
|
||||
String rootReverse();
|
||||
|
||||
@RequestMapping("/sub")
|
||||
String sub();
|
||||
|
||||
@RequestMapping("subEmpty")
|
||||
String subEmpty();
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping("/")
|
||||
public interface TestTemplate_RequestMapping_Empty_Method {
|
||||
|
||||
@RequestMapping("")
|
||||
String root();
|
||||
|
||||
@RequestMapping("/")
|
||||
String rootReverse();
|
||||
|
||||
@RequestMapping("/sub")
|
||||
String sub();
|
||||
|
||||
@RequestMapping("subEmpty")
|
||||
String subEmpty();
|
||||
|
||||
}
|
||||
|
||||
@JsonAutoDetect(fieldVisibility = ANY, getterVisibility = NONE,
|
||||
setterVisibility = NONE)
|
||||
public class TestObject {
|
||||
|
||||
@@ -6,11 +6,11 @@
|
||||
<parent>
|
||||
<artifactId>spring-cloud-dependencies-parent</artifactId>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<version>2.3.1.BUILD-SNAPSHOT</version>
|
||||
<version>2.3.1.RELEASE</version>
|
||||
<relativePath/>
|
||||
</parent>
|
||||
<artifactId>spring-cloud-openfeign-dependencies</artifactId>
|
||||
<version>2.2.4.BUILD-SNAPSHOT</version>
|
||||
<version>2.2.4.RELEASE</version>
|
||||
<packaging>pom</packaging>
|
||||
<name>spring-cloud-openfeign-dependencies</name>
|
||||
<description>Spring Cloud OpenFeign Dependencies</description>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-openfeign</artifactId>
|
||||
<version>2.2.4.BUILD-SNAPSHOT</version>
|
||||
<version>2.2.4.RELEASE</version>
|
||||
<relativePath>..</relativePath>
|
||||
</parent>
|
||||
<artifactId>spring-cloud-starter-openfeign</artifactId>
|
||||
|
||||
Reference in New Issue
Block a user