Java Code Examples for org.apache.dubbo.rpc.Invocation

The following examples show how to use org.apache.dubbo.rpc.Invocation. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: Sentinel-Dashboard-Nacos   Source File: DubboUtils.java    License: Apache License 2.0 6 votes vote down vote up
public static String getResourceName(Invoker<?> invoker, Invocation invocation) {
    StringBuilder buf = new StringBuilder(64);
    buf.append(invoker.getInterface().getName())
        .append(":")
        .append(invocation.getMethodName())
        .append("(");
    boolean isFirst = true;
    for (Class<?> clazz : invocation.getParameterTypes()) {
        if (!isFirst) {
            buf.append(",");
        }
        buf.append(clazz.getName());
        isFirst = false;
    }
    buf.append(")");
    return buf.toString();
}
 
Example 2
@Override
public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException {
    System.out.println("**************** Enter CircuitBreaker ****************");
    long countLong = count.incrementAndGet();
    long start = 0;
    try {
        CircuitBreakerUtils.isCallPermitted(circuitBreaker);
        start = System.nanoTime();
        Result result = invoker.invoke(invocation);
        if (result.hasException()) {
            doThrowException(result.getException(), start);
            return result;
        }
        long durationInNanos = System.nanoTime() - start;
        circuitBreaker.onSuccess(durationInNanos);
        return result;
    } catch (CircuitBreakerOpenException cbo) {

        doCircuitBreakerOpenException(cbo, countLong, breakCount.incrementAndGet());
        throw cbo;
    } catch (Throwable throwable) {
        doThrowException(throwable, start);
        throw throwable;
    }
}
 
Example 3
Source Project: dubbo-samples   Source File: UserLoadBalance.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public <T> Invoker<T> doSelect(List<Invoker<T>> invokers, URL url, Invocation invocation) throws RpcException {
    for (Invoker t : invokers) {
        try {
            InetAddress addr = InetAddress.getLocalHost();
            String ip = addr.getHostAddress().toString();
            URL u = t.getUrl();
            if (u.getIp().equals(ip)) {
                return t;
            }
        } catch (Exception e) {
            // no op
        }
    }
    return super.doSelect(invokers, url, invocation);
}
 
Example 4
Source Project: chronus   Source File: InvocationUtil.java    License: Apache License 2.0 6 votes vote down vote up
public static JobConfig getJobConfigByArgs(final Invocation invocation){
    Object[] args = invocation.getArguments();
    JobConfig jobConfig = null;
    if (args != null) {
        for (Object o : args) {
            if (!(o instanceof JobConfig)) {
                continue;
            }
            jobConfig = (JobConfig) o;
            if (StringUtils.isBlank(jobConfig.getSysCode())) {
                log.error("ClientLoadBalance doSelect() error, SysCode isBlank!");
                return null;
            }
            break;
        }
    }
    return jobConfig;
}
 
Example 5
Source Project: skywalking   Source File: DubboInterceptor.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Format operation name. e.g. org.apache.skywalking.apm.plugin.test.Test.test(String)
 *
 * @return operation name.
 */
private String generateOperationName(URL requestURL, Invocation invocation) {
    StringBuilder operationName = new StringBuilder();
    operationName.append(requestURL.getPath());
    operationName.append("." + invocation.getMethodName() + "(");
    for (Class<?> classes : invocation.getParameterTypes()) {
        operationName.append(classes.getSimpleName() + ",");
    }

    if (invocation.getParameterTypes().length > 0) {
        operationName.delete(operationName.length() - 1, operationName.length());
    }

    operationName.append(")");

    return operationName.toString();
}
 
Example 6
Source Project: Sentinel   Source File: DubboUtils.java    License: Apache License 2.0 6 votes vote down vote up
public static String getResourceName(Invoker<?> invoker, Invocation invocation, Boolean useGroupAndVersion) {
    StringBuilder buf = new StringBuilder(64);
    String interfaceResource = useGroupAndVersion ? invoker.getUrl().getColonSeparatedKey() : invoker.getInterface().getName();
    buf.append(interfaceResource)
        .append(":")
        .append(invocation.getMethodName())
        .append("(");
    boolean isFirst = true;
    for (Class<?> clazz : invocation.getParameterTypes()) {
        if (!isFirst) {
            buf.append(",");
        }
        buf.append(clazz.getName());
        isFirst = false;
    }
    buf.append(")");
    return buf.toString();
}
 
