@Test public void testAlarmRpcOutputElement() throws Exception { long timeInMillis = 1465967097648L; Timestamp now = new Timestamp(timeInMillis); AlarmParameters parameter = new AlarmParameters( "{baa-network-manager}(http: TEST_RESOURCE, now, AlarmSeverity.CRITICAL, "Test"); Element expectedAlarmRpcElement = loadAsXml(EXPECTED_ALARM_RPC_OUTPUT_DEVICE_HOLDER); Element alarmRpcOutputElement = new AlarmsDocumentTransformer(m_schemaRegistry, null) .getAlarmRpcOutputElement(AlarmTestConstants.NETWORK_MANAGER_NAMESPACE, "1", Arrays.asList(parameter)); assertXMLEquals(expectedAlarmRpcElement, alarmRpcOutputElement, m_ignoreElements); expectedAlarmRpcElement = loadAsXml(EXPECTED_ALARM_RPC_OUTPUT); alarmRpcOutputElement = new AlarmsDocumentTransformer(m_schemaRegistry, null).getAlarmRpcOutputElement(AlarmConstants.ALARM_NAMESPACE, "1", Arrays.asList(parameter)); assertXMLEquals(expectedAlarmRpcElement, alarmRpcOutputElement, m_ignoreElements); }
public Element getAlarmRpcOutputElement(String namespace, String offsetValue, List<AlarmParameters> alarmParameters) throws NetconfMessageBuilderException { String prefix = null; if (m_schemaRegistry != null) { prefix = getPrefix(namespace, null); } try { m_doc = DocumentUtils.getNewDocument(); } catch (ParserConfigurationException e) { throw new NetconfMessageBuilderException(ERROR_WHILE_BUILDING_DOCUMENT, e); } Element alarmRpcOutputElement = m_doc.createElementNS(namespace, buildLocalName(prefix, AlarmConstants.ACTIVE_ALARMS)); if (offsetValue != null) { appendChild(alarmRpcOutputElement, namespace, buildLocalName(prefix, AlarmConstants.OFFSET), offsetValue); } for (AlarmParameters alarmParameter : alarmParameters) { Element alarmElement = buildAlarmParameters(namespace, prefix, alarmParameter); alarmRpcOutputElement.appendChild(alarmElement); } return alarmRpcOutputElement; }
AlarmsDocumentTransformer extends PojoToDocumentTransformer { public Element getAlarmRpcOutputElement(String namespace, String offsetValue, List<AlarmParameters> alarmParameters) throws NetconfMessageBuilderException { String prefix = null; if (m_schemaRegistry != null) { prefix = getPrefix(namespace, null); } try { m_doc = DocumentUtils.getNewDocument(); } catch (ParserConfigurationException e) { throw new NetconfMessageBuilderException(ERROR_WHILE_BUILDING_DOCUMENT, e); } Element alarmRpcOutputElement = m_doc.createElementNS(namespace, buildLocalName(prefix, AlarmConstants.ACTIVE_ALARMS)); if (offsetValue != null) { appendChild(alarmRpcOutputElement, namespace, buildLocalName(prefix, AlarmConstants.OFFSET), offsetValue); } for (AlarmParameters alarmParameter : alarmParameters) { Element alarmElement = buildAlarmParameters(namespace, prefix, alarmParameter); alarmRpcOutputElement.appendChild(alarmElement); } return alarmRpcOutputElement; } }
AlarmsDocumentTransformer extends PojoToDocumentTransformer { public Element getAlarmRpcOutputElement(String namespace, String offsetValue, List<AlarmParameters> alarmParameters) throws NetconfMessageBuilderException { String prefix = null; if (m_schemaRegistry != null) { prefix = getPrefix(namespace, null); } try { m_doc = DocumentUtils.getNewDocument(); } catch (ParserConfigurationException e) { throw new NetconfMessageBuilderException(ERROR_WHILE_BUILDING_DOCUMENT, e); } Element alarmRpcOutputElement = m_doc.createElementNS(namespace, buildLocalName(prefix, AlarmConstants.ACTIVE_ALARMS)); if (offsetValue != null) { appendChild(alarmRpcOutputElement, namespace, buildLocalName(prefix, AlarmConstants.OFFSET), offsetValue); } for (AlarmParameters alarmParameter : alarmParameters) { Element alarmElement = buildAlarmParameters(namespace, prefix, alarmParameter); alarmRpcOutputElement.appendChild(alarmElement); } return alarmRpcOutputElement; } AlarmsDocumentTransformer(SchemaRegistry schemaRegistry, ModelNodeDataStoreManager dsm); }
AlarmsDocumentTransformer extends PojoToDocumentTransformer { public Element getAlarmRpcOutputElement(String namespace, String offsetValue, List<AlarmParameters> alarmParameters) throws NetconfMessageBuilderException { String prefix = null; if (m_schemaRegistry != null) { prefix = getPrefix(namespace, null); } try { m_doc = DocumentUtils.getNewDocument(); } catch (ParserConfigurationException e) { throw new NetconfMessageBuilderException(ERROR_WHILE_BUILDING_DOCUMENT, e); } Element alarmRpcOutputElement = m_doc.createElementNS(namespace, buildLocalName(prefix, AlarmConstants.ACTIVE_ALARMS)); if (offsetValue != null) { appendChild(alarmRpcOutputElement, namespace, buildLocalName(prefix, AlarmConstants.OFFSET), offsetValue); } for (AlarmParameters alarmParameter : alarmParameters) { Element alarmElement = buildAlarmParameters(namespace, prefix, alarmParameter); alarmRpcOutputElement.appendChild(alarmElement); } return alarmRpcOutputElement; } 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 getAlarmRpcOutputElement(String namespace, String offsetValue, List<AlarmParameters> alarmParameters) throws NetconfMessageBuilderException { String prefix = null; if (m_schemaRegistry != null) { prefix = getPrefix(namespace, null); } try { m_doc = DocumentUtils.getNewDocument(); } catch (ParserConfigurationException e) { throw new NetconfMessageBuilderException(ERROR_WHILE_BUILDING_DOCUMENT, e); } Element alarmRpcOutputElement = m_doc.createElementNS(namespace, buildLocalName(prefix, AlarmConstants.ACTIVE_ALARMS)); if (offsetValue != null) { appendChild(alarmRpcOutputElement, namespace, buildLocalName(prefix, AlarmConstants.OFFSET), offsetValue); } for (AlarmParameters alarmParameter : alarmParameters) { Element alarmElement = buildAlarmParameters(namespace, prefix, alarmParameter); alarmRpcOutputElement.appendChild(alarmElement); } return alarmRpcOutputElement; } 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);  }