diff options
author | amshegokar <AS00500801@techmahindra.com> | 2018-03-05 14:52:28 +0530 |
---|---|---|
committer | Takamune Cho <tc012c@att.com> | 2018-03-05 16:54:58 +0000 |
commit | 89a36a48001e19f57a09bb432e7baf7e1034599d (patch) | |
tree | 5ed0820a95659f082011d930980b672380ec5ef2 /appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src | |
parent | 2a65f44fc463f204ef51367dff9a894ce0acceb8 (diff) |
Unit Test Coverage Part:2
Unit Test Coverage for:
1. Snapshot.java
2. Volume.java
3. Volume_.java
4. Template.java
5. SnapshotRestoreResponse.java
Sonar Link:
https://sonar.onap.org/code?id=org.onap.appc%3Aappc&selected=org.onap.appc%3Aappc-iaas-adapter-bundle%3Asrc%2Fmain%2Fjava%2Forg%2Fonap%2Fappc%2Fadapter%2Fopenstack%2Fheat%2Fmodel
Change-Id: I18ecc259973bbd3934f9ccd4cc20d897444d9d76
Issue-ID: APPC-686
Signed-off-by: amshegokar <AS00500801@techmahindra.com>
Diffstat (limited to 'appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src')
5 files changed, 306 insertions, 0 deletions
diff --git a/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/test/java/org/onap/appc/adapter/openstack/heat/model/TestSnapshot.java b/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/test/java/org/onap/appc/adapter/openstack/heat/model/TestSnapshot.java new file mode 100644 index 000000000..1adc63e87 --- /dev/null +++ b/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/test/java/org/onap/appc/adapter/openstack/heat/model/TestSnapshot.java @@ -0,0 +1,75 @@ +/* +* ============LICENSE_START======================================================= +* ONAP : APPC +* ================================================================================ +* Copyright 2018 TechMahindra +*================================================================================= +* 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. +* ============LICENSE_END========================================================= +*/ +package org.onap.appc.adapter.openstack.heat.model; + +import static org.junit.Assert.*; + +import org.junit.Before; +import org.junit.Test; + +public class TestSnapshot { + private Snapshot snapshot; + + @Before + public void setUp() { + snapshot = new Snapshot(); + } + + @Test + public void testGetBackupId() { + snapshot.setId("222"); + assertNotNull(snapshot.getId()); + assertEquals(snapshot.getId(), "222"); + } + + @Test + public void testGetName() { + snapshot.setName("ABC"); + assertNotNull(snapshot.getName()); + assertEquals(snapshot.getName(), "ABC"); + } + + @Test + public void testGetStatus() { + snapshot.setStatus("status"); + assertNotNull(snapshot.getStatus()); + assertEquals(snapshot.getStatus(), "status"); + } + + @Test + public void testGetStatusReason() { + snapshot.setStatusReason("statusReason"); + assertNotNull(snapshot.getStatusReason()); + assertEquals(snapshot.getStatusReason(), "statusReason"); + } + + @Test + public void testGetCreationTime() { + snapshot.setCreationTime("01-March-2018"); + assertNotNull(snapshot.getCreationTime()); + assertEquals(snapshot.getCreationTime(), "01-March-2018"); + } + + @Test + public void testToString_ReturnNonEmptyString() { + assertNotEquals(snapshot.toString(), ""); + assertNotEquals(snapshot.toString(), null); + } +} diff --git a/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/test/java/org/onap/appc/adapter/openstack/heat/model/TestSnapshotRestoreResponse.java b/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/test/java/org/onap/appc/adapter/openstack/heat/model/TestSnapshotRestoreResponse.java new file mode 100644 index 000000000..3947161d8 --- /dev/null +++ b/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/test/java/org/onap/appc/adapter/openstack/heat/model/TestSnapshotRestoreResponse.java @@ -0,0 +1,61 @@ +/* +* ============LICENSE_START======================================================= +* ONAP : APPC +* ================================================================================ +* Copyright 2018 TechMahindra +*================================================================================= +* 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. +* ============LICENSE_END========================================================= +*/ +package org.onap.appc.adapter.openstack.heat.model; + +import static org.junit.Assert.*; + +import org.junit.Before; +import org.junit.Test; + +public class TestSnapshotRestoreResponse { + private SnapshotRestoreResponse snapshotRestoreResponse; + + @Before + public void setUp() { + snapshotRestoreResponse = new SnapshotRestoreResponse(); + } + + @Test + public void testGetCode() { + snapshotRestoreResponse.setCode("200"); + assertNotNull(snapshotRestoreResponse.getCode()); + assertEquals(snapshotRestoreResponse.getCode(), "200"); + } + + @Test + public void testMessage() { + snapshotRestoreResponse.setMessage("Success"); + assertNotNull(snapshotRestoreResponse.getMessage()); + assertEquals(snapshotRestoreResponse.getMessage(), "Success"); + } + + @Test + public void testTitle() { + snapshotRestoreResponse.setTitle("A1"); + assertNotNull(snapshotRestoreResponse.getTitle()); + assertEquals(snapshotRestoreResponse.getTitle(), "A1"); + } + + @Test + public void testToString_ReturnNonEmptyString() { + assertNotEquals(snapshotRestoreResponse.toString(), ""); + assertNotEquals(snapshotRestoreResponse.toString(), null); + } +} diff --git a/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/test/java/org/onap/appc/adapter/openstack/heat/model/TestTemplate.java b/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/test/java/org/onap/appc/adapter/openstack/heat/model/TestTemplate.java new file mode 100644 index 000000000..e22548077 --- /dev/null +++ b/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/test/java/org/onap/appc/adapter/openstack/heat/model/TestTemplate.java @@ -0,0 +1,48 @@ +/* +* ============LICENSE_START======================================================= +* ONAP : APPC +* ================================================================================ +* Copyright 2018 TechMahindra +*================================================================================= +* 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. +* ============LICENSE_END========================================================= +*/ +package org.onap.appc.adapter.openstack.heat.model; + +import static org.junit.Assert.*; + +import org.junit.Before; +import org.junit.Test; + +public class TestTemplate { + private Template template; + + @Before + public void setUp() { + template = new Template(); + } + + @Test + public void testGetHeatTemplateVersion() { + template.setHeatTemplateVersion("1.0"); + assertNotNull(template.getHeatTemplateVersion()); + assertEquals(template.getHeatTemplateVersion(), "1.0"); + } + + @Test + public void testToString_ReturnNonEmptyString() { + assertNotEquals(template.toString(), ""); + assertNotEquals(template.toString(), null); + } + +} diff --git a/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/test/java/org/onap/appc/adapter/openstack/heat/model/TestVolume.java b/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/test/java/org/onap/appc/adapter/openstack/heat/model/TestVolume.java new file mode 100644 index 000000000..c70c261c4 --- /dev/null +++ b/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/test/java/org/onap/appc/adapter/openstack/heat/model/TestVolume.java @@ -0,0 +1,47 @@ +/* +* ============LICENSE_START======================================================= +* ONAP : APPC +* ================================================================================ +* Copyright 2018 TechMahindra +*================================================================================= +* 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. +* ============LICENSE_END========================================================= +*/ +package org.onap.appc.adapter.openstack.heat.model; + +import static org.junit.Assert.*; + +import org.junit.Before; +import org.junit.Test; + +public class TestVolume { + private Volume volume; + + @Before + public void setUp() { + volume = new Volume(); + } + + @Test + public void testGetType() { + volume.setType("A"); + assertNotNull(volume.getType()); + assertEquals(volume.getType(), "A"); + } + + @Test + public void testToString_ReturnNonEmptyString() { + assertNotEquals(volume.toString(), ""); + assertNotEquals(volume.toString(), null); + } +} diff --git a/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/test/java/org/onap/appc/adapter/openstack/heat/model/TestVolume_.java b/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/test/java/org/onap/appc/adapter/openstack/heat/model/TestVolume_.java new file mode 100644 index 000000000..f20cea445 --- /dev/null +++ b/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/test/java/org/onap/appc/adapter/openstack/heat/model/TestVolume_.java @@ -0,0 +1,75 @@ +/* +* ============LICENSE_START======================================================= +* ONAP : APPC +* ================================================================================ +* Copyright 2018 TechMahindra +*================================================================================= +* 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. +* ============LICENSE_END========================================================= +*/ +package org.onap.appc.adapter.openstack.heat.model; + +import static org.junit.Assert.*; + +import org.junit.Before; +import org.junit.Test; + +public class TestVolume_ { + private Volume_ volume_; + + @Before + public void setUp() { + volume_ = new Volume_(); + } + + @Test + public void testGetStatus() { + volume_.setStatus("Success"); + assertNotNull(volume_.getStatus()); + assertEquals(volume_.getStatus(), "Success"); + } + + @Test + public void testGetName() { + volume_.setName("XYZ"); + assertNotNull(volume_.getName()); + assertEquals(volume_.getName(), "XYZ"); + } + + @Test + public void testGetResourceId() { + volume_.setResourceId("333"); + assertNotNull(volume_.getResourceId()); + assertEquals(volume_.getResourceId(), "333"); + } + + @Test + public void testGetAction() { + volume_.setAction("action"); + assertNotNull(volume_.getAction()); + assertEquals(volume_.getAction(), "action"); + } + + @Test + public void testGetType() { + volume_.setType("A"); + assertNotNull(volume_.getType()); + assertEquals(volume_.getType(), "A"); + } + + @Test + public void testToString_ReturnNonEmptyString() { + assertNotEquals(volume_.toString(), ""); + assertNotEquals(volume_.toString(), null); + } +} |