2 * Copyright (c) 2018 Cisco Systems, Inc. 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.mdsal.connector.ops.get;
10 import static org.junit.Assert.assertEquals;
11 import static org.mockito.Mockito.doReturn;
12 import static org.mockito.Mockito.mock;
14 import org.junit.Test;
15 import org.opendaylight.netconf.api.xml.XmlElement;
16 import org.opendaylight.netconf.api.xml.XmlUtil;
17 import org.opendaylight.netconf.mdsal.connector.CurrentSchemaContext;
18 import org.opendaylight.yangtools.yang.common.QName;
19 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
20 import org.opendaylight.yangtools.yang.test.util.YangParserTestUtils;
22 public class Netconf506Test {
23 private static final QName BASE = QName.create("urn:dummy:mod-0", "2016-03-01", "mainroot");
26 public void testValidateTypes() throws Exception {
27 final var context = YangParserTestUtils.parseYangResources(Bug8084.class,
28 "/yang/filter-validator-test-mod-0.yang", "/yang/mdsal-netconf-mapping-test.yang");
29 final var currentContext = mock(CurrentSchemaContext.class);
30 doReturn(context).when(currentContext).getCurrentContext();
31 final var validator = new FilterContentValidator(currentContext);
33 final var document = XmlUtil.readXmlToDocument(FilterContentValidatorTest.class
34 .getResourceAsStream("/filter/netconf506.xml"));
36 final var xmlElement = XmlElement.fromDomDocument(document);
37 final var actual = validator.validate(xmlElement);
39 assertEquals(YangInstanceIdentifier.builder()
41 .node(QName.create(BASE, "leafref-key-list"))
42 .nodeWithKey(QName.create(BASE, "leafref-key-list"), QName.create(BASE, "name"), "foo")