TSK-1687: Added Rest Docs for WorkbasketPriorityReport

This commit is contained in:
Tristan 2021-08-31 15:56:42 +02:00 committed by Mustapha Zorgati
parent 601ce19643
commit 37209776af
4 changed files with 22 additions and 18 deletions

View File

@ -138,6 +138,7 @@ include::{snippets}/WorkbasketAccessItemControllerRestDocTest/removeWorkbasketAc
== Monitoring Resources == Monitoring Resources
include::{snippets}/MonitorControllerRestDocTest/computeWorkbasketReportDocTest/auto-section.adoc[] include::{snippets}/MonitorControllerRestDocTest/computeWorkbasketReportDocTest/auto-section.adoc[]
include::{snippets}/MonitorControllerRestDocTest/computeWorkbasketPriorityReportDocTest/auto-section.adoc[]
include::{snippets}/MonitorControllerRestDocTest/computeClassificationCategoryReportDocTest/auto-section.adoc[] include::{snippets}/MonitorControllerRestDocTest/computeClassificationCategoryReportDocTest/auto-section.adoc[]
include::{snippets}/MonitorControllerRestDocTest/computeClassificationReportDocTest/auto-section.adoc[] include::{snippets}/MonitorControllerRestDocTest/computeClassificationReportDocTest/auto-section.adoc[]
include::{snippets}/MonitorControllerRestDocTest/computeDetailedClassificationReportDocTest/auto-section.adoc[] include::{snippets}/MonitorControllerRestDocTest/computeDetailedClassificationReportDocTest/auto-section.adoc[]

View File

@ -82,28 +82,23 @@ public class MonitorController {
} }
/** /**
* This endpoint generates a Workbasket Report by priority. This Report currently * This endpoint generates a Workbasket Report by priority ranges.
* *
* <p>Each Row represents a Workbasket. * <p>Each Row represents a Workbasket.
* *
* <p>Each Column Header represents a priority range. <br> * <p>Each Column Header represents a priority range. <br>
* <br> * <br>
* *
* <table> * <p><b>Default ranges</b>
* <caption><b>Default ranges</b></caption>
* <tr>
* <td> high </td> <td>priority &gt; 500</td>
* </tr>
* <tr>
* <td> medium </td> <td> 250 &ge; priority &le; 500</td>
* </tr>
* <tr>
* <td> low </td> <td> priority &lt; 250</td>
* </tr>
* </table>
* *
* @title Compute a Workbasket Report * <p>High: priority &gt; 500
* @param workbasketTypes determine the {@linkplain WorkbasketType}s to include in the report *
* <p>Medium: 250 &ge; priority &le; 500
*
* <p>Low: priority &lt; 250
*
* @title Compute a Workbasket Priority Report
* @param workbasketTypes determine the WorkbasketTypes to include in the report
* @return the computed Report * @return the computed Report
* @throws NotAuthorizedException if the current user is not authorized to compute the Report * @throws NotAuthorizedException if the current user is not authorized to compute the Report
* @throws InvalidArgumentException if topicWorkbaskets or useDefaultValues are false * @throws InvalidArgumentException if topicWorkbaskets or useDefaultValues are false
@ -111,7 +106,7 @@ public class MonitorController {
@GetMapping(path = RestEndpoints.URL_MONITOR_WORKBASKET_PRIORITY_REPORT) @GetMapping(path = RestEndpoints.URL_MONITOR_WORKBASKET_PRIORITY_REPORT)
@Transactional(readOnly = true, rollbackFor = Exception.class) @Transactional(readOnly = true, rollbackFor = Exception.class)
public ResponseEntity<ReportRepresentationModel> computePriorityWorkbasketReport( public ResponseEntity<ReportRepresentationModel> computePriorityWorkbasketReport(
@RequestParam(name = "workbasket-types", required = false) WorkbasketType[] workbasketTypes) @RequestParam(name = "workbasket-type", required = false) WorkbasketType[] workbasketTypes)
throws NotAuthorizedException, InvalidArgumentException { throws NotAuthorizedException, InvalidArgumentException {
WorkbasketPriorityReport.Builder builder = WorkbasketPriorityReport.Builder builder =
@ -318,7 +313,7 @@ public class MonitorController {
* *
* <p>Each Column Header represents a TimeInterval. * <p>Each Column Header represents a TimeInterval.
* *
* @title Get a Timestamp Report * @title Compute a Timestamp Report
* @param filterParameter the filter parameter * @param filterParameter the filter parameter
* @param timestamps Filter by the Task Timestamp of the task * @param timestamps Filter by the Task Timestamp of the task
* @return the computed report * @return the computed report

View File

@ -109,7 +109,7 @@ class MonitorControllerIntTest {
void should_ComputeReport_When_QueryingForAWorkbasketPriorityReport() { void should_ComputeReport_When_QueryingForAWorkbasketPriorityReport() {
String url = String url =
restHelper.toUrl(RestEndpoints.URL_MONITOR_WORKBASKET_PRIORITY_REPORT) restHelper.toUrl(RestEndpoints.URL_MONITOR_WORKBASKET_PRIORITY_REPORT)
+ "?workbasket-types=TOPIC,GROUP"; + "?workbasket-type=TOPIC,GROUP";
HttpEntity<?> auth = new HttpEntity<>(RestHelper.generateHeadersForUser("monitor")); HttpEntity<?> auth = new HttpEntity<>(RestHelper.generateHeadersForUser("monitor"));
ResponseEntity<ReportRepresentationModel> response = ResponseEntity<ReportRepresentationModel> response =

View File

@ -20,6 +20,14 @@ class MonitorControllerRestDocTest extends BaseRestDocTest {
.andExpect(MockMvcResultMatchers.status().isOk()); .andExpect(MockMvcResultMatchers.status().isOk());
} }
@Test
void computeWorkbasketPriorityReportDocTest() throws Exception {
mockMvc
.perform(
get(RestEndpoints.URL_MONITOR_WORKBASKET_PRIORITY_REPORT + "?workbasket-type=GROUP"))
.andExpect(MockMvcResultMatchers.status().isOk());
}
@Test @Test
void computeClassificationCategoryReportDocTest() throws Exception { void computeClassificationCategoryReportDocTest() throws Exception {
mockMvc mockMvc