Search in sources :

Example 6 with ToscaCsar

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

the class ToscaResourceInstaller method createToscaCsar.

protected void createToscaCsar(ToscaResourceStructure toscaResourceStructure) {
    Optional<ToscaCsar> toscaCsarOpt = toscaCsarRepo.findById(toscaResourceStructure.getToscaArtifact().getArtifactUUID());
    ToscaCsar toscaCsar;
    if (!toscaCsarOpt.isPresent()) {
        toscaCsar = new ToscaCsar();
        toscaCsar.setArtifactUUID(toscaResourceStructure.getToscaArtifact().getArtifactUUID());
    } else {
        toscaCsar = toscaCsarOpt.get();
    }
    if (toscaResourceStructure.getToscaArtifact().getArtifactChecksum() != null) {
        toscaCsar.setArtifactChecksum(toscaResourceStructure.getToscaArtifact().getArtifactChecksum());
    } else {
        toscaCsar.setArtifactChecksum(MANUAL_RECORD);
    }
    toscaCsar.setName(toscaResourceStructure.getToscaArtifact().getArtifactName());
    toscaCsar.setVersion(toscaResourceStructure.getToscaArtifact().getArtifactVersion());
    toscaCsar.setDescription(toscaResourceStructure.getToscaArtifact().getArtifactDescription());
    toscaCsar.setUrl(toscaResourceStructure.getToscaArtifact().getArtifactURL());
    toscaResourceStructure.setCatalogToscaCsar(toscaCsar);
}
Also used : ToscaCsar(org.onap.so.db.catalog.beans.ToscaCsar)

Example 7 with ToscaCsar

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

the class ASDCControllerITTest method treatNotification_ValidVnfResource_ExpectedOutput.

/**
 * Testing with the service-Svc140-VF-csar.csar.
 */
