summaryrefslogtreecommitdiffstats
path: root/prh-app-server
diff options
context:
space:
mode:
authorJoanna Jeremicz <joanna.jeremicz@nokia.com>2019-06-17 11:06:13 +0200
committerJoanna Jeremicz <joanna.jeremicz@nokia.com>2019-07-03 14:31:26 +0200
commitac77e0be3acc65b898d6310eaf09b3ee1a0d1725 (patch)
tree4a8b7c4bbc0d513551c3565e4b0e827efaa48bc5 /prh-app-server
parentce3730c7286f03375f38215a50af1ae6530a4845 (diff)
Logical links creation bug
Cleanup and test enhancements Change-Id: I0c5c027ceed13ec9b63b60555e78ef552122aeac Issue-ID: DCAEGEN2-1611 Signed-off-by: Joanna Jeremicz <joanna.jeremicz@nokia.com>
Diffstat (limited to 'prh-app-server')
-rw-r--r--prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/BbsActionsTaskTest.java9
-rw-r--r--prh-app-server/src/test/resources/BbsActionsTaskTestFiles/logicalLinkBody.json1
2 files changed, 10 insertions, 0 deletions
diff --git a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/BbsActionsTaskTest.java b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/BbsActionsTaskTest.java
index 5af78afa..1c5c3837 100644
--- a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/BbsActionsTaskTest.java
+++ b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/BbsActionsTaskTest.java
@@ -36,7 +36,9 @@ import static org.onap.dcaegen2.services.sdk.rest.services.adapters.http.HttpMet
import static org.onap.dcaegen2.services.sdk.rest.services.adapters.http.HttpMethod.PUT;
import com.google.gson.JsonObject;
+import io.netty.buffer.ByteBuf;
import io.netty.handler.codec.http.HttpResponseStatus;
+import java.nio.charset.StandardCharsets;
import java.util.List;
import java.util.Scanner;
import org.junit.jupiter.api.Test;
@@ -64,6 +66,7 @@ class BbsActionsTaskTest {
private static final String PNF_WITHOUT_LINK_JSON = "BbsActionsTaskTestFiles/pnfWithoutLinks.json";
private static final String PNF_WITH_LINK_JSON = "BbsActionsTaskTestFiles/pnfWithLogicalLink.json";
private static final String LOGICAL_LINK_JSON = "BbsActionsTaskTestFiles/oldLogicalLink.json";
+ private static final String LOGICAL_LINK_BODY = "BbsActionsTaskTestFiles/logicalLinkBody.json";
private CbsConfiguration cbsConfiguration = mock(CbsConfiguration.class);
@@ -136,6 +139,7 @@ class BbsActionsTaskTest {
assertEquals(GET, pnfGet.method());
assertEquals(AAI_URL + LOGICAL_LINK_URL + "/" + linkName, linkPut.url());
assertEquals(PUT, linkPut.method());
+ assertEquals(getBodyJson(LOGICAL_LINK_BODY), extractBodyFromRequest(linkPut));
}
@Test
@@ -179,6 +183,7 @@ class BbsActionsTaskTest {
assertEquals(GET, linkGet.method());
assertEquals(AAI_URL + LOGICAL_LINK_URL + "/" + linkName + "?resource-version=1560171816043", linkDelete.url());
assertEquals(DELETE, linkDelete.method());
+ assertEquals(getBodyJson(LOGICAL_LINK_BODY), extractBodyFromRequest(linkPut));
}
@Test
@@ -230,6 +235,10 @@ class BbsActionsTaskTest {
.build();
}
+ private String extractBodyFromRequest(HttpRequest request) {
+ return Mono.from(request.body().contents()).block().toString(StandardCharsets.UTF_8);
+ }
+
private String getBodyJson(String filename) {
return new Scanner(loader.getResourceAsStream(filename)).useDelimiter("\\A").next();
}
diff --git a/prh-app-server/src/test/resources/BbsActionsTaskTestFiles/logicalLinkBody.json b/prh-app-server/src/test/resources/BbsActionsTaskTestFiles/logicalLinkBody.json
new file mode 100644
index 00000000..c73b93e5
--- /dev/null
+++ b/prh-app-server/src/test/resources/BbsActionsTaskTestFiles/logicalLinkBody.json
@@ -0,0 +1 @@
+{"link-name":"some-link","link-type":"attachment-point","relationship-list":{"relationship":[{"related-link":"/network/pnfs/pnf/Nokia123","relationship-data":[]}]}} \ No newline at end of file