Class MockInvoker<T>

java.lang.Object
org.apache.dubbo.rpc.support.MockInvoker<T>
All Implemented Interfaces:
Node, Invoker<T>

public final class MockInvoker<T> extends Object implements Invoker<T>
  • Constructor Details

    • MockInvoker

      public MockInvoker(URL url, Class<T> type)
  • Method Details

    • parseMockValue

      public static Object parseMockValue(String mock) throws Exception
      Throws:
      Exception
    • parseMockValue

      public static Object parseMockValue(String mock, Type[] returnTypes) throws Exception
      Throws:
      Exception
    • invoke

      public Result invoke(Invocation invocation) throws RpcException
      Description copied from interface: Invoker
      invoke.
      Specified by:
      invoke in interface Invoker<T>
      Parameters:
      invocation -
      Returns:
      result
      Throws:
      RpcException
    • getThrowable

      public static Throwable getThrowable(String throwstr)
    • getMockObject

      public static Object getMockObject(ExtensionDirector extensionDirector, String mockService, Class serviceType)
    • normalizeMock

      public static String normalizeMock(String mock)
      Normalize mock string:
      1. return => return null
      2. fail => default
      3. force => default
      4. fail:throw/return foo => throw/return foo
      5. force:throw/return foo => throw/return foo
      Parameters:
      mock - mock string
      Returns:
      normalized mock string
    • getUrl

      public URL getUrl()
      Specified by:
      getUrl in interface Node
    • isAvailable

      public boolean isAvailable()
      Specified by:
      isAvailable in interface Node
    • destroy

      public void destroy()
      Specified by:
      destroy in interface Node
    • getInterface

      public Class<T> getInterface()
      Description copied from interface: Invoker
      get service interface.
      Specified by:
      getInterface in interface Invoker<T>
      Returns:
      service interface.