@Test
public void treatNotification_ValidVnfResource_ExpectedOutput() {
    /**
     * service UUID/invariantUUID from global metadata in resource-Testvf140-template.yml.
     */
    String serviceUuid = "28944a37-de3f-46ec-9c60-b57036fbd26d";
    String serviceInvariantUuid = "9e900d3e-1e2e-4124-a5c2-4345734dc9de";
    initMockAaiServer(serviceUuid, serviceInvariantUuid);
    NotificationDataImpl notificationData = new NotificationDataImpl();
    notificationData.setServiceUUID(serviceUuid);
    notificationData.setDistributionID(distributionId);
    notificationData.setServiceInvariantUUID(serviceInvariantUuid);
    notificationData.setServiceVersion("1.0");
    ResourceInfoImpl resourceInfo = constructVnfResourceInfo();
    List<ResourceInfoImpl> resourceInfoList = new ArrayList<>();
    resourceInfoList.add(resourceInfo);
    notificationData.setResources(resourceInfoList);
    ArtifactInfoImpl artifactInfo = constructVnfServiceArtifact();
    List<ArtifactInfoImpl> artifactInfoList = new ArrayList<>();
    artifactInfoList.add(artifactInfo);
    notificationData.setServiceArtifacts(artifactInfoList);
    try {
        asdcController.treatNotification(notificationData);
        logger.info("Checking the database for VNF ingestion");
        /**
         * Check the tosca csar entity, it should be the same as provided from NotficationData.
         */
        ToscaCsar toscaCsar = toscaCsarRepository.findById(artifactUuid).orElseThrow(() -> new EntityNotFoundException("Tosca csar: " + artifactUuid + " not found"));
        assertEquals("tosca csar UUID", artifactUuid, toscaCsar.getArtifactUUID());
        assertEquals("tosca csar name", "service-vnfservice.csar", toscaCsar.getName());
        assertEquals("tosca csar version", "1.0", toscaCsar.getVersion());
        assertNull("tosca csar descrption", toscaCsar.getDescription());
        assertEquals("tosca csar checksum", "MANUAL_RECORD", toscaCsar.getArtifactChecksum());
        assertEquals("toscar csar URL", "/download/service-vnfservice.csar", toscaCsar.getUrl());
        /**
         * Check the service entity, it should be the same as global metadata information in
         * service-Testservice140-template.yml inside csar.
         */
        Service service = serviceRepository.findById(serviceUuid).orElseThrow(() -> new EntityNotFoundException("Service: " + serviceUuid + " not found"));
        assertEquals("model UUID", serviceUuid, service.getModelUUID());
        assertEquals("model name", "SVC140", service.getModelName());
        assertEquals("model invariantUUID", serviceInvariantUuid, service.getModelInvariantUUID());
        assertEquals("model version", "1.0", service.getModelVersion());
        assertEquals("description", "SVC140", service.getDescription().trim());
        assertEquals("tosca csar artifact UUID", artifactUuid, service.getCsar().getArtifactUUID());
        assertEquals("service type", "ST", service.getServiceType());
        assertEquals("service role", "Sr", service.getServiceRole());
        assertEquals("environment context", "General_Revenue-Bearing", service.getEnvironmentContext());
        assertEquals("service category", "Network Service", service.getCategory());
        assertNull("workload context", service.getWorkloadContext());
        assertEquals("resource order", "TestVF140", service.getResourceOrder());
        assertEquals("CDS blueprint name", "BP140", service.getBlueprintName());
        assertEquals("CDS blueprint version", "v1.4.0", service.getBlueprintVersion());
        assertEquals("controller actor", "SO-REF-DATA", service.getControllerActor());
        /**
         * Check VNF resource, it should be the same as metadata in the topology template in
         * service-Testservice140-template.yml OR global metadata in the resource-Testservice140-template.yml
         */
        String vnfResourceKey = "d20d3ea9-2f54-4071-8b5c-fd746dde245e";
        VnfResource vnfResource = vnfResourceRepository.findById(vnfResourceKey).orElseThrow(() -> new EntityNotFoundException("VNF resource:" + vnfResourceKey + " not found"));
        assertEquals("orchestration mode", "HEAT", vnfResource.getOrchestrationMode());
        assertEquals("Description", "TestPNF140", vnfResource.getDescription().trim());
        assertEquals("model UUID", vnfResourceKey, vnfResource.getModelUUID());
        assertEquals("model invariant UUID", "7a4bffa2-fac5-4b8b-b348-0bdf313a1aeb", vnfResource.getModelInvariantUUID());
        assertEquals("model version", "1.0", vnfResource.getModelVersion());
        assertEquals("model name", "TestVF140", vnfResource.getModelName());
        assertEquals("tosca node type", "org.openecomp.resource.vf.Testvf140", vnfResource.getToscaNodeType());
        assertEquals("resource category", "Application L4+", vnfResource.getCategory());
        assertEquals("resource sub category", "Database", vnfResource.getSubCategory());
        /**
         * Check VNF resource customization, it should be the same as metadata in the topology template in
         * service-Testservice140-template.yml OR global metadata in the resource-Testservice140-template.yml
         */
        String vnfCustomizationKey = "ca1c8455-8ce2-4a76-a037-3f4cf01cffa0";
        VnfResourceCustomization vnfCustomization = Optional.ofNullable(vnfCustomizationRepository.findOneByModelCustomizationUUID(vnfCustomizationKey)).orElseThrow(() -> new EntityNotFoundException("VNF resource customization: " + vnfCustomizationKey + " not found"));
        assertEquals("model customizationUUID", vnfCustomizationKey, vnfCustomization.getModelCustomizationUUID());
        assertEquals("model instance name", "TestVF140 0", vnfCustomization.getModelInstanceName());
        assertNull("NF type", vnfCustomization.getNfType());
        assertNull("NF Role", vnfCustomization.getNfRole());
        assertNull("NF function", vnfCustomization.getNfFunction());
        assertNull("NF naming code", vnfCustomization.getNfNamingCode());
        assertEquals("VNF resource model UUID", vnfResourceKey, vnfCustomization.getVnfResources().getModelUUID());
        assertEquals("Multi stage design", "false", vnfCustomization.getMultiStageDesign());
        assertNotNull("resource input", vnfCustomization.getResourceInput());
        assertEquals("cds blueprint name(sdnc_model_name property)", "BP140", vnfCustomization.getBlueprintName());
        assertEquals("cds blueprint version(sdnc_model_version property)", "v1.4.0", vnfCustomization.getBlueprintVersion());
        assertEquals("controller actor", "SO-REF-DATA", vnfCustomization.getControllerActor());
        /**
         * Check the vnf resource customization with service mapping
         */
        List<VnfResourceCustomization> vnfCustList = service.getVnfCustomizations();
        assertEquals("VNF resource customization entity", 1, vnfCustList.size());
        assertEquals(vnfCustomizationKey, vnfCustList.get(0).getModelCustomizationUUID());
        /**
         * Check the watchdog for component distribution status
         */
        List<WatchdogComponentDistributionStatus> distributionList = watchdogCDStatusRepository.findByDistributionId(this.distributionId);
        assertNotNull(distributionList);
        assertEquals(1, distributionList.size());
        WatchdogComponentDistributionStatus distributionStatus = distributionList.get(0);
        assertEquals("COMPONENT_DONE_OK", distributionStatus.getComponentDistributionStatus());
        assertEquals("SO", distributionStatus.getComponentName());
    } catch (Exception e) {
        logger.info(e.getMessage(), e);
        fail(e.getMessage());
    }
}
Also used : ArtifactInfoImpl(org.onap.so.asdc.client.test.emulators.ArtifactInfoImpl) WatchdogComponentDistributionStatus(org.onap.so.db.request.beans.WatchdogComponentDistributionStatus) ResourceInfoImpl(org.onap.so.asdc.client.test.emulators.ResourceInfoImpl) ArrayList(java.util.ArrayList) Service(org.onap.so.db.catalog.beans.Service) EntityNotFoundException(javax.persistence.EntityNotFoundException) EntityNotFoundException(javax.persistence.EntityNotFoundException) ASDCControllerException(org.onap.so.asdc.client.exceptions.ASDCControllerException) VnfResource(org.onap.so.db.catalog.beans.VnfResource) NotificationDataImpl(org.onap.so.asdc.client.test.emulators.NotificationDataImpl) ToscaCsar(org.onap.so.db.catalog.beans.ToscaCsar) VnfResourceCustomization(org.onap.so.db.catalog.beans.VnfResourceCustomization) BaseTest(org.onap.so.asdc.BaseTest) Test(org.junit.Test)