Example 7
Source Project: Sentinel   Source File: DubboUtilsTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testGetResourceNameWithGroupAndVersion() throws NoSuchMethodException {
    Invoker invoker = mock(Invoker.class);
    URL url = URL.valueOf("dubbo://127.0.0.1:2181")
            .addParameter(CommonConstants.VERSION_KEY, "1.0.0")
            .addParameter(CommonConstants.GROUP_KEY, "grp1")
            .addParameter(CommonConstants.INTERFACE_KEY, DemoService.class.getName());
    when(invoker.getUrl()).thenReturn(url);
    when(invoker.getInterface()).thenReturn(DemoService.class);

    Invocation invocation = mock(Invocation.class);
    Method method = DemoService.class.getDeclaredMethod("sayHello", String.class, int.class);
    when(invocation.getMethodName()).thenReturn(method.getName());
    when(invocation.getParameterTypes()).thenReturn(method.getParameterTypes());

    String resourceNameUseGroupAndVersion = DubboUtils.getResourceName(invoker, invocation, true);

    assertEquals("com.alibaba.csp.sentinel.adapter.dubbo.provider.DemoService:1.0.0:grp1:sayHello(java.lang.String,int)", resourceNameUseGroupAndVersion);
}
 
Example 8
Source Project: Sentinel   Source File: SentinelDubboConsumerFilterTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testInterfaceLevelFollowControlAsync() throws InterruptedException {

    Invoker invoker = DubboTestUtil.getDefaultMockInvoker();
    Invocation invocation = DubboTestUtil.getDefaultMockInvocationOne();

    when(invocation.getAttachment(ASYNC_KEY)).thenReturn(Boolean.TRUE.toString());
    initFlowRule(DubboUtils.getInterfaceName(invoker));

    Result result1 = invokeDubboRpc(false, invoker, invocation);
    assertEquals("normal", result1.getValue());

    // should fallback because the qps > 1
    Result result2 = invokeDubboRpc(false, invoker, invocation);
    assertEquals("fallback", result2.getValue());

    // sleeping 1000 ms to reset qps
    Thread.sleep(1000);
    Result result3 = invokeDubboRpc(false, invoker, invocation);
    assertEquals("normal", result3.getValue());

    verifyInvocationStructureForCallFinish(invoker, invocation);
}
 
Example 9
Source Project: Sentinel   Source File: SentinelDubboConsumerFilterTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testMethodFlowControlAsync() {

    Invocation invocation = DubboTestUtil.getDefaultMockInvocationOne();
    Invoker invoker = DubboTestUtil.getDefaultMockInvoker();

    when(invocation.getAttachment(ASYNC_KEY)).thenReturn(Boolean.TRUE.toString());
    initFlowRule(consumerFilter.getMethodName(invoker, invocation));
    invokeDubboRpc(false, invoker, invocation);
    invokeDubboRpc(false, invoker, invocation);

    Invocation invocation2 = DubboTestUtil.getDefaultMockInvocationTwo();
    Result result2 = invokeDubboRpc(false, invoker, invocation2);
    verifyInvocationStructureForCallFinish(invoker, invocation2);
    assertEquals("normal", result2.getValue());

    // the method of invocation should be blocked
    Result fallback = invokeDubboRpc(false, invoker, invocation);
    assertEquals("fallback", fallback.getValue());
    verifyInvocationStructureForCallFinish(invoker, invocation);


}
 
