diff options
author | 2019-09-16 18:43:54 +0000 | |
---|---|---|
committer | 2019-09-17 00:53:34 +0000 | |
commit | ab4d7bb7087197977c464031239c202b220e6ad4 (patch) | |
tree | 2d6651ae08cc5c0637f6c0f0e1b3da5b5aaaf2ee /ueb-listener/src/test | |
parent | 85962cd92a89187b61ca63a597c7f1f172cd98f2 (diff) |
Migrate SdncVFModel to getEntity
Changes made:
Replace deprecated APIs with getEntity for processing VF nodes in a model.
Replace nodeTemplate with entityDetails in SdncVFModel.
Corresponding changes in SdncVFModelTest.
Issue-ID: CCSDK-1425
Change-Id: I2175af818c80f4526e0a57a196d03c9fba73bdbf
Signed-off-by: lalena.aria <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/SdncVFModelTest.java | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/SdncVFModelTest.java b/ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/SdncVFModelTest.java index 3f795a354..f20c1edbf 100644 --- a/ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/SdncVFModelTest.java +++ b/ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/SdncVFModelTest.java @@ -4,11 +4,15 @@ 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.NodeTemplate; +import org.onap.sdc.tosca.parser.impl.SdcPropertyNames; +import org.onap.sdc.toscaparser.api.Property; import org.onap.sdc.toscaparser.api.elements.Metadata; import org.onap.ccsdk.sli.core.dblib.DBResourceManager; @@ -19,17 +23,22 @@ import org.onap.ccsdk.sli.core.dblib.DBResourceManager; @Before public void setUp() throws Exception { ISdcCsarHelper mockCsarHelper = mock(ISdcCsarHelper.class); - NodeTemplate nodeTemplate = mock(NodeTemplate.class); + IEntityDetails mockEntityDetails = mock(IEntityDetails.class); Metadata mockMetadata = mock(Metadata.class); - DBResourceManager mockDBResourceManager = mock(DBResourceManager.class); + DBResourceManager mockDBResourceManager = mock(DBResourceManager.class); SdncUebConfiguration mockSdncUebConfiguration = mock(SdncUebConfiguration.class); - when(nodeTemplate.getMetaData()).thenReturn(mockMetadata); - when(mockCsarHelper.getMetadataPropertyValue(mockMetadata, "customizationUUID")).thenReturn("aaaa-bbbb-cccc-dddd"); - when(mockCsarHelper.getNodeTemplatePropertyLeafValue(nodeTemplate, "nf_naming_code")).thenReturn("test-nf-naming-code"); + Property mockProperty = mock(Property.class); + Map<String, Property> mockProperties = new HashMap<String, Property>(); + when(mockEntityDetails.getMetadata()).thenReturn(mockMetadata); + when(mockEntityDetails.getProperties()).thenReturn(mockProperties); + when(mockCsarHelper.getMetadataPropertyValue(mockMetadata, "customizationUUID")).thenReturn("aaaa-bbbb-cccc-dddd"); + when(mockCsarHelper.getMetadataPropertyValue(mockMetadata, SdcPropertyNames.PROPERTY_NAME_TYPE)).thenReturn("VF"); + mockProperty.setValue("test-nf-naming-code"); + when(mockProperties.get("nf_naming_code")).thenReturn(mockProperty); try { - testSdncVFModel = new SdncVFModel(mockCsarHelper,nodeTemplate,mockDBResourceManager,mockSdncUebConfiguration); + testSdncVFModel = new SdncVFModel(mockCsarHelper,mockEntityDetails,mockDBResourceManager,mockSdncUebConfiguration); testSdncVFModel.setServiceUUID("bbbb-cccc-dddd-eeee"); testSdncVFModel.setServiceInvariantUUID("cccc-dddd-eeee-ffff"); testSdncVFModel.setVendor("Cisco"); |