Example 8 with ToscaCsar

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

the class ASDCControllerITTest method treatNotification_ValidPnfResource_With_Software_Version_ExpectedOutput.

/**
 * Test with service-Ericservice-csar.csar to test software_vesrions field.
 */
@Test
public void treatNotification_ValidPnfResource_With_Software_Version_ExpectedOutput() {
    /**
     * service UUID/invariantUUID from global metadata in service-PnfServiceTestCds-template.yml.
     */
    // "77cf276e-905c-43f6-8d54-dda474be2f2e";
    String serviceUuid = "8e7b2bd7-6901-4cc2-b3fb-3b6a1d5631e3";
    // "913e6776-4bc3-49b9-b399-b5bb4690f0c7";
    String serviceInvariantUuid = "9a5f99c8-0492-4691-b29a-7360d9c3aae3";
    initMockAaiServer(serviceUuid, serviceInvariantUuid);
    NotificationDataImpl notificationData = new NotificationDataImpl();
    notificationData.setServiceUUID(serviceUuid);
    notificationData.setDistributionID(distributionId);
    notificationData.setServiceInvariantUUID(serviceInvariantUuid);
    notificationData.setServiceVersion("1.0");
    ResourceInfoImpl resourceInfo = constructPnfResourceInfoWithSWV1();
    List<ResourceInfoImpl> resourceInfoList = new ArrayList<>();
    resourceInfoList.add(resourceInfo);
    notificationData.setResources(resourceInfoList);
    ArtifactInfoImpl artifactInfo = constructPnfServiceArtifactWithSWV();
    List<ArtifactInfoImpl> artifactInfoList = new ArrayList<>();
    artifactInfoList.add(artifactInfo);
    notificationData.setServiceArtifacts(artifactInfoList);
    try {
        asdcController.treatNotification(notificationData);
        logger.info("Checking the database for PNF ingestion");
        /**
         * Check the tosca csar entity, it should be the same as provided from NotficationData.
         */
        ToscaCsar toscaCsar = toscaCsarRepository.findById(artifactUuid).orElseThrow(() -> new EntityNotFoundException("Tosca csar: " + artifactUuid + " not found"));
        assertEquals("tosca csar UUID", artifactUuid, toscaCsar.getArtifactUUID());
        assertEquals("tosca csar name", "service-Ericservice-csar.csar", toscaCsar.getName());
        assertEquals("tosca csar version", "1.0", toscaCsar.getVersion());
        assertNull("tosca csar descrption", toscaCsar.getDescription());
        assertEquals("tosca csar checksum", "MANUAL_RECORD", toscaCsar.getArtifactChecksum());
        assertEquals("toscar csar URL", "/download/service-Ericservice-csar.csar", toscaCsar.getUrl());
        /**
         * Check the service entity, it should be the same as global metadata information in
         * service-Testservice140-template.yml inside csar.
         */
        Service service = serviceRepository.findById(serviceUuid).orElseThrow(() -> new EntityNotFoundException("Service: " + serviceUuid + " not found"));
        /**
         * Check PNF resource, it should be the same as metadata in the topology template in
         * service-PnfServiceTestCds-template.yml OR global metadata in the resource-PnfServiceTestCds-template.yml
         */
        String pnfResourceKey = "7a90f80b-a6f6-4597-8c48-80bda26b4823";
        /**
         * Check PNF resource customization, it should be the same as metadata in the topology template in
         * service-PnfServiceTestCds-template.yml OR global metadata in the resource-PnfServiceTestCds-template.yml
         */
        // "9f01263a-eaf7-4d98-a37b-3785f751903e";
        String pnfCustomizationKey = "05660370-41ed-4720-a42b-d6def010c326";
        PnfResourceCustomization pnfCustomization = pnfCustomizationRepository.findById(pnfCustomizationKey).orElseThrow(() -> new EntityNotFoundException("PNF resource customization: " + pnfCustomizationKey + " not found"));
        assertEquals("model customizationUUID", pnfCustomizationKey, pnfCustomization.getModelCustomizationUUID());
        assertEquals("model instance name", "demo-PNF 0", pnfCustomization.getModelInstanceName());
        assertEquals("NF type", "", pnfCustomization.getNfType());
        assertEquals("NF Role", "", pnfCustomization.getNfRole());
        assertEquals("NF function", "", pnfCustomization.getNfFunction());
        assertEquals("NF naming code", "", pnfCustomization.getNfNamingCode());
        assertEquals("PNF resource model UUID", pnfResourceKey, pnfCustomization.getPnfResources().getModelUUID());
        assertEquals("Multi stage design", "", pnfCustomization.getMultiStageDesign());
        assertNull("resource input", pnfCustomization.getResourceInput());
        assertEquals("cds blueprint name(sdnc_model_name property)", "pm_control", pnfCustomization.getBlueprintName());
        assertEquals("cds blueprint version(sdnc_model_version property)", "1.0.0", pnfCustomization.getBlueprintVersion());
        assertEquals("default software version", "foo-123", pnfCustomization.getDefaultSoftwareVersion());
        assertTrue("skip post instantiation configuration", pnfCustomization.getSkipPostInstConf());
        assertEquals("controller actor", "SO-REF-DATA", pnfCustomization.getControllerActor());
        /**
         * Check the pnf resource customization with service mapping
         */
        List<PnfResourceCustomization> pnfCustList = service.getPnfCustomizations();
        assertEquals("PNF resource customization entity", 1, pnfCustList.size());
        assertEquals(pnfCustomizationKey, pnfCustList.get(0).getModelCustomizationUUID());
        /**
         * Check the watchdog for component distribution status
         */
        List<WatchdogComponentDistributionStatus> distributionList = watchdogCDStatusRepository.findByDistributionId(this.distributionId);
        assertNotNull(distributionList);
        assertEquals(1, distributionList.size());
        WatchdogComponentDistributionStatus distributionStatus = distributionList.get(0);
        assertEquals("COMPONENT_DONE_OK", distributionStatus.getComponentDistributionStatus());
        assertEquals("SO", distributionStatus.getComponentName());
    } catch (Exception e) {
        logger.info(e.getMessage(), e);
        fail(e.getMessage());
    }
}
Also used : PnfResourceCustomization(org.onap.so.db.catalog.beans.PnfResourceCustomization) ArtifactInfoImpl(org.onap.so.asdc.client.test.emulators.ArtifactInfoImpl) WatchdogComponentDistributionStatus(org.onap.so.db.request.beans.WatchdogComponentDistributionStatus) ResourceInfoImpl(org.onap.so.asdc.client.test.emulators.ResourceInfoImpl) ArrayList(java.util.ArrayList) Service(org.onap.so.db.catalog.beans.Service) EntityNotFoundException(javax.persistence.EntityNotFoundException) EntityNotFoundException(javax.persistence.EntityNotFoundException) ASDCControllerException(org.onap.so.asdc.client.exceptions.ASDCControllerException) NotificationDataImpl(org.onap.so.asdc.client.test.emulators.NotificationDataImpl) ToscaCsar(org.onap.so.db.catalog.beans.ToscaCsar) BaseTest(org.onap.so.asdc.BaseTest) Test(org.junit.Test)

