diff options
Diffstat (limited to 'src/test/java/org/onap/dcae/commonFunction')
-rw-r--r-- | src/test/java/org/onap/dcae/commonFunction/CommonStartupTest.java (renamed from src/test/java/org/onap/dcae/commonFunction/TestCommonStartup.java) | 16 | ||||
-rw-r--r-- | src/test/java/org/onap/dcae/commonFunction/EventProcessorTest.java | 6 |
2 files changed, 13 insertions, 9 deletions
diff --git a/src/test/java/org/onap/dcae/commonFunction/TestCommonStartup.java b/src/test/java/org/onap/dcae/commonFunction/CommonStartupTest.java index 12428024..5a171484 100644 --- a/src/test/java/org/onap/dcae/commonFunction/TestCommonStartup.java +++ b/src/test/java/org/onap/dcae/commonFunction/CommonStartupTest.java @@ -39,16 +39,20 @@ import java.io.FileReader; import java.io.IOException; import java.util.Map; import java.util.concurrent.LinkedBlockingQueue; + import org.json.JSONArray; import org.json.JSONObject; import org.junit.Test; import org.mockito.Mockito; +import org.onap.dcae.ApplicationSettings; +import org.onap.dcae.CLIUtils; import org.onap.dcae.commonFunction.CommonStartup.QueueFullException; import org.onap.dcae.commonFunction.event.publishing.EventPublisher; import org.onap.dcae.restapi.RestfulCollectorServlet; +import org.onap.dcae.vestest.TestingUtilities; -public class TestCommonStartup { +public class CommonStartupTest { @Test public void testParseCLIArguments() { @@ -67,7 +71,7 @@ public class TestCommonStartup { public void shouldPutValidVESEventOnProcessingQueueWithoutExceptions() throws IOException, QueueFullException { // given CommonStartup.fProcessingInputQueue = new LinkedBlockingQueue<>( - CommonStartup.KDEFAULT_MAXQUEUEDEVENTS); + CommonStartup.maxQueueEvent); JsonElement vesEvent = new JsonParser().parse(new FileReader("src/test/resources/VES_valid.txt")); JSONObject validVESEvent = new JSONObject(vesEvent.toString()); JSONArray jsonArrayMod = new JSONArray().put(validVESEvent); @@ -80,9 +84,9 @@ public class TestCommonStartup { @Test public void testParseStreamIdToStreamHashMapping() { // given - CommonStartup.streamID = "fault=sec_fault|syslog=sec_syslog|heartbeat=sec_heartbeat|measurementsForVfScaling=sec_measurement|mobileFlow=sec_mobileflow|other=sec_other|stateChange=sec_statechange|thresholdCrossingAlert=sec_thresholdCrossingAlert|voiceQuality=ves_voicequality|sipSignaling=ves_sipsignaling"; - EventProcessor eventProcessor = new EventProcessor(mock(EventPublisher.class)); + CommonStartup.streamID = TestingUtilities.convertDMaaPStreamsPropertyToMap("fault=sec_fault|syslog=sec_syslog|heartbeat=sec_heartbeat|measurementsForVfScaling=sec_measurement|mobileFlow=sec_mobileflow|other=sec_other|stateChange=sec_statechange|thresholdCrossingAlert=sec_thresholdCrossingAlert|voiceQuality=ves_voicequality|sipSignaling=ves_sipsignaling"); + EventProcessor eventProcessor = new EventProcessor(mock(EventPublisher.class)); // when Map<String, String[]> streamHashMapping = EventProcessor.streamidHash; @@ -94,7 +98,7 @@ public class TestCommonStartup { @Test public void testAuthListHandler() throws loadException, missingReqdSetting { // given - final nvReadableStack settings = new nvReadableStack(); + ApplicationSettings settings = new ApplicationSettings(new String[]{}, CLIUtils::processCmdLine); String user1 = "secureid"; String password1Hashed = "IWRjYWVSb2FkbTEyMyEt"; @@ -118,8 +122,6 @@ public class TestCommonStartup { // then assertEquals(authentic.getSecret(), password1UnHashed); } - - } diff --git a/src/test/java/org/onap/dcae/commonFunction/EventProcessorTest.java b/src/test/java/org/onap/dcae/commonFunction/EventProcessorTest.java index e211c12a..77ef005f 100644 --- a/src/test/java/org/onap/dcae/commonFunction/EventProcessorTest.java +++ b/src/test/java/org/onap/dcae/commonFunction/EventProcessorTest.java @@ -22,6 +22,8 @@ package org.onap.dcae.commonFunction; import com.google.gson.Gson; import java.util.concurrent.atomic.AtomicReference; + +import io.vavr.collection.HashMap; import org.json.JSONObject; import org.junit.Before; import org.junit.Test; @@ -29,6 +31,7 @@ import org.mockito.ArgumentCaptor; import java.util.List; import org.onap.dcae.commonFunction.event.publishing.EventPublisher; +import org.onap.dcae.vestest.TestingUtilities; import static org.assertj.core.api.Assertions.assertThat; import static org.junit.Assert.assertTrue; @@ -45,8 +48,7 @@ public class EventProcessorTest { @Before public void setUp() { - CommonStartup.streamID = "fault=sec_fault|syslog=sec_syslog|heartbeat=sec_heartbeat|measurementsForVfScaling=sec_measurement|mobileFlow=sec_mobileflow|other=sec_other|stateChange=sec_statechange|thresholdCrossingAlert=sec_thresholdCrossingAlert|voiceQuality=ves_voicequality|sipSignaling=ves_sipsignaling"; - CommonStartup.eventTransformFlag = 1; + CommonStartup.streamID = TestingUtilities.convertDMaaPStreamsPropertyToMap("fault=sec_fault|syslog=sec_syslog|heartbeat=sec_heartbeat|measurementsForVfScaling=sec_measurement|mobileFlow=sec_mobileflow|other=sec_other|stateChange=sec_statechange|thresholdCrossingAlert=sec_thresholdCrossingAlert|voiceQuality=ves_voicequality|sipSignaling=ves_sipsignaling"); } @Test |