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.assertEquals;
11 import static org.junit.Assert.assertTrue;
13 import java.util.Optional;
14 import org.junit.Test;
15 import org.opendaylight.yangtools.yang.common.QName;
16 import org.opendaylight.yangtools.yang.model.api.AugmentationSchemaNode;
17 import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
18 import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
20 public class YT911Test extends AbstractYangTest {
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() {
26 final var context = assertEffectiveModel("/bugs/YT911/foo.yang");
27 final DataSchemaNode foo = context.findDataChildByName(FOO).get();
28 assertEquals(Optional.of(Boolean.FALSE), foo.effectiveConfig());
29 assertTrue(foo instanceof ContainerSchemaNode);
32 final DataSchemaNode bar = ((ContainerSchemaNode) foo).findDataTreeChild(BAR).get();
33 assertEquals(Optional.of(Boolean.FALSE), bar.effectiveConfig());
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 assertEquals(Optional.empty(), augBar.effectiveConfig());
40 assertTrue(foo instanceof ContainerSchemaNode);