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 2022/10/25 20:13:23 UTC
[incubator-streampipes] branch STREAMPIPES-597 updated: [STREAMPIPES-597] Add backend code to get all pipelines containing a specific pipeline element
This is an automated email from the ASF dual-hosted git repository.
zehnder pushed a commit to branch STREAMPIPES-597
in repository https://gitbox.apache.org/repos/asf/incubator-streampipes.git
The following commit(s) were added to refs/heads/STREAMPIPES-597 by this push:
new ed40ad24b [STREAMPIPES-597] Add backend code to get all pipelines containing a specific pipeline element
ed40ad24b is described below
commit ed40ad24b7c4b7d9d46dadb45b4920f133167210
Author: Philipp Zehnder <ze...@fzi.de>
AuthorDate: Tue Oct 25 22:12:57 2022 +0200
[STREAMPIPES-597] Add backend code to get all pipelines containing a specific pipeline element
---
.../manager/pipeline/PipelineManager.java | 217 +++++++++++----------
.../manager/pipeline/TestPipelineManager.java | 21 +-
.../pipeline/TestPipelinesContainingElements.java | 88 +++++++++
.../streampipes/rest/impl/PipelineResource.java | 17 +-
.../datalake/DataLakeNoUserManagementV3Test.java | 211 --------------------
.../generator/pipeline/DummyPipelineGenerator.java | 4 +-
.../pipelineelement/DummyProcessorGenerator.java | 2 +
.../pipelineelement/DummySinkGenerator.java | 2 +
.../pipelineelement/DummyStreamGenerator.java | 27 +++
.../existing-adapters.component.ts | 2 +-
.../can-not-edit-adapter-dialog.component.html | 4 +-
11 files changed, 265 insertions(+), 330 deletions(-)
diff --git a/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/pipeline/PipelineManager.java b/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/pipeline/PipelineManager.java
index e67b97554..f04fb513d 100644
--- a/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/pipeline/PipelineManager.java
+++ b/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/pipeline/PipelineManager.java
@@ -18,10 +18,11 @@
package org.apache.streampipes.manager.pipeline;
+import com.google.common.collect.Streams;
import org.apache.streampipes.commons.random.UUIDGenerator;
import org.apache.streampipes.manager.operations.Operations;
import org.apache.streampipes.manager.permission.PermissionManager;
-import org.apache.streampipes.manager.storage.UserService;
+import org.apache.streampipes.model.base.NamedStreamPipesEntity;
import org.apache.streampipes.model.client.user.Permission;
import org.apache.streampipes.model.pipeline.Pipeline;
import org.apache.streampipes.model.pipeline.PipelineOperationStatus;
@@ -31,105 +32,123 @@ import org.apache.streampipes.storage.management.StorageDispatcher;
import java.util.Date;
import java.util.List;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
public class PipelineManager {
- /**
- * Returns all the pipelines of the user
- * @param username
- * @return all pipelines
- */
- public static List<Pipeline> getOwnPipelines(String username) {
- return new UserService(StorageDispatcher.INSTANCE.getNoSqlStore().getUserStorageAPI()).getOwnPipelines(username);
- }
-
- /**
- * Returns all pipelines
- * @return all pipelines
- */
- public static List<Pipeline> getAllPipelines() {
- return StorageDispatcher.INSTANCE.getNoSqlStore().getPipelineStorageAPI().getAllPipelines();
- }
-
- /**
- * Returns the stored pipeline with the given pipeline Id
- * @param pipelineId
- * @return pipeline
- */
- public static Pipeline getPipeline(String pipelineId) {
- return getPipelineStorage().getPipeline(pipelineId);
- }
-
- /**
- * Adds a new pipeline for the user with the username to the storage
- * @param principalSid the ID of the owner principal
- * @param pipeline
- * @return the pipelineId
- */
- public static String addPipeline(String principalSid,
- Pipeline pipeline) {
-
- // call by reference bad smell
- String pipelineId = UUIDGenerator.generateUuid();
- preparePipelineBasics(principalSid, pipeline, pipelineId);
- Operations.storePipeline(pipeline);
-
- Permission permission = new PermissionManager().makePermission(pipeline, principalSid);
- getPermissionStorage().addPermission(permission);
-
- return pipelineId;
- }
-
-
- /**
- * Starts all processing elements of the pipeline with the pipelineId
- * @param pipelineId
- * @return pipeline status of the start operation
- */
- public static PipelineOperationStatus startPipeline(String pipelineId) {
- Pipeline pipeline = getPipeline(pipelineId);
- PipelineOperationStatus status = Operations.startPipeline(pipeline);
- return status;
- }
-
- /**
- * Stops all processing elements of the pipeline
- * @param pipelineId
- * @param forceStop when it is true, the pipeline is stopped, even if not all processing element containers could be reached
- * @return pipeline status of the start operation
- */
- public static PipelineOperationStatus stopPipeline(String pipelineId,
- boolean forceStop) {
- Pipeline pipeline = getPipeline(pipelineId);
- PipelineOperationStatus status = Operations.stopPipeline(pipeline, forceStop);
-
- return status;
- }
-
- /**
- * Deletes the pipeline with the pipeline Id
- * @param pipelineId
- */
- public static void deletePipeline(String pipelineId) {
- getPipelineStorage().deletePipeline(pipelineId);
- }
-
- private static void preparePipelineBasics(String username,
- Pipeline pipeline,
- String pipelineId) {
- pipeline.setPipelineId(pipelineId);
- pipeline.setRunning(false);
- pipeline.setCreatedByUser(username);
- pipeline.setCreatedAt(new Date().getTime());
- pipeline.getSepas().forEach(processor -> processor.setCorrespondingUser(username));
- pipeline.getActions().forEach(action -> action.setCorrespondingUser(username));
- }
-
- private static IPipelineStorage getPipelineStorage() {
- return StorageDispatcher.INSTANCE.getNoSqlStore().getPipelineStorageAPI();
- }
-
- private static IPermissionStorage getPermissionStorage() {
- return StorageDispatcher.INSTANCE.getNoSqlStore().getPermissionStorage();
- }
+ /**
+ * Returns all pipelines
+ *
+ * @return all pipelines
+ */
+ public static List<Pipeline> getAllPipelines() {
+ return StorageDispatcher.INSTANCE.getNoSqlStore().getPipelineStorageAPI().getAllPipelines();
+ }
+
+ /**
+ * Returns the stored pipeline with the given pipeline id
+ *
+ * @param pipelineId id of pipeline
+ * @return pipeline resulting pipeline with given id
+ */
+ public static Pipeline getPipeline(String pipelineId) {
+ return getPipelineStorage().getPipeline(pipelineId);
+ }
+
+ /**
+ * Adds a new pipeline for the user with the username to the storage
+ *
+ * @param principalSid the ID of the owner principal
+ * @param pipeline to be added
+ * @return pipelineId of the stored pipeline
+ */
+ public static String addPipeline(String principalSid,
+ Pipeline pipeline) {
+
+ // call by reference bad smell
+ String pipelineId = UUIDGenerator.generateUuid();
+ preparePipelineBasics(principalSid, pipeline, pipelineId);
+ Operations.storePipeline(pipeline);
+
+ Permission permission = new PermissionManager().makePermission(pipeline, principalSid);
+ getPermissionStorage().addPermission(permission);
+
+ return pipelineId;
+ }
+
+
+ /**
+ * Starts all processing elements of the pipeline with the pipelineId
+ *
+ * @param pipelineId of pipeline to be started
+ * @return pipeline status of the start operation
+ */
+ public static PipelineOperationStatus startPipeline(String pipelineId) {
+ Pipeline pipeline = getPipeline(pipelineId);
+ return Operations.startPipeline(pipeline);
+ }
+
+ /**
+ * Stops all processing elements of the pipeline
+ *
+ * @param pipelineId of pipeline to be stopped
+ * @param forceStop when it is true, the pipeline is stopped, even if not all processing element
+ * containers could be reached
+ * @return pipeline status of the start operation
+ */
+ public static PipelineOperationStatus stopPipeline(String pipelineId,
+ boolean forceStop) {
+ Pipeline pipeline = getPipeline(pipelineId);
+
+ return Operations.stopPipeline(pipeline, forceStop);
+ }
+
+ /**
+ * Deletes the pipeline with the pipeline Id
+ *
+ * @param pipelineId of pipeline to be deleted
+ */
+ public static void deletePipeline(String pipelineId) {
+ getPipelineStorage().deletePipeline(pipelineId);
+ }
+
+
+ /**
+ * Checks for the pipelines that contain the processing element
+ * @param elementId the id of the processing Element
+ * @return all pipelines containing the element
+ */
+ public static List<Pipeline> getPipelinesContainingElements(String elementId) {
+ return PipelineManager.getAllPipelines().stream()
+ .filter(pipeline ->
+ mergePipelineElement(pipeline)
+ .anyMatch(el -> el.getElementId().equals(elementId)))
+ .collect(Collectors.toList());
+ }
+
+ private static Stream<NamedStreamPipesEntity> mergePipelineElement(Pipeline pipeline) {
+ return Streams.concat(pipeline.getStreams().stream(),
+ pipeline.getActions().stream(),
+ pipeline.getSepas().stream());
+ }
+
+ private static void preparePipelineBasics(String username,
+ Pipeline pipeline,
+ String pipelineId) {
+ pipeline.setPipelineId(pipelineId);
+ pipeline.setRunning(false);
+ pipeline.setCreatedByUser(username);
+ pipeline.setCreatedAt(new Date().getTime());
+ pipeline.getSepas().forEach(processor -> processor.setCorrespondingUser(username));
+ pipeline.getActions().forEach(action -> action.setCorrespondingUser(username));
+ }
+
+ private static IPipelineStorage getPipelineStorage() {
+ return StorageDispatcher.INSTANCE.getNoSqlStore().getPipelineStorageAPI();
+ }
+
+ private static IPermissionStorage getPermissionStorage() {
+ return StorageDispatcher.INSTANCE.getNoSqlStore().getPermissionStorage();
+ }
}
diff --git a/streampipes-pipeline-management/src/test/java/org/apache/streampipes/manager/pipeline/TestPipelineManager.java b/streampipes-pipeline-management/src/test/java/org/apache/streampipes/manager/pipeline/TestPipelineManager.java
index e6904ae8c..e277d1a16 100644
--- a/streampipes-pipeline-management/src/test/java/org/apache/streampipes/manager/pipeline/TestPipelineManager.java
+++ b/streampipes-pipeline-management/src/test/java/org/apache/streampipes/manager/pipeline/TestPipelineManager.java
@@ -36,23 +36,25 @@ import static junit.framework.TestCase.assertNotNull;
@RunWith(PowerMockRunner.class)
@PrepareForTest({
- UserResourceManager.class,
- PipelineManager.class,
- Operations.class})
+ UserResourceManager.class,
+ PipelineManager.class,
+ Operations.class})
public class TestPipelineManager {
@Before
public void before() {
PowerMockito.mockStatic(
- UserResourceManager.class);
+ UserResourceManager.class);
}
@Test
public void testStartPipeline() {
// Prepare
PipelineOperationStatus expectedPipelineOperationStatus = getPipelineOperationStatus();
- PowerMockito.stub(PowerMockito.method(PipelineManager.class, "getPipeline", String.class)).toReturn(DummyPipelineGenerator.makePipelineWithPipelineName());
- PowerMockito.stub(PowerMockito.method(Operations.class, "startPipeline", Pipeline.class)).toReturn(expectedPipelineOperationStatus);
+ PowerMockito.stub(PowerMockito.method(PipelineManager.class, "getPipeline", String.class))
+ .toReturn(DummyPipelineGenerator.makePipelineWithPipelineName());
+ PowerMockito.stub(PowerMockito.method(Operations.class, "startPipeline", Pipeline.class))
+ .toReturn(expectedPipelineOperationStatus);
// Test
PipelineOperationStatus result = PipelineManager.startPipeline("pipelineId");
@@ -66,8 +68,10 @@ public class TestPipelineManager {
public void testStopPipeline() {
// Prepare
PipelineOperationStatus expectedPipelineOperationStatus = getPipelineOperationStatus();
- PowerMockito.stub(PowerMockito.method(PipelineManager.class, "getPipeline", String.class)).toReturn(DummyPipelineGenerator.makePipelineWithPipelineName());
- PowerMockito.stub(PowerMockito.method(Operations.class, "stopPipeline", Pipeline.class, boolean.class)).toReturn(expectedPipelineOperationStatus);
+ PowerMockito.stub(PowerMockito.method(PipelineManager.class, "getPipeline", String.class))
+ .toReturn(DummyPipelineGenerator.makePipelineWithPipelineName());
+ PowerMockito.stub(PowerMockito.method(Operations.class, "stopPipeline", Pipeline.class, boolean.class))
+ .toReturn(expectedPipelineOperationStatus);
// Test
PipelineOperationStatus result = PipelineManager.stopPipeline("pipelineId", true);
@@ -77,6 +81,7 @@ public class TestPipelineManager {
assertEquals(expectedPipelineOperationStatus.getPipelineName(), result.getPipelineName());
}
+
private PipelineOperationStatus getPipelineOperationStatus() {
return new PipelineOperationStatus("", DummyPipelineGenerator.PIPELINE_NAME, "", new ArrayList<>());
}
diff --git a/streampipes-pipeline-management/src/test/java/org/apache/streampipes/manager/pipeline/TestPipelinesContainingElements.java b/streampipes-pipeline-management/src/test/java/org/apache/streampipes/manager/pipeline/TestPipelinesContainingElements.java
new file mode 100644
index 000000000..ff95828ba
--- /dev/null
+++ b/streampipes-pipeline-management/src/test/java/org/apache/streampipes/manager/pipeline/TestPipelinesContainingElements.java
@@ -0,0 +1,88 @@
+/*
+ * 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.
+ *
+ */
+package org.apache.streampipes.manager.pipeline;
+
+import org.apache.streampipes.model.pipeline.Pipeline;
+import org.apache.streampipes.test.generator.pipeline.DummyPipelineGenerator;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.powermock.api.mockito.PowerMockito;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
+
+import java.util.Collections;
+import java.util.List;
+
+import static junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertNotNull;
+
+@RunWith(PowerMockRunner.class)
+@PrepareForTest({
+ PipelineManager.class})
+public class TestPipelinesContainingElements {
+ public static final String TARGET_ELEMENT_ID = "TARGET_ELEMENT_ID";
+
+ private Pipeline pipeline;
+
+ @Before
+ public void before() {
+ pipeline = DummyPipelineGenerator.makePipelineWithProcessorAndSink();
+ PowerMockito.stub(PowerMockito.method(PipelineManager.class, "getAllPipelines"))
+ .toReturn(Collections.singletonList(pipeline));
+ }
+
+ @Test
+ public void getPipelineContainingNoElement() {
+ List<Pipeline> resultingPipelines = PipelineManager.getPipelinesContainingElements("");
+ assertNotNull(resultingPipelines);
+ assertEquals(resultingPipelines.size(), 0);
+ }
+
+ @Test
+ public void getPipelineContainingStream() {
+ pipeline.getStreams().forEach((spDataStream) -> spDataStream.setElementId(TARGET_ELEMENT_ID));
+
+ validateOneResultingPipeline();
+ }
+
+
+ @Test
+ public void getPipelineContainingProcessor() {
+
+ pipeline.getSepas().forEach((processor) -> processor.setElementId(TARGET_ELEMENT_ID));
+
+ validateOneResultingPipeline();
+ }
+
+ @Test
+ public void getPipelineContainingSink() {
+
+ pipeline.getActions().forEach((sink) -> sink.setElementId(TARGET_ELEMENT_ID));
+
+ validateOneResultingPipeline();
+ }
+
+ private void validateOneResultingPipeline() {
+ List<Pipeline> resultingPipelines = PipelineManager.getPipelinesContainingElements(TARGET_ELEMENT_ID);
+ assertNotNull(resultingPipelines);
+ assertEquals(resultingPipelines.size(), 1);
+ assertEquals(resultingPipelines.get(0).getName(), DummyPipelineGenerator.PIPELINE_NAME);
+ }
+
+}
diff --git a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/PipelineResource.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/PipelineResource.java
index 64f512ed1..61f862e5c 100644
--- a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/PipelineResource.java
+++ b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/PipelineResource.java
@@ -25,7 +25,12 @@ import io.swagger.v3.oas.annotations.media.ArraySchema;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
-import org.apache.streampipes.commons.exceptions.*;
+import org.apache.streampipes.commons.exceptions.NoMatchingFormatException;
+import org.apache.streampipes.commons.exceptions.NoMatchingJsonSchemaException;
+import org.apache.streampipes.commons.exceptions.NoMatchingProtocolException;
+import org.apache.streampipes.commons.exceptions.NoMatchingSchemaException;
+import org.apache.streampipes.commons.exceptions.NoSuitableSepasAvailableException;
+import org.apache.streampipes.commons.exceptions.RemoteServerNotAccessibleException;
import org.apache.streampipes.manager.execution.status.PipelineStatusManager;
import org.apache.streampipes.manager.operations.Operations;
import org.apache.streampipes.manager.pipeline.PipelineManager;
@@ -280,7 +285,7 @@ public class PipelineResource extends AbstractAuthGuardedRestResource {
@Produces(MediaType.APPLICATION_JSON)
@Path("/contains/{elementId}")
@JacksonSerialized
- @Operation(summary = "TODO",
+ @Operation(summary = "Returns all pipelines that contain the element with the elementId",
tags = {"Pipeline"},
responses = {
@ApiResponse(content = {
@@ -289,11 +294,9 @@ public class PipelineResource extends AbstractAuthGuardedRestResource {
array = @ArraySchema(schema = @Schema(implementation = Pipeline.class)))
})})
@PreAuthorize(AuthConstants.HAS_READ_PIPELINE_PRIVILEGE)
- public List<Pipeline> getPipelinesContainingElements(@PathParam("elementId") String pipelineId) {
-
- return PipelineManager.getAllPipelines();
- // TODO What happens when user does not have privileges
-// return PipelineManager.getAllPipelines();
+ @PostFilter("hasPermission(filterObject.pipelineId, 'READ')")
+ public List<Pipeline> getPipelinesContainingElement(@PathParam("elementId") String elementId) {
+ return PipelineManager.getPipelinesContainingElements(elementId);
}
}
diff --git a/streampipes-rest/src/test/java/org/apache/streampipes/rest/impl/datalake/DataLakeNoUserManagementV3Test.java b/streampipes-rest/src/test/java/org/apache/streampipes/rest/impl/datalake/DataLakeNoUserManagementV3Test.java
deleted file mode 100644
index 46252200e..000000000
--- a/streampipes-rest/src/test/java/org/apache/streampipes/rest/impl/datalake/DataLakeNoUserManagementV3Test.java
+++ /dev/null
@@ -1,211 +0,0 @@
-/*
- * 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.
- *
- */
-
-package org.apache.streampipes.rest.impl.datalake;
-
-import org.apache.streampipes.dataexplorer.DataLakeNoUserManagementV3;
-import org.junit.Before;
-import org.junit.Test;
-import org.apache.streampipes.model.schema.EventProperty;
-import org.apache.streampipes.model.schema.EventPropertyList;
-import org.apache.streampipes.model.schema.EventPropertyNested;
-import org.apache.streampipes.model.schema.EventPropertyPrimitive;
-
-
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-
-import static org.junit.Assert.*;
-
-public class DataLakeNoUserManagementV3Test {
-
- Method privateMethod;
- DataLakeNoUserManagementV3 management;
-
- @Before
- public void setPrivateMethod() throws NoSuchMethodException {
- this.management = new DataLakeNoUserManagementV3();
- this.privateMethod = DataLakeNoUserManagementV3.class.getDeclaredMethod("compareEventProperties",
- List.class , List.class);
- privateMethod.setAccessible(true);
- }
-
- @Test
- public void testCompareEventProperties() throws InvocationTargetException, IllegalAccessException {
- EventProperty property = createEventPropertyPrimitive("A", "type");
-
- boolean result = (boolean) privateMethod.invoke(management,
- Collections.singletonList(property),
- Collections.singletonList(property));
- assertEquals(true, result);
- }
-
- @Test
- public void testCompareEventProperties2() throws InvocationTargetException, IllegalAccessException {
- EventProperty property = createEventPropertyPrimitive("A", "type");
-
- EventProperty property2 = createEventPropertyPrimitive("A", "typeB");
-
- boolean result = (boolean) privateMethod.invoke(management,
- Collections.singletonList(property),
- Collections.singletonList(property2));
- assertEquals(false, result);
- }
-
-
- @Test
- public void testCompareEventProperties3() throws InvocationTargetException, IllegalAccessException {
- EventProperty property = createEventPropertyPrimitive("A", "type");
-
- EventPropertyPrimitive property2 = createEventPropertyPrimitive("C", "type");
-
-
- boolean result = (boolean) privateMethod.invoke(management,
- Collections.singletonList(property),
- Collections.singletonList(property2));
- assertEquals(false, result);
- }
-
- @Test
- public void testCompareEventProperties4() throws InvocationTargetException, IllegalAccessException {
- EventProperty property = createEventPropertyPrimitive("A", "type");
-
- EventProperty property2 = createEventPropertyPrimitive("A", "type");
- EventProperty property3 = createEventPropertyPrimitive("F", "type");
-
-
- boolean result = (boolean) privateMethod.invoke(management,
- Collections.singletonList(property),
- Arrays.asList(property2, property3));
- assertEquals(false, result);
- }
-
- @Test
- public void testCompareEventProperties5() throws InvocationTargetException, IllegalAccessException {
- EventProperty property = createEventPropertyPrimitive("A", "type");
- EventProperty property2 = createEventPropertyPrimitive("F", "type");
-
- EventProperty property3 = createEventPropertyPrimitive("A", "type");
- EventProperty property4 = createEventPropertyPrimitive("F", "type");
-
-
- boolean result = (boolean) privateMethod.invoke(management,
- Arrays.asList(property, property2),
- Arrays.asList(property3, property4));
- assertEquals(true, result);
- }
-
- @Test
- public void testCompareEventProperties6() throws InvocationTargetException, IllegalAccessException {
- EventProperty property = new EventPropertyList();
- property.setRuntimeName("A");
- ((EventPropertyList) property).setEventProperty(createEventPropertyPrimitive("K", "B"));
-
-
-
- boolean result = (boolean) privateMethod.invoke(management,
- Arrays.asList(property),
- Arrays.asList(property));
- assertEquals(true, result);
- }
-
- @Test
- public void testCompareEventProperties7() throws InvocationTargetException, IllegalAccessException {
- EventProperty property = new EventPropertyList();
- property.setRuntimeName("A");
- ((EventPropertyList) property).setEventProperty(createEventPropertyPrimitive("K", "B"));
-
- EventProperty property2 = new EventPropertyList();
- property2.setRuntimeName("A");
- ((EventPropertyList) property2).setEventProperty(createEventPropertyPrimitive("Z", "B"));
-
-
- boolean result = (boolean) privateMethod.invoke(management,
- Arrays.asList(property),
- Arrays.asList(property2));
- assertEquals(false, result);
- }
-
- @Test
- public void testCompareEventProperties8() throws InvocationTargetException, IllegalAccessException {
- EventProperty property = new EventPropertyNested();
- property.setRuntimeName("A");
- ((EventPropertyNested) property).setEventProperties(Arrays.asList(createEventPropertyPrimitive("A", "Type")));
-
-
- boolean result = (boolean) privateMethod.invoke(management,
- Arrays.asList(property),
- Arrays.asList(property));
- assertEquals(true, result);
- }
-
- @Test
- public void testCompareEventProperties9() throws InvocationTargetException, IllegalAccessException {
- EventProperty property = new EventPropertyNested();
- property.setRuntimeName("A");
- ((EventPropertyNested) property).setEventProperties(Arrays.asList(createEventPropertyPrimitive("A", "Type")));
-
-
- EventProperty property2 = new EventPropertyNested();
- property2.setRuntimeName("A");
- ((EventPropertyNested) property2).setEventProperties(Arrays.asList(createEventPropertyPrimitive("A", "P")));
-
- boolean result = (boolean) privateMethod.invoke(management,
- Arrays.asList(property),
- Arrays.asList(property2));
- assertEquals(false, result);
- }
-
- @Test
- public void testCompareEventProperties10() throws InvocationTargetException, IllegalAccessException {
- EventProperty property = new EventPropertyNested();
- property.setRuntimeName("A");
- ((EventPropertyNested) property).setEventProperties(Arrays.asList(createEventPropertyPrimitive("A", "Type")));
- EventProperty property2 = createEventPropertyPrimitive("A", "Type");;
-
- boolean result = (boolean) privateMethod.invoke(management,
- Arrays.asList(property, property2),
- Arrays.asList(property, property2));
- assertEquals(true, result);
- }
-
- @Test
- public void testCompareEventProperties11() throws InvocationTargetException, IllegalAccessException {
- EventProperty property = new EventPropertyNested();
- property.setRuntimeName("A");
- ((EventPropertyNested) property).setEventProperties(Arrays.asList(createEventPropertyPrimitive("A", "Type")));
- EventProperty property2 = createEventPropertyPrimitive("A", "Type");;
-
- boolean result = (boolean) privateMethod.invoke(management,
- Arrays.asList(property, property2),
- Arrays.asList(property));
- assertEquals(false, result);
- }
-
-
- private EventPropertyPrimitive createEventPropertyPrimitive(String rutimeName, String RuntimeType) {
- EventPropertyPrimitive eventPropertyPrimitive = new EventPropertyPrimitive();
- eventPropertyPrimitive.setRuntimeName(rutimeName);
- eventPropertyPrimitive.setRuntimeType(RuntimeType);
- return eventPropertyPrimitive;
- }
-
-}
diff --git a/streampipes-test-utils/src/main/java/org/apache/streampipes/test/generator/pipeline/DummyPipelineGenerator.java b/streampipes-test-utils/src/main/java/org/apache/streampipes/test/generator/pipeline/DummyPipelineGenerator.java
index afba69157..0e5381b42 100644
--- a/streampipes-test-utils/src/main/java/org/apache/streampipes/test/generator/pipeline/DummyPipelineGenerator.java
+++ b/streampipes-test-utils/src/main/java/org/apache/streampipes/test/generator/pipeline/DummyPipelineGenerator.java
@@ -21,11 +21,12 @@ package org.apache.streampipes.test.generator.pipeline;
import org.apache.streampipes.model.pipeline.Pipeline;
import org.apache.streampipes.test.generator.pipelineelement.DummyProcessorGenerator;
import org.apache.streampipes.test.generator.pipelineelement.DummySinkGenerator;
+import org.apache.streampipes.test.generator.pipelineelement.DummyStreamGenerator;
import java.util.Collections;
public class DummyPipelineGenerator {
- public static String PIPELINE_NAME = "Test Pipeline";
+ public static final String PIPELINE_NAME = "Test Pipeline";
public static Pipeline makePipelineWithPipelineName() {
Pipeline pipeline = new Pipeline();
@@ -37,6 +38,7 @@ public class DummyPipelineGenerator {
public static Pipeline makePipelineWithProcessorAndSink() {
Pipeline pipeline = makePipelineWithPipelineName();
+ pipeline.setStreams(Collections.singletonList(DummyStreamGenerator.makeDummyStream()));
pipeline.setSepas(Collections.singletonList(DummyProcessorGenerator.makeDummyProcessor()));
pipeline.setActions(Collections.singletonList(DummySinkGenerator.makeDummySink()));
diff --git a/streampipes-test-utils/src/main/java/org/apache/streampipes/test/generator/pipelineelement/DummyProcessorGenerator.java b/streampipes-test-utils/src/main/java/org/apache/streampipes/test/generator/pipelineelement/DummyProcessorGenerator.java
index 871b840de..2cdda2439 100644
--- a/streampipes-test-utils/src/main/java/org/apache/streampipes/test/generator/pipelineelement/DummyProcessorGenerator.java
+++ b/streampipes-test-utils/src/main/java/org/apache/streampipes/test/generator/pipelineelement/DummyProcessorGenerator.java
@@ -19,12 +19,14 @@
package org.apache.streampipes.test.generator.pipelineelement;
import org.apache.streampipes.model.graph.DataProcessorInvocation;
+import org.apache.streampipes.model.util.ElementIdGenerator;
public class DummyProcessorGenerator {
public static DataProcessorInvocation makeDummyProcessor() {
DataProcessorInvocation dataProcessorInvocation = new DataProcessorInvocation();
+ dataProcessorInvocation.setElementId(ElementIdGenerator.makeElementId(DataProcessorInvocation.class));
return dataProcessorInvocation;
}
diff --git a/streampipes-test-utils/src/main/java/org/apache/streampipes/test/generator/pipelineelement/DummySinkGenerator.java b/streampipes-test-utils/src/main/java/org/apache/streampipes/test/generator/pipelineelement/DummySinkGenerator.java
index 15a58a47d..b10cdf906 100644
--- a/streampipes-test-utils/src/main/java/org/apache/streampipes/test/generator/pipelineelement/DummySinkGenerator.java
+++ b/streampipes-test-utils/src/main/java/org/apache/streampipes/test/generator/pipelineelement/DummySinkGenerator.java
@@ -19,11 +19,13 @@
package org.apache.streampipes.test.generator.pipelineelement;
import org.apache.streampipes.model.graph.DataSinkInvocation;
+import org.apache.streampipes.model.util.ElementIdGenerator;
public class DummySinkGenerator {
public static DataSinkInvocation makeDummySink() {
DataSinkInvocation dataSinkInvocation = new DataSinkInvocation();
+ dataSinkInvocation.setElementId(ElementIdGenerator.makeElementId(DataSinkInvocation.class));
return dataSinkInvocation;
}
diff --git a/streampipes-test-utils/src/main/java/org/apache/streampipes/test/generator/pipelineelement/DummyStreamGenerator.java b/streampipes-test-utils/src/main/java/org/apache/streampipes/test/generator/pipelineelement/DummyStreamGenerator.java
new file mode 100644
index 000000000..28c59adb1
--- /dev/null
+++ b/streampipes-test-utils/src/main/java/org/apache/streampipes/test/generator/pipelineelement/DummyStreamGenerator.java
@@ -0,0 +1,27 @@
+/*
+ * 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.
+ *
+ */
+
+package org.apache.streampipes.test.generator.pipelineelement;
+
+import org.apache.streampipes.model.SpDataStream;
+
+public class DummyStreamGenerator {
+ public static SpDataStream makeDummyStream() {
+ return new SpDataStream();
+ }
+}
diff --git a/ui/src/app/connect/components/existing-adapters/existing-adapters.component.ts b/ui/src/app/connect/components/existing-adapters/existing-adapters.component.ts
index fd7480c2d..bf0d546b1 100644
--- a/ui/src/app/connect/components/existing-adapters/existing-adapters.component.ts
+++ b/ui/src/app/connect/components/existing-adapters/existing-adapters.component.ts
@@ -185,7 +185,7 @@ export class ExistingAdaptersComponent implements OnInit {
CanNotEditAdapterDialog,
{
panelType: PanelType.STANDARD_PANEL,
- title: 'Edit error',
+ title: 'No edit possible',
width: '50vw',
data: {
pipelines: effectedPipelines
diff --git a/ui/src/app/connect/dialog/can-not-edit-adapter-dialog/can-not-edit-adapter-dialog.component.html b/ui/src/app/connect/dialog/can-not-edit-adapter-dialog/can-not-edit-adapter-dialog.component.html
index f3f14f988..860e2bce3 100644
--- a/ui/src/app/connect/dialog/can-not-edit-adapter-dialog/can-not-edit-adapter-dialog.component.html
+++ b/ui/src/app/connect/dialog/can-not-edit-adapter-dialog/can-not-edit-adapter-dialog.component.html
@@ -10,12 +10,10 @@
<h5>It is used in the following pipelines:</h5>
</div>
</div>
-
-
<div fxFlex="100" fxLayout="column" class="w-100">
<div fxFlex="100" fxLayout="column" class="mat-elevation-z1 mt-10"
*ngFor="let pipeline of pipelines"
- data-cy="adapter-in-pipeline">
+ data-cy="adapter-in-pipeline">
<div fxFlex="100" fxLayout="column" class="p-15">
{{pipeline.name}}
</div>