diff options
author | PATRACHARI <gp2421@att.com> | 2018-08-23 10:08:30 -0400 |
---|---|---|
committer | PATRACHARI <gp2421@att.com> | 2018-08-23 10:41:23 -0400 |
commit | 4ecf5ae18225d7792c337a42f1b57fbb599beda2 (patch) | |
tree | 0b520d6e96b81acccb8465991e821e6f324eb8f2 /src/test/java | |
parent | d161143571eec74f877e5be6b85e479c44aae881 (diff) |
VES7.x to 5.x transformation
Update transformation code based on Min's requirement. This includes all
Measurement transformations.
Issue-ID: DCAEGEN2-600
Change-Id: I082df846e159a4f158619e700a6dfed6de43cd95
Signed-off-by: PATRACHARI <gp2421@att.com>
Diffstat (limited to 'src/test/java')
-rw-r--r-- | src/test/java/org/onap/dcae/vestest/TestConfigProcessor.java | 65 |
1 files changed, 64 insertions, 1 deletions
diff --git a/src/test/java/org/onap/dcae/vestest/TestConfigProcessor.java b/src/test/java/org/onap/dcae/vestest/TestConfigProcessor.java index 09517ae3..310e8be3 100644 --- a/src/test/java/org/onap/dcae/vestest/TestConfigProcessor.java +++ b/src/test/java/org/onap/dcae/vestest/TestConfigProcessor.java @@ -20,6 +20,7 @@ package org.onap.dcae.vestest;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
import java.io.FileReader;
import java.io.IOException;
@@ -116,8 +117,70 @@ public class TestConfigProcessor { System.out.println("responseData==" + responseData);
assertEquals(receiveDiscards, responseData);
}
+
+ @Test
+ public void testMapRenameObject() {
+
+ 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.faultVFScalingFields\",\"oldField\": \"event.faultFields.errors\",\"mapType\":\"renameObject\"}");
+ ConfigProcessors cpEvent = new ConfigProcessors(jsonObject);
+ final String receiveDiscards = cpEvent.getEventObjectVal("event.faultFields.errors").toString();
+ System.out.println("receiveDiscards==" + receiveDiscards);
+ cpEvent.map(jsonArgs);
+ final String responseData = cpEvent
+ .getEventObjectVal("event.faultFields.faultVFScalingFields")
+ .toString();
+ System.out.println("modified event==" + jsonObject.toString());
+ System.out.println("responseData==" + responseData);
+ assertEquals(receiveDiscards, responseData);
+ }
+ @Test
+ public void testMapHashmapToNameValueArray() {
+
+ 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.errors\",\"mapType\":\"hashmapToNameValueArray\"}");
+ ConfigProcessors cpEvent = new ConfigProcessors(jsonObject);
+ final String receiveDiscards = cpEvent.getEventObjectVal("event.faultFields.errors").toString();
+ System.out.println("receiveDiscards==" + receiveDiscards);
+ cpEvent.map(jsonArgs);
+ final String responseData = cpEvent
+ .getEventObjectVal("event.faultFields.errors")
+ .toString();
+ System.out.println("modified event==" + jsonObject.toString());
+ System.out.println("responseData==" + responseData);
+ assertNotEquals(receiveDiscards, responseData);
+ }
@Test
+ public void testMapNameValueArrayToHashmap() {
+
+ 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.alarmAdditionalInformation\",\"mapType\":\"nameValueArrayToHashmap\"}");
+ ConfigProcessors cpEvent = new ConfigProcessors(jsonObject);
+ final String receiveDiscards = cpEvent.getEventObjectVal("event.faultFields.alarmAdditionalInformation").toString();
+ System.out.println("receiveDiscards==" + receiveDiscards);
+ cpEvent.map(jsonArgs);
+ final String responseData = cpEvent
+ .getEventObjectVal("event.faultFields.alarmAdditionalInformation")
+ .toString();
+ System.out.println("modified event==" + jsonObject.toString());
+ System.out.println("responseData==" + responseData);
+ assertNotEquals(receiveDiscards, responseData);
+ }
+
+ @Test
public void testAttrAdd() {
final JSONObject jsonObject = getFileAsJsonObject();
@@ -304,6 +367,6 @@ public class TestConfigProcessor { System.out.println("responseData==" + responseData);
assertEquals("true", responseData);
- }
+ }
}
|