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

documentation of get project logs API call

parent 52536797
Pipeline #20856 passed with stage
in 14 minutes and 32 seconds
......@@ -6,6 +6,8 @@ import java.util.Map;
import javax.servlet.ServletContext;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
......@@ -24,7 +26,7 @@ import lcsb.mapviewer.services.interfaces.IUserService;
@RestController
@RequestMapping(value = "/projects", produces = MediaType.APPLICATION_JSON_VALUE)
public class ProjectController extends BaseController {
private ServletContext context;
private ProjectRestImpl projectController;
private IUserService userService;
......
......@@ -107,3 +107,21 @@ include::{snippets}/projects/project_data/get_source_file/curl-request.adoc[]
=== Sample Response
include::{snippets}/projects/project_data/get_source_file/response-body.adoc[]
== Get logs
Gets source file used to create the project.
=== Path Parameters
include::{snippets}/projects/project_data/get_project_logs/path-parameters.adoc[]
=== Request Parameters
include::{snippets}/projects/project_data/get_project_logs/request-parameters.adoc[]
=== Response Fields
include::{snippets}/projects/project_data/get_project_logs/response-fields.adoc[]
=== CURL sample
include::{snippets}/projects/project_data/get_project_logs/curl-request.adoc[]
=== Sample Response
include::{snippets}/projects/project_data/get_project_logs/response-body.adoc[]
......@@ -975,6 +975,7 @@ public class OverlayControllerIntegrationTest extends ControllerIntegrationTest
@Test
public void testDeprecatedOverlayInformation() throws Exception {
@SuppressWarnings("deprecation")
Layout overlay = createOverlay(null,
"elementIdentifier\t" + ColorSchemaColumn.REACTION_IDENTIFIER + "\tvalue\n\t\t-1");
overlay.setPublicLayout(true);
......
......@@ -4,8 +4,7 @@ import static org.junit.Assert.*;
import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.document;
import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.*;
import static org.springframework.restdocs.payload.PayloadDocumentation.*;
import static org.springframework.restdocs.request.RequestDocumentation.parameterWithName;
import static org.springframework.restdocs.request.RequestDocumentation.pathParameters;
import static org.springframework.restdocs.request.RequestDocumentation.*;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
import java.util.Arrays;
......@@ -147,10 +146,37 @@ public class ProjectControllerIntegrationTest extends ControllerIntegrationTest
MockHttpSession session = createSession(CURATOR_LOGIN, CURATOR_PASSWORD);
RequestBuilder request = get("/projects/" + TEST_PROJECT + "/logs/")
.session(session);
RequestBuilder request = get(
"/projects/{projectId}/logs/?start=0&length=5&level=warning&sortColumn=id&sortOrder=asc&search=age",
TEST_PROJECT).session(session);
mockMvc.perform(request)
.andDo(document("projects/project_data/get_project_logs",
requestParameters(
parameterWithName("start").description("number of first entry in this response"),
parameterWithName("sortColumn").description("log entry column that should be used for sorting (default: id)"),
parameterWithName("sortOrder").description("log entry sort order (asc, desc)"),
parameterWithName("level").description("level of log entry (warning, error)"),
parameterWithName("length").description("number of log entres we want to obtain"),
parameterWithName("search").description("search query used for filtering")
),
pathParameters(parameterWithName("projectId").description("project identifier")),
responseFields(
subsectionWithPath("data")
.description("list of log entries")
.type("Array<LogEntry>"),
fieldWithPath("filteredSize")
.description("number of entries that match filter criteria")
.type("number"),
fieldWithPath("length")
.description("number of entries in this response")
.type("number"),
fieldWithPath("start")
.description("number of first entry in this response")
.type("number"),
fieldWithPath("totalSize")
.description("number of all log entries")
.type("number"))))
.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