Search in sources :

Example 16 with CvnfcCustomization

use of org.onap.so.db.catalog.beans.CvnfcCustomization 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

CvnfcCustomization (org.onap.so.db.catalog.beans.CvnfcCustomization)16 ArrayList (java.util.ArrayList)12 Test (org.junit.Test)10 CvnfcConfigurationCustomization (org.onap.so.db.catalog.beans.CvnfcConfigurationCustomization)9 ConfigurationResource (org.onap.so.db.catalog.beans.ConfigurationResource)7 VnfcCustomization (org.onap.so.db.catalog.beans.VnfcCustomization)7 VfModule (org.onap.so.db.catalog.beans.VfModule)6 VfModuleCustomization (org.onap.so.db.catalog.beans.VfModuleCustomization)6 VnfResource (org.onap.so.db.catalog.beans.VnfResource)5 VnfResourceCustomization (org.onap.so.db.catalog.beans.VnfResourceCustomization)5 Transactional (org.springframework.transaction.annotation.Transactional)4 List (java.util.List)3 HashSet (java.util.HashSet)2 Set (java.util.Set)2 Collectors (java.util.stream.Collectors)2 BaseTest (org.onap.so.db.catalog.BaseTest)2 CollectionNetworkResourceCustomization (org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization)2 CollectionResourceInstanceGroupCustomization (org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization)2 ConfigurationResourceCustomization (org.onap.so.db.catalog.beans.ConfigurationResourceCustomization)2 InstanceGroup (org.onap.so.db.catalog.beans.InstanceGroup)2