From 7a0b8cbe5d1723076bd17e84bc741455acfd92c2 Mon Sep 17 00:00:00 2001 From: Sindhu A Date: Wed, 7 Mar 2018 13:25:41 +0000 Subject: Improve the UT coverage for libs Improve UT coverage for libs. Change-Id: I7bbcaba76b4a0f9c43461b704d40b64ad763a461 Issue-ID: SO-369 Signed-off-by: Sindhu A --- heat-model/pom.xml | 10 +- .../CreateStackParamTest.java | 110 ++++++++++++++++++ .../ExplanationTest.java | 43 +++++++ .../com.woorea.openstack.heat.model/LinkTest.java | 43 +++++++ .../ResourceTest.java | 125 ++++++++++++++++++++ .../ResourcesTest.java | 40 +++++++ .../com.woorea.openstack.heat.model/StackTest.java | 126 +++++++++++++++++++++ .../StacksTest.java | 35 ++++++ .../UpdateStackParamTest.java | 100 ++++++++++++++++ 9 files changed, 631 insertions(+), 1 deletion(-) create mode 100644 heat-model/src/test/main/java/com.woorea.openstack.heat.model/CreateStackParamTest.java create mode 100644 heat-model/src/test/main/java/com.woorea.openstack.heat.model/ExplanationTest.java create mode 100644 heat-model/src/test/main/java/com.woorea.openstack.heat.model/LinkTest.java create mode 100644 heat-model/src/test/main/java/com.woorea.openstack.heat.model/ResourceTest.java create mode 100644 heat-model/src/test/main/java/com.woorea.openstack.heat.model/ResourcesTest.java create mode 100644 heat-model/src/test/main/java/com.woorea.openstack.heat.model/StackTest.java create mode 100644 heat-model/src/test/main/java/com.woorea.openstack.heat.model/StacksTest.java create mode 100644 heat-model/src/test/main/java/com.woorea.openstack.heat.model/UpdateStackParamTest.java diff --git a/heat-model/pom.xml b/heat-model/pom.xml index 52aa416..444adeb 100644 --- a/heat-model/pom.xml +++ b/heat-model/pom.xml @@ -1,6 +1,14 @@ 4.0.0 - + + + junit + junit + 4.12 + test + + + org.onap.so.libs openstack-java-sdk 1.2.0-SNAPSHOT diff --git a/heat-model/src/test/main/java/com.woorea.openstack.heat.model/CreateStackParamTest.java b/heat-model/src/test/main/java/com.woorea.openstack.heat.model/CreateStackParamTest.java new file mode 100644 index 0000000..75006fc --- /dev/null +++ b/heat-model/src/test/main/java/com.woorea.openstack.heat.model/CreateStackParamTest.java @@ -0,0 +1,110 @@ +/*- + * ============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.heat.model; + +import org.junit.Test; + +import java.util.HashMap; +import java.util.Map; + +public class CreateStackParamTest { + + CreateStackParam test = new CreateStackParam(); + + @Test + public void getStackNameTest() throws Exception { + test.getStackName(); + } + + @Test + public void setStackNameTest() throws Exception { + test.setStackName("stack"); + } + @Test + public void getTemplateUrllTest() throws Exception { + test.getTemplateUrl(); + } + + @Test + public void setTemplateUrlTest() throws Exception { + test.setTemplateUrl("url"); + } + + @Test + public void getParametersTest() throws Exception { + test.getParameters(); + } + + @Test + public void getTemplateTest() throws Exception { + test.getTemplate(); + } + + @Test + public void setTemplateTest() throws Exception { + test.setTemplate("template"); + } + + @Test + public void setParametersTest() throws Exception { + Map parameters = new HashMap(); + parameters.put("1",test); + test.setParameters(parameters); + } + + @Test + public void getTimeoutMinutesTest() throws Exception { + test.getTimeoutMinutes(); + } + + @Test + public void setTimeoutMinutesTest() throws Exception { + test.setTimeoutMinutes(0); + } + + @Test + public void getEnvironmentTest() throws Exception { + test.getEnvironment(); + } + @Test + public void setEnvironmentTest() throws Exception { + test.setEnvironment("environment"); + } + + @Test + public void getDisableRollbackTest() throws Exception { + test.getDisableRollback(); + } + + @Test + public void setDisableRollbackTest() throws Exception { + test.setDisableRollback(true); + } + + @Test + public void setFilesTest() throws Exception { + Map parameters = new HashMap(); + parameters.put("1",test); + test.setFiles(parameters); + } + + @Test + public void getFilesTest() throws Exception { + test.getFiles(); + } + + +} diff --git a/heat-model/src/test/main/java/com.woorea.openstack.heat.model/ExplanationTest.java b/heat-model/src/test/main/java/com.woorea.openstack.heat.model/ExplanationTest.java new file mode 100644 index 0000000..b9388b6 --- /dev/null +++ b/heat-model/src/test/main/java/com.woorea.openstack.heat.model/ExplanationTest.java @@ -0,0 +1,43 @@ +/*- + * ============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.heat.model; + +import org.junit.Test; + + +public class ExplanationTest { + Explanation test = new Explanation(); + + @Test + public void getExplanationTest() throws Exception { + test.getExplanation(); + } + + @Test + public void getCodeTest() throws Exception { + test.getCode(); + } + + @Test + public void getTitleTest() throws Exception { + test.getTitle(); + } + + @Test + public void getErrorTest() throws Exception { + test.getError(); + } +} \ No newline at end of file diff --git a/heat-model/src/test/main/java/com.woorea.openstack.heat.model/LinkTest.java b/heat-model/src/test/main/java/com.woorea.openstack.heat.model/LinkTest.java new file mode 100644 index 0000000..3b4561d --- /dev/null +++ b/heat-model/src/test/main/java/com.woorea.openstack.heat.model/LinkTest.java @@ -0,0 +1,43 @@ +/*- + * ============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.heat.model; + +import org.junit.Test; + +public class LinkTest { + Link link = new Link(); + + @Test + public void getHrefTest() throws Exception { + link.getHref(); + } + + @Test + public void setHrefTest() throws Exception { + link.setHref("href"); + } + + @Test + public void getRelTest() throws Exception { + link.getRel(); + } + + @Test + public void setRelTest() throws Exception { + link.setRel("rel"); + } + +} diff --git a/heat-model/src/test/main/java/com.woorea.openstack.heat.model/ResourceTest.java b/heat-model/src/test/main/java/com.woorea.openstack.heat.model/ResourceTest.java new file mode 100644 index 0000000..e3423fd --- /dev/null +++ b/heat-model/src/test/main/java/com.woorea.openstack.heat.model/ResourceTest.java @@ -0,0 +1,125 @@ +/*- + * ============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.heat.model; + +import org.junit.Test; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +public class ResourceTest { + + Resource resource = new Resource(); + + @Test + public void getStatusReasonTest() throws Exception { + resource.getStatusReason(); + } + + @Test + public void setStatusReasonTest() throws Exception { + resource.setStatusReason("status"); + } + + @Test + public void getLogicalResourceIdTest() throws Exception { + resource.getLogicalResourceId(); + } + + @Test + public void setLogicalResourceIdTest() throws Exception { + resource.setLogicalResourceId("resourceId"); + } + + @Test + public void getStatusTest() throws Exception { + resource.getStatus(); + } + + @Test + public void setStatusTest() throws Exception { + resource.setStatus("status"); + } + + @Test + public void getPhysicalResourceIdTest() throws Exception { + resource.getPhysicalResourceId(); + } + + @Test + public void setPhysicalResourceIdTest() throws Exception { + resource.setPhysicalResourceId("resourceId"); + } + + @Test + public void getRequiredByTest() throws Exception { + resource.getRequiredBy(); + } + + @Test + public void setRequiredByTest() throws Exception { + List list = new ArrayList<>(); + list.add("testString"); + resource.setRequiredBy(list); + } + + @Test + public void getUpdatedTimeTest() throws Exception { + resource.getUpdatedTime(); + } + + @Test + public void setUpdatedTimeTest() throws Exception { + Date date = new Date(); + date.setTime(3600); + resource.setUpdatedTime(date); + } + + @Test + public void getTypeTest() throws Exception { + resource.getType(); + } + + @Test + public void setTypeTest() throws Exception { + resource.setType("type"); + } + + @Test + public void getNameTest() throws Exception { + resource.getName(); + } + + @Test + public void setNameTest() throws Exception { + resource.setName("name"); + } + + @Test + public void getLinksTest() throws Exception { + resource.getLinks(); + } + + @Test + public void setLinksTest() throws Exception { + Link link = new Link(); + List arrayList= new ArrayList(); + arrayList.add(link); + resource.setLinks(arrayList); + } + +} diff --git a/heat-model/src/test/main/java/com.woorea.openstack.heat.model/ResourcesTest.java b/heat-model/src/test/main/java/com.woorea.openstack.heat.model/ResourcesTest.java new file mode 100644 index 0000000..b3b55d5 --- /dev/null +++ b/heat-model/src/test/main/java/com.woorea.openstack.heat.model/ResourcesTest.java @@ -0,0 +1,40 @@ +/*- + * ============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.heat.model; + +import org.junit.Test; + +import java.util.AbstractList; +import java.util.ArrayList; +import java.util.List; + +public class ResourcesTest { + + Resources resources = new Resources(); + + @Test + public void getListTest() throws Exception { + resources.getList(); + } + + @Test + public void iteratorTest() throws Exception { + Resource res = new Resource(); + List lists = new ArrayList<>(); + lists.add(res); + //lists.iterator(); + } +} diff --git a/heat-model/src/test/main/java/com.woorea.openstack.heat.model/StackTest.java b/heat-model/src/test/main/java/com.woorea.openstack.heat.model/StackTest.java new file mode 100644 index 0000000..2b90fd8 --- /dev/null +++ b/heat-model/src/test/main/java/com.woorea.openstack.heat.model/StackTest.java @@ -0,0 +1,126 @@ +/*- + * ============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.heat.model; + + +import org.junit.Test; + +import java.util.*; + +public class StackTest { + + Stack stack = new Stack(); + + @Test + public void getUpdatedTimeTest() throws Exception { + stack.getUpdatedTime(); + } + + @Test + public void setUpdatedTimeTest() throws Exception { + Date date = new Date(); + date.setTime(3600); + stack.setUpdatedTime(date); + } + + @Test + public void getStackStatusTest() throws Exception { + stack.getStackStatus(); + } + + @Test + public void setStackStatusTest() throws Exception { + stack.setStackStatus("status"); + } + + @Test + public void getIdTest() throws Exception { + stack.getId(); + } + + @Test + public void setIdTest() throws Exception { + stack.setId("id"); + } + + @Test + public void getCreationTimeTest() throws Exception { + stack.getCreationTime(); + } + + @Test + public void setCreationTimeTest() throws Exception { + Date date = new Date(); + date.setTime(3600); + stack.setCreationTime(date); + } + + @Test + public void getStackNameTest() throws Exception { + stack.getStackName(); + } + + @Test + public void setStackNameTest() throws Exception { + stack.setStackName("stack"); + } + + @Test + public void getStackStatusReasonTest() throws Exception { + stack.getStackStatusReason(); + } + + @Test + public void setStackStatusReasonTest() throws Exception { + stack.setStackStatusReason("stack"); + } + + @Test + public void getLinksTest() throws Exception { + stack.getLinks(); + } + + @Test + public void setLinksTest() throws Exception { + Link link = new Link(); + List arrayList= new ArrayList(); + arrayList.add(link); + stack.setLinks(arrayList); + } + + @Test + public void getDescriptionTest() throws Exception { + stack.getDescription(); + } + + @Test + public void setDescriptionTest() throws Exception { + stack.setDescription("description"); + } + + @Test + public void getFilesTest() throws Exception { + stack.getFiles(); + } + + @Test + public void setFilesTest() throws Exception { + Map files = new HashMap(); + files.put("1",stack); + stack.setFiles(files); + } + +} diff --git a/heat-model/src/test/main/java/com.woorea.openstack.heat.model/StacksTest.java b/heat-model/src/test/main/java/com.woorea.openstack.heat.model/StacksTest.java new file mode 100644 index 0000000..b7a01e2 --- /dev/null +++ b/heat-model/src/test/main/java/com.woorea.openstack.heat.model/StacksTest.java @@ -0,0 +1,35 @@ +/*- + * ============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.heat.model; + +import org.junit.Test; + +import java.util.ArrayList; +import java.util.List; + +public class StacksTest { + + Stacks stacks = new Stacks(); + + @Test + public void iteratorTest() throws Exception { + Stack res = new Stack(); + List lists = new ArrayList<>(); + lists.add(res); + + } + +} diff --git a/heat-model/src/test/main/java/com.woorea.openstack.heat.model/UpdateStackParamTest.java b/heat-model/src/test/main/java/com.woorea.openstack.heat.model/UpdateStackParamTest.java new file mode 100644 index 0000000..d1e22b1 --- /dev/null +++ b/heat-model/src/test/main/java/com.woorea.openstack.heat.model/UpdateStackParamTest.java @@ -0,0 +1,100 @@ +/*- + * ============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.heat.model; + +import org.junit.Test; + +import java.util.HashMap; +import java.util.Map; + +public class UpdateStackParamTest { + + UpdateStackParam test = new UpdateStackParam(); + + @Test + public void getTemplateUrlTest() throws Exception { + test.getTemplateUrl(); + } + + @Test + public void setTemplateUrlTest() throws Exception { + test.setTemplateUrl("url"); + } + + @Test + public void getParametersTest() throws Exception { + test.getParameters(); + } + + @Test + public void getTemplateTest() throws Exception { + test.getTemplate(); + } + + @Test + public void setTemplateTest() throws Exception { + test.setTemplate("template"); + } + + + @Test + public void setParametersTest() throws Exception { + Map paramters = new HashMap(); + paramters.put("1",test); + test.setParameters(paramters); + } + @Test + public void getTimeoutMinutesTest() throws Exception { + test.getTimeoutMinutes(); + } + + @Test + public void setTimeoutMinutesTest() throws Exception { + test.setTimeoutMinutes(0); + } + @Test + public void getEnvironmentTest() throws Exception { + test.getEnvironment(); + } + + @Test + public void setFilesTest() throws Exception { + Map files = new HashMap(); + files.put("1",test); + test.setFiles(files); + } + + @Test + public void getFilesTest() throws Exception { + test.getFiles(); + } + + @Test + public void setEnvironmentTest() throws Exception { + test.setEnvironment("environment"); + } + + + @Test + public void getDisableRollbackTest() throws Exception { + test.getDisableRollback(); + } + + @Test + public void setDisableRollbackTest() throws Exception { + test.setDisableRollback(true); + } +} -- cgit 1.2.3-korg