summaryrefslogtreecommitdiffstats
path: root/src/test
diff options
context:
space:
mode:
authorVijay <vv770d@att.com>2017-09-25 20:32:23 +0000
committerVijay <vv770d@att.com>2017-09-25 20:32:48 +0000
commitf46b942de6b6ae6e9ede19a31c43c3e081fdc4e5 (patch)
treeebc638bdec91f7c78b3db36e573c28ef14d4c668 /src/test
parent86ac6e10c0caa05a9649d53b7179b3dcd8fbd802 (diff)
fix merge error n sonar items
https://jenkins.onap.org/job/dcaegen2-collectors-ves-master-merge-java/33/console Change-Id: I90693665dcf650028186a47ed69eaf15bc2f0d15 Issue-ID:DCAEGEN2-82 Signed-off-by: Vijay <vv770d@att.com>
Diffstat (limited to 'src/test')
-rw-r--r--src/test/java/org/onap/dcae/vestest/EventTransformTest.java37
-rw-r--r--src/test/java/org/onap/dcae/vestest/TestCommonStartup.java3
-rw-r--r--src/test/resources/event4xjson.txt7
3 files changed, 42 insertions, 5 deletions
diff --git a/src/test/java/org/onap/dcae/vestest/EventTransformTest.java b/src/test/java/org/onap/dcae/vestest/EventTransformTest.java
index 8a85117b..96e965cf 100644
--- a/src/test/java/org/onap/dcae/vestest/EventTransformTest.java
+++ b/src/test/java/org/onap/dcae/vestest/EventTransformTest.java
@@ -23,10 +23,8 @@ import static org.junit.Assert.assertEquals;
import java.io.FileReader;
import java.io.IOException;
-
import org.json.JSONObject;
import com.google.gson.JsonParser;
-
import com.google.gson.JsonObject;
import org.junit.Test;
@@ -63,7 +61,6 @@ public class EventTransformTest {
}
return jsonObject;
}
-
@Test
public void testAttrMap(){
@@ -95,7 +92,23 @@ public class EventTransformTest {
System.out.println("responseData==" + responseData);
assertEquals (alarmAdditionalInformation, responseData);
}
-
+ @Test
+ public void testJobjMaptoArray(){
+
+ final JSONObject jsonObject = getFileAsJsonObject();
+ //final String receiveDiscards = (((jsonObject.getJSONObject("event")).getJSONObject("faultFields")).get("errors")).get("receiveDiscards").toString();
+ System.out.println("event==" + jsonObject.toString());
+ //System.out.println("alarmAdditionalInformation==" + alarmAdditionalInformation);
+ final JSONObject jsonArgs = new JSONObject ( "{\"field\": \"event.faultFields.vNicPerformanceArray[]\",\"oldField\": \"event.faultFields.errors\",\"attrMap\":{\"receiveDiscards\":\"receivedDiscardedPacketsAccumulated\"}}" );
+ ConfigProcessors cpEvent = new ConfigProcessors(jsonObject);
+ final String receiveDiscards = cpEvent.getEventObjectVal("event.faultFields.errors.receiveDiscards").toString();
+ System.out.println("receiveDiscards==" + receiveDiscards);
+ cpEvent.map(jsonArgs);
+ final String responseData = cpEvent.getEventObjectVal("event.faultFields.vNicPerformanceArray[0].receivedDiscardedPacketsAccumulated").toString();
+ System.out.println("modified event==" + jsonObject.toString());
+ System.out.println("responseData==" + responseData);
+ assertEquals (receiveDiscards, responseData);
+ }
@Test
public void testAttrAdd(){
@@ -113,6 +126,22 @@ public class EventTransformTest {
}
@Test
+ public void testAttrUpdate(){
+
+ final JSONObject jsonObject = getFileAsJsonObject();
+ //final String functionRole = (jsonObject.getJSONObject("event")).getJSONObject("commonEventHeader").get("functionalRole").toString();
+ System.out.println("event==" + jsonObject.toString());
+ //System.out.println("functionRole==" + functionRole);
+ final JSONObject jsonArgs = new JSONObject ( "{\"field\": \"event.faultFields.version\",\"value\": \"2.0\",\"fieldType\": \"number\"}" );
+ ConfigProcessors cpEvent = new ConfigProcessors(jsonObject);
+ cpEvent.updateAttribute(jsonArgs);
+ final String responseData = cpEvent.getEventObjectVal("event.faultFields.version").toString();
+ System.out.println("modified event==" + jsonObject.toString());
+ System.out.println("responseData==" + responseData);
+ assertEquals ("2.0", responseData);
+ }
+
+ @Test
public void testAttrConcatenate(){
final JSONObject jsonObject = getFileAsJsonObject();
diff --git a/src/test/java/org/onap/dcae/vestest/TestCommonStartup.java b/src/test/java/org/onap/dcae/vestest/TestCommonStartup.java
index 06f70183..0cf90759 100644
--- a/src/test/java/org/onap/dcae/vestest/TestCommonStartup.java
+++ b/src/test/java/org/onap/dcae/vestest/TestCommonStartup.java
@@ -49,6 +49,7 @@ import com.att.nsa.drumlin.till.nv.impl.nvPropertiesFile;
import com.att.nsa.drumlin.till.nv.impl.nvReadableStack;
import com.att.nsa.drumlin.till.nv.impl.nvReadableTable;
+
public class TestCommonStartup {
String payload = null;
@@ -57,7 +58,7 @@ public class TestCommonStartup {
// process command line arguments
payload = new JsonParser().parse(new FileReader("src/test/resources/VES_valid.txt")).toString();
- CommonStartup.fProcessingInputQueue = new LinkedBlockingQueue<JSONObject> (CommonStartup.kDefault_MaxQueuedEvents);
+ CommonStartup.fProcessingInputQueue = new LinkedBlockingQueue<JSONObject> (CommonStartup.KDEFAULT_MAXQUEUEDEVENTS);
}
@After
diff --git a/src/test/resources/event4xjson.txt b/src/test/resources/event4xjson.txt
index 46c5fb51..318d5aed 100644
--- a/src/test/resources/event4xjson.txt
+++ b/src/test/resources/event4xjson.txt
@@ -1,4 +1,5 @@
{
+
"event": {
"commonEventHeader": {
"sourceId": "owb-rdm-003",
@@ -16,6 +17,12 @@
"sourceName": "owb-rdm-003"
},
"faultFields": {
+"errors": {
+ "receiveDiscards": 87665,
+ "transmitDiscards": 99999999,
+ "receiveErrors": 888888888,
+ "transmitErrors": 9000000001111
+},
"eventSeverity": "CRITICAL",
"alarmCondition": "lossOfSignal",
"faultFieldsVersion": 1.0,