Version 4


    This document describes the processes by which you can test a Smooks Configuration file (smooks-config.xml, etc.) using the new Smooks Run Configuration in the JBT 3.1.0 CR1 and above.


    (For details about using the Smooks Configuration Editor, click here.)


    The Smooks Run Configuration depends on having all of the appropriate Smooks runtime jars in the path of the Eclipse Plug-in or Java Project in the Eclipse workspace.


    The easiest solution is to do the following:


    1) Download the Smooks distribution from here:


    Grab the latest "ALL" distribution (as of today, it is the Smooks v.1.2.2 "ALL" distribution) and it will include binaries, examples, etc.


    2) Extract files from the archive somewhere on your machine.


    3) In your Eclipse workspace, copy the Smooks jars into a directory of your Eclipse plug-in or Java project named "lib".

    4) For your Eclipse Plug-in or Java Project, right-click on the project and select Properties.


    5) Select the "Java Build Path" item in the Properties list, select the Libraries tab, and click "Add JARs"


    6) In the Jar Selection dialog, select all the jars in the "lib" directory mentioned in step 3 and click OK.


    7) Click OK to close the Properties dialog. You should now see a "Referenced Libraries" node appear in your project hierarchy in Eclipse.


    You can also only bring in the dependencies you need, one at a time, but it is a time consuming process of trial and error.


    Steps for Testing

    If you haven't yet created a Smooks Run Configuration, you must do that first. You can use one of two different methods to create a Smooks Run Configuration.

    Creating a New Smooks Run Configuration using Run As...

    With a Smooks Configuration file selected in the Project Navigator or open in the Smooks Configuration Editor, you can use "Run As..." from the Run toolbar button or the Run menu at the top menu bar. Select "Smooks Run Configuration" from the menu and a new Smooks Run Configuration will be created for the selected or open Smooks Configuration file.


    A Run Configuration created in this way will automatically be run as well. See "Viewing Smooks Configuration Results" below for details.



    Creating a New Smooks Run Configuration from the Run Configurations Dialog

    1) In the Java or Plug-in Development perspective, you can open the Run Configurations dialog using Run -> Run Configurations... from the menubar or use the Run toolbar button drop-down to select Run Configurations...


    2) Find "Smooks Configuration" in the tree of available Run Configurations on the left side of the dialog. Right-click and select New or click the New toolbar button.



    3) Click the Browse button beside the Project field to select the Eclipse Plug-in or Java project which contains your Smooks Configuration.


    4) Then click the Search button beside the Configuration field to select the Smooks Configuration file. If any validation errors for the selected Smooks Configuration, they will appear at the top of the Run Configurations dialog. These must be resolved before you can execute the test.


    5) Click the Run button. Once you've Run the configuration once, it will appear in the Run toolbar button drop-down menu for easier access.


    Viewing Smooks Run Configuration Results


    If any errors or warnings appear, they will pop up in a dialog. And output from the test will appear in the Console view in the Eclipse IDE. Output will appear in one of two forms.


    Either the test runs, but doesn't generate any streaming output and shows this in the Console:


    Nothing to Display:
        - No Java Mappings.
        - No Templates Applied.


    Or the test runs and shows streaming output in the Console like this:


    [StreamResult ...]


        |"Insane","George Finklebine","CA","123 Wacky St.","95021"
        |"Youhoo","George Jehosophat Jr.","CO","456 Bizarro Ln.","80111"
        |"Gracie","George Burns","IL","789 Pushing Daisies Ct.","14560"


    [JavaResult Objects (XML Serialized)...]


        |  <persons class="list">
        |    <smooks.example.Person>
        |      <name>George Finklebine</name>
        |      <street>123 Wacky St.</street>
        |      <city>Insane</city>
        |      <state>CA</state>
        |      <zip>95021</zip>
        |    </smooks.example.Person>
        |    <smooks.example.Person>
        |      <name>George Jehosophat Jr.</name>
        |      <street>456 Bizarro Ln.</street>
        |      <city>Youhoo</city>
        |      <state>CO</state>
        |      <zip>80111</zip>
        |    </smooks.example.Person>
        |    <smooks.example.Person>
        |      <name>George Burns</name>
        |      <street>789 Pushing Daisies Ct.</street>
        |      <city>Gracie</city>
        |      <state>IL</state>
        |      <zip>14560</zip>
        |    </smooks.example.Person>
        |  </persons>


        |  <smooks.example.Person>
        |    <name>George Finklebine</name>
        |    <street>123 Wacky St.</street>
        |    <city>Insane</city>
        |    <state>CA</state>
        |    <zip>95021</zip>
        |  </smooks.example.Person>
        |  <smooks.example.Person>
        |    <name>George Jehosophat Jr.</name>
        |    <street>456 Bizarro Ln.</street>
        |    <city>Youhoo</city>
        |    <state>CO</state>
        |    <zip>80111</zip>
        |  </smooks.example.Person>
        |  <smooks.example.Person>
        |    <name>George Burns</name>
        |    <street>789 Pushing Daisies Ct.</street>
        |    <city>Gracie</city>
        |    <state>IL</state>
        |    <zip>14560</zip>
        |  </smooks.example.Person>


        |  <name>George Burns</name>
        |  <street>789 Pushing Daisies Ct.</street>
        |  <city>Gracie</city>
        |  <state>IL</state>
        |  <zip>14560</zip>