Step 3: Test the Siddhi Application¶
Any Siddhi application created for a business purpose needs to be tested before it is used to process actual data in order to ensure that it functions as expected. In order to facilitate testing, WSO2 Streaming Integrator Tooling includes an event simulator.
In Step 2: Create a Siddhi Application, you created the
TemperatureApp Siddhi application to calculate the average of every three temperature readings. In this section we are simulating ten temperature readings. The following table shows the temperature read with each simulated event, and the average that should be output for every event.
|Event No||Temperature||Calculated Average
(Calculated by the Siddhi Appllication)
To test the
TemperatureApp Siddhi application you created in Step 2: Create a Siddhi Application via this event simulator, follow the steps below.
Before you begin:
For this scenaro, you need to simulate multiple events from a file. For this purpose, download the tempReadings.csv file.
In the Streaming Integrator Tooling, click the following icon for event simulation on the side panel.
The Simulation panel opens as shown below.
Click on the Feed Simulation tab of the simulation panel, and click Create.
This opens a new panel for feed simulation.
In the panel for feed simulation that opened, enter information as follows:
In the fields in the top section of the panel, enter information as follows:
Field Value Simulation Name
Simulating Temperature Readings
In the Simulation Source field, select CSV file. Then click Add Simulation Source.
This adds a new section named CSV file Source 1: TemperatureApp to the panel.
In the CSV file Source 1: TemperatureApp section, enter information as follows:
Field Value Siddhi App Name
CSV file Click Upload. Then click Choose File and browse for the tempReadings.csv file that you downloaded.
Click Upload in the Upload CSV dialog box.
Click Save. The simulation you added is now displayed in the Feed Simulation tab as follows.
Click the play button for the simulation.
In the Start the Siddhi Application dialog box that appears, click Start Simulation.
The output is logged in the console as follows:
Once you have tested and ensured that the
TemperatureApp Siddhi application functions as expected, you can deploy it to process actual data. To do this, proceed to Step 4: Deploy the Siddhi Application.