Example 10
Source Project: Sentinel   Source File: SentinelDubboConsumerFilterTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testInvokeAsync() {

    Invocation invocation = DubboTestUtil.getDefaultMockInvocationOne();
    Invoker invoker = DubboTestUtil.getDefaultMockInvoker();

    when(invocation.getAttachment(ASYNC_KEY)).thenReturn(Boolean.TRUE.toString());
    final Result result = mock(Result.class);
    when(result.hasException()).thenReturn(false);
    when(invoker.invoke(invocation)).thenAnswer(invocationOnMock -> {
        verifyInvocationStructureForAsyncCall(invoker, invocation);
         return result;
    });
    consumerFilter.invoke(invoker, invocation);
    verify(invoker).invoke(invocation);

    Context context = ContextUtil.getContext();
    assertNotNull(context);
}
 
Example 11
Source Project: Sentinel   Source File: SentinelDubboConsumerFilterTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testInvokeSync() {

    Invocation invocation = DubboTestUtil.getDefaultMockInvocationOne();
    Invoker invoker = DubboTestUtil.getDefaultMockInvoker();

    final Result result = mock(Result.class);
    when(result.hasException()).thenReturn(false);
    when(result.getException()).thenReturn(new Exception());
    when(invoker.invoke(invocation)).thenAnswer(invocationOnMock -> {
        verifyInvocationStructure(invoker, invocation);
        return result;
    });

    consumerFilter.invoke(invoker, invocation);
    verify(invoker).invoke(invocation);

    Context context = ContextUtil.getContext();
    assertNull(context);
}
 
Example 12
@Override
public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException {
    String application = invoker.getUrl().getParameter(Constants.APPLICATION_KEY);
    if (application != null) {
        RpcContext.getContext().setAttachment(DubboUtils.SENTINEL_DUBBO_APPLICATION_KEY, application);
    }
    return invoker.invoke(invocation);
}
 
Example 13
Source Project: dubbo-samples   Source File: ThrowableAsyncFilter.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException {
    if (invocation != null) {
        throw new RuntimeException("exception before invoke()");
    }
    return invoker.invoke(invocation);
}
 
Example 14
@Test
public void testInvoke() {
    final String originApplication = "consumerA";

    final Invoker invoker = mock(Invoker.class);
    when(invoker.getInterface()).thenReturn(DemoService.class);

    final Invocation invocation = mock(Invocation.class);
    Method method = DemoService.class.getMethods()[0];
    when(invocation.getMethodName()).thenReturn(method.getName());
    when(invocation.getParameterTypes()).thenReturn(method.getParameterTypes());
    when(invocation.getAttachment(DubboUtils.SENTINEL_DUBBO_APPLICATION_KEY, ""))
        .thenReturn(originApplication);

    final Result result = mock(Result.class);
    when(result.hasException()).thenReturn(false);
    when(invoker.invoke(invocation)).thenAnswer(invocationOnMock -> {
        verifyInvocationStructure(originApplication, invoker, invocation);
        return result;
    });

    filter.invoke(invoker, invocation);
    verify(invoker).invoke(invocation);

    Context context = ContextUtil.getContext();
    assertNull(context);
}
 
Example 15
Source Project: Sentinel-Dashboard-Nacos   Source File: DubboUtilsTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testGetApplication() {
    Invocation invocation = mock(Invocation.class);
    when(invocation.getAttachments()).thenReturn(new HashMap<>());
    when(invocation.getAttachment(DubboUtils.SENTINEL_DUBBO_APPLICATION_KEY, ""))
        .thenReturn("consumerA");

    String application = DubboUtils.getApplication(invocation, "");
    verify(invocation).getAttachment(DubboUtils.SENTINEL_DUBBO_APPLICATION_KEY, "");

    assertEquals("consumerA", application);
}
 
Example 16
Source Project: Sentinel-Dashboard-Nacos   Source File: DubboUtilsTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testGetResourceName() {
    Invoker invoker = mock(Invoker.class);
    when(invoker.getInterface()).thenReturn(DemoService.class);

    Invocation invocation = mock(Invocation.class);
    Method method = DemoService.class.getMethods()[0];
    when(invocation.getMethodName()).thenReturn(method.getName());
    when(invocation.getParameterTypes()).thenReturn(method.getParameterTypes());

    String resourceName = DubboUtils.getResourceName(invoker, invocation);

    assertEquals("com.alibaba.csp.sentinel.adapter.dubbo.provider.DemoService:sayHello(java.lang.String,int)", resourceName);
}
 
