diff options
author | 2017-09-20 19:27:44 +0800 | |
---|---|---|
committer | 2017-09-20 19:27:44 +0800 | |
commit | aed0d0c540665963a719dd42ccb0e974294df0b7 (patch) | |
tree | c18853896618d6b069657b1369d83eb9c1dde64a /esr-mgr | |
parent | 844425b4c47843e8c02bfad4d45a7dae85b999cd (diff) |
Add unit test for vim register info.
Change-Id: I01472da080a3d544102183a681f7aceb3962da44
Issue-ID: AAI-354
Signed-off-by: lizi00164331 <li.zi30@zte.com.cn>
Diffstat (limited to 'esr-mgr')
4 files changed, 215 insertions, 1 deletions
diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/util/VimManagerUtil.java b/esr-mgr/src/main/java/org/onap/aai/esr/util/VimManagerUtil.java index b18c440..06a8ef0 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/util/VimManagerUtil.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/util/VimManagerUtil.java @@ -18,7 +18,6 @@ package org.onap.aai.esr.util; import java.util.ArrayList; -import org.onap.aai.esr.common.SystemStatus; import org.onap.aai.esr.common.SystemType; import org.onap.aai.esr.entity.aai.EsrSystemInfo; import org.onap.aai.esr.entity.aai.CloudRegionDetail; diff --git a/esr-mgr/src/test/java/org/onap/aai/esr/entity/rest/VimAuthInfoTest.java b/esr-mgr/src/test/java/org/onap/aai/esr/entity/rest/VimAuthInfoTest.java new file mode 100644 index 0000000..5e8aa4f --- /dev/null +++ b/esr-mgr/src/test/java/org/onap/aai/esr/entity/rest/VimAuthInfoTest.java @@ -0,0 +1,71 @@ +/** + * Copyright 2017 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. + */ +package org.onap.aai.esr.entity.rest; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; + +public class VimAuthInfoTest { + + @Test + public void getterAndSetter4cloudDomain(){ + final String cloudDomain = "chengdu"; + VimAuthInfo vimAuthInfo = new VimAuthInfo(); + vimAuthInfo.setCloudDomain(cloudDomain); + assertEquals(vimAuthInfo.getCloudDomain(), cloudDomain); + } + + @Test + public void getterAndSetter4userName(){ + final String userName = "nancy"; + VimAuthInfo vimAuthInfo = new VimAuthInfo(); + vimAuthInfo.setUserName(userName); + assertEquals(vimAuthInfo.getUserName(), userName); + } + + @Test + public void getterAndSetter4password(){ + final String password = "dasffa"; + VimAuthInfo vimAuthInfo = new VimAuthInfo(); + vimAuthInfo.setPassword(password); + assertEquals(vimAuthInfo.getPassword(), password); + } + + @Test + public void getterAndSetter4authUrl(){ + final String authUrl = "http://127.0.0.1:5000/auth/"; + VimAuthInfo vimAuthInfo = new VimAuthInfo(); + vimAuthInfo.setAuthUrl(authUrl); + assertEquals(vimAuthInfo.getAuthUrl(), authUrl); + } + + @Test + public void getterAndSetter4sslCacert(){ + final String sslCacert = "fdfafda"; + VimAuthInfo vimAuthInfo = new VimAuthInfo(); + vimAuthInfo.setSslCacert(sslCacert); + assertEquals(vimAuthInfo.getSslCacert(), sslCacert); + } + + @Test + public void getterAndSetter4sslInsecure(){ + final Boolean sslInsecure = true; + VimAuthInfo vimAuthInfo = new VimAuthInfo(); + vimAuthInfo.setSslInsecure(sslInsecure); + assertEquals(vimAuthInfo.getSslInsecure(), sslInsecure); + } +} diff --git a/esr-mgr/src/test/java/org/onap/aai/esr/entity/rest/VimRegisterInfoTest.java b/esr-mgr/src/test/java/org/onap/aai/esr/entity/rest/VimRegisterInfoTest.java new file mode 100644 index 0000000..04db4a3 --- /dev/null +++ b/esr-mgr/src/test/java/org/onap/aai/esr/entity/rest/VimRegisterInfoTest.java @@ -0,0 +1,105 @@ +/** + * Copyright 2017 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. + */ +package org.onap.aai.esr.entity.rest; + +import static org.junit.Assert.assertEquals; + +import java.util.ArrayList; + +import org.junit.Test; + +public class VimRegisterInfoTest { + @Test + public void getterAndSetter4cloudOwner(){ + final String cloudOwner = "zte"; + VimRegisterInfo vimRegisterInfo = new VimRegisterInfo(); + vimRegisterInfo.setCloudOwner(cloudOwner); + assertEquals(vimRegisterInfo.getCloudOwner(), cloudOwner); + } + + @Test + public void getterAndSetter4cloudRegionId(){ + final String cloudRegionId = "region-one"; + VimRegisterInfo vimRegisterInfo = new VimRegisterInfo(); + vimRegisterInfo.setCloudRegionId(cloudRegionId); + assertEquals(vimRegisterInfo.getCloudRegionId(), cloudRegionId); + } + + @Test + public void getterAndSetter4cloudType(){ + final String cloudType = "openstack"; + VimRegisterInfo vimRegisterInfo = new VimRegisterInfo(); + vimRegisterInfo.setCloudType(cloudType); + assertEquals(vimRegisterInfo.getCloudType(), cloudType); + } + + @Test + public void getterAndSetter4cloudRegionVersion(){ + final String cloudRegionVersion = "v1.0"; + VimRegisterInfo vimRegisterInfo = new VimRegisterInfo(); + vimRegisterInfo.setCloudRegionVersion(cloudRegionVersion); + assertEquals(vimRegisterInfo.getCloudRegionVersion(), cloudRegionVersion); + } + + @Test + public void getterAndSetter4ownerDefinedType(){ + final String ownerDefinedType = "test"; + VimRegisterInfo vimRegisterInfo = new VimRegisterInfo(); + vimRegisterInfo.setOwnerDefinedType(ownerDefinedType); + assertEquals(vimRegisterInfo.getOwnerDefinedType(), ownerDefinedType); + } + + @Test + public void getterAndSetter4cloudZone(){ + final String cloudZone = "zone1"; + VimRegisterInfo vimRegisterInfo = new VimRegisterInfo(); + vimRegisterInfo.setCloudZone(cloudZone); + assertEquals(vimRegisterInfo.getCloudZone(), cloudZone); + } + + @Test + public void getterAndSetter4complexName(){ + final String complexName = "test"; + VimRegisterInfo vimRegisterInfo = new VimRegisterInfo(); + vimRegisterInfo.setComplexName(complexName); + assertEquals(vimRegisterInfo.getComplexName(), complexName); + } + + @Test + public void getterAndSetter4cloudExtraInfo(){ + final String cloudExtraInfo = "test"; + VimRegisterInfo vimRegisterInfo = new VimRegisterInfo(); + vimRegisterInfo.setCloudExtraInfo(cloudExtraInfo); + assertEquals(vimRegisterInfo.getCloudExtraInfo(), cloudExtraInfo); + } + + @Test + public void getterAndSetter4status(){ + final String status = "normal"; + VimRegisterInfo vimRegisterInfo = new VimRegisterInfo(); + vimRegisterInfo.setStatus(status); + assertEquals(vimRegisterInfo.getStatus(), status); + } + + @Test + public void getterAndSetter4vimAuthInfos(){ + final ArrayList<VimAuthInfo> vimAuthInfos = new ArrayList<VimAuthInfo>(); + VimRegisterInfo vimRegisterInfo = new VimRegisterInfo(); + vimRegisterInfo.setVimAuthInfos(vimAuthInfos); + assertEquals(vimRegisterInfo.getVimAuthInfos(), vimAuthInfos); + } + +} diff --git a/esr-mgr/src/test/java/org/onap/aai/esr/entity/rest/VimRegisterResponseTest.java b/esr-mgr/src/test/java/org/onap/aai/esr/entity/rest/VimRegisterResponseTest.java new file mode 100644 index 0000000..21ebd16 --- /dev/null +++ b/esr-mgr/src/test/java/org/onap/aai/esr/entity/rest/VimRegisterResponseTest.java @@ -0,0 +1,39 @@ +/** + * Copyright 2017 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. + */ +package org.onap.aai.esr.entity.rest; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; + +public class VimRegisterResponseTest { + + @Test + public void getterAndSetter4cloudOwner(){ + final String cloudOwner = "zte"; + VimRegisterResponse vimRegisterResponse = new VimRegisterResponse(); + vimRegisterResponse.setCloudOwner(cloudOwner); + assertEquals(vimRegisterResponse.getCloudOwner(), cloudOwner); + } + + @Test + public void getterAndSetter4cloudRegionId(){ + final String cloudRegionId = "region-one"; + VimRegisterResponse vimRegisterResponse = new VimRegisterResponse(); + vimRegisterResponse.setCloudRegionId(cloudRegionId); + assertEquals(vimRegisterResponse.getCloudRegionId(), cloudRegionId); + } +} |