diff options
author | 2019-03-13 18:18:14 +0000 | |
---|---|---|
committer | 2019-03-13 18:26:33 +0000 | |
commit | e8941385a6b0353236884fb183ef9e198b6560f5 (patch) | |
tree | af68e747ffd68e741096009d0eb80fbdcf03bca3 /ueb-listener/src/test | |
parent | d91b57fd11c55a93ff0f55bb35aa4071eb7c0b61 (diff) |
Use getEnitity API for ingestion of TOSCA PNF
Changes made:
Update SdncUebCallback.processToscaCsar to ingest PNF entities.
Add methods in SdncBaseModel.java to support processing of IEntityDetails.
Add SdncPNFModel.java to populate VF_MODEL with PNF data.
Add SdncPNFModelTest.java junit coverage.
Change-Id: I9a82a94e8198d629395a60779f74178e4f8f065e
Issue-ID: SDNC-675
Signed-off-by: Aria, Lalena (la505a) <lalena.aria@att.com>
Diffstat (limited to 'ueb-listener/src/test')
-rw-r--r-- | ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/SdncPNFModelTest.java | 102 |
1 files changed, 102 insertions, 0 deletions
diff --git a/ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/SdncPNFModelTest.java b/ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/SdncPNFModelTest.java new file mode 100644 index 000000000..d4c06b049 --- /dev/null +++ b/ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/SdncPNFModelTest.java @@ -0,0 +1,102 @@ +package org.onap.ccsdk.sli.northbound.uebclient; + +import static org.junit.Assert.*; +import static org.mockito.Mockito.*; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; + +import org.junit.Before; +import org.junit.Test; +import org.onap.sdc.tosca.parser.api.IEntityDetails; +import org.onap.sdc.tosca.parser.api.ISdcCsarHelper; +import org.onap.sdc.toscaparser.api.elements.Metadata; +import org.onap.sdc.toscaparser.api.Property; + +import org.onap.ccsdk.sli.core.dblib.DBResourceManager; + + public class SdncPNFModelTest { + + SdncPNFModel testSdncPNFModel = null; + + @Before + public void setUp() throws Exception { + ISdcCsarHelper mockCsarHelper = mock(ISdcCsarHelper.class); + IEntityDetails mockEntityDetails = mock(IEntityDetails.class); + Metadata mockMetadata = mock(Metadata.class); + Property mockProperty = mock(Property.class); + Map<String, Property> mockProperties = new HashMap<String, Property>(); + DBResourceManager mockDBResourceManager = mock(DBResourceManager.class); + SdncUebConfiguration mockSdncUebConfiguration = mock(SdncUebConfiguration.class); + + when(mockEntityDetails.getMetadata()).thenReturn(mockMetadata); + when(mockCsarHelper.getMetadataPropertyValue(mockMetadata, "customizationUUID")).thenReturn("aaaa-bbbb-cccc-dddd"); + mockProperty.setValue("test-nf-naming-code"); + when(mockProperties.get("nf_naming_code")).thenReturn(mockProperty); + + try { + testSdncPNFModel = new SdncPNFModel(mockCsarHelper,mockEntityDetails,mockDBResourceManager,mockSdncUebConfiguration); + testSdncPNFModel.setServiceUUID("bbbb-cccc-dddd-eeee"); + testSdncPNFModel.setServiceInvariantUUID("cccc-dddd-eeee-ffff"); + testSdncPNFModel.setVendor("Cisco"); + testSdncPNFModel.setVendorModelDescription("Cisco Equipment Model"); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + assertNotNull(testSdncPNFModel); + } + + @Test + public void testSetGetVendor() { + String newVendorModel = "new-vendor-model"; + testSdncPNFModel.setVendor(newVendorModel); + String result = testSdncPNFModel.getVendor(); + assertEquals(result, newVendorModel); + } + + @Test + public void testSetGetVendorModelDescription() { + String newVendorModelDescription = "new-vendor-model-description"; + testSdncPNFModel.setVendorModelDescription(newVendorModelDescription); + String result = testSdncPNFModel.getVendorModelDescription(); + assertEquals(result, newVendorModelDescription); + } + + @Test + public void testSetGetNfNamingCode() { + String newNfNamingCode = "new-nf-naming-code"; + testSdncPNFModel.setNfNamingCode(newNfNamingCode); + String result = testSdncPNFModel.getNfNamingCode(); + assertEquals(result, newNfNamingCode); + } + + @Test + public void testSetGetServiceUUID() { + String newServiceUuid = "cccc-dddd-eeee-ffff"; + testSdncPNFModel.setServiceUUID(newServiceUuid); + String result = testSdncPNFModel.getServiceUUID(); + assertEquals(newServiceUuid, result); + } + + @Test + public void testSetGetServiceInvariantUUID() { + String newServiceInvariantUuid = "dddd-eeee-ffff-eeee"; + testSdncPNFModel.setServiceInvariantUUID(newServiceInvariantUuid); + String result = testSdncPNFModel.getServiceInvariantUUID(); + assertEquals(result, newServiceInvariantUuid); + } + + @Test + public void testInsertData() { + try { + testSdncPNFModel.insertData(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + } |