From 89a36a48001e19f57a09bb432e7baf7e1034599d Mon Sep 17 00:00:00 2001 From: amshegokar Date: Mon, 5 Mar 2018 14:52:28 +0530 Subject: 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 --- .../adapter/openstack/heat/model/TestSnapshot.java | 75 ++++++++++++++++++++++ .../heat/model/TestSnapshotRestoreResponse.java | 61 ++++++++++++++++++ .../adapter/openstack/heat/model/TestTemplate.java | 48 ++++++++++++++ .../adapter/openstack/heat/model/TestVolume.java | 47 ++++++++++++++ .../adapter/openstack/heat/model/TestVolume_.java | 75 ++++++++++++++++++++++ 5 files changed, 306 insertions(+) create mode 100644 appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/test/java/org/onap/appc/adapter/openstack/heat/model/TestSnapshot.java create mode 100644 appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/test/java/org/onap/appc/adapter/openstack/heat/model/TestSnapshotRestoreResponse.java create mode 100644 appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/test/java/org/onap/appc/adapter/openstack/heat/model/TestTemplate.java create mode 100644 appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/test/java/org/onap/appc/adapter/openstack/heat/model/TestVolume.java create mode 100644 appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/test/java/org/onap/appc/adapter/openstack/heat/model/TestVolume_.java (limited to 'appc-adapters') 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); + } +} -- cgit 1.2.3-korg