Commit ef729f1b authored by Piotr Gawron's avatar Piotr Gawron
Browse files

documentation for mesh API calls

parent 4932908c
Pipeline #31504 passed with stage
in 15 minutes and 33 seconds
= Rest API Documentation - Mesh
Piotr Gawron
v{project-version} {build-time}
:toc: left
:sectnums:
== Get info about mesh term
=== CURL sample
include::{snippets}/mesh/get_mesh/curl-request.adoc[]
=== Path Parameters
include::{snippets}/mesh/get_mesh/path-parameters.adoc[]
=== Response Fields
include::{snippets}/mesh/get_mesh/response-fields.adoc[]
=== Sample Response
include::{snippets}/mesh/get_mesh/response-body.adoc[]
......@@ -18,6 +18,7 @@ import org.junit.runners.Suite.SuiteClasses;
GenomicsControllerIntegrationTest.class,
MapControllerIntegrationTest.class,
MapControllerIntegrationTestWithoutTransaction.class,
MeshControllerIntegrationTest.class,
MiRnaControllerIntegrationTest.class,
OverlayControllerIntegrationTest.class,
OverlayControllerIntegrationTestWithoutTransaction.class,
......
package lcsb.mapviewer.web;
import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.document;
import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.get;
import static org.springframework.restdocs.payload.PayloadDocumentation.fieldWithPath;
import static org.springframework.restdocs.payload.PayloadDocumentation.responseFields;
import static org.springframework.restdocs.request.RequestDocumentation.parameterWithName;
import static org.springframework.restdocs.request.RequestDocumentation.pathParameters;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.junit.*;
import org.junit.runner.RunWith;
import org.springframework.test.annotation.Rollback;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.web.servlet.RequestBuilder;
import org.springframework.transaction.annotation.Transactional;
@RunWith(SpringJUnit4ClassRunner.class)
@Transactional
@Rollback
public class MeshControllerIntegrationTest extends ControllerIntegrationTest {
Logger logger = LogManager.getLogger();
@Before
public void setup() {
}
@After
public void tearDown() {
}
@Test
public void testGetTaxonomies() throws Exception {
RequestBuilder request = get("/mesh/{meshId}", "D002095");
mockMvc.perform(request)
.andDo(document("mesh/get_mesh",
pathParameters(parameterWithName("meshId").description("mesh id")),
responseFields(
fieldWithPath("name")
.description("name")
.type("String"),
fieldWithPath("description")
.description("description")
.type("String"),
fieldWithPath("synonyms")
.description("list of synonyms")
.type("Array"),
fieldWithPath("id")
.description("mesh id")
.type("String"))))
.andExpect(status().is2xxSuccessful());
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment