use of com.netflix.hystrix.metric.HystrixRequestEvents in project Hystrix by Netflix.
the class SerialHystrixRequestEventsTest method testSingleSemaphoreRejectedFallbackSuccess.
@Test
public void testSingleSemaphoreRejectedFallbackSuccess() throws IOException {
List<HystrixInvokableInfo<?>> executions = new ArrayList<HystrixInvokableInfo<?>>();
executions.add(new SimpleExecution(fooKey, 1, HystrixEventType.SEMAPHORE_REJECTED, HystrixEventType.FALLBACK_SUCCESS));
HystrixRequestEvents request = new HystrixRequestEvents(executions);
String actual = SerialHystrixRequestEvents.toJsonString(request);
assertEquals("[{\"name\":\"Foo\",\"events\":[\"SEMAPHORE_REJECTED\",\"FALLBACK_SUCCESS\"],\"latencies\":[1]}]", actual);
}
use of com.netflix.hystrix.metric.HystrixRequestEvents in project Hystrix by Netflix.
the class SerialHystrixRequestEventsTest method testEmpty.
@Test
public void testEmpty() throws IOException {
HystrixRequestEvents request = new HystrixRequestEvents(new ArrayList<HystrixInvokableInfo<?>>());
String actual = SerialHystrixRequestEvents.toJsonString(request);
assertEquals("[]", actual);
}
use of com.netflix.hystrix.metric.HystrixRequestEvents in project Hystrix by Netflix.
the class SerialHystrixRequestEventsTest method testSingleFailureFallbackMissing.
@Test
public void testSingleFailureFallbackMissing() throws IOException {
List<HystrixInvokableInfo<?>> executions = new ArrayList<HystrixInvokableInfo<?>>();
executions.add(new SimpleExecution(fooKey, 101, HystrixEventType.FAILURE, HystrixEventType.FALLBACK_MISSING));
HystrixRequestEvents request = new HystrixRequestEvents(executions);
String actual = SerialHystrixRequestEvents.toJsonString(request);
assertEquals("[{\"name\":\"Foo\",\"events\":[\"FAILURE\",\"FALLBACK_MISSING\"],\"latencies\":[101]}]", actual);
}
use of com.netflix.hystrix.metric.HystrixRequestEvents in project Hystrix by Netflix.
the class SerialHystrixRequestEventsTest method testSingleTimeoutFallbackSuccess.
@Test
public void testSingleTimeoutFallbackSuccess() throws IOException {
List<HystrixInvokableInfo<?>> executions = new ArrayList<HystrixInvokableInfo<?>>();
executions.add(new SimpleExecution(fooKey, 105, HystrixEventType.TIMEOUT, HystrixEventType.FALLBACK_SUCCESS));
HystrixRequestEvents request = new HystrixRequestEvents(executions);
String actual = SerialHystrixRequestEvents.toJsonString(request);
assertEquals("[{\"name\":\"Foo\",\"events\":[\"TIMEOUT\",\"FALLBACK_SUCCESS\"],\"latencies\":[105]}]", actual);
}
use of com.netflix.hystrix.metric.HystrixRequestEvents in project Hystrix by Netflix.
the class SerialHystrixRequestEventsTest method testMultipleCacheKeys.
@Test
public void testMultipleCacheKeys() throws IOException {
List<HystrixInvokableInfo<?>> executions = new ArrayList<HystrixInvokableInfo<?>>();
HystrixInvokableInfo<Integer> foo1 = new SimpleExecution(fooKey, 23, "cacheKeyA", HystrixEventType.SUCCESS);
HystrixInvokableInfo<Integer> cachedFoo1 = new SimpleExecution(fooKey, "cacheKeyA");
HystrixInvokableInfo<Integer> foo2 = new SimpleExecution(fooKey, 67, "cacheKeyB", HystrixEventType.SUCCESS);
HystrixInvokableInfo<Integer> cachedFoo2 = new SimpleExecution(fooKey, "cacheKeyB");
executions.add(foo1);
executions.add(cachedFoo1);
executions.add(foo2);
executions.add(cachedFoo2);
HystrixRequestEvents request = new HystrixRequestEvents(executions);
String actual = SerialHystrixRequestEvents.toJsonString(request);
assertTrue(actual.equals("[{\"name\":\"Foo\",\"events\":[\"SUCCESS\"],\"latencies\":[67],\"cached\":1},{\"name\":\"Foo\",\"events\":[\"SUCCESS\"],\"latencies\":[23],\"cached\":1}]") || actual.equals("[{\"name\":\"Foo\",\"events\":[\"SUCCESS\"],\"latencies\":[23],\"cached\":1},{\"name\":\"Foo\",\"events\":[\"SUCCESS\"],\"latencies\":[67],\"cached\":1}]"));
}
Aggregations