You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streampipes.apache.org by ze...@apache.org on 2021/12/07 08:51:53 UTC

[incubator-streampipes] 02/02: [STREAMPIPES-449] Add test for rate limit processor

This is an automated email from the ASF dual-hosted git repository.

zehnder pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/incubator-streampipes.git

commit f45d9a3d11ee53363f904ba0f27f4302af288e91
Author: Philipp Zehnder <ze...@fzi.de>
AuthorDate: Tue Dec 7 09:51:39 2021 +0100

    [STREAMPIPES-449] Add test for rate limit processor
---
 .../filters-jvm/rateLimit1/description.json        | 25 ++++++++++++++++++++++
 .../filters-jvm/rateLimit1/expected.csv            |  3 +++
 .../filters-jvm/rateLimit1/input.csv               | 12 +++++++++++
 ui/cypress/support/utils/StaticPropertyUtils.ts    |  2 +-
 .../static-alternatives.component.html             |  4 ++--
 .../static-one-of-input.component.html             |  2 +-
 6 files changed, 44 insertions(+), 4 deletions(-)

diff --git a/ui/cypress/fixtures/pipelineElement/filters-jvm/rateLimit1/description.json b/ui/cypress/fixtures/pipelineElement/filters-jvm/rateLimit1/description.json
new file mode 100644
index 0000000..bf2d851
--- /dev/null
+++ b/ui/cypress/fixtures/pipelineElement/filters-jvm/rateLimit1/description.json
@@ -0,0 +1,25 @@
+{
+  "name": "rate_limit",
+  "config": [
+    {
+      "type": "radio",
+      "selector": "grouping-enabled",
+      "value": "False"
+    },
+    {
+      "type": "radio",
+      "selector": "window-type",
+      "value": "Length Window"
+    },
+    {
+      "type": "input",
+      "selector": "undefined-length-window-size-2",
+      "value": "5"
+    },
+    {
+      "type": "radio",
+      "selector": "event-selection",
+      "value": "Last"
+    }
+  ]
+}
diff --git a/ui/cypress/fixtures/pipelineElement/filters-jvm/rateLimit1/expected.csv b/ui/cypress/fixtures/pipelineElement/filters-jvm/rateLimit1/expected.csv
new file mode 100644
index 0000000..0d663ca
--- /dev/null
+++ b/ui/cypress/fixtures/pipelineElement/filters-jvm/rateLimit1/expected.csv
@@ -0,0 +1,3 @@
+time;randomnumber
+1623871494000;22.0
+1623871499000;26.0
diff --git a/ui/cypress/fixtures/pipelineElement/filters-jvm/rateLimit1/input.csv b/ui/cypress/fixtures/pipelineElement/filters-jvm/rateLimit1/input.csv
new file mode 100644
index 0000000..0291979
--- /dev/null
+++ b/ui/cypress/fixtures/pipelineElement/filters-jvm/rateLimit1/input.csv
@@ -0,0 +1,12 @@
+timestamp;randomnumber
+1623871490000;62.0
+1623871491000;46.0
+1623871492000;41.0
+1623871493000;41.0
+1623871494000;22.0
+1623871495000;56.0
+1623871496000;95.0
+1623871497000;77.0
+1623871498000;85.0
+1623871499000;26.0
+1623871500000;21.0
diff --git a/ui/cypress/support/utils/StaticPropertyUtils.ts b/ui/cypress/support/utils/StaticPropertyUtils.ts
index 708287c..674c2f2 100644
--- a/ui/cypress/support/utils/StaticPropertyUtils.ts
+++ b/ui/cypress/support/utils/StaticPropertyUtils.ts
@@ -29,7 +29,7 @@ export class StaticPropertyUtils {
       } else if (config.type === 'drop-down') {
         cy.dataCy(config.selector).click().get('mat-option').contains(config.value).click();
       } else if (config.type === 'radio') {
-        cy.dataCy(config.selector + config.value).click();
+        cy.dataCy(config.selector.replace(' ', '_').toLowerCase() + '-' + config.value.replace(' ', '_').toLowerCase()).click();
       } else if (config.type === 'click') {
         cy.dataCy(config.selector).click({ force: true });
       } else if (config.type === 'code-input') {
diff --git a/ui/src/app/core-ui/static-properties/static-alternatives/static-alternatives.component.html b/ui/src/app/core-ui/static-properties/static-alternatives/static-alternatives.component.html
index 52769e8..4ce775a 100644
--- a/ui/src/app/core-ui/static-properties/static-alternatives/static-alternatives.component.html
+++ b/ui/src/app/core-ui/static-properties/static-alternatives/static-alternatives.component.html
@@ -26,7 +26,7 @@
                                   [value]="alternative"
                                   [checked]="alternative.selected"
                                   [matTooltip]="alternative.description"
-                                  [attr.data-cy]="alternative.label">
+                                  [attr.data-cy]="staticProperty.internalName.replace(' ',  '_').toLowerCase() + '-' + alternative.label.replace(' ',  '_').toLowerCase()">
                     <label style="font-weight: normal;">
                         {{alternative.label}}
                     </label>
@@ -63,4 +63,4 @@
     </div>
 
 
-</div>
\ No newline at end of file
+</div>
diff --git a/ui/src/app/core-ui/static-properties/static-one-of-input/static-one-of-input.component.html b/ui/src/app/core-ui/static-properties/static-one-of-input/static-one-of-input.component.html
index aed2912..fc31acc 100644
--- a/ui/src/app/core-ui/static-properties/static-one-of-input/static-one-of-input.component.html
+++ b/ui/src/app/core-ui/static-properties/static-one-of-input/static-one-of-input.component.html
@@ -26,7 +26,7 @@
                                       [value]="option"
                                       (click)="select(option.elementId)"
                                       [checked]="option.selected"
-                                      [attr.data-cy]="staticProperty.internalName + option.name">
+                                      [attr.data-cy]="staticProperty.internalName.replace(' ',  '_').toLowerCase() + '-' + option.name.replace(' ',  '_').toLowerCase()">
                         <label style="font-weight: normal">
                             {{option.name}}
                         </label>