dbaee222cbdbc091678989c93aebe2b0d6cfb651
[netconf.git] / restconf / sal-rest-docgen / src / test / java / org / opendaylight / netconf / sal / rest / doc / impl / DefinitionGeneratorTest.java
1 /*
2  * Copyright (c) 2014, 2015 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.netconf.sal.rest.doc.impl;
9
10 import static org.junit.Assert.assertNotNull;
11
12 import com.fasterxml.jackson.databind.node.ObjectNode;
13 import java.io.IOException;
14 import org.junit.Test;
15 import org.opendaylight.yangtools.yang.common.Revision;
16
17 public final class DefinitionGeneratorTest extends AbstractApiDocTest {
18     @Test
19     public void testConvertToJsonSchema() throws IOException {
20         final var module = CONTEXT.findModule("opflex", Revision.of("2014-05-28")).orElseThrow();
21         final DefinitionGenerator generator = new DefinitionGenerator();
22         final ObjectNode jsonObject = generator.convertToJsonSchema(module, CONTEXT, new DefinitionNames(), true);
23         assertNotNull(jsonObject);
24     }
25
26     @Test
27     public void testActionTypes() throws IOException {
28         final var module = CONTEXT.findModule("action-types").orElseThrow();
29         final DefinitionGenerator generator = new DefinitionGenerator();
30         final ObjectNode jsonObject = generator.convertToJsonSchema(module, CONTEXT, new DefinitionNames(), true);
31         assertNotNull(jsonObject);
32     }
33
34     @Test
35     public void testStringTypes() throws IOException {
36         final var module = CONTEXT.findModule("string-types").orElseThrow();
37         final DefinitionGenerator generator = new DefinitionGenerator();
38         final ObjectNode jsonObject = generator.convertToJsonSchema(module, CONTEXT, new DefinitionNames(), true);
39         assertNotNull(jsonObject);
40     }
41 }