2 * Copyright (c) 2017 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.yangtools.yang.model.export;
10 import static org.junit.jupiter.api.Assertions.assertFalse;
11 import static org.junit.jupiter.api.Assertions.assertNotNull;
12 import static org.junit.jupiter.api.Assertions.assertTrue;
14 import java.io.BufferedOutputStream;
15 import java.io.ByteArrayOutputStream;
16 import org.junit.jupiter.api.Test;
17 import org.opendaylight.yangtools.yang.common.Revision;
18 import org.opendaylight.yangtools.yang.test.util.YangParserTestUtils;
20 public class Bug6856Test {
22 public void testImplicitInputAndOutputInRpc() throws Exception {
23 final var schemaContext = YangParserTestUtils.parseYang("""
31 assertNotNull(schemaContext);
33 final var byteArrayOutputStream = new ByteArrayOutputStream();
34 final var bufferedOutputStream = new BufferedOutputStream(byteArrayOutputStream);
36 final var fooModule = schemaContext.findModule("foo", Revision.of("2017-02-28")).orElseThrow();
37 YinExportUtils.writeModuleAsYinText(fooModule.asEffectiveStatement(), bufferedOutputStream);
39 final var output = byteArrayOutputStream.toString();
40 assertNotNull(output);
41 assertFalse(output.isEmpty());
43 assertFalse(output.contains("<input>"));
44 assertFalse(output.contains("<output>"));
48 public void testExplicitInputAndOutputInRpc() throws Exception {
49 final var schemaContext = YangParserTestUtils.parseYang("""
68 assertNotNull(schemaContext);
70 final var byteArrayOutputStream = new ByteArrayOutputStream();
71 final var bufferedOutputStream = new BufferedOutputStream(byteArrayOutputStream);
73 final var barModule = schemaContext.findModule("bar", Revision.of("2017-02-28")).orElseThrow();
74 YinExportUtils.writeModuleAsYinText(barModule.asEffectiveStatement(), bufferedOutputStream);
76 final var output = byteArrayOutputStream.toString();
77 assertNotNull(output);
78 assertFalse(output.isEmpty());
80 assertTrue(output.contains("<input>"));
81 assertTrue(output.contains("<output>"));