2 * Copyright (c) 2014, 2015 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.controller.sal.rest.doc.impl;
10 import static org.junit.Assert.assertNotNull;
12 import com.fasterxml.jackson.databind.node.ObjectNode;
13 import java.io.IOException;
14 import org.junit.Test;
15 import org.opendaylight.netconf.sal.rest.doc.impl.ApiDocServiceImpl;
16 import org.opendaylight.netconf.sal.rest.doc.impl.DefinitionGenerator;
17 import org.opendaylight.netconf.sal.rest.doc.impl.DefinitionNames;
18 import org.opendaylight.yangtools.yang.common.Revision;
20 public final class SwaggerObjectTest extends AbstractApiDocTest {
22 public void testConvertToJsonSchema() throws IOException {
23 final var module = CONTEXT.findModule("opflex", Revision.of("2014-05-28")).orElseThrow();
24 final DefinitionGenerator generator = new DefinitionGenerator();
25 final ObjectNode jsonObject = generator.convertToJsonSchema(module, CONTEXT, new DefinitionNames(),
26 ApiDocServiceImpl.OAversion.V2_0, true);
27 assertNotNull(jsonObject);
31 public void testActionTypes() throws IOException {
32 final var module = CONTEXT.findModule("action-types").orElseThrow();
33 final DefinitionGenerator generator = new DefinitionGenerator();
34 final ObjectNode jsonObject = generator.convertToJsonSchema(module, CONTEXT, new DefinitionNames(),
35 ApiDocServiceImpl.OAversion.V2_0, true);
36 assertNotNull(jsonObject);
40 public void testStringTypes() throws IOException {
41 final var module = CONTEXT.findModule("string-types").orElseThrow();
42 final DefinitionGenerator generator = new DefinitionGenerator();
43 final ObjectNode jsonObject = generator.convertToJsonSchema(module, CONTEXT, new DefinitionNames(),
44 ApiDocServiceImpl.OAversion.V2_0, true);
45 assertNotNull(jsonObject);