Search in sources :

Example 6 with PnfResource

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

the class CatalogDbClientTest method getPnfResourceCustomizationByModelCustomizationUUID_validUuid_expectedOutput.

@Test
public void getPnfResourceCustomizationByModelCustomizationUUID_validUuid_expectedOutput() {
    PnfResourceCustomization pnfResourceCustomization = client.getPnfResourceCustomizationByModelCustomizationUUID("68dc9a92-214c-11e7-93ae-92361f002680");
    assertEquals("modelInstanceName", "PNF routing", pnfResourceCustomization.getModelInstanceName());
    assertEquals("blueprintName", "test_configuration_restconf", pnfResourceCustomization.getBlueprintName());
    assertEquals("blueprintVersion", "1.0.0", pnfResourceCustomization.getBlueprintVersion());
    assertTrue("skip post instantiation configuration", pnfResourceCustomization.getSkipPostInstConf());
    PnfResource pnfResource = pnfResourceCustomization.getPnfResources();
    assertNotNull(pnfResource);
    assertEquals("PNFResource modelUUID", "ff2ae348-214a-11e7-93ae-92361f002680", pnfResource.getModelUUID());
    assertEquals("PNFResource modelInvariantUUID", "2fff5b20-214b-11e7-93ae-92361f002680", pnfResource.getModelInvariantUUID());
    assertEquals("PNFResource modelVersion", "1.0", pnfResource.getModelVersion());
    assertEquals("PNFResource orchestration mode", "", pnfResource.getOrchestrationMode());
}
Also used : PnfResourceCustomization(org.onap.so.db.catalog.beans.PnfResourceCustomization) PnfResource(org.onap.so.db.catalog.beans.PnfResource) Test(org.junit.Test) CatalogDbAdapterBaseTest(org.onap.so.adapters.catalogdb.CatalogDbAdapterBaseTest)

Example 7 with PnfResource

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

the class ToscaResourceInstaller method createPnfResource.

/**
 * Construct the {@link PnfResource} from {@link IEntityDetails} object.
 */
private PnfResource createPnfResource(IEntityDetails entity) {
    PnfResource pnfResource = new PnfResource();
    Metadata metadata = entity.getMetadata();
    pnfResource.setModelInvariantUUID(testNull(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID)));
    pnfResource.setModelName(testNull(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_NAME)));
    pnfResource.setModelUUID(testNull(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_UUID)));
    pnfResource.setModelVersion(testNull(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_VERSION)));
    pnfResource.setDescription(testNull(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)));
    pnfResource.setCategory(testNull(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_CATEGORY)));
    pnfResource.setSubCategory(testNull(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_SUBCATEGORY)));
    pnfResource.setToscaNodeType(entity.getToscaType());
    return pnfResource;
}
Also used : PnfResource(org.onap.so.db.catalog.beans.PnfResource) Metadata(org.onap.sdc.toscaparser.api.elements.Metadata)

Example 8 with PnfResource

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

the class PnfCustomizationRepositoryTest method checkPnfResourceCustomization.

private void checkPnfResourceCustomization(PnfResourceCustomization pnfResourceCustomization) {
    assertEquals("modelInstanceName", "PNF routing", pnfResourceCustomization.getModelInstanceName());
    assertEquals("blueprintName", "test_configuration_restconf", pnfResourceCustomization.getBlueprintName());
    assertEquals("blueprintVersion", "1.0.0", pnfResourceCustomization.getBlueprintVersion());
    assertTrue("skip post instantiation configuration", pnfResourceCustomization.getSkipPostInstConf());
    PnfResource pnfResource = pnfResourceCustomization.getPnfResources();
    assertNotNull(pnfResource);
    assertEquals("PNFResource modelUUID", "ff2ae348-214a-11e7-93ae-92361f002680", pnfResource.getModelUUID());
    assertEquals("PNFResource modelInvariantUUID", "2fff5b20-214b-11e7-93ae-92361f002680", pnfResource.getModelInvariantUUID());
    assertEquals("PNFResource modelVersion", "1.0", pnfResource.getModelVersion());
    assertEquals("PNFResource orchestration mode", "", pnfResource.getOrchestrationMode());
}
Also used : PnfResource(org.onap.so.db.catalog.beans.PnfResource)

Example 9 with PnfResource

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

the class PnfResourceRepositoryTest method findResourceById_validUuid_expectedOutput.

@Test
public void findResourceById_validUuid_expectedOutput() throws Exception {
    PnfResource pnfResource = pnfResourceRepository.findById("ff2ae348-214a-11e7-93ae-92361f002680").orElseThrow(() -> new NoEntityFoundException("Cannot Find Entity"));
    checkPnfResource(pnfResource);
}
Also used : PnfResource(org.onap.so.db.catalog.beans.PnfResource) NoEntityFoundException(org.onap.so.db.catalog.exceptions.NoEntityFoundException) BaseTest(org.onap.so.db.catalog.BaseTest) Test(org.junit.Test)

Aggregations

PnfResource (org.onap.so.db.catalog.beans.PnfResource)9 Test (org.junit.Test)6 CatalogDbAdapterBaseTest (org.onap.so.adapters.catalogdb.CatalogDbAdapterBaseTest)4 PnfResourceCustomization (org.onap.so.db.catalog.beans.PnfResourceCustomization)4 Metadata (org.onap.sdc.toscaparser.api.elements.Metadata)2 ArrayList (java.util.ArrayList)1 EntityNotFoundException (javax.persistence.EntityNotFoundException)1 IEntityDetails (org.onap.sdc.tosca.parser.api.IEntityDetails)1 ISdcCsarHelper (org.onap.sdc.tosca.parser.api.ISdcCsarHelper)1 EntityQuery (org.onap.sdc.tosca.parser.elements.queries.EntityQuery)1 TopologyTemplateQuery (org.onap.sdc.tosca.parser.elements.queries.TopologyTemplateQuery)1 BaseTest (org.onap.so.asdc.BaseTest)1 ASDCControllerException (org.onap.so.asdc.client.exceptions.ASDCControllerException)1 ArtifactInfoImpl (org.onap.so.asdc.client.test.emulators.ArtifactInfoImpl)1 NotificationDataImpl (org.onap.so.asdc.client.test.emulators.NotificationDataImpl)1 ResourceInfoImpl (org.onap.so.asdc.client.test.emulators.ResourceInfoImpl)1 BaseTest (org.onap.so.db.catalog.BaseTest)1 Service (org.onap.so.db.catalog.beans.Service)1 ToscaCsar (org.onap.so.db.catalog.beans.ToscaCsar)1 NoEntityFoundException (org.onap.so.db.catalog.exceptions.NoEntityFoundException)1