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/10/01 21:23:37 UTC
[incubator-streampipes] branch dev updated: Added e2e tests for
MQTT and Influxdb
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
The following commit(s) were added to refs/heads/dev by this push:
new bd30c24 Added e2e tests for MQTT and Influxdb
bd30c24 is described below
commit bd30c24c22f055f202c1bf56c2601cd1eec8bcc0
Author: Philipp Zehnder <ze...@fzi.de>
AuthorDate: Fri Oct 1 23:23:13 2021 +0200
Added e2e tests for MQTT and Influxdb
---
ui/cypress/tests/adapter/InfluxDbAdapter.ts | 76 ++++++++++++++++++++++
ui/cypress/tests/adapter/MqttAdapter.ts | 69 ++++++++++++++++++++
.../static-secret-input.component.html | 27 ++++----
3 files changed, 159 insertions(+), 13 deletions(-)
diff --git a/ui/cypress/tests/adapter/InfluxDbAdapter.ts b/ui/cypress/tests/adapter/InfluxDbAdapter.ts
new file mode 100644
index 0000000..d1018ce
--- /dev/null
+++ b/ui/cypress/tests/adapter/InfluxDbAdapter.ts
@@ -0,0 +1,76 @@
+/*
+ * 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 { SpecificAdapterBuilder } from '../../support/builder/SpecificAdapterBuilder';
+import { PipelineBuilder } from '../../support/builder/PipelineBuilder';
+import { PipelineElementBuilder } from '../../support/builder/PipelineElementBuilder';
+import { AdapterUtils } from '../../support/utils/AdapterUtils';
+import { PipelineUtils } from '../../support/utils/PipelineUtils';
+
+describe('Test Random Data Simulator Stream Adapter', () => {
+ before('Setup Test', () => {
+ cy.initStreamPipesTest();
+ });
+
+ it('Perform Test', () => {
+ const simulatorAdapterName = 'simulator';
+
+ const machineAdapter = SpecificAdapterBuilder
+ .create('Machine_Data_Simulator')
+ .setName(simulatorAdapterName)
+ .addInput('input', 'wait-time-ms', '1000')
+ .build();
+
+ AdapterUtils.testSpecificStreamAdapter(machineAdapter);
+
+ const topicname = 'cypresstopic';
+ const pipelineInput = PipelineBuilder.create('Pipeline Test')
+ .addSource(simulatorAdapterName)
+ .addSink(
+ PipelineElementBuilder.create('influxdb')
+ .addInput('input', 'db_host', 'http://localhost')
+ .addInput('input', 'db_name', 'sp')
+ .addInput('input', 'db_measurement', topicname)
+ .addInput('input', 'db_user', 'sp')
+ .addInput('input', 'db_password', 'default')
+ .addInput('input', 'batch_interval_actions', '2')
+ .addInput('input', 'max_flush_duration', '{backspace}{backspace}{backspace}{backspace}500')
+ .addInput('drop-down', 'timestamp_mapping', 'timestamp')
+ .build())
+ .build();
+
+ PipelineUtils.testPipeline(pipelineInput);
+
+ const adapterInput = SpecificAdapterBuilder
+ .create('InfluxDB_Stream_Adapter')
+ .setName('InfluxDB Adapter')
+ .setTimestampProperty('time')
+ .setStoreInDataLake()
+ .addInput('input', 'influxDbHost', 'http://localhost')
+ .addInput('input', 'influxDbPort', '8086')
+ .addInput('input', 'influxDbDatabase', 'sp')
+ .addInput('input', 'influxDbMeasurement', topicname)
+ .addInput('input', 'influxDbUsername', 'sp')
+ .addInput('input', 'influxDbPassword', 'default')
+ .addInput('input', 'pollingInterval', '200')
+ .build();
+
+ AdapterUtils.testSpecificStreamAdapter(adapterInput);
+ });
+
+});
diff --git a/ui/cypress/tests/adapter/MqttAdapter.ts b/ui/cypress/tests/adapter/MqttAdapter.ts
new file mode 100644
index 0000000..1fdd730
--- /dev/null
+++ b/ui/cypress/tests/adapter/MqttAdapter.ts
@@ -0,0 +1,69 @@
+/*
+ * 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 { AdapterUtils } from '../../support/utils/AdapterUtils';
+import { GenericAdapterBuilder } from '../../support/builder/GenericAdapterBuilder';
+import { SpecificAdapterBuilder } from '../../support/builder/SpecificAdapterBuilder';
+import { PipelineBuilder } from '../../support/builder/PipelineBuilder';
+import { PipelineElementBuilder } from '../../support/builder/PipelineElementBuilder';
+import { PipelineUtils } from '../../support/utils/PipelineUtils';
+
+describe('Test Random Data Simulator Stream Adapter', () => {
+ before('Setup Test', () => {
+ cy.initStreamPipesTest();
+ });
+
+ it('Perform Test', () => {
+ const simulatorAdapterName = 'simulator';
+
+
+ const machineAdapter = SpecificAdapterBuilder
+ .create('Machine_Data_Simulator')
+ .setName(simulatorAdapterName)
+ .addInput('input', 'wait-time-ms', '1000')
+ .build();
+
+ AdapterUtils.testSpecificStreamAdapter(machineAdapter);
+
+ const topicname = 'cypresstopic';
+ const pipelineInput = PipelineBuilder.create('Pipeline Test')
+ .addSource(simulatorAdapterName)
+ .addSink(
+ PipelineElementBuilder.create('mqtt_publisher')
+ .addInput('input', 'host', 'localhost')
+ .addInput('input', 'topic', topicname)
+ .build())
+ .build();
+
+ PipelineUtils.testPipeline(pipelineInput);
+
+ const adapterInput = GenericAdapterBuilder
+ .create('MQTT')
+ .setName('Adapter Mqtt')
+ .setTimestampProperty('timestamp')
+ .setStoreInDataLake()
+ .addProtocolInput('select', 'Unauthenticated', 'check')
+ .addProtocolInput('input', 'broker_url', 'tcp://localhost:1883')
+ .addProtocolInput('input', 'topic', topicname)
+ .setFormat('json_object')
+ .build();
+
+ AdapterUtils.testGenericStreamAdapter(adapterInput);
+ });
+
+});
diff --git a/ui/src/app/core-ui/static-properties/static-secret-input/static-secret-input.component.html b/ui/src/app/core-ui/static-properties/static-secret-input/static-secret-input.component.html
index 7de9038..54f9ac5 100644
--- a/ui/src/app/core-ui/static-properties/static-secret-input/static-secret-input.component.html
+++ b/ui/src/app/core-ui/static-properties/static-secret-input/static-secret-input.component.html
@@ -18,19 +18,20 @@
<div [formGroup]="parentForm" id="formWrapper" fxFlex="100" fxLayout="column">
<div fxFlex="100" fxLayout="row">
- <mat-form-field fxFlex >
- <input type="password"
- fxFlex
- formControlName="{{fieldName}}"
- matInput
- [placeholder]="staticProperty.label"
- required
- (blur)="emitUpdate()">
- <mat-hint>{{staticProperty.description}}</mat-hint>
+ <mat-form-field fxFlex>
+ <input type="password"
+ fxFlex
+ formControlName="{{fieldName}}"
+ matInput
+ [placeholder]="staticProperty.label"
+ required
+ [attr.data-cy]="fieldName"
+ (blur)="emitUpdate()">
+ <mat-hint>{{staticProperty.description}}</mat-hint>
- <mat-error *ngIf="!fieldValid">
- {{errorMessage}}
- </mat-error>
- </mat-form-field>
+ <mat-error *ngIf="!fieldValid">
+ {{errorMessage}}
+ </mat-error>
+ </mat-form-field>
</div>
</div>
\ No newline at end of file