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/08/17 20:37:33 UTC

[incubator-streampipes] branch STREAMPIPES-319 updated: [STREAMPIPES-319] Update tess for worker rest client

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

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


The following commit(s) were added to refs/heads/STREAMPIPES-319 by this push:
     new ebe9cff  [STREAMPIPES-319] Update tess for worker rest client
ebe9cff is described below

commit ebe9cff41eff2347359b7175bc04fef78cf868e4
Author: Philipp Zehnder <ze...@fzi.de>
AuthorDate: Tue Aug 17 22:36:44 2021 +0200

    [STREAMPIPES-319] Update tess for worker rest client
---
 .../master/management/DescriptionManagementTest.java       |  2 +-
 .../container/master/management/WorkerRestClientTest.java  | 14 +++++++++++---
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/streampipes-connect-container-master/src/test/java/org/apache/streampipes/connect/container/master/management/DescriptionManagementTest.java b/streampipes-connect-container-master/src/test/java/org/apache/streampipes/connect/container/master/management/DescriptionManagementTest.java
index 58f82ed..d8f6fd6 100644
--- a/streampipes-connect-container-master/src/test/java/org/apache/streampipes/connect/container/master/management/DescriptionManagementTest.java
+++ b/streampipes-connect-container-master/src/test/java/org/apache/streampipes/connect/container/master/management/DescriptionManagementTest.java
@@ -58,7 +58,7 @@ public class DescriptionManagementTest {
         assertNotNull(result);
         assertNotNull(result.getList());
         assertEquals(1, result.getList().size());
-        assertEquals(JsonFormat.ID, result.getList().get(0).getUri());
+        assertEquals(JsonFormat.ID, result.getList().get(0).getAppId());
     }
 
 }
diff --git a/streampipes-connect-container-master/src/test/java/org/apache/streampipes/connect/container/master/management/WorkerRestClientTest.java b/streampipes-connect-container-master/src/test/java/org/apache/streampipes/connect/container/master/management/WorkerRestClientTest.java
index 5d2a1a9..2336f50 100644
--- a/streampipes-connect-container-master/src/test/java/org/apache/streampipes/connect/container/master/management/WorkerRestClientTest.java
+++ b/streampipes-connect-container-master/src/test/java/org/apache/streampipes/connect/container/master/management/WorkerRestClientTest.java
@@ -19,6 +19,7 @@
 package org.apache.streampipes.connect.container.master.management;
 
 import org.apache.streampipes.connect.api.exception.AdapterException;
+import org.apache.streampipes.connect.container.master.util.WorkerPaths;
 import org.apache.streampipes.model.connect.adapter.GenericAdapterSetDescription;
 import org.apache.streampipes.model.connect.adapter.GenericAdapterStreamDescription;
 import org.junit.Before;
@@ -34,7 +35,7 @@ import static org.mockito.Mockito.times;
 import static org.powermock.api.mockito.PowerMockito.*;
 
 @RunWith(PowerMockRunner.class)
-@PrepareForTest({ WorkerRestClient.class })
+@PrepareForTest({ WorkerRestClient.class, WorkerPaths.class })
 @PowerMockIgnore({"com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*", "javax.management.*"})
 public class WorkerRestClientTest {
 
@@ -46,20 +47,23 @@ public class WorkerRestClientTest {
     @Before
     public void before() {
         PowerMockito.mockStatic(WorkerRestClient.class);
+        PowerMockito.mockStatic(WorkerPaths.class);
     }
 
     @Test
     public void stopStreamAdapterSuccess() throws Exception {
 
+        String expectedUrl = "worker/stream/stop";
         doNothing().when(WorkerRestClient.class, "stopAdapter", any(), anyString());
         when(WorkerRestClient.class, "stopStreamAdapter", anyString(), any()).thenCallRealMethod();
+        when(WorkerPaths.class, "getStreamStopPath").thenReturn(expectedUrl);
         GenericAdapterStreamDescription description = new GenericAdapterStreamDescription();
         description.setId("id1");
 
         WorkerRestClient.stopStreamAdapter("", description);
 
         verifyStatic(WorkerRestClient.class, times(1));
-        WorkerRestClient.stopAdapter(any(), eq("worker/stream/stop"));
+        WorkerRestClient.stopAdapter(any(), eq(expectedUrl));
 
     }
 
@@ -78,8 +82,10 @@ public class WorkerRestClientTest {
      @Test
     public void invokeSetAdapterSuccess() throws Exception {
 
+        String expectedUrl = "worker/set/invoke";
         doNothing().when(WorkerRestClient.class, "startAdapter", anyString(), any());
         when(WorkerRestClient.class, "invokeSetAdapter", anyString(), any()).thenCallRealMethod();
+        when(WorkerPaths.class, "getSetInvokePath").thenReturn(expectedUrl);
 
         GenericAdapterSetDescription description = new GenericAdapterSetDescription();
         description.setId("id1");
@@ -101,15 +107,17 @@ public class WorkerRestClientTest {
     @Test
     public void stopSetAdapterSuccess() throws Exception {
 
+        String expectedUrl = "worker/set/stop";
         doNothing().when(WorkerRestClient.class, "stopAdapter", any(), anyString());
         when(WorkerRestClient.class, "stopSetAdapter", anyString(), any()).thenCallRealMethod();
+        when(WorkerPaths.class, "getSetStopPath").thenReturn(expectedUrl);
 
         GenericAdapterSetDescription description = new GenericAdapterSetDescription();
         description.setId("id1");
         WorkerRestClient.stopSetAdapter("", description);
 
         verifyStatic(WorkerRestClient.class, times(1));
-        WorkerRestClient.stopAdapter(any(), eq("worker/set/stop"));
+        WorkerRestClient.stopAdapter(any(), eq(expectedUrl));
 
     }