summaryrefslogtreecommitdiffstats
path: root/vid-app-common/src
diff options
context:
space:
mode:
authorEylon Malin <eylon.malin@intl.att.com>2019-09-01 17:26:56 +0300
committerIttay Stern <ittay.stern@att.com>2019-09-01 14:38:16 +0000
commitb2805ebd910ecf9cc49597a52bd8f6e6b18f1d31 (patch)
treee760ce4fd6042886d19f3e53cf3157229f07f20f /vid-app-common/src
parentccf611730b91fe10f60633c3aeb604ea993e61b0 (diff)
add some UT for MsoBusinessLogicImpl
Add UT for: deleteSvcInstance, deleteVnf, deleteVfModule Issue-ID: VID-378 Signed-off-by: Eylon Malin <eylon.malin@intl.att.com> Change-Id: I838c69ae4d0209fe8d62ada98e06dcc1817a4d88
Diffstat (limited to 'vid-app-common/src')
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/mso/MsoBusinessLogicImplTest.java65
1 files changed, 65 insertions, 0 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..c9f576db1 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
@@ -42,6 +42,7 @@ import static org.mockito.ArgumentMatchers.isA;
import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.doThrow;
import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import static org.onap.vid.controller.MsoController.CONFIGURATION_ID;
import static org.onap.vid.controller.MsoController.REQUEST_TYPE;
@@ -71,6 +72,7 @@ import org.hamcrest.MatcherAssert;
import org.jetbrains.annotations.NotNull;
import org.mockito.ArgumentMatcher;
import org.mockito.Mock;
+import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
import org.mockito.hamcrest.MockitoHamcrest;
import org.onap.portalsdk.core.util.SystemProperties;
@@ -1610,5 +1612,68 @@ public class MsoBusinessLogicImplTest extends AbstractTestNGSpringContextTests {
org.junit.Assert.assertThat(metadata.getRawData(), rawData);
org.junit.Assert.assertThat(metadata.getDescription(), descriptionMatcher);
}
+
+ @Test(dataProvider = "unAssignOrDeleteParams")
+ public void deleteSvcInstance_verifyEndPointPathConstructing(String status) {
+ Mockito.reset(msoInterface);
+ String endpoint = validateEndpointPath(MsoProperties.MSO_DELETE_OR_UNASSIGN_REST_API_SVC_INSTANCE);
+ RequestDetails requestDetails = new RequestDetails();
+
+
+ msoBusinessLogic.deleteSvcInstance(requestDetails, "tempId", status);
+
+ verify(msoInterface).deleteSvcInstance(requestDetails, endpoint + "/tempId");
+ }
+
+ @DataProvider
+ public Object[][] unAssignOrDeleteParams() {
+ return new Object[][]{
+ {"Active"},
+ {"unexpected-status"},
+ };
+ }
+
+ @Test(dataProvider = "unAssignStatus")
+ public void deleteSvcInstance_verifyEndPointPathConstructing_unAssignFeatureOn(String status) {
+ Mockito.reset(msoInterface);
+ String endpoint = validateEndpointPath(MsoProperties.MSO_DELETE_OR_UNASSIGN_REST_API_SVC_INSTANCE);
+ RequestDetails requestDetails = new RequestDetails();
+
+ msoBusinessLogic.deleteSvcInstance(requestDetails, "tempId", status);
+
+ verify(msoInterface).unassignSvcInstance(requestDetails, endpoint + "/tempId/unassign");
+ }
+
+ @DataProvider
+ public Object[][] unAssignStatus() {
+ return new Object[][]{
+ {"Created"},
+ {"Pendingdelete"},
+ {"pending-Delete"},
+ {"Assigned"}
+ };
+ }
+
+ @Test
+ public void deleteVnf_verifyEndPointPathConstructing() {
+ String endpoint = validateEndpointPath(MsoProperties.MSO_REST_API_VNF_INSTANCE);
+ RequestDetails requestDetails = new RequestDetails();
+
+ String vnf_endpoint = endpoint.replaceFirst(SVC_INSTANCE_ID, "serviceInstanceTempId");
+
+ msoBusinessLogic.deleteVnf(requestDetails, "serviceInstanceTempId", "vnfInstanceTempId");
+ verify(msoInterface).deleteVnf(requestDetails, vnf_endpoint + "/vnfInstanceTempId");
+ }
+
+ @Test
+ public void deleteVfModule_verifyEndPointPathConstructing() {
+ String endpoint = validateEndpointPath(MsoProperties.MSO_REST_API_VF_MODULE_INSTANCE);
+ RequestDetails requestDetails = new RequestDetails();
+
+ String vf__modules_endpoint = endpoint.replaceFirst(SVC_INSTANCE_ID, "serviceInstanceTempId").replaceFirst(VNF_INSTANCE_ID, "vnfInstanceTempId");
+
+ msoBusinessLogic.deleteVfModule(requestDetails, "serviceInstanceTempId", "vnfInstanceTempId", "vfModuleTempId");
+ verify(msoInterface).deleteVfModule(requestDetails, vf__modules_endpoint + "/vfModuleTempId");
+ }
}