AlarmsDocumentTransformer extends PojoToDocumentTransformer { public Element getAlarmNotificationElement(AlarmNotification alarmNotif) throws NetconfMessageBuilderException { return buildAlarmNotification(alarmNotif, AlarmConstants.ALARM_NAMESPACE); } AlarmsDocumentTransformer(SchemaRegistry schemaRegistry, ModelNodeDataStoreManager dsm); Element buildAlarmParameters(String namespace, String prefix, AlarmParameters alarmParameters); Element getAlarmNotificationElement(AlarmNotification alarmNotif); Element buildAlarmNotification(AlarmNotification alarmNotif, String alarmNS); Element getAlarmRpcOutputElement(String namespace, String offsetValue, List<AlarmParameters> alarmParameters);  }
@Test public void testAlarmNotification() throws Exception { Element expectedAlarmNotificationElement = loadAsXml(EXPECTED_ALARM_NOTIFICATION); long timeInMillis = 1465967097648L; Timestamp now = new Timestamp(timeInMillis); AlarmNotification notification = new AlarmNotification( "{baa-network-manager}(http: TEST_RESOURCE, now, AlarmSeverity.CRITICAL, "Test", AlarmCondition.ALARM_ON, MOUNT_KEY, null); Element alarmNotificationElement = new AlarmsDocumentTransformer(m_schemaRegistry, null) .getAlarmNotificationElement(notification); assertXMLEquals(expectedAlarmNotificationElement, alarmNotificationElement, m_ignoreElements); }
@Test public void testAlarmNotificationWithNonYangResource() throws Exception { Element expectedAlarmNotificationElement = loadAsXml(EXPECTED_ALARM_NOTIFICATION_NON_YANG_RESOURCE); long timeInMillis = 1465967097648L; Timestamp now = new Timestamp(timeInMillis); AlarmNotification notification = new AlarmNotification( "{baa-network-manager}(http: null, now, AlarmSeverity.CRITICAL, "Test", AlarmCondition.ALARM_ON, MOUNT_KEY, NON_YANG_RESOURCE_STRING); Element alarmNotificationElement = new AlarmsDocumentTransformer(m_schemaRegistry, null) .getAlarmNotificationElement(notification); assertXMLEquals(expectedAlarmNotificationElement, alarmNotificationElement, m_ignoreElements); }