Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Published by Scroll Versions from space FUNCTDEV and version SVC2025.2

...

After setting up your environment as described in General Procedure of Adding an Extension virt, implement the following interfaces (described in the Extensibility API documentation):

...

After you have implemented the necessary classes, define parasoft-extension.xml (introduced in General Procedure of Adding an Extension virt) as follows:

Code Block
<?xml version="1.0" encoding="UTF-8"?>
<extension xmlns="urn:com/parasoft/extensibility-framework/extension"
       type="messageListener" 
       name='The name of your message listener, appears in the transports menu' 
       description='A more detailed description'>
  <class>com.mycompany.MyMessageListener</class> <!-- implements ICustomMessageListener-->
  <form xmlns="urn:com/parasoft/extensibility-framework/gui">
       <!-- This describes the fields you wish to appear in your transport GUI --> 
       <section label="field group 1">
          <field id="key 1" label="field 1"/>
          <field id="key 2" label="field 2"/> 
          ...
          <section label="field group 2">
          <field id="key 3" label="field 3" />
      </section>
      <section label="field group 2">
          <field label="field 1" />
          ...
      </section>
      ...
  </form>
</extension>

...

After building the project as described in General Procedure of Adding an Extension virt, restart Virtualize and verify that the custom listener name (as specified in parasoft-extension.xml) appears in the Transports > Custom tab of the Virtual Asset configuration panel (opened by double-clicking a virtual asset’s Virtualize Server node).

...

  • The values provided to the extension GUI are saved as a name-value String map. As a result, rearranging the fields in the form element in parasoft-extension.xml will not affect how the user values are saved; however, changing the IDs will affect this. The IDs are used to save/load the values so they need to be unique. If you change them, then previously saved configurations will not load the previous values and will become empty. However, you can use a version updater to migrate old settings saved with old IDs to a new set of IDs. 
  • Only GUI fields with string values are supported in the custom form GUI. If your extension requires integers or other types, then you may convert the string content to the desired type in the extension implementation.
  • If you want a GUI field to serve as a password field (with inputs masked and the specified password saved securely), give that field element a password attribute that is set to true. For example, the following sets the pwd field to password mode:

    Code Block
    <form xmlns="urn:com/parasoft/extensibility-framework/gui">
         <section label="Main Settings">
            <field id="usr" label="Username"/>
            <field id="pwd" label="Password" password="true"/>
         </section> 
    </form>
  • Tables or lists can be implemented as comma-separated values in the string fields.
  • To provide visibility into events and errors related to this custom listener, you can call logging from ApplicationContext Application.getContext() (in the Extensibility API). Events can be categorized as INFO, ERROR, WARN, and DEBUG, categories which can be used as filter criteria in the SOAtest Event Monitor. We recommend that you invoke the method reportEvent(String message, String type) directly on the context that is passed in because that will automatically populate the source of the event (that is, which responder and PVA it is coming from). For example:
    Code Block
    // In your startup method:
    Application.getContext().reportEvent("My Message Listener started", ScriptingContext.INFO);
    
    // For error cases:
    Application.getContext().reportEvent("Failed to start listener: " + errorMessage, ScriptingContext.ERROR);
    
    // For debugging:
    Application.getContext().reportEvent("Processing message", ScriptingContext.DEBUG);