Example 9 with ToscaCsar

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

the class ASDCControllerITTest method treatNotification_ValidPnfResource_With_Default_Software_Version_ExpectedOutput.

/**
 * Test with service-Ericservice-csar.csar to test default_software_version field.
 */
@Test
public void treatNotification_ValidPnfResource_With_Default_Software_Version_ExpectedOutput() {
    /**
     * service UUID/invariantUUID from global metadata in service-PnfServiceTestCds-template.yml.
     */
    // "77cf276e-905c-43f6-8d54-dda474be2f2e";
    String serviceUuid = "8e7b2bd7-6901-4cc2-b3fb-3b6a1d5631e3";
    // "913e6776-4bc3-49b9-b399-b5bb4690f0c7";
    String serviceInvariantUuid = "9a5f99c8-0492-4691-b29a-7360d9c3aae3";
    initMockAaiServer(serviceUuid, serviceInvariantUuid);
    NotificationDataImpl notificationData = new NotificationDataImpl();
    notificationData.setServiceUUID(serviceUuid);
    notificationData.setDistributionID(distributionId);
    notificationData.setServiceInvariantUUID(serviceInvariantUuid);
    notificationData.setServiceVersion("1.0");
    ResourceInfoImpl resourceInfo = constructPnfResourceInfoWithSWV();
    List<ResourceInfoImpl> resourceInfoList = new ArrayList<>();
    resourceInfoList.add(resourceInfo);
    notificationData.setResources(resourceInfoList);
    ArtifactInfoImpl artifactInfo = constructPnfServiceArtifactWithSWV();
    List<ArtifactInfoImpl> artifactInfoList = new ArrayList<>();
    artifactInfoList.add(artifactInfo);
    notificationData.setServiceArtifacts(artifactInfoList);
    try {
        asdcController.treatNotification(notificationData);
        logger.info("Checking the database for PNF ingestion");
        /**
         * Check the tosca csar entity, it should be the same as provided from NotficationData.
         */
        ToscaCsar toscaCsar = toscaCsarRepository.findById(artifactUuid).orElseThrow(() -> new EntityNotFoundException("Tosca csar: " + artifactUuid + " not found"));
        assertEquals("tosca csar UUID", artifactUuid, toscaCsar.getArtifactUUID());
        assertEquals("tosca csar name", "service-Ericservice-csar.csar", toscaCsar.getName());
        assertEquals("tosca csar version", "1.0", toscaCsar.getVersion());
        assertNull("tosca csar descrption", toscaCsar.getDescription());
        assertEquals("tosca csar checksum", "MANUAL_RECORD", toscaCsar.getArtifactChecksum());
        assertEquals("toscar csar URL", "/download/service-Ericservice-csar.csar", toscaCsar.getUrl());
        /**
         * Check the service entity, it should be the same as global metadata information in
         * service-Testservice140-template.yml inside csar.
         */
        Service service = serviceRepository.findById(serviceUuid).orElseThrow(() -> new EntityNotFoundException("Service: " + serviceUuid + " not found"));
        /**
         * Check PNF resource, it should be the same as metadata in the topology template in
         * service-PnfServiceTestCds-template.yml OR global metadata in the resource-PnfServiceTestCds-template.yml
         */
        String pnfResourceKey = "7a90f80b-a6f6-4597-8c48-80bda26b4823";
        /**
         * Check PNF resource customization, it should be the same as metadata in the topology template in
         * service-PnfServiceTestCds-template.yml OR global metadata in the resource-PnfServiceTestCds-template.yml
         */
        // "9f01263a-eaf7-4d98-a37b-3785f751903e";
        String pnfCustomizationKey = "c850a53b-b63e-4043-ab10-53aabda78d37";
        PnfResourceCustomization pnfCustomization = pnfCustomizationRepository.findById(pnfCustomizationKey).orElseThrow(() -> new EntityNotFoundException("PNF resource customization: " + pnfCustomizationKey + " not found"));
        assertEquals("model customizationUUID", pnfCustomizationKey, pnfCustomization.getModelCustomizationUUID());
        assertEquals("model instance name", "demo-PNF 1", pnfCustomization.getModelInstanceName());
        assertEquals("NF type", "", pnfCustomization.getNfType());
        assertEquals("NF Role", "", pnfCustomization.getNfRole());
        assertEquals("NF function", "", pnfCustomization.getNfFunction());
        assertEquals("NF naming code", "", pnfCustomization.getNfNamingCode());
        assertEquals("PNF resource model UUID", pnfResourceKey, pnfCustomization.getPnfResources().getModelUUID());
        assertEquals("Multi stage design", "", pnfCustomization.getMultiStageDesign());
        assertNull("resource input", pnfCustomization.getResourceInput());
        assertEquals("cds blueprint name(sdnc_model_name property)", "pm_control", pnfCustomization.getBlueprintName());
        assertEquals("cds blueprint version(sdnc_model_version property)", "1.0.0", pnfCustomization.getBlueprintVersion());
        assertEquals("default software version", "4.0.0", pnfCustomization.getDefaultSoftwareVersion());
        assertTrue("skip post instantiation configuration", pnfCustomization.getSkipPostInstConf());
        assertEquals("controller actor", "SO-REF-DATA", pnfCustomization.getControllerActor());
        /**
         * Check the pnf resource customization with service mapping
         */
        List<PnfResourceCustomization> pnfCustList = service.getPnfCustomizations();
        assertEquals("PNF resource customization entity", 1, pnfCustList.size());
        assertEquals(pnfCustomizationKey, pnfCustList.get(0).getModelCustomizationUUID());
        /**
         * Check the watchdog for component distribution status
         */
        List<WatchdogComponentDistributionStatus> distributionList = watchdogCDStatusRepository.findByDistributionId(this.distributionId);
        assertNotNull(distributionList);
        assertEquals(1, distributionList.size());
        WatchdogComponentDistributionStatus distributionStatus = distributionList.get(0);
        assertEquals("COMPONENT_DONE_OK", distributionStatus.getComponentDistributionStatus());
        assertEquals("SO", distributionStatus.getComponentName());
    } catch (Exception e) {
        logger.info(e.getMessage(), e);
        fail(e.getMessage());
    }
}
Also used : PnfResourceCustomization(org.onap.so.db.catalog.beans.PnfResourceCustomization) ArtifactInfoImpl(org.onap.so.asdc.client.test.emulators.ArtifactInfoImpl) WatchdogComponentDistributionStatus(org.onap.so.db.request.beans.WatchdogComponentDistributionStatus) ResourceInfoImpl(org.onap.so.asdc.client.test.emulators.ResourceInfoImpl) ArrayList(java.util.ArrayList) Service(org.onap.so.db.catalog.beans.Service) EntityNotFoundException(javax.persistence.EntityNotFoundException) EntityNotFoundException(javax.persistence.EntityNotFoundException) ASDCControllerException(org.onap.so.asdc.client.exceptions.ASDCControllerException) NotificationDataImpl(org.onap.so.asdc.client.test.emulators.NotificationDataImpl) ToscaCsar(org.onap.so.db.catalog.beans.ToscaCsar) BaseTest(org.onap.so.asdc.BaseTest) Test(org.junit.Test)

