diff options
Diffstat (limited to 'mso-catalog-db/src')
12 files changed, 1487 insertions, 3 deletions
diff --git a/mso-catalog-db/src/main/resources/VnfResourceCustomization.hbm.xml b/mso-catalog-db/src/main/resources/VnfResourceCustomization.hbm.xml index b068e66e1e..72e7209d53 100644 --- a/mso-catalog-db/src/main/resources/VnfResourceCustomization.hbm.xml +++ b/mso-catalog-db/src/main/resources/VnfResourceCustomization.hbm.xml @@ -41,8 +41,8 @@ <property name="created" type="timestamp" generated="insert" update="false" insert="false" column="CREATION_TIMESTAMP" not-null="true"/>
<set name="vfModuleCustomizations" inverse="true" cascade="all">
- <key column="VNF_RESOURCE_MODEL_UUID" not-null="true" />
- <one-to-many class="VnfResCustomToVfModuleCustom" />
- </set>
+ <key column="VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID" not-null="true" />
+ <one-to-many class="VnfResCustomToVfModuleCustom" />
+ </set>
</class>
</hibernate-mapping>
diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/CatalogDatabaseTest.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/CatalogDatabaseTest.java new file mode 100644 index 0000000000..a00079d8a9 --- /dev/null +++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/CatalogDatabaseTest.java @@ -0,0 +1,757 @@ +/*-
+ * ============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.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.openecomp.mso.db.catalog.CatalogDatabase;
+import org.openecomp.mso.db.catalog.beans.AllottedResource;
+import org.openecomp.mso.db.catalog.beans.AllottedResourceCustomization;
+import org.openecomp.mso.db.catalog.beans.HeatEnvironment;
+import org.openecomp.mso.db.catalog.beans.HeatFiles;
+import org.openecomp.mso.db.catalog.beans.HeatTemplate;
+import org.openecomp.mso.db.catalog.beans.HeatTemplateParam;
+import org.openecomp.mso.db.catalog.beans.NetworkResource;
+import org.openecomp.mso.db.catalog.beans.NetworkResourceCustomization;
+import org.openecomp.mso.db.catalog.beans.Service;
+import org.openecomp.mso.db.catalog.beans.ServiceRecipe;
+import org.openecomp.mso.db.catalog.beans.ServiceToResourceCustomization;
+import org.openecomp.mso.db.catalog.beans.TempNetworkHeatTemplateLookup;
+import org.openecomp.mso.db.catalog.beans.ToscaCsar;
+import org.openecomp.mso.db.catalog.beans.VfModule;
+import org.openecomp.mso.db.catalog.beans.VfModuleCustomization;
+import org.openecomp.mso.db.catalog.beans.VfModuleToHeatFiles;
+import org.openecomp.mso.db.catalog.beans.VnfComponent;
+import org.openecomp.mso.db.catalog.beans.VnfComponentsRecipe;
+import org.openecomp.mso.db.catalog.beans.VnfRecipe;
+import org.openecomp.mso.db.catalog.beans.VnfResource;
+import org.openecomp.mso.db.catalog.beans.VnfResourceCustomization;
+import org.openecomp.mso.db.catalog.utils.RecordNotFoundException;
+
+public class CatalogDatabaseTest {
+
+ CatalogDatabase cd = null;
+
+ @Before
+ public void setup(){
+ cd = CatalogDatabase.getInstance();
+ }
+ @Test(expected = Exception.class)
+ public void getAllHeatTemplatesTestException(){
+ List <HeatTemplate> list = cd.getAllHeatTemplates();
+ }
+
+ @Test(expected = Exception.class)
+ public void getHeatTemplateTestException(){
+ HeatTemplate ht = cd.getHeatTemplate(10);
+ }
+
+ @Test(expected = Exception.class)
+ public void getHeatTemplateTest2Exception(){
+ HeatTemplate ht = cd.getHeatTemplate("heat123");
+ }
+
+ @Test(expected = Exception.class)
+ public void getHeatTemplateTest3Exception(){
+ HeatTemplate ht = cd.getHeatTemplate("heat123","v2");
+ }
+
+ @Test(expected = Exception.class)
+ public void getHeatTemplateByArtifactUuidException(){
+ HeatTemplate ht = cd.getHeatTemplateByArtifactUuid("123");
+ }
+
+ @Test(expected = Exception.class)
+ public void getHeatTemplateByArtifactUuidRegularQueryException(){
+ HeatTemplate ht = cd.getHeatTemplateByArtifactUuidRegularQuery("123");
+ }
+
+ @Test(expected = Exception.class)
+ public void getParametersForHeatTemplateTestException(){
+ List<HeatTemplateParam> ht = cd.getParametersForHeatTemplate("123");
+ }
+
+ @Test(expected = Exception.class)
+ public void getHeatEnvironmentByArtifactUuidTestException(){
+ HeatEnvironment ht = cd.getHeatEnvironmentByArtifactUuid("123");
+ }
+
+ @Test(expected = Exception.class)
+ public void getServiceByInvariantUUIDTestException(){
+ Service ht = cd.getServiceByInvariantUUID("123");
+ }
+
+ @Test(expected = Exception.class)
+ public void getServiceTestException(){
+ Service ht = cd.getService("123");
+ }
+
+ @Test(expected = Exception.class)
+ public void getServiceByModelUUIDTestException(){
+ Service ht = cd.getServiceByModelUUID("123");
+ }
+
+ @Test(expected = Exception.class)
+ public void getService2TestException(){
+ HashMap<String, String> map = new HashMap<>();
+ map.put("serviceNameVersionId", "v2");
+ Service ht = cd.getService(map, "123");
+ }
+
+ @Test(expected = Exception.class)
+ public void getServiceByModelNameTestException(){
+ Service ht = cd.getServiceByModelName("123");
+ }
+
+ @Test(expected = Exception.class)
+ public void getServiceByVersionAndInvariantIdTestException() throws Exception{
+ Service ht = cd.getServiceByVersionAndInvariantId("123","tetwe");
+ }
+
+ @Test(expected = Exception.class)
+ public void getServiceRecipeTestException() throws Exception{
+ ServiceRecipe ht = cd.getServiceRecipe("123","tetwe");
+ }
+
+ @Test(expected = Exception.class)
+ public void getServiceRecipeByServiceModelUuidTestException() throws Exception{
+ ServiceRecipe ht = cd.getServiceRecipeByServiceModelUuid("123","tetwe");
+ }
+
+ @Test(expected = Exception.class)
+ public void getServiceRecipesTestException() throws Exception{
+ List<ServiceRecipe> ht = cd.getServiceRecipes("123");
+ }
+
+ @Test(expected = Exception.class)
+ public void getVnfComponentTestException() throws Exception{
+ VnfComponent ht = cd.getVnfComponent(123,"vnf");
+ }
+
+ @Test(expected = Exception.class)
+ public void getVnfResourceTestException() throws Exception{
+ VnfResource ht = cd.getVnfResource("vnf");
+ }
+
+ @Test(expected = Exception.class)
+ public void getVnfResource2TestException() throws Exception{
+ VnfResource ht = cd.getVnfResource("vnf","3992");
+ }
+
+ @Test(expected = Exception.class)
+ public void getVnfResourceByModelCustomizationIdTestException() throws Exception{
+ VnfResource ht = cd.getVnfResourceByModelCustomizationId("3992");
+ }
+
+ @Test(expected = Exception.class)
+ public void getServiceRecipeTest2Exception() throws Exception{
+ ServiceRecipe ht = cd.getServiceRecipe(1001,"3992");
+ }
+
+ @Test(expected = Exception.class)
+ public void getVnfResourceCustomizationByModelCustomizationNameTestException(){
+ VnfResourceCustomization vnf = cd.getVnfResourceCustomizationByModelCustomizationName("test", "test234");
+ }
+
+ @Test(expected = Exception.class)
+ public void getVnfResourceByModelInvariantIdTestException(){
+ VnfResource vnf = cd.getVnfResourceByModelInvariantId("test", "test234");
+ }
+
+ @Test(expected = Exception.class)
+ public void getVnfResourceByIdTestException(){
+ VnfResource vnf = cd.getVnfResourceById(19299);
+ }
+
+ @Test(expected = Exception.class)
+ public void getVfModuleModelNameTestException(){
+ VfModule vnf = cd.getVfModuleModelName("tetes");
+ }
+
+ @Test(expected = Exception.class)
+ public void getVfModuleModelName2TestException(){
+ VfModule vnf = cd.getVfModuleModelName("tetes","4kidsl");
+ }
+
+ @Test(expected = Exception.class)
+ public void ggetVfModuleCustomizationByModelNameTestException(){
+ VfModuleCustomization vnf = cd.getVfModuleCustomizationByModelName("tetes");
+ }
+
+ @Test(expected = Exception.class)
+ public void getNetworkResourceTestException(){
+ NetworkResource vnf = cd.getNetworkResource("tetes");
+ }
+
+ @Test(expected = Exception.class)
+ public void getVnfRecipeTestException(){
+ VnfRecipe vnf = cd.getVnfRecipe("tetes","ergfedrf","4993493");
+ }
+
+ @Test(expected = Exception.class)
+ public void getVnfRecipe2TestException(){
+ VnfRecipe vnf = cd.getVnfRecipe("tetes","4993493");
+ }
+
+ @Test(expected = Exception.class)
+ public void getVnfRecipeByVfModuleIdTestException(){
+ VnfRecipe vnf = cd.getVnfRecipeByVfModuleId("tetes","4993493","vnf");
+ }
+
+ @Test(expected = Exception.class)
+ public void getVfModuleTypeTestException(){
+ VfModule vnf = cd.getVfModuleType("4993493");
+ }
+
+ @Test(expected = Exception.class)
+ public void getVfModuleType2TestException(){
+ VfModule vnf = cd.getVfModuleType("4993493","vnf");
+ }
+ @Test(expected = Exception.class)
+ public void getVnfResourceByServiceUuidTestException(){
+ VnfResource vnf = cd.getVnfResourceByServiceUuid("4993493");
+ }
+ @Test(expected = Exception.class)
+ public void getVnfResourceByVnfUuidTestException(){
+ VnfResource vnf = cd.getVnfResourceByVnfUuid("4993493");
+ }
+ @Test(expected = Exception.class)
+ public void getVfModuleByModelInvariantUuidTestException(){
+ VfModule vnf = cd.getVfModuleByModelInvariantUuid("4993493");
+ }
+ @Test(expected = Exception.class)
+ public void getVfModuleByModelCustomizationUuidTestException(){
+ VfModuleCustomization vnf = cd.getVfModuleByModelCustomizationUuid("4993493");
+ }
+ @Test(expected = Exception.class)
+ public void getVfModuleByModelInvariantUuidAndModelVersionTestException(){
+ VfModule vnf = cd.getVfModuleByModelInvariantUuidAndModelVersion("4993493","vnf");
+ }
+ @Test(expected = Exception.class)
+ public void getVfModuleCustomizationByModelCustomizationIdTestException(){
+ VfModuleCustomization vnf = cd.getVfModuleCustomizationByModelCustomizationId("4993493");
+ }
+ @Test(expected = Exception.class)
+ public void getVfModuleByModelUuidTestException(){
+ VfModule vnf = cd.getVfModuleByModelUuid("4993493");
+ }
+ @Test(expected = Exception.class)
+ public void getVnfResourceCustomizationByModelCustomizationUuidTestException(){
+ VnfResourceCustomization vnf = cd.getVnfResourceCustomizationByModelCustomizationUuid("4993493");
+ }
+ @Test(expected = Exception.class)
+ public void getVnfResourceCustomizationByModelVersionIdTestException(){
+ VnfResourceCustomization vnf = cd.getVnfResourceCustomizationByModelVersionId("4993493");
+ }
+ @Test(expected = Exception.class)
+ public void getVfModuleByModelCustomizationIdAndVersionTestException(){
+ cd.getVfModuleByModelCustomizationIdAndVersion("4993493","test");
+ }
+ @Test(expected = Exception.class)
+ public void getVfModuleByModelCustomizationIdModelVersionAndModelInvariantIdTestException(){
+ cd.getVfModuleByModelCustomizationIdModelVersionAndModelInvariantId("4993493","vnf","test");
+ }
+ @Test(expected = Exception.class)
+ public void getVnfResourceCustomizationByModelInvariantIdTest(){
+ cd.getVnfResourceCustomizationByModelInvariantId("4993493","vnf","test");
+ }
+ @Test(expected = Exception.class)
+ public void getVfModuleCustomizationByVnfModuleCustomizationUuidTest(){
+ cd.getVfModuleCustomizationByVnfModuleCustomizationUuid("4993493");
+ }
+ @Test(expected = Exception.class)
+ public void getVnfResourceCustomizationByVnfModelCustomizationNameAndModelVersionIdTest(){
+ cd.getVnfResourceCustomizationByVnfModelCustomizationNameAndModelVersionId("4993493","test");
+ }
+ @Test(expected = Exception.class)
+ public void getAllVfModuleCustomizationstest(){
+ cd.getAllVfModuleCustomizations("4993493");
+ }
+ @Test(expected = Exception.class)
+ public void getVnfResourceByModelUuidTest(){
+ cd.getVnfResourceByModelUuid("4993493");
+ }
+ @Test(expected = Exception.class)
+ public void getVnfResCustomToVfModuleTest(){
+ cd.getVnfResCustomToVfModule("4993493","test");
+ }
+ @Test(expected = Exception.class)
+ public void getVfModulesForVnfResourceTest(){
+ VnfResource vnfResource = new VnfResource();
+ vnfResource.setModelUuid("48839");
+ cd.getVfModulesForVnfResource(vnfResource);
+ }
+ @Test(expected = Exception.class)
+ public void getVfModulesForVnfResource2Test(){
+ cd.getVfModulesForVnfResource("4993493");
+ }
+ @Test(expected = Exception.class)
+ public void getServiceByUuidTest(){
+ cd.getServiceByUuid("4993493");
+ }
+ @Test(expected = Exception.class)
+ public void getNetworkResourceById2Test(){
+ cd.getNetworkResourceById(4993493);
+ }
+ @Test(expected = Exception.class)
+ public void getNetworkResourceByIdTest(){
+ cd.getVfModuleTypeByUuid("4993493");
+ }
+ @Test
+ public void isEmptyOrNullTest(){
+ boolean is = cd.isEmptyOrNull("4993493");
+ assertFalse(is);
+ }
+ @Test(expected = Exception.class)
+ public void getSTRTest(){
+ cd.getSTR("4993493","test","vnf");
+ }
+ @Test(expected = Exception.class)
+ public void getVRCtoVFMCTest(){
+ cd.getVRCtoVFMC("4993493","388492");
+ }
+ @Test(expected = Exception.class)
+ public void getVfModuleTypeByUuidTestException(){
+ cd.getVfModuleTypeByUuid("4993493");
+ }
+
+ @Test(expected = Exception.class)
+ public void getTempNetworkHeatTemplateLookupTest(){
+ cd.getTempNetworkHeatTemplateLookup("4993493");
+ }
+
+ @Test(expected = Exception.class)
+ public void getAllNetworksByServiceModelUuidTest(){
+ cd.getAllNetworksByServiceModelUuid("4993493");
+ }
+ @Test(expected = Exception.class)
+ public void getAllNetworksByServiceModelInvariantUuidTest(){
+ cd.getAllNetworksByServiceModelInvariantUuid("4993493");
+ }
+ @Test(expected = Exception.class)
+ public void getAllNetworksByServiceModelInvariantUuid2Test(){
+ cd.getAllNetworksByServiceModelInvariantUuid("4993493","test");
+ }
+ @Test(expected = Exception.class)
+ public void getAllNetworksByNetworkModelCustomizationUuidTest(){
+ cd.getAllNetworksByNetworkModelCustomizationUuid("4993493");
+ }
+ @Test(expected = Exception.class)
+ public void getAllNetworksByNetworkTypeTest(){
+ cd.getAllNetworksByNetworkType("4993493");
+ }
+ @Test(expected = Exception.class)
+ public void getAllVfmcForVrcTest(){
+ VnfResourceCustomization re = new VnfResourceCustomization();
+ re.setModelCustomizationUuid("377483");
+ cd.getAllVfmcForVrc(re);
+ }
+ @Test(expected = Exception.class)
+ public void getAllVnfsByServiceModelUuidTest(){
+ cd.getAllVnfsByServiceModelUuid("4993493");
+ }
+ @Test(expected = Exception.class)
+ public void getAllVnfsByServiceModelInvariantUuidTest(){
+ cd.getAllVnfsByServiceModelInvariantUuid("4993493");
+ }
+ @Test(expected = Exception.class)
+ public void getAllVnfsByServiceModelInvariantUuid2Test(){
+ cd.getAllVnfsByServiceModelInvariantUuid("4993493","test");
+ }
+ @Test(expected = Exception.class)
+ public void getAllVnfsByServiceNameTest(){
+ cd.getAllVnfsByServiceName("4993493","test");
+ }
+ @Test(expected = Exception.class)
+ public void getAllVnfsByServiceName2Test(){
+ cd.getAllVnfsByServiceName("4993493");
+ }
+ @Test(expected = Exception.class)
+ public void getAllVnfsByVnfModelCustomizationUuidTest(){
+ cd.getAllVnfsByVnfModelCustomizationUuid("4993493");
+ }
+ @Test(expected = Exception.class)
+ public void getAllAllottedResourcesByServiceModelUuidTest(){
+ cd.getAllAllottedResourcesByServiceModelUuid("4993493");
+ }
+ @Test(expected = Exception.class)
+ public void getAllAllottedResourcesByServiceModelInvariantUuidTest(){
+ cd.getAllAllottedResourcesByServiceModelInvariantUuid("4993493");
+ }
+ @Test(expected = Exception.class)
+ public void getAllAllottedResourcesByServiceModelInvariantUuid2Test(){
+ cd.getAllAllottedResourcesByServiceModelInvariantUuid("4993493","test");
+ }
+ @Test(expected = Exception.class)
+ public void getAllAllottedResourcesByArModelCustomizationUuidTest(){
+ cd.getAllAllottedResourcesByArModelCustomizationUuid("4993493");
+ }
+ @Test(expected = Exception.class)
+ public void getAllottedResourceByModelUuidTest(){
+ cd.getAllottedResourceByModelUuid("4993493");
+ }
+ @Test(expected = Exception.class)
+ public void getAllResourcesByServiceModelUuidTest(){
+ cd.getAllResourcesByServiceModelUuid("4993493");
+ }
+ @Test(expected = Exception.class)
+ public void getAllResourcesByServiceModelInvariantUuidTest(){
+ cd.getAllResourcesByServiceModelInvariantUuid("4993493");
+ }
+
+ @Test(expected = Exception.class)
+ public void getAllResourcesByServiceModelInvariantUuid2Test(){
+ cd.getAllResourcesByServiceModelInvariantUuid("4993493","test");
+ }
+ @Test(expected = Exception.class)
+ public void getSingleNetworkByModelCustomizationUuidTest(){
+ cd.getSingleNetworkByModelCustomizationUuid("4993493");
+ }
+ @Test(expected = Exception.class)
+ public void getSingleAllottedResourceByModelCustomizationUuidTest(){
+ cd.getSingleAllottedResourceByModelCustomizationUuid("4993493");
+ }
+ @Test(expected = Exception.class)
+ public void getVfModuleRecipeTest(){
+ cd.getVfModuleRecipe("4993493","test","get");
+ }
+ @Test(expected = Exception.class)
+ public void getVfModuleTest(){
+ cd.getVfModule("4993493","test","get","v2","vnf");
+ }
+ @Test(expected = Exception.class)
+ public void getVnfComponentsRecipeTest(){
+ cd.getVnfComponentsRecipe("4993493","test","v2","vnf","get","3992");
+ }
+ @Test(expected = Exception.class)
+ public void getVnfComponentsRecipeByVfModuleTest(){
+ List <VfModule> resultList = new ArrayList<>();
+ VfModule m = new VfModule();
+ resultList.add(m);
+ cd.getVnfComponentsRecipeByVfModule(resultList,"4993493");
+ }
+ @Test(expected = Exception.class)
+ public void getAllVnfResourcesTest(){
+ cd.getAllVnfResources();
+ }
+ @Test(expected = Exception.class)
+ public void getVnfResourcesByRoleTest(){
+ cd.getVnfResourcesByRole("4993493");
+ }
+ @Test(expected = Exception.class)
+ public void getVnfResourceCustomizationsByRoleTest(){
+ cd.getVnfResourceCustomizationsByRole("4993493");
+ }
+ @Test(expected = Exception.class)
+ public void getAllNetworkResourcesTest(){
+ cd.getAllNetworkResources();
+ }
+ @Test(expected = Exception.class)
+ public void getAllNetworkResourceCustomizationsTest(){
+ cd.getAllNetworkResourceCustomizations();
+ }
+ @Test(expected = Exception.class)
+ public void getAllVfModulesTest(){
+ cd.getAllVfModules();
+ }
+ @Test(expected = Exception.class)
+ public void getAllVfModuleCustomizationsTest(){
+ cd.getAllVfModuleCustomizations();
+ }
+ @Test(expected = Exception.class)
+ public void getAllHeatEnvironmentTest(){
+ cd.getAllHeatEnvironment();
+ }
+ @Test(expected = Exception.class)
+ public void getHeatEnvironment2Test(){
+ cd.getHeatEnvironment(4993493);
+ }
+ @Test(expected = Exception.class)
+ public void getNestedTemplatesTest(){
+ cd.getNestedTemplates(4993493);
+ }
+ @Test(expected = Exception.class)
+ public void getNestedTemplates2Test(){
+ cd.getNestedTemplates("4993493");
+ }
+ @Test(expected = Exception.class)
+ public void getHeatFilesTest(){
+ cd.getHeatFiles(4993493);
+ }
+ @Test(expected = Exception.class)
+ public void getVfModuleToHeatFilesEntryTest(){
+ cd.getVfModuleToHeatFilesEntry("4993493","49959499");
+ }
+ @Test(expected = Exception.class)
+ public void getServiceToResourceCustomization(){
+ cd.getServiceToResourceCustomization("4993493","599349","49900");
+ }
+ @Test(expected = Exception.class)
+ public void getHeatFilesForVfModuleTest(){
+ cd.getHeatFilesForVfModule("4993493");
+ }
+ @Test(expected = Exception.class)
+ public void getHeatTemplateTest(){
+ cd.getHeatTemplate("4993493","test","heat");
+ }
+
+ @Test(expected = Exception.class)
+ public void saveHeatTemplateTest(){
+ HeatTemplate heat = new HeatTemplate();
+ Set <HeatTemplateParam> paramSet = new HashSet<HeatTemplateParam>();
+ cd.saveHeatTemplate(heat,paramSet);
+ }
+ @Test(expected = Exception.class)
+ public void getHeatEnvironmentTest(){
+ cd.getHeatEnvironment("4993493","test","heat");
+ }
+ @Test(expected = Exception.class)
+ public void getHeatEnvironment3Test(){
+ cd.getHeatEnvironment("4993493","test");
+ }
+ @Test(expected = Exception.class)
+ public void saveHeatEnvironmentTest(){
+ HeatEnvironment en = new HeatEnvironment();
+ cd.saveHeatEnvironment(en);
+ }
+ @Test(expected = Exception.class)
+ public void saveHeatTemplate2Test(){
+ HeatTemplate heat = new HeatTemplate();
+ cd.saveHeatTemplate(heat);
+ }
+ @Test(expected = Exception.class)
+ public void saveHeatFileTest(){
+ HeatFiles hf = new HeatFiles();
+ cd.saveHeatFile(hf);
+ }
+ @Test(expected = Exception.class)
+ public void saveVnfRecipeTest(){
+ VnfRecipe vr = new VnfRecipe();
+ cd.saveVnfRecipe(vr);
+ }
+ @Test(expected = Exception.class)
+ public void saveVnfComponentsRecipe(){
+ VnfComponentsRecipe vr = new VnfComponentsRecipe();
+ cd.saveVnfComponentsRecipe(vr);
+ }
+ @Test(expected = Exception.class)
+ public void saveOrUpdateVnfResourceTest(){
+ VnfResource vr = new VnfResource();
+ cd.saveOrUpdateVnfResource(vr);
+ }
+ @Test(expected = Exception.class)
+ public void saveVnfResourceCustomizationTest(){
+ VnfResourceCustomization vr = new VnfResourceCustomization();
+ cd.saveVnfResourceCustomization(vr);
+ }
+ @Test(expected = Exception.class)
+ public void saveAllottedResourceCustomizationTest(){
+ AllottedResourceCustomization arc = new AllottedResourceCustomization();
+ cd.saveAllottedResourceCustomization(arc);
+ }
+ @Test(expected = Exception.class)
+ public void saveAllottedResourceTest(){
+ AllottedResource ar = new AllottedResource();
+ cd.saveAllottedResource(ar);
+ }
+ @Test(expected = Exception.class)
+ public void saveNetworkResourceTest() throws RecordNotFoundException {
+ NetworkResource nr = new NetworkResource();
+ cd.saveNetworkResource(nr);
+ }
+ @Test(expected = Exception.class)
+ public void saveToscaCsarTest()throws RecordNotFoundException {
+ ToscaCsar ts = new ToscaCsar();
+ cd.saveToscaCsar(ts);
+ }
+ @Test(expected = Exception.class)
+ public void getToscaCsar(){
+ cd.getToscaCsar("4993493");
+ }
+ @Test(expected = Exception.class)
+ public void saveTempNetworkHeatTemplateLookupTest(){
+ TempNetworkHeatTemplateLookup t = new TempNetworkHeatTemplateLookup();
+ cd.saveTempNetworkHeatTemplateLookup(t);
+ }
+ @Test(expected = Exception.class)
+ public void saveVfModuleToHeatFiles(){
+ VfModuleToHeatFiles v = new VfModuleToHeatFiles();
+ cd.saveVfModuleToHeatFiles(v);
+ }
+ @Test(expected = Exception.class)
+ public void saveVnfResourceToVfModuleCustomizationTest() throws RecordNotFoundException {
+ VnfResourceCustomization v =new VnfResourceCustomization();
+ VfModuleCustomization vm = new VfModuleCustomization();
+ cd.saveVnfResourceToVfModuleCustomization(v, vm);
+ }
+ @Test(expected = Exception.class)
+ public void saveNetworkResourceCustomizationTest() throws RecordNotFoundException {
+ NetworkResourceCustomization nrc = new NetworkResourceCustomization();
+ cd.saveNetworkResourceCustomization(nrc);
+ }
+
+ @Test(expected = Exception.class)
+ public void saveServiceToNetworksTest(){
+ AllottedResource ar = new AllottedResource();
+ cd.saveAllottedResource(ar);
+ }
+ @Test(expected = Exception.class)
+ public void saveServiceToResourceCustomizationTest(){
+ ServiceToResourceCustomization ar = new ServiceToResourceCustomization();
+ cd.saveServiceToResourceCustomization(ar);
+ }
+ @Test(expected = Exception.class)
+ public void saveServiceTest(){
+ Service ar = new Service();
+ cd.saveService(ar);
+ }
+ @Test(expected = Exception.class)
+ public void saveOrUpdateVfModuleTest(){
+ VfModule ar = new VfModule();
+ cd.saveOrUpdateVfModule(ar);
+ }
+ @Test(expected = Exception.class)
+ public void saveOrUpdateVfModuleCustomizationTest(){
+ VfModuleCustomization ar = new VfModuleCustomization();
+ cd.saveOrUpdateVfModuleCustomization(ar);
+ }
+
+ @Test(expected = Exception.class)
+ public void getNestedHeatTemplateTest(){
+ cd.getNestedHeatTemplate(101,201);
+ }
+ @Test(expected = Exception.class)
+ public void getNestedHeatTemplate2Test(){
+ cd.getNestedHeatTemplate("1002","1002");
+ }
+ @Test(expected = Exception.class)
+ public void saveNestedHeatTemplateTest(){
+ HeatTemplate ar = new HeatTemplate();
+ cd.saveNestedHeatTemplate("1001",ar,"test");
+ }
+ @Test(expected = Exception.class)
+ public void getHeatFiles2Test(){
+ VfModuleCustomization ar = new VfModuleCustomization();
+ cd.getHeatFiles(101,"test","1001","v2");
+ }
+ @Test(expected = Exception.class)
+ public void getHeatFiles3Test(){
+ VfModuleCustomization ar = new VfModuleCustomization();
+ cd.getHeatFiles("200192");
+ }
+ @Test(expected = Exception.class)
+ public void saveHeatFilesTest(){
+ HeatFiles ar = new HeatFiles();
+ cd.saveHeatFiles(ar);
+ }
+ @Test(expected = Exception.class)
+ public void saveVfModuleToHeatFilesTest(){
+ HeatFiles ar = new HeatFiles();
+ cd.saveVfModuleToHeatFiles("3772893",ar);
+ }
+ @Test
+ public void getNetworkResourceByModelUuidTest(){
+
+ cd.getNetworkResourceByModelUuid("3899291");
+ }
+ @Test(expected = Exception.class)
+ public void getNetworkRecipeTest(){
+
+ cd.getNetworkRecipe("test","test1","test2");
+ }
+ @Test(expected = Exception.class)
+ public void getNetworkRecipe2Test(){
+
+ cd.getNetworkRecipe("test","test1");
+ }
+ @Test
+ public void getNetworkResourceByModelCustUuidTest(){
+
+ cd.getNetworkResourceByModelCustUuid("test");
+ }
+ @Test(expected = Exception.class)
+ public void getVnfComponentsRecipe2Test(){
+
+ cd.getVnfComponentsRecipe("test1","test2","test3","test4");
+ }
+ @Test(expected = Exception.class)
+ public void getVnfComponentsRecipeByVfModuleModelUUIdTest(){
+
+ cd.getVnfComponentsRecipeByVfModuleModelUUId("test1","test2","test3");
+ }
+ @Test(expected = Exception.class)
+ public void getVnfComponentRecipesTest(){
+
+ cd.getVnfComponentRecipes("test");
+ }
+ @Test(expected = Exception.class)
+ public void saveOrUpdateVnfComponentTest(){
+ VnfComponent ar = new VnfComponent();
+ cd.saveOrUpdateVnfComponent(ar);
+ }
+
+ @Test(expected = Exception.class)
+ public void getVfModule2Test(){
+
+ cd.getVfModule("test");
+ }
+ @Test(expected = Exception.class)
+ public void getVfModuleByModelUUIDTest(){
+
+ cd.getVfModuleByModelUUID("test");
+ }
+ @Test(expected = Exception.class)
+ public void getServiceRecipeByModelUUIDTest(){
+
+ cd.getServiceRecipeByModelUUID("test1","test2");
+ }
+ @Test(expected = Exception.class)
+ public void getModelRecipeTest(){
+
+ cd.getModelRecipe("test1","test2","test3");
+ }
+ @Test(expected = Exception.class)
+ public void healthCheck(){
+
+ cd.healthCheck();
+ }
+ @Test(expected = Exception.class)
+ public void executeQuerySingleRow(){
+ VnfComponent ar = new VnfComponent();
+ HashMap<String, String> variables = new HashMap<String, String>();
+ cd.executeQuerySingleRow("tets",variables,false);
+ }
+ @Test(expected = Exception.class)
+ public void executeQueryMultipleRows(){
+ HashMap<String, String> variables = new HashMap<String, String>();
+ cd.executeQueryMultipleRows("select",variables,false);
+ }
+}
diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/HeatFilesTest.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/HeatFilesTest.java new file mode 100644 index 0000000000..da4e87806c --- /dev/null +++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/HeatFilesTest.java @@ -0,0 +1,87 @@ +/*- + * ============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 static org.junit.Assert.fail; + +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStreamWriter; +import java.io.Writer; +import java.util.UUID; + +import org.junit.Test; +import org.openecomp.mso.db.catalog.beans.HeatFiles; + +/** + */ + +public class HeatFilesTest { + + @Test + public final void heatFilesTest() { + + HeatFiles heatFiles = new HeatFiles(); + heatFiles.setFileBody("testBody"); + heatFiles.setArtifactUuid(UUID.randomUUID().toString()); + assertTrue(heatFiles.getFileBody().equals("testBody")); + assertTrue(!heatFiles.toString().contains("8 chars")); + heatFiles.setFileBody(null); + assertTrue(!heatFiles.toString().contains("Not defined")); + heatFiles.setVersion("12"); + assertTrue(heatFiles.getVersion().equals("12")); + + heatFiles.setFileName("File"); + assertTrue(heatFiles.getFileName().equalsIgnoreCase("File")); + + heatFiles.setCreated(null); + assertTrue(heatFiles.getCreated() == null); + heatFiles.setAsdcUuid("asdc"); + + assertTrue(heatFiles.getAsdcUuid().equalsIgnoreCase("asdc")); + + heatFiles.setDescription("desc"); + assertTrue(heatFiles.getDescription().equalsIgnoreCase("desc")); + + + heatFiles.setArtifactChecksum("artifactChecksum"); + assertTrue(heatFiles.getArtifactChecksum().equalsIgnoreCase("artifactChecksum")); + File tempFile; + try { + tempFile = File.createTempFile("heatFiles", "test"); + tempFile.deleteOnExit(); + try (Writer writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(tempFile), "utf-8"))) { + writer.write("something\n"); + writer.write("something2\n"); + } + heatFiles.setFileBody(tempFile.getAbsolutePath()); + assertTrue(heatFiles.getFileBody().contains("test")); + } catch (IOException e) { + e.printStackTrace(); + fail("Exception caught"); + } + + } + +} diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ModelRecipeTest.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ModelRecipeTest.java new file mode 100644 index 0000000000..d70f267cc1 --- /dev/null +++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ModelRecipeTest.java @@ -0,0 +1,59 @@ +/*- + * ============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.ModelRecipe; + +/** + */ + +public class ModelRecipeTest { + + @Test + public final void modelRecipeDataTest() { + ModelRecipe modelRecipe = new ModelRecipe(); + modelRecipe.setAction("action"); + assertTrue(modelRecipe.getAction().equalsIgnoreCase("action")); + modelRecipe.setCreated(new Timestamp(System.currentTimeMillis())); + assertTrue(modelRecipe.getCreated() != null); + modelRecipe.setDescription("description"); + assertTrue(modelRecipe.getDescription().equalsIgnoreCase("description")); + modelRecipe.setId(1); + assertTrue(modelRecipe.getId() == 1); + modelRecipe.setModelId(1); + assertTrue(modelRecipe.getModelId() == 1); + modelRecipe.setModelParamXSD("modelParamXSD"); + assertTrue(modelRecipe.getModelParamXSD().equalsIgnoreCase("modelParamXSD")); + modelRecipe.setOrchestrationUri("orchestrationUri"); + assertTrue(modelRecipe.getOrchestrationUri().equalsIgnoreCase("orchestrationUri")); + modelRecipe.setRecipeTimeout(1); + assertTrue(modelRecipe.getRecipeTimeout() == 1); + modelRecipe.setSchemaVersion("schemaVersion"); + assertTrue(modelRecipe.getSchemaVersion().equalsIgnoreCase("schemaVersion")); +// assertTrue(modelRecipe.toString() != null); + } + +} diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ModelTest.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ModelTest.java new file mode 100644 index 0000000000..dcc9810042 --- /dev/null +++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ModelTest.java @@ -0,0 +1,69 @@ +/*- + * ============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.Model; + +/** + */ + +public class ModelTest { + + @Test + public final void modelDataTest() { + Model model = new Model(); + model.setId(1); + assertTrue(model.getId() == 1); + + model.setCreated(new Timestamp(System.currentTimeMillis())); + assertTrue(model.getCreated() != null); + model.setModelCustomizationId("modelCustomizationId"); + + assertTrue(model.getModelCustomizationId().equalsIgnoreCase("modelCustomizationId")); + model.setModelCustomizationName("modelCustomizationName"); + assertTrue(model.getModelCustomizationName().equalsIgnoreCase("modelCustomizationName")); + + model.setModelInvariantId("modelInvariantId"); + assertTrue(model.getModelInvariantId().equalsIgnoreCase("modelInvariantId")); + model.setModelName("modelName"); + assertTrue(model.getModelName().equalsIgnoreCase("modelName")); + + model.setModelType("modelType"); + assertTrue(model.getModelType().equalsIgnoreCase("modelType")); + model.setModelVersion("modelVersion"); + assertTrue(model.getModelVersion().equalsIgnoreCase("modelVersion")); + model.setModelVersionId("modelVersionId"); + assertTrue(model.getModelVersionId().equalsIgnoreCase("modelVersionId")); + model.setVersion("1"); + assertTrue(model.getVersion().equalsIgnoreCase("1")); + model.setRecipes(null); + + assertTrue(model.getRecipes() == null); +// assertTrue(model.toString() != null); + + } + +} diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/NetworkRecipeTest.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/NetworkRecipeTest.java new file mode 100644 index 0000000000..97eadb3f1d --- /dev/null +++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/NetworkRecipeTest.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.NetworkRecipe; + +/** + */ + +public class NetworkRecipeTest { + + @Test + public final void networkRecipeDataTest() { + + NetworkRecipe networkRecipe = new NetworkRecipe(); + networkRecipe.setAction("action"); + assertTrue(networkRecipe.getAction().equalsIgnoreCase("action")); + networkRecipe.setCreated(new Timestamp(System.currentTimeMillis())); + assertTrue(networkRecipe.getCreated() != null); + networkRecipe.setDescription("description"); + assertTrue(networkRecipe.getDescription().equalsIgnoreCase("description")); + networkRecipe.setId(1); + assertTrue(networkRecipe.getId() == 1); + networkRecipe.setModelName("modelName"); + assertTrue(networkRecipe.getModelName().equalsIgnoreCase("modelName")); + networkRecipe.setNetworkParamXSD("networkParamXSD"); + assertTrue(networkRecipe.getNetworkParamXSD().equalsIgnoreCase("networkParamXSD")); + networkRecipe.setOrchestrationUri("orchestrationUri"); + assertTrue(networkRecipe.getOrchestrationUri().equalsIgnoreCase("orchestrationUri")); + networkRecipe.setRecipeTimeout(1); + assertTrue(networkRecipe.getRecipeTimeout() == 1); + networkRecipe.setServiceType("serviceType"); + assertTrue(networkRecipe.getServiceType().equalsIgnoreCase("serviceType")); + networkRecipe.setVersion("version"); + assertTrue(networkRecipe.getVersion().equalsIgnoreCase("version")); +// assertTrue(networkRecipe.toString() != null); + + } + +} diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/NetworkResourceCustomizationTest.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/NetworkResourceCustomizationTest.java new file mode 100644 index 0000000000..7b54854fd9 --- /dev/null +++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/NetworkResourceCustomizationTest.java @@ -0,0 +1,62 @@ +/*- + * ============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.NetworkResource; +import org.openecomp.mso.db.catalog.beans.NetworkResourceCustomization; + +/** + */ + +public class NetworkResourceCustomizationTest { + + @Test + public final void networkResourceCustomizationDataTest() { + NetworkResourceCustomization networkResourceCustomization = new NetworkResourceCustomization(); + networkResourceCustomization.setModelCustomizationUuid("modelCustomizationUuid"); + assertTrue(networkResourceCustomization.getModelCustomizationUuid().equalsIgnoreCase("modelCustomizationUuid")); + networkResourceCustomization.setModelInstanceName("modelInstanceName"); + assertTrue(networkResourceCustomization.getModelInstanceName().equalsIgnoreCase("modelInstanceName")); + networkResourceCustomization.setCreated(new Timestamp(System.currentTimeMillis())); + assertTrue(networkResourceCustomization.getCreated() != null); + networkResourceCustomization.setNetworkResource(new NetworkResource()); + assertTrue(networkResourceCustomization.getNetworkResource() != null); + networkResourceCustomization.setNetworkResourceModelUuid("networkResourceModelUuid"); + assertTrue(networkResourceCustomization.getNetworkResourceModelUuid() + .equalsIgnoreCase("networkResourceModelUuid")); + networkResourceCustomization.setNetworkRole("networkRole"); + assertTrue(networkResourceCustomization.getNetworkRole().equalsIgnoreCase("networkRole")); + networkResourceCustomization.setNetworkScope("networkScope"); + assertTrue(networkResourceCustomization.getNetworkScope().equalsIgnoreCase("networkScope")); + networkResourceCustomization.setNetworkTechnology("networkTechnology"); + assertTrue(networkResourceCustomization.getNetworkTechnology().equalsIgnoreCase("networkTechnology")); + networkResourceCustomization.setNetworkType("networkType"); + assertTrue(networkResourceCustomization.getNetworkType().equalsIgnoreCase("networkType")); +// assertTrue(networkResourceCustomization.toString() != null); + + } + +} diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/NetworkResourceTest.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/NetworkResourceTest.java new file mode 100644 index 0000000000..11ee57b86b --- /dev/null +++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/NetworkResourceTest.java @@ -0,0 +1,68 @@ +/*- + * ============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.NetworkResource; + +/** + */ + +public class NetworkResourceTest { + + @Test + public final void networkResourceDataTest() { + NetworkResource networkResource = new NetworkResource(); + networkResource.setAicVersionMax("aicVersionMax"); + assertTrue(networkResource.getAicVersionMax().equalsIgnoreCase("aicVersionMax")); + networkResource.setAicVersionMin("aicVersionMin"); + assertTrue(networkResource.getAicVersionMin().equalsIgnoreCase("aicVersionMin")); + networkResource.setCreated(new Timestamp(System.currentTimeMillis())); + assertTrue(networkResource.getCreated() != null); + networkResource.setDescription("description"); + assertTrue(networkResource.getDescription().equalsIgnoreCase("description")); + networkResource.setHeatTemplateArtifactUUID("heatTemplateArtifactUUID"); + assertTrue(networkResource.getHeatTemplateArtifactUUID().equalsIgnoreCase("heatTemplateArtifactUUID")); + networkResource.setModelInvariantUUID("modelInvariantUUID"); + assertTrue(networkResource.getModelInvariantUUID().equalsIgnoreCase("modelInvariantUUID")); + networkResource.setModelName("modelName"); + assertTrue(networkResource.getModelName().equalsIgnoreCase("modelName")); + networkResource.setModelUUID("modelUUID"); + assertTrue(networkResource.getModelUUID().equalsIgnoreCase("modelUUID")); + networkResource.setModelVersion("modelVersion"); + assertTrue(networkResource.getModelVersion().equalsIgnoreCase("modelVersion")); + networkResource.setNeutronNetworkType("neutronNetworkType"); + assertTrue(networkResource.getNeutronNetworkType().equalsIgnoreCase("neutronNetworkType")); + networkResource.setOrchestrationMode("orchestrationMode"); + assertTrue(networkResource.getOrchestrationMode().equalsIgnoreCase("orchestrationMode")); + networkResource.setToscaNodeType("toscaNodeType"); + assertTrue(networkResource.getToscaNodeType().equalsIgnoreCase("toscaNodeType")); + networkResource.setVersion("1"); + assertTrue(networkResource.getVersion().equalsIgnoreCase("1")); +// assertTrue(networkResource.toString() != null); + + } + +} 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 index 0000000000..49dc9b7079 --- /dev/null +++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/RecipeTest.java @@ -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 index 0000000000..0e3492170e --- /dev/null +++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ServiceMacroHolderTest.java @@ -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 index 0000000000..4b4a5adf4a --- /dev/null +++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ServiceRecipeTest.java @@ -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); + + } + +} diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ToStringTest.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ToStringTest.java new file mode 100644 index 0000000000..05e857f178 --- /dev/null +++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ToStringTest.java @@ -0,0 +1,151 @@ +/*- + * ============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.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +import org.junit.Test; +import org.openecomp.mso.db.catalog.beans.AllottedResourceCustomization; +import org.openecomp.mso.db.catalog.beans.HeatFiles; +import org.openecomp.mso.db.catalog.beans.Model; +import org.openecomp.mso.db.catalog.beans.ModelRecipe; +import org.openecomp.mso.db.catalog.beans.NetworkResource; +import org.openecomp.mso.db.catalog.beans.NetworkResourceCustomization; +import org.openecomp.mso.db.catalog.beans.Service; +import org.openecomp.mso.db.catalog.beans.ServiceMacroHolder; +import org.openecomp.mso.db.catalog.beans.ServiceRecipe; +import org.openecomp.mso.db.catalog.beans.ServiceToResourceCustomization; +import org.openecomp.mso.db.catalog.beans.TempNetworkHeatTemplateLookup; +import org.openecomp.mso.db.catalog.beans.VfModule; +import org.openecomp.mso.db.catalog.beans.VnfComponent; +import org.openecomp.mso.db.catalog.beans.VnfResource; +import org.openecomp.mso.db.catalog.beans.VnfResourceCustomization; + +public class ToStringTest { + + @Test + public void testTModelRecipeToString(){ + ModelRecipe mr = new ModelRecipe(); + mr.setCreated(new Timestamp(10001)); + mr.setModelId(102); + mr.setRecipeTimeout(100); + String str = mr.toString(); + assertTrue(str != null); + } + + @Test + public void networkResourcetoStringTest(){ + NetworkResource nr = new NetworkResource(); + nr.setCreated(new Timestamp(10000)); + String str = nr.toString(); + assertTrue(str != null); + } + + @Test + public void modelTestToString(){ + Model m = new Model(); + m.setCreated(new Timestamp(100000)); + m.setId(1001); + m.setModelCustomizationId("10012"); + String str = m.toString(); + assertTrue(str != null); + } + + @Test + public void serviceMacroHolderTest(){ + ServiceMacroHolder smh = new ServiceMacroHolder(); + Service service = new Service(); + Map<String,ServiceRecipe> recipes = new HashMap<>(); + recipes.put("test", new ServiceRecipe()); + service.setRecipes(recipes); + + Set<ServiceToResourceCustomization> serviceResourceCustomizations = new HashSet<>(); + ServiceToResourceCustomization sr = new ServiceToResourceCustomization(); + serviceResourceCustomizations.add(sr); + service.setServiceResourceCustomizations(serviceResourceCustomizations); + smh.setService(service); + + ArrayList<VnfResource> vnflist = new ArrayList<>(); + smh.setVnfResources(vnflist); + + VnfResource vr = new VnfResource(); + Set<VnfResourceCustomization> vnfResourceCustomization = new HashSet<>(); + vnfResourceCustomization.add(new VnfResourceCustomization()); + vr.setVnfResourceCustomizations(vnfResourceCustomization); + + Set<VfModule> vfModules = new HashSet<>(); + vfModules.add(new VfModule()); + vr.setVfModules(vfModules); + smh.addVnfResource(vr); + + ArrayList<VnfResourceCustomization> vnfResourceCustomizations = new ArrayList<>(); + smh.setVnfResourceCustomizations(vnfResourceCustomizations); + + VnfResourceCustomization vrc = new VnfResourceCustomization(); + smh.addVnfResourceCustomizations(vrc); + + ArrayList<NetworkResourceCustomization> networkResourceCustomizations = new ArrayList<>(); + smh.setNetworkResourceCustomization(networkResourceCustomizations); + + NetworkResourceCustomization nrc = new NetworkResourceCustomization(); + smh.addNetworkResourceCustomization(nrc); + + ArrayList<AllottedResourceCustomization> allottedResourceCustomizations = new ArrayList<>(); + smh.setAllottedResourceCustomization(allottedResourceCustomizations); + + AllottedResourceCustomization arc = new AllottedResourceCustomization(); + smh.addAllottedResourceCustomization(arc); + + String str = smh.toString(); + assertTrue(str != null); + } + + @Test + public void heatFilesTest(){ + HeatFiles hf = new HeatFiles(); + String str = hf.toString(); + assertTrue(str != null); + + } + + @Test + public void testVnfConponent(){ + VnfComponent vnf = new VnfComponent(); + String str = vnf.toString(); + assertTrue(str != null); + } + + @Test + public void testTempNetworkHeatTemplateLookup(){ + TempNetworkHeatTemplateLookup tn =new TempNetworkHeatTemplateLookup(); + String str = tn.toString(); + assertTrue(str != null); + } + + +} |