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

SvenO3 pushed a commit to branch 
5193-fix-missing-icons-and-documentation-during-extension-migration
in repository https://gitbox.apache.org/repos/asf/streampipes.git


The following commit(s) were added to 
refs/heads/5193-fix-missing-icons-and-documentation-during-extension-migration 
by this push:
     new 718d427da1 Remove deletion of existing assets
718d427da1 is described below

commit 718d427da1ee0d14b5ecb5567517096eb62a748d
Author: Sven Oehler <[email protected]>
AuthorDate: Tue Nov 3 14:04:07 2026 +0100

    Remove deletion of existing assets
---
 .../manager/verification/ElementVerifier.java      | 10 ++++++++-
 .../manager/verification/TypedElementVerifier.java | 17 +++++----------
 .../manager/verification/TypeExtractorTest.java    | 25 ++++++++++++++++++++++
 3 files changed, 39 insertions(+), 13 deletions(-)

diff --git 
a/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/verification/ElementVerifier.java
 
b/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/verification/ElementVerifier.java
index 9abfeb8f31..50db874da2 100644
--- 
a/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/verification/ElementVerifier.java
+++ 
b/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/verification/ElementVerifier.java
@@ -100,6 +100,7 @@ public abstract class ElementVerifier<T extends 
NamedStreamPipesEntity> {
         storeAssets(service);
       } catch (IOException | NoServiceEndpointsAvailableException e) {
         LOG.error("Could not store assets for app id '{}'", 
elementDescription.getAppId(), e);
+        return assetErrorMessage();
       }
       return successMessage();
     } else {
@@ -119,6 +120,7 @@ public abstract class ElementVerifier<T extends 
NamedStreamPipesEntity> {
       updateAssets(service);
     } catch (IOException | NoServiceEndpointsAvailableException e) {
       LOG.error("Could not update assets for app id '{}'", 
elementDescription.getAppId(), e);
+      return assetErrorMessage();
     }
     return successMessage();
 
@@ -129,11 +131,17 @@ public abstract class ElementVerifier<T extends 
NamedStreamPipesEntity> {
 
   protected void updateAssets(SpServiceRegistration service) throws 
IOException, NoServiceEndpointsAvailableException {
     if (elementDescription.isIncludesAssets()) {
-      assetManager.deleteAsset(elementDescription.getAppId());
       storeAssets(service);
     }
   }
 
+  private Message assetErrorMessage() {
+    return new ErrorMessage(elementDescription.getName(), List.of(
+        NotificationType.STORAGE_SUCCESS.uiNotification(),
+        new Notification("Asset update failed", "The element description was 
stored, but its assets could not be updated. "
+            + "Please retry the update.")));
+  }
+
   private Message successMessage() {
     List<Notification> notifications = new ArrayList<>();
     notifications.add(NotificationType.STORAGE_SUCCESS.uiNotification());
diff --git 
a/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/verification/TypedElementVerifier.java
 
b/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/verification/TypedElementVerifier.java
index c899129ffc..5f1a12dae7 100644
--- 
a/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/verification/TypedElementVerifier.java
+++ 
b/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/verification/TypedElementVerifier.java
@@ -18,18 +18,14 @@
 
 package org.apache.streampipes.manager.verification;
 
-import 
org.apache.streampipes.commons.exceptions.NoServiceEndpointsAvailableException;
 import 
org.apache.streampipes.manager.api.extensions.ExtensionServiceRequestManager;
-import 
org.apache.streampipes.manager.execution.endpoint.ExtensionsServiceEndpointGenerator;
 import org.apache.streampipes.model.base.NamedStreamPipesEntity;
 import 
org.apache.streampipes.model.extensions.svcdiscovery.SpServiceRegistration;
 import org.apache.streampipes.resource.management.SpResourceManager;
 import 
org.apache.streampipes.storage.api.pipeline.IPipelineElementDescriptionStorage;
-import org.apache.streampipes.svcdiscovery.api.ISpServiceDiscovery;
 import org.apache.streampipes.svcdiscovery.api.model.SpServiceUrlProvider;
 
 import java.io.IOException;
-import java.util.Set;
 import java.util.function.Consumer;
 import java.util.function.Predicate;
 
@@ -40,7 +36,6 @@ public class TypedElementVerifier<T extends 
NamedStreamPipesEntity> extends Elem
   private final Consumer<T> updateOperation;
   private final SpServiceUrlProvider serviceUrlProvider;
   private final ExtensionServiceRequestManager requestManager;
-  private final ISpServiceDiscovery serviceDiscovery;
 
   public TypedElementVerifier(
       String graphData,
@@ -59,7 +54,6 @@ public class TypedElementVerifier<T extends 
NamedStreamPipesEntity> extends Elem
     this.updateOperation = updateOperation;
     this.serviceUrlProvider = serviceUrlProvider;
     this.requestManager = requestManager;
-    this.serviceDiscovery = resourceManager.getServiceDiscovery();
   }
 
   public TypedElementVerifier(
@@ -78,7 +72,6 @@ public class TypedElementVerifier<T extends 
NamedStreamPipesEntity> extends Elem
     this.updateOperation = updateOperation;
     this.serviceUrlProvider = serviceUrlProvider;
     this.requestManager = requestManager;
-    this.serviceDiscovery = resourceManager.getServiceDiscovery();
   }
 
   @Override
@@ -96,12 +89,12 @@ public class TypedElementVerifier<T extends 
NamedStreamPipesEntity> extends Elem
   }
 
   @Override
-  protected void storeAssets(SpServiceRegistration service) throws 
IOException, NoServiceEndpointsAvailableException {
+  protected void storeAssets(SpServiceRegistration service) throws IOException 
{
     if (elementDescription.isIncludesAssets()) {
-      var assetService = service != null ? service
-          : new ExtensionsServiceEndpointGenerator(serviceDiscovery)
-              .selectService(elementDescription.getAppId(), 
serviceUrlProvider, Set.of());
-      assetManager.storeAsset(serviceUrlProvider, 
elementDescription.getAppId(), requestManager, assetService);
+      if (service == null) {
+        throw new IOException("No source service provided for assets of " + 
elementDescription.getAppId());
+      }
+      assetManager.storeAsset(serviceUrlProvider, 
elementDescription.getAppId(), requestManager, service);
     }
   }
 }
diff --git 
a/streampipes-pipeline-management/src/test/java/org/apache/streampipes/manager/verification/TypeExtractorTest.java
 
b/streampipes-pipeline-management/src/test/java/org/apache/streampipes/manager/verification/TypeExtractorTest.java
index 2d46f596b1..4b13bc0774 100644
--- 
a/streampipes-pipeline-management/src/test/java/org/apache/streampipes/manager/verification/TypeExtractorTest.java
+++ 
b/streampipes-pipeline-management/src/test/java/org/apache/streampipes/manager/verification/TypeExtractorTest.java
@@ -36,11 +36,14 @@ import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
 import static org.junit.jupiter.api.Assertions.assertThrows;
 import static org.junit.jupiter.api.Assertions.assertTrue;
 import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.never;
 import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.verifyNoInteractions;
 import static org.mockito.Mockito.when;
 
 public class TypeExtractorTest {
@@ -109,6 +112,28 @@ public class TypeExtractorTest {
     assertEquals(NotificationType.STORAGE_SUCCESS.title(), 
message.getNotifications().get(0).getTitle());
   }
 
+  @Test
+  public void updateWithoutAssetsDoesNotRequireAService() throws 
SepaParseException {
+    var message = new TypeExtractor(payload(SpDataStream.class), storageApi, 
requestManager, resourceManager)
+        .getTypeVerifier().verifyAndUpdate(null);
+
+    assertTrue(message.isSuccess());
+    verifyNoInteractions(requestManager);
+    verify(resourceManager, never()).getServiceDiscovery();
+  }
+
+  @Test
+  public void updateWithAssetsReportsMissingServiceWithoutDiscovery() throws 
SepaParseException {
+    var description = 
payload(DataSinkDescription.class).replace("\"elementId\"", 
"\"includesAssets\":true,\"elementId\"");
+    var message = new TypeExtractor(description, storageApi, requestManager, 
resourceManager)
+        .getTypeVerifier().verifyAndUpdate(null);
+
+    assertFalse(message.isSuccess());
+    assertTrue(message.getNotifications().stream().anyMatch(n -> 
n.getTitle().equals("Asset update failed")));
+    verifyNoInteractions(requestManager);
+    verify(resourceManager, never()).getServiceDiscovery();
+  }
+
   @Test
   public void missingClassProperty_throwsSepaParseException() {
     assertThrows(

Reply via email to