test_class.declarator: consumerContextFilter = new ConsumerContextFilter()
test_class.original_string: Filter consumerContextFilter = new ConsumerContextFilter();
test_class.type: Filter
test_class.var_name: consumerContextFilter
test_class.file: dubbo-rpc/dubbo-rpc-api/src/test/java/com/alibaba/dubbo/rpc/filter/ConsumerContextFilterTest.java
test_class.identifier: ConsumerContextFilterTest
test_case.body: @Test
      public void testSetContext() {
          URL url = URL.valueOf("test://test:11/test?group=dubbo&version=1.1");
          Invoker<DemoService> invoker = new MyInvoker<DemoService>(url);
          Invocation invocation = new MockInvocation();
          consumerContextFilter.invoke(invoker, invocation);
          assertEquals(invoker, RpcContext.getContext().getInvoker());
          assertEquals(invocation, RpcContext.getContext().getInvocation());
          assertEquals(NetUtils.getLocalHost() + ":0", RpcContext.getContext().getLocalAddressString());
          assertEquals("test:11", RpcContext.getContext().getRemoteAddressString());
  
      }
test_case.class_method_signature: ConsumerContextFilterTest.testSetContext()
test_case.full_signature: @Test public void testSetContext()
test_case.identifier: testSetContext
test_case.invocations: valueOf invoke assertEquals getInvoker getContext assertEquals getInvocation getContext assertEquals getLocalHost getLocalAddressString getContext assertEquals getRemoteAddressString getContext
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testSetContext()
focal_class.file: dubbo-rpc/dubbo-rpc-api/src/main/java/com/alibaba/dubbo/rpc/filter/ConsumerContextFilter.java
focal_class.identifier: ConsumerContextFilter
focal_class.interfaces: implements Filter
focal_class.class_method_signature: ConsumerContextFilter.invoke(Invoker<?> invoker, Invocation invocation)
focal_class.full_signature: @Override public Result invoke(Invoker<?> invoker, Invocation invocation)
focal_class.identifier: invoke
focal_class.modifiers: @Override public
focal_class.parameters: (Invoker<?> invoker, Invocation invocation)
focal_class.return: Result
focal_class.signature: Result invoke(Invoker<?> invoker, Invocation invocation)
focal_method.body: @Override
      public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException {
          RpcContext.getContext()
                  .setInvoker(invoker)
                  .setInvocation(invocation)
                  .setLocalAddress(NetUtils.getLocalHost(), 0)
                  .setRemoteAddress(invoker.getUrl().getHost(),
                          invoker.getUrl().getPort());
          if (invocation instanceof RpcInvocation) {
              ((RpcInvocation) invocation).setInvoker(invoker);
          }
          try {
              RpcResult result = (RpcResult) invoker.invoke(invocation);
              RpcContext.getServerContext().setAttachments(result.getAttachments());
              return result;
          } finally {
              RpcContext.getContext().clearAttachments();
          }
      }
focal_method.class_method_signature: ConsumerContextFilter.invoke(Invoker<?> invoker, Invocation invocation)
focal_method.full_signature: @Override public Result invoke(Invoker<?> invoker, Invocation invocation)
focal_method.identifier: invoke
focal_method.invocations: setRemoteAddress setLocalAddress setInvocation setInvoker getContext getLocalHost getHost getUrl getPort getUrl setInvoker invoke setAttachments getServerContext getAttachments clearAttachments getContext
focal_method.modifiers: @Override public
focal_method.parameters: (Invoker<?> invoker, Invocation invocation)
focal_method.return: Result
focal_method.signature: Result invoke(Invoker<?> invoker, Invocation invocation)