Example 17
Source Project: dubbo-samples   Source File: LegacyListenableFilter.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException {
    RpcContext context = RpcContext.getContext();
    String filters = (String) context.getAttachment("filters");
    if (StringUtils.isEmpty(filters)) {
        filters = "";
    }
    filters += " legacy-block-filter";
    context.setAttachment("filters", filters);

    return invoker.invoke(invocation);
}
 
Example 18
@Test
public void testInvoke() {
    final String originApplication = "consumerA";

    final Invoker invoker = mock(Invoker.class);
    when(invoker.getInterface()).thenReturn(DemoService.class);

    final Invocation invocation = mock(Invocation.class);
    Method method = DemoService.class.getMethods()[0];
    when(invocation.getMethodName()).thenReturn(method.getName());
    when(invocation.getParameterTypes()).thenReturn(method.getParameterTypes());
    when(invocation.getAttachment(DubboUtils.SENTINEL_DUBBO_APPLICATION_KEY, ""))
        .thenReturn(originApplication);

    final Result result = mock(Result.class);
    when(result.hasException()).thenReturn(false);
    when(invoker.invoke(invocation)).thenAnswer(invocationOnMock -> {
        verifyInvocationStructure(originApplication, invoker, invocation);
        return result;
    });

    filter.invoke(invoker, invocation);
    verify(invoker).invoke(invocation);

    Context context = ContextUtil.getContext();
    assertNull(context);
}
 
Example 19
@Test
public void testInvokeApplicationKey() {
    Invoker invoker = mock(Invoker.class);
    Invocation invocation = mock(Invocation.class);
    URL url = URL.valueOf("test://test:111/test?application=serviceA");
    when(invoker.getUrl()).thenReturn(url);

    filter.invoke(invoker, invocation);
    verify(invoker).invoke(invocation);

    String application = RpcContext.getContext().getAttachment(DubboUtils.SENTINEL_DUBBO_APPLICATION_KEY);
    assertEquals("serviceA", application);
}
 
Example 20
@Test
public void testInvokeNullApplicationKey() {
    Invoker invoker = mock(Invoker.class);
    Invocation invocation = mock(Invocation.class);
    URL url = URL.valueOf("test://test:111/test?application=");
    when(invoker.getUrl()).thenReturn(url);

    filter.invoke(invoker, invocation);
    verify(invoker).invoke(invocation);

    String application = RpcContext.getContext().getAttachment(DubboUtils.SENTINEL_DUBBO_APPLICATION_KEY);
    assertNull(application);
}
 
Example 21
Source Project: dubbo-sentinel-support   Source File: DubboUtilsTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testGetResourceName() {
    Invoker invoker = mock(Invoker.class);
    when(invoker.getInterface()).thenReturn(DemoService.class);

    Invocation invocation = mock(Invocation.class);
    Method method = DemoService.class.getMethods()[0];
    when(invocation.getMethodName()).thenReturn(method.getName());
    when(invocation.getParameterTypes()).thenReturn(method.getParameterTypes());

    String resourceName = DubboUtils.getResourceName(invoker, invocation);

    assertEquals("com.alibaba.csp.sentinel.adapter.dubbo.provider.DemoService:sayHello(java.lang.String,int)", resourceName);
}
 
Example 22
Source Project: bird-java   Source File: BirdExceptionFilter.java    License: MIT License 5 votes vote down vote up
@Override
public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException {
    try {
        return invoker.invoke(invocation);
    } catch (RuntimeException e) {
        logger.error("Got unchecked and undeclared exception which called by " + RpcContext.getContext().getRemoteHost()
                + ". service: " + invoker.getInterface().getName() + ", method: " + invocation.getMethodName()
                + ", exception: " + e.getClass().getName() + ": " + e.getMessage(), e);
        throw e;
    }
}
 
