setUp()
The
setUp()
method for inbound is very similar to that for outbound. You may,
however, not need an outbound connection through the adapter. Accordingly, you
need only perform the following tasks:
1.
Create an adapter instance and set its properties
2.
Start the resource adapter.
Test
The test methods for inbound must do the following:
1.
Prepare the data inside the EIS. In a polling adapter, this would cause the
triggers to fire, populating the event table.
2.
Create a
MockEndpointFactory
, and an
ActivationSpecWithXid
.
3.
Call
endpointActivation()
on the adapter.
4.
Wait for the event to arrive.
5.
Assert the correctness of the data after it is sent to the endpoint.
Note:
You can group your inbound and outbound tests into a single suite, and run
them at once, getting instant feedback in your development environment.
For a detailed and coded example of the procedures described above, see the
TwineBall sample that comes with the WebSphere Adapter Toolkit.
Build and execute TwineBall JUnit
To build and execute TwineBalll JUnit, perform the following steps:
1.
Import in the Twineball, or KiteString source code from the samples gallery.
2.
Find the testcase you want to run. For example, choose AllTest.java in the
com.ibm.j2ca.sample.twineball
package in the tests folder.
3.
Right-click on the class and choose
Run As
→
JUnit Test
.
See the results after the JUnit run. The color green indicates that the test case was
run successfully.
Testing the adapter in managed mode
Testing the adapter in managed mode means testing adapter instances on
WebSphere Process Server. This type of testing, in contrast to testing in unmanaged
mode, more closely reflects the production environment that customers encounter.
Before testing your adapter implementation in managed mode, you must export a
resource adapter EAR file to WebSphere Process Server.
Running tests in managed mode help uncover problems your adapter might have
with the following services provided by WebSphere Process Server and the
Adapter Foundation Classes:
v
Connection management
v
Transaction management
v
Event management
WebSphere Adapter development overview
197
Summary of Contents for WebSphere Adapter Toolkit
Page 2: ......
Page 6: ...iv WebSphere Adapters WebSphere Adapter Toolkit User Guide...
Page 220: ...214 WebSphere Adapters WebSphere Adapter Toolkit User Guide...
Page 224: ...218 WebSphere Adapters WebSphere Adapter Toolkit User Guide...
Page 225: ......
Page 226: ...Printed in USA...