Class AbstractBaseProxy<I,IP extends InvocationProxy>

java.lang.Object
com.sun.ts.tests.common.vehicle.none.proxy.AbstractBaseProxy<I,IP>
Type Parameters:
I - - The interface type of the proxy used to represent the test methods
IP - - The invocation proxy type used to dispatch the method calls
All Implemented Interfaces:
InvocationProxy<I>, InvocationHandler

public abstract class AbstractBaseProxy<I,IP extends InvocationProxy> extends Object implements InvocationProxy<I>
An abstract base class for creating dynamic proxies used to dispatch method calls to a remote server.
  • Constructor Details

    • AbstractBaseProxy

      public AbstractBaseProxy()
  • Method Details

    • runTest

      public abstract RemoteStatus runTest(String testName)
      Implemented by the IP class to dispatch the method call to the remote server.
      Specified by:
      runTest in interface InvocationProxy<I>
      Parameters:
      testName - - a test method name
      Returns:
      - the status of the test method result
    • newProxy

      public I newProxy()
      Creates a new proxy instance of the interface type I that is not bound to a specific dispatcher.
      Returns:
      - a new proxy instance
    • newProxy

      public I newProxy(Object testCase)
      Creates a new proxy instance of the interface type I that is bound to the direct dispatcher. Useful for testing, but not tck tests.
      Parameters:
      testCase - - the test case instance
      Returns:
      - a new proxy instance
    • newProxy

      public I newProxy(String host, String port)
      Creates a new proxy instance of the interface type I that is bound to the servlet dispatcher.
      Specified by:
      newProxy in interface InvocationProxy<I>
      Parameters:
      host - - servlet host
      port - - servlet port
      Returns:
      - a new proxy instance
    • getLastProxy

      public I getLastProxy()
      Returns the last proxy instance created.
      Returns:
    • getInterfaceClass

      public Class<I> getInterfaceClass()
      Specified by:
      getInterfaceClass in interface InvocationProxy<I>
    • getInvocationProxyClass

      public Class<IP> getInvocationProxyClass()
    • getReifiedTypeArguments

      public Class<?>[] getReifiedTypeArguments()
    • getGenericInfo

      public String getGenericInfo()
    • getDispatcher

      public Function<Object[],RemoteStatus> getDispatcher()
    • setDispatcher

      public void setDispatcher(Function<Object[],RemoteStatus> dispatcher)
      Provide a custom dispatcher to handle the method calls.
      Parameters:
      dispatcher - - a function that takes an array of objects and returns a RemoteStatus. The last element in the array is the test method name.
    • useDirectDispatcher

      public void useDirectDispatcher(Object testCase)
      Use the DirectDispatcher to handle the method calls.
      Parameters:
      testCase -
    • useServletDispatcher

      public void useServletDispatcher(String host, String port)
      Use the ServletDispatcher to handle the method calls.
      Parameters:
      host - - servlet host
      port - - servlet port
    • invoke

      public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
      Specified by:
      invoke in interface InvocationHandler
      Parameters:
      proxy - the proxy instance that the method was invoked on
      method - the Method instance corresponding to the interface method invoked on the proxy instance.
      args - an array of objects containing the values of the arguments passed in the method invocation on the proxy instance, or null if interface method takes no arguments. This method handles the Object methods toString, hashCode, and equals. All other methods are dispatched to the dispatcher.
      Returns:
      - the result of the method call
      Throws:
      Throwable - on failure