From 7bbd089426cfd2097be1c7d7bc585c981995c8e0 Mon Sep 17 00:00:00 2001 From: subhash kumar singh Date: Mon, 12 Feb 2018 09:50:17 +0000 Subject: Improve code coverage for libs Improve code coverage for libs. Change-Id: I97474085887fb65dfd63b3687a44338171d8fe0b Issue-ID: SO-369 Signed-off-by: subhash kumar singh --- .../nova/model/SecurityGroupForCreateTest.java | 44 +++++ .../nova/model/SecurityGroupRuleForCreateTest.java | 94 ++++++++++ .../openstack/nova/model/SecurityGroupTest.java | 54 ++++++ .../openstack/nova/model/SecurityGroupsTest.java | 34 ++++ .../openstack/nova/model/ServerForCreateTest.java | 40 +++++ .../woorea/openstack/nova/model/ServerTest.java | 199 +++++++++++++++++++++ 6 files changed, 465 insertions(+) create mode 100644 nova-model/src/test/java/com/woorea/openstack/nova/model/SecurityGroupForCreateTest.java create mode 100644 nova-model/src/test/java/com/woorea/openstack/nova/model/SecurityGroupRuleForCreateTest.java create mode 100644 nova-model/src/test/java/com/woorea/openstack/nova/model/SecurityGroupTest.java create mode 100644 nova-model/src/test/java/com/woorea/openstack/nova/model/SecurityGroupsTest.java create mode 100644 nova-model/src/test/java/com/woorea/openstack/nova/model/ServerTest.java (limited to 'nova-model/src') diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/SecurityGroupForCreateTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/SecurityGroupForCreateTest.java new file mode 100644 index 0000000..e52dc4c --- /dev/null +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/SecurityGroupForCreateTest.java @@ -0,0 +1,44 @@ +/*- + * ============LICENSE_START======================================================= + * 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 com.woorea.openstack.nova.model; + +import org.junit.Test; + +public class SecurityGroupForCreateTest { + + SecurityGroupForCreate securityGroupForCreate = new SecurityGroupForCreate(); + + @Test + public void getName() throws Exception { + securityGroupForCreate.getName(); + } + + @Test + public void setName() throws Exception { + securityGroupForCreate.setName("test"); + } + + @Test + public void getDescription() throws Exception { + securityGroupForCreate.getDescription(); + } + + @Test + public void setDescription() throws Exception { + securityGroupForCreate.setDescription("desc"); + } + +} \ No newline at end of file diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/SecurityGroupRuleForCreateTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/SecurityGroupRuleForCreateTest.java new file mode 100644 index 0000000..0b272f7 --- /dev/null +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/SecurityGroupRuleForCreateTest.java @@ -0,0 +1,94 @@ +/*- + * ============LICENSE_START======================================================= + * 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 com.woorea.openstack.nova.model; + +import org.junit.Test; + +public class SecurityGroupRuleForCreateTest { + + SecurityGroupRuleForCreate securityGroupRuleForCreate = new SecurityGroupRuleForCreate(); + + @Test + public void getParentGroupId() throws Exception { + securityGroupRuleForCreate.getParentGroupId(); + } + + @Test + public void setParentGroupId() throws Exception { + securityGroupRuleForCreate.setParentGroupId("parent"); + } + + @Test + public void setParentGroupId1() throws Exception { + securityGroupRuleForCreate.setParentGroupId(1); + } + + @Test + public void getFromPort() throws Exception { + securityGroupRuleForCreate.getFromPort(); + } + + @Test + public void setFromPort() throws Exception { + securityGroupRuleForCreate.setFromPort(80); + } + + @Test + public void getToPort() throws Exception { + securityGroupRuleForCreate.getToPort(); + } + + @Test + public void setToPort() throws Exception { + securityGroupRuleForCreate.setToPort(80); + } + + @Test + public void getIpProtocol() throws Exception { + securityGroupRuleForCreate.getIpProtocol(); + } + + @Test + public void setIpProtocol() throws Exception { + securityGroupRuleForCreate.setIpProtocol("test"); + } + + @Test + public void getCidr() throws Exception { + securityGroupRuleForCreate.getCidr(); + } + + @Test + public void setCidr() throws Exception { + securityGroupRuleForCreate.setCidr("test"); + } + + @Test + public void getGroupId() throws Exception { + securityGroupRuleForCreate.getGroupId(); + } + + @Test + public void setGroupId() throws Exception { + securityGroupRuleForCreate.setGroupId("test"); + } + + @Test + public void setGroupId1() throws Exception { + securityGroupRuleForCreate.setGroupId(1); + } + +} \ No newline at end of file diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/SecurityGroupTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/SecurityGroupTest.java new file mode 100644 index 0000000..a337d45 --- /dev/null +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/SecurityGroupTest.java @@ -0,0 +1,54 @@ +/*- + * ============LICENSE_START======================================================= + * 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 com.woorea.openstack.nova.model; + +import org.junit.Test; + +public class SecurityGroupTest { + + SecurityGroup securityGroup = new SecurityGroup(); + + @Test + public void getId() throws Exception { + securityGroup.getId(); + } + + @Test + public void getName() throws Exception { + securityGroup.getName(); + } + + @Test + public void getDescription() throws Exception { + securityGroup.getDescription(); + } + + @Test + public void getTenantId() throws Exception { + securityGroup.getTenantId(); + } + + @Test + public void getRules() throws Exception { + securityGroup.getRules(); + } + + @Test + public void getLinks() throws Exception { + securityGroup.getLinks(); + } + +} \ No newline at end of file diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/SecurityGroupsTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/SecurityGroupsTest.java new file mode 100644 index 0000000..358a088 --- /dev/null +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/SecurityGroupsTest.java @@ -0,0 +1,34 @@ +/*- + * ============LICENSE_START======================================================= + * 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 com.woorea.openstack.nova.model; + +import org.junit.Test; + +public class SecurityGroupsTest { + + SecurityGroups securityGroups = new SecurityGroups(); + + @Test + public void getList() throws Exception { + securityGroups.getList(); + } + + @Test(expected = NullPointerException.class) + public void iterator() throws Exception { + securityGroups.iterator(); + } + +} \ No newline at end of file diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/ServerForCreateTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/ServerForCreateTest.java index b68b51a..bfc9ac4 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/ServerForCreateTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/ServerForCreateTest.java @@ -17,141 +17,181 @@ package com.woorea.openstack.nova.model; import org.junit.Test; +import java.util.Collections; +import java.util.HashMap; + public class ServerForCreateTest { + + ServerForCreate serverForCreate = new ServerForCreate(); + @Test public void getName() throws Exception { + serverForCreate.getName(); } @Test public void setName() throws Exception { + serverForCreate.setName("test"); } @Test public void getAdminPass() throws Exception { + serverForCreate.getAdminPass(); } @Test public void setAdminPass() throws Exception { + serverForCreate.setAdminPass("adminpass"); } @Test public void getImageRef() throws Exception { + serverForCreate.getImageRef(); } @Test public void setImageRef() throws Exception { + serverForCreate.setImageRef("image"); } @Test public void getFlavorRef() throws Exception { + serverForCreate.getFlavorRef(); } @Test public void setFlavorRef() throws Exception { + serverForCreate.setFlavorRef("test"); } @Test public void getAccessIPv4() throws Exception { + serverForCreate.getAccessIPv4(); } @Test public void setAccessIPv4() throws Exception { + serverForCreate.setAccessIPv4("test"); } @Test public void getAccessIPv6() throws Exception { + serverForCreate.getAccessIPv6(); } @Test public void setAccessIPv6() throws Exception { + serverForCreate.setAccessIPv6("ipv6"); } @Test public void getMin() throws Exception { + serverForCreate.getMin(); } @Test public void setMin() throws Exception { + serverForCreate.setMin(1); } @Test public void getMax() throws Exception { + serverForCreate.setMax(2); } @Test public void setMax() throws Exception { + serverForCreate.setMax(2); } @Test public void getDiskConfig() throws Exception { + serverForCreate.getDiskConfig(); } @Test public void setDiskConfig() throws Exception { + serverForCreate.setDiskConfig("config"); } @Test public void getKeyName() throws Exception { + serverForCreate.getKeyName(); } @Test public void setKeyName() throws Exception { + serverForCreate.setKeyName("test"); } @Test public void getPersonality() throws Exception { + serverForCreate.getPersonality(); } @Test public void setPersonality() throws Exception { + serverForCreate.setPersonality(Collections.emptyList()); } @Test public void getMetadata() throws Exception { + serverForCreate.getMetadata(); } @Test public void setMetadata() throws Exception { + serverForCreate.setMetadata(new HashMap()); } @Test public void getSecurityGroups() throws Exception { + serverForCreate.getSecurityGroups(); } @Test public void getUserData() throws Exception { + serverForCreate.getUserData(); } @Test public void setUserData() throws Exception { + serverForCreate.setUserData("test"); } @Test public void getAvailabilityZone() throws Exception { + serverForCreate.getAvailabilityZone(); } @Test public void setAvailabilityZone() throws Exception { + serverForCreate.setAvailabilityZone("test"); } @Test public void isConfigDrive() throws Exception { + serverForCreate.isConfigDrive(); } @Test public void setConfigDrive() throws Exception { + serverForCreate.setConfigDrive(true); } @Test public void getNetworks() throws Exception { + serverForCreate.getNetworks(); } @Test public void setNetworks() throws Exception { + serverForCreate.setNetworks(Collections.emptyList()); } @Test public void addNetworks() throws Exception { + serverForCreate.addNetworks("test", "localhost"); } } \ No newline at end of file diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/ServerTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/ServerTest.java new file mode 100644 index 0000000..ba1a11d --- /dev/null +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/ServerTest.java @@ -0,0 +1,199 @@ +/*- + * ============LICENSE_START======================================================= + * 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 com.woorea.openstack.nova.model; + +import org.junit.Test; + +public class ServerTest { + + Server server = new Server(); + + @Test + public void getId() throws Exception { + server.getId(); + } + + @Test + public void getName() throws Exception { + server.getName(); + } + + @Test + public void getAddresses() throws Exception { + server.getAddresses(); + } + + @Test + public void getLinks() throws Exception { + server.getLinks(); + } + + @Test + public void getImage() throws Exception { + server.getImage(); + } + + @Test + public void setImage() throws Exception { + server.setImage(new Image()); + } + + @Test + public void getFlavor() throws Exception { + server.getFlavor(); + } + + @Test + public void setFlavor() throws Exception { + server.setFlavor(new Flavor()); + } + + @Test + public void getAccessIPv4() throws Exception { + server.getAccessIPv4(); + } + + @Test + public void getAccessIPv6() throws Exception { + server.getAccessIPv6(); + } + + @Test + public void getConfigDrive() throws Exception { + server.getConfigDrive(); + } + + @Test + public void getStatus() throws Exception { + server.getStatus(); + } + + @Test + public void getProgress() throws Exception { + server.getProgress(); + } + + @Test + public void getFault() throws Exception { + server.getFault(); + } + + @Test + public void getTenantId() throws Exception { + server.getTenantId(); + } + + @Test + public void getUserId() throws Exception { + server.getUserId(); + } + + @Test + public void getKeyName() throws Exception { + server.getKeyName(); + } + + @Test + public void getHostId() throws Exception { + server.getHostId(); + } + + @Test + public void getUpdated() throws Exception { + server.getUpdated(); + } + + @Test + public void getCreated() throws Exception { + server.getCreated(); + } + + @Test + public void getMetadata() throws Exception { + server.getMetadata(); + } + + @Test + public void getSecurityGroups() throws Exception { + server.getSecurityGroups(); + } + + @Test + public void getTaskState() throws Exception { + server.getTaskState(); + } + + @Test + public void getPowerState() throws Exception { + server.getPowerState(); + } + + @Test + public void getVmState() throws Exception { + server.getVmState(); + } + + @Test + public void getHost() throws Exception { + server.getHost(); + } + + @Test + public void getInstanceName() throws Exception { + server.getInstanceName(); + } + + @Test + public void getHypervisorHostname() throws Exception { + server.getHypervisorHostname(); + } + + @Test + public void getDiskConfig() throws Exception { + server.getDiskConfig(); + } + + @Test + public void getAvailabilityZone() throws Exception { + server.getAvailabilityZone(); + } + + @Test + public void getLaunchedAt() throws Exception { + server.getLaunchedAt(); + } + + @Test + public void getTerminatedAt() throws Exception { + server.getTerminatedAt(); + } + + @Test + public void getOsExtendedVolumesAttached() throws Exception { + server.getOsExtendedVolumesAttached(); + } + + @Test + public void getUuid() throws Exception { + server.getUuid(); + } + + @Test + public void getAdminPass() throws Exception { + server.getAdminPass(); + } + +} \ No newline at end of file -- cgit 1.2.3-korg