1 - Debug an existing process script





Create Test class from template



Last updated
We are creating a new, empty script file in our project. Then we copy and paste the code of an existing process script into the file. We create a Test to host the script, and we debug the existing script with IntelliJ.
Right click on training and select New -> Package, aka: new folder.

Call the package: training.example01 . Right click on example01` and add a new, blank Groovy Script. Call it psgNull - null: it does nothing, no functionality!

Goto to Boomi Integration and create a new Process Script, call it psgNull

Copy the code and paste it into the psgNull.groovy file.

IntelliJ gives us some warnings (yellow bars to the right): Unused Imports and Unnecessary Semicolon - fix it, or leave it. Just to mention here that you eventually want to read and recognize what IntelliJ tells you.
Set a breakpoint on line 8, we want to stop there:

Now, we want to debug that script, and we need a Test as a host to run the process script locally.
Right click on the example01 folder select New -> Boomi Process Script Test and provide the Map-Script name (from above: psgNull) without psg:

Tip!
The MyScripts IntelliJ project comes with four pre-configured templates, to create new Tests and Scripts. If you have
Project Files Bar -> Options (three dots) -> Appearance -> View Excluded Files
enabled, you will see the files in the project directory under .idea\fileTemplates.
More information on that topic in the IntelliJ Help.
Open the created Test_Null, click the green arrow and Debug method test01().

The code execution is going to halt in the debugger in our Boomi Script psgNull.groovyon line 8.

Select dataContext.getDataCount(), right click and Evaluate Expression... to see the data: value = 1.
Big question: A value of 1 means, the script has got one document! The question is, where did it come from?
Last updated
import java.util.Properties;
import java.io.InputStream;
for( int i = 0; i < dataContext.getDataCount(); i++ ) {
InputStream is = dataContext.getStream(i);
Properties props = dataContext.getProperties(i);
dataContext.storeStream(is, props);
}