diff options
author | Eylon Malin <eylon.malin@intl.att.com> | 2019-09-02 14:56:13 +0300 |
---|---|---|
committer | Eylon Malin <eylon.malin@intl.att.com> | 2019-09-02 14:56:13 +0300 |
commit | 4e36a1de996cc5b30454d77c08545cd71f3c671d (patch) | |
tree | 749fb54a6ec2c1a555aef780c2603b35299a3919 | |
parent | 9f8e3d7ae1bd7c38312e68d8a7f88c6dc86488ab (diff) |
improve test to verify also serialization
Issue-ID: VID-378
Signed-off-by: Eylon Malin <eylon.malin@intl.att.com>
Change-Id: Iaff42459fc9bd7d843b21af6d710afc9a194680c
-rw-r--r-- | vid-app-common/src/test/java/org/onap/vid/mso/MsoBusinessLogicImplTest.java | 40 | ||||
-rw-r--r-- | vid-app-common/src/test/resources/payload_jsons/vfModuleDeactivateAndCloudDelete.json | 8 |
2 files changed, 10 insertions, 38 deletions
diff --git a/vid-app-common/src/test/java/org/onap/vid/mso/MsoBusinessLogicImplTest.java b/vid-app-common/src/test/java/org/onap/vid/mso/MsoBusinessLogicImplTest.java index c0683425b..2ea37f4bc 100644 --- a/vid-app-common/src/test/java/org/onap/vid/mso/MsoBusinessLogicImplTest.java +++ b/vid-app-common/src/test/java/org/onap/vid/mso/MsoBusinessLogicImplTest.java @@ -21,6 +21,7 @@ package org.onap.vid.mso; +import static net.javacrumbs.jsonunit.JsonMatchers.jsonEquals; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatExceptionOfType; import static org.assertj.core.api.Assertions.tuple; @@ -89,7 +90,6 @@ import org.onap.vid.mso.model.CloudConfiguration; import org.onap.vid.mso.model.ModelInfo; import org.onap.vid.mso.model.OperationalEnvironmentActivateInfo; import org.onap.vid.mso.model.OperationalEnvironmentDeactivateInfo; -import org.onap.vid.mso.model.RequestInfo; import org.onap.vid.mso.model.RequestParameters; import org.onap.vid.mso.rest.OperationalEnvironment.OperationEnvironmentRequestDetails; import org.onap.vid.mso.rest.Request; @@ -862,39 +862,11 @@ public class MsoBusinessLogicImplTest extends AbstractTestNGSpringContextTests { } @Test - public void shouldProperlyBuildRequestDetailsForSoftDeleteWithProperParameters() { - // given - SoftDeleteRequest softDeleteRequest = new SoftDeleteRequest(); - RequestDetails requestDetails = new RequestDetails(); - - String userId = "testUserID"; - String tenantId = "testTenantId "; - String cloudRegionId = "testCloudId"; - - - RequestInfo requestInfo = new RequestInfo(); - requestInfo.setSource("VID"); - requestInfo.setRequestorId(userId); - requestDetails.setRequestInfo(requestInfo); - - CloudConfiguration cloudConfiguration = new CloudConfiguration(); - cloudConfiguration.setTenantId(tenantId); - cloudConfiguration.setLcpCloudRegionId(cloudRegionId); - requestDetails.setCloudConfiguration(cloudConfiguration); - - setModelInfoForRequestDetails(requestDetails); - - setRequestParametersForRequestDetails(requestDetails); - - softDeleteRequest.setLcpCloudRegionId(cloudRegionId); - softDeleteRequest.setTenantId(tenantId); - softDeleteRequest.setUserId(userId); - - // when - RequestDetails response = msoBusinessLogic.buildRequestDetailsForSoftDelete(softDeleteRequest); - - // then - assertThat(response).isEqualTo(requestDetails); + public void shouldProperlyBuildRequestDetailsForSoftDeleteWithProperParameters() throws IOException { + SoftDeleteRequest request = new SoftDeleteRequest("testTenantId", "testCloudId", "testUserID"); + String expected = IOUtils.toString(this.getClass().getResource("/payload_jsons/vfModuleDeactivateAndCloudDelete.json"), "UTF-8"); + final RequestDetails result = msoBusinessLogic.buildRequestDetailsForSoftDelete(request); + MatcherAssert.assertThat(result, jsonEquals(expected)); } private void setRequestParametersForRequestDetails(RequestDetails requestDetails) { diff --git a/vid-app-common/src/test/resources/payload_jsons/vfModuleDeactivateAndCloudDelete.json b/vid-app-common/src/test/resources/payload_jsons/vfModuleDeactivateAndCloudDelete.json index d86ad1966..dbac1383d 100644 --- a/vid-app-common/src/test/resources/payload_jsons/vfModuleDeactivateAndCloudDelete.json +++ b/vid-app-common/src/test/resources/payload_jsons/vfModuleDeactivateAndCloudDelete.json @@ -3,15 +3,15 @@ "modelType": "vfModule" }, "cloudConfiguration": { - "lcpCloudRegionId": "mdt1", - "tenantId": "88a6ca3ee0394ade9403f075db23167e" + "lcpCloudRegionId": "testCloudId", + "tenantId": "testTenantId" }, "requestInfo": { "source": "VID", - "requestorId": "az2016" + "requestorId": "testUserID" }, "requestParameters" : { "testApi" : "GR_API", "userParams": [] } -}
\ No newline at end of file +} |