Search in sources :

Example 21 with HystrixRequestEvents

use of com.netflix.hystrix.metric.HystrixRequestEvents in project Hystrix by Netflix.

the class SerialHystrixRequestEventsTest method testCollapsedBatchOfOne.

@Test
public void testCollapsedBatchOfOne() throws IOException {
    List<HystrixInvokableInfo<?>> executions = new ArrayList<HystrixInvokableInfo<?>>();
    executions.add(new SimpleExecution(fooKey, 53, collapserKey, 1, HystrixEventType.SUCCESS));
    HystrixRequestEvents request = new HystrixRequestEvents(executions);
    String actual = SerialHystrixRequestEvents.toJsonString(request);
    assertEquals("[{\"name\":\"Foo\",\"events\":[\"SUCCESS\"],\"latencies\":[53],\"collapsed\":{\"name\":\"FooCollapser\",\"count\":1}}]", actual);
}
Also used : ArrayList(java.util.ArrayList) HystrixRequestEvents(com.netflix.hystrix.metric.HystrixRequestEvents) HystrixInvokableInfo(com.netflix.hystrix.HystrixInvokableInfo) Test(org.junit.Test)

Example 22 with HystrixRequestEvents

use of com.netflix.hystrix.metric.HystrixRequestEvents in project Hystrix by Netflix.

the class SerialHystrixRequestEventsTest method testCollapsedBatchOfSix.

@Test
public void testCollapsedBatchOfSix() throws IOException {
    List<HystrixInvokableInfo<?>> executions = new ArrayList<HystrixInvokableInfo<?>>();
    executions.add(new SimpleExecution(fooKey, 53, collapserKey, 6, HystrixEventType.SUCCESS));
    HystrixRequestEvents request = new HystrixRequestEvents(executions);
    String actual = SerialHystrixRequestEvents.toJsonString(request);
    assertEquals("[{\"name\":\"Foo\",\"events\":[\"SUCCESS\"],\"latencies\":[53],\"collapsed\":{\"name\":\"FooCollapser\",\"count\":6}}]", actual);
}
Also used : ArrayList(java.util.ArrayList) HystrixRequestEvents(com.netflix.hystrix.metric.HystrixRequestEvents) HystrixInvokableInfo(com.netflix.hystrix.HystrixInvokableInfo) Test(org.junit.Test)

Example 23 with HystrixRequestEvents

use of com.netflix.hystrix.metric.HystrixRequestEvents in project Hystrix by Netflix.

the class SerialHystrixRequestEventsTest method testSingleThreadPoolRejectedFallbackSuccess.

@Test
public void testSingleThreadPoolRejectedFallbackSuccess() throws IOException {
    List<HystrixInvokableInfo<?>> executions = new ArrayList<HystrixInvokableInfo<?>>();
    executions.add(new SimpleExecution(fooKey, 1, HystrixEventType.THREAD_POOL_REJECTED, HystrixEventType.FALLBACK_SUCCESS));
    HystrixRequestEvents request = new HystrixRequestEvents(executions);
    String actual = SerialHystrixRequestEvents.toJsonString(request);
    assertEquals("[{\"name\":\"Foo\",\"events\":[\"THREAD_POOL_REJECTED\",\"FALLBACK_SUCCESS\"],\"latencies\":[1]}]", actual);
}
Also used : ArrayList(java.util.ArrayList) HystrixRequestEvents(com.netflix.hystrix.metric.HystrixRequestEvents) HystrixInvokableInfo(com.netflix.hystrix.HystrixInvokableInfo) Test(org.junit.Test)

Aggregations

HystrixRequestEvents (com.netflix.hystrix.metric.HystrixRequestEvents)23 HystrixInvokableInfo (com.netflix.hystrix.HystrixInvokableInfo)22 Test (org.junit.Test)22 ArrayList (java.util.ArrayList)21 JsonGenerator (com.fasterxml.jackson.core.JsonGenerator)1 StringWriter (java.io.StringWriter)1