Search in sources :

Example 21 with VnfResource

use of org.onap.so.db.catalog.beans.VnfResource in project so by onap.

the class CvnfcCustomizationRepositoryTest method createAndGetCvnfcCustomizationListTest.

@Test
@Transactional
public void createAndGetCvnfcCustomizationListTest() 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);
    vnfResourceCustomization.setVnfResources(vnfResource);
    VnfcCustomization vnfcCustomization = setUpVnfcCustomization();
    vnfcCustomization.setModelCustomizationUUID("d95d704a-9ff2-11e8-98d0-529269fb1459");
    cvnfcCustomizationRepository.save(cvnfcCustomization);
    List<CvnfcCustomization> cvnfcCustomizationList = cvnfcCustomizationRepository.findByModelCustomizationUUID("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);
}
Also used : VnfResource(org.onap.so.db.catalog.beans.VnfResource) CvnfcCustomization(org.onap.so.db.catalog.beans.CvnfcCustomization) ArrayList(java.util.ArrayList) VnfcCustomization(org.onap.so.db.catalog.beans.VnfcCustomization) VfModuleCustomization(org.onap.so.db.catalog.beans.VfModuleCustomization) VfModule(org.onap.so.db.catalog.beans.VfModule) VnfResourceCustomization(org.onap.so.db.catalog.beans.VnfResourceCustomization) Test(org.junit.Test) BaseTest(org.onap.so.db.catalog.BaseTest) Transactional(org.springframework.transaction.annotation.Transactional)

Aggregations

VnfResource (org.onap.so.db.catalog.beans.VnfResource)21 Test (org.junit.Test)10 VfModule (org.onap.so.db.catalog.beans.VfModule)9 VfModuleCustomization (org.onap.so.db.catalog.beans.VfModuleCustomization)9 ArrayList (java.util.ArrayList)8 VnfResourceCustomization (org.onap.so.db.catalog.beans.VnfResourceCustomization)8 HashMap (java.util.HashMap)5 CatalogDbAdapterBaseTest (org.onap.so.adapters.catalogdb.CatalogDbAdapterBaseTest)5 HeatEnvironment (org.onap.so.db.catalog.beans.HeatEnvironment)5 HeatTemplate (org.onap.so.db.catalog.beans.HeatTemplate)5 CvnfcCustomization (org.onap.so.db.catalog.beans.CvnfcCustomization)4 HeatTemplateParam (org.onap.so.db.catalog.beans.HeatTemplateParam)4 VnfcCustomization (org.onap.so.db.catalog.beans.VnfcCustomization)4 Transactional (org.springframework.transaction.annotation.Transactional)4 JsonParseException (com.fasterxml.jackson.core.JsonParseException)3 VnfException (org.onap.so.adapters.vnf.exceptions.VnfException)3 CloudSite (org.onap.so.db.catalog.beans.CloudSite)3 HeatFiles (org.onap.so.db.catalog.beans.HeatFiles)3 MavenLikeVersioning (org.onap.so.db.catalog.utils.MavenLikeVersioning)3 MsoException (org.onap.so.openstack.exceptions.MsoException)3