Minor changes after review

This commit is contained in:
Alex Theedom 2016-08-16 08:10:45 +01:00
parent fa3581339c
commit e4f2bed4fd
3 changed files with 18 additions and 6 deletions

View File

@ -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();
}
}

View File

@ -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();
}
}

View File

@ -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"));
}
}