Search in sources :

Example 1 with AsyncSpanStore

use of zipkin.storage.AsyncSpanStore in project zipkin by openzipkin.

the class InternalGuavaSpanStoreAdapterTest method getTraces_exception.

@Test
public void getTraces_exception() throws Exception {
    QueryRequest request = QueryRequest.builder().build();
    doAnswer(answer(c -> c.onError(new IllegalStateException("failed")))).when(asyncSpanStore).getTraces(eq(request), any(Callback.class));
    thrown.expect(ExecutionException.class);
    thrown.expectCause(isA(IllegalStateException.class));
    spanStore.getTraces(request).get();
}
Also used : TRACE(zipkin.TestObjects.TRACE) Mock(org.mockito.Mock) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) Test(org.junit.Test) LINKS(zipkin.TestObjects.LINKS) AsyncSpanStore(zipkin.storage.AsyncSpanStore) ExecutionException(java.util.concurrent.ExecutionException) Consumer(java.util.function.Consumer) Matchers.any(org.mockito.Matchers.any) Answer(org.mockito.stubbing.Answer) Is.isA(org.hamcrest.core.Is.isA) Rule(org.junit.Rule) Arrays.asList(java.util.Arrays.asList) Matchers.eq(org.mockito.Matchers.eq) Mockito.doAnswer(org.mockito.Mockito.doAnswer) QueryRequest(zipkin.storage.QueryRequest) MockitoJUnit(org.mockito.junit.MockitoJUnit) MockitoRule(org.mockito.junit.MockitoRule) ExpectedException(org.junit.rules.ExpectedException) Callback(zipkin.storage.Callback) Before(org.junit.Before) Callback(zipkin.storage.Callback) QueryRequest(zipkin.storage.QueryRequest) Test(org.junit.Test)

Example 2 with AsyncSpanStore

use of zipkin.storage.AsyncSpanStore in project zipkin by openzipkin.

the class InternalGuavaSpanStoreAdapterTest method getTraces_success.

@Test
public void getTraces_success() throws Exception {
    QueryRequest request = QueryRequest.builder().build();
    doAnswer(answer(c -> c.onSuccess(asList(TRACE)))).when(asyncSpanStore).getTraces(eq(request), any(Callback.class));
    assertThat(spanStore.getTraces(request).get()).containsExactly(TRACE);
}
Also used : TRACE(zipkin.TestObjects.TRACE) Mock(org.mockito.Mock) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) Test(org.junit.Test) LINKS(zipkin.TestObjects.LINKS) AsyncSpanStore(zipkin.storage.AsyncSpanStore) ExecutionException(java.util.concurrent.ExecutionException) Consumer(java.util.function.Consumer) Matchers.any(org.mockito.Matchers.any) Answer(org.mockito.stubbing.Answer) Is.isA(org.hamcrest.core.Is.isA) Rule(org.junit.Rule) Arrays.asList(java.util.Arrays.asList) Matchers.eq(org.mockito.Matchers.eq) Mockito.doAnswer(org.mockito.Mockito.doAnswer) QueryRequest(zipkin.storage.QueryRequest) MockitoJUnit(org.mockito.junit.MockitoJUnit) MockitoRule(org.mockito.junit.MockitoRule) ExpectedException(org.junit.rules.ExpectedException) Callback(zipkin.storage.Callback) Before(org.junit.Before) Callback(zipkin.storage.Callback) QueryRequest(zipkin.storage.QueryRequest) Test(org.junit.Test)

Aggregations

Arrays.asList (java.util.Arrays.asList)2 ExecutionException (java.util.concurrent.ExecutionException)2 Consumer (java.util.function.Consumer)2 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)2 Is.isA (org.hamcrest.core.Is.isA)2 Before (org.junit.Before)2 Rule (org.junit.Rule)2 Test (org.junit.Test)2 ExpectedException (org.junit.rules.ExpectedException)2 Matchers.any (org.mockito.Matchers.any)2 Matchers.eq (org.mockito.Matchers.eq)2 Mock (org.mockito.Mock)2 Mockito.doAnswer (org.mockito.Mockito.doAnswer)2 MockitoJUnit (org.mockito.junit.MockitoJUnit)2 MockitoRule (org.mockito.junit.MockitoRule)2 Answer (org.mockito.stubbing.Answer)2 LINKS (zipkin.TestObjects.LINKS)2 TRACE (zipkin.TestObjects.TRACE)2 AsyncSpanStore (zipkin.storage.AsyncSpanStore)2 Callback (zipkin.storage.Callback)2