public class NetworkServerControlWrapper
extends java.lang.Object
NetworkServerControl
instance, using reflection
to allow TestConfiguration
to be used without having
derbynet.jar on the classpath.
Only methods actually required by TestConfiguration
are wrapped, and
this class depends on the functionality implemented by
NetworkServerTestSetup
.
The problem before was that an exception was thrown during class loading time, even if the network server functionality was never required by the tests being run. With this wrapper, an exception will be thrown only if the functionality is actually required and the necessary classes are not on the classpath.
Modifier and Type | Field and Description |
---|---|
private java.lang.Object |
ctrl
Associated
NetworkServerControl instance. |
private java.lang.reflect.Method[] |
METHODS
Array with the various method objects.
|
private static int |
PING |
private static int |
SHUTDOWN |
private static int |
START |
Constructor and Description |
---|
NetworkServerControlWrapper()
Creates a new wrapper object.
|
Modifier and Type | Method and Description |
---|---|
private void |
invoke(int methodIndex,
java.lang.Object[] args)
Helper method that invokes a method returning
void . |
void |
ping() |
void |
shutdown() |
void |
start(java.io.PrintWriter printWriter) |
private static final int PING
private static final int SHUTDOWN
private static final int START
private final java.lang.Object ctrl
NetworkServerControl
instance.private final java.lang.reflect.Method[] METHODS
NetworkServerControlWrapper() throws java.lang.Exception
java.lang.Exception
- if creating the NetworkServerControl
instance
failsprivate final void invoke(int methodIndex, java.lang.Object[] args) throws java.lang.Exception
void
.methodIndex
- index of the method to invoke (METHODS
)args
- arguments to pass to the method being invokedjava.lang.Exception
- a broad range of exceptions can be thrown, both
related to reflection and any exceptions the invoked methods
themselves might throwpublic void ping() throws java.lang.Exception
java.lang.Exception
NetworkServerControl.ping()
public void shutdown() throws java.lang.Exception
java.lang.Exception
NetworkServerControl.shutdown()
public void start(java.io.PrintWriter printWriter) throws java.lang.Exception
java.lang.Exception
NetworkServerControl.start(java.io.PrintWriter)
Apache Derby V10.13 Internals - Copyright © 2004,2016 The Apache Software Foundation. All Rights Reserved.