diff options
author | HePeng <he.peng6@zte.com.cn> | 2019-11-12 09:29:28 +0800 |
---|---|---|
committer | HePeng <he.peng6@zte.com.cn> | 2019-11-19 11:08:56 +0800 |
commit | 7c717d9b4f466b86ab534682096e4d5075965756 (patch) | |
tree | 8cbf3ed4d9614bd72a7bd2249b52ee2e1243b12e | |
parent | 0b65e97caa85ff37a2eba6efff27bcb3a6efbe2e (diff) |
Close AAI-2618 Issue
No non-vulnerable version exists. AAI does not use default typing.
Issue-ID: AAI-2618
Change-Id: I5a78eb2d76d43b4d065f3d998b914d6eca13972a
Signed-off-by: HePeng <he.peng6@zte.com.cn>
-rw-r--r-- | esr-mgr/src/test/java/org/onap/aai/esr/util/NfvoManagerUtilTest.java | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/esr-mgr/src/test/java/org/onap/aai/esr/util/NfvoManagerUtilTest.java b/esr-mgr/src/test/java/org/onap/aai/esr/util/NfvoManagerUtilTest.java new file mode 100644 index 0000000..1a7e4c8 --- /dev/null +++ b/esr-mgr/src/test/java/org/onap/aai/esr/util/NfvoManagerUtilTest.java @@ -0,0 +1,71 @@ +/** + * Copyright 2019 ZTE Corporation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * Submit by HePeng 10064135 + */ +package org.onap.aai.esr.util; + +import com.google.gson.Gson; +import org.junit.Test; +import org.onap.aai.esr.entity.aai.EsrNfvoDetail; +import org.onap.aai.esr.entity.rest.NfvoRegisterInfo; + +import static org.junit.Assert.assertEquals; + +public class NfvoManagerUtilTest { + @Test + public void nfvoRegisterInfo2EsrNfvoTest() + { + NfvoManagerUtil nfvoManagerUtil=new NfvoManagerUtil(); + NfvoRegisterInfo nfvoRegisterInfo=new NfvoRegisterInfo(); + ExtsysUtil extsysUtil=new ExtsysUtil(); + nfvoRegisterInfo.setNfvoId("123456"); + nfvoRegisterInfo.setApiroot("/api/v1/test"); + nfvoRegisterInfo.setName("NFVO_TEST"); + nfvoRegisterInfo.setVendor("ZTE"); + nfvoRegisterInfo.setVersion("v1"); + nfvoRegisterInfo.setUrl("127.0.0.1"); + nfvoRegisterInfo.setUserName("root"); + nfvoRegisterInfo.setPassword("root"); + EsrNfvoDetail esrNfvoDetail=nfvoManagerUtil.nfvoRegisterInfo2EsrNfvo(nfvoRegisterInfo); + esrNfvoDetail.setNfvoId("123456"); + esrNfvoDetail.setResourceVersion("v2"); + esrNfvoDetail.getEsrSystemInfoList().getEsrSystemInfo().get(0).setEsrSystemInfoId("654321"); + String esrnfvoStr = extsysUtil.objectToString(esrNfvoDetail); + String expect = "{\"nfvo-id\":\"123456\"," + "\"resource-version\":\"v2\"," +"\"api-root\":\"/api/v1/test\"," + + "\"esr-system-info-list\":" + "{\"esr-system-info\":" + "[{\"esr-system-info-id\":\"654321\"," + + "\"system-name\":\"NFVO_TEST\"," + "\"vendor\":\"ZTE\"," + "\"version\":\"v1\"," + "\"service-url\":\"127.0.0.1\"," + + "\"user-name\":\"root\"," + "\"password\":\"root\","+ "\"system-type\":\"NFVO\"}]}}"; + assertEquals(expect,esrnfvoStr); + + } + @Test + public void esrNfvo2NfvoRegisterInfoTest() + { + EsrNfvoDetail esrNfvoDetail=new EsrNfvoDetail(); + NfvoRegisterInfo nfvoRegisterInfo = new NfvoRegisterInfo(); + NfvoManagerUtil nfvoManagerUtil = new NfvoManagerUtil(); + String esrnfvoStr = "{\"nfvo-id\":\"123456\"," + "\"resource-version\":\"v2\"," +"\"api-root\":\"/api/v1/test\"," + + "\"esr-system-info-list\":" + "{\"esr-system-info\":" + "[{\"esr-system-info-id\":\"654321\"," + + "\"system-name\":\"NFVO_TEST\"," + "\"vendor\":\"ZTE\","+ "\"version\":\"v1\"," + "\"service-url\":\"127.0.0.1\"," + + "\"user-name\":\"root\"," + "\"password\":\"root\","+ "\"system-type\":\"NFVO\"}]}}"; + esrNfvoDetail=new Gson().fromJson(esrnfvoStr,EsrNfvoDetail.class); + nfvoRegisterInfo=nfvoManagerUtil.esrNfvo2NfvoRegisterInfo(esrNfvoDetail); + String registerInfoStr = new ExtsysUtil().objectToString(nfvoRegisterInfo); + String expect= "{\"nfvoId\":\"123456\"," + "\"name\":\"NFVO_TEST\"," + "\"apiroot\":\"/api/v1/test\"," + + "\"vendor\":\"ZTE\"," + "\"version\":\"v1\"," +"\"url\":\"127.0.0.1\","+"\"userName\":\"root\"," + + "\"password\":\"root\"}"; + assertEquals(registerInfoStr, expect); + } +} |