test_class.declarator: invokers = new ArrayList<Invoker<IHelloService>>()
test_class.original_string: List<Invoker<IHelloService>> invokers = new ArrayList<Invoker<IHelloService>>();
test_class.type: List<Invoker<IHelloService>>
test_class.var_name: invokers
test_class.file: dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/support/wrapper/MockClusterInvokerTest.java
test_class.identifier: MockClusterInvokerTest
test_case.body: @Test
      public void testMockInvokerFromOverride_Invoke_checkCompatible_ImplMock() {
          URL url = URL.valueOf("remote://1.2.3.4/" + IHelloService.class.getName())
                  .addParameter("mock", "true")
                  .addParameter(REFER_KEY, URL.encode(PATH_KEY + "=" + IHelloService.class.getName()))
                  .addParameter("invoke_return_error", "true");
          Invoker<IHelloService> cluster = getClusterInvoker(url);
          //Configured with mock
          RpcInvocation invocation = new RpcInvocation();
          invocation.setMethodName("getSomething");
          Result ret = cluster.invoke(invocation);
          Assertions.assertEquals("somethingmock", ret.getValue());
      }
test_case.class_method_signature: MockClusterInvokerTest.testMockInvokerFromOverride_Invoke_checkCompatible_ImplMock()
test_case.full_signature: @Test public void testMockInvokerFromOverride_Invoke_checkCompatible_ImplMock()
test_case.identifier: testMockInvokerFromOverride_Invoke_checkCompatible_ImplMock
test_case.invocations: addParameter addParameter addParameter valueOf getName encode getName getClusterInvoker setMethodName invoke assertEquals getValue
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testMockInvokerFromOverride_Invoke_checkCompatible_ImplMock()
focal_class.declarator: logger = LoggerFactory.getLogger(MockClusterInvoker.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger logger = LoggerFactory.getLogger(MockClusterInvoker.class);
focal_class.type: Logger
focal_class.var_name: logger
focal_class.declarator: directory
focal_class.modifier: private final
focal_class.original_string: private final Directory<T> directory;
focal_class.type: Directory<T>
focal_class.var_name: directory
focal_class.declarator: invoker
focal_class.modifier: private final
focal_class.original_string: private final Invoker<T> invoker;
focal_class.type: Invoker<T>
focal_class.var_name: invoker
focal_class.file: dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/support/wrapper/MockClusterInvoker.java
focal_class.identifier: MockClusterInvoker
focal_class.interfaces: implements ClusterInvoker<T>
focal_class.class_method_signature: MockClusterInvoker.MockClusterInvoker(Directory<T> directory, Invoker<T> invoker)
focal_class.full_signature: public  MockClusterInvoker(Directory<T> directory, Invoker<T> invoker)
focal_class.identifier: MockClusterInvoker
focal_class.modifiers: public
focal_class.parameters: (Directory<T> directory, Invoker<T> invoker)
focal_class.signature:  MockClusterInvoker(Directory<T> directory, Invoker<T> invoker)
focal_class.class_method_signature: MockClusterInvoker.getUrl()
focal_class.full_signature: @Override public URL getUrl()
focal_class.identifier: getUrl
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: URL
focal_class.signature: URL getUrl()
focal_class.class_method_signature: MockClusterInvoker.getRegistryUrl()
focal_class.full_signature: public URL getRegistryUrl()
focal_class.identifier: getRegistryUrl
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: URL
focal_class.signature: URL getRegistryUrl()
focal_class.class_method_signature: MockClusterInvoker.getDirectory()
focal_class.full_signature: @Override public Directory<T> getDirectory()
focal_class.identifier: getDirectory
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: Directory<T>
focal_class.signature: Directory<T> getDirectory()
focal_class.class_method_signature: MockClusterInvoker.isDestroyed()
focal_class.full_signature: @Override public boolean isDestroyed()
focal_class.identifier: isDestroyed
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: boolean
focal_class.signature: boolean isDestroyed()
focal_class.class_method_signature: MockClusterInvoker.isAvailable()
focal_class.full_signature: @Override public boolean isAvailable()
focal_class.identifier: isAvailable
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: boolean
focal_class.signature: boolean isAvailable()
focal_class.class_method_signature: MockClusterInvoker.destroy()
focal_class.full_signature: @Override public void destroy()
focal_class.identifier: destroy
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void destroy()
focal_class.class_method_signature: MockClusterInvoker.getInterface()
focal_class.full_signature: @Override public Class<T> getInterface()
focal_class.identifier: getInterface
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: Class<T>
focal_class.signature: Class<T> getInterface()
focal_class.class_method_signature: MockClusterInvoker.invoke(Invocation invocation)
focal_class.full_signature: @Override public Result invoke(Invocation invocation)
focal_class.identifier: invoke
focal_class.modifiers: @Override public
focal_class.parameters: (Invocation invocation)
focal_class.return: Result
focal_class.signature: Result invoke(Invocation invocation)
focal_class.class_method_signature: MockClusterInvoker.doMockInvoke(Invocation invocation, RpcException e)
focal_class.full_signature: @SuppressWarnings({"unchecked", "rawtypes"}) private Result doMockInvoke(Invocation invocation, RpcException e)
focal_class.identifier: doMockInvoke
focal_class.modifiers: @SuppressWarnings({"unchecked", "rawtypes"}) private
focal_class.parameters: (Invocation invocation, RpcException e)
focal_class.return: Result
focal_class.signature: Result doMockInvoke(Invocation invocation, RpcException e)
focal_class.class_method_signature: MockClusterInvoker.getMockExceptionMessage(Throwable t, Throwable mt)
focal_class.full_signature: private String getMockExceptionMessage(Throwable t, Throwable mt)
focal_class.identifier: getMockExceptionMessage
focal_class.modifiers: private
focal_class.parameters: (Throwable t, Throwable mt)
focal_class.return: String
focal_class.signature: String getMockExceptionMessage(Throwable t, Throwable mt)
focal_class.class_method_signature: MockClusterInvoker.selectMockInvoker(Invocation invocation)
focal_class.full_signature: private List<Invoker<T>> selectMockInvoker(Invocation invocation)
focal_class.identifier: selectMockInvoker
focal_class.modifiers: private
focal_class.parameters: (Invocation invocation)
focal_class.return: List<Invoker<T>>
focal_class.signature: List<Invoker<T>> selectMockInvoker(Invocation invocation)
focal_class.class_method_signature: MockClusterInvoker.toString()
focal_class.full_signature: @Override public String toString()
focal_class.identifier: toString
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: String
focal_class.signature: String toString()
focal_method.body: @Override
      public Result invoke(Invocation invocation) throws RpcException {
          Result result = null;
  
          String value = getUrl().getMethodParameter(invocation.getMethodName(), MOCK_KEY, Boolean.FALSE.toString()).trim();
          if (value.length() == 0 || "false".equalsIgnoreCase(value)) {
              //no mock
              result = this.invoker.invoke(invocation);
          } else if (value.startsWith("force")) {
              if (logger.isWarnEnabled()) {
                  logger.warn("force-mock: " + invocation.getMethodName() + " force-mock enabled , url : " + getUrl());
              }
              //force:direct mock
              result = doMockInvoke(invocation, null);
          } else {
              //fail-mock
              try {
                  result = this.invoker.invoke(invocation);
  
                  //fix:#4585
                  if(result.getException() != null && result.getException() instanceof RpcException){
                      RpcException rpcException= (RpcException)result.getException();
                      if(rpcException.isBiz()){
                          throw  rpcException;
                      }else {
                          result = doMockInvoke(invocation, rpcException);
                      }
                  }
  
              } catch (RpcException e) {
                  if (e.isBiz()) {
                      throw e;
                  }
  
                  if (logger.isWarnEnabled()) {
                      logger.warn("fail-mock: " + invocation.getMethodName() + " fail-mock enabled , url : " + getUrl(), e);
                  }
                  result = doMockInvoke(invocation, e);
              }
          }
          return result;
      }
focal_method.class_method_signature: MockClusterInvoker.invoke(Invocation invocation)
focal_method.full_signature: @Override public Result invoke(Invocation invocation)
focal_method.identifier: invoke
focal_method.invocations: trim getMethodParameter getUrl getMethodName toString length equalsIgnoreCase invoke startsWith isWarnEnabled warn getMethodName getUrl doMockInvoke invoke getException getException getException isBiz doMockInvoke isBiz isWarnEnabled warn getMethodName getUrl doMockInvoke
focal_method.modifiers: @Override public
focal_method.parameters: (Invocation invocation)
focal_method.return: Result
focal_method.signature: Result invoke(Invocation invocation)