aboutsummaryrefslogtreecommitdiffstats
path: root/src/test/java
diff options
context:
space:
mode:
authorZlatko Murgoski <zlatko.murgoski@nokia.com>2019-05-09 11:21:14 +0200
committerZlatko Murgoski <zlatko.murgoski@nokia.com>2019-06-14 11:56:34 +0200
commit3c3c7ad09c02852cd0b4db03ecc9cc5c429cab08 (patch)
tree80221b2d825d878b6b6e860a5bae55f9317f9ec3 /src/test/java
parent2bff7994a2bf880694a4c967b488ce55f3911af2 (diff)
VES Collector - Event Ordering
https://jira.onap.org/browse/DCAEGEN2-1483 Change-Id: I28b0e871ce570a3cf4c0d2e08d040b66eb6db3aa Issue-ID: DCAEGEN2-1483 Signed-off-by: Zlatko Murgoski <zlatko.murgoski@nokia.com>
Diffstat (limited to 'src/test/java')
-rw-r--r--src/test/java/org/onap/dcae/ApplicationSettingsTest.java19
-rw-r--r--src/test/java/org/onap/dcae/TLSTestBase.java5
-rw-r--r--src/test/java/org/onap/dcae/common/EventSenderTest.java12
3 files changed, 12 insertions, 24 deletions
diff --git a/src/test/java/org/onap/dcae/ApplicationSettingsTest.java b/src/test/java/org/onap/dcae/ApplicationSettingsTest.java
index 60287aef..6b0023f8 100644
--- a/src/test/java/org/onap/dcae/ApplicationSettingsTest.java
+++ b/src/test/java/org/onap/dcae/ApplicationSettingsTest.java
@@ -235,25 +235,6 @@ public class ApplicationSettingsTest {
}
@Test
- public void shouldReturnMaximumAllowedQueuedEvents() throws IOException {
- // when
- int maximumAllowedQueuedEvents = fromTemporaryConfiguration("collector.inputQueue.maxPending=10000")
- .maximumAllowedQueuedEvents();
-
- // then
- assertEquals(10000, maximumAllowedQueuedEvents);
- }
-
- @Test
- public void shouldReturnDefaultMaximumAllowedQueuedEvents() throws IOException {
- // when
- int maximumAllowedQueuedEvents = fromTemporaryConfiguration().maximumAllowedQueuedEvents();
-
- // then
- assertEquals(1024 * 4, maximumAllowedQueuedEvents);
- }
-
- @Test
public void shouldTellIfSchemaValidationIsEnabled() throws IOException {
// when
boolean jsonSchemaValidationEnabled = fromTemporaryConfiguration("collector.schema.checkflag=1")
diff --git a/src/test/java/org/onap/dcae/TLSTestBase.java b/src/test/java/org/onap/dcae/TLSTestBase.java
index 4dada129..df10ead9 100644
--- a/src/test/java/org/onap/dcae/TLSTestBase.java
+++ b/src/test/java/org/onap/dcae/TLSTestBase.java
@@ -24,6 +24,7 @@ package org.onap.dcae;
import org.json.JSONObject;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mockito;
+import org.onap.dcae.common.EventSender;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.mock.mockito.MockBean;
@@ -69,8 +70,8 @@ public class TLSTestBase {
protected abstract class TestClassBase {
@MockBean
- @Qualifier("inputQueue")
- protected LinkedBlockingQueue<JSONObject> queue;
+ @Qualifier("eventSender")
+ protected EventSender eventSender;
@LocalServerPort
private int port;
diff --git a/src/test/java/org/onap/dcae/common/EventSenderTest.java b/src/test/java/org/onap/dcae/common/EventSenderTest.java
index aba3c2a9..f49d3cd8 100644
--- a/src/test/java/org/onap/dcae/common/EventSenderTest.java
+++ b/src/test/java/org/onap/dcae/common/EventSenderTest.java
@@ -28,6 +28,7 @@ import static org.mockito.Mockito.when;
import io.vavr.collection.HashMap;
import io.vavr.collection.Map;
+import org.json.JSONArray;
import org.json.JSONObject;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -39,7 +40,6 @@ import org.onap.dcae.common.publishing.EventPublisher;
@RunWith(MockitoJUnitRunner.Silent.class)
public class EventSenderTest {
-
private String event = "{\"VESversion\":\"v7\",\"VESuniqueId\":\"fd69d432-5cd5-4c15-9d34-407c81c61c6a-0\",\"event\":{\"commonEventHeader\":{\"startEpochMicrosec\":1544016106000000,\"eventId\":\"fault33\",\"timeZoneOffset\":\"UTC+00.00\",\"priority\":\"Normal\",\"version\":\"4.0.1\",\"nfVendorName\":\"Ericsson\",\"reportingEntityName\":\"1\",\"sequence\":1,\"domain\":\"fault\",\"lastEpochMicrosec\":1544016106000000,\"eventName\":\"Fault_KeyFileFault\",\"vesEventListenerVersion\":\"7.0.1\",\"sourceName\":\"1\"},\"faultFields\":{\"eventSeverity\":\"CRITICAL\",\"alarmCondition\":\"KeyFileFault\",\"faultFieldsVersion\":\"4.0\",\"eventCategory\":\"PROCESSINGERRORALARM\",\"specificProblem\":\"License Key File Fault_1\",\"alarmAdditionalInformation\":{\"probableCause\":\"ConfigurationOrCustomizationError\",\"additionalText\":\"test_1\",\"source\":\"ManagedElement=1,SystemFunctions=1,Lm=1\"},\"eventSourceType\":\"Lm\",\"vfStatus\":\"Active\"}}}\n";
@Mock
@@ -54,7 +54,10 @@ public class EventSenderTest {
public void shouldntSendEventWhenStreamIdsIsEmpty() {
when(settings.dMaaPStreamsMapping()).thenReturn(HashMap.empty());
eventSender = new EventSender(eventPublisher, settings );
- eventSender.send(new JSONObject(event));
+ JSONObject jsonObject = new JSONObject(event);
+ JSONArray jsonArray = new JSONArray();
+ jsonArray.put(jsonObject);
+ eventSender.send(jsonArray);
verify(eventPublisher,never()).sendEvent(any(),any());
}
@@ -63,7 +66,10 @@ public class EventSenderTest {
Map<String, String[]> streams = HashMap.of("fault", new String[]{"ves-fault", "fault-ves"});
when(settings.dMaaPStreamsMapping()).thenReturn(streams);
eventSender = new EventSender(eventPublisher, settings );
- eventSender.send(new JSONObject(event));
+ JSONObject jsonObject = new JSONObject(event);
+ JSONArray jsonArray = new JSONArray();
+ jsonArray.put(jsonObject);
+ eventSender.send(jsonArray);
verify(eventPublisher, times(2)).sendEvent(any(),any());
}
} \ No newline at end of file