diff options
author | Lizi <li.zi30@zte.com.cn> | 2018-01-10 02:58:01 +0000 |
---|---|---|
committer | Lizi <li.zi30@zte.com.cn> | 2018-01-10 02:58:18 +0000 |
commit | 3ca84f4c73c5996a2cc5d4372d70f1e7bce5cf0f (patch) | |
tree | 8a4a0c27a5003e1f65929d5743a3dace2d6a94de /esr-mgr/src/test | |
parent | 4bc5af16cefb4c33f83bf499b385c94e0c850595 (diff) |
Add unit test for vnfm manage API.
Change-Id: I51af8e01b8408acb6e7b0213c2db25c7e49102cd
Issue-ID: AAI-500
Signed-off-by: Lizi <li.zi30@zte.com.cn>
Diffstat (limited to 'esr-mgr/src/test')
-rw-r--r-- | esr-mgr/src/test/java/org/onap/aai/esr/wrapper/VnfmManagerWrapperTest.java | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/esr-mgr/src/test/java/org/onap/aai/esr/wrapper/VnfmManagerWrapperTest.java b/esr-mgr/src/test/java/org/onap/aai/esr/wrapper/VnfmManagerWrapperTest.java index 917fac4..00dc1f7 100644 --- a/esr-mgr/src/test/java/org/onap/aai/esr/wrapper/VnfmManagerWrapperTest.java +++ b/esr-mgr/src/test/java/org/onap/aai/esr/wrapper/VnfmManagerWrapperTest.java @@ -17,6 +17,8 @@ package org.onap.aai.esr.wrapper; import static org.junit.Assert.assertEquals; +import java.util.ArrayList; + import javax.ws.rs.core.Response; import org.junit.Assert; @@ -81,4 +83,60 @@ public class VnfmManagerWrapperTest { } ExternalSystemProxy.isTest = false; } + + @Test + public void test_queryVnfmList() { + ExternalSystemProxy.isTest = true; + ExtsysUtil extsysUtil = new ExtsysUtil(); + ArrayList<VnfmRegisterInfo> vnfmList = new ArrayList<VnfmRegisterInfo>(); + VnfmRegisterInfo vnfmRegisterInfo = new VnfmRegisterInfo(); + vnfmRegisterInfo.setVimId("987654"); + vnfmRegisterInfo.setVersion("v1"); + vnfmRegisterInfo.setVendor("zte"); + vnfmRegisterInfo.setUserName("onap"); + vnfmRegisterInfo.setUrl("http://10.11.22.33:8000"); + vnfmRegisterInfo.setType("vnfm"); + vnfmRegisterInfo.setPassword("987654"); + vnfmRegisterInfo.setName("ONAP VNFM"); + vnfmRegisterInfo.setCertificateUrl("http://11.22.33.44:5000/v3"); + vnfmRegisterInfo.setVnfmId("123456"); + vnfmList.add(vnfmRegisterInfo); + Response response = vnfmManagerWrapper.queryVnfmList(); + if (response != null) { + Assert.assertTrue(response.getStatus() == 200); + assertEquals(extsysUtil.objectToString(vnfmList), extsysUtil.objectToString(response.getEntity())); + } + ExternalSystemProxy.isTest = false; + } + + @Test + public void test_delVnfm() { + ExternalSystemProxy.isTest = true; + Response response = vnfmManagerWrapper.delVnfm("123456"); + if(response != null) { + Assert.assertTrue(response.getStatus() == 204); + } + ExternalSystemProxy.isTest = false; + } + + @Test + public void test_updateVnfm() { + ExternalSystemProxy.isTest = true; + VnfmRegisterInfo vnfmRegisterInfo = new VnfmRegisterInfo(); + vnfmRegisterInfo.setVimId("987654"); + vnfmRegisterInfo.setVersion("v1"); + vnfmRegisterInfo.setVendor("zte"); + vnfmRegisterInfo.setUserName("onap"); + vnfmRegisterInfo.setUrl("http://10.11.22.33:8000"); + vnfmRegisterInfo.setType("vnfm"); + vnfmRegisterInfo.setPassword("987654"); + vnfmRegisterInfo.setName("ONAP VNFM"); + vnfmRegisterInfo.setCertificateUrl("http://11.22.33.44:5000/v3"); + vnfmRegisterInfo.setVnfmId("123456"); + Response response = vnfmManagerWrapper.updateVnfm(vnfmRegisterInfo, "123456"); + if(response != null) { + Assert.assertTrue(response.getStatus() == 200); + } + ExternalSystemProxy.isTest = false; + } } |