Example 10 with ToscaCsar

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

the class ToscaResourceStructureTest method toscaResourceStructureBeanTest.

@Test
public void toscaResourceStructureBeanTest() {
    artifactInfo = mock(ArtifactInfoImpl.class);
    sdcCsarHelper = mock(SdcCsarHelperImpl.class);
    toscaResourceStructure = new ToscaResourceStructure();
    toscaResourceStructure.setHeatTemplateUUID("heatTemplateUUID");
    toscaResourceStructure.setAllottedList(new ArrayList<NodeTemplate>());
    toscaResourceStructure.setSdcCsarHelper(sdcCsarHelper);
    toscaResourceStructure.setServiceMetadata(new Metadata(new HashMap<>()));
    toscaResourceStructure.setCatalogService(new Service());
    toscaResourceStructure.setNetworkTypes(new ArrayList<>());
    toscaResourceStructure.setVfTypes(new ArrayList<>());
    toscaResourceStructure.setCatalogResourceCustomization(new AllottedResourceCustomization());
    toscaResourceStructure.setCatalogNetworkResourceCustomization(new NetworkResourceCustomization());
    toscaResourceStructure.setCatalogNetworkResource(new NetworkResource());
    toscaResourceStructure.setCatalogVfModule(new VfModule());
    toscaResourceStructure.setVnfResourceCustomization(new VnfResourceCustomization());
    toscaResourceStructure.setVfModuleCustomization(new VfModuleCustomization());
    toscaResourceStructure.setAllottedResource(new AllottedResource());
    toscaResourceStructure.setAllottedResourceCustomization(new AllottedResourceCustomization());
    toscaResourceStructure.setCatalogTempNetworkHeatTemplateLookup(new TempNetworkHeatTemplateLookup());
    toscaResourceStructure.setHeatFilesUUID("heatFilesUUID");
    toscaResourceStructure.setToscaArtifact(artifactInfo);
    toscaResourceStructure.setToscaCsar(new ToscaCsar());
    toscaResourceStructure.setVolHeatTemplateUUID("volHeatTemplateUUID");
    toscaResourceStructure.setEnvHeatTemplateUUID("envHeatTemplateUUID");
    toscaResourceStructure.setServiceVersion("serviceVersion");
    toscaResourceStructure.setWorkloadPerformance("workloadPerformance");
    toscaResourceStructure.setVfModule(new VfModule());
    toscaResourceStructure.setTempNetworkHeatTemplateLookup(new TempNetworkHeatTemplateLookup());
    toscaResourceStructure.setSuccessfulDeployment();
    assertEquals("heatTemplateUUID", toscaResourceStructure.getHeatTemplateUUID());
    assertThat(toscaResourceStructure.getAllottedList(), sameBeanAs(new ArrayList<NodeTemplate>()));
    assertEquals(sdcCsarHelper, toscaResourceStructure.getSdcCsarHelper());
    assertThat(toscaResourceStructure.getServiceMetadata(), sameBeanAs(new Metadata(new HashMap<>())));
    assertThat(toscaResourceStructure.getCatalogService(), sameBeanAs(new Service()));
    assertThat(toscaResourceStructure.getNetworkTypes(), sameBeanAs(new ArrayList<>()));
    assertThat(toscaResourceStructure.getVfTypes(), sameBeanAs(new ArrayList<>()));
    assertThat(toscaResourceStructure.getCatalogResourceCustomization(), sameBeanAs(new AllottedResourceCustomization()));
    assertThat(toscaResourceStructure.getCatalogNetworkResourceCustomization(), sameBeanAs(new NetworkResourceCustomization()));
    assertThat(toscaResourceStructure.getCatalogNetworkResource(), sameBeanAs(new NetworkResource()));
    assertThat(toscaResourceStructure.getCatalogVfModule(), sameBeanAs(new VfModule()));
    assertThat(toscaResourceStructure.getVnfResourceCustomization(), sameBeanAs(new VnfResourceCustomization()));
    assertThat(toscaResourceStructure.getVfModuleCustomization(), sameBeanAs(new VfModuleCustomization()));
    assertThat(toscaResourceStructure.getAllottedResource(), sameBeanAs(new AllottedResource()));
    assertThat(toscaResourceStructure.getAllottedResourceCustomization(), sameBeanAs(new AllottedResourceCustomization()));
    assertThat(toscaResourceStructure.getCatalogTempNetworkHeatTemplateLookup(), sameBeanAs(new TempNetworkHeatTemplateLookup()));
    assertEquals("heatFilesUUID", toscaResourceStructure.getHeatFilesUUID());
    assertEquals(artifactInfo, toscaResourceStructure.getToscaArtifact());
    assertThat(toscaResourceStructure.getToscaCsar(), sameBeanAs(new ToscaCsar()));
    assertEquals("volHeatTemplateUUID", toscaResourceStructure.getVolHeatTemplateUUID());
    assertEquals("envHeatTemplateUUID", toscaResourceStructure.getEnvHeatTemplateUUID());
    assertEquals("serviceVersion", toscaResourceStructure.getServiceVersion());
    assertEquals("workloadPerformance", toscaResourceStructure.getWorkloadPerformance());
    assertThat(toscaResourceStructure.getVfModule(), sameBeanAs(new VfModule()));
    assertThat(toscaResourceStructure.getTempNetworkHeatTemplateLookup(), sameBeanAs(new TempNetworkHeatTemplateLookup()));
    assertEquals(true, toscaResourceStructure.isDeployedSuccessfully());
}
Also used : ArtifactInfoImpl(org.onap.so.asdc.client.test.emulators.ArtifactInfoImpl) HashMap(java.util.HashMap) Metadata(org.onap.sdc.toscaparser.api.elements.Metadata) ArrayList(java.util.ArrayList) Service(org.onap.so.db.catalog.beans.Service) VfModule(org.onap.so.db.catalog.beans.VfModule) AllottedResource(org.onap.so.db.catalog.beans.AllottedResource) AllottedResourceCustomization(org.onap.so.db.catalog.beans.AllottedResourceCustomization) NetworkResource(org.onap.so.db.catalog.beans.NetworkResource) NodeTemplate(org.onap.sdc.toscaparser.api.NodeTemplate) TempNetworkHeatTemplateLookup(org.onap.so.db.catalog.beans.TempNetworkHeatTemplateLookup) SdcCsarHelperImpl(org.onap.sdc.tosca.parser.impl.SdcCsarHelperImpl) NetworkResourceCustomization(org.onap.so.db.catalog.beans.NetworkResourceCustomization) VfModuleCustomization(org.onap.so.db.catalog.beans.VfModuleCustomization) ToscaCsar(org.onap.so.db.catalog.beans.ToscaCsar) VnfResourceCustomization(org.onap.so.db.catalog.beans.VnfResourceCustomization) Test(org.junit.Test)

