summaryrefslogtreecommitdiffstats
path: root/vnfm-simulator/vnfm-service/src/test/java
diff options
context:
space:
mode:
authorLathish <lathishbabu.ganesan@est.tech>2019-04-26 08:46:13 +0000
committerLathish <lathishbabu.ganesan@est.tech>2019-04-26 08:46:13 +0000
commitc0b9d01cbc3a3d3b1ce32178394e8fd74a10de65 (patch)
tree816a6baad581f3a7655724662de6616dff74bd0f /vnfm-simulator/vnfm-service/src/test/java
parent0164ebaeecf27e635b3b4097034780dbb8be7c74 (diff)
VNFM simulator implementation for instantiate flow
Issue-ID: SO-1773 Change-Id: I710fe6905d650df29f7550f4eafde2f672301bc4 Signed-off-by: Lathish <lathishbabu.ganesan@est.tech>
Diffstat (limited to 'vnfm-simulator/vnfm-service/src/test/java')
-rw-r--r--vnfm-simulator/vnfm-service/src/test/java/org/onap/svnfm/simulator/controllers/TestSvnfmController.java17
1 files changed, 9 insertions, 8 deletions
diff --git a/vnfm-simulator/vnfm-service/src/test/java/org/onap/svnfm/simulator/controllers/TestSvnfmController.java b/vnfm-simulator/vnfm-service/src/test/java/org/onap/svnfm/simulator/controllers/TestSvnfmController.java
index f338b5828e..9cb0702ee0 100644
--- a/vnfm-simulator/vnfm-service/src/test/java/org/onap/svnfm/simulator/controllers/TestSvnfmController.java
+++ b/vnfm-simulator/vnfm-service/src/test/java/org/onap/svnfm/simulator/controllers/TestSvnfmController.java
@@ -20,10 +20,13 @@
package org.onap.svnfm.simulator.controllers;
+import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.when;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
+import com.fasterxml.jackson.databind.ObjectMapper;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -31,15 +34,15 @@ import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.CreateVnfRequest;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201;
+import org.onap.svnfm.simulator.constants.Constant;
import org.onap.svnfm.simulator.controller.SvnfmController;
import org.onap.svnfm.simulator.repository.VnfmCacheRepository;
import org.onap.svnfm.simulator.services.SvnfmService;
-import org.onap.vnfm.v1.model.CreateVnfRequest;
-import org.onap.vnfm.v1.model.InlineResponse201;
import org.springframework.http.MediaType;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
-import com.fasterxml.jackson.databind.ObjectMapper;
@RunWith(MockitoJUnitRunner.class)
public class TestSvnfmController {
@@ -69,14 +72,12 @@ public class TestSvnfmController {
createVnfRequest.setVnfInstanceName("createVnfInstanceTest");
createVnfRequest.setVnfInstanceDescription("createVnfInstanceTest");
- when(vnfmCacheRepository.createVnf(createVnfRequest)).thenReturn(new InlineResponse201());
-
- svnfmService.createVnf(createVnfRequest);
+ when(vnfmCacheRepository.createVnf(eq(createVnfRequest), anyString())).thenReturn(new InlineResponse201());
final String body = (new ObjectMapper()).valueToTree(createVnfRequest).toString();
this.mockMvc
- .perform(post("/svnfm/vnf_instances").content(body).contentType(MediaType.APPLICATION_JSON)
- .accept(MediaType.APPLICATION_JSON))
+ .perform(post(Constant.BASE_URL + "/vnf_instances").content(body)
+ .contentType(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON))
.andExpect(status().isCreated()).andExpect(content().contentType(MediaType.APPLICATION_JSON));
}
}