Use EJB Test Client wizard
The Use EJB Test Client wizard adds a declaration of a test client class to the active class in the code editor. If you don't have an EJB test client yet or want to create another, you can use the wizard to create one for you.
To use the wizard, open the class you want to add the declaration to in JBuilder's code editor, then choose Wizards|Use EJB Test Client.
Step 1
EJB Test Client Class Already Exists
If the EJB test client already exists, check this option and then click Next. The wizard takes you to the next step where you specify the test client to use. If you don't check this option, when you click Next, you are taken to another page where you create an EJB test client.
Step 2 of 2
There are two steps if you have an existing EJB test client already.
Class
Specify the existing test client class by entering its name or by navigating to it.
Field
Specify a variable name that will hold an instance of the test client class. Click Finish when you are done, and the wizard generates the declaration.
Step 2 of 3
This page appears if you haven't specified an existing EJB test client in the previous step.
Enterprise JavaBean
From the drop-down list, select the enterprise bean you want to create a test client for or type in the name of the bean. The list displays all enterprise beans in the current project.
Package
From the drop-down list, select the package you want the test client to be in. The drop-down list displays all currently opened projects.
Class
Enter a name for your new EJB test client. JBuilder suggests a default name based on the name of the enterprise bean you are building the test client for. You can accept this name or enter another.
Base Class
If you want the test client based a class, specify the base class name by typing it in or navigate to where the base class resides and select it.
Generate Logging Messages
If this option is checked, the wizard generates code that declares and implements a method in the test client that calls each method in the remote interface. Each of these methods reports its success in invoking the remote method and how long the remote method took to execute.
Generate Main Function
Check this option to add a main()
function to the test client. You can then call the bean's methods from the main()
function. You do this by first calling either a create or find method, and, if a remote reference is returned, by using that remote reference to call the bean's business methods. Or, because the wizard declares a client
object in the main()
function, you can use that client
object to call the methods declared in the test client that call the bean's remote methods.
Generate Header Comments
If checked, this option adds JavaDoc header comments such as Title and Author to the top of the EJB test client.
Step 3 of 3
Field
Enter the variable name you want to hold an instance of the test client. JBuilder suggests a default name based on the name of the bean you are targeting, but you can choose one of your own.
Choose Finish when you are done, and the wizard generates an EJB test client for you and adds a declaration of the class in the active class in the code editor.