2 * Copyright (c) 2022 PANTHEON.tech, s.r.o. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.netconf.client.mdsal;
10 import static org.junit.jupiter.api.Assertions.assertFalse;
12 import javax.xml.transform.dom.DOMSource;
13 import org.junit.jupiter.api.Test;
14 import org.opendaylight.netconf.api.xml.XmlUtil;
15 import org.xmlunit.builder.DiffBuilder;
19 void testFilterDomNamespaces() throws Exception {
20 final var source = XmlUtil.readXmlToDocument(NC881Test.class.getResourceAsStream("/nc881/netconf-state.xml"));
21 final var expected = XmlUtil.readXmlToDocument(
22 NC881Test.class.getResourceAsStream("/nc881/netconf-state-filtered.xml"));
24 final var filteredDom = NetconfStateSchemas.ietfMonitoringCopy(new DOMSource(source.getDocumentElement()));
25 final var filtered = XmlUtil.newDocument();
26 filtered.appendChild(filtered.importNode(filteredDom.getNode(), true));
28 final var diff = DiffBuilder.compare(expected)
33 assertFalse(diff.hasDifferences(), diff.toString());