<test>

<span metal:use-macro="container/Zuite_viewTestMacroLibrary/macros/init_test_environment">init</span>
store | http://example.com/erp5 | base_url_x
openAndWait | ${base_url}/Zuite_setUpPersonTest |
verifyTextPresent |
<span metal:use-macro="container/Zuite_viewTestMacroLibrary/macros/wait_for_activities"> Wait for activities </span>
<span metal:use-macro="container/Zuite_viewTestMacroLibrary/macros/login_as_functional_test_user">Login As Functional Test User</span>

</test>

# Agenda

- Create Data Supply
- Create Data Supply Lines

This tutorial teaches how to create Data Supply to prepare Wendelin to receive data sent by fluentd from IoT Gateway.

# Data Supplies

On the modules page click on Data Supplies.

# Add

Click on Add button to add new Data Supply.

# Create Document

Continue with clicking on Create Document.

<test>

openAndWait | ${base_url_x}/web_site_module/default_wendelin_front/ |
waitForElementPresent | //a[contains(@href,'page=front')] |
click | //a[contains(@href,'page=front')] |
waitForElementPresent | //a[contains(@href,'data_supply_module')] |
click | //a[contains(@href,'data_supply_module')] |
waitForElementPresent | //a[@data-i18n="Add"] |
click | //a[@data-i18n="Add"] |
waitForElementPresent | //button[@type="submit" and @data-i18n="Proceed"] |
pause | 3000 |
click | //button[@type="submit" and @data-i18n="Proceed"] |

</test>

# Fill the Form

First fill in the Title and Reference for the Data Supply.

Pay attention on the reference, we name it simply sensor_1 as we have only 1 sensor that will be sending data to wendelin.

This reference will be used in later tutorials when we will configure fluentd.

# Fill the Form Cont.

Imagine an example of a Sample Company that owns a Sample Factory where is a sensor that sends data to wendelin.

Then the source of the data is Sample Factory.

Source - where data comes from.

# Fill the Form Cont.

Continuing the example, the Source Section is Sample Company.

Source Section - owner of data before the ingestion.

# Fill the Form Cont.

Destination - physical place where data is stored.

Destination Section - owner of data after ingestion. Can be the same as the source.

<test>

waitForElementPresent | //input[@id="field_my_title"] |
type | //input[@id="field_my_title"] | Environment Sensor
type | //input[@id="field_my_reference"] | sensor_1
type | //input[@id="field_my_version"] | 001
type | //input[@id="field_my_source_title"] | Sample Factory
fireEvent | //input[@name='field_my_source_title'] | input
waitForElementPresent | //li[@name='Organisation'] |
click | //li[@name='Organisation'] |
type | //input[@id="field_my_source_section_title"] | Sample Company
fireEvent | //input[@name='field_my_source_section_title'] | input
waitForElementPresent | //li[@name='Organisation'] |
click | //li[@name='Organisation'] |
type | //input[@id="field_my_destination_title"] | Nexedi Data Center
fireEvent | //input[@name='field_my_destination_title'] | input
waitForElementPresent | //li[@name='Organisation'] |
click | //li[@name='Organisation'] |
click | //button[@name="submit" and @data-i18n="Save"] |
pause | 5000 |
waitForElementPresent | //button[@type="submit" and @class="success"] |
waitForElementPresent | //a[contains(@href,'Dvalidate_action')] |
click | //a[contains(@href,'Dvalidate_action')] |
waitForElementPresent | //button[@type="submit" and @data-i18n="Proceed"] |
click | //button[@type="submit" and @data-i18n="Proceed"] |
waitForElementPresent | //button[@type="submit" and @class="success"] |
waitForElementPresent | //input[@id="field_my_destination_section_title"] |
type | //input[@id="field_my_destination_section_title"] | Sample Company
fireEvent | //input[@name='field_my_destination_section_title'] | input
waitForElementPresent | //li[contains(@data-relative-url,'organisation_module/')] |
click | //li[contains(@data-relative-url,'organisation_module/')] |
click | //button[@name="submit" and @data-i18n="Save"] |
pause | 5000 |
waitForElementPresent | //button[@type="submit" and @class="success"] |

