Minor changes after review
This commit is contained in:
parent
fa3581339c
commit
e4f2bed4fd
|
@ -10,8 +10,13 @@ public class HystrixController {
|
|||
@Autowired
|
||||
private SpringExistingClient client;
|
||||
|
||||
@RequestMapping("/")
|
||||
public String index() throws InterruptedException{
|
||||
return client.invokeRemoteService();
|
||||
@RequestMapping("/withHystrix")
|
||||
public String withHystrix() throws InterruptedException{
|
||||
return client.invokeRemoteServiceWithHystrix();
|
||||
}
|
||||
|
||||
@RequestMapping("/withOutHystrix")
|
||||
public String withOutHystrix() throws InterruptedException{
|
||||
return client.invokeRemoteServiceWithOutHystrix();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,8 +10,11 @@ public class SpringExistingClient {
|
|||
private int remoteServiceDelay;
|
||||
|
||||
@HystrixCircuitBreaker
|
||||
public String invokeRemoteService() throws InterruptedException{
|
||||
public String invokeRemoteServiceWithHystrix() throws InterruptedException{
|
||||
return new RemoteServiceTestSimulator(remoteServiceDelay).execute();
|
||||
}
|
||||
|
||||
public String invokeRemoteServiceWithOutHystrix() throws InterruptedException{
|
||||
return new RemoteServiceTestSimulator(remoteServiceDelay).execute();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,10 +23,14 @@ public class SpringAndHystrixIntegrationTest {
|
|||
public final ExpectedException exception = ExpectedException.none();
|
||||
|
||||
@Test
|
||||
public void givenTimeOutOf15000_whenExistingClientCalled_thenExpectHystrixRuntimeException() throws InterruptedException {
|
||||
public void givenTimeOutOf15000_whenClientCalledWithHystrix_thenExpectHystrixRuntimeException() throws InterruptedException {
|
||||
exception.expect(HystrixRuntimeException.class);
|
||||
assertThat(hystrixController.index(), equalTo("Success"));
|
||||
hystrixController.withHystrix();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenTimeOutOf15000_whenClientCalledWithOutHystrix_thenExpectSuccess() throws InterruptedException {
|
||||
assertThat(hystrixController.withOutHystrix(), equalTo("Success"));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue