setUp()
The setUp() method for inbound is very similar to that for outbound. Youmay,
however, not need an outbound connection throughthe 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. Waitfor the event to arrive.
5. Assert the correctness of the data after it is sent to the endpoint.
Note: Youcan 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
TwineBallsample that comes with the WebSphere Adapter Toolkit.
Build and execute TwineBall JUnit
Tobuild 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.javain 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 modeTestingthe adapter in managed mode means testing adapter instances on
WebSphereProcess 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 WebSphereProcess Server.
Running tests in managed mode help uncover problems your adapter might have
with the following services provided by WebSphereProcess Server and the
Adapter Foundation Classes:
vConnection management
vTransactionmanagement
vEvent management
WebSphereAdapter development overview 197