From cd0fa5da3dd92649adc837ca774459fea2fd08c4 Mon Sep 17 00:00:00 2001 From: "r.bogacki" Date: Wed, 10 Jul 2019 10:38:42 +0200 Subject: Vulnerability fixes in ServicePluginFactory Sonar vulnerability fixes in ServicePluginFactory. -Moved hardcoded IP addresses to the property file. -Added junit test. Issue-ID: SO-2106 Signed-off-by: Robert Bogacki Change-Id: Id33e17f7845c106212bbf4d4a8ca78641cea1396 --- .../workflow/service/ServicePluginFactoryTest.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'bpmn/so-bpmn-infrastructure-common/src/test/java/org') diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactoryTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactoryTest.java index 0b4050beec..1a75f125f6 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactoryTest.java +++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactoryTest.java @@ -20,6 +20,7 @@ package org.onap.so.bpmn.infrastructure.workflow.service; import static org.mockito.Mockito.doReturn; +import org.apache.commons.lang.reflect.FieldUtils; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; @@ -154,4 +155,21 @@ public class ServicePluginFactoryTest { String result = servicePluginFactory.doServiceHoming(null, invalidJsonWithOnlyNeededValues); Assert.assertEquals(result, invalidJsonWithOnlyNeededValues); } + + @Test + public void verifyExternalConfigurationLoading() throws IllegalAccessException { + + ServicePluginFactory servicePluginFactory = ServicePluginFactory.getInstance(); + + String oofDefaultEndpoint = (String) FieldUtils.readField(servicePluginFactory, "OOF_DEFAULT_ENDPOINT", true); + Assert.assertNotNull(oofDefaultEndpoint); + + String thirdSpDefaultEndpoint = + (String) FieldUtils.readField(servicePluginFactory, "THIRD_SP_DEFAULT_ENDPOINT", true); + Assert.assertNotNull(thirdSpDefaultEndpoint); + + String inventoryOssDefaultEndpoint = + (String) FieldUtils.readField(servicePluginFactory, "INVENTORY_OSS_DEFAULT_ENDPOINT", true); + Assert.assertNotNull(inventoryOssDefaultEndpoint); + } } -- cgit 1.2.3-korg