Adding UT for MSO catalogdb POJO 07/17307/3
authorSeshu-Kumar-M <seshu.kumar.m@huawei.com>
Thu, 5 Oct 2017 05:59:34 +0000 (11:29 +0530)
committerSeshu Kumar M <seshu.kumar.m@huawei.com>
Fri, 6 Oct 2017 04:51:44 +0000 (04:51 +0000)
UT-Step6

IssueId: SO-172

Change-Id: I18ba0ebfd372b06e688e5a1b6d9e8b8d34cab227
Signed-off-by: Seshu-Kumar-M <seshu.kumar.m@huawei.com>
mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/VfModuleTest.java [new file with mode: 0644]
mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/VnfRecipeTest.java [new file with mode: 0644]
mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/VnfResourceTest.java [new file with mode: 0644]

diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/VfModuleTest.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/VfModuleTest.java
new file mode 100644 (file)
index 0000000..9409a64
--- /dev/null
@@ -0,0 +1,63 @@
+/*-\r
+ * ============LICENSE_START=======================================================\r
+ * ONAP - SO\r
+ * ================================================================================\r
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
+ * ================================================================================\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ * \r
+ *      http://www.apache.org/licenses/LICENSE-2.0\r
+ * \r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ * ============LICENSE_END=========================================================\r
+ */\r
+\r
+package org.openecomp.mso.db.catalog.test;\r
+\r
+import static org.junit.Assert.assertTrue;\r
+\r
+import java.sql.Timestamp;\r
+\r
+import org.junit.Test;\r
+import org.openecomp.mso.db.catalog.beans.VfModule;\r
+\r
+/**\r
+ */\r
+\r
+public class VfModuleTest {\r
+\r
+       @Test\r
+       public final void vfModuleDataTest() {\r
+               VfModule vfModule = new VfModule();\r
+               vfModule.setCreated(new Timestamp(System.currentTimeMillis()));\r
+               assertTrue(vfModule.getCreated() != null);\r
+               vfModule.setDescription("description");\r
+               assertTrue(vfModule.getDescription().equalsIgnoreCase("description"));\r
+\r
+               vfModule.setModelInvariantUUID("action");\r
+               assertTrue(vfModule.getModelInvariantUUID().equalsIgnoreCase("action"));\r
+\r
+               vfModule.setModelName("modelName");\r
+               assertTrue(vfModule.getModelName().equalsIgnoreCase("modelName"));\r
+\r
+               vfModule.setModelUUID("modelUUID");\r
+               assertTrue(vfModule.getModelUUID().equalsIgnoreCase("modelUUID"));\r
+               vfModule.setModelVersion("modelVersion");\r
+               assertTrue(vfModule.getModelVersion().equalsIgnoreCase("modelVersion"));\r
+               vfModule.setHeatTemplateArtifactUUId("heatTemplateArtifactUUId");\r
+               assertTrue(vfModule.getHeatTemplateArtifactUUId().equalsIgnoreCase("heatTemplateArtifactUUId"));\r
+               vfModule.setVnfResourceModelUUId("vnfResourceModelUUId");\r
+               assertTrue(vfModule.getVnfResourceModelUUId().equalsIgnoreCase("vnfResourceModelUUId"));\r
+               vfModule.setIsBase(1);\r
+               assertTrue(vfModule.isBase());\r
+//             assertTrue(vfModule.toString() == null);\r
+\r
+       }\r
+\r
+}\r
diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/VnfRecipeTest.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/VnfRecipeTest.java
new file mode 100644 (file)
index 0000000..95e45f7
--- /dev/null
@@ -0,0 +1,63 @@
+/*-\r
+ * ============LICENSE_START=======================================================\r
+ * ONAP - SO\r
+ * ================================================================================\r
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
+ * ================================================================================\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ * \r
+ *      http://www.apache.org/licenses/LICENSE-2.0\r
+ * \r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ * ============LICENSE_END=========================================================\r
+ */\r
+\r
+package org.openecomp.mso.db.catalog.test;\r
+\r
+import static org.junit.Assert.assertTrue;\r
+\r
+import java.sql.Timestamp;\r
+\r
+import org.junit.Test;\r
+import org.openecomp.mso.db.catalog.beans.VnfRecipe;\r
+\r
+/**\r
+ */\r
+\r
+public class VnfRecipeTest {\r
+\r
+       @Test\r
+       public final void vnfRecipeDataTest() {\r
+               VnfRecipe vnfRecipe = new VnfRecipe();\r
+               vnfRecipe.setCreated(new Timestamp(System.currentTimeMillis()));\r
+               assertTrue(vnfRecipe.getCreated() != null);\r
+               vnfRecipe.setDescription("description");\r
+               assertTrue(vnfRecipe.getDescription().equalsIgnoreCase("description"));\r
+\r
+               vnfRecipe.setOrchestrationUri("orchestrationUri");\r
+               assertTrue(vnfRecipe.getOrchestrationUri().equalsIgnoreCase("orchestrationUri"));\r
+\r
+               vnfRecipe.setRecipeTimeout(1);\r
+               assertTrue(vnfRecipe.getRecipeTimeout() == 1);\r
+               vnfRecipe.setVnfType("vnfType");\r
+               assertTrue(vnfRecipe.getVnfType().equalsIgnoreCase("vnfType"));\r
+\r
+               vnfRecipe.setServiceType("serviceType");\r
+               assertTrue(vnfRecipe.getServiceType().equalsIgnoreCase("serviceType"));\r
+               vnfRecipe.setVersion("version");\r
+               assertTrue(vnfRecipe.getVersion().equalsIgnoreCase("version"));\r
+               vnfRecipe.setVnfParamXSD("vnfParamXSD");\r
+               assertTrue(vnfRecipe.getVnfParamXSD().equalsIgnoreCase("vnfParamXSD"));\r
+               vnfRecipe.setVfModuleId("vfModuleId");\r
+               assertTrue(vnfRecipe.getVfModuleId().equalsIgnoreCase("vfModuleId"));\r
+//             assertTrue(vnfRecipe.toString() == null);\r
+\r
+       }\r
+\r
+}\r
diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/VnfResourceTest.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/VnfResourceTest.java
new file mode 100644 (file)
index 0000000..68749e3
--- /dev/null
@@ -0,0 +1,82 @@
+/*-\r
+ * ============LICENSE_START=======================================================\r
+ * ONAP - SO\r
+ * ================================================================================\r
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
+ * ================================================================================\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ * \r
+ *      http://www.apache.org/licenses/LICENSE-2.0\r
+ * \r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ * ============LICENSE_END=========================================================\r
+ */\r
+\r
+package org.openecomp.mso.db.catalog.test;\r
+\r
+import static org.junit.Assert.assertTrue;\r
+\r
+import java.sql.Timestamp;\r
+import java.util.HashSet;\r
+import java.util.Set;\r
+\r
+import org.junit.Test;\r
+import org.openecomp.mso.db.catalog.beans.VfModule;\r
+import org.openecomp.mso.db.catalog.beans.VnfResource;\r
+import org.openecomp.mso.db.catalog.beans.VnfResourceCustomization;\r
+\r
+/**\r
+ */\r
+\r
+public class VnfResourceTest {\r
+\r
+       @Test\r
+       public final void vnfResourceDataTest() {\r
+\r
+               VnfResource vnfResource = new VnfResource();\r
+               vnfResource.setCreated(new Timestamp(System.currentTimeMillis()));\r
+               assertTrue(vnfResource.getCreated() != null);\r
+               vnfResource.setDescription("description");\r
+               assertTrue(vnfResource.getDescription().equalsIgnoreCase("description"));\r
+\r
+               vnfResource.setAicVersionMax("aicVersionMax");\r
+               assertTrue(vnfResource.getAicVersionMax().equalsIgnoreCase("aicVersionMax"));\r
+\r
+               vnfResource.setAicVersionMin("aicVersionMin");\r
+               assertTrue(vnfResource.getAicVersionMin().equalsIgnoreCase("aicVersionMin"));\r
+               vnfResource.setHeatTemplateArtifactUUId("heatTemplateArtifactUUId");\r
+               assertTrue(vnfResource.getHeatTemplateArtifactUUId().equalsIgnoreCase("heatTemplateArtifactUUId"));\r
+\r
+               vnfResource.setModelInvariantUuid("modelInvariantUuid");\r
+               assertTrue(vnfResource.getModelInvariantUuid().equalsIgnoreCase("modelInvariantUuid"));\r
+               vnfResource.setModelName("modelName");\r
+               assertTrue(vnfResource.getModelName().equalsIgnoreCase("modelName"));\r
+               vnfResource.setModelUuid("modelUuid");\r
+               assertTrue(vnfResource.getModelUuid().equalsIgnoreCase("modelUuid"));\r
+               vnfResource.setModelVersion("modelVersion");\r
+               assertTrue(vnfResource.getModelVersion().equalsIgnoreCase("modelVersion"));\r
+               vnfResource.setOrchestrationMode("orchestrationMode");\r
+               assertTrue(vnfResource.getOrchestrationMode().equalsIgnoreCase("orchestrationMode"));\r
+               vnfResource.setTemplateId("heatTemplateArtifactUUId");\r
+               assertTrue(vnfResource.getHeatTemplateArtifactUUId().equalsIgnoreCase("heatTemplateArtifactUUId"));\r
+               vnfResource.setModelInvariantUuid("modelInvariantUuid");\r
+               assertTrue(vnfResource.getModelInvariantUuid().equalsIgnoreCase("modelInvariantUuid"));\r
+               Set<VnfResourceCustomization> list = new HashSet<>();\r
+               list.add(new VnfResourceCustomization());\r
+               vnfResource.setVnfResourceCustomizations(list);\r
+               assertTrue(vnfResource.getVfModuleCustomizations() != null);\r
+               Set<VfModule> vfModules = new HashSet<>();\r
+               vfModules.add(new VfModule());\r
+               vnfResource.setVfModules(vfModules);\r
+               assertTrue(vnfResource.getVfModules() != null);\r
+//             assertTrue(vnfResource.toString() != null);\r
+\r
+       }\r
+\r
+}\r