summaryrefslogtreecommitdiffstats
path: root/src/test
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
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')
-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
-rw-r--r--src/test/resources/controller-config_dmaap_ip.json1
-rw-r--r--src/test/resources/controller-config_singleline_ip.json1
-rw-r--r--src/test/resources/test_collector_ip_op.properties1
6 files changed, 12 insertions, 27 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
diff --git a/src/test/resources/controller-config_dmaap_ip.json b/src/test/resources/controller-config_dmaap_ip.json
index 1cc6576b..f148db55 100644
--- a/src/test/resources/controller-config_dmaap_ip.json
+++ b/src/test/resources/controller-config_dmaap_ip.json
@@ -1,6 +1,5 @@
{
"auth.method": "noAuth",
- "collector.inputQueue.maxPending": 8096,
"collector.schema.checkflag": 1,
"collector.keystore.file.location": "/opt/app/dcae-certificate/keystore.jks",
"tomcat.maxthreads": "200",
diff --git a/src/test/resources/controller-config_singleline_ip.json b/src/test/resources/controller-config_singleline_ip.json
index c3a8d067..a3974e0f 100644
--- a/src/test/resources/controller-config_singleline_ip.json
+++ b/src/test/resources/controller-config_singleline_ip.json
@@ -5,7 +5,6 @@
"tomcat.maxthreads": "200",
"collector.dmaap.streamid": "fault=ves-fault|syslog=ves-syslog|heartbeat=ves-heartbeat|measurementsForVfScaling=ves-measurement|mobileFlow=ves-mobileflow|other=ves-other|stateChange=ves-statechange|thresholdCrossingAlert=ves-thresholdCrossingAlert|voiceQuality=ves-voicequality|sipSignaling=ves-sipsignaling",
"streams_subscribes": {},
- "collector.inputQueue.maxPending": "8096",
"streams_publishes": {
"ves-mobileflow": {
"type": "message_router",
diff --git a/src/test/resources/test_collector_ip_op.properties b/src/test/resources/test_collector_ip_op.properties
index 9450067a..0916211f 100644
--- a/src/test/resources/test_collector_ip_op.properties
+++ b/src/test/resources/test_collector_ip_op.properties
@@ -9,7 +9,6 @@ collector.dmaapfile=./etc/DmaapConfig.json
auth.method=noAuth
header.authlist=sample1,$2a$10$pgjaxDzSuc6XVFEeqvxQ5u90DKJnM/u7TJTcinAlFJVaavXMWf/Zi|userid1,$2a$10$61gNubgJJl9lh3nvQvY9X.x4e5ETWJJ7ao7ZhJEvmfJigov26Z6uq|userid2,$2a$10$G52y/3uhuhWAMy.bx9Se8uzWinmbJa.dlm1LW6bYPdPkkywLDPLiy
event.transform.flag=1
-collector.inputQueue.maxPending = 8096
streams_subscribes = {}
services_calls = {}
tomcat.maxthreads = 200