Example 23
Source Project: bird-java   Source File: IpFirstLoadBalance.java    License: MIT License 5 votes vote down vote up
@Override
protected <T> Invoker<T> doSelect(List<Invoker<T>> invokers, URL url, Invocation invocation) {
    List<String> ips = SystemHelper.getLocalIps();

    if (CollectionUtils.isNotEmpty(ips)) {
        for (Invoker<T> invoker : invokers) {
            if (ips.contains(invoker.getUrl().getHost())) {
                return invoker;
            }
        }
    }

    return defaultLoadBalance.select(invokers,url,invocation);
}
 
Example 24
Source Project: sofa-tracer   Source File: DubboSofaTracerFilter.java    License: Apache License 2.0 5 votes vote down vote up
private SofaTracerSpan serverReceived(Invocation invocation) {
    Map<String, String> tags = new HashMap<>();
    tags.put(Tags.SPAN_KIND.getKey(), Tags.SPAN_KIND_SERVER);
    String serializeSpanContext = invocation.getAttachments()
        .get(CommonSpanTags.RPC_TRACE_NAME);
    SofaTracerSpanContext sofaTracerSpanContext = SofaTracerSpanContext
        .deserializeFromString(serializeSpanContext);
    boolean isCalculateSampler = false;
    boolean isSampled = true;
    if (sofaTracerSpanContext == null) {
        SelfLog
            .error("SpanContext created error when server received and root SpanContext created.");
        sofaTracerSpanContext = SofaTracerSpanContext.rootStart();
        isCalculateSampler = true;
    }
    String simpleName = invocation.getInvoker().getInterface().getSimpleName();
    SofaTracerSpan serverSpan = new SofaTracerSpan(dubboProviderSofaTracer.getSofaTracer(),
        System.currentTimeMillis(), simpleName, sofaTracerSpanContext, tags);
    // calculate sampler
    if (isCalculateSampler) {
        Sampler sampler = dubboProviderSofaTracer.getSofaTracer().getSampler();
        if (sampler != null) {
            isSampled = sampler.sample(serverSpan).isSampled();
        }
        sofaTracerSpanContext.setSampled(isSampled);
    }
    SofaTraceContext sofaTraceContext = SofaTraceContextHolder.getSofaTraceContext();
    // Record server receive event
    serverSpan.log(LogData.SERVER_RECV_EVENT_VALUE);
    sofaTraceContext.push(serverSpan);
    return serverSpan;
}
 
Example 25
Source Project: sofa-tracer   Source File: DubboSofaTracerFilter.java    License: Apache License 2.0 5 votes vote down vote up
private void appendElapsedTimeTags(Invocation invocation, SofaTracerSpan sofaTracerSpan,
                                   Result result, boolean isClient) {
    if (sofaTracerSpan == null) {
        return;
    }
    String reqSize;
    String respSize;
    String elapsed;
    String deElapsed;
    if (isClient) {
        reqSize = invocation.getAttachment(AttachmentKeyConstants.CLIENT_SERIALIZE_SIZE);
        elapsed = invocation.getAttachment(AttachmentKeyConstants.CLIENT_SERIALIZE_TIME);
        respSize = result.getAttachment(AttachmentKeyConstants.CLIENT_DESERIALIZE_SIZE);
        deElapsed = result.getAttachment(AttachmentKeyConstants.CLIENT_DESERIALIZE_TIME);
        sofaTracerSpan.setTag(AttachmentKeyConstants.CLIENT_SERIALIZE_TIME,
            parseAttachment(elapsed, 0));
        sofaTracerSpan.setTag(AttachmentKeyConstants.CLIENT_DESERIALIZE_TIME,
            parseAttachment(deElapsed, 0));
        sofaTracerSpan.setTag(AttachmentKeyConstants.CLIENT_SERIALIZE_SIZE,
            parseAttachment(reqSize, 0));
        sofaTracerSpan.setTag(AttachmentKeyConstants.CLIENT_DESERIALIZE_SIZE,
            parseAttachment(respSize, 0));
    } else {
        reqSize = invocation.getAttachment(AttachmentKeyConstants.SERVER_DESERIALIZE_SIZE);
        deElapsed = invocation.getAttachment(AttachmentKeyConstants.SERVER_DESERIALIZE_TIME);
        respSize = result.getAttachment(AttachmentKeyConstants.SERVER_SERIALIZE_SIZE);
        elapsed = result.getAttachment(AttachmentKeyConstants.SERVER_SERIALIZE_TIME);
        sofaTracerSpan.setTag(AttachmentKeyConstants.SERVER_DESERIALIZE_SIZE,
            parseAttachment(reqSize, 0));
        sofaTracerSpan.setTag(AttachmentKeyConstants.SERVER_DESERIALIZE_TIME,
            parseAttachment(deElapsed, 0));
        sofaTracerSpan.setTag(AttachmentKeyConstants.SERVER_SERIALIZE_SIZE,
            parseAttachment(respSize, 0));
        sofaTracerSpan.setTag(AttachmentKeyConstants.SERVER_SERIALIZE_TIME,
            parseAttachment(elapsed, 0));
    }

}
 
