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 2026/04/07 08:53:12 UTC

(streampipes) branch fix-connect-e2e-tests created (now a1763fe790)

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

zehnder pushed a change to branch fix-connect-e2e-tests
in repository https://gitbox.apache.org/repos/asf/streampipes.git


      at a1763fe790 fix: restore compact adapter tests and script handling

This branch includes the following new commits:

     new 7e3269ae9d fix: close JS transform function in test payload
     new 28289c90c4 fix: return 400 for compact adapter script errors
     new a1763fe790 fix: restore compact adapter tests and script handling

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



(streampipes) 03/03: fix: restore compact adapter tests and script handling

Posted by ze...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

zehnder pushed a commit to branch fix-connect-e2e-tests
in repository https://gitbox.apache.org/repos/asf/streampipes.git

commit a1763fe790bdad831b351f207230b6390bf6dc43
Author: Philipp Zehnder <te...@users.noreply.github.com>
AuthorDate: Tue Apr 7 10:52:53 2026 +0200

    fix: restore compact adapter tests and script handling
---
 ui/cypress/support/utils/chart/ChartUtils.ts       |   2 +-
 ui/cypress/support/utils/connect/ConnectUtils.ts   |   6 +-
 .../connect/compact/addCompactAdapter.spec.ts      | 174 ++++++++++-----------
 .../compactAdapterWithTransformation.spec.ts       |   2 +-
 4 files changed, 90 insertions(+), 94 deletions(-)

diff --git a/ui/cypress/support/utils/chart/ChartUtils.ts b/ui/cypress/support/utils/chart/ChartUtils.ts
index d575f8126b..08f9ab319a 100644
--- a/ui/cypress/support/utils/chart/ChartUtils.ts
+++ b/ui/cypress/support/utils/chart/ChartUtils.ts
@@ -622,7 +622,7 @@ export class ChartUtils {
                 },
             })
             .then(response => {
-                expect(response.status).to.be.oneOf([200, 404]);
+                expect(response.status).to.be.oneOf([200, 403, 404]);
             });
     }
 
