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
64b81ff5
Unverified
Commit
64b81ff5
authored
Jan 09, 2017
by
Spencer Gibb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update hystrix to 1.5.9
fixes gh-1600
parent
f3deb045
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
16 deletions
+30
-16
HystrixStreamEndpointTests.java
...ork/cloud/netflix/hystrix/HystrixStreamEndpointTests.java
+29
-15
pom.xml
spring-cloud-netflix-dependencies/pom.xml
+1
-1
No files found.
spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/hystrix/HystrixStreamEndpointTests.java
View file @
64b81ff5
...
...
@@ -16,12 +16,16 @@
package
org
.
springframework
.
cloud
.
netflix
.
hystrix
;
import
com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand
;
import
java.io.InputStream
;
import
java.net.URL
;
import
java.util.ArrayList
;
import
java.util.List
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.boot.autoconfigure.EnableAutoConfiguration
;
import
org.springframework.boot.context.embedded.LocalServerPort
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.boot.test.context.SpringBootTest.WebEnvironment
;
import
org.springframework.boot.test.web.client.TestRestTemplate
;
...
...
@@ -31,27 +35,27 @@ import org.springframework.context.annotation.Configuration;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.test.annotation.DirtiesContext
;
import
org.springframework.test.context.junit4.Spring
JUnit4Class
Runner
;
import
org.springframework.test.context.junit4.SpringRunner
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.io.InputStream
;
import
java.net.URL
;
import
com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
import
static
org
.
junit
.
Assert
.
fail
;
/**
* @author Dave Syer
* @author Spencer Gibb
*/
@RunWith
(
SpringJUnit4ClassRunner
.
class
)
@SpringBootTest
(
classes
=
HystrixStreamEndpointTests
.
Application
.
class
,
webEnvironment
=
WebEnvironment
.
RANDOM_PORT
,
value
=
{
@RunWith
(
SpringRunner
.
class
)
@SpringBootTest
(
classes
=
HystrixStreamEndpointTests
.
Application
.
class
,
webEnvironment
=
WebEnvironment
.
RANDOM_PORT
,
value
=
{
"spring.application.name=hystrixstreamtest"
})
@DirtiesContext
public
class
HystrixStreamEndpointTests
{
@
Value
(
"${local.server.port}"
)
@
LocalServerPort
private
int
port
=
0
;
@Test
...
...
@@ -69,12 +73,22 @@ public class HystrixStreamEndpointTests {
assertEquals
(
"bad response code"
,
HttpStatus
.
OK
,
response
.
getStatusCode
());
URL
hystrixUrl
=
new
URL
(
url
+
"/admin/hystrix.stream"
);
InputStream
in
=
hystrixUrl
.
openStream
();
byte
[]
buffer
=
new
byte
[
1024
];
in
.
read
(
buffer
);
String
contents
=
new
String
(
buffer
);
assertTrue
(
contents
.
contains
(
"Hystrix"
));
in
.
close
();
List
<
String
>
data
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
5
;
i
++)
{
try
(
InputStream
in
=
hystrixUrl
.
openStream
())
{
byte
[]
buffer
=
new
byte
[
1024
];
in
.
read
(
buffer
);
data
.
add
(
new
String
(
buffer
));
}
}
for
(
String
item
:
data
)
{
if
(
item
.
contains
(
"data:"
))
{
return
;
// test passed
}
}
fail
(
"/hystrix.stream didn't contain 'data:' was "
+
data
);
}
@Configuration
...
...
spring-cloud-netflix-dependencies/pom.xml
View file @
64b81ff5
...
...
@@ -17,7 +17,7 @@
<archaius.version>
0.7.4
</archaius.version>
<eureka.version>
1.6.1
</eureka.version>
<feign.version>
9.3.1
</feign.version>
<hystrix.version>
1.5.
7
</hystrix.version>
<hystrix.version>
1.5.
9
</hystrix.version>
<ribbon.version>
2.2.0
</ribbon.version>
<servo.version>
0.10.1
</servo.version>
<zuul.version>
1.3.0
</zuul.version>
...
...
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