diff options
author | Benjamin, Max (mb388a) <mb388a@us.att.com> | 2019-04-02 22:54:57 -0400 |
---|---|---|
committer | Benjamin, Max (mb388a) <mb388a@us.att.com> | 2019-04-02 22:54:57 -0400 |
commit | 86f04e1d55b54a1a23bb274d211c6fca85980fef (patch) | |
tree | e8fb0a8c1d5e64761068df56faa8a8e509fa2f48 /mso-catalog-db/src/test/java/org | |
parent | d59fc0ad5db7b7cacf5996f86db34f41090061fa (diff) |
fix catalogdb cvfnc customization
Hibernate entities were all wrong and needed
a complete rewrite.
The scope kept growing and ended up touching a
lot more of the code than originally planned.
These changes make the db interactions much easier
and more straightforward from java.
The flyway script order had to change to make this
migration possible.
Change-Id: I6ce363a385661300eddb11923ac6a80538edaddc
Issue-ID: SO-1710
Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
Diffstat (limited to 'mso-catalog-db/src/test/java/org')
-rw-r--r-- | mso-catalog-db/src/test/java/org/onap/so/db/catalog/TestApplication.java | 2 | ||||
-rw-r--r-- | mso-catalog-db/src/test/java/org/onap/so/db/catalog/beans/BeansTest.java | 1 | ||||
-rw-r--r-- | mso-catalog-db/src/test/java/org/onap/so/db/catalog/beans/CvnfcConfigurationCustomizationTest.java (renamed from mso-catalog-db/src/test/java/org/onap/so/db/catalog/beans/VnfVfmoduleCvnfcConfigurationCustomizationTest.java) | 22 | ||||
-rw-r--r-- | mso-catalog-db/src/test/java/org/onap/so/db/catalog/beans/CvnfcCustomizationTest.java | 30 | ||||
-rw-r--r-- | mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CvnfcCustomizationRepositoryTest.java | 149 | ||||
-rw-r--r-- | mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/VnfCustomizationRepositoryTest.java | 77 |
6 files changed, 21 insertions, 260 deletions
diff --git a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/TestApplication.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/TestApplication.java index 0226b86739..64b393628c 100644 --- a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/TestApplication.java +++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/TestApplication.java @@ -26,7 +26,7 @@ import org.springframework.boot.autoconfigure.domain.EntityScan; import org.springframework.context.annotation.Profile; import org.springframework.data.jpa.repository.config.EnableJpaRepositories; -@SpringBootApplication(scanBasePackages = { "org.onap.so.db.catalog"}) +@SpringBootApplication(scanBasePackages = { "org.onap.so.db.catalog","org.onap.so.client", "org.onap.so.configuration"}) @EnableJpaRepositories("org.onap.so.db.catalog.data.repository") @EntityScan("org.onap.so.db.catalog") @Profile("test") diff --git a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/beans/BeansTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/beans/BeansTest.java index 44439ede22..2188380bbd 100644 --- a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/beans/BeansTest.java +++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/beans/BeansTest.java @@ -29,6 +29,7 @@ import javax.persistence.Column; import javax.persistence.GeneratedValue; import javax.persistence.Temporal; +import org.junit.Ignore; import org.junit.Test; import org.onap.so.openpojo.rules.CustomSetterMustExistRule; import org.onap.so.openpojo.rules.EqualsAndHashCodeTester; diff --git a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/beans/VnfVfmoduleCvnfcConfigurationCustomizationTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/beans/CvnfcConfigurationCustomizationTest.java index b3ad06cca4..e5a17228b7 100644 --- a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/beans/VnfVfmoduleCvnfcConfigurationCustomizationTest.java +++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/beans/CvnfcConfigurationCustomizationTest.java @@ -24,7 +24,7 @@ import static org.junit.Assert.assertTrue; import org.junit.Test; -public class VnfVfmoduleCvnfcConfigurationCustomizationTest { +public class CvnfcConfigurationCustomizationTest { private static final String CONFIGURATION_FUNCTION = "testconfigurationFunction"; private static final String CONFIGURATION_ROLE = "testconfigurationRole"; @@ -37,7 +37,7 @@ public class VnfVfmoduleCvnfcConfigurationCustomizationTest { @Test public final void testVnfVfmoduleCvnfcConfigurationCustomization () { - VnfVfmoduleCvnfcConfigurationCustomization vnfVfmoduleCvnfcConfigurationCustomization = new VnfVfmoduleCvnfcConfigurationCustomization(); + CvnfcConfigurationCustomization vnfVfmoduleCvnfcConfigurationCustomization = new CvnfcConfigurationCustomization(); vnfVfmoduleCvnfcConfigurationCustomization.setConfigurationFunction(CONFIGURATION_FUNCTION); vnfVfmoduleCvnfcConfigurationCustomization.setConfigurationResource(setupConfigurationResource()); vnfVfmoduleCvnfcConfigurationCustomization.setConfigurationRole(CONFIGURATION_ROLE); @@ -50,9 +50,6 @@ public class VnfVfmoduleCvnfcConfigurationCustomizationTest { vnfVfmoduleCvnfcConfigurationCustomization.setModelInstanceName(MODEL_INSTANCE_NAME); vnfVfmoduleCvnfcConfigurationCustomization.setPolicyName(POLICY_NAME); - vnfVfmoduleCvnfcConfigurationCustomization.setVfModuleCustomization(setupVfModuleCustomization()); - vnfVfmoduleCvnfcConfigurationCustomization.setVnfResourceCustomization(setupVnfResourceCustomization()); - assertTrue (vnfVfmoduleCvnfcConfigurationCustomization.getId().equals (new Integer(1))); assertTrue (vnfVfmoduleCvnfcConfigurationCustomization.getConfigurationFunction().equals (CONFIGURATION_FUNCTION)); assertTrue (vnfVfmoduleCvnfcConfigurationCustomization.getConfigurationRole().equals (CONFIGURATION_ROLE)); @@ -61,21 +58,8 @@ public class VnfVfmoduleCvnfcConfigurationCustomizationTest { assertTrue (vnfVfmoduleCvnfcConfigurationCustomization.getModelInstanceName().equals (MODEL_INSTANCE_NAME)); assertTrue (vnfVfmoduleCvnfcConfigurationCustomization.getPolicyName().equals (POLICY_NAME)); assertTrue (vnfVfmoduleCvnfcConfigurationCustomization.getCvnfcCustomization().getModelCustomizationUUID().equals (MODEL_CUSTOMIZATION_UUID)); - assertTrue (vnfVfmoduleCvnfcConfigurationCustomization.getVnfResourceCustomization().getModelCustomizationUUID().equals (MODEL_CUSTOMIZATION_UUID)); - assertTrue (vnfVfmoduleCvnfcConfigurationCustomization.getVfModuleCustomization().getModelCustomizationUUID().equals (MODEL_CUSTOMIZATION_UUID)); - } - - private VfModuleCustomization setupVfModuleCustomization(){ - VfModuleCustomization vfModuleCustomization = new VfModuleCustomization(); - vfModuleCustomization.setModelCustomizationUUID(MODEL_CUSTOMIZATION_UUID); - return vfModuleCustomization; - } - - private VnfResourceCustomization setupVnfResourceCustomization(){ - VnfResourceCustomization vnfResourceCustomization = new VnfResourceCustomization(); - vnfResourceCustomization.setModelCustomizationUUID(MODEL_CUSTOMIZATION_UUID); - return vnfResourceCustomization; } + private ConfigurationResource setupConfigurationResource(){ ConfigurationResource configurationResource = new ConfigurationResource(); diff --git a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/beans/CvnfcCustomizationTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/beans/CvnfcCustomizationTest.java index 7ec28205d6..4ab05f363a 100644 --- a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/beans/CvnfcCustomizationTest.java +++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/beans/CvnfcCustomizationTest.java @@ -56,11 +56,9 @@ public class CvnfcCustomizationTest { cvnfcCustomization.setNfcNamingCode(NFC_NAMING_CODE); cvnfcCustomization.setToscaNodeType(TOSCA_NODE_TYPE); cvnfcCustomization.setVfModuleCustomization(setupVfModuleCustomization()); - cvnfcCustomization.setVnfcCustomization(setupVnfcCustomization()); - cvnfcCustomization.setVnfResourceCustomization(setupVnfResourceCustomization()); - Set<VnfVfmoduleCvnfcConfigurationCustomization> vnfVfmoduleCvnfcConfigurationCustomizationSet = new HashSet(); - vnfVfmoduleCvnfcConfigurationCustomizationSet.add(setupVnfVfmoduleCvnfcConfigurationCustomization()); - cvnfcCustomization.setVnfVfmoduleCvnfcConfigurationCustomization(vnfVfmoduleCvnfcConfigurationCustomizationSet); + Set<CvnfcConfigurationCustomization> cvnfcConfigurationCustomizationSet = new HashSet(); + cvnfcConfigurationCustomizationSet.add(setupCvnfcConfigurationCustomization()); + cvnfcCustomization.setCvnfcConfigurationCustomization(cvnfcConfigurationCustomizationSet); assertTrue (cvnfcCustomization.getId().equals (new Integer(1))); assertTrue (cvnfcCustomization.getDescription().equals (DESCRIPTION)); @@ -73,7 +71,6 @@ public class CvnfcCustomizationTest { assertTrue (cvnfcCustomization.getNfcFunction().equals (NFC_FUNCTION)); assertTrue (cvnfcCustomization.getNfcNamingCode().equals (NFC_NAMING_CODE)); assertTrue (cvnfcCustomization.getToscaNodeType().equals (TOSCA_NODE_TYPE)); - assertTrue (cvnfcCustomization.getVnfcCustomization().getModelCustomizationUUID().equals (MODEL_CUSTOMIZATION_UUID)); assertTrue (cvnfcCustomization.getVfModuleCustomization().getModelCustomizationUUID().equals (MODEL_CUSTOMIZATION_UUID)); } @@ -82,22 +79,11 @@ public class CvnfcCustomizationTest { vfModuleCustomization.setModelCustomizationUUID(MODEL_CUSTOMIZATION_UUID); return vfModuleCustomization; } + - private VnfcCustomization setupVnfcCustomization(){ - VnfcCustomization vnfcCustomization = new VnfcCustomization(); - vnfcCustomization.setModelCustomizationUUID(MODEL_CUSTOMIZATION_UUID); - return vnfcCustomization; - } - - private VnfResourceCustomization setupVnfResourceCustomization(){ - VnfResourceCustomization vnfResourceCustomization = new VnfResourceCustomization(); - vnfResourceCustomization.setModelCustomizationUUID(MODEL_CUSTOMIZATION_UUID); - return vnfResourceCustomization; - } - - private VnfVfmoduleCvnfcConfigurationCustomization setupVnfVfmoduleCvnfcConfigurationCustomization(){ - VnfVfmoduleCvnfcConfigurationCustomization vnfVfmoduleCvnfcConfigurationCustomization = new VnfVfmoduleCvnfcConfigurationCustomization(); - vnfVfmoduleCvnfcConfigurationCustomization.setModelCustomizationUUID(MODEL_CUSTOMIZATION_UUID); - return vnfVfmoduleCvnfcConfigurationCustomization; + private CvnfcConfigurationCustomization setupCvnfcConfigurationCustomization(){ + CvnfcConfigurationCustomization cvnfcConfigurationCustomization = new CvnfcConfigurationCustomization(); + cvnfcConfigurationCustomization.setModelCustomizationUUID(MODEL_CUSTOMIZATION_UUID); + return cvnfcConfigurationCustomization; } }
\ No newline at end of file diff --git a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CvnfcCustomizationRepositoryTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CvnfcCustomizationRepositoryTest.java index 4b6598427e..7aab47a625 100644 --- a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CvnfcCustomizationRepositoryTest.java +++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CvnfcCustomizationRepositoryTest.java @@ -32,12 +32,12 @@ import org.junit.Assert; import org.junit.Test; import org.onap.so.db.catalog.BaseTest; import org.onap.so.db.catalog.beans.ConfigurationResource; +import org.onap.so.db.catalog.beans.CvnfcConfigurationCustomization; import org.onap.so.db.catalog.beans.CvnfcCustomization; import org.onap.so.db.catalog.beans.VfModule; import org.onap.so.db.catalog.beans.VfModuleCustomization; import org.onap.so.db.catalog.beans.VnfResource; import org.onap.so.db.catalog.beans.VnfResourceCustomization; -import org.onap.so.db.catalog.beans.VnfVfmoduleCvnfcConfigurationCustomization; import org.onap.so.db.catalog.beans.VnfcCustomization; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.transaction.annotation.Transactional; @@ -74,16 +74,14 @@ public class CvnfcCustomizationRepositoryTest extends BaseTest { vnfResourceCustomization.setModelCustomizationUUID("cf9f6efc-9f14-11e8-98d0-529269fb1459"); vnfResourceCustomization.setModelInstanceName("testModelInstanceName"); - List<VnfResourceCustomization> vnfResourceCustomizations = new ArrayList(); + List<VnfResourceCustomization> vnfResourceCustomizations = new ArrayList<>(); vnfResourceCustomizations.add(vnfResourceCustomization); vnfResource.setVnfResourceCustomizations(vnfResourceCustomizations); vnfResourceCustomization.setVnfResources(vnfResource); - cvnfcCustomization.setVnfResourceCustomization(vnfResourceCustomization); VnfcCustomization vnfcCustomization = setUpVnfcCustomization(); vnfcCustomization.setModelCustomizationUUID("d95d704a-9ff2-11e8-98d0-529269fb1459"); - cvnfcCustomization.setVnfcCustomization(vnfcCustomization); cvnfcCustomizationRepository.save(cvnfcCustomization); @@ -126,16 +124,16 @@ public class CvnfcCustomizationRepositoryTest extends BaseTest { vnfResourceCustomization.setModelCustomizationUUID("cf9f6efc-9f14-11e8-98d0-529269fb1459"); vnfResourceCustomization.setModelInstanceName("testModelInstanceName"); - List<VnfResourceCustomization> vnfResourceCustomizations = new ArrayList(); + List<VnfResourceCustomization> vnfResourceCustomizations = new ArrayList<>(); vnfResourceCustomizations.add(vnfResourceCustomization); vnfResource.setVnfResourceCustomizations(vnfResourceCustomizations); vnfResourceCustomization.setVnfResources(vnfResource); - cvnfcCustomization.setVnfResourceCustomization(vnfResourceCustomization); + VnfcCustomization vnfcCustomization = setUpVnfcCustomization(); vnfcCustomization.setModelCustomizationUUID("d95d704a-9ff2-11e8-98d0-529269fb1459"); - cvnfcCustomization.setVnfcCustomization(vnfcCustomization); + @@ -186,11 +184,10 @@ public class CvnfcCustomizationRepositoryTest extends BaseTest { vnfResource.setVnfResourceCustomizations(vnfResourceCustomizations); vnfResourceCustomization.setVnfResources(vnfResource); - cvnfcCustomization.setVnfResourceCustomization(vnfResourceCustomization); + VnfcCustomization vnfcCustomization = setUpVnfcCustomization(); vnfcCustomization.setModelCustomizationUUID("d95d704a-9ff2-11e8-98d0-529269fb1459"); - cvnfcCustomization.setVnfcCustomization(vnfcCustomization); cvnfcCustomizationRepository.save(cvnfcCustomization); @@ -204,137 +201,7 @@ public class CvnfcCustomizationRepositoryTest extends BaseTest { } - @Test - @Transactional - public void createAndGetCvnfcCustomizationsTest() throws Exception { - - CvnfcCustomization cvnfcCustomization = setUpCvnfcCustomization(); - cvnfcCustomization.setModelCustomizationUUID("cf9f6efc-9f14-11e8-98d0-529269fb1459"); - - VfModuleCustomization vfModuleCustomization = new VfModuleCustomization(); - vfModuleCustomization.setModelCustomizationUUID("cf9f6efc-9f14-11e8-98d0-529269fb1459"); - - VfModule vFModule = setUpVfModule(); - VnfResource vnfResource = setUpVnfResource(); - - vFModule.setVnfResources(vnfResource); - vfModuleCustomization.setVfModule(vFModule); - cvnfcCustomization.setVfModuleCustomization(vfModuleCustomization); - - VnfResourceCustomization vnfResourceCustomization = new VnfResourceCustomization(); - vnfResourceCustomization.setModelCustomizationUUID("cf9f6efc-9f14-11e8-98d0-529269fb1459"); - vnfResourceCustomization.setModelInstanceName("testModelInstanceName"); - - List<VnfResourceCustomization> vnfResourceCustomizations = new ArrayList(); - vnfResourceCustomizations.add(vnfResourceCustomization); - vnfResource.setVnfResourceCustomizations(vnfResourceCustomizations); - vnfResourceCustomization.setVnfResources(vnfResource); - - cvnfcCustomization.setVnfResourceCustomization(vnfResourceCustomization); - - VnfcCustomization vnfcCustomization = setUpVnfcCustomization(); - vnfcCustomization.setModelCustomizationUUID("d95d704a-9ff2-11e8-98d0-529269fb1459"); - cvnfcCustomization.setVnfcCustomization(vnfcCustomization); - - cvnfcCustomizationRepository.save(cvnfcCustomization); - - List<CvnfcCustomization> cvnfcCustomizationList = cvnfcCustomizationRepository.findByVnfResourceCustomizationAndVfModuleCustomization("cf9f6efc-9f14-11e8-98d0-529269fb1459","cf9f6efc-9f14-11e8-98d0-529269fb1459"); - boolean matchFound = false; - for (CvnfcCustomization foundCvnfcCustomization : cvnfcCustomizationList) { - if (foundCvnfcCustomization.getDescription().equalsIgnoreCase(cvnfcCustomization.getDescription())) { - - assertThat(cvnfcCustomization, sameBeanAs(foundCvnfcCustomization) - .ignoring("id") - .ignoring("created") - .ignoring("vnfVfmoduleCvnfcConfigurationCustomization") - .ignoring("vnfResourceCusteModelCustomizationUUID")); - - matchFound = true; - break; - } - } - Assert.assertTrue(matchFound); - } + - @Test - @Transactional - public void createAndGetCvnfcCustomizationsExtractToscaModelTest() throws Exception { - - CvnfcCustomization cvnfcCustomization = setUpCvnfcCustomization(); - cvnfcCustomization.setModelCustomizationUUID("cf9f6efc-9f14-11e8-98d0-529269fb1459"); - - VfModuleCustomization vfModuleCustomization = new VfModuleCustomization(); - vfModuleCustomization.setModelCustomizationUUID("cf9f6efc-9f14-11e8-98d0-529269fb1459"); - - VfModule vFModule = setUpVfModule(); - VnfResource vnfResource = setUpVnfResource(); - - vFModule.setVnfResources(vnfResource); - vfModuleCustomization.setVfModule(vFModule); - cvnfcCustomization.setVfModuleCustomization(vfModuleCustomization); - - VnfResourceCustomization vnfResourceCustomization = new VnfResourceCustomization(); - vnfResourceCustomization.setModelCustomizationUUID("cf9f6efc-9f14-11e8-98d0-529269fb1459"); - vnfResourceCustomization.setModelInstanceName("testModelInstanceName"); - - List<VnfResourceCustomization> vnfResourceCustomizations = new ArrayList(); - vnfResourceCustomizations.add(vnfResourceCustomization); - vnfResource.setVnfResourceCustomizations(vnfResourceCustomizations); - vnfResourceCustomization.setVnfResources(vnfResource); - - cvnfcCustomization.setVnfResourceCustomization(vnfResourceCustomization); - - VnfcCustomization vnfcCustomization = setUpVnfcCustomization(); - vnfcCustomization.setModelCustomizationUUID("d95d704a-9ff2-11e8-98d0-529269fb1459"); - cvnfcCustomization.setVnfcCustomization(vnfcCustomization); - - ConfigurationResource configurationResource = new ConfigurationResource(); - configurationResource.setToscaNodeType("FabricConfiguration"); - configurationResource.setModelInvariantUUID("modelInvariantUUID"); - configurationResource.setModelUUID("modelUUID"); - configurationResource.setModelName("modelName"); - configurationResource.setModelVersion("modelVersion"); - configurationResource.setDescription("description"); - configurationResource.setToscaNodeType("toscaNodeType"); - - VnfVfmoduleCvnfcConfigurationCustomization vnfVfmoduleCvnfcConfigurationCustomization = new VnfVfmoduleCvnfcConfigurationCustomization(); - vnfVfmoduleCvnfcConfigurationCustomization.setConfigurationFunction("configurationFunction"); - vnfVfmoduleCvnfcConfigurationCustomization.setModelCustomizationUUID("modelCustomizationUUID"); - vnfVfmoduleCvnfcConfigurationCustomization.setConfigurationResource(configurationResource); - vnfVfmoduleCvnfcConfigurationCustomization.setCvnfcCustomization(cvnfcCustomization); - vnfVfmoduleCvnfcConfigurationCustomization.setModelInstanceName("modelInstanceName"); - vnfVfmoduleCvnfcConfigurationCustomization.setVfModuleCustomization(vfModuleCustomization); - vnfVfmoduleCvnfcConfigurationCustomization.setVnfResourceCustomization(vnfResourceCustomization); - - Set<VnfVfmoduleCvnfcConfigurationCustomization> vnfVfmoduleCvnfcConfigurationCustomizationSet = new HashSet<VnfVfmoduleCvnfcConfigurationCustomization>(); - vnfVfmoduleCvnfcConfigurationCustomizationSet.add(vnfVfmoduleCvnfcConfigurationCustomization); - cvnfcCustomization.setVnfVfmoduleCvnfcConfigurationCustomization(vnfVfmoduleCvnfcConfigurationCustomizationSet); - vfModuleCustomization.setVnfVfmoduleCvnfcConfigurationCustomization(vnfVfmoduleCvnfcConfigurationCustomizationSet); - vnfResourceCustomization.setVnfVfmoduleCvnfcConfigurationCustomization(vnfVfmoduleCvnfcConfigurationCustomizationSet); - - cvnfcCustomizationRepository.save(cvnfcCustomization); - - List<CvnfcCustomization> cvnfcCustomizationList = cvnfcCustomizationRepository.findByVnfResourceCustomizationAndVfModuleCustomization("cf9f6efc-9f14-11e8-98d0-529269fb1459","cf9f6efc-9f14-11e8-98d0-529269fb1459"); - boolean matchFound = false; - for (CvnfcCustomization foundCvnfcCustomization : cvnfcCustomizationList) { - if (foundCvnfcCustomization.getDescription().equalsIgnoreCase(cvnfcCustomization.getDescription())) { - - assertThat(cvnfcCustomization, sameBeanAs(foundCvnfcCustomization) - .ignoring("id") - .ignoring("created") - .ignoring("vnfVfmoduleCvnfcConfigurationCustomization") - .ignoring("vnfResourceCusteModelCustomizationUUID")); - - matchFound = true; - - Set<VnfVfmoduleCvnfcConfigurationCustomization> vnfVfmoduleCvnfcConfigurationCustomizations = foundCvnfcCustomization.getVnfVfmoduleCvnfcConfigurationCustomization(); - for(VnfVfmoduleCvnfcConfigurationCustomization customization : vnfVfmoduleCvnfcConfigurationCustomizations) { - Assert.assertTrue(customization.getConfigurationResource().getToscaNodeType().equalsIgnoreCase("toscaNodeType")); - } - break; - } - } - Assert.assertTrue(matchFound); - - } + } diff --git a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/VnfCustomizationRepositoryTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/VnfCustomizationRepositoryTest.java deleted file mode 100644 index be21ea9b35..0000000000 --- a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/VnfCustomizationRepositoryTest.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * ============LICENSE_START======================================================= - * Copyright (C) 2019 Nordix Foundation. - * ================================================================================ - * 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. - * - * SPDX-License-Identifier: Apache-2.0 - * ============LICENSE_END========================================================= - */ - -package org.onap.so.db.catalog.data.repository; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; - -import java.util.List; -import org.junit.Test; -import org.onap.so.db.catalog.BaseTest; -import org.onap.so.db.catalog.beans.VnfResource; -import org.onap.so.db.catalog.beans.VnfResourceCustomization; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.util.CollectionUtils; - - -public class VnfCustomizationRepositoryTest extends BaseTest { - - @Autowired - private VnfCustomizationRepository vnfCustomizationRepository; - - @Test - public void findByModelCustomizationUUID_ValidUuid_ExpectedOutput() throws Exception { - List<VnfResourceCustomization> vnfCustomizationList = vnfCustomizationRepository - .findByModelCustomizationUUID("68dc9a92-214c-11e7-93ae-92361f002671"); - assertFalse(CollectionUtils.isEmpty(vnfCustomizationList)); - assertEquals("output contains one entity", 1, vnfCustomizationList.size()); - - checkVnfResourceCustomization(vnfCustomizationList.get(0)); - } - - @Test - public void findOneByModelCustomizationUUID_ValidUuid_ExpectedOutput() throws Exception { - VnfResourceCustomization vnfResourceCustomization = vnfCustomizationRepository - .findOneByModelCustomizationUUID("68dc9a92-214c-11e7-93ae-92361f002671"); - checkVnfResourceCustomization(vnfResourceCustomization); - } - - @Test - public void findByModelInstanceNameAndVnfResources_ValidNameAndUuid_ExpectedOutput() throws Exception { - VnfResourceCustomization vnfResourceCustomization = vnfCustomizationRepository - .findByModelInstanceNameAndVnfResources("vSAMP10a 1", "ff2ae348-214a-11e7-93ae-92361f002671"); - checkVnfResourceCustomization(vnfResourceCustomization); - } - - private void checkVnfResourceCustomization(VnfResourceCustomization vnfResourceCustomization) { - assertEquals("modelInstanceName", "vSAMP10a 1", vnfResourceCustomization.getModelInstanceName()); - assertEquals("blueprintName", "test_configuration_restconf", vnfResourceCustomization.getBlueprintName()); - assertEquals("blueprintVersion", "1.0.0", vnfResourceCustomization.getBlueprintVersion()); - VnfResource vnfResource = vnfResourceCustomization.getVnfResources(); - assertNotNull(vnfResource); - - assertEquals("VNFResource modelUUID", "ff2ae348-214a-11e7-93ae-92361f002671", vnfResource.getModelUUID()); - assertEquals("VNFResource modelInvariantUUID", "2fff5b20-214b-11e7-93ae-92361f002671", - vnfResource.getModelInvariantUUID()); - assertEquals("VNFResource modelVersion", "1.0", vnfResource.getModelVersion()); - assertEquals("VNFResource orchestration mode", "HEAT", vnfResource.getOrchestrationMode()); - } -} |