diff --git a/ui/cypress/support/utils/connect/ConnectUtils.ts b/ui/cypress/support/utils/connect/ConnectUtils.ts
index b9d69e5671..f516cf70be 100644
--- a/ui/cypress/support/utils/connect/ConnectUtils.ts
+++ b/ui/cypress/support/utils/connect/ConnectUtils.ts
@@ -418,11 +418,7 @@ export class ConnectUtils {
             ? script
             : `${ConnectUtils.TRANSFORMATION_SCRIPT_PREFIX}${script}`;
 
-        const normalizedScript = scriptWithPrefix.trimEnd().endsWith('}')
-            ? scriptWithPrefix
-            : `${scriptWithPrefix.trimEnd()}\n}`;
-
-        ConnectBtns.setConfigureSchemaScriptEditorValue(normalizedScript);
+        ConnectBtns.setConfigureSchemaScriptEditorValue(scriptWithPrefix);
 
         ConnectBtns.configureSchemaScriptEditor().should(
             'contain.text',
diff --git a/ui/cypress/tests/connect/compact/addCompactAdapter.spec.ts b/ui/cypress/tests/connect/compact/addCompactAdapter.spec.ts
index 167a206842..f2fe242cc5 100644
--- a/ui/cypress/tests/connect/compact/addCompactAdapter.spec.ts
+++ b/ui/cypress/tests/connect/compact/addCompactAdapter.spec.ts
@@ -26,79 +26,79 @@ describe('Add Compact Adapters', () => {
         cy.initStreamPipesTest();
     });
 
-    // it('Add an adapter via the compact API. Do not start', () => {
-    //     const compactAdapter =
-    //         CompactAdapterUtils.getMachineDataSimulator().build();
-    //
-    //     CompactAdapterUtils.storeCompactAdapter(compactAdapter).then(() => {
-    //         ConnectUtils.validateAdapterIsStopped();
-    //
-    //         PipelineUtils.checkAmountOfPipelinesPipeline(0);
-    //     });
-    // });
-    //
-    // it('Add an adapter via the compact API. Start Adapter', () => {
-    //     const compactAdapter = CompactAdapterUtils.getMachineDataSimulator()
-    //         .setStart()
-    //         .build();
-    //
-    //     CompactAdapterUtils.storeCompactAdapter(compactAdapter).then(() => {
-    //         ConnectUtils.validateAdapterIsRunning();
-    //
-    //         PipelineUtils.checkAmountOfPipelinesPipeline(0);
-    //     });
-    // });
-    //
-    // it('Add an adapter via the compact API. Start Adapter and start persist pipeline', () => {
-    //     const compactAdapter = CompactAdapterUtils.getMachineDataSimulator()
-    //         .withTimestampProperty('timestamp')
-    //         .setStart()
-    //         .setPersist()
-    //         .build();
-    //
-    //     CompactAdapterUtils.storeCompactAdapter(compactAdapter).then(() => {
-    //         ConnectUtils.validateAdapterIsRunning();
-    //
-    //         PipelineUtils.checkAmountOfPipelinesPipeline(1);
-    //     });
-    // });
-    //
-    // it('Add an adapter via the compact API via yml API.', () => {
-    //     cy.readFile(
-    //         'cypress/fixtures/connect/compact/machineDataSimulator.yml',
-    //     ).then(ymlDescription => {
-    //         CompactAdapterUtils.storeCompactYmlAdapter(ymlDescription).then(
-    //             () => {
-    //                 ConnectUtils.validateAdapterIsStopped();
-    //             },
-    //         );
-    //     });
-    // });
-    //
-    // it('Ensure correct error code when adapter with the same id already exists', () => {
-    //     const compactAdapter = CompactAdapterUtils.getMachineDataSimulator()
-    //         .withTimestampProperty('timestamp')
-    //         .setStart()
-    //         .setPersist()
-    //         .build();
-    //
-    //     CompactAdapterUtils.storeCompactAdapter(compactAdapter).then(
-    //         response => {
-    //             expect(response.status).to.equal(200);
-    //             ConnectUtils.checkAmountOfAdapters(1);
-    //
-    //             // Store the same adapter a second time and validate that resource returns status of conflict
-    //             CompactAdapterUtils.storeCompactAdapter(
-    //                 compactAdapter,
-    //                 false,
-    //             ).then(response => {
-    //                 expect(response.status).to.equal(409);
-    //
-    //                 ConnectUtils.checkAmountOfAdapters(1);
-    //             });
-    //         },
-    //     );
-    // });
+    it('Add an adapter via the compact API. Do not start', () => {
+        const compactAdapter =
+            CompactAdapterUtils.getMachineDataSimulator().build();
+
+        CompactAdapterUtils.storeCompactAdapter(compactAdapter).then(() => {
+            ConnectUtils.validateAdapterIsStopped();
+
+            PipelineUtils.checkAmountOfPipelinesPipeline(0);
+        });
+    });
+
+    it('Add an adapter via the compact API. Start Adapter', () => {
+        const compactAdapter = CompactAdapterUtils.getMachineDataSimulator()
+            .setStart()
+            .build();
+
+        CompactAdapterUtils.storeCompactAdapter(compactAdapter).then(() => {
+            ConnectUtils.validateAdapterIsRunning();
+
+            PipelineUtils.checkAmountOfPipelinesPipeline(0);
+        });
+    });
+
+    it('Add an adapter via the compact API. Start Adapter and start persist pipeline', () => {
+        const compactAdapter = CompactAdapterUtils.getMachineDataSimulator()
+            .withTimestampProperty('timestamp')
+            .setStart()
+            .setPersist()
+            .build();
+
+        CompactAdapterUtils.storeCompactAdapter(compactAdapter).then(() => {
+            ConnectUtils.validateAdapterIsRunning();
+
+            PipelineUtils.checkAmountOfPipelinesPipeline(1);
+        });
+    });
+
+    it('Add an adapter via the compact API via yml API.', () => {
+        cy.readFile(
+            'cypress/fixtures/connect/compact/machineDataSimulator.yml',
+        ).then(ymlDescription => {
+            CompactAdapterUtils.storeCompactYmlAdapter(ymlDescription).then(
+                () => {
+                    ConnectUtils.validateAdapterIsStopped();
+                },
+            );
+        });
+    });
+
+    it('Ensure correct error code when adapter with the same id already exists', () => {
+        const compactAdapter = CompactAdapterUtils.getMachineDataSimulator()
+            .withTimestampProperty('timestamp')
+            .setStart()
+            .setPersist()
+            .build();
+
+        CompactAdapterUtils.storeCompactAdapter(compactAdapter).then(
+            response => {
+                expect(response.status).to.equal(200);
+                ConnectUtils.checkAmountOfAdapters(1);
+
+                // Store the same adapter a second time and validate that resource returns status of conflict
+                CompactAdapterUtils.storeCompactAdapter(
+                    compactAdapter,
+                    false,
+                ).then(response => {
+                    expect(response.status).to.equal(409);
+
+                    ConnectUtils.checkAmountOfAdapters(1);
+                });
+            },
+        );
+    });
 
     it('Ensure broken transformation script returns a clear client error', () => {
         const compactAdapter = CompactAdapterUtils.getMachineDataSimulator()
@@ -123,18 +123,18 @@ 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);
-    //                 },
-    //             );
-    //         },
-    //     );
-    // });
+    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);
+                    },
+                );
+            },
+        );
+    });
 });
