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/11/02 20:11:21 UTC

[incubator-streampipes] 02/03: [STREAMPIPES-445] Add test for adapter monitoring

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

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

commit 9654e67202e8d2fb826e282bb029f1c3d0093a34
Author: Philipp Zehnder <ze...@fzi.de>
AuthorDate: Tue Nov 2 11:17:06 2021 +0100

    [STREAMPIPES-445] Add test for adapter monitoring
---
 ui/cypress/support/utils/AdapterUtils.ts           |  6 ++
 ui/cypress/tests/adapter/testMonitoringAdapter.ts  | 68 +++++++++++-----------
 .../existing-adapters.component.html               |  1 +
 3 files changed, 42 insertions(+), 33 deletions(-)

diff --git a/ui/cypress/support/utils/AdapterUtils.ts b/ui/cypress/support/utils/AdapterUtils.ts
index 9321a46..a4314f6 100644
--- a/ui/cypress/support/utils/AdapterUtils.ts
+++ b/ui/cypress/support/utils/AdapterUtils.ts
@@ -188,6 +188,12 @@ export class AdapterUtils {
     cy.get('button').contains('Close').parent().click();
   }
 
+  public static openAdapterDetails(adapterName: string) {
+    cy.visit('#/connect');
+    cy.get('div').contains('My Adapters').parent().click();
+    cy.dataCy('details-' + adapterName).click();
+  }
+
   public static deleteAdapter() {
     // Delete adapter
     cy.visit('#/connect');
diff --git a/ui/cypress/tests/adapter/testMonitoringAdapter.ts b/ui/cypress/tests/adapter/testMonitoringAdapter.ts
index 9f8dd57..6b77e93 100644
--- a/ui/cypress/tests/adapter/testMonitoringAdapter.ts
+++ b/ui/cypress/tests/adapter/testMonitoringAdapter.ts
@@ -17,45 +17,47 @@
  */
 
 import { AdapterUtils } from '../../support/utils/AdapterUtils';
-import { GenericAdapterBuilder } from '../../support/builder/GenericAdapterBuilder';
-import { FileManagementUtils } from '../../support/utils/FileManagementUtils';
 
 describe('Test File Stream Adapter', () => {
   before('Setup Test', () => {
-    cy.initStreamPipesTest();
-    FileManagementUtils.addFile('fileTest/random.csv');
+    // cy.initStreamPipesTest();
+    // FileManagementUtils.addFile('fileTest/random.csv');
+    cy.login();
   });
 
   it('Perform Test', () => {
-    const one = GenericAdapterBuilder
-      .create('File_Stream')
-      .setName('File Stream Adapter Test 1')
-      .setTimestampProperty('timestamp')
-      .addProtocolInput('input', 'speed', '1')
-      .addProtocolInput('checkbox', 'replaceTimestamp', 'check')
-      .setFormat('csv')
-      .addFormatInput('input', 'delimiter', ';')
-      .addFormatInput('checkbox', 'header', 'check');
-    AdapterUtils.testGenericStreamAdapter(one.build());
-
-    one.setName('File Stream Adapter Test 1');
-    AdapterUtils.testGenericStreamAdapter(one.build());
-
-    const adapterInput = GenericAdapterBuilder
-      .create('Apache_Kafka')
-      .setName('Internal Monitor Adapter')
-      .setTimestampProperty('timestamp')
-      .setStoreInDataLake()
-      .addDimensionProperty('adapterId')
-      .addProtocolInput('select', 'Unauthenticated', 'check')
-      .addProtocolInput('input', 'host', 'localhost')
-      .addProtocolInput('input', 'port', '9094')
-      .addProtocolInput('click', 'sp-reload', '')
-      .addProtocolInput('select', 'adapterstatus', 'check')
-      .setFormat('json_object')
-      .build();
-
-    AdapterUtils.testGenericStreamAdapter(adapterInput);
+
+    const adapterName = 'testmonitoring';
+
+    // const one = GenericAdapterBuilder
+    //   .create('File_Stream')
+    //   .setName(adapterName)
+    //   .setTimestampProperty('timestamp')
+    //   .addProtocolInput('input', 'speed', '1')
+    //   .addProtocolInput('checkbox', 'replaceTimestamp', 'check')
+    //   .setFormat('csv')
+    //   .addFormatInput('input', 'delimiter', ';')
+    //   .addFormatInput('checkbox', 'header', 'check');
+    //
+    // AdapterUtils.testGenericStreamAdapter(one.build());
+    //
+    // const adapterInput = GenericAdapterBuilder
+    //   .create('Apache_Kafka')
+    //   .setName('Internal Monitor Adapter')
+    //   .setTimestampProperty('timestamp')
+    //   .setStoreInDataLake()
+    //   .addDimensionProperty('adapterId')
+    //   .addProtocolInput('select', 'Unauthenticated', 'check')
+    //   .addProtocolInput('input', 'host', 'localhost')
+    //   .addProtocolInput('input', 'port', '9094')
+    //   .addProtocolInput('click', 'sp-reload', '')
+    //   .addProtocolInput('select', 'adapterstatus', 'check')
+    //   .setFormat('json_object')
+    //   .build();
+    //
+    // AdapterUtils.testGenericStreamAdapter(adapterInput);
+
+    AdapterUtils.openAdapterDetails(adapterName);
   });
 
 });
diff --git a/ui/src/app/connect/components/data-marketplace/existing-adapters/existing-adapters.component.html b/ui/src/app/connect/components/data-marketplace/existing-adapters/existing-adapters.component.html
index 9fd91d5..4120a25 100644
--- a/ui/src/app/connect/components/data-marketplace/existing-adapters/existing-adapters.component.html
+++ b/ui/src/app/connect/components/data-marketplace/existing-adapters/existing-adapters.component.html
@@ -86,6 +86,7 @@
                     <div fxLayout="row">
                         <span fxFlex fxFlexOrder="1" fxLayout="row" fxLayoutAlign="center center">
                             <button (click)="showAdapterDetails(adapter)"
+                                    [attr.data-cy]="'details-' + adapter.name"
                                     color="accent"
                                     mat-button
                                     mat-icon-button