Top
Interstage Studio User's Guide
FUJITSU Software

D.2.4 Creating an EJB Test Client

Create a test client (client for operation check) from the created Enterprise Beans and check the operation of each business method. This section explains how to create a test client and how to conduct the test. Here, It explains how to create an EJB test client as a Web application.

Point

If you are creating an EJB test client that is connected remotely to an EJB, create a Java application project, and in [Client type] in the EJB test client wizard, specify a client type other than "Web".

"Web" cannot be selected in [Client type] in an EJB test client if the EJB does not contain a LocalHome/Local interface.

Creating a project

From [New] wizard, select [Web] > [Dynamic Web Project] to create a Web application project for use as a test client.

Select the created Web application project, and then, in the context menu, select [Properties] > [Java Build Path] > [Projects] tab. Add the Enterprise Bean project targeted for testing.

Creating the EJB test client source

From the [New] wizard, select [EJB] > [J2EE] > [EJB Test Client], and use the wizard to create the EJB test client source.

See below for the wizard settings. Since the EJB test client is being created as a Web application in this case, select "Web" at [Client type].

Point

Developing a test client requires the following classes included in the Enterprise Bean to be tested:

  • If [Client type] is "EJB" or "J2EE1.3".

    • Home interface class and remote interface class (mandatory)

  • If [Client type] id "Web".

    • Local interface class and localhome interface class (mandatory)

  • Common conditions

    • User-defined class to be passed as a parameter or return value in Enterprise Bean invocation (valid when this class is being used)

Note

EJB2.1 applications cannot be accessed from remote environment. Therefore specify [Web] in [Client type] in the EJB Test Client wizard to check the operation of the EJB2.1 application from the created Web application, via the local interface.

A test client cannot be created for an Enterprise Bean that exposed a Stateless Session Bean as a Web service.

If J2EE1.3 is selected as the client type, a J2EE1.3 format deployment descriptor is generated in the EJB test client project, but this project cannot be added to an enterprise application project.

Editing generated files

If required, edit the files generated by wizards.

Run

Deploy the EJB application to be tested and the created Web application to a J2EE execution environment where the IJServer type is [Web and EJB Applications run in the same Java VM], and launch the applications. Check the operation of the Web application from the Web browser.