Adding UT for MsoCatalog POJO 87/17187/3
authorseshukm <seshu.kumar.m@huawei.com>
Wed, 4 Oct 2017 08:17:44 +0000 (13:47 +0530)
committerSeshu Kumar M <seshu.kumar.m@huawei.com>
Wed, 4 Oct 2017 11:13:41 +0000 (11:13 +0000)
UT-Step3

IssueId: SO-172

Change-Id: Iac580a8936104078e529db9fdab178e0686eae51
Signed-off-by: seshukm <seshu.kumar.m@huawei.com>
mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/RecipeTest.java [new file with mode: 0644]
mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ServiceMacroHolderTest.java [new file with mode: 0644]
mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ServiceRecipeTest.java [new file with mode: 0644]

diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/RecipeTest.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/RecipeTest.java
new file mode 100644 (file)
index 0000000..49dc9b7
--- /dev/null
@@ -0,0 +1,55 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
+ * ================================================================================
+ * 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.openecomp.mso.db.catalog.test;
+
+import static org.junit.Assert.assertTrue;
+
+import java.sql.Timestamp;
+
+import org.junit.Test;
+import org.openecomp.mso.db.catalog.beans.Recipe;
+
+/**
+ */
+
+public class RecipeTest {
+
+       @Test
+       public final void recipeDataTest() {
+               Recipe recipe = new Recipe();
+               recipe.setAction("action");
+               assertTrue(recipe.getAction().equalsIgnoreCase("action"));
+               recipe.setCreated(new Timestamp(System.currentTimeMillis()));
+               assertTrue(recipe.getCreated() != null);
+               recipe.setDescription("description");
+               assertTrue(recipe.getDescription().equalsIgnoreCase("description"));
+               recipe.setId(1);
+               assertTrue(recipe.getId() == 1);
+               recipe.setOrchestrationUri("orchestrationUri");
+               assertTrue(recipe.getOrchestrationUri().equalsIgnoreCase("orchestrationUri"));
+               recipe.setRecipeTimeout(1);
+               assertTrue(recipe.getRecipeTimeout() == 1);
+               recipe.setServiceType("serviceType");
+               assertTrue(recipe.getServiceType().equalsIgnoreCase("serviceType"));
+//             assertTrue(recipe.toString() != null);
+       }
+
+}
diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ServiceMacroHolderTest.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ServiceMacroHolderTest.java
new file mode 100644 (file)
index 0000000..0e34921
--- /dev/null
@@ -0,0 +1,48 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
+ * ================================================================================
+ * 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.openecomp.mso.db.catalog.test;
+
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+import org.openecomp.mso.db.catalog.beans.AllottedResourceCustomization;
+import org.openecomp.mso.db.catalog.beans.NetworkResourceCustomization;
+import org.openecomp.mso.db.catalog.beans.ServiceMacroHolder;
+import org.openecomp.mso.db.catalog.beans.VnfResource;
+import org.openecomp.mso.db.catalog.beans.VnfResourceCustomization;
+
+/**
+ */
+
+public class ServiceMacroHolderTest {
+
+       @Test
+       public final void serviceMacroHolderDataTest() {
+               ServiceMacroHolder serviceMacroHolder = new ServiceMacroHolder();
+               assertTrue(serviceMacroHolder.getService() == null);
+               serviceMacroHolder.addVnfResource(new VnfResource());
+               serviceMacroHolder.addVnfResourceCustomizations(new VnfResourceCustomization());
+               serviceMacroHolder.addNetworkResourceCustomization(new NetworkResourceCustomization());
+               serviceMacroHolder.addAllottedResourceCustomization(new AllottedResourceCustomization());
+               assertTrue(serviceMacroHolder != null);
+       }
+
+}
diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ServiceRecipeTest.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ServiceRecipeTest.java
new file mode 100644 (file)
index 0000000..4b4a5ad
--- /dev/null
@@ -0,0 +1,65 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
+ * ================================================================================
+ * 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.openecomp.mso.db.catalog.test;
+
+import static org.junit.Assert.assertTrue;
+
+import java.sql.Timestamp;
+import java.util.Date;
+
+import org.junit.Test;
+import org.openecomp.mso.db.catalog.beans.ServiceRecipe;
+
+/**
+ */
+
+public class ServiceRecipeTest {
+
+       @Test
+       public final void serviceRecipeDataTest() {
+
+               ServiceRecipe serviceRecipe = new ServiceRecipe();
+               serviceRecipe.setAction("action");
+               assertTrue(serviceRecipe.getAction().equalsIgnoreCase("action"));
+               serviceRecipe.setCreated(new Timestamp(System.currentTimeMillis()));
+               assertTrue(serviceRecipe.getCreated() != null);
+               serviceRecipe.setDescription("description");
+               assertTrue(serviceRecipe.getDescription().equalsIgnoreCase("description"));
+               serviceRecipe.setId(1);
+               assertTrue(serviceRecipe.getId() == 1);
+               serviceRecipe.setOrchestrationUri("orchestrationUri");
+               assertTrue(serviceRecipe.getOrchestrationUri().equalsIgnoreCase("orchestrationUri"));
+               serviceRecipe.setRecipeTimeout(1);
+               assertTrue(serviceRecipe.getRecipeTimeout() == 1);
+               serviceRecipe.setVersion("version");
+               assertTrue(serviceRecipe.getVersion().equalsIgnoreCase("version"));
+               serviceRecipe.setServiceTimeoutInterim(1);
+               assertTrue(serviceRecipe.getServiceTimeoutInterim() == 1);
+               serviceRecipe.setServiceParamXSD("serviceParamXSD");
+               assertTrue(serviceRecipe.getServiceParamXSD().equalsIgnoreCase("serviceParamXSD"));
+               assertTrue(serviceRecipe.toString() != null);
+               ServiceRecipe serviceRecipeWithValue = new ServiceRecipe(1, "string", "string", "string", "string", "string", 1,
+                               1, new Date());
+               assertTrue(serviceRecipeWithValue.toString() != null);
+
+       }
+
+}