2 * Copyright (c) 2018 Pantheon Technologies, 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.yangtools.yang.stmt;
10 import static org.junit.Assert.assertFalse;
11 import static org.junit.Assert.assertTrue;
13 import org.junit.Test;
14 import org.opendaylight.yangtools.yang.common.QName;
15 import org.opendaylight.yangtools.yang.model.api.AugmentationSchemaNode;
16 import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
17 import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
18 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
20 public class YT911Test {
21 private static final QName FOO = QName.create("foo", "2018-10-22", "foo");
22 private static final QName BAR = QName.create(FOO, "bar");
25 public void testAugmentationConfig() throws Exception {
26 final SchemaContext context = StmtTestUtils.parseYangSource("/bugs/YT911/foo.yang");
27 final DataSchemaNode foo = context.findDataChildByName(FOO).get();
28 assertFalse(foo.isConfiguration());
29 assertTrue(foo instanceof ContainerSchemaNode);
32 final DataSchemaNode bar = ((ContainerSchemaNode) foo).findDataTreeChild(BAR).get();
33 assertFalse(bar.isConfiguration());
34 assertTrue(foo instanceof ContainerSchemaNode);
36 // Original augmentation node
37 final AugmentationSchemaNode aug = ((ContainerSchemaNode) foo).getAvailableAugmentations().iterator().next();
38 final DataSchemaNode augBar = aug.findDataTreeChild(BAR).get();
39 assertTrue(augBar.isConfiguration());
40 assertTrue(foo instanceof ContainerSchemaNode);