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.yangtools.yang.data.api.schema.stream;
10 import static org.junit.jupiter.api.Assertions.assertEquals;
12 import java.io.IOException;
13 import org.junit.jupiter.api.BeforeAll;
14 import org.junit.jupiter.api.Test;
15 import org.opendaylight.yangtools.yang.common.QName;
16 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
17 import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
18 import org.opendaylight.yangtools.yang.test.util.YangParserTestUtils;
20 public class YT1433Test {
21 private static EffectiveModelContext CONTEXT;
24 public static void beforeAll() {
25 CONTEXT = YangParserTestUtils.parseYangResourceDirectory("/YT1433");
29 public void testContainerAugmentContainer() throws IOException {
30 final FormattingNormalizedNodeStreamWriter streamWriter = new FormattingNormalizedNodeStreamWriter();
32 final QName bar = QName.create("foo", "bar");
33 final QName baz = QName.create("foo", "baz");
35 final YangInstanceIdentifier path = YangInstanceIdentifier.builder()
36 .node(QName.create("foo", "foo"))
41 try (var iidWriter = YangInstanceIdentifierWriter.open(streamWriter, CONTEXT, path)) {
42 try (var nnWriter = new NormalizedNodeWriter(streamWriter)) {
54 """, streamWriter.result());
58 public void testChoiceAugmentCointainer() throws IOException {
59 final FormattingNormalizedNodeStreamWriter streamWriter = new FormattingNormalizedNodeStreamWriter();
61 final QName bar = QName.create("bar", "bar");
62 final QName baz = QName.create("bar", "baz");
64 final YangInstanceIdentifier path = YangInstanceIdentifier.builder()
65 .node(QName.create("bar", "foo"))
70 try (var iidWriter = YangInstanceIdentifierWriter.open(streamWriter, CONTEXT, path)) {
71 try (var nnWriter = new NormalizedNodeWriter(streamWriter)) {
83 """, streamWriter.result());