Aggregations

ToscaCsar (org.onap.so.db.catalog.beans.ToscaCsar)10 Service (org.onap.so.db.catalog.beans.Service)7 Test (org.junit.Test)6 ArrayList (java.util.ArrayList)5 BaseTest (org.onap.so.asdc.BaseTest)5 NotificationDataImpl (org.onap.so.asdc.client.test.emulators.NotificationDataImpl)5 EntityNotFoundException (javax.persistence.EntityNotFoundException)4 ASDCControllerException (org.onap.so.asdc.client.exceptions.ASDCControllerException)4 ArtifactInfoImpl (org.onap.so.asdc.client.test.emulators.ArtifactInfoImpl)4 ResourceInfoImpl (org.onap.so.asdc.client.test.emulators.ResourceInfoImpl)3 WatchdogComponentDistributionStatus (org.onap.so.db.request.beans.WatchdogComponentDistributionStatus)3 PnfResourceCustomization (org.onap.so.db.catalog.beans.PnfResourceCustomization)2 VnfResourceCustomization (org.onap.so.db.catalog.beans.VnfResourceCustomization)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 WireMock.aResponse (com.github.tomakehurst.wiremock.client.WireMock.aResponse)1 WireMock.post (com.github.tomakehurst.wiremock.client.WireMock.post)1 WireMock.urlPathEqualTo (com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo)1 WireMock.urlPathMatching (com.github.tomakehurst.wiremock.client.WireMock.urlPathMatching)1 MatcherAssert.assertThat (com.shazam.shazamcrest.MatcherAssert.assertThat)1 Matchers.sameBeanAs (com.shazam.shazamcrest.matcher.Matchers.sameBeanAs)1