diff options
author | Eylon Malin <eylon.malin@intl.att.com> | 2020-01-13 12:07:45 +0200 |
---|---|---|
committer | Eylon Malin <eylon.malin@intl.att.com> | 2020-01-13 14:16:52 +0200 |
commit | 6876eba3d0b43b01eb303a0d530fe45712f33d74 (patch) | |
tree | 7f6808357cc2d89405f6003cd5bd8dbe78d6c741 /vid-app-common/src/test/java/org/onap/vid/services/AsyncInstantiationBusinessLogicTest.java | |
parent | 9d0eee5eee868aaee3cf169a4a6716dc1530e4e3 (diff) |
clear isFailed and statusMessage when get it from frontend request
Issue-ID: VID-724
Change-Id: I1bc33513250b220a063742233592388c7a108958
Signed-off-by: Eylon Malin <eylon.malin@intl.att.com>
Diffstat (limited to 'vid-app-common/src/test/java/org/onap/vid/services/AsyncInstantiationBusinessLogicTest.java')
-rw-r--r-- | vid-app-common/src/test/java/org/onap/vid/services/AsyncInstantiationBusinessLogicTest.java | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/vid-app-common/src/test/java/org/onap/vid/services/AsyncInstantiationBusinessLogicTest.java b/vid-app-common/src/test/java/org/onap/vid/services/AsyncInstantiationBusinessLogicTest.java index 7a6b94a1a..0749aaf82 100644 --- a/vid-app-common/src/test/java/org/onap/vid/services/AsyncInstantiationBusinessLogicTest.java +++ b/vid-app-common/src/test/java/org/onap/vid/services/AsyncInstantiationBusinessLogicTest.java @@ -23,8 +23,10 @@ package org.onap.vid.services; import static net.javacrumbs.jsonunit.JsonAssert.assertJsonEquals; import static net.javacrumbs.jsonunit.JsonAssert.whenIgnoringPaths; import static net.javacrumbs.jsonunit.JsonMatchers.jsonEquals; +import static net.javacrumbs.jsonunit.JsonMatchers.jsonPartEquals; import static net.javacrumbs.jsonunit.core.Option.IGNORING_ARRAY_ORDER; import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.allOf; import static org.hamcrest.Matchers.containsInAnyOrder; import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.hasItem; @@ -59,12 +61,14 @@ import static org.onap.vid.job.Job.JobStatus.PAUSE; import static org.onap.vid.job.Job.JobStatus.PENDING; import static org.onap.vid.job.Job.JobStatus.STOPPED; import static org.onap.vid.testUtils.TestUtils.generateRandomAlphaNumeric; +import static org.onap.vid.utils.KotlinUtilsKt.JACKSON_OBJECT_MAPPER; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertFalse; import static org.testng.Assert.assertNotNull; import static org.testng.Assert.assertNull; import static org.testng.Assert.assertTrue; +import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; @@ -150,8 +154,6 @@ import org.testng.annotations.Test; @ContextConfiguration(classes = {DataSourceConfig.class, SystemProperties.class, MockedAaiClientAndFeatureManagerConfig.class}) public class AsyncInstantiationBusinessLogicTest extends AsyncInstantiationBaseTest { - - @Mock private JobAdapter jobAdapterMock; @@ -1391,7 +1393,36 @@ public class AsyncInstantiationBusinessLogicTest extends AsyncInstantiationBaseT { String path = asyncInstantiationBL.getVfModuleReplacePath("myService", "myVNF", "myVFModule"); assertThat(path, equalTo("/serviceInstantiation/v7/serviceInstances/myService/vnfs/myVNF/vfModules/myVFModule/replace")); + } + @Test + public void whenCallClearStatusFromRequest_isFailedAndStatusAreRemoved() throws JsonProcessingException { + ServiceInstantiation serviceInstantiation = JACKSON_OBJECT_MAPPER.readValue( + "{" + + " \"modelInfo\": {" + + " \"modelType\": \"service\"" + + " }," + + " \"isFailed\": true," + + " \"statusMessage\": \"some status\"," + + " \"vnfs\": {" + + " \"vProbe_NC_VNF\": {" + + " \"modelInfo\": {" + + " \"modelType\": \"vnf\"" + + " }," + + " \"isFailed\": true," + + " \"statusMessage\": \"other status\"" + + " }" + + " }" + + "}", + ServiceInstantiation.class); + asyncInstantiationBL.clearStatusFromRequest(serviceInstantiation); + assertThat(serviceInstantiation, allOf( + jsonPartEquals("isFailed", false), + jsonPartEquals("statusMessage", null), + jsonPartEquals("vnfs.vProbe_NC_VNF.isFailed", false), + jsonPartEquals("vnfs.vProbe_NC_VNF.statusMessage", null) + )); } + } |