Merge pull request #12 from muellners/develop
Update spring to version 2.x.x
diff --git a/.gitignore b/.gitignore
index 536de5a..c0af34f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,7 +2,10 @@
.idea
build/
target/
-
+bin/
+.project
+.settings/
+.classpath
# Ignore Gradle GUI config
gradle-app.setting
diff --git a/build.gradle b/build.gradle
index 96abe59..24c0680 100644
--- a/build.gradle
+++ b/build.gradle
@@ -25,9 +25,9 @@
}
plugins {
- id 'com.github.hierynomus.license' version '0.13.1'
- id("org.nosphere.apache.rat") version "0.3.1"
- id "com.jfrog.artifactory" version "4.9.5"
+ id 'com.github.hierynomus.license' version '0.15.0'
+ id("org.nosphere.apache.rat") version "0.6.0"
+ id "com.jfrog.artifactory" version "4.15.1"
id 'maven-publish'
id 'idea'
id 'java'
@@ -37,10 +37,10 @@
version 'spring_boot_2-SNAPSHOT'
ext.versions = [
- springcontext : '4.3.3.RELEASE',
- springboot : '1.4.1.RELEASE',
- feigngson : '8.16.2',
- findbugs : '3.0.1',
+ springcontext : '5.2.5.RELEASE',
+ springboot : '2.2.6.RELEASE',
+ feigngson : '8.18.0',
+ findbugs : '3.0.2',
frameworklangversion : 'spring_boot_2-SNAPSHOT'
]
@@ -59,14 +59,14 @@
dependencyManagement {
imports {
- mavenBom 'org.springframework.cloud:spring-cloud-netflix:1.2.0.RELEASE'
+ mavenBom 'org.springframework.cloud:spring-cloud-dependencies:Hoxton.SR3'
}
}
dependencies {
compile(
- [group: 'org.springframework.cloud', name: 'spring-cloud-starter-feign'],
- [group: 'org.springframework.cloud', name: 'spring-cloud-starter-eureka'],
+ [group: 'org.springframework.cloud', name: 'spring-cloud-starter-openfeign'],
+ [group: 'org.springframework.cloud', name: 'spring-cloud-starter-netflix-eureka-client'],
[group: 'org.springframework', name: 'spring-context', version: versions.springcontext],
[group: 'com.google.code.findbugs', name: 'jsr305', version: versions.findbugs],
[group: 'com.netflix.feign', name: 'feign-gson', version: versions.feigngson],
@@ -128,6 +128,10 @@
"build/**",
"gradlew",
"gradlew.bat",
- "README.md"
+ "README.md",
+ ".project",
+ "bin/**",
+ ".classpath",
+ ".settings/**"
]
}
diff --git a/src/main/java/org/apache/fineract/cn/api/util/ApiFactory.java b/src/main/java/org/apache/fineract/cn/api/util/ApiFactory.java
index 1a574bd..7ac1e2b 100644
--- a/src/main/java/org/apache/fineract/cn/api/util/ApiFactory.java
+++ b/src/main/java/org/apache/fineract/cn/api/util/ApiFactory.java
@@ -25,7 +25,7 @@
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
-import org.springframework.cloud.netflix.feign.support.SpringMvcContract;
+import org.springframework.cloud.openfeign.support.SpringMvcContract;
import org.springframework.stereotype.Component;
/**
diff --git a/src/main/java/org/apache/fineract/cn/api/util/CustomFeignClientsConfiguration.java b/src/main/java/org/apache/fineract/cn/api/util/CustomFeignClientsConfiguration.java
index d8e4b60..76888a1 100644
--- a/src/main/java/org/apache/fineract/cn/api/util/CustomFeignClientsConfiguration.java
+++ b/src/main/java/org/apache/fineract/cn/api/util/CustomFeignClientsConfiguration.java
@@ -29,7 +29,7 @@
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
-import org.springframework.cloud.netflix.feign.FeignClientsConfiguration;
+import org.springframework.cloud.openfeign.FeignClientsConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Scope;
diff --git a/src/test/java/org/apache/fineract/cn/api/util/AnnotatedErrorDecoderTest.java b/src/test/java/org/apache/fineract/cn/api/util/AnnotatedErrorDecoderTest.java
index b272ab7..aed2d6d 100644
--- a/src/test/java/org/apache/fineract/cn/api/util/AnnotatedErrorDecoderTest.java
+++ b/src/test/java/org/apache/fineract/cn/api/util/AnnotatedErrorDecoderTest.java
@@ -21,6 +21,7 @@
import feign.Feign;
import feign.FeignException;
import feign.Response;
+import feign.Request;
import org.apache.fineract.cn.api.annotation.ThrowsException;
import org.junit.Assert;
import org.junit.Test;
@@ -50,51 +51,62 @@
public static Collection testCases() throws NoSuchMethodException {
final Collection<TestCase> ret = new ArrayList<>();
+ final String TEST_URL = "http://igle.pop.org/app/v1/";
+ final Request request = Request.create("GET", TEST_URL, Collections.emptyMap(), new byte[]{}, Charset.defaultCharset());
+
final Response emptyInternalServerErrorResponse = Response.builder()
.status(HttpStatus.INTERNAL_SERVER_ERROR.value())
.body("blah", Charset.defaultCharset())
.headers(Collections.emptyMap())
+ .request(request)
.build();
final Response emptyBadRequestResponse = Response.builder()
.status(HttpStatus.BAD_REQUEST.value())
.body("blah", Charset.defaultCharset())
.headers(Collections.emptyMap())
+ .request(request)
.build();
final Response emptyBadRequestResponseWithNoBody = Response.builder()
.status(HttpStatus.BAD_REQUEST.value())
.headers(Collections.emptyMap())
+ .request(request)
.build();
final Response emptyNotFoundRequestResponse = Response.builder()
.status(HttpStatus.NOT_FOUND.value())
.body("blah", Charset.defaultCharset())
.headers(Collections.emptyMap())
+ .request(request)
.build();
final Response emptyConflictResponse = Response.builder()
.status(HttpStatus.CONFLICT.value())
.body("blah", Charset.defaultCharset())
.headers(Collections.emptyMap())
+ .request(request)
.build();
final Response emptyIAmATeapotResponse = Response.builder()
.status(HttpStatus.I_AM_A_TEAPOT.value())
.body("blah", Charset.defaultCharset())
.headers(Collections.emptyMap())
+ .request(request)
.build();
final Response emptyUnauthorizedResponse = Response.builder()
.status(HttpStatus.UNAUTHORIZED.value())
.body("blah", Charset.defaultCharset())
.headers(Collections.emptyMap())
+ .request(request)
.build();
final Response emptyForbiddenResponse = Response.builder()
.status(HttpStatus.FORBIDDEN.value())
.body("blah", Charset.defaultCharset())
.headers(Collections.emptyMap())
+ .request(request)
.build();
final String madeUpMethodKey = "x";
@@ -106,10 +118,10 @@
Feign.configKey(OneMethodInterface.class, OneMethodInterface.class.getMethod("method"));
final String onceAnnotatedMethodKey =
- Feign.configKey(OneMethodOneAnnotationInterface.class, OneMethodOneAnnotationInterface.class.getMethod("method"));
+ Feign.configKey(OneMethodOneAnnotationInterface.class, OneMethodOneAnnotationInterface.class.getMethod("method"));
final String onceAnnotatedWithStringExceptionMethodKey =
- Feign.configKey(OneMethodOneAnnotationStringParameteredExceptionInterface.class, OneMethodOneAnnotationStringParameteredExceptionInterface.class.getMethod("method"));
+ Feign.configKey(OneMethodOneAnnotationStringParameteredExceptionInterface.class, OneMethodOneAnnotationStringParameteredExceptionInterface.class.getMethod("method"));
ret.add(new TestCase("Methodless interface")
.clazz(MethodlessInterface.class)
@@ -154,10 +166,10 @@
.expectedResult(new ParameterlessException()));
ret.add(new TestCase("Interface with one method that has one annotation containing an exception which accepts a string parameter.")
- .clazz(OneMethodOneAnnotationStringParameteredExceptionInterface.class)
- .methodKey(onceAnnotatedWithStringExceptionMethodKey)
- .response(emptyBadRequestResponse)
- .expectedResult(new StringParameteredException("blah")));
+ .clazz(OneMethodOneAnnotationStringParameteredExceptionInterface.class)
+ .methodKey(onceAnnotatedWithStringExceptionMethodKey)
+ .response(emptyBadRequestResponse)
+ .expectedResult(new StringParameteredException("blah")));
ret.add(new TestCase("Bad request on an interface in which bad request isn't mapped.")
.clazz(AnnotationlessInterface.class)
@@ -166,17 +178,17 @@
.expectedResult(new IllegalArgumentException("blah")));
ret.add(new TestCase("Bad request with no body on an interface in which bad request isn't mapped.")
- .clazz(AnnotationlessInterface.class)
- .methodKey(annotationlessMethodKey)
- .response(emptyBadRequestResponseWithNoBody)
- .expectedResult(new IllegalArgumentException((String)null)));
+ .clazz(AnnotationlessInterface.class)
+ .methodKey(annotationlessMethodKey)
+ .response(emptyBadRequestResponseWithNoBody)
+ .expectedResult(new IllegalArgumentException((String)null)));
ret.add(new TestCase("Not found request on an interface in which not found request isn't mapped.")
- .clazz(AnnotationlessInterface.class)
- .methodKey(annotationlessMethodKey)
- .response(emptyNotFoundRequestResponse)
- .expectedResult(new NotFoundException("blah")));
+ .clazz(AnnotationlessInterface.class)
+ .methodKey(annotationlessMethodKey)
+ .response(emptyNotFoundRequestResponse)
+ .expectedResult(new NotFoundException("blah")));
ret.add(new TestCase("Request with invalid token.")
.clazz(OneMethodOneAnnotationInterface.class)
diff --git a/src/test/java/org/apache/fineract/cn/api/util/CookieInterceptingClientTest.java b/src/test/java/org/apache/fineract/cn/api/util/CookieInterceptingClientTest.java
index 0b64af1..1c4102c 100644
--- a/src/test/java/org/apache/fineract/cn/api/util/CookieInterceptingClientTest.java
+++ b/src/test/java/org/apache/fineract/cn/api/util/CookieInterceptingClientTest.java
@@ -38,12 +38,12 @@
*/
public class CookieInterceptingClientTest {
private final static String TEST_URL = "http://igle.pop.org/app/v1/";
+ private final Request request = Request.create("GET", TEST_URL, Collections.emptyMap(), new byte[]{}, Charset.defaultCharset());
@Test
public void cookiesPlacedInJarThenAttachedToRequest() throws IOException, URISyntaxException {
final CookieInterceptingClient testSubject = new CookieInterceptingClient(TEST_URL);
- //response
final CookieInterceptingClient spiedTestSubject = Mockito.spy(testSubject);
final Map<String, Collection<String>> cookieHeaders = new HashMap<>();
@@ -52,11 +52,12 @@
.status(HttpStatus.INTERNAL_SERVER_ERROR.value())
.reason("blah")
.headers(cookieHeaders)
+ .request(this.request)
.build();
Mockito.doReturn(dummyResponse).when(spiedTestSubject).superExecute(Mockito.anyObject(), Mockito.anyObject());
- spiedTestSubject.execute(Request.create("", TEST_URL +"request", Collections.emptyMap(), new byte[]{}, Charset.defaultCharset()), new Request.Options());
+ spiedTestSubject.execute(this.request, new Request.Options());
final Map<String, List<String>> ret = testSubject.cookieManager.get(new URI(TEST_URL), Collections.emptyMap());
Assert.assertEquals(ret.get("Cookie"), Collections.singletonList("x=y"));