summaryrefslogtreecommitdiffstats
path: root/adapters
diff options
context:
space:
mode:
authorBenjamin, Max (mb388a) <mb388a@us.att.com>2019-03-20 16:19:39 -0400
committerBenjamin, Max (mb388a) <mb388a@us.att.com>2019-03-21 13:29:05 -0400
commite8689688629582187b2484eda21524ee70abbb9f (patch)
tree49ee8dc72349a4929dc2bfd45bc6ef203f1d1e88 /adapters
parent353782a4d50f3764f71916385dc062401aa7456d (diff)
Corrected hibernate for cfvc customization table
fix two tests that did not ignore some properties fix schema sql file that was missing fields Properly wire hibernate entities, clean up db tables Update schema.sql files to be consistent add junit for customization linked to same cvnfc Change-Id: I4bc0a83cb3908f5b34224416e75446b6cd166b9e Issue-ID: SO-1689 Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
Diffstat (limited to 'adapters')
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.6__Fix_CVNFC_Customization.sql23
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CvnfcCatalogDbQueryTest.java91
2 files changed, 37 insertions, 77 deletions
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.6__Fix_CVNFC_Customization.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.6__Fix_CVNFC_Customization.sql
new file mode 100644
index 0000000000..f09c7362d5
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.6__Fix_CVNFC_Customization.sql
@@ -0,0 +1,23 @@
+use catalogdb;
+
+DROP TABLE vnf_vfmodule_cvnfc_configuration_customization;
+
+CREATE TABLE IF NOT EXISTS vnf_vfmodule_cvnfc_configuration_customization (
+ `ID` INT(11) NOT NULL AUTO_INCREMENT,
+ `MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL,
+ `MODEL_INSTANCE_NAME` VARCHAR(200) NOT NULL,
+ `CONFIGURATION_TYPE` VARCHAR(200) NULL,
+ `CONFIGURATION_ROLE` VARCHAR(200) NULL,
+ `CONFIGURATION_FUNCTION` VARCHAR(200) NULL,
+ `POLICY_NAME` VARCHAR(200) NULL,
+ `CREATION_TIMESTAMP` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ `CONFIGURATION_MODEL_UUID` VARCHAR(200) NOT NULL,
+ `VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) DEFAULT NULL,
+ `VF_MODULE_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) DEFAULT NULL,
+ `CVNFC_CUSTOMIZATION_ID` INT(11) DEFAULT NULL,
+ PRIMARY KEY (`ID`),
+ INDEX `fk_vnf_vfmodule_cvnfc_config_cust__configuration_idx` (`CONFIGURATION_MODEL_UUID` ASC),
+
+ CONSTRAINT `fk_vnf_vfmod_cvnfc_config_cust__configuration_resource` FOREIGN KEY (`CONFIGURATION_MODEL_UUID`)
+ REFERENCES `configuration` (`MODEL_UUID`) ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE = INNODB AUTO_INCREMENT = 20654 DEFAULT CHARACTER SET = LATIN1; \ No newline at end of file
diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CvnfcCatalogDbQueryTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CvnfcCatalogDbQueryTest.java
index 89f4824492..898e8eadf1 100644
--- a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CvnfcCatalogDbQueryTest.java
+++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CvnfcCatalogDbQueryTest.java
@@ -89,7 +89,7 @@ public class CvnfcCatalogDbQueryTest {
CvnfcCustomization found = foundCvnfcCustomization.get(0);
CvnfcCustomization templateCvnfcCustomization = new CvnfcCustomization();
- BeanUtils.copyProperties(found, templateCvnfcCustomization, "vnfVfmoduleCvnfcConfigurationCustomization");
+ BeanUtils.copyProperties(found, templateCvnfcCustomization, "vnfVfmoduleCvnfcConfigurationCustomization", "vfModuleCustomization", "vnfcCustomization", "vnfResourceCustomization");
assertThat(cvnfcCustomization, sameBeanAs(templateCvnfcCustomization)
.ignoring("id")
@@ -99,86 +99,23 @@ public class CvnfcCatalogDbQueryTest {
}
@Test
- public void getLinkedVnfVfmoduleCvnfcConfigurationCustomizationTest() {
+ public void cVnfcByCustomizationUUID_Test() {
- CvnfcCustomization cvnfcCustomization = setUpCvnfcCustomization("0c042562-2bac-11e9-b210-d663bd873d93");
-
- 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("toscaNodeTypeFC");
-
- VnfResource vnfResource = new VnfResource();
- vnfResource.setModelUUID("6f19c5fa-2b19-11e9-b210-d663bd873d93");
- vnfResource.setModelVersion("modelVersion");
- vnfResource.setOrchestrationMode("orchestrationMode");
+ CvnfcCustomization cvnfcCustomization = setUpCvnfcCustomization("dadc2c8c-2bab-11e9-b210-d663bd873d93");
+
+ CvnfcCustomization found = client.getCvnfcCustomizationByCustomizationUUID("dadc2c8c-2bab-11e9-b210-d663bd873d93");
+ assertNotNull(found);
- VfModule vfModule = new VfModule();
- vfModule.setModelUUID("98aa2a6e-2b18-11e9-b210-d663bd873d93");
- vfModule.setModelInvariantUUID("9fe57860-2b18-11e9-b210-d663bd873d93");
- vfModule.setIsBase(true);
- vfModule.setModelName("modelName");
- vfModule.setModelVersion("modelVersion");
- vfModule.setVnfResources(vnfResource);
+ CvnfcCustomization templateCvnfcCustomization = new CvnfcCustomization();
+ BeanUtils.copyProperties(found, templateCvnfcCustomization, "vnfVfmoduleCvnfcConfigurationCustomization", "vfModuleCustomization", "vnfcCustomization", "vnfResourceCustomization");
- VfModuleCustomization vfModuleCustomization = new VfModuleCustomization();
- vfModuleCustomization.setModelCustomizationUUID("bdbf984a-2b16-11e9-b210-d663bd873d93");
- vfModuleCustomization.setVfModule(vfModule);
- cvnfcCustomization.setVfModuleCustomization(vfModuleCustomization);
-
- VnfResourceCustomization vnfResourceCustomization = new VnfResourceCustomization();
- vnfResourceCustomization.setModelCustomizationUUID("6912dd02-2b16-11e9-b210-d663bd873d93");
- vnfResourceCustomization.setModelInstanceName("testModelInstanceName");
- vnfResourceCustomization.setVnfResources(vnfResource);
- cvnfcCustomization.setVnfResourceCustomization(vnfResourceCustomization);
-
- VnfVfmoduleCvnfcConfigurationCustomization vnfVfmoduleCvnfcConfigurationCustomization = new VnfVfmoduleCvnfcConfigurationCustomization();
- vnfVfmoduleCvnfcConfigurationCustomization.setConfigurationFunction("configurationFunction");
- vnfVfmoduleCvnfcConfigurationCustomization.setModelCustomizationUUID("64627fec-2b1b-11e9-b210-d663bd873d93");
- 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);
-
- vnfVfmoduleCvnfcConfigurationCustomization.setCvnfcCustomization(cvnfcCustomization);
-
- cvnfcCustomizationRepository.save(cvnfcCustomization);
-
- List<CvnfcCustomization> foundCvnfcCustomization = client.getCvnfcCustomizationByVnfCustomizationUUIDAndVfModuleCustomizationUUID("6912dd02-2b16-11e9-b210-d663bd873d93","bdbf984a-2b16-11e9-b210-d663bd873d93");
- assertNotNull(foundCvnfcCustomization);
- assertTrue(foundCvnfcCustomization.size() > 0);
- CvnfcCustomization found = foundCvnfcCustomization.get(0);
-
- Set<VnfVfmoduleCvnfcConfigurationCustomization> vnfVfmoduleCvnfcConfigurationCustomizations = found.getVnfVfmoduleCvnfcConfigurationCustomization();
- if (vnfVfmoduleCvnfcConfigurationCustomizations.size() > 0){
- for(VnfVfmoduleCvnfcConfigurationCustomization customization : vnfVfmoduleCvnfcConfigurationCustomizations) {
- Assert.assertTrue(customization.getConfigurationResource().getToscaNodeType().equalsIgnoreCase("toscaNodeTypeFC"));
- }
- } else {
- Assert.fail("No linked VnfVfmoduleCvnfcConfigurationCustomization found for CvnfcCustomization");
- }
-
- VnfVfmoduleCvnfcConfigurationCustomization vnfVfmoduleCvnfcConfigurationCustomizationFound = client.
- getVnfVfmoduleCvnfcConfigurationCustomizationByVnfCustomizationUuidAndVfModuleCustomizationUuidAndCvnfcCustomizationUuid(
- "6912dd02-2b16-11e9-b210-d663bd873d93",
- "bdbf984a-2b16-11e9-b210-d663bd873d93",
- "0c042562-2bac-11e9-b210-d663bd873d93");
- assertNotNull(vnfVfmoduleCvnfcConfigurationCustomizationFound);
- System.out.println(vnfVfmoduleCvnfcConfigurationCustomizationFound.getModelCustomizationUUID());
+ assertThat(cvnfcCustomization, sameBeanAs(templateCvnfcCustomization)
+ .ignoring("id")
+ .ignoring("created")
+ .ignoring("vnfVfmoduleCvnfcConfigurationCustomization")
+ .ignoring("vnfResourceCusteModelCustomizationUUID"));
}
+
protected CvnfcCustomization setUpCvnfcCustomization(String id){
CvnfcCustomization cvnfcCustomization = new CvnfcCustomization();