Improve the UT coverage for libs 19/34519/2
authorSindhu A <arcot.sindhuri@huawei.com>
Wed, 7 Mar 2018 13:25:41 +0000 (13:25 +0000)
committerSindhu A <arcot.sindhuri@huawei.com>
Thu, 8 Mar 2018 06:01:04 +0000 (06:01 +0000)
Improve UT coverage for libs.

Change-Id: I7bbcaba76b4a0f9c43461b704d40b64ad763a461
Issue-ID: SO-369
Signed-off-by: Sindhu A <arcot.sindhuri@huawei.com>
heat-model/pom.xml
heat-model/src/test/main/java/com.woorea.openstack.heat.model/CreateStackParamTest.java [new file with mode: 0644]
heat-model/src/test/main/java/com.woorea.openstack.heat.model/ExplanationTest.java [new file with mode: 0644]
heat-model/src/test/main/java/com.woorea.openstack.heat.model/LinkTest.java [new file with mode: 0644]
heat-model/src/test/main/java/com.woorea.openstack.heat.model/ResourceTest.java [new file with mode: 0644]
heat-model/src/test/main/java/com.woorea.openstack.heat.model/ResourcesTest.java [new file with mode: 0644]
heat-model/src/test/main/java/com.woorea.openstack.heat.model/StackTest.java [new file with mode: 0644]
heat-model/src/test/main/java/com.woorea.openstack.heat.model/StacksTest.java [new file with mode: 0644]
heat-model/src/test/main/java/com.woorea.openstack.heat.model/UpdateStackParamTest.java [new file with mode: 0644]

index 52aa416..444adeb 100644 (file)
@@ -1,6 +1,14 @@
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
        <modelVersion>4.0.0</modelVersion>
-       <parent>
+    <dependencies>
+               <dependency>
+                       <groupId>junit</groupId>
+                       <artifactId>junit</artifactId>
+                       <version>4.12</version>
+                       <scope>test</scope>
+               </dependency>
+       </dependencies>
+    <parent>
                <groupId>org.onap.so.libs</groupId>
                <artifactId>openstack-java-sdk</artifactId>
                <version>1.2.0-SNAPSHOT</version>
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 (file)
index 0000000..75006fc
--- /dev/null
@@ -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<String, Object> parameters = new HashMap<String,Object>();
+        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<String, Object> parameters = new HashMap<String,Object>();
+        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 (file)
index 0000000..b9388b6
--- /dev/null
@@ -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 (file)
index 0000000..3b4561d
--- /dev/null
@@ -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 (file)
index 0000000..e3423fd
--- /dev/null
@@ -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<String> 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<Link> arrayList= new ArrayList<Link>();
+        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 (file)
index 0000000..b3b55d5
--- /dev/null
@@ -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<Resource> 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 (file)
index 0000000..2b90fd8
--- /dev/null
@@ -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<Link> arrayList= new ArrayList<Link>();
+        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<String, Object> files = new HashMap<String,Object>();
+        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 (file)
index 0000000..b7a01e2
--- /dev/null
@@ -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<Stack> 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 (file)
index 0000000..d1e22b1
--- /dev/null
@@ -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<String, Object> paramters = new HashMap<String,Object>();
+        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<String, Object> files = new HashMap<String,Object>();
+        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);
+    }
+}