Skip to content

Martini Services Running Groovy Classes

After creating and configuring your Groovy service in Martini, you'll want to test it by running the service. The process to run a Groovy service is streamlined and user-friendly.

Running from the Navigator View

  1. Invoke in Browser:

    • In the Navigator view, right-click on the Groovy class or script containing the service you intend to run.
    • Select 'Invoke in Browser' from the context menu. This opens a dialog where you can choose the specific service you wish to execute.

    Alternative Invocation via HTTP Client

    Martini also offers invocation through the HTTP Client, a feature-rich tool for composing and testing API requests. This method is particularly useful for more advanced service testing and invocation scenarios.

  2. Selecting the Service:

    • From the service selection dialog, pick the service you want to run. If your script or class inherits from another, you may find additional inherited services. These can be revealed by checking the "Show hidden services" option.
  3. Invoke the Service:

    • Click 'OK' or 'Invoke' to proceed. This action will open a new browser tab with the service invoker interface.
    • The service invoker displays detailed information about the service, including its description, parameters, and options for request and response types, along with the invocation URL.

Running from the Groovy Editor

  • Inline Invocation:

    • Open the Groovy service file in the editor.
    • Locate the run icon next to the line number at the method signature and click on it to invoke the service directly.
    • This triggers the service invoker window, similar to the process via the Navigator view.

    Invoking services from the editor

Tips for Effective Running of Groovy Services

  • Input Parameters: Before invoking a service, make sure all necessary input parameters are correctly populated.
  • Leveraging Groovydoc: Utilize Groovydoc for a clear understanding of each service's functionality and parameters.
  • Testing Variations: To ensure robust service performance, test with various input values to simulate different operational scenarios.

Groovy services in Martini are a blend of convenience and power, aiding in efficient API development and testing.