X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;ds=sidebyside;f=opendaylight%2Fmd-sal%2Fsal-rest-docgen%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Frest%2Fdoc%2Fimpl%2FDocGeneratorTest.java;fp=opendaylight%2Fmd-sal%2Fsal-rest-docgen%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Frest%2Fdoc%2Fimpl%2FDocGeneratorTest.java;h=0000000000000000000000000000000000000000;hb=237c0e41ac33d7b3367b8e1a038bfba4c6431610;hp=264bc67004b58cfd8381f18ff7cf3b0d811e07fb;hpb=f6609a5ab258b69a0d8ae2a97ee140b4da3b82ba;p=controller.git diff --git a/opendaylight/md-sal/sal-rest-docgen/src/test/java/org/opendaylight/controller/sal/rest/doc/impl/DocGeneratorTest.java b/opendaylight/md-sal/sal-rest-docgen/src/test/java/org/opendaylight/controller/sal/rest/doc/impl/DocGeneratorTest.java deleted file mode 100644 index 264bc67004..0000000000 --- a/opendaylight/md-sal/sal-rest-docgen/src/test/java/org/opendaylight/controller/sal/rest/doc/impl/DocGeneratorTest.java +++ /dev/null @@ -1,72 +0,0 @@ -package org.opendaylight.controller.sal.rest.doc.impl; - -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.datatype.jsonorg.JsonOrgModule; -import com.google.common.base.Preconditions; -import junit.framework.Assert; -import org.junit.Test; -import org.junit.Before; -import org.junit.After; -import org.opendaylight.controller.sal.rest.doc.swagger.ApiDeclaration; -import org.opendaylight.yangtools.yang.model.api.Module; -import org.opendaylight.yangtools.yang.model.parser.api.YangModelParser; -import org.opendaylight.yangtools.yang.parser.impl.YangParserImpl; - -import java.io.File; -import java.io.FileNotFoundException; -import java.net.URI; -import java.net.URISyntaxException; -import java.util.ArrayList; -import java.util.List; -import java.util.Set; - -/** - * - */ -public class DocGeneratorTest { - - private Set modules; - private ObjectMapper mapper; - - public Set loadModules(String resourceDirectory) throws FileNotFoundException, URISyntaxException { - - URI resourceDirUri = getClass().getResource(resourceDirectory).toURI(); - final YangModelParser parser = new YangParserImpl(); - final File testDir = new File(resourceDirUri); - final String[] fileList = testDir.list(); - final List testFiles = new ArrayList<>(); - if (fileList == null) { - throw new FileNotFoundException(resourceDirectory.toString()); - } - for (String fileName : fileList) { - - testFiles.add(new File(testDir, fileName)); - } - return parser.parseYangModels(testFiles); - } - - @Before - public void before() throws Exception { - modules = loadModules("/yang"); - mapper = new ObjectMapper(); - mapper.registerModule(new JsonOrgModule()); - } - - @After - public void after() throws Exception { - } - - /** - * Method: getApiDeclaration(String module, String revision, UriInfo uriInfo) - */ - @Test - public void testGetModuleDoc() throws Exception { - Preconditions.checkArgument(modules != null, "No modules found"); - - for (Module m : modules){ - ApiDeclaration doc = ApiDocGenerator.getInstance().getSwaggerDocSpec(m, "http://localhost:8080/restconf"); - Assert.assertNotNull(doc); - } - } - -}