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

docs for get overlay bioEntites API calls

parent 6fdf8c65
......@@ -115,7 +115,6 @@ abstract public class ControllerIntegrationTest {
private String dapiLogin;
private String dapiPassword;
@Autowired
private ChemicalRestImpl chemicalRestImpl;
......@@ -545,6 +544,10 @@ abstract public class ControllerIntegrationTest {
return getProjectPathParameters().and(parameterWithName("overlayId").description("overlay identifier"));
}
protected PathParametersSnippet getOverlayMapPathParameters() {
return getMapPathParameters().and(parameterWithName("overlayId").description("overlay identifier"));
}
protected RequestParametersSnippet getChemicalFilter() {
return requestParameters(
parameterWithName("columns")
......@@ -559,5 +562,4 @@ abstract public class ControllerIntegrationTest {
.optional());
}
}
......@@ -273,10 +273,13 @@ public class OverlayControllerIntegrationTest extends ControllerIntegrationTest
MockHttpSession session = createSession(BUILT_IN_TEST_ADMIN_LOGIN, BUILT_IN_TEST_ADMIN_PASSWORD);
RequestBuilder request = get("/projects/" + TEST_PROJECT + "/overlays/" + overlay.getId() + "/")
RequestBuilder request = get("/projects/{projectId}/overlays/{overlayId}/", TEST_PROJECT, overlay.getId())
.session(session);
mockMvc.perform(request)
.andDo(document("projects/project_overlays/get_by_id",
getOverlayPathParameters(),
responseFields(overlayFields())))
.andExpect(status().is2xxSuccessful());
}
......@@ -337,11 +340,15 @@ public class OverlayControllerIntegrationTest extends ControllerIntegrationTest
MockHttpSession session = createSession(BUILT_IN_TEST_ADMIN_LOGIN, BUILT_IN_TEST_ADMIN_PASSWORD);
RequestBuilder request = get(
"/projects/" + TEST_PROJECT + "/overlays/" + overlay.getId() + "/models/" + map.getId() + "/bioEntities/")
"/projects/{projectId}/overlays/{overlayId}/models/{mapId}/bioEntities/",
TEST_PROJECT, overlay.getId(), map.getId())
.session(session);
String response = mockMvc.perform(request)
.andExpect(status().is2xxSuccessful())
.andDo(document("projects/project_overlays/get_bio_entities",
getOverlayMapPathParameters(),
listOfOverlayBioEntitiesFields()))
.andReturn().getResponse().getContentAsString();
int count = map.getElements().size() + map.getReactions().size();
......@@ -397,7 +404,7 @@ public class OverlayControllerIntegrationTest extends ControllerIntegrationTest
}
@Test
public void testGetReactionsForOverlay() throws Exception {
public void testGetReactionForOverlay() throws Exception {
User admin = userService.getUserByLogin(BUILT_IN_TEST_ADMIN_LOGIN);
Layout overlay = createOverlay(admin);
......@@ -405,12 +412,16 @@ public class OverlayControllerIntegrationTest extends ControllerIntegrationTest
MockHttpSession session = createSession(BUILT_IN_TEST_ADMIN_LOGIN, BUILT_IN_TEST_ADMIN_PASSWORD);
RequestBuilder request = get(
"/projects/" + TEST_PROJECT + "/overlays/" + overlay.getId() + "/models/" + map.getId()
+ "/bioEntities/reactions/" + reaction.getId() + "/")
.session(session);
"/projects/{projectId}/overlays/{overlayId}/models/{mapId}/bioEntities/reactions/{reactionId}/",
TEST_PROJECT, overlay.getId(), map.getId(), reaction.getId())
.session(session);
mockMvc.perform(request)
.andExpect(status().is2xxSuccessful());
.andDo(document("projects/project_overlays/get_reaction",
getOverlayMapPathParameters().and(parameterWithName("reactionId").description("reaction identifier")),
responseFields(overlayBioEntityFields())))
.andExpect(status().is2xxSuccessful())
.andReturn().getResponse().getContentAsString();
}
@Test
......@@ -458,11 +469,14 @@ public class OverlayControllerIntegrationTest extends ControllerIntegrationTest
MockHttpSession session = createSession(BUILT_IN_TEST_ADMIN_LOGIN, BUILT_IN_TEST_ADMIN_PASSWORD);
RequestBuilder request = get(
"/projects/" + TEST_PROJECT + "/overlays/" + overlay.getId() + "/models/" + map.getId()
+ "/bioEntities/elements/" + element.getId() + "/")
.session(session);
"/projects/{projectId}/overlays/{overlayId}/models/{mapId}/bioEntities/elements/{elementId}/",
TEST_PROJECT, overlay.getId(), map.getId(), element.getId())
.session(session);
mockMvc.perform(request)
.andDo(document("projects/project_overlays/get_element",
getOverlayMapPathParameters().and(parameterWithName("elementId").description("element identifier")),
responseFields(overlayBioEntityFields())))
.andExpect(status().is2xxSuccessful());
}
......@@ -1387,4 +1401,48 @@ public class OverlayControllerIntegrationTest extends ControllerIntegrationTest
return requestFields().andWithPrefix("overlay.", fields);
}
private ResponseFieldsSnippet listOfOverlayBioEntitiesFields() {
return responseFields().andWithPrefix("[].", overlayBioEntityFields());
}
private List<FieldDescriptor> overlayBioEntityFields() {
return Arrays.asList(
fieldWithPath("type")
.description("type of bioEntity (ALIAS/REACTION)")
.type("string"),
fieldWithPath("overlayContent.idObject")
.description("identifier of the bioEntity")
.type("number"),
fieldWithPath("overlayContent.uniqueId")
.description("identifier of the bioEntity")
.type("number")
.ignored(),
fieldWithPath("overlayContent.modelId")
.description("map identifier where bioEntity is located")
.type("number"),
fieldWithPath("overlayContent.value")
.description("normalized value assigned to the bioEntity from overlay")
.type("number"),
fieldWithPath("overlayContent.color")
.description("color assigned to the bioEntity from overlay")
.type("string"),
fieldWithPath("overlayContent.description")
.description("description assigned to the bioEntity from overlay")
.type("string")
.optional(),
fieldWithPath("overlayContent.geneVariations")
.description("list of gene variants assigned to the bioEntity from overlay")
.type("string")
.optional(),
fieldWithPath("overlayContent.type")
.description("type of data overlay")
.type("string")
.optional()
.ignored(),
fieldWithPath("overlayContent.width")
.description("line width of reaction bioEntity assigned to the bioEntity from overlay")
.type("number")
.optional());
}
}
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