Test the Extension

In this task, you build the purchase project and test the new REST service using a REST client. Testing requires a Gateway Proxy pointing to a running MATRIXX Engine.

About this task

For information about installing and managing MATRIXX, see MATRIXX Installation and Upgrade.

For more information about the MATRIXX environment variables, see the discussion about container directories and environment variables in MATRIXX Installation and Upgrade.

Procedure

  1. Go to to the /mtxsdk/projects/target/purchase directory.
  2. Copy the extensions.jar file to the /opt/mtx/ext/common directory.
  3. Edit the /opt/mtx/conf/extension-containers.yaml file.
    Note: If this file does not exist, you must create it.
  4. Add the MDC definition files to extension-containers.yaml.
    For example:
    extension-core: /extension-containers.yaml
    Extension-rest: /extension-rest-mdc.xml
  5. Copy the libraries or dependencies to /opt/mtx/ext/common the directory.
  6. Build the project.
    At the command prompt, type:
    mvn clean install
  7. Copy the rsgwextension.jar file to the /opt/mtx/ext/rsgateway directory.
  8. Enter the following command to restart RS Gateway:
    sudo systemctl restart mtx_rsgateway
  9. Check the RS Gateway log file (/var/log/mtx/rsgateway.log) to confirm that the extensions loaded correctly.
  10. Configure the Gateway Proxy on the local pod to communicate with a running engine.
    See the discussion about configuring the Gateway Proxy in MATRIXX Installation and Upgrade.
  11. Using your REST client, send the following request.
    URL:
    POST http://localhost:8080/rsgateway/data/json/demo/subscriber/1-2-3-4/offer
    Request Body:
    {"Type": "phone", "Amount": 52.99, "Color":rose-gold}

Results

If the purchase project is working correctly, you should see the following response.
{
"$": "DemoResultSubscriberPurchase",
"Result": 0,
"ResultText": "Ok -> hello from DemoServices",
"_resultCode": 0,
"_resultText": "Ok -> hello from DemoServices",
"_resultType": "Create"
}

What to do next

Update the REST service.