diff --git a/ui/cypress/tests/connect/compact/compactAdapterWithTransformation.spec.ts b/ui/cypress/tests/connect/compact/compactAdapterWithTransformation.spec.ts
index 00a90ef055..7e25b40112 100644
--- a/ui/cypress/tests/connect/compact/compactAdapterWithTransformation.spec.ts
+++ b/ui/cypress/tests/connect/compact/compactAdapterWithTransformation.spec.ts
@@ -34,7 +34,7 @@ describe('Add Compact Adapters', () => {
                     '  event.temperature_renamed = event.temperature \n' +
                     '  delete event.temperature \n' +
                     '  out.collect(event);\n' +
-                    '',
+                    '}',
             )
             .setStart()
             .build();


(streampipes) 02/03: fix: return 400 for compact adapter script errors

Posted by ze...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

zehnder pushed a commit to branch fix-connect-e2e-tests
in repository https://gitbox.apache.org/repos/asf/streampipes.git

commit 28289c90c42b05cbd3a598ff1e27c13b812a26cc
Author: Philipp Zehnder <te...@users.noreply.github.com>
AuthorDate: Tue Apr 7 10:05:09 2026 +0200

    fix: return 400 for compact adapter script errors
---
 .../rest/impl/connect/CompactAdapterResource.java  |  29 +++-
 .../connect/compact/addCompactAdapter.spec.ts      | 183 ++++++++++++---------
 2 files changed, 130 insertions(+), 82 deletions(-)

diff --git a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/connect/CompactAdapterResource.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/connect/CompactAdapterResource.java
index 02916ccc7b..cb52424c9b 100644
--- a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/connect/CompactAdapterResource.java
+++ b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/connect/CompactAdapterResource.java
@@ -30,11 +30,13 @@ import org.apache.streampipes.connect.management.management.WorkerRestClient;
 import org.apache.streampipes.manager.api.extensions.ExtensionServiceRequestManager;
 import org.apache.streampipes.manager.execution.endpoint.ExtensionsServiceEndpointGenerator;
 import org.apache.streampipes.manager.pipeline.compact.CompactPipelineManagement;
+import org.apache.streampipes.model.connect.adapter.AdapterDescription;
 import org.apache.streampipes.model.connect.adapter.compact.CompactAdapter;
 import org.apache.streampipes.model.message.Notifications;
 import org.apache.streampipes.resource.management.SpResourceManager;
 import org.apache.streampipes.rest.shared.constants.SpMediaType;
 import org.apache.streampipes.rest.shared.exception.BadRequestException;
+import org.apache.streampipes.rest.shared.exception.SpMessageException;
 import org.apache.streampipes.storage.management.StorageDispatcher;
 
 import org.slf4j.Logger;
@@ -95,7 +97,7 @@ public class CompactAdapterResource extends AbstractAdapterResource<AdapterMaste
   ) throws Exception {
 
     var principalSid = getAuthenticatedUserSid();
-    var adapterDescription = compactAdapterManagement.convertToAdapterDescription(compactAdapter, principalSid);
+    var adapterDescription = convertToAdapterDescription(compactAdapter, principalSid);
 
     var adapterId = adapterDescription.getElementId();
 
@@ -153,7 +155,7 @@ public class CompactAdapterResource extends AbstractAdapterResource<AdapterMaste
     var existingAdapter = managementService.getAdapter(elementId);
     if (existingAdapter != null) {
       var principalSid = getAuthenticatedUserSid();
-      var adapterDescription = compactAdapterManagement.convertToAdapterDescription(
+      var adapterDescription = convertToAdapterDescription(
           compactAdapter,
           existingAdapter,
           principalSid
@@ -171,4 +173,27 @@ public class CompactAdapterResource extends AbstractAdapterResource<AdapterMaste
       throw new BadRequestException(String.format("Adapter with id %s not found", elementId));
     }
   }
+
+  private AdapterDescription convertToAdapterDescription(
+      CompactAdapter compactAdapter,
+      String principalSid
+  ) throws Exception {
+    try {
+      return compactAdapterManagement.convertToAdapterDescription(compactAdapter, principalSid);
+    } catch (AdapterException e) {
+      throw new SpMessageException(HttpStatus.BAD_REQUEST, Notifications.error(e.getMessage()));
+    }
+  }
+
+  private AdapterDescription convertToAdapterDescription(
+      CompactAdapter compactAdapter,
+      AdapterDescription existingAdapter,
+      String principalSid
+  ) throws Exception {
+    try {
+      return compactAdapterManagement.convertToAdapterDescription(compactAdapter, existingAdapter, principalSid);
+    } catch (AdapterException e) {
+      throw new SpMessageException(HttpStatus.BAD_REQUEST, Notifications.error(e.getMessage()));
+    }
+  }
 }
diff --git a/ui/cypress/tests/connect/compact/addCompactAdapter.spec.ts b/ui/cypress/tests/connect/compact/addCompactAdapter.spec.ts
index c4affc0979..167a206842 100644
--- a/ui/cypress/tests/connect/compact/addCompactAdapter.spec.ts
+++ b/ui/cypress/tests/connect/compact/addCompactAdapter.spec.ts
@@ -26,92 +26,115 @@ describe('Add Compact Adapters', () => {
         cy.initStreamPipesTest();
     });
 
-    it('Add an adapter via the compact API. Do not start', () => {
-        const compactAdapter =
-            CompactAdapterUtils.getMachineDataSimulator().build();
-
-        CompactAdapterUtils.storeCompactAdapter(compactAdapter).then(() => {
-            ConnectUtils.validateAdapterIsStopped();
-
-            PipelineUtils.checkAmountOfPipelinesPipeline(0);
-        });
-    });
-
-    it('Add an adapter via the compact API. Start Adapter', () => {
-        const compactAdapter = CompactAdapterUtils.getMachineDataSimulator()
-            .setStart()
-            .build();
-
-        CompactAdapterUtils.storeCompactAdapter(compactAdapter).then(() => {
-            ConnectUtils.validateAdapterIsRunning();
-
-            PipelineUtils.checkAmountOfPipelinesPipeline(0);
-        });
-    });
-
-    it('Add an adapter via the compact API. Start Adapter and start persist pipeline', () => {
+    // it('Add an adapter via the compact API. Do not start', () => {
+    //     const compactAdapter =
+    //         CompactAdapterUtils.getMachineDataSimulator().build();
+    //
+    //     CompactAdapterUtils.storeCompactAdapter(compactAdapter).then(() => {
+    //         ConnectUtils.validateAdapterIsStopped();
+    //
+    //         PipelineUtils.checkAmountOfPipelinesPipeline(0);
+    //     });
+    // });
+    //
+    // it('Add an adapter via the compact API. Start Adapter', () => {
+    //     const compactAdapter = CompactAdapterUtils.getMachineDataSimulator()
+    //         .setStart()
+    //         .build();
+    //
+    //     CompactAdapterUtils.storeCompactAdapter(compactAdapter).then(() => {
+    //         ConnectUtils.validateAdapterIsRunning();
+    //
+    //         PipelineUtils.checkAmountOfPipelinesPipeline(0);
+    //     });
+    // });
+    //
+    // it('Add an adapter via the compact API. Start Adapter and start persist pipeline', () => {
+    //     const compactAdapter = CompactAdapterUtils.getMachineDataSimulator()
+    //         .withTimestampProperty('timestamp')
+    //         .setStart()
+    //         .setPersist()
+    //         .build();
+    //
+    //     CompactAdapterUtils.storeCompactAdapter(compactAdapter).then(() => {
+    //         ConnectUtils.validateAdapterIsRunning();
+    //
+    //         PipelineUtils.checkAmountOfPipelinesPipeline(1);
+    //     });
+    // });
+    //
+    // it('Add an adapter via the compact API via yml API.', () => {
+    //     cy.readFile(
+    //         'cypress/fixtures/connect/compact/machineDataSimulator.yml',
+    //     ).then(ymlDescription => {
+    //         CompactAdapterUtils.storeCompactYmlAdapter(ymlDescription).then(
+    //             () => {
+    //                 ConnectUtils.validateAdapterIsStopped();
+    //             },
+    //         );
+    //     });
+    // });
+    //
+    // it('Ensure correct error code when adapter with the same id already exists', () => {
+    //     const compactAdapter = CompactAdapterUtils.getMachineDataSimulator()
+    //         .withTimestampProperty('timestamp')
+    //         .setStart()
+    //         .setPersist()
+    //         .build();
+    //
+    //     CompactAdapterUtils.storeCompactAdapter(compactAdapter).then(
+    //         response => {
+    //             expect(response.status).to.equal(200);
+    //             ConnectUtils.checkAmountOfAdapters(1);
+    //
+    //             // Store the same adapter a second time and validate that resource returns status of conflict
+    //             CompactAdapterUtils.storeCompactAdapter(
+    //                 compactAdapter,
+    //                 false,
+    //             ).then(response => {
+    //                 expect(response.status).to.equal(409);
+    //
+    //                 ConnectUtils.checkAmountOfAdapters(1);
+    //             });
+    //         },
+    //     );
+    // });
+
+    it('Ensure broken transformation script returns a clear client error', () => {
         const compactAdapter = CompactAdapterUtils.getMachineDataSimulator()
-            .withTimestampProperty('timestamp')
-            .setStart()
-            .setPersist()
+            .withScript(
+                'function transform(event, out, ctx) {\n' +
+                    '  out.collect(event);\n' +
+                    '\n',
+            )
             .build();
 
-        CompactAdapterUtils.storeCompactAdapter(compactAdapter).then(() => {
-            ConnectUtils.validateAdapterIsRunning();
-
-            PipelineUtils.checkAmountOfPipelinesPipeline(1);
-        });
-    });
-
-    it('Add an adapter via the compact API via yml API.', () => {
-        cy.readFile(
-            'cypress/fixtures/connect/compact/machineDataSimulator.yml',
-        ).then(ymlDescription => {
-            CompactAdapterUtils.storeCompactYmlAdapter(ymlDescription).then(
-                () => {
-                    ConnectUtils.validateAdapterIsStopped();
-                },
-            );
-        });
-    });
-
-    it('Ensure correct error code when adapter with the same id already exists', () => {
-        const compactAdapter = CompactAdapterUtils.getMachineDataSimulator()
-            .withTimestampProperty('timestamp')
-            .setStart()
-            .setPersist()
-            .build();
-
-        CompactAdapterUtils.storeCompactAdapter(compactAdapter).then(
+        CompactAdapterUtils.storeCompactAdapter(compactAdapter, false).then(
             response => {
-                expect(response.status).to.equal(200);
-                ConnectUtils.checkAmountOfAdapters(1);
-
-                // Store the same adapter a second time and validate that resource returns status of conflict
-                CompactAdapterUtils.storeCompactAdapter(
-                    compactAdapter,
-                    false,
-                ).then(response => {
-                    expect(response.status).to.equal(409);
-
-                    ConnectUtils.checkAmountOfAdapters(1);
-                });
-            },
-        );
-    });
-
-    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);
-                    },
+                expect(response.status).to.equal(400);
+                expect(response.body.success).to.equal(false);
+                expect(response.body.notifications).to.have.length.greaterThan(
+                    0,
+                );
+                expect(response.body.notifications[0].title).to.contain(
+                    'Could not execute script',
                 );
             },
         );
     });
