diff options
author | 2017-10-18 14:47:03 +0800 | |
---|---|---|
committer | 2017-10-18 14:47:03 +0800 | |
commit | 32686c4efae298d7b1785365162b2df3e8afedfc (patch) | |
tree | c2ebdd632037d67a19134a4074e9a77bcc8b8198 /nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java | |
parent | 745f0040b6ad786862b5548cf9285267d209d613 (diff) |
modify msb register part
Change-Id: I034853c0d03af9f395493955a0788403ab3ae31b
Issue-ID: VFC-54
Signed-off-by: yufei_zhou <yufei.zhou@nokia-sbell.com>
Diffstat (limited to 'nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java')
2 files changed, 34 insertions, 17 deletions
diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/msb/impl/MsbMgmrImplTest.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/msb/impl/MsbMgmrImplTest.java index 8e175e63..aa1a0217 100644 --- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/msb/impl/MsbMgmrImplTest.java +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/msb/impl/MsbMgmrImplTest.java @@ -16,14 +16,22 @@ package org.onap.vfc.nfvo.driver.vnfm.svnfm.msb.impl; +import static org.mockito.Mockito.when; + +import java.io.IOException; +import java.util.HashMap; + +import org.apache.http.client.ClientProtocolException; import org.junit.Before; import org.junit.Test; import org.mockito.InjectMocks; import org.mockito.Mock; +import org.mockito.Mockito; import org.mockito.MockitoAnnotations; -import org.onap.msb.sdk.discovery.common.RouteException; import org.onap.vfc.nfvo.driver.vnfm.svnfm.common.bo.AdaptorEnv; import org.onap.vfc.nfvo.driver.vnfm.svnfm.http.client.HttpClientProcessorInf; +import org.onap.vfc.nfvo.driver.vnfm.svnfm.http.client.HttpResult; +import org.springframework.web.bind.annotation.RequestMethod; public class MsbMgmrImplTest { @InjectMocks @@ -40,23 +48,29 @@ public class MsbMgmrImplTest { env.setMsbPort(80); msbMgmr.setAdaptorEnv(env); MockitoAnnotations.initMocks(this); + + String json = "{\"serviceName\":\"catalog\", \"url\":\"/api/catalog/v1\"}"; + HttpResult httpResult = new HttpResult(); + httpResult.setContent(json); + + when(httpClientProcessor.process(Mockito.anyString(), Mockito.any(RequestMethod.class), Mockito.any(HashMap.class), Mockito.anyString())).thenReturn(httpResult); } - @Test(expected = RuntimeException.class) + @Test public void testRegister() { msbMgmr.register(); } - @Test(expected = RuntimeException.class) + @Test public void testunRegister() { msbMgmr.unregister(); } - @Test(expected = RouteException.class) - public void testGetServiceUrlInMsbBySeriveNameAndPort() throws RouteException + @Test + public void testGetServiceUrlInMsbBySeriveNameAndPort() throws ClientProtocolException, IOException { - msbMgmr.getServiceUrlInMsbBySeriveNameAndPort("serviceName", "88"); + msbMgmr.getServiceUrlInMsbBySeriveNameAndVersion("serviceName", "88"); } } diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nslcm/impl/NslcmMgmrImplTest.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nslcm/impl/NslcmMgmrImplTest.java index ddff4ca2..47c33bf1 100644 --- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nslcm/impl/NslcmMgmrImplTest.java +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nslcm/impl/NslcmMgmrImplTest.java @@ -45,7 +45,7 @@ import org.onap.vfc.nfvo.driver.vnfm.svnfm.nslcm.bo.entity.AffectedVnfc; import org.onap.vfc.nfvo.driver.vnfm.svnfm.nslcm.bo.entity.InterfaceInfo; import org.onap.vfc.nfvo.driver.vnfm.svnfm.nslcm.bo.entity.ResourceDefinition; import org.onap.vfc.nfvo.driver.vnfm.svnfm.nslcm.bo.entity.VimAssets; -import org.onap.vfc.nfvo.driver.vnfm.svnfm.nslcm.bo.entity.VimInfo; +import org.onap.vfc.nfvo.driver.vnfm.svnfm.nslcm.bo.entity.NslcmVimInfo; import org.springframework.web.bind.annotation.RequestMethod; import com.google.gson.Gson; @@ -87,18 +87,21 @@ public class NslcmMgmrImplTest { additionalParam2.add(resource); gresponse.setAdditionalParam(additionalParam2); - VimInfo vim = new VimInfo(); - vim.setInterfaceEndpoint("interfaceEndpoint"); - vim.setVimId("vimId"); - AccessInfo accessInfo = null; - vim.setAccessInfo(accessInfo ); - InterfaceInfo interfaceInfo = null; - vim.setInterfaceInfo(interfaceInfo); + List<NslcmVimInfo> vim = new ArrayList<NslcmVimInfo>(); + NslcmVimInfo vims=new NslcmVimInfo(); + vims.setInterfaceEndpoint("interfaceEndpoint"); + vims.setVimId("vimId"); + List<AccessInfo> accessInfo = null; + vims.setAccessInfo(accessInfo); + List<InterfaceInfo> interfaceInfo = null; + vims.setInterfaceInfo(interfaceInfo); + + vim.add(vims); VimAssets vimAssets = null; gresponse.setVimAssets(vimAssets); - gresponse.setVim(vim ); + gresponse.setVim(vim); String json = gson.toJson(gresponse); HttpResult httpResult = new HttpResult(); httpResult.setContent(json); @@ -139,9 +142,9 @@ public class NslcmMgmrImplTest { cbamRequest.setJobId("jobId"); cbamRequest.setOperation("operation"); cbamRequest.setVnfInstanceId(vnfInstanceId); - AffectedVirtualStorage affectedVirtualStorage = new AffectedVirtualStorage(); + List<AffectedVirtualStorage> affectedVirtualStorage = new ArrayList<AffectedVirtualStorage>(); cbamRequest.setAffectedVirtualStorage(affectedVirtualStorage ); - AffectedVnfc affectedVnfc = new AffectedVnfc(); + List<AffectedVnfc> affectedVnfc = new ArrayList<AffectedVnfc>(); cbamRequest.setAffectedVnfc(affectedVnfc ); nslcmMgmr.notifyVnf(cbamRequest, vnfInstanceId); } |