diff options
Diffstat (limited to 'prh-app-server/src')
-rw-r--r-- | prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/BbsActionsTaskTest.java | 9 | ||||
-rw-r--r-- | prh-app-server/src/test/resources/BbsActionsTaskTestFiles/logicalLinkBody.json | 1 |
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 |