Example 26
Source Project: Sentinel   Source File: DubboUtils.java    License: Apache License 2.0 5 votes vote down vote up
public static String getResourceName(Invoker<?> invoker, Invocation invocation, String prefix) {
    if (StringUtil.isNotBlank(prefix)) {
        return new StringBuilder(64)
                .append(prefix)
                .append(getResourceName(invoker, invocation, DubboConfig.getDubboInterfaceGroupAndVersionEnabled()))
                .toString();
    } else {
        return getResourceName(invoker, invocation, DubboConfig.getDubboInterfaceGroupAndVersionEnabled());
    }
}
 
Example 27
Source Project: Sentinel   Source File: SentinelDubboConsumerFilter.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException {
    InvokeMode invokeMode = RpcUtils.getInvokeMode(invoker.getUrl(), invocation);
    if (InvokeMode.SYNC == invokeMode) {
        return syncInvoke(invoker, invocation);
    } else {
        return asyncInvoke(invoker, invocation);
    }

}
 
Example 28
Source Project: dubbo-samples   Source File: OnErrorThrowableAsyncFilter.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void onError(Throwable t, Invoker<?> invoker, Invocation invocation) {
    System.out.println("OnErrorThrowableAsyncFilter onError executed: " + t.getMessage());
    if (invocation != null) {
        throw new RuntimeException("Exception from onError");
    }
}
 
Example 29
Source Project: dubbo-samples   Source File: AsyncPostprocessFilter.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException {
    RpcContext context = RpcContext.getContext();
    String filters = (String) context.getAttachment("filters");
    if (StringUtils.isEmpty(filters)) {
        filters = "";
    }
    filters += " async-post-process-filter";
    context.setAttachment("filters", filters);

    return invoker.invoke(invocation);
}
 
Example 30
Source Project: Sentinel   Source File: SentinelDubboProviderFilterTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testInvoke() {

    final String originApplication = "consumerA";

    URL url = DubboTestUtil.getDefaultTestURL();
    url = url.addParameter(CommonConstants.SIDE_KEY, CommonConstants.PROVIDER_SIDE);
    Invoker invoker = DubboTestUtil.getMockInvoker(url, DemoService.class);

    Invocation invocation = DubboTestUtil.getMockInvocation(DemoService.class.getMethods()[0]);
    when(invocation.getAttachment(DubboUtils.SENTINEL_DUBBO_APPLICATION_KEY, ""))
            .thenReturn(originApplication);

    final Result result = mock(Result.class);
    when(result.hasException()).thenReturn(false);
    when(result.getException()).thenReturn(new Exception());

    when(invoker.invoke(invocation)).thenAnswer(invocationOnMock -> {
        verifyInvocationStructure(originApplication, invoker, invocation);
        return result;
    });

    filter.invoke(invoker, invocation);
    verify(invoker).invoke(invocation);

    Context context = ContextUtil.getContext();
    assertNull(context);
}