...
The MQTT Extensions are custom extensions for Parasoft SOAtest and Virtualize. You can use the extensions on the client side to perform many tasks:
- Publish to a topic.
- Subscribe to a topic filter until the desired number of messages are received or a specified duration elapses.
- Monitor a topic filter during test execution to perform validations on the events that occur.
On the server side, you can use the listener extension to subscribe to a topic filter then publish to a topic based on the incoming subscription messages.
The following custom extensions are provided for MQTT integration:
...
This tool can be installed from the UI or command line. Download and unzip the compressed folder in a convenient location prior to starting the installation process.
UI Installation
- Choose Parasoft> Go to Parasoft > Preferences and click System Properties in the sidebar menu.
- Click Add JARs and navigate to select the mqtt.jar file.
- Click Apply.
- Restart SOAtest.
Command Line Installation
Add the mqtt.jar file to the system.properties.classpath
property in your local settings properties file. For example:
system.properties.classpath=<path to jar><PATH_TO_JAR>/mqtt.jar
MQTT Transport
- Add a Message Client to a test and switch the transport to Custom Extension.
- Choose MQTT from the Select Implementation drop-down menu.
Configuration
You can configure the following settings.
Anchor | ||||
---|---|---|---|---|
|
Click the Connection tab to configure the connection settings.
...
Broker URL | Defines the URL of the MQTT broker in the following format:
This field is required. If the defined protocol is | ||||||
---|---|---|---|---|---|---|---|
Client ID | Defines the client ID to use when connecting to the broker. If left blank, the client ID will be generated by the MQTT broker. | ||||||
Username | Defines the username to use when connecting to the broker. | ||||||
Password | Defines the password to use when connecting to the broker. | ||||||
Connection Timeout
| Defines the maximum seconds allowed to establish a connection to the MQTT broker. Default: The default is | ||||||
Keep Alive Interval
| Defines the maximum interval before disconnecting an idle MQTT client. Default: The default is | ||||||
Clean Session
| Enables/disables clean sessions.
Default: The default is | ||||||
Client Persistence Directory
| Defines a directory to store client persistence files. Client persistence is useful if Clean Session is set to Default: The default is |
...
Scroll Table Layout | ||
---|---|---|
|
Topic | Defines to which topic to publish the message to. |
---|---|
Quality of Service | Defines the quality-of-service metric that's tied to the published message. Possible values are |
Retain Message on Server | Enables/disables retaining the message on the server. Setting to Retained messages are solicited to clients upon subscription to a topic regardless of their Clean Session settings. Default: The default is |
Anchor | ||||
---|---|---|---|---|
|
...
Scroll Table Layout | ||
---|---|---|
|
Topic | Defines to which topic to publish the LWT to. |
---|---|
Will Payload | Defines the payload of the LWT. Default: The default is |
Quality of Service | Defines the quality-of-service metric that's tied to the LWT. Possible values are |
Retain Message on Server | Enables/disables retaining the LWT on the server. Setting to true retains the LWT. Retained messages are solicited to clients upon subscription to a topic regardless of their Clean Session settings. Default: The default is |
Anchor | ||||
---|---|---|---|---|
|
The TLS settings must be configured when the protocol is set to ssl
or wss
in the Broker URL field so that secure connections can be established properly.
...
TLS Protocol | Defines the Transport Layer Protocol to use when establishing a secure connection. Default: The default is |
---|---|
Key Manager Factory | Defines the Key Manager Factory used to manage the keys provided in the Key Store File. Different Key Managers are available depending on the security providers that have been loaded into the JVM. If additional security providers have been added to the JVM, check the security provider's documentation to gather the available factory names. Default: The default is |
Key Store File Location | Defines an absolute or relative path to the asset (.tst, .pva, .pvn) key store file. |
Key Store Type | Defines the type of Key Store File provided. Different Key Store Types can be handled depending on the security providers that have been loaded into the JVM. If additional security providers have been added to the JVM, check the security provider's documentation to gather the available Key Store Type names. |
Key Store Password | Defines the password to be used to extract the keys/certificates from the Key Store File.If If left blank, an attempt will be made to extract the keys without a password. |
Trust Manager Factory | Defines the Trust Manager Factory used to manage the keys provided in the Trust Store File. Different Trust Managers are available depending on the security providers that have been loaded into the JVM. If additional security providers have been added to the JVM, check the security provider's documentation to gather the available factory names. Default: The default is |
Trust Store File Location | Defines an absolute or relative path to the asset (.tst, .pva, .pvn) Trust Store file. Default: The default is |
Trust Store Type | Defines the type of Trust Store File provided. Different Trust Store Types can be handled depending on the security providers that have been loaded into the JVM. If additional security providers have been added to the JVM, check the security provider's documentation to gather the available Trust Store Type names. |
Trust Store Password | Defines the password to be used to extract the keys/certificates from the Trust Store File. If left blank, an attempt will be made to extract the keys without a password. |
Connection Management Settings
Click the Connection Management tab to configure the connection management settings.
...
Topic Filter
| Defines the topic filter to use when establishing a subscription. You can use the special wildcards The Example: For the topics
This field is required. | ||||||
---|---|---|---|---|---|---|---|
Quality of Service
| Defines the quality of service (QoS) level of the subscription. Messages published at a lower QoS will be received at the published QoS. Messages published at a higher QoS will be received using the QoS specified in this setting. Default: The default is | ||||||
Max Messages | Defines the maximum number of messages to wait for before ending the subscription. Default: The default is | ||||||
Subscription Duration. | Defines the maximum number of milliseconds that a topic filter can be subscribed to when the Max Messages is set to | ||||||
Timestamp Format
| Defines the formatting of the timestamps that are generated with each message that arrives. Default: The default is To define custom timestamp formats please see the SimpleDateFormat Javadocs: http://docs.oracle.com/javase/8/docs/api/java/text/SimpleDateFormat.html |
...
Topic Filter | See Topic Filter for a description of how to configure this field. This field is required. |
---|---|
Quality of Service | See Quality of Service for a description on how to configure this field. |
Publish Settings
See Publish Settings for details on how to configure this page.
...
- Add an event monitor to a test.
- In the Event Source tab, choose Custom/API-based events source from the Platform dropdown menu.
- In the Event Retrieval section, choose Subscribe to an event producer from the Pattern drop-down menu.
- In the User Code section, choose Java from the Language drop-down menu.
- Enter "com.parasoft.soavirt.mqtt.event.MqttEventMonitor" in the Class field of the User Code section.
- Choose getEventSubscriber(String, String, String, Context) from the Method drop-down menu of the User Code section.
...
URL | Defines the broker URL. The broker URL is defined differently in the Event Monitor than in the other tooling. Use the following pattern to configure the broker URL:
This field is required. If the SSL protocol is defined, the MQTT Configure Tool must be used to configure the Transport Layer Security (TLS) settings for the client. If You cannot use wildcards in the URL to define the topic filter or else the URL will not parse properly. To use wildcards in your topic filter, omit the topic filter from the URL declaration and define the topic filter using the MQTT Configure Tool. You can define a custom timestamp format of the message arrival events with the MQTT Configure Tool. |
---|---|
Username | Defines the username to use when connecting to the broker. |
Password | Defines the password to use when connecting to the broker. |
...
- Click the Profiles node under Load Test Configuration.
- Click the Setup/Teardown Options tab in the Project Configuration panel and enable the Run once per virtual user option.
Third-party Content
This extension includes items that have been sourced from third parties as outlined below.
...