@Test public void testIETFAlarmNotificationIdentification() throws Exception { Element expectedAlarmNotificationElement = loadAsXml(EXPECTED_IETF_ALARM_NOTIFICATION_RESOURCE_IDENTIFICATION); long timeInMillis = 1465967097648L; Timestamp now = new Timestamp(timeInMillis); AlarmNotification notification = new AlarmNotification( "{baa-network-manager}" + AlarmTestConstants.ALARM_TYPE_ID_FOR_DEVICE, "{xyz-al}(urn:broadband-forum-org:yang:dpu-alarm-types)xdsl-fe-los", INTF_MODEL_NODE_ID_IDENTIFICATION, now, AlarmSeverity.MAJOR, "dummyText", AlarmCondition.ALARM_ON, MOUNT_KEY, null); Element alarmNotificationElement = new AlarmsDocumentTransformer(m_schemaRegistry, m_dsm).buildAlarmNotification(notification, "urn:ietf:params:xml:ns:yang:ietf-alarms"); assertXMLEquals(expectedAlarmNotificationElement, alarmNotificationElement, m_ignoreElements); }
public Element buildAlarmNotification(AlarmNotification alarmNotif, String alarmNS) throws NetconfMessageBuilderException { try { m_doc = DocumentUtils.getNewDocument(); } catch (ParserConfigurationException e) { throw new NetconfMessageBuilderException(ERROR_WHILE_BUILDING_DOCUMENT, e); } String prefix = null; if (m_schemaRegistry != null) { prefix = m_schemaRegistry.getPrefix(alarmNS); if (prefix == null) { prefix = AlarmConstants.ALARM_PREFIX; } } Element alarmNotificationElement = m_doc.createElementNS(alarmNS, buildLocalName(prefix, AlarmConstants.ALARM_NOTIFICATION)); buildAlarmParameters(alarmNS, prefix, alarmNotif, alarmNotificationElement); LOGGER.debug(null, "Processed alarmNotification-%s ", alarmNotif.toString()); return alarmNotificationElement; }
AlarmsDocumentTransformer extends PojoToDocumentTransformer { public Element buildAlarmNotification(AlarmNotification alarmNotif, String alarmNS) throws NetconfMessageBuilderException { try { m_doc = DocumentUtils.getNewDocument(); } catch (ParserConfigurationException e) { throw new NetconfMessageBuilderException(ERROR_WHILE_BUILDING_DOCUMENT, e); } String prefix = null; if (m_schemaRegistry != null) { prefix = m_schemaRegistry.getPrefix(alarmNS); if (prefix == null) { prefix = AlarmConstants.ALARM_PREFIX; } } Element alarmNotificationElement = m_doc.createElementNS(alarmNS, buildLocalName(prefix, AlarmConstants.ALARM_NOTIFICATION)); buildAlarmParameters(alarmNS, prefix, alarmNotif, alarmNotificationElement); LOGGER.debug(null, "Processed alarmNotification-%s ", alarmNotif.toString()); return alarmNotificationElement; } }
AlarmsDocumentTransformer extends PojoToDocumentTransformer { public Element buildAlarmNotification(AlarmNotification alarmNotif, String alarmNS) throws NetconfMessageBuilderException { try { m_doc = DocumentUtils.getNewDocument(); } catch (ParserConfigurationException e) { throw new NetconfMessageBuilderException(ERROR_WHILE_BUILDING_DOCUMENT, e); } String prefix = null; if (m_schemaRegistry != null) { prefix = m_schemaRegistry.getPrefix(alarmNS); if (prefix == null) { prefix = AlarmConstants.ALARM_PREFIX; } } Element alarmNotificationElement = m_doc.createElementNS(alarmNS, buildLocalName(prefix, AlarmConstants.ALARM_NOTIFICATION)); buildAlarmParameters(alarmNS, prefix, alarmNotif, alarmNotificationElement); LOGGER.debug(null, "Processed alarmNotification-%s ", alarmNotif.toString()); return alarmNotificationElement; } AlarmsDocumentTransformer(SchemaRegistry schemaRegistry, ModelNodeDataStoreManager dsm); }
AlarmsDocumentTransformer extends PojoToDocumentTransformer { public Element buildAlarmNotification(AlarmNotification alarmNotif, String alarmNS) throws NetconfMessageBuilderException { try { m_doc = DocumentUtils.getNewDocument(); } catch (ParserConfigurationException e) { throw new NetconfMessageBuilderException(ERROR_WHILE_BUILDING_DOCUMENT, e); } String prefix = null; if (m_schemaRegistry != null) { prefix = m_schemaRegistry.getPrefix(alarmNS); if (prefix == null) { prefix = AlarmConstants.ALARM_PREFIX; } } Element alarmNotificationElement = m_doc.createElementNS(alarmNS, buildLocalName(prefix, AlarmConstants.ALARM_NOTIFICATION)); buildAlarmParameters(alarmNS, prefix, alarmNotif, alarmNotificationElement); LOGGER.debug(null, "Processed alarmNotification-%s ", alarmNotif.toString()); return alarmNotificationElement; } 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); }
AlarmsDocumentTransformer extends PojoToDocumentTransformer { public Element buildAlarmNotification(AlarmNotification alarmNotif, String alarmNS) throws NetconfMessageBuilderException { try { m_doc = DocumentUtils.getNewDocument(); } catch (ParserConfigurationException e) { throw new NetconfMessageBuilderException(ERROR_WHILE_BUILDING_DOCUMENT, e); } String prefix = null; if (m_schemaRegistry != null) { prefix = m_schemaRegistry.getPrefix(alarmNS); if (prefix == null) { prefix = AlarmConstants.ALARM_PREFIX; } } Element alarmNotificationElement = m_doc.createElementNS(alarmNS, buildLocalName(prefix, AlarmConstants.ALARM_NOTIFICATION)); buildAlarmParameters(alarmNS, prefix, alarmNotif, alarmNotificationElement); LOGGER.debug(null, "Processed alarmNotification-%s ", alarmNotif.toString()); return alarmNotificationElement; } 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);  }