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 methodsIP
- - 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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the last proxy instance created.Class<?>[]
newProxy()
Creates a new proxy instance of the interface type I that is not bound to a specific dispatcher.Creates a new proxy instance of the interface type I that is bound to the direct dispatcher.Creates a new proxy instance of the interface type I that is bound to the servlet dispatcher.abstract RemoteStatus
Implemented by the IP class to dispatch the method call to the remote server.void
setDispatcher
(Function<Object[], RemoteStatus> dispatcher) Provide a custom dispatcher to handle the method calls.void
useDirectDispatcher
(Object testCase) Use the DirectDispatcher to handle the method calls.void
useServletDispatcher
(String host, String port) Use the ServletDispatcher to handle the method calls.
-
Constructor Details
-
AbstractBaseProxy
public AbstractBaseProxy()
-
-
Method Details
-
runTest
Implemented by the IP class to dispatch the method call to the remote server.- Specified by:
runTest
in interfaceInvocationProxy<I>
- Parameters:
testName
- - a test method name- Returns:
- - the status of the test method result
-
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
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
Creates a new proxy instance of the interface type I that is bound to the servlet dispatcher.- Specified by:
newProxy
in interfaceInvocationProxy<I>
- Parameters:
host
- - servlet hostport
- - servlet port- Returns:
- - a new proxy instance
-
getLastProxy
Returns the last proxy instance created.- Returns:
-
getInterfaceClass
- Specified by:
getInterfaceClass
in interfaceInvocationProxy<I>
-
getInvocationProxyClass
-
getReifiedTypeArguments
-
getGenericInfo
-
getDispatcher
-
setDispatcher
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
Use the DirectDispatcher to handle the method calls.- Parameters:
testCase
-
-
useServletDispatcher
Use the ServletDispatcher to handle the method calls.- Parameters:
host
- - servlet hostport
- - servlet port
-
invoke
- Specified by:
invoke
in interfaceInvocationHandler
- Parameters:
proxy
- the proxy instance that the method was invoked onmethod
- theMethod
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, ornull
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
-