@Test public void testStateResponseIsPrepared() throws Exception { Map<ModelNodeId, Pair<List<QName>, List<FilterNode>>> attributes = prepareAttributes(); Element dataElement = DocumentUtils.stringToDocument(DATA).getDocumentElement(); Map<ModelNodeId, List<Element>> stateResponse = m_util.getStateResponse(attributes, dataElement); assertResponse(stateResponse); }
public Map<ModelNodeId, List<Element>> getStateResponse(Map<ModelNodeId, Pair<List<QName>, List<FilterNode>>> attributes, Element dataElement) { Map<ModelNodeId, List<Element>> response = new HashMap<>(); for (Map.Entry<ModelNodeId, Pair<List<QName>, List<FilterNode>>> entry : attributes.entrySet()) { List<Element> childElements = getChildElements(dataElement); Element matchingNode = null; ModelNodeId nodeId = entry.getKey(); for (Element rootNode : childElements) { matchingNode = getMatchingNode(nodeId, rootNode); if (matchingNode != null) { break; } } if (matchingNode != null) { fillResponseForNode(entry, matchingNode, response); } } return response; }
DeviceSubsystemResponseUtil { public Map<ModelNodeId, List<Element>> getStateResponse(Map<ModelNodeId, Pair<List<QName>, List<FilterNode>>> attributes, Element dataElement) { Map<ModelNodeId, List<Element>> response = new HashMap<>(); for (Map.Entry<ModelNodeId, Pair<List<QName>, List<FilterNode>>> entry : attributes.entrySet()) { List<Element> childElements = getChildElements(dataElement); Element matchingNode = null; ModelNodeId nodeId = entry.getKey(); for (Element rootNode : childElements) { matchingNode = getMatchingNode(nodeId, rootNode); if (matchingNode != null) { break; } } if (matchingNode != null) { fillResponseForNode(entry, matchingNode, response); } } return response; } }
DeviceSubsystemResponseUtil { public Map<ModelNodeId, List<Element>> getStateResponse(Map<ModelNodeId, Pair<List<QName>, List<FilterNode>>> attributes, Element dataElement) { Map<ModelNodeId, List<Element>> response = new HashMap<>(); for (Map.Entry<ModelNodeId, Pair<List<QName>, List<FilterNode>>> entry : attributes.entrySet()) { List<Element> childElements = getChildElements(dataElement); Element matchingNode = null; ModelNodeId nodeId = entry.getKey(); for (Element rootNode : childElements) { matchingNode = getMatchingNode(nodeId, rootNode); if (matchingNode != null) { break; } } if (matchingNode != null) { fillResponseForNode(entry, matchingNode, response); } } return response; } DeviceSubsystemResponseUtil(SchemaRegistry schemaRegistry); }
DeviceSubsystemResponseUtil { public Map<ModelNodeId, List<Element>> getStateResponse(Map<ModelNodeId, Pair<List<QName>, List<FilterNode>>> attributes, Element dataElement) { Map<ModelNodeId, List<Element>> response = new HashMap<>(); for (Map.Entry<ModelNodeId, Pair<List<QName>, List<FilterNode>>> entry : attributes.entrySet()) { List<Element> childElements = getChildElements(dataElement); Element matchingNode = null; ModelNodeId nodeId = entry.getKey(); for (Element rootNode : childElements) { matchingNode = getMatchingNode(nodeId, rootNode); if (matchingNode != null) { break; } } if (matchingNode != null) { fillResponseForNode(entry, matchingNode, response); } } return response; } DeviceSubsystemResponseUtil(SchemaRegistry schemaRegistry); Map<ModelNodeId, List<Element>> getStateResponse(Map<ModelNodeId, Pair<List<QName>, List<FilterNode>>> attributes, Element
            dataElement); }
DeviceSubsystemResponseUtil { public Map<ModelNodeId, List<Element>> getStateResponse(Map<ModelNodeId, Pair<List<QName>, List<FilterNode>>> attributes, Element dataElement) { Map<ModelNodeId, List<Element>> response = new HashMap<>(); for (Map.Entry<ModelNodeId, Pair<List<QName>, List<FilterNode>>> entry : attributes.entrySet()) { List<Element> childElements = getChildElements(dataElement); Element matchingNode = null; ModelNodeId nodeId = entry.getKey(); for (Element rootNode : childElements) { matchingNode = getMatchingNode(nodeId, rootNode); if (matchingNode != null) { break; } } if (matchingNode != null) { fillResponseForNode(entry, matchingNode, response); } } return response; } DeviceSubsystemResponseUtil(SchemaRegistry schemaRegistry); Map<ModelNodeId, List<Element>> getStateResponse(Map<ModelNodeId, Pair<List<QName>, List<FilterNode>>> attributes, Element
            dataElement);  }