</test>

# Save

After click on Save button to save the changes.

# Validate

After it is saved, click on Validate on left side panel to validate the Data Supply.

# Confirm Valdation

Click on Validate to confirm validation.

# Add Data Supply Line

Click on Add button to add Data Supply Line.

# Create Document

Continue with clicking on Create Document.

# Fill the Form

Title: Ingest Bucket Data

Reference: ingestion_operation

For Product or Service - data operation by default exists in wendelin. when you type in the field Ingest Data from drop down list choose the existing one.

# Fill the Form Cont.

For Item we choose Data Acquisition Unit that we created in the previous tutorial.

# Save

After click on Save button to save the changes.

# Back to Data Supply

Click on Data Supply Line: Ingest Bucket Data to go back and create another Data Supply line

<test>

waitForElementPresent | //a[@data-i18n="Add"] |
click | //a[@data-i18n="Add"] |
waitForElementPresent | //button[@name="submit"] |
pause | 5000 |
click | //button[@name="submit"] |
waitForElementPresent | //input[@id="field_my_title"] |
type | //input[@id="field_my_title"] | Ingest Bucket Data
type | //input[@id="field_my_reference"] | ingestion_operation
type | //input[@id="field_my_resource_title"] | Ingest Data
fireEvent | //input[@name='field_my_resource_title'] | input
waitForElementPresent | //li[contains(@data-relative-url,'data_operation_module/')] |
click | //li[contains(@data-relative-url,'data_operation_module/')] |
type | //input[@id="field_my_aggregate_title_list"] | Olimex Environment Sensor
fireEvent | //input[@name='field_my_aggregate_title_list'] | input
waitForElementPresent | //li[contains(@data-relative-url,'data_acquisition_unit_module/')] |
click | //li[contains(@data-relative-url,'data_acquisition_unit_module/')] |
click | //button[@name="submit" and @data-i18n="Save"] |
pause | 5000 |
waitForElementPresent | //button[@type="submit" and @class="success"] |
click | //a[contains(@data-i18n, 'Data Supply Line')] |
pause | 5000 |

</test>

# Add Data Supply Line

Click on Add button to add Data Supply Line.

# Create Document

Continue with clicking on Create Document.

# Fill the Form

Title: Sample Environment Data

Reference: out_stream

For Product or Service we choose Data Product that we created in the previous tutorial.

# Fill the Form Cont.

For Use from drop down list choose Big Data/Ingestion/Stream Ingestion.

# Save

After click on Save button to save the changes.

# Data Supply

Data Supply with Data Supply Lines is ready.

<test>

waitForElementPresent | //a[@data-i18n="Add"] |
click | //a[@data-i18n="Add"] |
waitForElementPresent | //button[@name="submit"] |
pause | 5000 |
click | //button[@name="submit"] |
waitForElementPresent | //input[@id="field_my_title"] |
type | //input[@id="field_my_title"] | Sample Environment Data
type | //input[@id="field_my_reference"] | out_stream
type | //input[@id="field_my_resource_title"] | Sample Environment Raw Data
fireEvent | //input[@name='field_my_resource_title'] | input
waitForElementPresent | //li[contains(@data-relative-url,'data_product_module/')] |
click | //li[contains(@data-relative-url,'data_product_module/')] |
select | //select[@id="field_my_use"] | Big Data/Ingestion/Stream Ingestion
click | //button[@name="submit" and @data-i18n="Save"] |
pause | 5000 |
waitForElementPresent | //button[@type="submit" and @class="success"] |
click | //a[contains(@data-i18n, 'Data Supply Line')] |
pause | 5000 |
verifyElementPresent | //input[@value="ingestion_operation"] |
verifyElementPresent | //input[@value="out_stream"] |
open | ${base_url_x}/portal_skins/erp5_wendelin_data_lake/Ingestion_ingestDataStream?reference=sensor_1-sample-environment-raw-data |
pause | 60000 |
openAndWait | ${base_url_x}/web_site_module/default_wendelin_front/ |

</test>