Service Development Help : Debugging Java Services : About Test Harnesses : Creating a Test Harness
Creating a Test Harness
Use the following procedure to create a test harness for a Java class that you want to debug.
To create a test harness
1. In the Package Navigator view, right click the Java service for which you want to generate a test harness and select Generate Code.
Alternatively, if the Java service is open in the editor, you can right click in the editor and select Generate Code.
2. In the Code Generation window, select For debugging this service and click Finish.
Designer generates the test harness with a single main primary method and displays it in the JDT debugger editor.
3. Optionally update the Integration Server to which the test harness will connect to obtain the input parameters of the Java class to debug.
a. Locate the following statements in the test harness Java class:
// Connect to server - edit for alternate server
String server = "serverHost:portNumber"; //$NON-NLS-1$
By default, the code identifies the Integration Server associated with the Java service for which you generated the test harness.
b. Replace the host name and port number with the host name and port number of an alternate Integration Server.
4. If you want the test harness to use SSL when connecting to Integration Server:
a. Locate the following statements in the test harness Java class:
// To use SSL:
//
// context.setSecure(true);

// Optionally send authentication certificates
//
// String cert = "c:\\myCerts\\cert.der"; //$NON-NLS-1$
// String privKey = "c:\\myCerts\\privkey.der"; //$NON-NLS-1$
// String cacert = "c:\\myCerts\\cacert.der"; //$NON-NLS-1$
// context.setSSLCertificates(cert, privKey, cacert);
b. Remove the // from the context.setSecure(true) statement to uncomment it.
c. If you want to send authentication certificates, update the certificates information and remove the // from the lines to uncomment them.
5. If you want to provide Integration Server credentials:
a. Locate the following statements in the test harness Java class:
// Set username and password for protected services
String username = null;
String password = null;
b. Specify a user name and password on these lines.
Important:  
If you want to share the test harness with other users, do not supply your user name and password because this presents a security risk.
6. Select File > Save to save any changes you made.
About Debugging a Java Service while its Class Runs in Designer
About Test Harnesses
How to Suspend Execution of a Java Class while Debugging
Debugging a Java Service while its Class Runs in Designer
Viewing Service Results from Debugging a Java Service
Service Development Projects in the Local Workspace
Copyright © 2017 Software AG, Darmstadt, Germany. (Innovation Release)

Product LogoContact Support   |   Community   |   Feedback