From de57596ba8e816d3e751b21c949a3fe132b314f0 Mon Sep 17 00:00:00 2001 From: Mustapha Zorgati <15628173+mustaphazorgati@users.noreply.github.com> Date: Thu, 3 Dec 2020 03:24:21 +0100 Subject: [PATCH] TSK-1436: reworked review comments. --- .../taskana/common/test/rest/RestHelper.java | 12 +- .../common/test/rest/WebSecurityConfig.java | 4 +- .../impl/TaskHistoryQueryImpl.java | 5 + .../impl/task/TaskHistoryQuery.java | 9 + .../query/QueryTaskHistoryAccTest.java | 27 +++ .../docs/asciidoc/simplehistory-rest-api.adoc | 6 +- .../rest/HistoryRestEndpoints.java | 2 +- .../rest/TaskHistoryEventController.java | 6 +- .../rest/TaskHistoryQueryFilterParameter.java | 160 +++++++---------- .../TaskHistoryEventRepresentationModel.java | 18 +- .../TaskHistoryEventControllerIntTest.java | 169 +++++++++++++----- ...yEventControllerRestDocumentationTest.java | 11 +- .../api/ClassificationService.java | 4 +- .../java/pro/taskana/task/api/TaskQuery.java | 2 +- .../pro/taskana/task/api/TaskService.java | 13 +- .../workbasket/api/WorkbasketService.java | 4 +- .../acceptance/task/CancelTaskAccTest.java | 2 +- .../ObjectAttributeChangeDetectorTest.java | 2 +- .../security/BootWebSecurityConfigurer.java | 5 +- .../taskana/TaskanaWildFlyApplication.java | 1 - .../taskana/TaskanaWildflyConfiguration.java | 2 +- .../WildflyWebSecurityConfigurer.java | 1 - .../java/pro/taskana/AbstractAccTest.java | 23 ++- .../java/pro/taskana/TaskanaWildflyTest.java | 36 ++-- .../src/docs/asciidoc/rest-api.adoc | 3 +- .../rest/ClassificationController.java | 11 +- .../ClassificationDefinitionController.java | 2 +- .../ClassificationQueryFilterParameter.java | 62 +++---- ...ssificationSummaryRepresentationModel.java | 2 +- .../common/rest/AccessIdController.java | 6 +- .../common/rest/QuerySortParameter.java | 2 +- .../common/rest/TaskanaEngineController.java | 1 - .../models/AccessIdRepresentationModel.java | 18 +- .../common/rest/models/PageMetadata.java | 34 ++++ .../TaskanaUserInfoRepresentationModel.java | 5 +- .../models/VersionRepresentationModel.java | 7 +- .../monitor/rest/MonitorController.java | 24 +-- .../models/ReportRepresentationModel.java | 16 +- .../task/rest/TaskCommentController.java | 36 ++-- .../pro/taskana/task/rest/TaskController.java | 41 ++--- .../task/rest/TaskQueryFilterParameter.java | 38 ++-- .../models/AttachmentRepresentationModel.java | 2 +- .../ObjectReferenceRepresentationModel.java | 8 +- .../rest/models/TaskRepresentationModel.java | 2 +- .../TaskSummaryRepresentationModel.java | 2 +- .../rest/WorkbasketAccessItemController.java | 2 +- ...kbasketAccessItemQueryFilterParameter.java | 8 +- .../workbasket/rest/WorkbasketController.java | 29 ++- .../rest/WorkbasketQueryFilterParameter.java | 20 +-- .../models/WorkbasketRepresentationModel.java | 2 +- ...cationControllerRestDocumentationTest.java | 28 +-- ...nitionControllerRestDocumentationTest.java | 4 +- ...cessIdControllerRestDocumentationTest.java | 4 +- .../common/rest/QuerySortParameterTest.java | 20 +-- ...e.java => SchemaNameCustomizableTest.java} | 2 +- ...EngineControllerRestDocumentationTest.java | 7 + .../common/rest/WebSecurityConfigurer.java | 1 - .../models/ReportRepresentationModelTest.java | 10 +- 58 files changed, 542 insertions(+), 441 deletions(-) rename rest/taskana-rest-spring/src/test/java/pro/taskana/common/rest/{TestSchemaNameCustomizable.java => SchemaNameCustomizableTest.java} (98%) diff --git a/common/taskana-common-test/src/main/java/pro/taskana/common/test/rest/RestHelper.java b/common/taskana-common-test/src/main/java/pro/taskana/common/test/rest/RestHelper.java index a663f3de4..218cea038 100644 --- a/common/taskana-common-test/src/main/java/pro/taskana/common/test/rest/RestHelper.java +++ b/common/taskana-common-test/src/main/java/pro/taskana/common/test/rest/RestHelper.java @@ -47,12 +47,12 @@ public class RestHelper { public String toUrl(String relativeUrl, Object... uriVariables) { return UriComponentsBuilder.fromPath(relativeUrl) - .scheme("http") - .host("127.0.0.1") - .port(getPort()) - .build(false) - .expand(uriVariables) - .toString(); + .scheme("http") + .host("127.0.0.1") + .port(getPort()) + .build(false) + .expand(uriVariables) + .toString(); } public HttpEntity defaultRequest() { diff --git a/common/taskana-common-test/src/main/java/pro/taskana/common/test/rest/WebSecurityConfig.java b/common/taskana-common-test/src/main/java/pro/taskana/common/test/rest/WebSecurityConfig.java index 9552f0052..8b02270d5 100644 --- a/common/taskana-common-test/src/main/java/pro/taskana/common/test/rest/WebSecurityConfig.java +++ b/common/taskana-common-test/src/main/java/pro/taskana/common/test/rest/WebSecurityConfig.java @@ -21,9 +21,7 @@ import org.springframework.web.filter.CorsFilter; import org.springframework.web.servlet.config.annotation.CorsRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; -/** - * Default basic configuration for taskana web example. - */ +/** Default basic configuration for taskana web example. */ @Configuration public class WebSecurityConfig { diff --git a/history/taskana-simplehistory-provider/src/main/java/pro/taskana/simplehistory/impl/TaskHistoryQueryImpl.java b/history/taskana-simplehistory-provider/src/main/java/pro/taskana/simplehistory/impl/TaskHistoryQueryImpl.java index f874dc9b1..d36681369 100644 --- a/history/taskana-simplehistory-provider/src/main/java/pro/taskana/simplehistory/impl/TaskHistoryQueryImpl.java +++ b/history/taskana-simplehistory-provider/src/main/java/pro/taskana/simplehistory/impl/TaskHistoryQueryImpl.java @@ -522,6 +522,11 @@ public class TaskHistoryQueryImpl implements TaskHistoryQuery { return this; } + @Override + public TaskHistoryQuery orderByTaskHistoryEventId(SortDirection sortDirection) { + return addOrderCriteria("ID", sortDirection); + } + @Override public TaskHistoryQuery orderByBusinessProcessId(SortDirection sortDirection) { return addOrderCriteria("BUSINESS_PROCESS_ID", sortDirection); diff --git a/history/taskana-simplehistory-provider/src/main/java/pro/taskana/simplehistory/impl/task/TaskHistoryQuery.java b/history/taskana-simplehistory-provider/src/main/java/pro/taskana/simplehistory/impl/task/TaskHistoryQuery.java index 5429a581c..a0b67e43e 100644 --- a/history/taskana-simplehistory-provider/src/main/java/pro/taskana/simplehistory/impl/task/TaskHistoryQuery.java +++ b/history/taskana-simplehistory-provider/src/main/java/pro/taskana/simplehistory/impl/task/TaskHistoryQuery.java @@ -335,6 +335,15 @@ public interface TaskHistoryQuery extends BaseQuery events = + getHistoryService() + .createTaskHistoryQuery() + .orderByTaskHistoryEventId(SortDirection.ASCENDING) + .list(); + + assertThat(events) + .extracting(TaskHistoryEvent::getId) + .isSortedAccordingTo(CASE_INSENSITIVE_ORDER); + } + + @Test + void should_SortQueryByIdDesc_When_Requested() { + List events = + getHistoryService() + .createTaskHistoryQuery() + .orderByTaskHistoryEventId(SortDirection.DESCENDING) + .list(); + + assertThat(events) + .extracting(TaskHistoryEvent::getId) + .isSortedAccordingTo(CASE_INSENSITIVE_ORDER.reversed()); + } + @Test void should_ReturnHistoryEvents_For_DifferentInAttributes() { List returnValues = diff --git a/history/taskana-simplehistory-rest-spring/src/docs/asciidoc/simplehistory-rest-api.adoc b/history/taskana-simplehistory-rest-spring/src/docs/asciidoc/simplehistory-rest-api.adoc index 97134b7e0..651e6b3f1 100644 --- a/history/taskana-simplehistory-rest-spring/src/docs/asciidoc/simplehistory-rest-api.adoc +++ b/history/taskana-simplehistory-rest-spring/src/docs/asciidoc/simplehistory-rest-api.adoc @@ -1,7 +1,7 @@ = TASKANA History module RESTful API Documentation == Overview -This is the REST documentation for http://taskana.pro)[TASKANA]'s simplehistory REST Endpoints. +This is the REST documentation for http://taskana.pro)[TASKANA]'s simplehistory REST endpoints. For all Query Parameters:: whenever a parameter is an array type multiple values can be passed by declaring that parameter multiple times. @@ -13,9 +13,9 @@ Please have a look at example responses for each resource to determine the avail TASKANA uses the https://restfulapi.net/hateoas/)[HATEOAS] (Hypermedia as the Engine of Application State) REST constraint. Most of our resources contain a `_links` section which contains navigation links. These navigation links not only help navigate through our REST API, they encapsulate API. -Using HATEOAS allows us to change some Endpoints without breaking any frontend. +Using HATEOAS allows us to change some endpoints without breaking any frontend. == History event -include::{snippets}/TaskHistoryEventControllerRestDocumentationTest/getAllTaskHistoryEventDocTest/auto-section.adoc[] +include::{snippets}/TaskHistoryEventControllerRestDocumentationTest/getAllTaskHistoryEventsDocTest/auto-section.adoc[] include::{snippets}/TaskHistoryEventControllerRestDocumentationTest/getSpecificTaskHistoryEventDocTest/auto-section.adoc[] \ No newline at end of file diff --git a/history/taskana-simplehistory-rest-spring/src/main/java/pro/taskana/simplehistory/rest/HistoryRestEndpoints.java b/history/taskana-simplehistory-rest-spring/src/main/java/pro/taskana/simplehistory/rest/HistoryRestEndpoints.java index cf2b71cd6..0a31b4da5 100644 --- a/history/taskana-simplehistory-rest-spring/src/main/java/pro/taskana/simplehistory/rest/HistoryRestEndpoints.java +++ b/history/taskana-simplehistory-rest-spring/src/main/java/pro/taskana/simplehistory/rest/HistoryRestEndpoints.java @@ -7,5 +7,5 @@ public class HistoryRestEndpoints { public static final String URL_HISTORY_EVENTS = API_V1 + "task-history-event"; public static final String URL_HISTORY_EVENTS_ID = API_V1 + "task-history-event/{historyEventId}"; - private HistoryRestEndpoints(){} + private HistoryRestEndpoints() {} } diff --git a/history/taskana-simplehistory-rest-spring/src/main/java/pro/taskana/simplehistory/rest/TaskHistoryEventController.java b/history/taskana-simplehistory-rest-spring/src/main/java/pro/taskana/simplehistory/rest/TaskHistoryEventController.java index 13b4c31af..78ff4775c 100644 --- a/history/taskana-simplehistory-rest-spring/src/main/java/pro/taskana/simplehistory/rest/TaskHistoryEventController.java +++ b/history/taskana-simplehistory-rest-spring/src/main/java/pro/taskana/simplehistory/rest/TaskHistoryEventController.java @@ -87,12 +87,13 @@ public class TaskHistoryEventController { } /** - * This endpoints retrieves a single Task History Event. + * This endpoint retrieves a single Task History Event. * * @title Get a single Task History Event * @param historyEventId the id of the requested Task History Event. * @return the requested Task History Event - * @throws TaskanaHistoryEventNotFoundException if the provided Task History Event is not found. + * @throws TaskanaHistoryEventNotFoundException If a Task History Event can't be found by the + * provided historyEventId */ @GetMapping(path = HistoryRestEndpoints.URL_HISTORY_EVENTS_ID) @Transactional(readOnly = true, rollbackFor = Exception.class) @@ -117,6 +118,7 @@ public class TaskHistoryEventController { } public enum TaskHistoryQuerySortBy implements QuerySortBy { + TASK_HISTORY_EVENT_ID(TaskHistoryQuery::orderByTaskHistoryEventId), BUSINESS_PROCESS_ID(TaskHistoryQuery::orderByBusinessProcessId), PARENT_BUSINESS_PROCESS_ID(TaskHistoryQuery::orderByParentBusinessProcessId), TASK_ID(TaskHistoryQuery::orderByTaskId), diff --git a/history/taskana-simplehistory-rest-spring/src/main/java/pro/taskana/simplehistory/rest/TaskHistoryQueryFilterParameter.java b/history/taskana-simplehistory-rest-spring/src/main/java/pro/taskana/simplehistory/rest/TaskHistoryQueryFilterParameter.java index 506ba90cd..0d8c44d66 100644 --- a/history/taskana-simplehistory-rest-spring/src/main/java/pro/taskana/simplehistory/rest/TaskHistoryQueryFilterParameter.java +++ b/history/taskana-simplehistory-rest-spring/src/main/java/pro/taskana/simplehistory/rest/TaskHistoryQueryFilterParameter.java @@ -13,30 +13,26 @@ import pro.taskana.spi.history.api.events.task.TaskHistoryCustomField; public class TaskHistoryQueryFilterParameter implements QueryParameter { - /** - * Filter by the event type of the Task History Event. This is an exact match. - */ + /** Filter by the event type of the Task History Event. This is an exact match. */ @JsonProperty("event-type") private final String[] eventType; /** - * Filter by the event type of the Task History Event. This results into a substring search. (% is - * appended to the front and end of the requested value). Further SQL "Like" wildcard characters - * will be resolved correctly. + * Filter by the event type of the Task History Event. This results in a substring search.. (% is + * appended to the beginning and end of the requested value). Further SQL "Like" wildcard + * characters will be resolved correctly. */ @JsonProperty("event-type-like") private final String[] eventTypeLike; - /** - * Filter by the user id of the Task History Event. This is an exact match. - */ + /** Filter by the user id of the Task History Event. This is an exact match. */ @JsonProperty("user-id") private final String[] userId; /** - * Filter by the user id of the Task History Event. This results into a substring search. (% is - * appended to the front and end of the requested value). Further SQL "Like" wildcard characters - * will be resolved correctly. + * Filter by the user id of the Task History Event. This results in a substring search.. (% is + * appended to the beginning and end of the requested value). Further SQL "Like" wildcard + * characters will be resolved correctly. */ @JsonProperty("user-id-like") private final String[] userIdLike; @@ -49,62 +45,52 @@ public class TaskHistoryQueryFilterParameter implements QueryParameterThe format is ISO-8601. */ @@ -29,23 +29,23 @@ public class TaskHistoryEventRepresentationModel private String userId; /** Domain. */ private String domain; - /** The key of workbasket. */ + /** The key of the Workbasket. */ private String workbasketKey; - /** The company referenced primary object belongs to. */ + /** The company the referenced primary object belongs to. */ private String porCompany; - /** The type of the reference (contract, claim, policy, customer, ...). */ + /** The type of the referenced primary object (contract, claim, policy, customer, ...). */ private String porType; - /** The (kind of) system, the object resides in (e.g. SAP, MySystem A, ...). */ + /** The (kind of) system, the referenced primary object resides in (e.g. SAP, MySystem A, ...). */ private String porSystem; - /** The instance of the system, the object resides in. */ + /** The instance of the system, the referenced primary object resides in. */ private String porInstance; /** The value of the primary object reference. */ private String porValue; - /** The key of classification task. */ + /** The key of the task's classification. */ private String taskClassificationKey; - /** The category of classification. */ + /** The category of the task's classification. */ private String taskClassificationCategory; - /** The key of the task's attachment. */ + /** The classification key of the task's attachment. */ private String attachmentClassificationKey; /** The old value. */ private String oldValue; diff --git a/history/taskana-simplehistory-rest-spring/src/test/java/pro/taskana/simplehistory/rest/TaskHistoryEventControllerIntTest.java b/history/taskana-simplehistory-rest-spring/src/test/java/pro/taskana/simplehistory/rest/TaskHistoryEventControllerIntTest.java index 5bff3f059..c4d20fa54 100644 --- a/history/taskana-simplehistory-rest-spring/src/test/java/pro/taskana/simplehistory/rest/TaskHistoryEventControllerIntTest.java +++ b/history/taskana-simplehistory-rest-spring/src/test/java/pro/taskana/simplehistory/rest/TaskHistoryEventControllerIntTest.java @@ -1,12 +1,12 @@ package pro.taskana.simplehistory.rest; +import static java.lang.String.CASE_INSENSITIVE_ORDER; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; import static pro.taskana.common.test.rest.RestHelper.TEMPLATE; import java.time.Instant; import java.time.LocalDate; -import java.time.LocalDateTime; import java.time.ZoneId; import org.assertj.core.api.ThrowableAssert.ThrowingCallable; import org.junit.jupiter.api.Disabled; @@ -19,7 +19,9 @@ import org.springframework.http.HttpMethod; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.client.HttpClientErrorException; +import org.springframework.web.util.UriComponentsBuilder; +import pro.taskana.common.rest.models.PageMetadata; import pro.taskana.common.test.rest.RestHelper; import pro.taskana.common.test.rest.TaskanaSpringBootTest; import pro.taskana.simplehistory.rest.models.TaskHistoryEventPagedRepresentationModel; @@ -36,8 +38,10 @@ class TaskHistoryEventControllerIntTest { this.restHelper = restHelper; } + // region Get Task History Events + @Test - void testGetAllHistoryEvent() { + void should_GetAllHistoryEvents_When_UrlIsVisited() { ResponseEntity response = TEMPLATE.exchange( restHelper.toUrl(HistoryRestEndpoints.URL_HISTORY_EVENTS), @@ -45,33 +49,29 @@ class TaskHistoryEventControllerIntTest { restHelper.defaultRequest(), ParameterizedTypeReference.forType(TaskHistoryEventPagedRepresentationModel.class)); assertThat(response.getBody()).isNotNull(); - assertThat(response.getBody().getLink(IanaLinkRelations.SELF)).isNotNull(); assertThat(response.getBody().getContent()).hasSize(45); } @Test - void testGetAllHistoryEventDescendingOrder() { - String parameters = "?sort-by=BUSINESS_PROCESS_ID&order=DESCENDING&page-size=3&page=1"; + void should_GenerateSelfLink_When_TaskHistoryEventsAreRequested() { ResponseEntity response = TEMPLATE.exchange( - restHelper.toUrl(HistoryRestEndpoints.URL_HISTORY_EVENTS + parameters), + restHelper.toUrl(HistoryRestEndpoints.URL_HISTORY_EVENTS), HttpMethod.GET, restHelper.defaultRequest(), ParameterizedTypeReference.forType(TaskHistoryEventPagedRepresentationModel.class)); assertThat(response.getBody()).isNotNull(); - assertThat(response.getBody().getContent()).hasSize(3); assertThat(response.getBody().getLink(IanaLinkRelations.SELF)) - .isNotNull() + .isPresent() .get() .extracting(Link::getHref) .asString() - .endsWith(parameters); + .endsWith(HistoryRestEndpoints.URL_HISTORY_EVENTS); } @Test - void should_ReturnSpecificTaskHistoryEventWithoutDetails_When_ListIsQueried() { - String parameters = - "?business-process-id=BPI:01" + "&sort-by=BUSINESS_PROCESS_ID&page-size=6&page=1"; + void should_ContainQueryParametersInComputedSelfLink_When_TaskHistoryEventsAreRequested() { + String parameters = "?domain=DOMAIN_A&domain=DOMAIN_B"; ResponseEntity response = TEMPLATE.exchange( restHelper.toUrl(HistoryRestEndpoints.URL_HISTORY_EVENTS + parameters), @@ -79,31 +79,47 @@ class TaskHistoryEventControllerIntTest { restHelper.defaultRequest(), ParameterizedTypeReference.forType(TaskHistoryEventPagedRepresentationModel.class)); assertThat(response.getBody()).isNotNull(); - assertThat(response.getBody().getLink(IanaLinkRelations.SELF)).isNotNull(); - assertThat(response.getBody().getPageMetadata()).isNotNull(); - assertThat(response.getBody().getContent()).hasSize(1); - assertThat(response.getBody().getContent().iterator().next().getDetails()).isNull(); + assertThat(response.getBody().getLink(IanaLinkRelations.SELF)) + .isPresent() + .get() + .extracting(Link::getHref) + .asString() + .endsWith(HistoryRestEndpoints.URL_HISTORY_EVENTS + parameters); } @Test - void should_ReturnSpecificTaskHistoryEventWithDetails_When_SingleEventIsQueried() { - ResponseEntity response = + void should_SortEventsByBusinessProcessIdDesc_When_SortByAndOrderQueryParametersAreDeclared() { + String parameters = "?sort-by=BUSINESS_PROCESS_ID&order=DESCENDING"; + ResponseEntity response = TEMPLATE.exchange( - restHelper.toUrl( - HistoryRestEndpoints.URL_HISTORY_EVENTS_ID, - "THI:000000000000000000000000000000000000"), + restHelper.toUrl(HistoryRestEndpoints.URL_HISTORY_EVENTS + parameters), HttpMethod.GET, restHelper.defaultRequest(), - ParameterizedTypeReference.forType(TaskHistoryEventRepresentationModel.class)); - + ParameterizedTypeReference.forType(TaskHistoryEventPagedRepresentationModel.class)); assertThat(response.getBody()).isNotNull(); - assertThat(response.getBody().getLink(IanaLinkRelations.SELF)).isNotNull(); - assertThat(response.getBody().getDetails()).isNotNull(); + assertThat(response.getBody().getContent()) + .extracting(TaskHistoryEventRepresentationModel::getBusinessProcessId) + .isSortedAccordingTo(CASE_INSENSITIVE_ORDER.reversed()); + } + + @Test + void should_ApplyBusinessProcessIdFilter_When_QueryParameterIsProvided() { + String parameters = "?business-process-id=BPI:01"; + ResponseEntity response = + TEMPLATE.exchange( + restHelper.toUrl(HistoryRestEndpoints.URL_HISTORY_EVENTS + parameters), + HttpMethod.GET, + restHelper.defaultRequest(), + ParameterizedTypeReference.forType(TaskHistoryEventPagedRepresentationModel.class)); + assertThat(response.getBody()).isNotNull(); + assertThat(response.getBody().getContent()) + .extracting(TaskHistoryEventRepresentationModel::getTaskHistoryId) + .containsExactly("THI:000000000000000000000000000000000000"); } @Test @Disabled("no solution for this") - void testThrowsExceptionIfInvalidFilterIsUsed() { + void should_ReturnBadStatusErrorCode_When_InvalidQueryParameterIsUsed() { ThrowingCallable httpCall = () -> TEMPLATE.exchange( @@ -120,8 +136,8 @@ class TaskHistoryEventControllerIntTest { @Test @Disabled("Jörg pls fix this") - void testGetHistoryEventWrongCreatedFormat() { - String currentTime = LocalDateTime.now().toString(); + void should_ReturnBadStatusErrorCode_When_CreatedQueryParameterIsWrongFormatted() { + String currentTime = "wrong format"; ThrowingCallable httpCall = () -> TEMPLATE.exchange( @@ -138,7 +154,7 @@ class TaskHistoryEventControllerIntTest { } @Test - void testGetHistoryEventOfDate() { + void should_ApplyCreatedFilter_When_QueryParametersAreProvided() { Instant now = LocalDate.now().atStartOfDay(ZoneId.systemDefault()).toInstant(); ResponseEntity response = TEMPLATE.exchange( @@ -153,8 +169,14 @@ class TaskHistoryEventControllerIntTest { } @Test - void testGetSecondPageSortedByKey() { - String parameters = "?sort-by=WORKBASKET_KEY&order=DESCENDING&page=2&page-size=2"; + void should_ApplyPaging_When_PagingIsRequested() { + String expectedFirstPageParameters = "?sort-by=TASK_HISTORY_EVENT_ID&page-size=3&page=1"; + String expectedLastPageParameters = "?sort-by=TASK_HISTORY_EVENT_ID&page-size=3&page=15"; + String expectedPrevPageParameters = "?sort-by=TASK_HISTORY_EVENT_ID&page-size=3&page=2"; + String expectedNextPageParameters = "?sort-by=TASK_HISTORY_EVENT_ID&page-size=3&page=4"; + + String parameters = "?sort-by=TASK_HISTORY_EVENT_ID&page-size=3&page=3"; + ResponseEntity response = TEMPLATE.exchange( restHelper.toUrl(HistoryRestEndpoints.URL_HISTORY_EVENTS + parameters), @@ -163,19 +185,82 @@ class TaskHistoryEventControllerIntTest { ParameterizedTypeReference.forType(TaskHistoryEventPagedRepresentationModel.class)); assertThat(response.getBody()).isNotNull(); - assertThat(response.getBody().getContent()).hasSize(2); - assertThat(response.getBody().getContent().iterator().next().getWorkbasketKey()) - .isEqualTo("WBI:100000000000000000000000000000000002"); - assertThat(response.getBody().getLink(IanaLinkRelations.SELF)) - .isNotNull() + assertThat(response.getBody().getContent()) + .extracting(TaskHistoryEventRepresentationModel::getTaskHistoryId) + .containsExactly( + "THI:000000000000000000000000000000000006", + "THI:000000000000000000000000000000000007", + "THI:000000000000000000000000000000000008"); + + assertThat(response.getBody().getPageMetadata()).isEqualTo(new PageMetadata(3, 45, 15, 3)); + + assertThat(response.getBody().getLink(IanaLinkRelations.FIRST)) + .isPresent() .get() .extracting(Link::getHref) .asString() - .endsWith(parameters); - - assertThat(response.getBody().getLink(IanaLinkRelations.FIRST)).isNotNull(); - assertThat(response.getBody().getLink(IanaLinkRelations.PREV)).isNotNull(); - assertThat(response.getBody().getLink(IanaLinkRelations.NEXT)).isNotNull(); - assertThat(response.getBody().getLink(IanaLinkRelations.LAST)).isNotNull(); + .endsWith(HistoryRestEndpoints.URL_HISTORY_EVENTS + expectedFirstPageParameters); + assertThat(response.getBody().getLink(IanaLinkRelations.LAST)) + .isPresent() + .get() + .extracting(Link::getHref) + .asString() + .endsWith(HistoryRestEndpoints.URL_HISTORY_EVENTS + expectedLastPageParameters); + assertThat(response.getBody().getLink(IanaLinkRelations.PREV)) + .isPresent() + .get() + .extracting(Link::getHref) + .asString() + .endsWith(HistoryRestEndpoints.URL_HISTORY_EVENTS + expectedPrevPageParameters); + assertThat(response.getBody().getLink(IanaLinkRelations.NEXT)) + .isPresent() + .get() + .extracting(Link::getHref) + .asString() + .endsWith(HistoryRestEndpoints.URL_HISTORY_EVENTS + expectedNextPageParameters); } + + // endregion + + // region Get Specific Task History Event + + @Test + void should_GenerateSelfLink_When_SpecificTaskHistoryEventIsRequested() { + String id = "THI:000000000000000000000000000000000000"; + String expectedUrl = + UriComponentsBuilder.fromPath(HistoryRestEndpoints.URL_HISTORY_EVENTS_ID) + .buildAndExpand(id) + .toUriString(); + + ResponseEntity response = + TEMPLATE.exchange( + restHelper.toUrl(HistoryRestEndpoints.URL_HISTORY_EVENTS_ID, id), + HttpMethod.GET, + restHelper.defaultRequest(), + ParameterizedTypeReference.forType(TaskHistoryEventPagedRepresentationModel.class)); + assertThat(response.getBody()).isNotNull(); + assertThat(response.getBody().getLink(IanaLinkRelations.SELF)) + .isPresent() + .get() + .extracting(Link::getHref) + .asString() + .endsWith(expectedUrl); + } + + @Test + void should_GetSpecificTaskHistoryEventWithDetails_When_SingleEventIsQueried() { + ResponseEntity response = + TEMPLATE.exchange( + restHelper.toUrl( + HistoryRestEndpoints.URL_HISTORY_EVENTS_ID, + "THI:000000000000000000000000000000000000"), + HttpMethod.GET, + restHelper.defaultRequest(), + ParameterizedTypeReference.forType(TaskHistoryEventRepresentationModel.class)); + + assertThat(response.getBody()).isNotNull(); + assertThat(response.getBody().getDetails()).isNotNull(); + } + + // endregion } diff --git a/history/taskana-simplehistory-rest-spring/src/test/java/pro/taskana/simplehistory/rest/TaskHistoryEventControllerRestDocumentationTest.java b/history/taskana-simplehistory-rest-spring/src/test/java/pro/taskana/simplehistory/rest/TaskHistoryEventControllerRestDocumentationTest.java index 729fe2f78..2291168b6 100644 --- a/history/taskana-simplehistory-rest-spring/src/test/java/pro/taskana/simplehistory/rest/TaskHistoryEventControllerRestDocumentationTest.java +++ b/history/taskana-simplehistory-rest-spring/src/test/java/pro/taskana/simplehistory/rest/TaskHistoryEventControllerRestDocumentationTest.java @@ -10,18 +10,19 @@ import pro.taskana.common.test.BaseRestDocumentationTest; class TaskHistoryEventControllerRestDocumentationTest extends BaseRestDocumentationTest { @Test - void getAllTaskHistoryEventDocTest() throws Exception { + void getAllTaskHistoryEventsDocTest() throws Exception { mockMvc - .perform( - get(HistoryRestEndpoints.URL_HISTORY_EVENTS + "?page=1&page-size=3")) + .perform(get(HistoryRestEndpoints.URL_HISTORY_EVENTS + "?page=1&page-size=3")) .andExpect(MockMvcResultMatchers.status().isOk()); } @Test void getSpecificTaskHistoryEventDocTest() throws Exception { mockMvc - .perform(get(HistoryRestEndpoints.URL_HISTORY_EVENTS_ID, - "THI:000000000000000000000000000000000000")) + .perform( + get( + HistoryRestEndpoints.URL_HISTORY_EVENTS_ID, + "THI:000000000000000000000000000000000000")) .andExpect(MockMvcResultMatchers.status().isOk()); } } diff --git a/lib/taskana-core/src/main/java/pro/taskana/classification/api/ClassificationService.java b/lib/taskana-core/src/main/java/pro/taskana/classification/api/ClassificationService.java index e73662c11..3b14fec98 100644 --- a/lib/taskana-core/src/main/java/pro/taskana/classification/api/ClassificationService.java +++ b/lib/taskana-core/src/main/java/pro/taskana/classification/api/ClassificationService.java @@ -90,8 +90,8 @@ public interface ClassificationService { * @return the updated Classification. * @throws ClassificationNotFoundException if the classification OR it´s parent does not exist. * @throws NotAuthorizedException if the caller got no ADMIN or BUSINESS_ADMIN permissions. - * @throws ConcurrencyException if the Classification was modified meanwhile and is not latest - * anymore. + * @throws ConcurrencyException If the classification was modified in the meantime and is not the + * most up to date anymore. * @throws InvalidArgumentException if the ServiceLevel property does not comply with the ISO 8601 * specification */ diff --git a/lib/taskana-core/src/main/java/pro/taskana/task/api/TaskQuery.java b/lib/taskana-core/src/main/java/pro/taskana/task/api/TaskQuery.java index 012679220..06ec99fb3 100644 --- a/lib/taskana-core/src/main/java/pro/taskana/task/api/TaskQuery.java +++ b/lib/taskana-core/src/main/java/pro/taskana/task/api/TaskQuery.java @@ -447,7 +447,7 @@ public interface TaskQuery extends BaseQuery { * @param customField identifies which custom attribute is affected. * @param searchArguments the customField values of the searched for tasks * @return the query - * @throws InvalidArgumentException if searchArguments is not given + * @throws InvalidArgumentException if searchArguments are not given */ TaskQuery customAttributeIn(TaskCustomField customField, String... searchArguments) throws InvalidArgumentException; diff --git a/lib/taskana-core/src/main/java/pro/taskana/task/api/TaskService.java b/lib/taskana-core/src/main/java/pro/taskana/task/api/TaskService.java index 75060fdb2..fbbad12de 100644 --- a/lib/taskana-core/src/main/java/pro/taskana/task/api/TaskService.java +++ b/lib/taskana-core/src/main/java/pro/taskana/task/api/TaskService.java @@ -62,7 +62,7 @@ public interface TaskService { * @param taskId id of the task which should be unclaimed. * @return updated unclaimed task * @throws TaskNotFoundException if the task can´t be found or does not exist - * @throws InvalidStateException if the task is already in a final state. + * @throws InvalidStateException if the task is already in an end state. * @throws InvalidOwnerException if the task is claimed by another user. * @throws NotAuthorizedException if the current user has no read permission for the workbasket * the task is in @@ -77,9 +77,8 @@ public interface TaskService { * @param taskId id of the task which should be unclaimed. * @return updated unclaimed task * @throws TaskNotFoundException if the task can´t be found or does not exist - * @throws InvalidStateException if the task is already completed. - * @throws InvalidOwnerException if forceCancel is false and the task is claimed by another - * user. + * @throws InvalidStateException if the task is already in an end state. + * @throws InvalidOwnerException if forceCancel is false and the task is claimed by another user. * @throws NotAuthorizedException if the current user has no read permission for the workbasket * the task is in */ @@ -126,7 +125,7 @@ public interface TaskService { * @return the created and persisted task * @throws TaskAlreadyExistException if the Task does already exist. * @throws NotAuthorizedException thrown if the current user is not authorized to create that task - * @throws WorkbasketNotFoundException thrown if the work basket referenced by the task is not + * @throws WorkbasketNotFoundException thrown if the workbasket referenced by the task is not * found * @throws ClassificationNotFoundException thrown if the {@link Classification} referenced by the * task is not found @@ -307,7 +306,7 @@ public interface TaskService { * * @param taskId The Id of the task to delete. * @throws TaskNotFoundException If the given Id does not refer to an existing task. - * @throws InvalidStateException If the state of the referenced task is not Completed. + * @throws InvalidStateException If the state of the referenced task is not an end state. * @throws NotAuthorizedException if the current user is not member of role ADMIN */ void deleteTask(String taskId) @@ -318,7 +317,7 @@ public interface TaskService { * * @param taskId The Id of the task to delete. * @throws TaskNotFoundException If the given Id does not refer to an existing task. - * @throws InvalidStateException If the state of the referenced task is not Completed and + * @throws InvalidStateException If the state of the referenced task is not an end state and * forceDelete is false. * @throws NotAuthorizedException if the current user is not member of role ADMIN */ diff --git a/lib/taskana-core/src/main/java/pro/taskana/workbasket/api/WorkbasketService.java b/lib/taskana-core/src/main/java/pro/taskana/workbasket/api/WorkbasketService.java index fb683bdf4..e7d63ac1a 100644 --- a/lib/taskana-core/src/main/java/pro/taskana/workbasket/api/WorkbasketService.java +++ b/lib/taskana-core/src/main/java/pro/taskana/workbasket/api/WorkbasketService.java @@ -279,8 +279,8 @@ public interface WorkbasketService { throws NotAuthorizedException, WorkbasketNotFoundException; /** - * Remove a distribution target from a workbasket. If the the specified distribution target - * doesn't exist, the method silently returns without doing anything. + * Remove a distribution target from a workbasket. If the specified distribution target doesn't + * exist, the method silently returns without doing anything. * * @param sourceWorkbasketId The id of the source workbasket * @param targetWorkbasketId The id of the target workbasket diff --git a/lib/taskana-core/src/test/java/acceptance/task/CancelTaskAccTest.java b/lib/taskana-core/src/test/java/acceptance/task/CancelTaskAccTest.java index 0c7a71615..c307976e0 100644 --- a/lib/taskana-core/src/test/java/acceptance/task/CancelTaskAccTest.java +++ b/lib/taskana-core/src/test/java/acceptance/task/CancelTaskAccTest.java @@ -37,7 +37,7 @@ class CancelTaskAccTest extends AbstractAccTest { @WithAccessId(user = "user-1-2") @Test - void testQeryCancelledTasks() { + void testQueryCancelledTasks() { List taskSummaries = taskService.createTaskQuery().stateIn(TaskState.CANCELLED).list(); assertThat(taskSummaries).hasSize(5); diff --git a/lib/taskana-core/src/test/java/pro/taskana/common/internal/util/ObjectAttributeChangeDetectorTest.java b/lib/taskana-core/src/test/java/pro/taskana/common/internal/util/ObjectAttributeChangeDetectorTest.java index 6f9d0c190..f3373bb23 100644 --- a/lib/taskana-core/src/test/java/pro/taskana/common/internal/util/ObjectAttributeChangeDetectorTest.java +++ b/lib/taskana-core/src/test/java/pro/taskana/common/internal/util/ObjectAttributeChangeDetectorTest.java @@ -18,7 +18,7 @@ import pro.taskana.workbasket.api.WorkbasketType; import pro.taskana.workbasket.internal.models.WorkbasketAccessItemImpl; import pro.taskana.workbasket.internal.models.WorkbasketImpl; -// TODO: this has to be moved to taskana-common but this is currently not possible due to the the +// TODO: this has to be moved to taskana-common but this is currently not possible due to the // workbasket and task imports class ObjectAttributeChangeDetectorTest { diff --git a/rest/taskana-rest-spring-example-boot/src/main/java/pro/taskana/rest/security/BootWebSecurityConfigurer.java b/rest/taskana-rest-spring-example-boot/src/main/java/pro/taskana/rest/security/BootWebSecurityConfigurer.java index c5eec6209..e13c6bf2e 100644 --- a/rest/taskana-rest-spring-example-boot/src/main/java/pro/taskana/rest/security/BootWebSecurityConfigurer.java +++ b/rest/taskana-rest-spring-example-boot/src/main/java/pro/taskana/rest/security/BootWebSecurityConfigurer.java @@ -13,9 +13,7 @@ import org.springframework.security.web.util.matcher.AntPathRequestMatcher; import pro.taskana.common.rest.SpringSecurityToJaasFilter; -/** - * Default basic configuration for taskana web example. - */ +/** Default basic configuration for taskana web example. */ @EnableWebSecurity public class BootWebSecurityConfigurer extends WebSecurityConfigurerAdapter { @@ -116,5 +114,4 @@ public class BootWebSecurityConfigurer extends WebSecurityConfigurerAdapter { filter.setCreateEmptySubject(true); return filter; } - } diff --git a/rest/taskana-rest-spring-example-wildfly/src/main/java/pro/taskana/TaskanaWildFlyApplication.java b/rest/taskana-rest-spring-example-wildfly/src/main/java/pro/taskana/TaskanaWildFlyApplication.java index e88478ac2..c4bddee55 100644 --- a/rest/taskana-rest-spring-example-wildfly/src/main/java/pro/taskana/TaskanaWildFlyApplication.java +++ b/rest/taskana-rest-spring-example-wildfly/src/main/java/pro/taskana/TaskanaWildFlyApplication.java @@ -18,5 +18,4 @@ public class TaskanaWildFlyApplication extends SpringBootServletInitializer { public static void main(String[] args) { SpringApplication.run(TaskanaWildFlyApplication.class, args); } - } diff --git a/rest/taskana-rest-spring-example-wildfly/src/main/java/pro/taskana/TaskanaWildflyConfiguration.java b/rest/taskana-rest-spring-example-wildfly/src/main/java/pro/taskana/TaskanaWildflyConfiguration.java index f600309a9..983f4edfb 100644 --- a/rest/taskana-rest-spring-example-wildfly/src/main/java/pro/taskana/TaskanaWildflyConfiguration.java +++ b/rest/taskana-rest-spring-example-wildfly/src/main/java/pro/taskana/TaskanaWildflyConfiguration.java @@ -33,7 +33,7 @@ public class TaskanaWildflyConfiguration { @Primary @ConfigurationProperties(prefix = "datasource") public DataSourceProperties dataSourceProperties( - @Value("${taskana.schemaName:TASKANA}") String schemaName) { + @Value("${taskana.schemaName:TASKANA}") String schemaName) { DataSourceProperties props = new DataSourceProperties(); props.setUrl( "jdbc:h2:mem:taskana;IGNORECASE=TRUE;LOCK_MODE=0;INIT=CREATE SCHEMA IF NOT EXISTS " diff --git a/rest/taskana-rest-spring-example-wildfly/src/main/java/pro/taskana/wildfly/security/WildflyWebSecurityConfigurer.java b/rest/taskana-rest-spring-example-wildfly/src/main/java/pro/taskana/wildfly/security/WildflyWebSecurityConfigurer.java index 5364ff0bf..6786b5fe4 100644 --- a/rest/taskana-rest-spring-example-wildfly/src/main/java/pro/taskana/wildfly/security/WildflyWebSecurityConfigurer.java +++ b/rest/taskana-rest-spring-example-wildfly/src/main/java/pro/taskana/wildfly/security/WildflyWebSecurityConfigurer.java @@ -25,5 +25,4 @@ public class WildflyWebSecurityConfigurer extends WebSecurityConfigurerAdapter { filter.setCreateEmptySubject(true); return filter; } - } diff --git a/rest/taskana-rest-spring-example-wildfly/src/test/java/pro/taskana/AbstractAccTest.java b/rest/taskana-rest-spring-example-wildfly/src/test/java/pro/taskana/AbstractAccTest.java index 53b950044..46ca2d5b6 100644 --- a/rest/taskana-rest-spring-example-wildfly/src/test/java/pro/taskana/AbstractAccTest.java +++ b/rest/taskana-rest-spring-example-wildfly/src/test/java/pro/taskana/AbstractAccTest.java @@ -49,23 +49,20 @@ public class AbstractAccTest { protected ResponseEntity performGetHistoryEventsRestCall() { - return RestHelper.TEMPLATE - .exchange( - restHelper.toUrl("/taskana" + HistoryRestEndpoints.URL_HISTORY_EVENTS), - HttpMethod.GET, - restHelper.defaultRequest(), - ParameterizedTypeReference - .forType(TaskHistoryEventPagedRepresentationModel.class)); + return RestHelper.TEMPLATE.exchange( + restHelper.toUrl("/taskana" + HistoryRestEndpoints.URL_HISTORY_EVENTS), + HttpMethod.GET, + restHelper.defaultRequest(), + ParameterizedTypeReference.forType(TaskHistoryEventPagedRepresentationModel.class)); } protected ResponseEntity performCreateTaskRestCall() { TaskRepresentationModel taskRepresentationModel = getTaskResourceSample(); - return RestHelper.TEMPLATE - .exchange( - restHelper.toUrl("/taskana" + RestEndpoints.URL_TASKS), - HttpMethod.POST, - new HttpEntity<>(taskRepresentationModel, restHelper.getHeadersTeamlead_1()), - ParameterizedTypeReference.forType(TaskRepresentationModel.class)); + return RestHelper.TEMPLATE.exchange( + restHelper.toUrl("/taskana" + RestEndpoints.URL_TASKS), + HttpMethod.POST, + new HttpEntity<>(taskRepresentationModel, restHelper.getHeadersTeamlead_1()), + ParameterizedTypeReference.forType(TaskRepresentationModel.class)); } protected String parseServerLog() throws Exception { diff --git a/rest/taskana-rest-spring-example-wildfly/src/test/java/pro/taskana/TaskanaWildflyTest.java b/rest/taskana-rest-spring-example-wildfly/src/test/java/pro/taskana/TaskanaWildflyTest.java index 7c42149be..eb9477dda 100644 --- a/rest/taskana-rest-spring-example-wildfly/src/test/java/pro/taskana/TaskanaWildflyTest.java +++ b/rest/taskana-rest-spring-example-wildfly/src/test/java/pro/taskana/TaskanaWildflyTest.java @@ -1,6 +1,7 @@ package pro.taskana; import static org.assertj.core.api.Assertions.assertThat; +import static pro.taskana.common.test.rest.RestHelper.TEMPLATE; import java.io.File; import java.util.List; @@ -23,7 +24,6 @@ import org.springframework.http.ResponseEntity; import pro.taskana.common.rest.RestEndpoints; import pro.taskana.common.rest.models.AccessIdRepresentationModel; import pro.taskana.common.rest.models.TaskanaUserInfoRepresentationModel; -import pro.taskana.common.test.rest.RestHelper; import pro.taskana.task.rest.models.TaskRepresentationModel; /** @@ -69,12 +69,11 @@ public class TaskanaWildflyTest extends AbstractAccTest { @RunAsClient public void should_ReturnUserInformationForAuthenticatedUser_IfRequested() { ResponseEntity response = - RestHelper.TEMPLATE - .exchange( - restHelper.toUrl("/taskana" + RestEndpoints.URL_CURRENT_USER), - HttpMethod.GET, - restHelper.defaultRequest(), - ParameterizedTypeReference.forType(TaskanaUserInfoRepresentationModel.class)); + TEMPLATE.exchange( + restHelper.toUrl("/taskana" + RestEndpoints.URL_CURRENT_USER), + HttpMethod.GET, + restHelper.defaultRequest(), + ParameterizedTypeReference.forType(TaskanaUserInfoRepresentationModel.class)); assertThat(response.getStatusCode()).isEqualTo(HttpStatus.OK); TaskanaUserInfoRepresentationModel currentUser = response.getBody(); assertThat(currentUser).isNotNull(); @@ -87,13 +86,11 @@ public class TaskanaWildflyTest extends AbstractAccTest { @RunAsClient public void should_ReturnUserFromLdap_WhenWildcardSearchIsConducted() { ResponseEntity> response = - RestHelper.TEMPLATE - .exchange( - restHelper.toUrl("/taskana" + RestEndpoints.URL_ACCESS_ID + "?search-for=rig"), - HttpMethod.GET, - restHelper.defaultRequest(), - new ParameterizedTypeReference>() { - }); + TEMPLATE.exchange( + restHelper.toUrl("/taskana" + RestEndpoints.URL_ACCESS_ID + "?search-for=rig"), + HttpMethod.GET, + restHelper.defaultRequest(), + new ParameterizedTypeReference>() {}); assertThat(response.getStatusCode()).isEqualTo(HttpStatus.OK); assertThat(response.getBody()).hasSize(2); } @@ -102,12 +99,13 @@ public class TaskanaWildflyTest extends AbstractAccTest { @RunAsClient public void should_ReturnTask_WhenRequested() { ResponseEntity response = - RestHelper.TEMPLATE - .exchange(restHelper.toUrl("/taskana" + RestEndpoints.URL_TASKS_ID, + TEMPLATE.exchange( + restHelper.toUrl( + "/taskana" + RestEndpoints.URL_TASKS_ID, "TKI:000000000000000000000000000000000001"), - HttpMethod.GET, - restHelper.defaultRequest(), - ParameterizedTypeReference.forType(TaskRepresentationModel.class)); + HttpMethod.GET, + restHelper.defaultRequest(), + ParameterizedTypeReference.forType(TaskRepresentationModel.class)); assertThat(response.getStatusCode()).isEqualTo(HttpStatus.OK); assertThat(response.getBody()).isNotNull(); } diff --git a/rest/taskana-rest-spring/src/docs/asciidoc/rest-api.adoc b/rest/taskana-rest-spring/src/docs/asciidoc/rest-api.adoc index dbaad05b8..afa6e5922 100644 --- a/rest/taskana-rest-spring/src/docs/asciidoc/rest-api.adoc +++ b/rest/taskana-rest-spring/src/docs/asciidoc/rest-api.adoc @@ -11,7 +11,7 @@ NOTE: HATEOAS support is still in development. Please have a look at example res TASKANA uses the https://restfulapi.net/hateoas/)[HATEOAS] (Hypermedia as the Engine of Application State) REST constraint. Most of our resources contain a `_links` section which contains navigation links. These navigation links not only help navigate through our REST API, they encapsulate API. -Using HATEOAS allows us to change some Endpoints without breaking any frontend. +Using HATEOAS allows us to change some endpoints without breaking any frontend. == Task Resource @@ -81,6 +81,7 @@ include::{snippets}/TaskanaEngineControllerRestDocumentationTest/getClassificati include::{snippets}/TaskanaEngineControllerRestDocumentationTest/getClassificationCategoriesByTypeMapDocTest/auto-section.adoc[] include::{snippets}/TaskanaEngineControllerRestDocumentationTest/getCurrentUserInfoDocTest/auto-section.adoc[] include::{snippets}/TaskanaEngineControllerRestDocumentationTest/getHistoryProviderIsEnabledDocTest/auto-section.adoc[] +include::{snippets}/TaskanaEngineControllerRestDocumentationTest/getCurrentVersionDocTest/auto-section.adoc[] == Import / Export diff --git a/rest/taskana-rest-spring/src/main/java/pro/taskana/classification/rest/ClassificationController.java b/rest/taskana-rest-spring/src/main/java/pro/taskana/classification/rest/ClassificationController.java index 315d1d0ac..55c66e5c2 100644 --- a/rest/taskana-rest-spring/src/main/java/pro/taskana/classification/rest/ClassificationController.java +++ b/rest/taskana-rest-spring/src/main/java/pro/taskana/classification/rest/ClassificationController.java @@ -95,12 +95,12 @@ public class ClassificationController { } /** - * This endpoints retrieves a single Classification. + * This endpoint retrieves a single Classification. * - * @title Get a single Classification * @param classificationId the id of the requested Classification. * @return the requested classification - * @throws ClassificationNotFoundException if the provided classification is not found. + * @throws ClassificationNotFoundException if the requested classification is not found. + * @title Get a single Classification */ @GetMapping(path = RestEndpoints.URL_CLASSIFICATIONS_ID, produces = MediaTypes.HAL_JSON_VALUE) @Transactional(readOnly = true, rollbackFor = Exception.class) @@ -121,7 +121,7 @@ public class ClassificationController { } /** - * This endpoints creates a new Classification. + * This endpoint creates a new Classification. * * @title Create a new Classification * @param repModel the Classification which should be created. @@ -165,8 +165,7 @@ public class ClassificationController { * @throws ClassificationNotFoundException if the requested Classification is not found * @throws ConcurrencyException if the requested Classification id has been modified in the * meantime by a different process. - * @throws InvalidArgumentException if the id in the path and in the the request body does not - * match + * @throws InvalidArgumentException if the id in the path and in the request body does not match */ @PutMapping(path = RestEndpoints.URL_CLASSIFICATIONS_ID) @Transactional(rollbackFor = Exception.class) diff --git a/rest/taskana-rest-spring/src/main/java/pro/taskana/classification/rest/ClassificationDefinitionController.java b/rest/taskana-rest-spring/src/main/java/pro/taskana/classification/rest/ClassificationDefinitionController.java index 24ae70831..2f3002473 100644 --- a/rest/taskana-rest-spring/src/main/java/pro/taskana/classification/rest/ClassificationDefinitionController.java +++ b/rest/taskana-rest-spring/src/main/java/pro/taskana/classification/rest/ClassificationDefinitionController.java @@ -110,7 +110,7 @@ public class ClassificationDefinitionController { * @param file the file containing the Classifications which should be imported. * @return nothing * @throws InvalidArgumentException if any Classification within the import file is invalid - * @throws NotAuthorizedException if the current user is not authorized to import Classification + * @throws NotAuthorizedException if the current user is not authorized to import Classifications * @throws ConcurrencyException TODO: this makes no sense * @throws ClassificationNotFoundException TODO: this makes no sense * @throws ClassificationAlreadyExistException TODO: this makes no sense diff --git a/rest/taskana-rest-spring/src/main/java/pro/taskana/classification/rest/ClassificationQueryFilterParameter.java b/rest/taskana-rest-spring/src/main/java/pro/taskana/classification/rest/ClassificationQueryFilterParameter.java index 44cacd757..bab71db4e 100644 --- a/rest/taskana-rest-spring/src/main/java/pro/taskana/classification/rest/ClassificationQueryFilterParameter.java +++ b/rest/taskana-rest-spring/src/main/java/pro/taskana/classification/rest/ClassificationQueryFilterParameter.java @@ -19,8 +19,8 @@ public class ClassificationQueryFilterParameter private final String[] name; /** - * Filter by the name of the classification. This results into a substring search. (% is appended - * to the front and end of the requested value). Further SQL "Like" wildcard characters will be + * Filter by the name of the classification. This results in a substring search. (% is appended to + * the beginning and end of the requested value). Further SQL "Like" wildcard characters will be * resolved correctly. */ @JsonProperty("name-like") @@ -39,64 +39,64 @@ public class ClassificationQueryFilterParameter private final String[] type; /** - * Filter by the value of the field custom1. This results into a substring search. (% is appended - * to the front and end of the requested value). Further SQL "Like" wildcard characters will be - * resolved correctly. + * Filter by the value of the field custom1. This results in a substring search.. (% is appended + * to the beginning and end of the requested value). Further SQL "Like" wildcard characters will + * be resolved correctly. */ @JsonProperty("custom-1-like") private final String[] custom1Like; /** - * Filter by the value of the field custom2. This results into a substring search. (% is appended - * to the front and end of the requested value). Further SQL "Like" wildcard characters will be - * resolved correctly. + * Filter by the value of the field custom2. This results in a substring search.. (% is appended + * to the beginning and end of the requested value). Further SQL "Like" wildcard characters will + * be resolved correctly. */ @JsonProperty("custom-2-like") - private final String[] custom3Like; - - /** - * Filter by the value of the field custom3. This results into a substring search. (% is appended - * to the front and end of the requested value). Further SQL "Like" wildcard characters will be - * resolved correctly. - */ - @JsonProperty("custom-3-like") private final String[] custom2Like; /** - * Filter by the value of the field custom4. This results into a substring search. (% is appended - * to the front and end of the requested value). Further SQL "Like" wildcard characters will be - * resolved correctly. + * Filter by the value of the field custom3. This results in a substring search.. (% is appended + * to the beginning and end of the requested value). Further SQL "Like" wildcard characters will + * be resolved correctly. + */ + @JsonProperty("custom-3-like") + private final String[] custom3Like; + + /** + * Filter by the value of the field custom4. This results in a substring search.. (% is appended + * to the beginning and end of the requested value). Further SQL "Like" wildcard characters will + * be resolved correctly. */ @JsonProperty("custom-4-like") private final String[] custom4Like; /** - * Filter by the value of the field custom5. This results into a substring search. (% is appended - * to the front and end of the requested value). Further SQL "Like" wildcard characters will be - * resolved correctly. + * Filter by the value of the field custom5. This results in a substring search.. (% is appended + * to the beginning and end of the requested value). Further SQL "Like" wildcard characters will + * be resolved correctly. */ @JsonProperty("custom-5-like") private final String[] custom5Like; /** - * Filter by the value of the field custom6. This results into a substring search. (% is appended - * to the front and end of the requested value). Further SQL "Like" wildcard characters will be - * resolved correctly. + * Filter by the value of the field custom6. This results in a substring search.. (% is appended + * to the beginning and end of the requested value). Further SQL "Like" wildcard characters will + * be resolved correctly. */ @JsonProperty("custom-6-like") private final String[] custom6Like; /** - * Filter by the value of the field custom7. This results into a substring search. (% is appended - * to the front and end of the requested value). Further SQL "Like" wildcard characters will be - * resolved correctly. + * Filter by the value of the field custom7. This results in a substring search.. (% is appended + * to the beginning and end of the requested value). Further SQL "Like" wildcard characters will + * be resolved correctly. */ @JsonProperty("custom-7-like") private final String[] custom7Like; /** - * Filter by the value of the field custom8. This results into a substring search. (% is appended - * to the front and end of the requested value). Further SQL "Like" wildcard characters will be - * resolved correctly. + * Filter by the value of the field custom8. This results in a substring search.. (% is appended + * to the beginning and end of the requested value). Further SQL "Like" wildcard characters will + * be resolved correctly. */ @JsonProperty("custom-8-like") private final String[] custom8Like; diff --git a/rest/taskana-rest-spring/src/main/java/pro/taskana/classification/rest/models/ClassificationSummaryRepresentationModel.java b/rest/taskana-rest-spring/src/main/java/pro/taskana/classification/rest/models/ClassificationSummaryRepresentationModel.java index a125ca69c..8446ce9b9 100644 --- a/rest/taskana-rest-spring/src/main/java/pro/taskana/classification/rest/models/ClassificationSummaryRepresentationModel.java +++ b/rest/taskana-rest-spring/src/main/java/pro/taskana/classification/rest/models/ClassificationSummaryRepresentationModel.java @@ -41,7 +41,7 @@ public class ClassificationSummaryRepresentationModel * *

This is stated according to ISO 8601. */ - protected String serviceLevel; + @NotNull protected String serviceLevel; /** The type of classification. Types can be configured in the file 'taskana.properties'. */ protected String type; /** A custom property with name "1". */ diff --git a/rest/taskana-rest-spring/src/main/java/pro/taskana/common/rest/AccessIdController.java b/rest/taskana-rest-spring/src/main/java/pro/taskana/common/rest/AccessIdController.java index 04b55a7ff..5560a1dc9 100644 --- a/rest/taskana-rest-spring/src/main/java/pro/taskana/common/rest/AccessIdController.java +++ b/rest/taskana-rest-spring/src/main/java/pro/taskana/common/rest/AccessIdController.java @@ -40,9 +40,9 @@ public class AccessIdController { * @title Search for Access Id (users and groups) * @param searchFor the Access Id which should be searched for. * @return a list of all found Access Ids - * @throws InvalidArgumentException if the provided search for access id is shorter thant the - * configured one. - * @throws NotAuthorizedException if the current user is not ADMIN or BUSINESS_ADMIN. + * @throws InvalidArgumentException if the provided search for access id is shorter than the + * configured one. + * @throws NotAuthorizedException if the current user is not ADMIN or BUSINESS_ADMIN. */ @GetMapping(path = RestEndpoints.URL_ACCESS_ID) public ResponseEntity> searchUsersAndGroups( diff --git a/rest/taskana-rest-spring/src/main/java/pro/taskana/common/rest/QuerySortParameter.java b/rest/taskana-rest-spring/src/main/java/pro/taskana/common/rest/QuerySortParameter.java index b31cd3d1f..873d55833 100644 --- a/rest/taskana-rest-spring/src/main/java/pro/taskana/common/rest/QuerySortParameter.java +++ b/rest/taskana-rest-spring/src/main/java/pro/taskana/common/rest/QuerySortParameter.java @@ -59,7 +59,7 @@ public class QuerySortParameter, S extends QuerySortBy throws InvalidArgumentException { if (sortBy == null && order != null) { throw new InvalidArgumentException( - "Only 'order' were provided. Please also provide 'sort-by' parameter(s)"); + "Only 'order' parameters were provided. Please also provide 'sort-by' parameter(s)"); } } diff --git a/rest/taskana-rest-spring/src/main/java/pro/taskana/common/rest/TaskanaEngineController.java b/rest/taskana-rest-spring/src/main/java/pro/taskana/common/rest/TaskanaEngineController.java index da11ffc3c..f829d6c5e 100644 --- a/rest/taskana-rest-spring/src/main/java/pro/taskana/common/rest/TaskanaEngineController.java +++ b/rest/taskana-rest-spring/src/main/java/pro/taskana/common/rest/TaskanaEngineController.java @@ -38,7 +38,6 @@ public class TaskanaEngineController { * * @return An array with the domain-names as strings */ - // TODO: this is not proper usage of this endpoint.. @GetMapping(path = RestEndpoints.URL_DOMAIN) public ResponseEntity> getDomains() { ResponseEntity> response = diff --git a/rest/taskana-rest-spring/src/main/java/pro/taskana/common/rest/models/AccessIdRepresentationModel.java b/rest/taskana-rest-spring/src/main/java/pro/taskana/common/rest/models/AccessIdRepresentationModel.java index 954391afa..8baf4c148 100644 --- a/rest/taskana-rest-spring/src/main/java/pro/taskana/common/rest/models/AccessIdRepresentationModel.java +++ b/rest/taskana-rest-spring/src/main/java/pro/taskana/common/rest/models/AccessIdRepresentationModel.java @@ -1,21 +1,19 @@ package pro.taskana.common.rest.models; -/** - * resource class for access id validation. - */ -public class AccessIdRepresentationModel { +import org.springframework.hateoas.RepresentationModel; +import org.springframework.lang.NonNull; - /** - * The name of this Access Id. - */ +/** EntityModel for access id validation. */ +public class AccessIdRepresentationModel extends RepresentationModel { + + /** The name of this Access Id. */ private String name; /** * The value of the Access Id. This value will be used to determine the access to a workbasket. */ private String accessId; - public AccessIdRepresentationModel() { - } + public AccessIdRepresentationModel() {} public AccessIdRepresentationModel(String name, String accessId) { this.accessId = accessId; @@ -39,7 +37,7 @@ public class AccessIdRepresentationModel { } @Override - public String toString() { + public @NonNull String toString() { return "AccessIdResource [" + "name=" + this.name + ", accessId=" + this.accessId + "]"; } } diff --git a/rest/taskana-rest-spring/src/main/java/pro/taskana/common/rest/models/PageMetadata.java b/rest/taskana-rest-spring/src/main/java/pro/taskana/common/rest/models/PageMetadata.java index e9b184a49..e36968d3d 100644 --- a/rest/taskana-rest-spring/src/main/java/pro/taskana/common/rest/models/PageMetadata.java +++ b/rest/taskana-rest-spring/src/main/java/pro/taskana/common/rest/models/PageMetadata.java @@ -1,6 +1,7 @@ package pro.taskana.common.rest.models; import java.beans.ConstructorProperties; +import java.util.Objects; /** * This is copied from {@link org.springframework.hateoas.PagedModel.PageMetadata}. Reason: The @@ -41,4 +42,37 @@ public class PageMetadata { public long getNumber() { return number; } + + @Override + public int hashCode() { + return Objects.hash(size, totalElements, totalPages, number); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof PageMetadata)) { + return false; + } + PageMetadata other = (PageMetadata) obj; + return size == other.size + && totalElements == other.totalElements + && totalPages == other.totalPages + && number == other.number; + } + + @Override + public String toString() { + return "PageMetadata [size=" + + size + + ", totalElements=" + + totalElements + + ", totalPages=" + + totalPages + + ", number=" + + number + + "]"; + } } diff --git a/rest/taskana-rest-spring/src/main/java/pro/taskana/common/rest/models/TaskanaUserInfoRepresentationModel.java b/rest/taskana-rest-spring/src/main/java/pro/taskana/common/rest/models/TaskanaUserInfoRepresentationModel.java index 43afbdfd9..b4dc538ae 100644 --- a/rest/taskana-rest-spring/src/main/java/pro/taskana/common/rest/models/TaskanaUserInfoRepresentationModel.java +++ b/rest/taskana-rest-spring/src/main/java/pro/taskana/common/rest/models/TaskanaUserInfoRepresentationModel.java @@ -3,6 +3,7 @@ package pro.taskana.common.rest.models; import java.util.ArrayList; import java.util.List; import org.springframework.hateoas.RepresentationModel; +import org.springframework.lang.NonNull; import pro.taskana.common.api.TaskanaRole; @@ -14,7 +15,7 @@ public class TaskanaUserInfoRepresentationModel private String userId; /** All groups the current user is a member of. */ private List groupIds = new ArrayList<>(); - /** All taskana roles the current user is a member of. */ + /** All taskana roles the current user fulfills. */ private List roles = new ArrayList<>(); public String getUserId() { @@ -42,7 +43,7 @@ public class TaskanaUserInfoRepresentationModel } @Override - public String toString() { + public @NonNull String toString() { return "TaskanaUserInfoRepresentationModel [userId=" + userId + ", groupIds=" diff --git a/rest/taskana-rest-spring/src/main/java/pro/taskana/common/rest/models/VersionRepresentationModel.java b/rest/taskana-rest-spring/src/main/java/pro/taskana/common/rest/models/VersionRepresentationModel.java index d896c2c87..0a1be0844 100644 --- a/rest/taskana-rest-spring/src/main/java/pro/taskana/common/rest/models/VersionRepresentationModel.java +++ b/rest/taskana-rest-spring/src/main/java/pro/taskana/common/rest/models/VersionRepresentationModel.java @@ -1,11 +1,14 @@ package pro.taskana.common.rest.models; +import javax.validation.constraints.NotNull; import org.springframework.hateoas.RepresentationModel; +import org.springframework.lang.NonNull; /** EntityModel class for version information. */ public class VersionRepresentationModel extends RepresentationModel { - private String version; + /** The current TASKANA version of the REST Service. */ + @NotNull private String version; public String getVersion() { return version; @@ -16,7 +19,7 @@ public class VersionRepresentationModel extends RepresentationModelA Task Status Report contains the total number of tasks, clustered in their Task States and * grouped by Workbaskets. Each row represents a Workbasket while each column represents a Task @@ -55,7 +55,7 @@ public class MonitorController { * @param domains Filter the report values by domains. * @param states Filter the report values by task states. * @return the computed TaskStatusReport - * @throws NotAuthorizedException if the current user is not authenticated to compute the report + * @throws NotAuthorizedException if the current user is not authorized to compute the report * @title Get a Task Status Report */ @GetMapping(path = RestEndpoints.URL_MONITOR_TASKS_STATUS_REPORT) @@ -83,7 +83,7 @@ public class MonitorController { } /** - * This endpoints generates a Workbasket Report. + * This endpoint generates a Workbasket Report. * *

A WorkbasketReport contains the total numbers of tasks, clustered by the a Task Timestamp * date range and grouped by Workbaskets. Each row represents a Workbasket while each column @@ -92,7 +92,7 @@ public class MonitorController { * @param states Filter the report by task states * @param taskTimestamp determine which task timestamp should be used for comparison * @return the computed report - * @throws NotAuthorizedException if the current user is not authenticated to compute the report + * @throws NotAuthorizedException if the current user is not authorized to compute the report * @throws InvalidArgumentException TODO: this is never thrown ... * @title Get a Workbasket Report */ @@ -154,16 +154,16 @@ public class MonitorController { } /** - * This endpoints generates a Classification Report. + * This endpoint generates a Classification Report. * - *

A Classification Report contains the total numbers of tasks, clustered by the a Task - * Timestamp date range and grouped by Classifications. Each row represents a Classification while - * each column represents a date range. + *

A Classification Report contains the total numbers of tasks, clustered by the Task Timestamp + * date range and grouped by Classifications. Each row represents a Classification while each + * column represents a date range. * * @title Get a Classification Report * @return the computed report * @param taskTimestamp determine which Task Timestamp should be used for comparison - * @throws NotAuthorizedException if the current user is not authenticated to compute the report + * @throws NotAuthorizedException if the current user is not authorized to compute the report * @throws InvalidArgumentException TODO: this is never thrown */ @GetMapping(path = RestEndpoints.URL_MONITOR_TASKS_CLASSIFICATION_REPORT) @@ -192,15 +192,15 @@ public class MonitorController { } /** - * This endpoints generates a Timestamp Report. + * This endpoint generates a Timestamp Report. * - *

A Timestamp Report contains the total numbers of tasks, clustered by date range and grouped + *

A Timestamp Report contains the total number of tasks, clustered by date range and grouped * by its Task Status. Each row represents a Task Status while each column represents a date * range. Each row can be expanded to further group the tasks by their Org Level (1-4) * * @title Get a Timestamp Report * @return the computed report - * @throws NotAuthorizedException if the current user is not authenticated to compute the report + * @throws NotAuthorizedException if the current user is not authorized to compute the report * @throws InvalidArgumentException TODO: this is never thrown */ @GetMapping(path = RestEndpoints.URL_MONITOR_TIMESTAMP_REPORT) diff --git a/rest/taskana-rest-spring/src/main/java/pro/taskana/monitor/rest/models/ReportRepresentationModel.java b/rest/taskana-rest-spring/src/main/java/pro/taskana/monitor/rest/models/ReportRepresentationModel.java index da1d44933..0e6ed00b1 100644 --- a/rest/taskana-rest-spring/src/main/java/pro/taskana/monitor/rest/models/ReportRepresentationModel.java +++ b/rest/taskana-rest-spring/src/main/java/pro/taskana/monitor/rest/models/ReportRepresentationModel.java @@ -11,7 +11,7 @@ import pro.taskana.monitor.api.reports.row.SingleRow; /** EntityModel class for {@link Report}. */ public class ReportRepresentationModel extends RepresentationModel { - /** Object holding metainfo on the report. */ + /** Object holding meta info on the report. */ private final MetaInformation meta; /** Array holding the rows of the report. */ @@ -109,22 +109,22 @@ public class ReportRepresentationModel extends RepresentationModel temp; - switch (sortBy.get(i)) { - case CREATED: - temp = Comparator.comparing(TaskComment::getCreated); - break; - case MODIFIED: - temp = Comparator.comparing(TaskComment::getModified); - break; - default: - throw new InvalidArgumentException( - String.format("Unknown sort-by '%s'", sortBy.get(i))); - } + Comparator temp = sortBy.get(i).getComparator(); if (sortDirection == SortDirection.DESCENDING) { temp = temp.reversed(); } @@ -292,7 +280,17 @@ public class TaskCommentController { } enum TaskCommentsSortBy { - CREATED, - MODIFIED + CREATED(Comparator.comparing(TaskComment::getCreated)), + MODIFIED(Comparator.comparing(TaskComment::getModified)); + + private final Comparator comparator; + + TaskCommentsSortBy(Comparator comparing) { + comparator = comparing; + } + + public Comparator getComparator() { + return comparator; + } } } diff --git a/rest/taskana-rest-spring/src/main/java/pro/taskana/task/rest/TaskController.java b/rest/taskana-rest-spring/src/main/java/pro/taskana/task/rest/TaskController.java index f54c8f059..94ba5576f 100644 --- a/rest/taskana-rest-spring/src/main/java/pro/taskana/task/rest/TaskController.java +++ b/rest/taskana-rest-spring/src/main/java/pro/taskana/task/rest/TaskController.java @@ -147,12 +147,11 @@ public class TaskController { /** * This endpoint retrieves a specific Task. * - * @title Get a single Task * @param taskId the id of the requested Task * @return the requested Task * @throws TaskNotFoundException if the requested Task does not exist. - * @throws NotAuthorizedException if the current user is not authorized to get the requested - * Task. + * @throws NotAuthorizedException if the current user is not authorized to get the requested Task. + * @title Get a single Task */ @GetMapping(path = RestEndpoints.URL_TASKS_ID) @Transactional(readOnly = true, rollbackFor = Exception.class) @@ -172,15 +171,15 @@ public class TaskController { /** * This endpoint claims a Task if possible. * - * @title Claim a Task - * @param taskId the requested Task which should be claimed + * @param taskId the id of the Task which should be claimed * @param userName TODO: this is currently not used * @return the claimed Task * @throws TaskNotFoundException if the requested Task does not exist. - * @throws InvalidStateException then the state of the requested Task is not READY. + * @throws InvalidStateException if the state of the requested Task is not READY. * @throws InvalidOwnerException if the Task is already claimed by someone else. * @throws NotAuthorizedException if the current user has no read permissions for the requested * Task. + * @title Claim a Task */ @PostMapping(path = RestEndpoints.URL_TASKS_ID_CLAIM) @Transactional(rollbackFor = Exception.class) @@ -202,15 +201,15 @@ public class TaskController { } /** - * Selects the first Task returned by the Task Query and claims it. + * This endpoint selects the first Task returned by the Task Query and claims it. * - * @title Select and claim a Task * @param filterParameter the filter parameters * @param sortParameter the sort parameters * @return the claimed Task - * @throws InvalidOwnerException If the Task is already claimed by someone else + * @throws InvalidOwnerException if the Task is already claimed by someone else * @throws NotAuthorizedException if the current user has no read permission for the Workbasket * the Task is in + * @title Select and claim a Task */ @PostMapping(path = RestEndpoints.URL_TASKS_ID_SELECT_AND_CLAIM) @Transactional(rollbackFor = Exception.class) @@ -236,16 +235,17 @@ public class TaskController { } /** - * Cancel the claim of an existing Task if it was claimed by the current user before. + * This endpoint cancels the claim of an existing Task if it was claimed by the current user + * before. * - * @title Cancel a claimed Task * @param taskId the id of the requested Task. * @return the unclaimed Task. * @throws TaskNotFoundException if the requested Task does not exist. - * @throws InvalidStateException if the Task is already in a final state. + * @throws InvalidStateException if the Task is already in an end state. * @throws InvalidOwnerException if the Task is claimed by a different user. * @throws NotAuthorizedException if the current user has no read permission for the Workbasket * the Task is in + * @title Cancel a claimed Task */ @DeleteMapping(path = RestEndpoints.URL_TASKS_ID_CLAIM) @Transactional(rollbackFor = Exception.class) @@ -268,14 +268,14 @@ public class TaskController { /** * This endpoint completes a Task. * - * @title Complete a Task - * @param taskId the requested Task. + * @param taskId id of the requested Task to complete. * @return the completed Task * @throws TaskNotFoundException if the requested Task does not exist. * @throws InvalidOwnerException if current user is not the owner of the Task or an administrator. - * @throws InvalidStateException if Task wasn't claimed before. + * @throws InvalidStateException if Task wasn't claimed previously. * @throws NotAuthorizedException if the current user has no read permission for the Workbasket * the Task is in + * @title Complete a Task */ @PostMapping(path = RestEndpoints.URL_TASKS_ID_COMPLETE) @Transactional(rollbackFor = Exception.class) @@ -319,15 +319,15 @@ public class TaskController { /** * This endpoint creates a persistent Task. * - * @title Create a new Task * @param taskRepresentationModel the Task which should be created. * @return the created Task * @throws WorkbasketNotFoundException if the referenced Workbasket does not exist * @throws ClassificationNotFoundException if the referenced Classification does not exist - * @throws NotAuthorizedException if the current user is not authorized to append a Task in the + * @throws NotAuthorizedException if the current user is not authorized to append a Task to the * referenced Workbasket * @throws TaskAlreadyExistException if the requested Task already exists. * @throws InvalidArgumentException if any input is semantically wrong. + * @title Create a new Task */ @PostMapping(path = RestEndpoints.URL_TASKS) @Transactional(rollbackFor = Exception.class) @@ -384,9 +384,8 @@ public class TaskController { /** * This endpoint updates a requested Task. * - * @title Update a Task * @param taskId the id of the Task which should be updated - * @param taskRepresentationModel the new Task + * @param taskRepresentationModel the new Task for the requested id. * @return the updated Task * @throws TaskNotFoundException if the requested Task does not exist. * @throws ClassificationNotFoundException if the updated Classification does not exist. @@ -394,9 +393,11 @@ public class TaskController { * @throws ConcurrencyException if the Task has been updated by a different process in the * meantime * @throws NotAuthorizedException if the current user is not authorized. - * @throws AttachmentPersistenceException if the Task contains two attachments with the same id. + * @throws AttachmentPersistenceException if the modified Task contains two attachments with the + * same id. * @throws InvalidStateException if an attempt is made to change the owner of the Task and the * Task is not in state READY. + * @title Update a Task */ @PutMapping(path = RestEndpoints.URL_TASKS_ID) @Transactional(rollbackFor = Exception.class) diff --git a/rest/taskana-rest-spring/src/main/java/pro/taskana/task/rest/TaskQueryFilterParameter.java b/rest/taskana-rest-spring/src/main/java/pro/taskana/task/rest/TaskQueryFilterParameter.java index 83520d98c..bbd4f5725 100644 --- a/rest/taskana-rest-spring/src/main/java/pro/taskana/task/rest/TaskQueryFilterParameter.java +++ b/rest/taskana-rest-spring/src/main/java/pro/taskana/task/rest/TaskQueryFilterParameter.java @@ -24,60 +24,54 @@ public class TaskQueryFilterParameter implements QueryParameter /** Filter by the name of the task. This is an exact match. */ private final String[] name; /** - * Filter by the name of the task. This results into a substring search. (% is appended to the + * Filter by the name of the task. This results in a substring search.. (% is appended to the * front and end of the requested value). Further SQL "Like" wildcard characters will be resolved * correctly. */ @JsonProperty("name-like") private final String[] nameLike; - /** Filter by the priority of the task. */ + /** Filter by the priority of the task. This is an exact match. */ private final int[] priority; - - /** Filter by the task state. */ + /** Filter by the task state. This is an exact match. */ private final TaskState[] state; - /** Filter by the classification key. */ + /** Filter by the classification key. This is an exact match. */ @JsonProperty("classification.key") private final String[] classificationKeys; - /** Filter by task id. */ + /** Filter by task id. This is an exact match. */ @JsonProperty("task-id") private final String[] taskIds; - /** Filter by workbasket id. */ + /** Filter by workbasket id. This is an exact match. */ @JsonProperty("workbasket-id") private final String[] workbasketIds; /** Filter by workbasket keys. This parameter can only be used in combination with 'domain' */ @JsonProperty("workbasket-key") private final String[] workbasketKeys; - - /** Filter by domain. */ + /** Filter by domain. This is an exact match. */ private final String domain; - /** Filter by owner. */ + /** Filter by owner. This is an exact match. */ private final String[] owner; /** - * Filter by the owner of the task. This results into a substring search. (% is appended to the + * Filter by the owner of the task. This results in a substring search.. (% is appended to the * front and end of the requested value). Further SQL "Like" wildcard characters will be resolved * correctly. */ @JsonProperty("owner-like") private final String[] ownerLike; - /** Filter by the company of the primary object reference. */ + /** Filter by the company of the primary object reference. This is an exact match. */ @JsonProperty("por.company") private final String[] porCompany; - - /** Filter by the system of the primary object reference. */ + /** Filter by the system of the primary object reference. This is an exact match. */ @JsonProperty("por.system") private final String[] porSystem; - /** Filter by the system instance of the primary object reference. */ + /** Filter by the system instance of the primary object reference. This is an exact match. */ @JsonProperty("por.instance") private final String[] porInstance; - - /** Filter by the type of the primary object reference. */ + /** Filter by the type of the primary object reference. This is an exact match. */ @JsonProperty("por.type") private final String[] porType; - - /** Filter by the value of the primary object reference. */ + /** Filter by the value of the primary object reference. This is an exact match. */ @JsonProperty("por.value") private final String[] porValue; - /** * Filter by a planned time interval. The length of the provided values has to be even. To create * an open interval you can either use 'null' or just leave it blank. @@ -146,14 +140,14 @@ public class TaskQueryFilterParameter implements QueryParameter private final WildcardSearchField[] wildcardSearchFields; /** - * Filter by wildcard search field. + * Filter by wildcard search field. This is an exact match. * *

This must be used in combination with 'wildcard-search-value' */ @JsonProperty("wildcard-search-value") private final String wildcardSearchValue; - /** Filter by the external id. */ + /** Filter by the external id. This is an exact match. */ @JsonProperty("external-id") private final String[] externalIds; diff --git a/rest/taskana-rest-spring/src/main/java/pro/taskana/task/rest/models/AttachmentRepresentationModel.java b/rest/taskana-rest-spring/src/main/java/pro/taskana/task/rest/models/AttachmentRepresentationModel.java index 7495ae98d..792e42c84 100644 --- a/rest/taskana-rest-spring/src/main/java/pro/taskana/task/rest/models/AttachmentRepresentationModel.java +++ b/rest/taskana-rest-spring/src/main/java/pro/taskana/task/rest/models/AttachmentRepresentationModel.java @@ -8,7 +8,7 @@ import pro.taskana.task.api.models.Attachment; /** EntityModel class for {@link Attachment}. */ public class AttachmentRepresentationModel extends AttachmentSummaryRepresentationModel { - /** All additional information on the task. */ + /** All additional information of the Attachment. */ private Map customAttributes = new HashMap<>(); public Map getCustomAttributes() { diff --git a/rest/taskana-rest-spring/src/main/java/pro/taskana/task/rest/models/ObjectReferenceRepresentationModel.java b/rest/taskana-rest-spring/src/main/java/pro/taskana/task/rest/models/ObjectReferenceRepresentationModel.java index f2ded68e7..079a58b3c 100644 --- a/rest/taskana-rest-spring/src/main/java/pro/taskana/task/rest/models/ObjectReferenceRepresentationModel.java +++ b/rest/taskana-rest-spring/src/main/java/pro/taskana/task/rest/models/ObjectReferenceRepresentationModel.java @@ -7,13 +7,13 @@ public class ObjectReferenceRepresentationModel /** Unique ID. */ private String id; - /** The company referenced primary object belongs to. */ + /** The company the referenced primary object belongs to. */ private String company; - /** The (kind of) system, the object resides in (e.g. SAP, MySystem A, ...). */ + /** The (kind of) system, the referenced primary object resides in (e.g. SAP, MySystem A, ...). */ private String system; - /** The instance of the system, the object resides in. */ + /** The instance of the system, the referenced primary object resides in. */ private String systemInstance; - /** The type of the reference (contract, claim, policy, customer, ...). */ + /** The type of the referenced primary object (contract, claim, policy, customer, ...). */ private String type; /** The value of the primary object reference. */ private String value; diff --git a/rest/taskana-rest-spring/src/main/java/pro/taskana/task/rest/models/TaskRepresentationModel.java b/rest/taskana-rest-spring/src/main/java/pro/taskana/task/rest/models/TaskRepresentationModel.java index 5cc42653b..18b24ffd9 100644 --- a/rest/taskana-rest-spring/src/main/java/pro/taskana/task/rest/models/TaskRepresentationModel.java +++ b/rest/taskana-rest-spring/src/main/java/pro/taskana/task/rest/models/TaskRepresentationModel.java @@ -13,7 +13,7 @@ import pro.taskana.task.api.models.Task; public class TaskRepresentationModel extends TaskSummaryRepresentationModel { // All objects have to be serializable - /** Additional information on the task. */ + /** Additional information of the task. */ private List customAttributes = Collections.emptyList(); /** Callback Information of the task. */ diff --git a/rest/taskana-rest-spring/src/main/java/pro/taskana/task/rest/models/TaskSummaryRepresentationModel.java b/rest/taskana-rest-spring/src/main/java/pro/taskana/task/rest/models/TaskSummaryRepresentationModel.java index 894c16040..cfa183aa7 100644 --- a/rest/taskana-rest-spring/src/main/java/pro/taskana/task/rest/models/TaskSummaryRepresentationModel.java +++ b/rest/taskana-rest-spring/src/main/java/pro/taskana/task/rest/models/TaskSummaryRepresentationModel.java @@ -59,7 +59,7 @@ public class TaskSummaryRepresentationModel protected String businessProcessId; /** the parent business process id. */ protected String parentBusinessProcessId; - /** The owner of the tasks. The owner is set upon claiming of the task. */ + /** The owner of the task. The owner is set upon claiming of the task. */ protected String owner; /** The Objects primary ObjectReference. */ @NotNull protected ObjectReferenceRepresentationModel primaryObjRef; diff --git a/rest/taskana-rest-spring/src/main/java/pro/taskana/workbasket/rest/WorkbasketAccessItemController.java b/rest/taskana-rest-spring/src/main/java/pro/taskana/workbasket/rest/WorkbasketAccessItemController.java index f6c9bbfc7..13c4e3bfd 100644 --- a/rest/taskana-rest-spring/src/main/java/pro/taskana/workbasket/rest/WorkbasketAccessItemController.java +++ b/rest/taskana-rest-spring/src/main/java/pro/taskana/workbasket/rest/WorkbasketAccessItemController.java @@ -88,7 +88,7 @@ public class WorkbasketAccessItemController { * This endpoint deletes all Workbasket Access Items for a provided Access Id. * * @title Delete a Workbasket Access Item - * @param accessId the Access Id which should be removed + * @param accessId the Access Id whose Workbasket Access Items should be removed * @return no content * @throws NotAuthorizedException if the user is not authorized. * @throws InvalidArgumentException if some argument is invalid. diff --git a/rest/taskana-rest-spring/src/main/java/pro/taskana/workbasket/rest/WorkbasketAccessItemQueryFilterParameter.java b/rest/taskana-rest-spring/src/main/java/pro/taskana/workbasket/rest/WorkbasketAccessItemQueryFilterParameter.java index e776d78cb..8b8f891bf 100644 --- a/rest/taskana-rest-spring/src/main/java/pro/taskana/workbasket/rest/WorkbasketAccessItemQueryFilterParameter.java +++ b/rest/taskana-rest-spring/src/main/java/pro/taskana/workbasket/rest/WorkbasketAccessItemQueryFilterParameter.java @@ -15,8 +15,8 @@ public class WorkbasketAccessItemQueryFilterParameter private final String[] workbasketKey; /** - * Filter by the key of the workbasket. This results into a substring search. (% is appended to - * the front and end of the requested value). Further SQL "Like" wildcard characters will be + * Filter by the key of the workbasket. This results in a substring search.. (% is appended to the + * beginning and end of the requested value). Further SQL "Like" wildcard characters will be * resolved correctly. */ @JsonProperty("workbasket-key-like") @@ -27,8 +27,8 @@ public class WorkbasketAccessItemQueryFilterParameter private final String[] accessId; /** - * Filter by the name of the access id. This results into a substring search. (% is appended to - * the front and end of the requested value). Further SQL "Like" wildcard characters will be + * Filter by the name of the access id. This results in a substring search.. (% is appended to the + * beginning and end of the requested value). Further SQL "Like" wildcard characters will be * resolved correctly. */ @JsonProperty("access-id-like") diff --git a/rest/taskana-rest-spring/src/main/java/pro/taskana/workbasket/rest/WorkbasketController.java b/rest/taskana-rest-spring/src/main/java/pro/taskana/workbasket/rest/WorkbasketController.java index 5c4e38f8e..00e0406e5 100644 --- a/rest/taskana-rest-spring/src/main/java/pro/taskana/workbasket/rest/WorkbasketController.java +++ b/rest/taskana-rest-spring/src/main/java/pro/taskana/workbasket/rest/WorkbasketController.java @@ -153,8 +153,7 @@ public class WorkbasketController { * @title Delete a Workbasket * @param workbasketId the id of the Workbasket which should be deleted * @return the deleted Workbasket - * @throws NotAuthorizedException if the current user is not authorized to delete this - * Workbasket. + * @throws NotAuthorizedException if the current user is not authorized to delete this Workbasket. * @throws InvalidArgumentException if the requested Workbasket id is null or empty * @throws WorkbasketNotFoundException if the requested Workbasket is not found * @throws WorkbasketInUseException if the Workbasket contains tasks. @@ -224,10 +223,10 @@ public class WorkbasketController { * * @title Update a Workbasket * @param workbasketId the id of the Workbasket which should be updated. - * @param workbasketRepresentationModel the new Workbasket. + * @param workbasketRepresentationModel the new Workbasket for the requested id. * @return the updated Workbasket - * @throws InvalidWorkbasketException if the requested id and the id within the new Workbasket - * do not match. + * @throws InvalidWorkbasketException if the requested id and the id within the new Workbasket do + * not match. * @throws WorkbasketNotFoundException if the requested workbasket does not * @throws NotAuthorizedException if the current user is not authorized to update the Workbasket * @throws ConcurrencyException if an attempt is made to update the Workbasket and another user @@ -270,7 +269,7 @@ public class WorkbasketController { * @return the access items for the requested workbasket. * @throws NotAuthorizedException if the current user is not member of role BUSINESS_ADMIN or * ADMIN - * @throws WorkbasketNotFoundException the requested Workbasket does not exist. + * @throws WorkbasketNotFoundException if the requested Workbasket does not exist. */ @GetMapping( path = RestEndpoints.URL_WORKBASKET_ID_ACCESS_ITEMS, @@ -300,29 +299,29 @@ public class WorkbasketController { * * @title Set all Workbasket Access Items * @param workbasketId the id of the Workbasket whose Workbasket Access Items will be replaced - * @param workbasketAccessResourceItems the new Workbasket Access Items. + * @param workbasketAccessItemRepModels the new Workbasket Access Items. * @return the new Workbasket Access Items for the requested Workbasket * @throws NotAuthorizedException if the current user is not member of role BUSINESS_ADMIN or * ADMIN * @throws InvalidArgumentException if the new Workbasket Access Items are not provided. * @throws WorkbasketNotFoundException TODO: this is never thrown. - * @throws WorkbasketAccessItemAlreadyExistException if a duplicate Workbasket Access Item - * exists in the provided list. + * @throws WorkbasketAccessItemAlreadyExistException if a duplicate Workbasket Access Item exists + * in the provided list. */ @PutMapping(path = RestEndpoints.URL_WORKBASKET_ID_ACCESS_ITEMS) @Transactional(rollbackFor = Exception.class) public ResponseEntity setWorkbasketAccessItems( @PathVariable(value = "workbasketId") String workbasketId, - @RequestBody WorkbasketAccessItemCollectionRepresentationModel workbasketAccessResourceItems) + @RequestBody WorkbasketAccessItemCollectionRepresentationModel workbasketAccessItemRepModels) throws NotAuthorizedException, InvalidArgumentException, WorkbasketNotFoundException, WorkbasketAccessItemAlreadyExistException { LOGGER.debug("Entry to setWorkbasketAccessItems(workbasketId= {})", workbasketId); - if (workbasketAccessResourceItems == null) { + if (workbasketAccessItemRepModels == null) { throw new InvalidArgumentException("Can´t create something with NULL body-value."); } List wbAccessItems = new ArrayList<>(); - workbasketAccessResourceItems + workbasketAccessItemRepModels .getContent() .forEach( item -> @@ -364,10 +363,10 @@ public class WorkbasketController { LOGGER.debug("Entry to getDistributionTargets(workbasketId= {})", workbasketId); List distributionTargets = workbasketService.getDistributionTargets(workbasketId); - DistributionTargetsCollectionRepresentationModel distributionTargetListResource = + DistributionTargetsCollectionRepresentationModel distributionTargetRepModels = workbasketSummaryRepresentationModelAssembler.toTaskanaCollectionModel(distributionTargets); ResponseEntity result = - ResponseEntity.ok(distributionTargetListResource); + ResponseEntity.ok(distributionTargetRepModels); if (LOGGER.isDebugEnabled()) { LOGGER.debug("Exit from getDistributionTargets(), returning {}", result); } @@ -383,7 +382,7 @@ public class WorkbasketController { * @param targetWorkbasketIds the destination Workbaskets. * @return the new Distribution Targets for the requested Workbasket. * @throws WorkbasketNotFoundException if any Workbasket was not found (either source or target) - * @throws NotAuthorizedException if the current used doesn't have READ permission for the source + * @throws NotAuthorizedException if the current user doesn't have READ permission for the source * Workbasket */ @PutMapping(path = RestEndpoints.URL_WORKBASKET_ID_DISTRIBUTION) diff --git a/rest/taskana-rest-spring/src/main/java/pro/taskana/workbasket/rest/WorkbasketQueryFilterParameter.java b/rest/taskana-rest-spring/src/main/java/pro/taskana/workbasket/rest/WorkbasketQueryFilterParameter.java index a286c548f..a85029ed5 100644 --- a/rest/taskana-rest-spring/src/main/java/pro/taskana/workbasket/rest/WorkbasketQueryFilterParameter.java +++ b/rest/taskana-rest-spring/src/main/java/pro/taskana/workbasket/rest/WorkbasketQueryFilterParameter.java @@ -15,8 +15,8 @@ public class WorkbasketQueryFilterParameter implements QueryParameterThe format is ISO-8601. */ diff --git a/rest/taskana-rest-spring/src/test/java/pro/taskana/classification/rest/ClassificationControllerRestDocumentationTest.java b/rest/taskana-rest-spring/src/test/java/pro/taskana/classification/rest/ClassificationControllerRestDocumentationTest.java index 576bb6295..59218508b 100644 --- a/rest/taskana-rest-spring/src/test/java/pro/taskana/classification/rest/ClassificationControllerRestDocumentationTest.java +++ b/rest/taskana-rest-spring/src/test/java/pro/taskana/classification/rest/ClassificationControllerRestDocumentationTest.java @@ -1,28 +1,21 @@ package pro.taskana.classification.rest; -import static org.assertj.core.api.Assertions.assertThat; import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.delete; import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.get; import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.post; import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.put; -import java.util.List; -import org.junit.jupiter.api.MethodOrderer.OrderAnnotation; -import org.junit.jupiter.api.Order; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.TestMethodOrder; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.web.servlet.result.MockMvcResultMatchers; import pro.taskana.classification.api.ClassificationService; import pro.taskana.classification.api.models.Classification; -import pro.taskana.classification.api.models.ClassificationSummary; import pro.taskana.classification.rest.assembler.ClassificationRepresentationModelAssembler; import pro.taskana.classification.rest.models.ClassificationRepresentationModel; import pro.taskana.common.rest.RestEndpoints; import pro.taskana.common.test.BaseRestDocumentationTest; -@TestMethodOrder(OrderAnnotation.class) class ClassificationControllerRestDocumentationTest extends BaseRestDocumentationTest { @Autowired ClassificationRepresentationModelAssembler assembler; @@ -44,10 +37,10 @@ class ClassificationControllerRestDocumentationTest extends BaseRestDocumentatio } @Test - @Order(1) void createClassificationDocTest() throws Exception { Classification classification = classificationService.newClassification("Key0815casdgdgh", "DOMAIN_B", "TASK"); + classification.setServiceLevel("P1D"); ClassificationRepresentationModel repModel = assembler.toModel(classification); mockMvc .perform( @@ -56,25 +49,12 @@ class ClassificationControllerRestDocumentationTest extends BaseRestDocumentatio .andExpect(MockMvcResultMatchers.status().isCreated()); } - /** - * this test only works with the {@link - * ClassificationControllerRestDocumentationTest#createClassificationDocTest()} test. - * - * @throws Exception if any exception is thrown. - */ @Test - @Order(2) void deleteClassificationDocTest() throws Exception { - List list = - classificationService - .createClassificationQuery() - .keyIn("Key0815casdgdgh") - .domainIn("DOMAIN_B") - .typeIn("TASK") - .list(); - assertThat(list).hasSize(1); mockMvc - .perform(delete(RestEndpoints.URL_CLASSIFICATIONS_ID, list.get(0).getId())) + .perform( + delete( + RestEndpoints.URL_CLASSIFICATIONS_ID, "CLI:100000000000000000000000000000000010")) .andExpect(MockMvcResultMatchers.status().isNoContent()); } diff --git a/rest/taskana-rest-spring/src/test/java/pro/taskana/classification/rest/ClassificationDefinitionControllerRestDocumentationTest.java b/rest/taskana-rest-spring/src/test/java/pro/taskana/classification/rest/ClassificationDefinitionControllerRestDocumentationTest.java index 464f75a6f..99c5485bb 100644 --- a/rest/taskana-rest-spring/src/test/java/pro/taskana/classification/rest/ClassificationDefinitionControllerRestDocumentationTest.java +++ b/rest/taskana-rest-spring/src/test/java/pro/taskana/classification/rest/ClassificationDefinitionControllerRestDocumentationTest.java @@ -15,8 +15,7 @@ import pro.taskana.classification.rest.models.ClassificationCollectionRepresenta import pro.taskana.common.rest.RestEndpoints; import pro.taskana.common.test.BaseRestDocumentationTest; -class ClassificationDefinitionControllerRestDocumentationTest - extends BaseRestDocumentationTest { +class ClassificationDefinitionControllerRestDocumentationTest extends BaseRestDocumentationTest { @Autowired ClassificationRepresentationModelAssembler assembler; @Autowired ClassificationService classificationService; @@ -32,6 +31,7 @@ class ClassificationDefinitionControllerRestDocumentationTest void importClassificationDefinitionsDocTest() throws Exception { Classification classification = classificationService.newClassification("Key0815", "DOMAIN_B", "TASK"); + classification.setServiceLevel("P1D"); ClassificationCollectionRepresentationModel importCollection = assembler.toTaskanaCollectionModel(List.of(classification)); diff --git a/rest/taskana-rest-spring/src/test/java/pro/taskana/common/rest/AccessIdControllerRestDocumentationTest.java b/rest/taskana-rest-spring/src/test/java/pro/taskana/common/rest/AccessIdControllerRestDocumentationTest.java index bd73acfaa..a8c49e2c6 100644 --- a/rest/taskana-rest-spring/src/test/java/pro/taskana/common/rest/AccessIdControllerRestDocumentationTest.java +++ b/rest/taskana-rest-spring/src/test/java/pro/taskana/common/rest/AccessIdControllerRestDocumentationTest.java @@ -18,8 +18,8 @@ public class AccessIdControllerRestDocumentationTest extends BaseRestDocumentati @Test void getGroupsForAccessIdDocTest() throws Exception { - mockMvc.perform(get(RestEndpoints.URL_ACCESS_ID_GROUPS + "?access-id=teamlead-1")) + mockMvc + .perform(get(RestEndpoints.URL_ACCESS_ID_GROUPS + "?access-id=teamlead-1")) .andExpect(MockMvcResultMatchers.status().isOk()); } - } diff --git a/rest/taskana-rest-spring/src/test/java/pro/taskana/common/rest/QuerySortParameterTest.java b/rest/taskana-rest-spring/src/test/java/pro/taskana/common/rest/QuerySortParameterTest.java index de9781eb3..81e664d18 100644 --- a/rest/taskana-rest-spring/src/test/java/pro/taskana/common/rest/QuerySortParameterTest.java +++ b/rest/taskana-rest-spring/src/test/java/pro/taskana/common/rest/QuerySortParameterTest.java @@ -19,8 +19,8 @@ class QuerySortParameterTest { MockQuery query = mock(MockQuery.class); MockSortBy sortBy = mock(MockSortBy.class); - QuerySortParameter sortByParameter = new QuerySortParameter<>( - List.of(sortBy), List.of(SortDirection.ASCENDING)); + QuerySortParameter sortByParameter = + new QuerySortParameter<>(List.of(sortBy), List.of(SortDirection.ASCENDING)); sortByParameter.applyToQuery(query); @@ -73,8 +73,8 @@ class QuerySortParameterTest { MockSortBy sortBy2 = mock(MockSortBy.class); QuerySortParameter sortByParameter = - new QuerySortParameter<>(List.of(sortBy1, sortBy2), - List.of(SortDirection.ASCENDING, SortDirection.ASCENDING)); + new QuerySortParameter<>( + List.of(sortBy1, sortBy2), List.of(SortDirection.ASCENDING, SortDirection.ASCENDING)); sortByParameter.applyToQuery(query); @@ -87,10 +87,10 @@ class QuerySortParameterTest { MockSortBy sortBy = mock(MockSortBy.class); SortDirection sortDirection = SortDirection.ASCENDING; assertThatThrownBy( - () -> new QuerySortParameter<>(List.of(sortBy, sortBy), List.of(sortDirection))) + () -> new QuerySortParameter<>(List.of(sortBy, sortBy), List.of(sortDirection))) .isInstanceOf(InvalidArgumentException.class); assertThatThrownBy( - () -> new QuerySortParameter<>(List.of(sortBy), List.of(sortDirection, sortDirection))) + () -> new QuerySortParameter<>(List.of(sortBy), List.of(sortDirection, sortDirection))) .isInstanceOf(InvalidArgumentException.class); } @@ -102,11 +102,7 @@ class QuerySortParameterTest { private enum MockColumnNames implements QueryColumnName {} - private abstract static class MockSortBy implements QuerySortBy { + private abstract static class MockSortBy implements QuerySortBy {} - } - - private abstract static class MockQuery implements BaseQuery { - - } + private abstract static class MockQuery implements BaseQuery {} } diff --git a/rest/taskana-rest-spring/src/test/java/pro/taskana/common/rest/TestSchemaNameCustomizable.java b/rest/taskana-rest-spring/src/test/java/pro/taskana/common/rest/SchemaNameCustomizableTest.java similarity index 98% rename from rest/taskana-rest-spring/src/test/java/pro/taskana/common/rest/TestSchemaNameCustomizable.java rename to rest/taskana-rest-spring/src/test/java/pro/taskana/common/rest/SchemaNameCustomizableTest.java index 3dbaa85ea..0c3b8d39a 100644 --- a/rest/taskana-rest-spring/src/test/java/pro/taskana/common/rest/TestSchemaNameCustomizable.java +++ b/rest/taskana-rest-spring/src/test/java/pro/taskana/common/rest/SchemaNameCustomizableTest.java @@ -19,7 +19,7 @@ import pro.taskana.sampledata.SampleDataGenerator; /** Test that the schema name can be customized. */ @TaskanaSpringBootTest -class TestSchemaNameCustomizable { +class SchemaNameCustomizableTest { String schemaName = "CUSTOMSCHEMANAME"; boolean isPostgres = false; diff --git a/rest/taskana-rest-spring/src/test/java/pro/taskana/common/rest/TaskanaEngineControllerRestDocumentationTest.java b/rest/taskana-rest-spring/src/test/java/pro/taskana/common/rest/TaskanaEngineControllerRestDocumentationTest.java index a95dee588..1764a8bfe 100644 --- a/rest/taskana-rest-spring/src/test/java/pro/taskana/common/rest/TaskanaEngineControllerRestDocumentationTest.java +++ b/rest/taskana-rest-spring/src/test/java/pro/taskana/common/rest/TaskanaEngineControllerRestDocumentationTest.java @@ -48,4 +48,11 @@ class TaskanaEngineControllerRestDocumentationTest extends BaseRestDocumentation .perform(get(RestEndpoints.URL_HISTORY_ENABLED)) .andExpect(MockMvcResultMatchers.status().isOk()); } + + @Test + void getCurrentVersionDocTest() throws Exception { + mockMvc + .perform(get(RestEndpoints.URL_VERSION)) + .andExpect(MockMvcResultMatchers.status().isOk()); + } } diff --git a/rest/taskana-rest-spring/src/test/java/pro/taskana/common/rest/WebSecurityConfigurer.java b/rest/taskana-rest-spring/src/test/java/pro/taskana/common/rest/WebSecurityConfigurer.java index ee4708506..979a3b773 100644 --- a/rest/taskana-rest-spring/src/test/java/pro/taskana/common/rest/WebSecurityConfigurer.java +++ b/rest/taskana-rest-spring/src/test/java/pro/taskana/common/rest/WebSecurityConfigurer.java @@ -10,7 +10,6 @@ import org.springframework.security.core.authority.mapping.GrantedAuthoritiesMap import org.springframework.security.ldap.userdetails.LdapAuthoritiesPopulator; import org.springframework.security.web.jaasapi.JaasApiIntegrationFilter; - @EnableWebSecurity public class WebSecurityConfigurer extends WebSecurityConfigurerAdapter { diff --git a/rest/taskana-rest-spring/src/test/java/pro/taskana/monitor/rest/models/ReportRepresentationModelTest.java b/rest/taskana-rest-spring/src/test/java/pro/taskana/monitor/rest/models/ReportRepresentationModelTest.java index 3f83bd3f5..c680fc30d 100644 --- a/rest/taskana-rest-spring/src/test/java/pro/taskana/monitor/rest/models/ReportRepresentationModelTest.java +++ b/rest/taskana-rest-spring/src/test/java/pro/taskana/monitor/rest/models/ReportRepresentationModelTest.java @@ -62,7 +62,7 @@ class ReportRepresentationModelTest { assertThat(meta.getRowDesc()).isEqualTo(new String[] {"WORKBASKET"}); assertThat(meta.getHeader()) .isEqualTo(headers.stream().map(TimeIntervalColumnHeader::getDisplayName).toArray()); - assertThat(meta.getTotalDesc()).isEqualTo("Total"); + assertThat(meta.getSumRowDesc()).isEqualTo("Total"); // rows assertThat(resource.getRows()).isEmpty(); @@ -98,7 +98,7 @@ class ReportRepresentationModelTest { assertThat(meta.getRowDesc()).isEqualTo(new String[] {"CLASSIFICATION"}); assertThat(meta.getHeader()) .isEqualTo(headers.stream().map(TimeIntervalColumnHeader::getDisplayName).toArray()); - assertThat(meta.getTotalDesc()).isEqualTo("Total"); + assertThat(meta.getSumRowDesc()).isEqualTo("Total"); // rows List rows = resource.getRows(); @@ -144,7 +144,7 @@ class ReportRepresentationModelTest { assertThat(meta.getRowDesc()).isEqualTo(new String[] {"CLASSIFICATION"}); assertThat(meta.getHeader()) .isEqualTo(headers.stream().map(TimeIntervalColumnHeader::getDisplayName).toArray()); - assertThat(meta.getTotalDesc()).isEqualTo("Total"); + assertThat(meta.getSumRowDesc()).isEqualTo("Total"); // rows List rows = resource.getRows(); @@ -199,7 +199,7 @@ class ReportRepresentationModelTest { assertThat(meta.getRowDesc()).isEqualTo(new String[] {"TASK CLASSIFICATION", "ATTACHMENT"}); assertThat(meta.getHeader()) .isEqualTo(headers.stream().map(TimeIntervalColumnHeader::getDisplayName).toArray()); - assertThat(meta.getTotalDesc()).isEqualTo("Total"); + assertThat(meta.getSumRowDesc()).isEqualTo("Total"); // rows List rows = resource.getRows(); @@ -279,7 +279,7 @@ class ReportRepresentationModelTest { assertThat(meta.getRowDesc()).isEqualTo(new String[] {"TASK CLASSIFICATION", "ATTACHMENT"}); assertThat(meta.getHeader()) .isEqualTo(headers.stream().map(TimeIntervalColumnHeader::getDisplayName).toArray()); - assertThat(meta.getTotalDesc()).isEqualTo("Total"); + assertThat(meta.getSumRowDesc()).isEqualTo("Total"); // rows List rows = resource.getRows();