This is an automated email from the ASF dual-hosted git repository.
zehnder pushed a commit to branch STREAMPIPES-380
in repository https://gitbox.apache.org/repos/asf/incubator-streampipes.git
The following commit(s) were added to refs/heads/STREAMPIPES-380 by this push:
new 6024036 Add test description json to define pe tests
6024036 is described below
commit 60240363e1fcc6a59fb07a772852125b53decf94
Author: Philipp Zehnder <[email protected]>
AuthorDate: Fri Jun 25 20:38:15 2021 +0200
Add test description json to define pe tests
---
.../booleanInverter1/description.json | 6 ++++
.../pipelineElement/fieldRenamer1/description.json | 7 ++++
.../pipelineElement/fieldRenamer1/expected.csv | 22 ++++++------
.../pipelineElement/fieldRenamer1/input.csv | 22 ++++++------
.../numericalFilter1/description.json | 8 +++++
.../pipelineElement/numericalFilter1/expected.csv | 12 +++----
.../pipelineElement/numericalFilter1/input.csv | 22 ++++++------
.../integration/adapter/machineDataSimulator.ts | 2 --
...{booleanInverter1.ts => AllPipelineElements.ts} | 19 +++++-----
...eldRenamerTest1.ts => SinglePipelineElement.ts} | 28 +++++++--------
.../pipelineElement/numericalFilterTest1.ts | 40 ----------------------
ui/cypress/plugins/index.ts | 28 +++++++++++++--
.../general/readDir.ts} | 33 ++++++++++++------
ui/cypress/support/index.ts | 1 +
14 files changed, 131 insertions(+), 119 deletions(-)
diff --git
a/ui/cypress/fixtures/pipelineElement/booleanInverter1/description.json
b/ui/cypress/fixtures/pipelineElement/booleanInverter1/description.json
new file mode 100644
index 0000000..56832b6
--- /dev/null
+++ b/ui/cypress/fixtures/pipelineElement/booleanInverter1/description.json
@@ -0,0 +1,6 @@
+{
+ "name": "boolean_inverter",
+ "config": [
+ {"type": "drop-down", "selector": "invert-field", "value":
"booleanToInvert"}
+ ]
+}
\ No newline at end of file
diff --git a/ui/cypress/fixtures/pipelineElement/fieldRenamer1/description.json
b/ui/cypress/fixtures/pipelineElement/fieldRenamer1/description.json
new file mode 100644
index 0000000..cae3a21
--- /dev/null
+++ b/ui/cypress/fixtures/pipelineElement/fieldRenamer1/description.json
@@ -0,0 +1,7 @@
+{
+ "name": "field_renamer",
+ "config": [
+ {"type": "drop-down", "selector": "convert-property", "value": "count"},
+ {"type": "input", "selector": "field-name", "value": "newname"}
+ ]
+}
\ No newline at end of file
diff --git a/ui/cypress/fixtures/pipelineElement/fieldRenamer1/expected.csv
b/ui/cypress/fixtures/pipelineElement/fieldRenamer1/expected.csv
index c977de6..9bea824 100644
--- a/ui/cypress/fixtures/pipelineElement/fieldRenamer1/expected.csv
+++ b/ui/cypress/fixtures/pipelineElement/fieldRenamer1/expected.csv
@@ -1,11 +1,11 @@
-time;newname;randomnumber;randomtext;sp_internal_label;timestamp
-1623871499055;122.0;62.0;c;;1.623871499055E12
-1623871500059;123.0;46.0;a;;1.623871500059E12
-1623871501064;124.0;41.0;b;;1.623871501064E12
-1623871502070;125.0;41.0;b;;1.62387150207E12
-1623871503078;126.0;22.0;b;;1.623871503078E12
-1623871504082;127.0;56.0;a;;1.623871504082E12
-1623871505084;128.0;95.0;b;;1.623871505084E12
-1623871506086;129.0;77.0;a;;1.623871506086E12
-1623871507091;130.0;85.0;b;;1.623871507091E12
-1623871508093;131.0;22.0;a;;1.623871508093E12
+time;newname;sp_internal_label;timestamp
+1623871499055;122.0;;1.623871499055E12
+1623871500059;123.0;;1.623871500059E12
+1623871501064;124.0;;1.623871501064E12
+1623871502070;125.0;;1.62387150207E12
+1623871503078;126.0;;1.623871503078E12
+1623871504082;127.0;;1.623871504082E12
+1623871505084;128.0;;1.623871505084E12
+1623871506086;129.0;;1.623871506086E12
+1623871507091;130.0;;1.623871507091E12
+1623871508093;131.0;;1.623871508093E12
diff --git a/ui/cypress/fixtures/pipelineElement/fieldRenamer1/input.csv
b/ui/cypress/fixtures/pipelineElement/fieldRenamer1/input.csv
index 2420ef5..ac4fd1b 100644
--- a/ui/cypress/fixtures/pipelineElement/fieldRenamer1/input.csv
+++ b/ui/cypress/fixtures/pipelineElement/fieldRenamer1/input.csv
@@ -1,11 +1,11 @@
-timestamp;count;randomnumber;randomtext
-1623871499055;122.0;62.0;c
-1623871500059;123.0;46.0;a
-1623871501064;124.0;41.0;b
-1623871502070;125.0;41.0;b
-1623871503078;126.0;22.0;b
-1623871504082;127.0;56.0;a
-1623871505084;128.0;95.0;b
-1623871506086;129.0;77.0;a
-1623871507091;130.0;85.0;b
-1623871508093;131.0;22.0;a
+timestamp;count
+1623871499055;122.0
+1623871500059;123.0
+1623871501064;124.0
+1623871502070;125.0
+1623871503078;126.0
+1623871504082;127.0
+1623871505084;128.0
+1623871506086;129.0
+1623871507091;130.0
+1623871508093;131.0
diff --git
a/ui/cypress/fixtures/pipelineElement/numericalFilter1/description.json
b/ui/cypress/fixtures/pipelineElement/numericalFilter1/description.json
new file mode 100644
index 0000000..e6e16f9
--- /dev/null
+++ b/ui/cypress/fixtures/pipelineElement/numericalFilter1/description.json
@@ -0,0 +1,8 @@
+{
+ "name": "numerical_filter",
+ "config": [
+ {"type": "drop-down", "selector": "number-mapping", "value":
"randomnumber"},
+ {"type": "radio", "selector": "operation", "value": "\\>"},
+ {"type": "input", "selector": "value", "value": "50"}
+ ]
+}
\ No newline at end of file
diff --git a/ui/cypress/fixtures/pipelineElement/numericalFilter1/expected.csv
b/ui/cypress/fixtures/pipelineElement/numericalFilter1/expected.csv
index 4695aee..3bf1f2e 100644
--- a/ui/cypress/fixtures/pipelineElement/numericalFilter1/expected.csv
+++ b/ui/cypress/fixtures/pipelineElement/numericalFilter1/expected.csv
@@ -1,6 +1,6 @@
-time;count;randomnumber;randomtext;sp_internal_label;timestamp
-1623871499055;122.0;62.0;c;;1.623871499055E12
-1623871504082;127.0;56.0;a;;1.623871504082E12
-1623871505084;128.0;95.0;b;;1.623871505084E12
-1623871506086;129.0;77.0;a;;1.623871506086E12
-1623871507091;130.0;85.0;b;;1.623871507091E12
+time;randomnumber;sp_internal_label;timestamp
+1623871499055;62.0;;1.623871499055E12
+1623871504082;56.0;;1.623871504082E12
+1623871505084;95.0;;1.623871505084E12
+1623871506086;77.0;;1.623871506086E12
+1623871507091;85.0;;1.623871507091E12
diff --git a/ui/cypress/fixtures/pipelineElement/numericalFilter1/input.csv
b/ui/cypress/fixtures/pipelineElement/numericalFilter1/input.csv
index 2420ef5..c5fb22e 100644
--- a/ui/cypress/fixtures/pipelineElement/numericalFilter1/input.csv
+++ b/ui/cypress/fixtures/pipelineElement/numericalFilter1/input.csv
@@ -1,11 +1,11 @@
-timestamp;count;randomnumber;randomtext
-1623871499055;122.0;62.0;c
-1623871500059;123.0;46.0;a
-1623871501064;124.0;41.0;b
-1623871502070;125.0;41.0;b
-1623871503078;126.0;22.0;b
-1623871504082;127.0;56.0;a
-1623871505084;128.0;95.0;b
-1623871506086;129.0;77.0;a
-1623871507091;130.0;85.0;b
-1623871508093;131.0;22.0;a
+timestamp;randomnumber
+1623871499055;62.0
+1623871500059;46.0
+1623871501064;41.0
+1623871502070;41.0
+1623871503078;22.0
+1623871504082;56.0
+1623871505084;95.0
+1623871506086;77.0
+1623871507091;85.0
+1623871508093;22.0
diff --git a/ui/cypress/integration/adapter/machineDataSimulator.ts
b/ui/cypress/integration/adapter/machineDataSimulator.ts
index d5ede86..7b7c07f 100644
--- a/ui/cypress/integration/adapter/machineDataSimulator.ts
+++ b/ui/cypress/integration/adapter/machineDataSimulator.ts
@@ -20,7 +20,6 @@ import { AdapterUtils } from
'../../support/utils/AdapterUtils';
import { SpecificAdapterBuilder } from
'../../support/builder/SpecificAdapterBuilder';
describe('Test Random Data Simulator Stream Adapter', () => {
-
const adapterInput = SpecificAdapterBuilder
.create('Machine_Data_Simulator')
.setName('Machine Data Simulator Test')
@@ -28,5 +27,4 @@ describe('Test Random Data Simulator Stream Adapter', () => {
.build();
AdapterUtils.testSpecificStreamAdapter(adapterInput);
-
});
diff --git a/ui/cypress/integration/pipelineElement/booleanInverter1.ts
b/ui/cypress/integration/pipelineElement/AllPipelineElements.ts
similarity index 67%
rename from ui/cypress/integration/pipelineElement/booleanInverter1.ts
rename to ui/cypress/integration/pipelineElement/AllPipelineElements.ts
index b2778d2..ca85e1b 100644
--- a/ui/cypress/integration/pipelineElement/booleanInverter1.ts
+++ b/ui/cypress/integration/pipelineElement/AllPipelineElements.ts
@@ -17,22 +17,19 @@
*/
import { ProcessingElementTestUtils } from
'../../support/utils/ProcessingElementTestUtils';
-import { PipelineElementBuilder } from
'../../support/builder/PipelineElementBuilder';
-import { ProcessorTestBuilder } from
'../../support/builder/ProcessorTestBuilder';
+import { ProcessorTest } from '../../support/model/ProcessorTest';
-describe('Test Field Renamer 1', () => {
+const allTests = Cypress.env('processingElements');
+
+allTests.forEach(test => {
+ describe('Test Processor ' + test['name'], () => {
it('Login', () => {
- cy.login();
+ cy.login();
});
- const processorTest = ProcessorTestBuilder.create('booleanInverter1')
- .setProcessor(
- PipelineElementBuilder.create('boolean_inverter')
- .addInput('drop-down', 'invert-field', 'booleanToInvert')
- .build())
- .build();
+ const processorTest = test as ProcessorTest;
ProcessingElementTestUtils.testElement(processorTest);
-
+ });
});
diff --git a/ui/cypress/integration/pipelineElement/fieldRenamerTest1.ts
b/ui/cypress/integration/pipelineElement/SinglePipelineElement.ts
similarity index 61%
rename from ui/cypress/integration/pipelineElement/fieldRenamerTest1.ts
rename to ui/cypress/integration/pipelineElement/SinglePipelineElement.ts
index 50f3c2b..f2a007b 100644
--- a/ui/cypress/integration/pipelineElement/fieldRenamerTest1.ts
+++ b/ui/cypress/integration/pipelineElement/SinglePipelineElement.ts
@@ -17,23 +17,23 @@
*/
import { ProcessingElementTestUtils } from
'../../support/utils/ProcessingElementTestUtils';
-import { PipelineElementBuilder } from
'../../support/builder/PipelineElementBuilder';
-import { ProcessorTestBuilder } from
'../../support/builder/ProcessorTestBuilder';
+import { ProcessorTest } from '../../support/model/ProcessorTest';
-describe('Test Field Renamer 1', () => {
+const allTests = Cypress.env('processingElements');
- it('Login', () => {
- cy.login();
- });
+allTests.forEach(test => {
+ const testName = 'fieldRenamer1';
- const processorTest = ProcessorTestBuilder.create('fieldRenamer1')
- .setProcessor(
- PipelineElementBuilder.create('field_renamer')
- .addInput('drop-down', 'convert-property', 'count')
- .addInput('input', 'field-name', 'newname')
- .build())
- .build();
+ const processorTest = test as ProcessorTest;
- ProcessingElementTestUtils.testElement(processorTest);
+ if (processorTest.name === testName) {
+ describe('Test Processor ' + test['name'], () => {
+ it('Login', () => {
+ cy.login();
+ });
+
+ ProcessingElementTestUtils.testElement(processorTest);
+ });
+ }
});
diff --git a/ui/cypress/integration/pipelineElement/numericalFilterTest1.ts
b/ui/cypress/integration/pipelineElement/numericalFilterTest1.ts
deleted file mode 100644
index 06402c4..0000000
--- a/ui/cypress/integration/pipelineElement/numericalFilterTest1.ts
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-import { ProcessingElementTestUtils } from
'../../support/utils/ProcessingElementTestUtils';
-import { PipelineElementBuilder } from
'../../support/builder/PipelineElementBuilder';
-import { ProcessorTest } from '../../support/model/ProcessorTest';
-import { ProcessorTestBuilder } from
'../../support/builder/ProcessorTestBuilder';
-
-describe('Test Numerical Filter 1', () => {
-
- it('Login', () => {
- cy.login();
- });
-
- const processorTest = ProcessorTestBuilder.create('numericalFilter1')
- .setProcessor(
- PipelineElementBuilder.create('numerical_filter')
- .addInput('drop-down', 'number-mapping', 'randomnumber')
- .addInput('radio', 'operation', '\\>')
- .addInput('input', 'value', '50')
- .build())
- .build();
-
- ProcessingElementTestUtils.testElement(processorTest);
-});
diff --git a/ui/cypress/plugins/index.ts b/ui/cypress/plugins/index.ts
index d1af6b8..bcd1c95 100644
--- a/ui/cypress/plugins/index.ts
+++ b/ui/cypress/plugins/index.ts
@@ -27,8 +27,32 @@
// ***********************************************************
// This function is called when a project is opened or re-opened (e.g. due to
// the project's config changing)
+import * as fs from 'fs';
+import { ProcessorTest } from '../support/model/ProcessorTest';
+
+function readProcessingElements(): ProcessorTest[] {
+ const result: ProcessorTest[] = [];
+
+ const allPipelineTests = fs.readdirSync('cypress/fixtures/pipelineElement');
+
+ allPipelineTests.forEach(test => {
+ const testDescription =
fs.readFileSync('cypress/fixtures/pipelineElement/' + test +
'/description.json');
+ // @ts-ignore
+ const pt = new ProcessorTest();
+ pt.name = test;
+ // @ts-ignore
+ pt.processor = JSON.parse(testDescription);
+
+ result.push(pt);
+ });
+
+ return result;
+}
+
module.exports = (on, config) => {
- // `on` is used to hook into various events Cypress emits
- // `config` is the resolved Cypress config
+
+ config.env.processingElements = readProcessingElements();
+
+ return config;
};
diff --git a/ui/cypress/integration/adapter/machineDataSimulator.ts
b/ui/cypress/support/general/readDir.ts
similarity index 61%
copy from ui/cypress/integration/adapter/machineDataSimulator.ts
copy to ui/cypress/support/general/readDir.ts
index d5ede86..8869cd3 100644
--- a/ui/cypress/integration/adapter/machineDataSimulator.ts
+++ b/ui/cypress/support/general/readDir.ts
@@ -16,17 +16,28 @@
*
*/
-import { AdapterUtils } from '../../support/utils/AdapterUtils';
-import { SpecificAdapterBuilder } from
'../../support/builder/SpecificAdapterBuilder';
+import * as fs from 'fs';
-describe('Test Random Data Simulator Stream Adapter', () => {
+declare global {
+ namespace Cypress {
+ interface Chainable {
+ /**
+ * Login into streampipes with standard test user
+ * @example cy.login();
+ */
+ readDir: typeof readDir;
+ }
+ }
+}
- const adapterInput = SpecificAdapterBuilder
- .create('Machine_Data_Simulator')
- .setName('Machine Data Simulator Test')
- .addInput('input', 'wait-time-ms', '1000')
- .build();
+export const readDir = (dir: string) => {
+ fs.readdir(dir, (err: any, files: any[]) => {
+ if (err) {
+ return console.log('Unable to scan directory: ' + err);
+ }
+ files.forEach((file) => {
+ console.log('file: ' + file);
+ });
+ });
- AdapterUtils.testSpecificStreamAdapter(adapterInput);
-
-});
+};
diff --git a/ui/cypress/support/index.ts b/ui/cypress/support/index.ts
index a9467ec..60f803f 100644
--- a/ui/cypress/support/index.ts
+++ b/ui/cypress/support/index.ts
@@ -26,5 +26,6 @@ import 'cypress-file-upload';
Cypress.Commands.add('login', login);
Cypress.Commands.add('logout', logout);
Cypress.Commands.add('dataCy', dataCy);
+// Cypress.Commands.add('readDir', readDir);