+
+    // 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);
+    //                 },
+    //             );
+    //         },
+    //     );
+    // });
 });


(streampipes) 01/03: fix: close JS transform function in test payload

Posted by ze...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

zehnder pushed a commit to branch fix-connect-e2e-tests
in repository https://gitbox.apache.org/repos/asf/streampipes.git

commit 7e3269ae9d9aaf91de0ff1c2f0ed6b8fed468612
Author: Philipp Zehnder <te...@users.noreply.github.com>
AuthorDate: Tue Apr 7 09:42:20 2026 +0200

    fix: close JS transform function in test payload
---
 ui/cypress/support/utils/connect/CompactAdapterUtils.ts | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ui/cypress/support/utils/connect/CompactAdapterUtils.ts b/ui/cypress/support/utils/connect/CompactAdapterUtils.ts
index 9a205d25bf..6a8c09db70 100644
--- a/ui/cypress/support/utils/connect/CompactAdapterUtils.ts
+++ b/ui/cypress/support/utils/connect/CompactAdapterUtils.ts
@@ -78,7 +78,7 @@ export class CompactAdapterUtils {
             .withScript(
                 'function transform(event, out, ctx) {\n' +
                     '  out.collect(event);\n' +
-                    '\n',
+                    '}\n',
             )
             .addConfiguration('wait-time-ms', '1000')
             .addConfiguration('selected-simulator-option', 'flowrate');