From 085784cc3a006259a66c8435d0b6fbede1df923f Mon Sep 17 00:00:00 2001 From: Seshu-Kumar-M Date: Thu, 5 Oct 2017 11:29:34 +0530 Subject: Adding UT for MSO catalogdb POJO UT-Step6 IssueId: SO-172 Change-Id: I18ba0ebfd372b06e688e5a1b6d9e8b8d34cab227 Signed-off-by: Seshu-Kumar-M --- .../mso/db/catalog/test/VfModuleTest.java | 63 +++++++++++++++++ .../mso/db/catalog/test/VnfRecipeTest.java | 63 +++++++++++++++++ .../mso/db/catalog/test/VnfResourceTest.java | 82 ++++++++++++++++++++++ 3 files changed, 208 insertions(+) create mode 100644 mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/VfModuleTest.java create mode 100644 mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/VnfRecipeTest.java create mode 100644 mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/VnfResourceTest.java (limited to 'mso-catalog-db/src') 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 index 0000000000..9409a642ec --- /dev/null +++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/VfModuleTest.java @@ -0,0 +1,63 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. 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.VfModule; + +/** + */ + +public class VfModuleTest { + + @Test + public final void vfModuleDataTest() { + VfModule vfModule = new VfModule(); + vfModule.setCreated(new Timestamp(System.currentTimeMillis())); + assertTrue(vfModule.getCreated() != null); + vfModule.setDescription("description"); + assertTrue(vfModule.getDescription().equalsIgnoreCase("description")); + + vfModule.setModelInvariantUUID("action"); + assertTrue(vfModule.getModelInvariantUUID().equalsIgnoreCase("action")); + + vfModule.setModelName("modelName"); + assertTrue(vfModule.getModelName().equalsIgnoreCase("modelName")); + + vfModule.setModelUUID("modelUUID"); + assertTrue(vfModule.getModelUUID().equalsIgnoreCase("modelUUID")); + vfModule.setModelVersion("modelVersion"); + assertTrue(vfModule.getModelVersion().equalsIgnoreCase("modelVersion")); + vfModule.setHeatTemplateArtifactUUId("heatTemplateArtifactUUId"); + assertTrue(vfModule.getHeatTemplateArtifactUUId().equalsIgnoreCase("heatTemplateArtifactUUId")); + vfModule.setVnfResourceModelUUId("vnfResourceModelUUId"); + assertTrue(vfModule.getVnfResourceModelUUId().equalsIgnoreCase("vnfResourceModelUUId")); + vfModule.setIsBase(1); + assertTrue(vfModule.isBase()); +// assertTrue(vfModule.toString() == null); + + } + +} 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 index 0000000000..95e45f7b52 --- /dev/null +++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/VnfRecipeTest.java @@ -0,0 +1,63 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. 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.VnfRecipe; + +/** + */ + +public class VnfRecipeTest { + + @Test + public final void vnfRecipeDataTest() { + VnfRecipe vnfRecipe = new VnfRecipe(); + vnfRecipe.setCreated(new Timestamp(System.currentTimeMillis())); + assertTrue(vnfRecipe.getCreated() != null); + vnfRecipe.setDescription("description"); + assertTrue(vnfRecipe.getDescription().equalsIgnoreCase("description")); + + vnfRecipe.setOrchestrationUri("orchestrationUri"); + assertTrue(vnfRecipe.getOrchestrationUri().equalsIgnoreCase("orchestrationUri")); + + vnfRecipe.setRecipeTimeout(1); + assertTrue(vnfRecipe.getRecipeTimeout() == 1); + vnfRecipe.setVnfType("vnfType"); + assertTrue(vnfRecipe.getVnfType().equalsIgnoreCase("vnfType")); + + vnfRecipe.setServiceType("serviceType"); + assertTrue(vnfRecipe.getServiceType().equalsIgnoreCase("serviceType")); + vnfRecipe.setVersion("version"); + assertTrue(vnfRecipe.getVersion().equalsIgnoreCase("version")); + vnfRecipe.setVnfParamXSD("vnfParamXSD"); + assertTrue(vnfRecipe.getVnfParamXSD().equalsIgnoreCase("vnfParamXSD")); + vnfRecipe.setVfModuleId("vfModuleId"); + assertTrue(vnfRecipe.getVfModuleId().equalsIgnoreCase("vfModuleId")); +// assertTrue(vnfRecipe.toString() == null); + + } + +} 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 index 0000000000..68749e397e --- /dev/null +++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/VnfResourceTest.java @@ -0,0 +1,82 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. 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.HashSet; +import java.util.Set; + +import org.junit.Test; +import org.openecomp.mso.db.catalog.beans.VfModule; +import org.openecomp.mso.db.catalog.beans.VnfResource; +import org.openecomp.mso.db.catalog.beans.VnfResourceCustomization; + +/** + */ + +public class VnfResourceTest { + + @Test + public final void vnfResourceDataTest() { + + VnfResource vnfResource = new VnfResource(); + vnfResource.setCreated(new Timestamp(System.currentTimeMillis())); + assertTrue(vnfResource.getCreated() != null); + vnfResource.setDescription("description"); + assertTrue(vnfResource.getDescription().equalsIgnoreCase("description")); + + vnfResource.setAicVersionMax("aicVersionMax"); + assertTrue(vnfResource.getAicVersionMax().equalsIgnoreCase("aicVersionMax")); + + vnfResource.setAicVersionMin("aicVersionMin"); + assertTrue(vnfResource.getAicVersionMin().equalsIgnoreCase("aicVersionMin")); + vnfResource.setHeatTemplateArtifactUUId("heatTemplateArtifactUUId"); + assertTrue(vnfResource.getHeatTemplateArtifactUUId().equalsIgnoreCase("heatTemplateArtifactUUId")); + + vnfResource.setModelInvariantUuid("modelInvariantUuid"); + assertTrue(vnfResource.getModelInvariantUuid().equalsIgnoreCase("modelInvariantUuid")); + vnfResource.setModelName("modelName"); + assertTrue(vnfResource.getModelName().equalsIgnoreCase("modelName")); + vnfResource.setModelUuid("modelUuid"); + assertTrue(vnfResource.getModelUuid().equalsIgnoreCase("modelUuid")); + vnfResource.setModelVersion("modelVersion"); + assertTrue(vnfResource.getModelVersion().equalsIgnoreCase("modelVersion")); + vnfResource.setOrchestrationMode("orchestrationMode"); + assertTrue(vnfResource.getOrchestrationMode().equalsIgnoreCase("orchestrationMode")); + vnfResource.setTemplateId("heatTemplateArtifactUUId"); + assertTrue(vnfResource.getHeatTemplateArtifactUUId().equalsIgnoreCase("heatTemplateArtifactUUId")); + vnfResource.setModelInvariantUuid("modelInvariantUuid"); + assertTrue(vnfResource.getModelInvariantUuid().equalsIgnoreCase("modelInvariantUuid")); + Set list = new HashSet<>(); + list.add(new VnfResourceCustomization()); + vnfResource.setVnfResourceCustomizations(list); + assertTrue(vnfResource.getVfModuleCustomizations() != null); + Set vfModules = new HashSet<>(); + vfModules.add(new VfModule()); + vnfResource.setVfModules(vfModules); + assertTrue(vnfResource.getVfModules() != null); +// assertTrue(vnfResource.toString() != null); + + } + +} -- cgit 1.2.3-korg