Testing Wrapper Functions
This section explains how to test JWAVE wrapper functions without writing client Java programs. The WRAPPER_TEST_* procedures are PV‑WAVE procedures that you can use to imitate the behavior of the Java client application, such as setting parameters, setting colors, and setting and executing the JWAVE wrapper.
Testing a Numerical Program
For example, let’s look at how you can test the JWAVE wrapper simple.pro that we discussed in Chapter 1: JWAVE System Introduction. This wrapper accepts a number and returns the square root of the number to the Java client. To test this wrapper without writing the Java client application yet, you can run the following test procedures in PV‑WAVE (assuming that the directory that contains simple.pro is in the !Path system variable of PV‑WAVE):
WAVE> WRAPPER_TEST_INIT, 'SIMPLE'
WAVE> WRAPPER_TEST_SETPARAM, 'NUMBER', 2
WAVE> WRAPPER_TEST_EXECUTE
WAVE> WRAPPER_TEST_RETURN_INFO
DATA            FLOAT     =       1.41421
WAVE> 
Here we set the wrapper, set a parameter, executed the wrapper, and printed the return data.
The procedures used to test this wrapper correspond to the Java methods used to set parameters, and so on, in the client application. Table 5-1: PV-WAVE Test Routines shows the correspondence between these PV‑WAVE test routines and the Java methods they imitate.
 
PV-WAVE Test Routines
Test Procedure
JWAVE Java Method
WRAPPER_TEST_INIT
JWaveExecute.setFunction and JWaveView.setSize (optional)
WRAPPER_TEST_SETCOLOR
JWaveView.setNamedColor
WRAPPER_TEST_SETPARAM
JWaveExecute.setParam
WRAPPER_TEST_EXECUTE
JWaveExecute.execute
WRAPPER_TEST_GETRETURN
JWaveExecute.getReturnData
WRAPPER_TEST_RETURN_INFO
Parameter.printInfo
Testing a Graphics Program
You can also use the WRAPPER_TEST_* routines to test wrapper functions that generate graphics. To do this, specify the window size to WRAPPER_TEST_INIT, as shown in one of the examples below. If the wrapper returns a graphic, then the test procedure WRAPPER_TEST_EXECUTE displays the graphic in a PV‑WAVE window.
Here is an example that tests the wrapper jwave_plot.pro. You can find this wrapper function in:
(UNIX) RW_DIR/jwave-3_6/lib
(WIN) RW_DIR\jwave-3_6\lib
where RW_DIR is the main Rogue Wave installation directory.
WAVE> WRAPPER_TEST_INIT, 'JWAVE_PLOT', 300, 300 
WAVE> WRAPPER_TEST_SETCOLOR, 'BACKGROUND', '000000'xL ; black
WAVE> WRAPPER_TEST_SETCOLOR, 'LINE', 'ff0000'xL ; blue
WAVE> WRAPPER_TEST_SETPARAM, 'Y', HANNING(20,20)
WAVE> WRAPPER_TEST_SETPARAM, 'PSYM', 1
WAVE> WRAPPER_TEST_EXECUTE
Here, note that the WRAPPER_TEST_SETCOLOR procedure is used to set line and background colors. When WRAPPER_TEST_EXECUTE is run, the plot is displayed in a PV‑WAVE graphics window.
For detailed information on each of the WRAPPER_TEST_* routines, see Appendix A: JWAVE Wrapper API.