After writing Java™ code
to modify pattern instances, test the code to check that it works
correctly.
About this task
You can test your Java code
either by creating an instance of a pattern and checking that it is
modified as you expect or by using the Java debugger
to step through the code.
Procedure
- To test your user-defined pattern by creating an instance
of the pattern, see Testing a user-defined pattern.
- To use the Java debugger,
you must open a temporary workspace to generate an instance of your
user-defined pattern, then return to the original workspace to step
through the code. To use the Java debugger,
complete the following steps:
- In your Java code
file, add a breakpoint to the required line of code. To add a breakpoint,
right-click the marker bar (vertical ruler) to the left of the required
code and click Toggle Breakpoint.
- In the Pattern Authoring editor, click the Create
Pattern tab.
- Click Debug Pattern.
The Workspace Launcher window opens.
- Select the temporary workspace in which to generate
an instance of your user-defined pattern. Click Browse and
select a workspace or enter a workspace in the Workspace field.
Click OK.
The selected workspace
opens.
- In the temporary workspace, you must generate an instance
of your user-defined pattern. In the Application Development view, click the Patterns
Explorer tab and select your user-defined pattern.
- In the Pattern Specification tab,
click Create New Instance. Enter a name for
the instance of your user-defined pattern and click OK.
- Enter any mandatory pattern parameters and click Generate.
The generation of the pattern instance stops when it reaches
the breakpoint in your Java code.
- In the original workspace, in the Confirm
Perspective Switch window, click Yes.
The original workspace switches to debug mode and shows
the code paused at your breakpoint.
- You can now use the Java debugger
to test your code; see Java Debugger.
- When you have finished testing the code in the Java debugger, close the temporary
workspace and switch back to the Integration Development
perspective in
the original workspace; see IBM App Connect Enterprise Toolkit perspectives.
What to do next
You can either change your Java code
and retest it or you can package and distribute your user-defined
pattern:
To
ensure that changes in your Java code
are included in your generated pattern, change the version number
of the Java plug-in, as described
in the following steps.
- Update the version number of the Java plug-in
in manifest.mf.
- Update the version number of the pattern on the Create
Pattern tab.
- Re-create the pattern plug-ins and pattern archive, as described
in Building pattern plug-ins.
To check that the pattern
archive contains the correct versions of the plug-ins, you can look
at the feature.xml file.
- Install the pattern.