1 package org.opendaylight.controller.sal.rest.doc.impl;
3 import com.google.common.base.Preconditions;
4 import org.json.JSONObject;
5 import org.junit.Assert;
6 import org.junit.Before;
8 import org.opendaylight.yangtools.yang.model.api.Module;
9 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
10 import org.opendaylight.yangtools.yang.parser.impl.YangParserImpl;
13 import java.util.HashSet;
17 public class ModelGeneratorTest {
19 private DocGenTestHelper helper;
20 private SchemaContext schemaContext;
23 public void setUp() throws Exception {
24 helper = new DocGenTestHelper();
26 schemaContext = new YangParserImpl().resolveSchemaContext(new HashSet<Module>(helper.getModules().values()));
30 public void testConvertToJsonSchema() throws Exception {
32 Preconditions.checkArgument(helper.getModules() != null, "No modules found");
34 ModelGenerator generator = new ModelGenerator();
36 for (Map.Entry<File, Module> m : helper.getModules().entrySet()) {
37 if (m.getKey().getAbsolutePath().endsWith("opflex.yang")) {
39 JSONObject jsonObject = generator.convertToJsonSchema(m.getValue(), schemaContext);
40 Assert.assertNotNull(jsonObject);