From 7227b514788952dc7fc377e6767a0d8f95b0b08d Mon Sep 17 00:00:00 2001 From: Philipp Zehnder Date: Mon, 11 Nov 2024 15:55:07 +0100 Subject: [PATCH] fix(#3325): Add a test to validate file stream adapter via compact API --- .../fixtures/connect/compact/compactTest.csv | 2 + .../fixtures/connect/compact/fileReplay.yml | 40 +++++++++++++++++++ .../connect/compact/addCompactAdapter.spec.ts | 16 ++++++++ 3 files changed, 58 insertions(+) create mode 100644 ui/cypress/fixtures/connect/compact/compactTest.csv create mode 100644 ui/cypress/fixtures/connect/compact/fileReplay.yml diff --git a/ui/cypress/fixtures/connect/compact/compactTest.csv b/ui/cypress/fixtures/connect/compact/compactTest.csv new file mode 100644 index 0000000000..6cf117f7c1 --- /dev/null +++ b/ui/cypress/fixtures/connect/compact/compactTest.csv @@ -0,0 +1,2 @@ +timestamp;value;temperature +1000;1.0;0.1 diff --git a/ui/cypress/fixtures/connect/compact/fileReplay.yml b/ui/cypress/fixtures/connect/compact/fileReplay.yml new file mode 100644 index 0000000000..3c57795f10 --- /dev/null +++ b/ui/cypress/fixtures/connect/compact/fileReplay.yml @@ -0,0 +1,40 @@ +# 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. + +id: sp:adapterdescription:IfmzfQ +name: File Stream Adapter Test +description: '' +appId: org.apache.streampipes.connect.iiot.protocol.stream.file +configuration: + - filePath: compactTest.csv + - replaceTimestamp: + - '' + - replayOnce: 'no' + - speed: keepOriginalTime + - delimiter: ; + format: CSV + header: + - Header +schema: + timestamp: + description: '' + propertyScope: HEADER_PROPERTY + semanticType: http://schema.org/DateTime +transform: + rename: {} + measurementUnit: {} +createOptions: + persist: true + start: true diff --git a/ui/cypress/tests/connect/compact/addCompactAdapter.spec.ts b/ui/cypress/tests/connect/compact/addCompactAdapter.spec.ts index c19e345f8d..57d2466c15 100644 --- a/ui/cypress/tests/connect/compact/addCompactAdapter.spec.ts +++ b/ui/cypress/tests/connect/compact/addCompactAdapter.spec.ts @@ -19,6 +19,7 @@ import { ConnectUtils } from '../../../support/utils/connect/ConnectUtils'; import { CompactAdapterUtils } from '../../../support/utils/connect/CompactAdapterUtils'; import { PipelineUtils } from '../../../support/utils/pipeline/PipelineUtils'; +import { FileManagementUtils } from '../../../support/utils/FileManagementUtils'; describe('Add Compact Adapters', () => { beforeEach('Setup Test', () => { @@ -96,4 +97,19 @@ describe('Add Compact Adapters', () => { }, ); }); + + it('Add file stream adapter via the compact API. Start Adapter with Pipeline', () => { + FileManagementUtils.addFile('connect/compact/compactTest.csv'); + + cy.readFile('cypress/fixtures/connect/compact/fileReplay.yml').then( + ymlDescription => { + CompactAdapterUtils.storeCompactYmlAdapter(ymlDescription).then( + () => { + ConnectUtils.validateAdapterIsRunning(); + PipelineUtils.checkAmountOfPipelinesPipeline(1); + }, + ); + }, + ); + }); });