Chapter 12. Extended messaging 363
12.4 Unit test
In this section, we will test the Sender bean component independently from the
process where we are going to use this component later.
12.4.1 Creating and configuring a server
Create a new Integration Test Environment with the name EMS_unitTest, then
add the EMS_loggingQueueEAR project to the configured projects list. If you
need detailed steps for this task, refer to “Integration Server V5.1 test
environment setup” on page 563.
Before the code can be executed on the server, some configuration needs to be
peformed.
1. Switch to the Server perspective, then double-click the EMS_unitTest server
in the Server Configuration view to open the server configuration editor.
2. Select the JMS tab and open the Node Settings part.
3. Create a new JMS Connection Factory by clicking the Add button next to the
WASQueueConnectionFactories entries, then specify the settings as shown
in Figure 12-6 on page 364.
364 WebSphere Business Integrator Server Foundation V5.1 Handbook
Figure 12-6 Queue Connection Factory settings
4. Create a queue for the server by clicking Add next to the WASQueue entries.
Use the details shown in Figure 12-7 on page 365.
Chapter 12. Extended messaging 365
Figure 12-7 JMS Queue
5. Scroll down to the Server Settings section in the JMS window.
6. Add the new queue to the list by clicking the Add button and entering
LogQueue in the text box.
7. Switch to the Extended Messaging tab.
8. Scroll down to the Node Settings section and click Add next to the list of
Output Ports. Specify the settings shown in Figure 12-8 on page 366 and click
OK.
366 WebSphere Business Integrator Server Foundation V5.1 Handbook
Figure 12-8 Creating the Extended Messaging Output Port
9. Select the Trace tab and check that Enable trace is selected. Enter the
following Trace string:
com.ibm.ejs.jms.JMSQueueSenderHandle=all=enabled
10.Save and close the configuration.
11.Right-click EMS_unitTest in the workspace Servers view and select Publish
from the menu. You should be presented with a message saying Publishing
was successful.
Note: Make sure you select the JNDI name for the JMS destination, as
shown in Figure 12-8, before you go any further.
Chapter 12. Extended messaging 367
12.4.2 Testing the LogSender in isolation
The following steps will show how to test the Sender bean in isolation,
independently from other application components.
1. Start the EMS_unitTest server.
2. Check that the following messages appear in the console, and that no errors
are reported.
Binding EMSLogOutputPort as ems/nicejourney/LogOutputPort
Binding EMS_testQCF as jms/nicejourney/QCF
Binding LogQueue as jms/nicejourney/logQ
The Extended Messaging service started successfully.
Starting application: EMS_loggingQueueEAR
Preparing to start EJB jar: EMS_loggingQueue.jar
Starting EJB jar: EMS_loggingQueue.jar
Application started: EMS_loggingQueueEAR
3. Switch to the J2EE perspective and select LogSender under the EJB
Modules folder in the J2EE Hierarchy.
4. Right-click the LogSender entry and select Run on Server.... Select Finish.
5. Select Test EJB local interface from the window that is presented, then click
Finish. The IBM Universal Test Client should start.
6. Expand the LogSenderLocal
LogSenderLocalHome tree in the
References pane. Select LogSenderLocal create().
7. Click the Invoke button in the Parameters pane, then click Work with Object.
The test client should now look like Figure 12-9.
Figure 12-9 Test client ready to run the local interface

Get WebSphere Business Integration Server Foundation V5.1 Handbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.