Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
spring-cloud-netflix
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
openSource
spring-cloud-netflix
Commits
65ec7730
Commit
65ec7730
authored
Jan 27, 2016
by
Dave Syer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix FeignHttpClientTests
parent
2f905b81
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
23 deletions
+27
-23
FeignRibbonClientAutoConfiguration.java
...flix/feign/ribbon/FeignRibbonClientAutoConfiguration.java
+4
-1
AdhocTestSuite.java
...ava/org/springframework/cloud/netflix/AdhocTestSuite.java
+2
-4
FeignHttpClientTests.java
...ework/cloud/netflix/feign/valid/FeignHttpClientTests.java
+21
-18
No files found.
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/feign/ribbon/FeignRibbonClientAutoConfiguration.java
View file @
65ec7730
...
...
@@ -56,12 +56,14 @@ public class FeignRibbonClientAutoConfiguration {
@Bean
@ConditionalOnMissingBean
public
Client
feignClient
(
CachingSpringLoadBalancerFactory
cachingFactory
)
{
return
new
LoadBalancerFeignClient
(
new
Client
.
Default
(
null
,
null
),
cachingFactory
);
return
new
LoadBalancerFeignClient
(
new
Client
.
Default
(
null
,
null
),
cachingFactory
);
}
@Configuration
@ConditionalOnClass
(
ApacheHttpClient
.
class
)
@ConditionalOnProperty
(
value
=
"feign.httpclient.enabled"
,
matchIfMissing
=
true
)
@ConditionalOnMissingBean
(
Client
.
class
)
protected
static
class
HttpClientConfiguration
{
@Autowired
(
required
=
false
)
...
...
@@ -86,6 +88,7 @@ public class FeignRibbonClientAutoConfiguration {
@Configuration
@ConditionalOnClass
(
OkHttpClient
.
class
)
@ConditionalOnProperty
(
value
=
"feign.okhttp.enabled"
,
matchIfMissing
=
true
)
@ConditionalOnMissingBean
(
Client
.
class
)
protected
static
class
OkHttpConfiguration
{
@Autowired
(
required
=
false
)
...
...
spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/AdhocTestSuite.java
View file @
65ec7730
...
...
@@ -20,8 +20,7 @@ import org.junit.Ignore;
import
org.junit.runner.RunWith
;
import
org.junit.runners.Suite
;
import
org.junit.runners.Suite.SuiteClasses
;
import
org.springframework.cloud.netflix.zuul.SampleZuulProxyApplicationTests
;
import
org.springframework.cloud.netflix.zuul.SimpleZuulServerApplicationTests
;
import
org.springframework.cloud.netflix.feign.valid.FeignHttpClientTests
;
/**
* A test suite for probing weird ordering problems in the tests.
...
...
@@ -29,8 +28,7 @@ import org.springframework.cloud.netflix.zuul.SimpleZuulServerApplicationTests;
* @author Dave Syer
*/
@RunWith
(
Suite
.
class
)
@SuiteClasses
({
SimpleZuulServerApplicationTests
.
class
,
SampleZuulProxyApplicationTests
.
class
})
@SuiteClasses
({
FeignHttpClientTests
.
class
})
@Ignore
public
class
AdhocTestSuite
{
...
...
spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/feign/valid/FeignHttpClientTests.java
View file @
65ec7730
...
...
@@ -16,14 +16,6 @@
package
org
.
springframework
.
cloud
.
netflix
.
feign
.
valid
;
import
static
org
.
hamcrest
.
Matchers
.
equalTo
;
import
static
org
.
hamcrest
.
Matchers
.
instanceOf
;
import
static
org
.
hamcrest
.
Matchers
.
is
;
import
static
org
.
hamcrest
.
Matchers
.
notNullValue
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
junit
.
Assert
.
assertNotNull
;
import
static
org
.
junit
.
Assert
.
assertThat
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -51,6 +43,14 @@ import org.springframework.web.bind.annotation.RestController;
import
com.netflix.loadbalancer.Server
;
import
com.netflix.loadbalancer.ServerList
;
import
static
org
.
hamcrest
.
Matchers
.
equalTo
;
import
static
org
.
hamcrest
.
Matchers
.
instanceOf
;
import
static
org
.
hamcrest
.
Matchers
.
is
;
import
static
org
.
hamcrest
.
Matchers
.
notNullValue
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
junit
.
Assert
.
assertNotNull
;
import
static
org
.
junit
.
Assert
.
assertThat
;
import
feign.Client
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
...
...
@@ -63,7 +63,7 @@ import lombok.NoArgsConstructor;
@SpringApplicationConfiguration
(
classes
=
FeignHttpClientTests
.
Application
.
class
)
@WebAppConfiguration
@IntegrationTest
({
"server.port=0"
,
"spring.application.name=feignclienttest"
,
"feign.hystrix.enabled=false"
})
"feign.hystrix.enabled=false"
,
"feign.okhttp.enabled=false"
})
@DirtiesContext
public
class
FeignHttpClientTests
{
...
...
@@ -80,28 +80,30 @@ public class FeignHttpClientTests {
private
UserClient
userClient
;
@FeignClient
(
"localapp"
)
protected
interface
TestClient
extends
BaseTestClient
{
}
protected
interface
TestClient
extends
BaseTestClient
{
}
protected
interface
BaseTestClient
{
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
=
"/hello"
)
Hello
getHello
();
@RequestMapping
(
method
=
RequestMethod
.
PATCH
,
value
=
"/hellop"
)
ResponseEntity
<
Void
>
patchHello
();
ResponseEntity
<
Void
>
patchHello
(
Hello
hello
);
}
protected
interface
UserService
{
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
=
"/users/{id}"
)
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
=
"/users/{id}"
)
User
getUser
(
@PathVariable
(
"id"
)
long
id
);
}
@FeignClient
(
"localapp"
)
protected
interface
UserClient
extends
UserService
{
}
protected
interface
UserClient
extends
UserService
{
}
@Configuration
@EnableAutoConfiguration
@RestController
@EnableFeignClients
(
clients
=
{
TestClient
.
class
,
UserClient
.
class
})
@EnableFeignClients
(
clients
=
{
TestClient
.
class
,
UserClient
.
class
})
@RibbonClient
(
name
=
"localapp"
,
configuration
=
LocalRibbonClientConfiguration
.
class
)
protected
static
class
Application
implements
UserService
{
...
...
@@ -121,9 +123,10 @@ public class FeignHttpClientTests {
}
public
static
void
main
(
String
[]
args
)
{
new
SpringApplicationBuilder
(
Application
.
class
).
properties
(
"spring.application.name=feignclienttest"
,
"management.contextPath=/admin"
).
run
(
args
);
new
SpringApplicationBuilder
(
Application
.
class
)
.
properties
(
"spring.application.name=feignclienttest"
,
"management.contextPath=/admin"
)
.
run
(
args
);
}
}
...
...
@@ -136,7 +139,7 @@ public class FeignHttpClientTests {
@Test
public
void
testPatch
()
{
ResponseEntity
<
Void
>
response
=
this
.
testClient
.
patchHello
();
ResponseEntity
<
Void
>
response
=
this
.
testClient
.
patchHello
(
new
Hello
(
"foo"
)
);
assertThat
(
response
,
is
(
notNullValue
()));
String
header
=
response
.
getHeaders
().
getFirst
(
"X-Hello"
);
assertThat
(
header
,
equalTo
(
"hello world patch"
));
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment