FinishSpan { static void finish(TracingFilter filter, DubboRequest request, @Nullable Result result, @Nullable Throwable error, Span span) { if (request instanceof RpcClientRequest) { filter.clientHandler.handleReceive( new DubboClientResponse((DubboClientRequest) request, result, error), span); } else { filter.serverHandler.handleSend( new DubboServerResponse((DubboServerRequest) request, result, error), span); } } FinishSpan(Span span, Result result); abstract void accept(@Nullable Object unused, @Nullable Throwable error);  }
@Test public void finish_null_result_and_error_DubboClientRequest() { Span span = tracing.tracer().nextSpan().kind(Span.Kind.CLIENT).start(); FinishSpan.finish(filter, clientRequest, null, null, span); testSpanHandler.takeRemoteSpan(Kind.CLIENT); }
@Test public void finish_null_result_and_error_DubboServerRequest() { Span span = tracing.tracer().nextSpan().kind(Span.Kind.SERVER).start(); FinishSpan.finish(filter, serverRequest, null, null, span); testSpanHandler.takeRemoteSpan(Kind.SERVER); }
@Test public void finish_result_but_null_error_DubboClientRequest() { Span span = tracing.tracer().nextSpan().kind(Span.Kind.CLIENT).start(); FinishSpan.finish(filter, clientRequest, mock(Result.class), null, span); testSpanHandler.takeRemoteSpan(Kind.CLIENT); }
@Test public void finish_result_but_null_error_DubboServerRequest() { Span span = tracing.tracer().nextSpan().kind(Span.Kind.SERVER).start(); FinishSpan.finish(filter, serverRequest, mock(Result.class), null, span); testSpanHandler.takeRemoteSpan(Kind.SERVER); }
@Test public void finish_error_but_null_result_DubboClientRequest() { Span span = tracing.tracer().nextSpan().kind(Span.Kind.CLIENT).start(); Throwable error = new RuntimeException("melted"); FinishSpan.finish(filter, clientRequest, null, error, span); testSpanHandler.takeRemoteSpanWithError(Kind.CLIENT, error); }
@Test public void finish_error_but_null_result_DubboServerRequest() { Span span = tracing.tracer().nextSpan().kind(Span.Kind.SERVER).start(); Throwable error = new RuntimeException("melted"); FinishSpan.finish(filter, serverRequest, null, error, span); testSpanHandler.takeRemoteSpanWithError(Kind.SERVER, error); }