diff options
9 files changed, 193 insertions, 84 deletions
diff --git a/engine-d-standalone/pom.xml b/engine-d-standalone/pom.xml index b8608a4..733a538 100644 --- a/engine-d-standalone/pom.xml +++ b/engine-d-standalone/pom.xml @@ -22,7 +22,7 @@ <parent> <groupId>org.onap.holmes.engine-management</groupId> <artifactId>holmes-engine-parent</artifactId> - <version>1.3.4-SNAPSHOT</version> + <version>1.3.5-SNAPSHOT</version> </parent> <artifactId>holmes-engine-d-standalone</artifactId> diff --git a/engine-d-standalone/src/main/assembly/dbscripts/postgresql/onap-holmes_engine-createobj.sql b/engine-d-standalone/src/main/assembly/dbscripts/postgresql/onap-holmes_engine-createobj.sql index 82eed4a..6831ce2 100644 --- a/engine-d-standalone/src/main/assembly/dbscripts/postgresql/onap-holmes_engine-createobj.sql +++ b/engine-d-standalone/src/main/assembly/dbscripts/postgresql/onap-holmes_engine-createobj.sql @@ -36,7 +36,8 @@ CREATE TABLE ALARM_INFO ( LASTEPOCHMICROSEC BIGINT NOT NULL, SOURCEID VARCHAR(150) NOT NULL, SOURCENAME VARCHAR(150) NOT NULL, - PRIMARY KEY (EVENTID) + SEQUENCE SMALLINT NOT NULL, + PRIMARY KEY (EVENTID, SEQUENCE, SOURCENAME) ); CREATE TABLE IF NOT EXISTS ENGINE_ENTITY ( diff --git a/engine-d/pom.xml b/engine-d/pom.xml index 1f439cf..d210155 100644 --- a/engine-d/pom.xml +++ b/engine-d/pom.xml @@ -22,7 +22,7 @@ <parent> <groupId>org.onap.holmes.engine-management</groupId> <artifactId>holmes-engine-parent</artifactId> - <version>1.3.4-SNAPSHOT</version> + <version>1.3.5-SNAPSHOT</version> </parent> <artifactId>holmes-engine-d</artifactId> diff --git a/engine-d/src/main/java/org/onap/holmes/dsa/dmaappolling/DMaaPResponseUtil.java b/engine-d/src/main/java/org/onap/holmes/dsa/dmaappolling/DMaaPResponseUtil.java index e7d6669..394dc08 100644 --- a/engine-d/src/main/java/org/onap/holmes/dsa/dmaappolling/DMaaPResponseUtil.java +++ b/engine-d/src/main/java/org/onap/holmes/dsa/dmaappolling/DMaaPResponseUtil.java @@ -18,10 +18,14 @@ package org.onap.holmes.dsa.dmaappolling; import com.google.gson.JsonObject; import com.google.gson.JsonParser; import org.jvnet.hk2.annotations.Service; -import org.onap.holmes.common.api.stat.AlarmAdditionalField; import org.onap.holmes.common.api.stat.VesAlarm; +import org.onap.holmes.common.api.stat.AlarmAdditionalField; +import com.google.gson.Gson; +import java.util.Map; +import java.util.TimeZone; import java.util.Collections; +import java.util.HashMap; import java.util.List; import static org.onap.holmes.common.utils.GsonUtil.*; @@ -52,7 +56,9 @@ public class DMaaPResponseUtil { vesAlarm.setEventName(getAsString(commonEventHeaderJson, "eventName")); vesAlarm.setAlarmIsCleared(vesAlarm.getEventName().endsWith("Cleared") ? 1 : 0); vesAlarm.setEventType(getAsString(commonEventHeaderJson, "eventType")); - vesAlarm.setInternalHeaderFields(getAsString(commonEventHeaderJson, "internalHeaderFields")); + if (commonEventHeaderJson.has("internalHeaderFields")) { + vesAlarm.setInternalHeaderFields(commonEventHeaderJson.getAsJsonObject("internalHeaderFields").toString()); + } vesAlarm.setLastEpochMicrosec(getAsLong(commonEventHeaderJson, "lastEpochMicrosec")); vesAlarm.setNfcNamingCode(getAsString(commonEventHeaderJson, "nfcNamingCode")); vesAlarm.setNfNamingCode(getAsString(commonEventHeaderJson, "nfNamingCode")); @@ -63,19 +69,41 @@ public class DMaaPResponseUtil { vesAlarm.setSourceId(getAsString(commonEventHeaderJson, "sourceId")); vesAlarm.setSourceName(getAsString(commonEventHeaderJson, "sourceName")); vesAlarm.setStartEpochMicrosec(getAsLong(commonEventHeaderJson, "startEpochMicrosec")); - vesAlarm.setVersion(getAsLong(commonEventHeaderJson, "version")); + vesAlarm.setVersion(getAsString(commonEventHeaderJson, "version")); + vesAlarm.setNfVendorName(getAsString(commonEventHeaderJson, "nfVendorName")); + if (commonEventHeaderJson.has("timeZoneOffset")) { + TimeZone timeZone = TimeZone.getTimeZone(getAsString(commonEventHeaderJson, "timeZoneOffset")); + vesAlarm.setTimeZoneOffset(timeZone); + } + if (commonEventHeaderJson.has("vesEventListenerVersion")) { + vesAlarm.setVesEventListenerVersion(getAsString(commonEventHeaderJson, "vesEventListenerVersion")); + } } private void convertFaultFieldsJsonToEvent(JsonObject faultFieldsJson, VesAlarm vesAlarm) { - vesAlarm.setAlarmAdditionalInformation(getListElementByNode(faultFieldsJson, "alarmAdditionalInformation")); vesAlarm.setAlarmCondition(getAsString(faultFieldsJson, "alarmCondition")); vesAlarm.setAlarmInterfaceA(getAsString(faultFieldsJson, "alarmInterfaceA")); vesAlarm.setEventCategory(getAsString(faultFieldsJson, "eventCategory")); vesAlarm.setEventSeverity(getAsString(faultFieldsJson, "eventSeverity")); vesAlarm.setEventSourceType(getAsString(faultFieldsJson, "eventSourceType")); - vesAlarm.setFaultFieldsVersion(getAsLong(faultFieldsJson, "faultFieldsVersion")); + vesAlarm.setFaultFieldsVersion(getAsString(faultFieldsJson, "faultFieldsVersion")); vesAlarm.setSpecificProblem(getAsString(faultFieldsJson, "specificProblem")); vesAlarm.setVfStatus(getAsString(faultFieldsJson, "vfStatus")); + //Support VES Specificatin 5.4 + if ("2.0".equals(vesAlarm.getFaultFieldsVersion())) { + List<AlarmAdditionalField> alarmAdditionalFieldList = getListElementByNode(faultFieldsJson, "alarmAdditionalInformation"); + Map<String, String> alarmAdditionalInformation = new HashMap<String, String>(); + for (AlarmAdditionalField field : alarmAdditionalFieldList) { + alarmAdditionalInformation.put(field.getName(), field.getValue()); + } + vesAlarm.setAlarmAdditionalInformation(alarmAdditionalInformation); + } //Support VES Specification 7.1 + else if (faultFieldsJson.has("alarmAdditionalInformation")) { + JsonObject alarmAddInfo = JsonParser.parseString(faultFieldsJson.get("alarmAdditionalInformation").toString()).getAsJsonObject(); + Gson gson = new Gson(); + Map map = gson.fromJson(alarmAddInfo, Map.class); + vesAlarm.setAlarmAdditionalInformation(map); + } } private List<AlarmAdditionalField> getListElementByNode(JsonObject jsonNode, String name) { diff --git a/engine-d/src/main/java/org/onap/holmes/engine/db/AlarmInfoDao.java b/engine-d/src/main/java/org/onap/holmes/engine/db/AlarmInfoDao.java index bab3084..83fa3f6 100644 --- a/engine-d/src/main/java/org/onap/holmes/engine/db/AlarmInfoDao.java +++ b/engine-d/src/main/java/org/onap/holmes/engine/db/AlarmInfoDao.java @@ -27,7 +27,7 @@ import java.util.List; public abstract class AlarmInfoDao {
@GetGeneratedKeys
- @SqlUpdate("INSERT INTO ALARM_INFO (EVENTID,EVENTNAME,STARTEPOCHMICROSEC,SOURCEID,SOURCENAME,ALARMISCLEARED,ROOTFLAG,LASTEPOCHMICROSEC) VALUES (:eventId,:eventName,:startEpochMicroSec,:sourceId,:sourceName,:alarmIsCleared,:rootFlag,:lastEpochMicroSec)")
+ @SqlUpdate("INSERT INTO ALARM_INFO (EVENTID,EVENTNAME,STARTEPOCHMICROSEC,SOURCEID,SOURCENAME,SEQUENCE,ALARMISCLEARED,ROOTFLAG,LASTEPOCHMICROSEC) VALUES (:eventId,:eventName,:startEpochMicroSec,:sourceId,:sourceName,:sequence,:alarmIsCleared,:rootFlag,:lastEpochMicroSec)")
protected abstract String addAlarm(@BindBean AlarmInfo alarmInfo);
@SqlQuery("SELECT * FROM ALARM_INFO")
diff --git a/engine-d/src/test/java/org/onap/holmes/dsa/dmaappolling/DMaaPResponseUtilTest.java b/engine-d/src/test/java/org/onap/holmes/dsa/dmaappolling/DMaaPResponseUtilTest.java index 3b46fed..ded50b0 100644 --- a/engine-d/src/test/java/org/onap/holmes/dsa/dmaappolling/DMaaPResponseUtilTest.java +++ b/engine-d/src/test/java/org/onap/holmes/dsa/dmaappolling/DMaaPResponseUtilTest.java @@ -24,8 +24,9 @@ import org.onap.holmes.common.api.stat.VesAlarm; import org.powermock.core.classloader.annotations.PrepareForTest; import java.io.IOException; -import java.util.ArrayList; -import java.util.List; +import java.util.HashMap; +import java.util.Map; +import java.util.TimeZone; import static org.hamcrest.CoreMatchers.equalTo; import static org.junit.Assert.assertThat; @@ -62,7 +63,7 @@ public class DMaaPResponseUtilTest { + "\"sourceId\":\"3345556444\"," + "\"sourceName\":\"nihoahh\"," + "\"startEpochMicrosec\":54545454," - + "\"version\":998989879" + + "\"version\":\"4.0\"" + "}," + "\"faultFields\":{" + "\"alarmAdditionalInformation\":[" @@ -80,7 +81,7 @@ public class DMaaPResponseUtilTest { + "\"eventCategory\":\"Event category\"," + "\"eventSeverity\":\"CRITICAL\"," + "\"eventSourceType\":\"type of event source\"," - + "\"faultFieldsVersion\":567567567," + + "\"faultFieldsVersion\":\"2.0\"," + "\"specificProblem\":\"short description\"," + "\"vfStatus\":\"Preparing to terminate\"" + "}" @@ -101,25 +102,122 @@ public class DMaaPResponseUtilTest { expected.setSourceId("3345556444"); expected.setSourceName("nihoahh"); expected.setStartEpochMicrosec((long) 54545454); - expected.setVersion((long) 998989879); - - List<AlarmAdditionalField> alarmAdditionalFields = new ArrayList<>(); - AlarmAdditionalField alarmAdditionalField1 = new AlarmAdditionalField(); - alarmAdditionalField1.setName("niaho"); - alarmAdditionalField1.setName("1111"); - alarmAdditionalFields.add(alarmAdditionalField1); - AlarmAdditionalField alarmAdditionalField2 = new AlarmAdditionalField(); - alarmAdditionalField2.setName("tian"); - alarmAdditionalField2.setName("22222"); - alarmAdditionalFields.add(alarmAdditionalField2); + expected.setVersion("4.0"); + + Map<String, String> alarmAdditionalFields = new HashMap<String, String>(); + alarmAdditionalFields.put("niaho", "1111"); + alarmAdditionalFields.put("titan", "22222"); expected.setAlarmAdditionalInformation(alarmAdditionalFields); + expected.setAlarmCondition("fadilel"); + expected.setAlarmInterfaceA("generating the alarm"); + expected.setEventCategory("Event category"); + expected.setEventSeverity("CRITICAL"); + expected.setEventSourceType("type of event source"); + expected.setFaultFieldsVersion("2.0"); + expected.setSpecificProblem("short description"); + expected.setVfStatus("Preparing to terminate"); + + VesAlarm result = dMaaPResponseUtil.convertJsonToVesAlarm(json); + + assertThat(expected.getDomain(), equalTo(result.getDomain())); + assertThat(expected.getEventId(), equalTo(result.getEventId())); + assertThat(expected.getEventName(), equalTo(result.getEventName())); + assertThat(expected.getEventType(), equalTo(result.getEventType())); + assertThat(expected.getLastEpochMicrosec(), equalTo(result.getLastEpochMicrosec())); + assertThat(expected.getNfcNamingCode(), equalTo(result.getNfcNamingCode())); + assertThat(expected.getNfNamingCode(), equalTo(result.getNfNamingCode())); + assertThat(expected.getPriority(), equalTo(result.getPriority())); + assertThat(expected.getReportingEntityId(), equalTo(result.getReportingEntityId())); + assertThat(expected.getReportingEntityName(), equalTo(result.getReportingEntityName())); + assertThat(expected.getSequence(), equalTo(result.getSequence())); + assertThat(expected.getSourceId(), equalTo(result.getSourceId())); + assertThat(expected.getSourceName(), equalTo(result.getSourceName())); + assertThat(expected.getStartEpochMicrosec(), equalTo(result.getStartEpochMicrosec())); + assertThat(expected.getVersion(), equalTo(result.getVersion())); + + assertThat(expected.getAlarmCondition(), equalTo(result.getAlarmCondition())); + assertThat(expected.getAlarmInterfaceA(), equalTo(result.getAlarmInterfaceA())); + assertThat(expected.getEventCategory(), equalTo(result.getEventCategory())); + assertThat(expected.getEventSeverity(), equalTo(result.getEventSeverity())); + assertThat(expected.getEventSourceType(), equalTo(result.getEventSourceType())); + assertThat(expected.getFaultFieldsVersion(), equalTo(result.getFaultFieldsVersion())); + assertThat(expected.getSpecificProblem(), equalTo(result.getSpecificProblem())); + assertThat(expected.getVfStatus(), equalTo(result.getVfStatus())); + + } + + @Test + public void testDMaaPResponseUtil_v7_input_normal() throws IOException { + String json = "{\"event\":{" + + "\"commonEventHeader\":{" + + "\"domain\":\"fault\"," + + "\"eventId\":\"112355255-24345\"," + + "\"eventName\":\"4333454333\"," + + "\"eventType\":\"remote\"," + + "\"lastEpochMicrosec\":333434333," + + "\"nfcNamingCode\":\"567422\"," + + "\"nfNamingCode\":\"qweertrr\"," + + "\"priority\":\"High\"," + + "\"reportingEntityId\":\"99888888888\"," + + "\"reportingEntityName\":\"tianshisdlsdjf\"," + + "\"sequence\":34566," + + "\"sourceId\":\"3345556444\"," + + "\"sourceName\":\"nihoahh\"," + + "\"startEpochMicrosec\":54545454," + + "\"version\":\"998989879\"," + + "\"timeZoneOffset\":\"UTC-05:30\"," + + "\"nfVendorName\": \"Ericsson\"," + + "\"vesEventListenerVersion\": \"7.2.1\"" + + "}," + + "\"faultFields\":{" + + "\"alarmAdditionalInformation\":" + + "{" + + "\"niaho\":\"1111\"," + + "\"titan\":\"2222\"" + + "}" + + "," + + "\"alarmCondition\":\"fadilel\"," + + "\"alarmInterfaceA\":\"generating the alarm\"," + + "\"eventCategory\":\"Event category\"," + + "\"eventSeverity\":\"CRITICAL\"," + + "\"eventSourceType\":\"type of event source\"," + + "\"faultFieldsVersion\":4.0," + + "\"specificProblem\":\"short description\"," + + "\"vfStatus\":\"Preparing to terminate\"" + + "}" + + "}" + + "}"; + VesAlarm expected = new VesAlarm(); + expected.setDomain("fault"); + expected.setEventId("112355255-24345"); + expected.setEventName("4333454333"); + expected.setEventType("remote"); + expected.setLastEpochMicrosec((long) 333434333); + expected.setNfcNamingCode("567422"); + expected.setNfNamingCode("qweertrr"); + expected.setPriority("High"); + expected.setReportingEntityId("99888888888"); + expected.setReportingEntityName("tianshisdlsdjf"); + expected.setSequence(34566); + expected.setSourceId("3345556444"); + expected.setSourceName("nihoahh"); + expected.setStartEpochMicrosec((long) 54545454); + expected.setVersion("998989879"); + expected.setNfVendorName("Ericsson"); + expected.setVesEventListenerVersion("7.2.1"); + TimeZone timeZone = TimeZone.getTimeZone("UTC-05:30"); + expected.setTimeZoneOffset(timeZone); + Map<String, String> alarmAdditionalFields = new HashMap<String, String>(); + alarmAdditionalFields.put("niaho", "1111"); + alarmAdditionalFields.put("titan", "22222"); + expected.setAlarmAdditionalInformation(alarmAdditionalFields); expected.setAlarmCondition("fadilel"); expected.setAlarmInterfaceA("generating the alarm"); expected.setEventCategory("Event category"); expected.setEventSeverity("CRITICAL"); expected.setEventSourceType("type of event source"); - expected.setFaultFieldsVersion((long) 567567567); + expected.setFaultFieldsVersion("4.0"); expected.setSpecificProblem("short description"); expected.setVfStatus("Preparing to terminate"); @@ -149,6 +247,9 @@ public class DMaaPResponseUtilTest { assertThat(expected.getFaultFieldsVersion(), equalTo(result.getFaultFieldsVersion())); assertThat(expected.getSpecificProblem(), equalTo(result.getSpecificProblem())); assertThat(expected.getVfStatus(), equalTo(result.getVfStatus())); + assertThat(expected.getVesEventListenerVersion(), equalTo(result.getVesEventListenerVersion())); + assertThat(expected.getNfVendorName(), equalTo(result.getNfVendorName())); + assertThat(expected.getTimeZoneOffset(), equalTo(result.getTimeZoneOffset())); } @@ -180,7 +281,7 @@ public class DMaaPResponseUtilTest { + "\"sequence\":34566," + "\"sourceName\":\"nihoahh\"," + "\"startEpochMicrosec\":54545454," - + "\"version\":998989879" + + "\"version\":\"4.0\"" + "}," + "\"faultFields\":{" + "\"alarmAdditionalInformation\":[" @@ -196,7 +297,7 @@ public class DMaaPResponseUtilTest { + "\"alarmCondition\":\"fadilel\"," + "\"eventSeverity\":\"CRITICAL\"," + "\"eventSourceType\":\"type of event source\"," - + "\"faultFieldsVersion\":567567567," + + "\"faultFieldsVersion\":\"2.0\"," + "\"specificProblem\":\"short description\"," + "\"vfStatus\":\"Preparing to terminate\"" + "}" @@ -211,23 +312,16 @@ public class DMaaPResponseUtilTest { expected.setSequence(34566); expected.setSourceName("nihoahh"); expected.setStartEpochMicrosec((long) 54545454); - expected.setVersion((long) 998989879); - - List<AlarmAdditionalField> alarmAdditionalFields = new ArrayList<>(); - AlarmAdditionalField alarmAdditionalField1 = new AlarmAdditionalField(); - alarmAdditionalField1.setName("niaho"); - alarmAdditionalField1.setName("1111"); - alarmAdditionalFields.add(alarmAdditionalField1); - AlarmAdditionalField alarmAdditionalField2 = new AlarmAdditionalField(); - alarmAdditionalField2.setName("tian"); - alarmAdditionalField2.setName("22222"); - alarmAdditionalFields.add(alarmAdditionalField2); + expected.setVersion("4.0"); + Map<String, String> alarmAdditionalFields = new HashMap<String, String>(); + alarmAdditionalFields.put("niaho", "1111"); + alarmAdditionalFields.put("titan", "22222"); expected.setAlarmAdditionalInformation(alarmAdditionalFields); expected.setAlarmCondition("fadilel"); expected.setEventSeverity("CRITICAL"); expected.setEventSourceType("type of event source"); - expected.setFaultFieldsVersion((long) 567567567); + expected.setFaultFieldsVersion("2.0"); expected.setSpecificProblem("short description"); expected.setVfStatus("Preparing to terminate"); @@ -265,7 +359,7 @@ public class DMaaPResponseUtilTest { + "\"sequence\":34566," + "\"sourceName\":\"nihoahh\"," + "\"startEpochMicrosec\":54545454," - + "\"version\":998989879" + + "\"version\":\"4.0\"" + "}," + "\"faultFields\":{" + "\"alarmAdditionalInformation\":[" @@ -281,7 +375,7 @@ public class DMaaPResponseUtilTest { + "\"alarmCondition\":\"fadilel\"," + "\"eventSeverity\":\"CRITICAL\"," + "\"eventSourceType\":\"type of event source\"," - + "\"faultFieldsVersion\":567567567," + + "\"faultFieldsVersion\":\"2.0\"," + "\"specificProblem\":\"short description\"," + "\"vfStatus\":\"Preparing to terminate\"" + "}" @@ -296,23 +390,15 @@ public class DMaaPResponseUtilTest { expected.setSequence(34566); expected.setSourceName("nihoahh"); expected.setStartEpochMicrosec((long) 54545454); - expected.setVersion((long) 998989879); - - List<AlarmAdditionalField> alarmAdditionalFields = new ArrayList<>(); - AlarmAdditionalField alarmAdditionalField = new AlarmAdditionalField(); - alarmAdditionalField.setName(null); - alarmAdditionalField.setValue("1111"); - alarmAdditionalFields.add(alarmAdditionalField); - alarmAdditionalField = new AlarmAdditionalField(); - alarmAdditionalField.setName("tian"); - alarmAdditionalField.setValue("22222"); - alarmAdditionalFields.add(alarmAdditionalField); + expected.setVersion("4.0"); + Map<String, String> alarmAdditionalFields = new HashMap<String, String>(); + alarmAdditionalFields.put(null, "1111"); expected.setAlarmAdditionalInformation(alarmAdditionalFields); expected.setAlarmCondition("fadilel"); expected.setEventSeverity("CRITICAL"); expected.setEventSourceType("type of event source"); - expected.setFaultFieldsVersion((long) 567567567); + expected.setFaultFieldsVersion("2.0"); expected.setSpecificProblem("short description"); expected.setVfStatus("Preparing to terminate"); @@ -327,11 +413,9 @@ public class DMaaPResponseUtilTest { assertThat(expected.getSourceName(), equalTo(result.getSourceName())); assertThat(expected.getStartEpochMicrosec(), equalTo(result.getStartEpochMicrosec())); assertThat(expected.getVersion(), equalTo(result.getVersion())); + assertThat(expected.getAlarmAdditionalInformation().get("niaho"), + equalTo(result.getAlarmAdditionalInformation().get("niaho"))); - assertThat(expected.getAlarmAdditionalInformation().get(0).getName(), - equalTo(result.getAlarmAdditionalInformation().get(0).getName())); - assertThat(expected.getAlarmAdditionalInformation().get(0).getValue(), - equalTo(result.getAlarmAdditionalInformation().get(0).getValue())); assertThat(expected.getAlarmCondition(), equalTo(result.getAlarmCondition())); assertThat(expected.getEventSeverity(), equalTo(result.getEventSeverity())); diff --git a/engine-d/src/test/java/org/onap/holmes/dsa/dmaappolling/SubscriberTest.java b/engine-d/src/test/java/org/onap/holmes/dsa/dmaappolling/SubscriberTest.java index f88ddfb..339a23e 100644 --- a/engine-d/src/test/java/org/onap/holmes/dsa/dmaappolling/SubscriberTest.java +++ b/engine-d/src/test/java/org/onap/holmes/dsa/dmaappolling/SubscriberTest.java @@ -33,6 +33,8 @@ import org.powermock.modules.junit4.PowerMockRunner; import java.util.ArrayList; import java.util.List; +import java.util.HashMap; +import java.util.Map; import static org.easymock.EasyMock.*; import static org.hamcrest.CoreMatchers.*; @@ -73,19 +75,16 @@ public class SubscriberTest { vesAlarm.setSourceId("Source-123"); vesAlarm.setSourceName("Source-123"); vesAlarm.setStartEpochMicrosec(500L); - vesAlarm.setVersion(1L); - List<AlarmAdditionalField> alarmAdditionalFields = new ArrayList<>(); - AlarmAdditionalField field = new AlarmAdditionalField(); - field.setName("addInfo"); - field.setValue("addInfo"); - alarmAdditionalFields.add(field); - vesAlarm.setAlarmAdditionalInformation(alarmAdditionalFields); - vesAlarm.setAlarmCondition("alarmCondition"); + vesAlarm.setVersion("4.0"); + Map alarmAdditionalFields = new HashMap<String, String>(); + alarmAdditionalFields.put("addInfo", "addInfo"); + vesAlarm.setAlarmAdditionalInformation(alarmAdditionalFields); + vesAlarm.setAlarmCondition("alarmCondition"); vesAlarm.setAlarmInterfaceA("alarmInterfaceA"); vesAlarm.setEventCategory("eventCategory"); vesAlarm.setEventSeverity("eventSeverity"); vesAlarm.setEventSourceType("eventSourceType"); - vesAlarm.setFaultFieldsVersion(1L); + vesAlarm.setFaultFieldsVersion("2.0"); vesAlarm.setSpecificProblem("specificProblem"); vesAlarm.setVfStatus("vfStatus"); @@ -104,16 +103,16 @@ public class SubscriberTest { "\"sourceId\": \"Source-123\"," + "\"sourceName\": \"Source-123\"," + "\"startEpochMicrosec\": 500," + - "\"version\": 1" + + "\"version\": \"4.0\"" + "}," + " \"faultFields\" : {" + - "\"alarmAdditionalInformation\": [{\"name\":\"addInfo\", \"value\":\"addInfo\"}]," + + "\"alarmAdditionalInformatiddon\":[{\"name\":\"addInfo\", \"value\":\"addInfo\"}]," + "\"alarmCondition\": \"alarmCondition\"," + "\"alarmInterfaceA\": \"alarmInterfaceA\"," + "\"eventCategory\": \"eventCategory\"," + "\"eventSeverity\": \"eventSeverity\"," + "\"eventSourceType\": \"eventSourceType\"," + - "\"faultFieldsVersion\": 1," + + "\"faultFieldsVersion\": \"2.0\"," + "\"specificProblem\": \"specificProblem\"," + "\"vfStatus\": \"vfStatus\"" + "}}}"; @@ -160,19 +159,16 @@ public class SubscriberTest { vesAlarm.setSourceId("Source-123"); vesAlarm.setSourceName("Source-123"); vesAlarm.setStartEpochMicrosec(500L); - vesAlarm.setVersion(1L); - List<AlarmAdditionalField> alarmAdditionalFields = new ArrayList<>(); - AlarmAdditionalField field = new AlarmAdditionalField(); - field.setName("addInfo"); - field.setValue("addInfo"); - alarmAdditionalFields.add(field); - vesAlarm.setAlarmAdditionalInformation(alarmAdditionalFields); - vesAlarm.setAlarmCondition("alarmCondition"); + vesAlarm.setVersion("4.0"); + Map alarmAdditionalFields = new HashMap<String, String>(); + alarmAdditionalFields.put("addInfo", "addInfo"); + vesAlarm.setAlarmAdditionalInformation(alarmAdditionalFields); + vesAlarm.setAlarmCondition("alarmCondition"); vesAlarm.setAlarmInterfaceA("alarmInterfaceA"); vesAlarm.setEventCategory("eventCategory"); vesAlarm.setEventSeverity("eventSeverity"); vesAlarm.setEventSourceType("eventSourceType"); - vesAlarm.setFaultFieldsVersion(1L); + vesAlarm.setFaultFieldsVersion("2.0"); vesAlarm.setSpecificProblem("specificProblem"); vesAlarm.setVfStatus("vfStatus"); @@ -191,7 +187,7 @@ public class SubscriberTest { "\"sourceId\": \"Source-123\"," + "\"sourceName\": \"Source-123\"," + "\"startEpochMicrosec\": 500," + - "\"version\": 1" + + "\"version\": \"4.0\"" + "}," + " \"faultFields\" : {" + "\"alarmAdditionalInformation\": [{\"name\":\"addInfo\", \"value\":\"addInfo\"}]," + @@ -200,7 +196,7 @@ public class SubscriberTest { "\"eventCategory\": \"eventCategory\"," + "\"eventSeverity\": \"eventSeverity\"," + "\"eventSourceType\": \"eventSourceType\"," + - "\"faultFieldsVersion\": 1," + + "\"faultFieldsVersion\": \"2.0\"," + "\"specificProblem\": \"specificProblem\"," + "\"vfStatus\": \"vfStatus\"" + "}}}"; @@ -257,4 +253,4 @@ public class SubscriberTest { PowerMock.verifyAll(); } -}
\ No newline at end of file +} diff --git a/engine-d/src/test/java/org/onap/holmes/engine/dmaap/DMaaPAlarmPollingTest.java b/engine-d/src/test/java/org/onap/holmes/engine/dmaap/DMaaPAlarmPollingTest.java index 896a384..74765f5 100644 --- a/engine-d/src/test/java/org/onap/holmes/engine/dmaap/DMaaPAlarmPollingTest.java +++ b/engine-d/src/test/java/org/onap/holmes/engine/dmaap/DMaaPAlarmPollingTest.java @@ -85,4 +85,4 @@ public class DMaaPAlarmPollingTest { assertThat(alarmInfo.getRootFlag(), is(0)); } -}
\ No newline at end of file +} @@ -26,7 +26,7 @@ <groupId>org.onap.holmes.engine-management</groupId> <artifactId>holmes-engine-parent</artifactId> - <version>1.3.4-SNAPSHOT</version> + <version>1.3.5-SNAPSHOT</version> <packaging>pom</packaging> <name>holmes-engine-management</name> <modules> @@ -168,7 +168,7 @@ <dependency> <groupId>org.onap.holmes.common</groupId> <artifactId>holmes-actions</artifactId> - <version>1.3.5</version> + <version>1.3.6</version> <exclusions> <exclusion> <groupId>io.dropwizard</groupId> |