TSK-1430: Rename Mapping to RestEndpoints, groups relevant endpoints together

This commit is contained in:
Chi Nguyen 2020-10-29 14:24:51 +01:00 committed by Mustapha Zorgati
parent 9c2453659a
commit 6dc782e37a
40 changed files with 372 additions and 318 deletions

View File

@ -55,7 +55,7 @@ public class ScheduledJob {
}
public Instant getDue() {
return due != null ? due.truncatedTo(ChronoUnit.MILLIS) : null;
return due != null ? due.truncatedTo(ChronoUnit.MILLIS) : null;
}
public void setDue(Instant due) {

View File

@ -103,7 +103,7 @@ public class WorkbasketHistoryEvent {
}
public Instant getCreated() {
return created != null ? created.truncatedTo(ChronoUnit.MILLIS) : null;
return created != null ? created.truncatedTo(ChronoUnit.MILLIS) : null;
}
public void setCreated(Instant created) {

View File

@ -19,7 +19,7 @@ import pro.taskana.classification.api.models.Classification;
import pro.taskana.classification.rest.assembler.ClassificationRepresentationModelAssembler;
import pro.taskana.classification.rest.models.ClassificationRepresentationModel;
import pro.taskana.common.api.exceptions.InvalidArgumentException;
import pro.taskana.common.rest.Mapping;
import pro.taskana.common.rest.RestEndpoints;
import pro.taskana.common.test.rest.RestHelper;
import pro.taskana.common.test.rest.TaskanaSpringBootTest;
import pro.taskana.task.api.models.Task;
@ -58,7 +58,7 @@ class AsyncUpdateJobIntTest {
ResponseEntity<ClassificationRepresentationModel> response =
TEMPLATE.exchange(
restHelper.toUrl(Mapping.URL_CLASSIFICATIONS_ID, CLASSIFICATION_ID),
restHelper.toUrl(RestEndpoints.URL_CLASSIFICATIONS_ID, CLASSIFICATION_ID),
HttpMethod.GET,
new HttpEntity<String>(restHelper.getHeadersTeamlead_1()),
ParameterizedTypeReference.forType(ClassificationRepresentationModel.class));
@ -73,7 +73,7 @@ class AsyncUpdateJobIntTest {
classification.setPriority(1000);
TEMPLATE.exchange(
restHelper.toUrl(Mapping.URL_CLASSIFICATIONS_ID, CLASSIFICATION_ID),
restHelper.toUrl(RestEndpoints.URL_CLASSIFICATIONS_ID, CLASSIFICATION_ID),
HttpMethod.PUT,
new HttpEntity<>(classification, restHelper.getHeadersTeamlead_1()),
ParameterizedTypeReference.forType(ClassificationRepresentationModel.class));
@ -86,7 +86,7 @@ class AsyncUpdateJobIntTest {
// verify the classification modified timestamp is after 'before'
ResponseEntity<ClassificationRepresentationModel> repeatedResponse =
TEMPLATE.exchange(
restHelper.toUrl(Mapping.URL_CLASSIFICATIONS_ID, CLASSIFICATION_ID),
restHelper.toUrl(RestEndpoints.URL_CLASSIFICATIONS_ID, CLASSIFICATION_ID),
HttpMethod.GET,
new HttpEntity<String>(restHelper.getHeadersTeamlead_1()),
ParameterizedTypeReference.forType(ClassificationRepresentationModel.class));
@ -151,7 +151,7 @@ class AsyncUpdateJobIntTest {
ResponseEntity<TaskRepresentationModel> taskResponse =
TEMPLATE.exchange(
restHelper.toUrl(Mapping.URL_TASKS_ID, taskId),
restHelper.toUrl(RestEndpoints.URL_TASKS_ID, taskId),
HttpMethod.GET,
new HttpEntity<>(restHelper.getHeadersAdmin()),
ParameterizedTypeReference.forType(TaskRepresentationModel.class));

View File

@ -38,8 +38,8 @@ import pro.taskana.common.api.exceptions.DomainNotFoundException;
import pro.taskana.common.api.exceptions.InvalidArgumentException;
import pro.taskana.common.api.exceptions.NotAuthorizedException;
import pro.taskana.common.rest.AbstractPagingController;
import pro.taskana.common.rest.Mapping;
import pro.taskana.common.rest.QueryHelper;
import pro.taskana.common.rest.RestEndpoints;
import pro.taskana.common.rest.models.TaskanaPagedModel;
/** Controller for all {@link Classification} related endpoints. */
@ -71,7 +71,7 @@ public class ClassificationController extends AbstractPagingController {
this.summaryModelAssembler = summaryModelAssembler;
}
@GetMapping(path = Mapping.URL_CLASSIFICATIONS)
@GetMapping(path = RestEndpoints.URL_CLASSIFICATIONS)
@Transactional(readOnly = true, rollbackFor = Exception.class)
public ResponseEntity<TaskanaPagedModel<ClassificationSummaryRepresentationModel>>
getClassifications(@RequestParam MultiValueMap<String, String> params)
@ -96,7 +96,7 @@ public class ClassificationController extends AbstractPagingController {
return response;
}
@GetMapping(path = Mapping.URL_CLASSIFICATIONS_ID, produces = MediaTypes.HAL_JSON_VALUE)
@GetMapping(path = RestEndpoints.URL_CLASSIFICATIONS_ID, produces = MediaTypes.HAL_JSON_VALUE)
@Transactional(readOnly = true, rollbackFor = Exception.class)
public ResponseEntity<ClassificationRepresentationModel> getClassification(
@PathVariable String classificationId) throws ClassificationNotFoundException {
@ -114,7 +114,7 @@ public class ClassificationController extends AbstractPagingController {
return response;
}
@PostMapping(path = Mapping.URL_CLASSIFICATIONS)
@PostMapping(path = RestEndpoints.URL_CLASSIFICATIONS)
@Transactional(rollbackFor = Exception.class)
public ResponseEntity<ClassificationRepresentationModel> createClassification(
@RequestBody ClassificationRepresentationModel resource)
@ -135,7 +135,7 @@ public class ClassificationController extends AbstractPagingController {
return response;
}
@PutMapping(path = Mapping.URL_CLASSIFICATIONS_ID)
@PutMapping(path = RestEndpoints.URL_CLASSIFICATIONS_ID)
@Transactional(rollbackFor = Exception.class)
public ResponseEntity<ClassificationRepresentationModel> updateClassification(
@PathVariable(value = "classificationId") String classificationId,
@ -169,7 +169,7 @@ public class ClassificationController extends AbstractPagingController {
return result;
}
@DeleteMapping(path = Mapping.URL_CLASSIFICATIONS_ID)
@DeleteMapping(path = RestEndpoints.URL_CLASSIFICATIONS_ID)
@Transactional(readOnly = true, rollbackFor = Exception.class)
public ResponseEntity<ClassificationRepresentationModel> deleteClassification(
@PathVariable String classificationId)

View File

@ -39,7 +39,7 @@ import pro.taskana.common.api.exceptions.ConcurrencyException;
import pro.taskana.common.api.exceptions.DomainNotFoundException;
import pro.taskana.common.api.exceptions.InvalidArgumentException;
import pro.taskana.common.api.exceptions.NotAuthorizedException;
import pro.taskana.common.rest.Mapping;
import pro.taskana.common.rest.RestEndpoints;
import pro.taskana.common.rest.models.TaskanaPagedModel;
/** Controller for Importing / Exporting classifications. */
@ -66,7 +66,7 @@ public class ClassificationDefinitionController {
this.classificationRepresentationModelAssembler = classificationRepresentationModelAssembler;
}
@GetMapping(path = Mapping.URL_CLASSIFICATIONDEFINITIONS)
@GetMapping(path = RestEndpoints.URL_CLASSIFICATION_DEFINITIONS)
@Transactional(readOnly = true, rollbackFor = Exception.class)
public ResponseEntity<TaskanaPagedModel<ClassificationRepresentationModel>> exportClassifications(
@RequestParam(required = false) String domain) {
@ -93,7 +93,7 @@ public class ClassificationDefinitionController {
return response;
}
@PostMapping(path = Mapping.URL_CLASSIFICATIONDEFINITIONS)
@PostMapping(path = RestEndpoints.URL_CLASSIFICATION_DEFINITIONS)
@Transactional(rollbackFor = Exception.class)
public ResponseEntity<Void> importClassifications(@RequestParam("file") MultipartFile file)
throws InvalidArgumentException, NotAuthorizedException, ConcurrencyException,

View File

@ -34,7 +34,7 @@ public class AccessIdController {
this.taskanaEngine = taskanaEngine;
}
@GetMapping(path = Mapping.URL_ACCESSID)
@GetMapping(path = RestEndpoints.URL_ACCESS_ID)
public ResponseEntity<List<AccessIdRepresentationModel>> validateAccessIds(
@RequestParam("search-for") String searchFor)
throws InvalidArgumentException, NotAuthorizedException {
@ -60,7 +60,7 @@ public class AccessIdController {
return response;
}
@GetMapping(path = Mapping.URL_ACCESSID_GROUPS)
@GetMapping(path = RestEndpoints.URL_ACCESS_ID_GROUPS)
public ResponseEntity<List<AccessIdRepresentationModel>> getGroupsByAccessId(
@RequestParam("access-id") String accessId)
throws InvalidArgumentException, NotAuthorizedException {

View File

@ -1,50 +0,0 @@
package pro.taskana.common.rest;
/** Collection of Url to Controller mappings. */
public final class Mapping {
public static final String PRE = "/api/v1/";
public static final String URL_ACCESSID = PRE + "access-ids";
public static final String URL_ACCESSID_GROUPS = URL_ACCESSID + "/groups";
public static final String URL_CLASSIFICATIONS = PRE + "classifications";
public static final String URL_CLASSIFICATIONS_ID = URL_CLASSIFICATIONS + "/{classificationId}";
public static final String URL_CLASSIFICATIONDEFINITIONS = PRE + "classification-definitions";
public static final String URL_MONITOR = PRE + "monitor";
public static final String URL_MONITOR_TASKS_STATUS = URL_MONITOR + "/tasks-status-report";
public static final String URL_MONITOR_TASKS_WORKBASKET =
URL_MONITOR + "/tasks-workbasket-report";
public static final String URL_MONITOR_TASKS_WORKBASKET_PLANNED =
URL_MONITOR + "/tasks-workbasket-planned-date-report";
public static final String URL_MONITOR_TASKS_CLASSIFICATION =
URL_MONITOR + "/tasks-classification-report";
public static final String URL_MONITOR_TIMESTAMP = URL_MONITOR + "/timestamp-report";
public static final String URL_DOMAIN = PRE + "domains";
public static final String URL_CLASSIFICATION_CATEGORIES = PRE + "classification-categories";
public static final String URL_CLASSIFICATION_TYPES = PRE + "classification-types";
public static final String URL_CLASSIFICATION_CATEGORIES_BY_TYPES =
PRE + "classifications-by-type";
public static final String URL_CURRENT_USER = PRE + "current-user-info";
public static final String URL_HISTORY_ENABLED = PRE + "history-provider-enabled";
public static final String URL_HISTORY_EVENTS = PRE + "task-history-event";
public static final String URL_HISTORY_EVENTS_ID = "/{historyEventId}";
public static final String URL_VERSION = PRE + "version";
public static final String URL_TASKS = PRE + "tasks";
public static final String URL_TASKS_ID = URL_TASKS + "/{taskId}";
public static final String URL_TASK_COMMENTS = URL_TASKS_ID + "/comments";
public static final String URL_TASK_COMMENT = URL_TASKS + "/comments/{taskCommentId}";
public static final String URL_TASKS_ID_CLAIM = URL_TASKS_ID + "/claim";
public static final String URL_TASKS_ID_SELECT_AND_CLAIM = URL_TASKS + "/select-and-claim";
public static final String URL_TASKS_ID_COMPLETE = URL_TASKS_ID + "/complete";
public static final String URL_TASKS_ID_TRANSFER_WORKBASKETID =
URL_TASKS_ID + "/transfer/{workbasketId}";
public static final String URL_WORKBASKET_ACCESS_ITEMS = PRE + "workbasket-access-items";
public static final String URL_WORKBASKET = PRE + "workbaskets";
public static final String URL_WORKBASKET_ID = URL_WORKBASKET + "/{workbasketId}";
public static final String URL_WORKBASKET_ID_ACCESSITEMS =
URL_WORKBASKET_ID + "/workbasketAccessItems";
public static final String URL_WORKBASKET_ID_DISTRIBUTION =
URL_WORKBASKET_ID + "/distribution-targets";
public static final String URL_WORKBASKET_DEFINITIONS = PRE + "workbasket-definitions";
private Mapping() {}
}

View File

@ -0,0 +1,57 @@
package pro.taskana.common.rest;
/** Collection of Url to Controller mappings. */
public final class RestEndpoints {
public static final String API_V1 = "/api/v1/";
public static final String URL_VERSION = API_V1 + "version";
public static final String URL_DOMAIN = API_V1 + "domains";
public static final String URL_CURRENT_USER = API_V1 + "current-user-info";
public static final String URL_ACCESS_ID = API_V1 + "access-ids";
public static final String URL_ACCESS_ID_GROUPS = URL_ACCESS_ID + "/groups";
public static final String URL_CLASSIFICATIONS = API_V1 + "classifications";
public static final String URL_CLASSIFICATIONS_ID = URL_CLASSIFICATIONS + "/{classificationId}";
public static final String URL_CLASSIFICATION_DEFINITIONS = API_V1 + "classification-definitions";
public static final String URL_CLASSIFICATION_CATEGORIES = API_V1 + "classification-categories";
public static final String URL_CLASSIFICATION_TYPES = API_V1 + "classification-types";
public static final String URL_CLASSIFICATION_CATEGORIES_BY_TYPES =
API_V1 + "classifications-by-type";
public static final String URL_WORKBASKET_ACCESS_ITEMS = API_V1 + "workbasket-access-items";
public static final String URL_WORKBASKET = API_V1 + "workbaskets";
public static final String URL_WORKBASKET_DEFINITIONS = API_V1 + "workbasket-definitions";
public static final String URL_WORKBASKET_ID = URL_WORKBASKET + "/{workbasketId}";
public static final String URL_WORKBASKET_ID_ACCESS_ITEMS =
URL_WORKBASKET_ID + "/workbasketAccessItems";
public static final String URL_WORKBASKET_ID_DISTRIBUTION =
URL_WORKBASKET_ID + "/distribution-targets";
public static final String URL_TASKS = API_V1 + "tasks";
public static final String URL_TASKS_ID = URL_TASKS + "/{taskId}";
public static final String URL_TASKS_ID_CLAIM = URL_TASKS_ID + "/claim";
public static final String URL_TASKS_ID_SELECT_AND_CLAIM = URL_TASKS + "/select-and-claim";
public static final String URL_TASKS_ID_COMPLETE = URL_TASKS_ID + "/complete";
public static final String URL_TASKS_ID_TRANSFER_WORKBASKET_ID =
URL_TASKS_ID + "/transfer/{workbasketId}";
public static final String URL_TASK_COMMENTS = URL_TASKS_ID + "/comments";
public static final String URL_TASK_COMMENT = URL_TASKS + "/comments/{taskCommentId}";
public static final String URL_MONITOR = API_V1 + "monitor";
public static final String URL_MONITOR_TASKS_STATUS = URL_MONITOR + "/tasks-status-report";
public static final String URL_MONITOR_TASKS_WORKBASKET =
URL_MONITOR + "/tasks-workbasket-report";
public static final String URL_MONITOR_TASKS_WORKBASKET_PLANNED =
URL_MONITOR + "/tasks-workbasket-planned-date-report";
public static final String URL_MONITOR_TASKS_CLASSIFICATION =
URL_MONITOR + "/tasks-classification-report";
public static final String URL_MONITOR_TIMESTAMP = URL_MONITOR + "/timestamp-report";
public static final String URL_HISTORY_ENABLED = API_V1 + "history-provider-enabled";
public static final String URL_HISTORY_EVENTS = API_V1 + "task-history-event";
public static final String URL_HISTORY_EVENTS_ID = "/{historyEventId}";
private RestEndpoints() {}
}

View File

@ -36,7 +36,7 @@ public class TaskanaEngineController {
this.taskanaEngine = taskanaEngine;
}
@GetMapping(path = Mapping.URL_DOMAIN)
@GetMapping(path = RestEndpoints.URL_DOMAIN)
public ResponseEntity<List<String>> getDomains() {
ResponseEntity<List<String>> response =
ResponseEntity.ok(taskanaEngineConfiguration.getDomains());
@ -46,7 +46,7 @@ public class TaskanaEngineController {
return response;
}
@GetMapping(path = Mapping.URL_CLASSIFICATION_CATEGORIES)
@GetMapping(path = RestEndpoints.URL_CLASSIFICATION_CATEGORIES)
public ResponseEntity<List<String>> getClassificationCategories(String type) {
LOGGER.debug("Entry to getClassificationCategories(type = {})", type);
ResponseEntity<List<String>> response;
@ -65,7 +65,7 @@ public class TaskanaEngineController {
return response;
}
@GetMapping(path = Mapping.URL_CLASSIFICATION_TYPES)
@GetMapping(path = RestEndpoints.URL_CLASSIFICATION_TYPES)
public ResponseEntity<List<String>> getClassificationTypes() {
ResponseEntity<List<String>> response =
ResponseEntity.ok(taskanaEngineConfiguration.getClassificationTypes());
@ -75,7 +75,7 @@ public class TaskanaEngineController {
return response;
}
@GetMapping(path = Mapping.URL_CLASSIFICATION_CATEGORIES_BY_TYPES)
@GetMapping(path = RestEndpoints.URL_CLASSIFICATION_CATEGORIES_BY_TYPES)
public ResponseEntity<Map<String, List<String>>> getClassificationCategoriesByTypeMap() {
ResponseEntity<Map<String, List<String>>> response =
ResponseEntity.ok(taskanaEngineConfiguration.getClassificationCategoriesByTypeMap());
@ -85,7 +85,7 @@ public class TaskanaEngineController {
return response;
}
@GetMapping(path = Mapping.URL_CURRENT_USER)
@GetMapping(path = RestEndpoints.URL_CURRENT_USER)
public ResponseEntity<TaskanaUserInfoRepresentationModel> getCurrentUserInfo() {
LOGGER.debug("Entry to getCurrentUserInfo()");
TaskanaUserInfoRepresentationModel resource = new TaskanaUserInfoRepresentationModel();
@ -104,7 +104,7 @@ public class TaskanaEngineController {
return response;
}
@GetMapping(path = Mapping.URL_HISTORY_ENABLED)
@GetMapping(path = RestEndpoints.URL_HISTORY_ENABLED)
public ResponseEntity<Boolean> getIsHistoryProviderEnabled() {
ResponseEntity<Boolean> response = ResponseEntity.ok(taskanaEngine.isHistoryEnabled());
LOGGER.debug("Exit from getIsHistoryProviderEnabled(), returning {}", response);
@ -116,7 +116,7 @@ public class TaskanaEngineController {
*
* @return The current version.
*/
@GetMapping(path = Mapping.URL_VERSION)
@GetMapping(path = RestEndpoints.URL_VERSION)
public ResponseEntity<VersionRepresentationModel> currentVersion() {
LOGGER.debug("Entry to currentVersion()");
VersionRepresentationModel resource = new VersionRepresentationModel();

View File

@ -18,7 +18,7 @@ import org.springframework.web.bind.annotation.RestController;
import pro.taskana.common.api.exceptions.InvalidArgumentException;
import pro.taskana.common.api.exceptions.NotAuthorizedException;
import pro.taskana.common.rest.Mapping;
import pro.taskana.common.rest.RestEndpoints;
import pro.taskana.monitor.api.MonitorService;
import pro.taskana.monitor.api.TaskTimestamp;
import pro.taskana.monitor.api.reports.header.TimeIntervalColumnHeader;
@ -45,7 +45,7 @@ public class MonitorController {
this.reportRepresentationModelAssembler = reportRepresentationModelAssembler;
}
@GetMapping(path = Mapping.URL_MONITOR_TASKS_STATUS)
@GetMapping(path = RestEndpoints.URL_MONITOR_TASKS_STATUS)
@Transactional(readOnly = true, rollbackFor = Exception.class)
public ResponseEntity<ReportRepresentationModel> getTasksStatusReport(
@RequestParam(required = false) List<String> domains,
@ -69,7 +69,7 @@ public class MonitorController {
return response;
}
@GetMapping(path = Mapping.URL_MONITOR_TASKS_WORKBASKET)
@GetMapping(path = RestEndpoints.URL_MONITOR_TASKS_WORKBASKET)
@Transactional(readOnly = true, rollbackFor = Exception.class)
public ResponseEntity<ReportRepresentationModel> getTasksWorkbasketReport(
@RequestParam(value = "states") List<TaskState> states)
@ -92,7 +92,7 @@ public class MonitorController {
return ResponseEntity.status(HttpStatus.OK).body(report);
}
@GetMapping(path = Mapping.URL_MONITOR_TASKS_WORKBASKET_PLANNED)
@GetMapping(path = RestEndpoints.URL_MONITOR_TASKS_WORKBASKET_PLANNED)
@Transactional(readOnly = true, rollbackFor = Exception.class)
public ResponseEntity<ReportRepresentationModel> getTasksWorkbasketPlannedDateReport(
@RequestParam(value = "daysInPast") int daysInPast,
@ -120,7 +120,7 @@ public class MonitorController {
return ResponseEntity.status(HttpStatus.OK).body(report);
}
@GetMapping(path = Mapping.URL_MONITOR_TASKS_CLASSIFICATION)
@GetMapping(path = RestEndpoints.URL_MONITOR_TASKS_CLASSIFICATION)
@Transactional(readOnly = true, rollbackFor = Exception.class)
public ResponseEntity<ReportRepresentationModel> getTasksClassificationReport()
throws NotAuthorizedException, InvalidArgumentException {
@ -140,7 +140,7 @@ public class MonitorController {
return ResponseEntity.status(HttpStatus.OK).body(report);
}
@GetMapping(path = Mapping.URL_MONITOR_TIMESTAMP)
@GetMapping(path = RestEndpoints.URL_MONITOR_TIMESTAMP)
@Transactional(readOnly = true, rollbackFor = Exception.class)
public ResponseEntity<ReportRepresentationModel> getDailyEntryExitReport()
throws NotAuthorizedException, InvalidArgumentException {

View File

@ -24,8 +24,8 @@ import pro.taskana.common.api.BaseQuery.SortDirection;
import pro.taskana.common.api.exceptions.ConcurrencyException;
import pro.taskana.common.api.exceptions.InvalidArgumentException;
import pro.taskana.common.api.exceptions.NotAuthorizedException;
import pro.taskana.common.rest.Mapping;
import pro.taskana.common.rest.QueryHelper;
import pro.taskana.common.rest.RestEndpoints;
import pro.taskana.common.rest.models.TaskanaPagedModel;
import pro.taskana.task.api.TaskService;
import pro.taskana.task.api.exceptions.TaskCommentNotFoundException;
@ -55,7 +55,7 @@ public class TaskCommentController {
this.taskCommentRepresentationModelAssembler = taskCommentRepresentationModelAssembler;
}
@GetMapping(path = Mapping.URL_TASK_COMMENT)
@GetMapping(path = RestEndpoints.URL_TASK_COMMENT)
@Transactional(readOnly = true, rollbackFor = Exception.class)
public ResponseEntity<TaskCommentRepresentationModel> getTaskComment(
@PathVariable String taskCommentId)
@ -80,7 +80,7 @@ public class TaskCommentController {
return response;
}
@GetMapping(path = Mapping.URL_TASK_COMMENTS)
@GetMapping(path = RestEndpoints.URL_TASK_COMMENTS)
@Transactional(readOnly = true, rollbackFor = Exception.class)
public ResponseEntity<TaskanaPagedModel<TaskCommentRepresentationModel>> getTaskComments(
@PathVariable String taskId,
@ -109,7 +109,7 @@ public class TaskCommentController {
return response;
}
@DeleteMapping(path = Mapping.URL_TASK_COMMENT)
@DeleteMapping(path = RestEndpoints.URL_TASK_COMMENT)
@Transactional(readOnly = true, rollbackFor = Exception.class)
public ResponseEntity<TaskCommentRepresentationModel> deleteTaskComment(
@PathVariable String taskCommentId)
@ -130,7 +130,7 @@ public class TaskCommentController {
return result;
}
@PutMapping(path = Mapping.URL_TASK_COMMENT)
@PutMapping(path = RestEndpoints.URL_TASK_COMMENT)
@Transactional(readOnly = true, rollbackFor = Exception.class)
public ResponseEntity<TaskCommentRepresentationModel> updateTaskComment(
@PathVariable String taskCommentId,
@ -168,7 +168,7 @@ public class TaskCommentController {
return result;
}
@PostMapping(path = Mapping.URL_TASK_COMMENTS)
@PostMapping(path = RestEndpoints.URL_TASK_COMMENTS)
@Transactional(rollbackFor = Exception.class)
public ResponseEntity<TaskCommentRepresentationModel> createTaskComment(
@PathVariable String taskId,

View File

@ -34,8 +34,8 @@ import pro.taskana.common.api.exceptions.InvalidArgumentException;
import pro.taskana.common.api.exceptions.NotAuthorizedException;
import pro.taskana.common.api.exceptions.TaskanaException;
import pro.taskana.common.rest.AbstractPagingController;
import pro.taskana.common.rest.Mapping;
import pro.taskana.common.rest.QueryHelper;
import pro.taskana.common.rest.RestEndpoints;
import pro.taskana.common.rest.models.TaskanaPagedModel;
import pro.taskana.task.api.TaskCustomField;
import pro.taskana.task.api.TaskQuery;
@ -108,7 +108,7 @@ public class TaskController extends AbstractPagingController {
this.taskSummaryRepresentationModelAssembler = taskSummaryRepresentationModelAssembler;
}
@GetMapping(path = Mapping.URL_TASKS)
@GetMapping(path = RestEndpoints.URL_TASKS)
@Transactional(readOnly = true, rollbackFor = Exception.class)
public ResponseEntity<TaskanaPagedModel<TaskSummaryRepresentationModel>> getTasks(
@RequestParam MultiValueMap<String, String> params) throws InvalidArgumentException {
@ -134,7 +134,7 @@ public class TaskController extends AbstractPagingController {
return response;
}
@DeleteMapping(path = Mapping.URL_TASKS)
@DeleteMapping(path = RestEndpoints.URL_TASKS)
@Transactional(readOnly = true, rollbackFor = Exception.class)
public ResponseEntity<TaskanaPagedModel<TaskSummaryRepresentationModel>> deleteTasks(
@RequestParam MultiValueMap<String, String> params)
@ -168,7 +168,7 @@ public class TaskController extends AbstractPagingController {
return response;
}
@GetMapping(path = Mapping.URL_TASKS_ID)
@GetMapping(path = RestEndpoints.URL_TASKS_ID)
@Transactional(readOnly = true, rollbackFor = Exception.class)
public ResponseEntity<TaskRepresentationModel> getTask(@PathVariable String taskId)
throws TaskNotFoundException, NotAuthorizedException {
@ -183,7 +183,7 @@ public class TaskController extends AbstractPagingController {
return result;
}
@PostMapping(path = Mapping.URL_TASKS_ID_CLAIM)
@PostMapping(path = RestEndpoints.URL_TASKS_ID_CLAIM)
@Transactional(rollbackFor = Exception.class)
public ResponseEntity<TaskRepresentationModel> claimTask(
@PathVariable String taskId, @RequestBody String userName)
@ -202,7 +202,7 @@ public class TaskController extends AbstractPagingController {
return result;
}
@PostMapping(path = Mapping.URL_TASKS_ID_SELECT_AND_CLAIM)
@PostMapping(path = RestEndpoints.URL_TASKS_ID_SELECT_AND_CLAIM)
@Transactional(rollbackFor = Exception.class)
public ResponseEntity<TaskRepresentationModel> selectAndClaimTask(
@RequestParam MultiValueMap<String, String> params)
@ -225,7 +225,7 @@ public class TaskController extends AbstractPagingController {
return result;
}
@DeleteMapping(path = Mapping.URL_TASKS_ID_CLAIM)
@DeleteMapping(path = RestEndpoints.URL_TASKS_ID_CLAIM)
@Transactional(rollbackFor = Exception.class)
public ResponseEntity<TaskRepresentationModel> cancelClaimTask(@PathVariable String taskId)
throws TaskNotFoundException, InvalidStateException, InvalidOwnerException,
@ -244,7 +244,7 @@ public class TaskController extends AbstractPagingController {
return result;
}
@PostMapping(path = Mapping.URL_TASKS_ID_COMPLETE)
@PostMapping(path = RestEndpoints.URL_TASKS_ID_COMPLETE)
@Transactional(rollbackFor = Exception.class)
public ResponseEntity<TaskRepresentationModel> completeTask(@PathVariable String taskId)
throws TaskNotFoundException, InvalidOwnerException, InvalidStateException,
@ -261,7 +261,7 @@ public class TaskController extends AbstractPagingController {
return result;
}
@DeleteMapping(path = Mapping.URL_TASKS_ID)
@DeleteMapping(path = RestEndpoints.URL_TASKS_ID)
@Transactional(rollbackFor = Exception.class)
public ResponseEntity<TaskRepresentationModel> deleteTask(@PathVariable String taskId)
throws TaskNotFoundException, InvalidStateException, NotAuthorizedException {
@ -272,7 +272,7 @@ public class TaskController extends AbstractPagingController {
return result;
}
@PostMapping(path = Mapping.URL_TASKS)
@PostMapping(path = RestEndpoints.URL_TASKS)
@Transactional(rollbackFor = Exception.class)
public ResponseEntity<TaskRepresentationModel> createTask(
@RequestBody TaskRepresentationModel taskRepresentationModel)
@ -295,7 +295,7 @@ public class TaskController extends AbstractPagingController {
return result;
}
@PostMapping(path = Mapping.URL_TASKS_ID_TRANSFER_WORKBASKETID)
@PostMapping(path = RestEndpoints.URL_TASKS_ID_TRANSFER_WORKBASKET_ID)
@Transactional(rollbackFor = Exception.class)
public ResponseEntity<TaskRepresentationModel> transferTask(
@PathVariable String taskId, @PathVariable String workbasketId)
@ -312,7 +312,7 @@ public class TaskController extends AbstractPagingController {
return result;
}
@PutMapping(path = Mapping.URL_TASKS_ID)
@PutMapping(path = RestEndpoints.URL_TASKS_ID)
@Transactional(rollbackFor = Exception.class)
public ResponseEntity<TaskRepresentationModel> updateTask(
@PathVariable(value = "taskId") String taskId,

View File

@ -18,8 +18,8 @@ import org.springframework.web.bind.annotation.RestController;
import pro.taskana.common.api.exceptions.InvalidArgumentException;
import pro.taskana.common.api.exceptions.NotAuthorizedException;
import pro.taskana.common.rest.AbstractPagingController;
import pro.taskana.common.rest.Mapping;
import pro.taskana.common.rest.QueryHelper;
import pro.taskana.common.rest.RestEndpoints;
import pro.taskana.common.rest.ldap.LdapClient;
import pro.taskana.common.rest.models.TaskanaPagedModel;
import pro.taskana.workbasket.api.WorkbasketAccessItemQuery;
@ -65,7 +65,7 @@ public class WorkbasketAccessItemController extends AbstractPagingController {
* @throws NotAuthorizedException if the user is not authorized.
* @throws InvalidArgumentException if some argument is invalid.
*/
@GetMapping(path = Mapping.URL_WORKBASKET_ACCESS_ITEMS)
@GetMapping(path = RestEndpoints.URL_WORKBASKET_ACCESS_ITEMS)
public ResponseEntity<TaskanaPagedModel<WorkbasketAccessItemRepresentationModel>>
getWorkbasketAccessItems(@RequestParam MultiValueMap<String, String> params)
throws NotAuthorizedException, InvalidArgumentException {
@ -101,7 +101,7 @@ public class WorkbasketAccessItemController extends AbstractPagingController {
* @throws NotAuthorizedException if the user is not authorized.
* @throws InvalidArgumentException if some argument is invalid.
*/
@DeleteMapping(path = Mapping.URL_WORKBASKET_ACCESS_ITEMS)
@DeleteMapping(path = RestEndpoints.URL_WORKBASKET_ACCESS_ITEMS)
public ResponseEntity<Void> removeWorkbasketAccessItems(
@RequestParam("access-id") String accessId)
throws NotAuthorizedException, InvalidArgumentException {

View File

@ -26,8 +26,8 @@ import pro.taskana.common.api.exceptions.DomainNotFoundException;
import pro.taskana.common.api.exceptions.InvalidArgumentException;
import pro.taskana.common.api.exceptions.NotAuthorizedException;
import pro.taskana.common.rest.AbstractPagingController;
import pro.taskana.common.rest.Mapping;
import pro.taskana.common.rest.QueryHelper;
import pro.taskana.common.rest.RestEndpoints;
import pro.taskana.common.rest.models.TaskanaPagedModel;
import pro.taskana.workbasket.api.WorkbasketPermission;
import pro.taskana.workbasket.api.WorkbasketQuery;
@ -93,7 +93,7 @@ public class WorkbasketController extends AbstractPagingController {
workbasketAccessItemRepresentationModelAssembler;
}
@GetMapping(path = Mapping.URL_WORKBASKET)
@GetMapping(path = RestEndpoints.URL_WORKBASKET)
@Transactional(readOnly = true, rollbackFor = Exception.class)
public ResponseEntity<TaskanaPagedModel<WorkbasketSummaryRepresentationModel>> getWorkbaskets(
@RequestParam MultiValueMap<String, String> params) throws InvalidArgumentException {
@ -120,7 +120,7 @@ public class WorkbasketController extends AbstractPagingController {
return response;
}
@GetMapping(path = Mapping.URL_WORKBASKET_ID, produces = MediaTypes.HAL_JSON_VALUE)
@GetMapping(path = RestEndpoints.URL_WORKBASKET_ID, produces = MediaTypes.HAL_JSON_VALUE)
@Transactional(readOnly = true, rollbackFor = Exception.class)
public ResponseEntity<WorkbasketRepresentationModel> getWorkbasket(
@PathVariable(value = "workbasketId") String workbasketId)
@ -136,7 +136,7 @@ public class WorkbasketController extends AbstractPagingController {
return result;
}
@DeleteMapping(path = Mapping.URL_WORKBASKET_ID)
@DeleteMapping(path = RestEndpoints.URL_WORKBASKET_ID)
@Transactional(rollbackFor = Exception.class, noRollbackFor = WorkbasketNotFoundException.class)
public ResponseEntity<WorkbasketRepresentationModel> deleteWorkbasket(
@PathVariable(value = "workbasketId") String workbasketId)
@ -160,7 +160,7 @@ public class WorkbasketController extends AbstractPagingController {
return response;
}
@PostMapping(path = Mapping.URL_WORKBASKET)
@PostMapping(path = RestEndpoints.URL_WORKBASKET)
@Transactional(rollbackFor = Exception.class)
public ResponseEntity<WorkbasketRepresentationModel> createWorkbasket(
@RequestBody WorkbasketRepresentationModel workbasketRepresentationModel)
@ -184,7 +184,7 @@ public class WorkbasketController extends AbstractPagingController {
return response;
}
@PutMapping(path = Mapping.URL_WORKBASKET_ID)
@PutMapping(path = RestEndpoints.URL_WORKBASKET_ID)
@Transactional(rollbackFor = Exception.class)
public ResponseEntity<WorkbasketRepresentationModel> updateWorkbasket(
@PathVariable(value = "workbasketId") String workbasketId,
@ -214,7 +214,9 @@ public class WorkbasketController extends AbstractPagingController {
return result;
}
@GetMapping(path = Mapping.URL_WORKBASKET_ID_ACCESSITEMS, produces = MediaTypes.HAL_JSON_VALUE)
@GetMapping(
path = RestEndpoints.URL_WORKBASKET_ID_ACCESS_ITEMS,
produces = MediaTypes.HAL_JSON_VALUE)
@Transactional(readOnly = true, rollbackFor = Exception.class)
public ResponseEntity<TaskanaPagedModel<WorkbasketAccessItemRepresentationModel>>
getWorkbasketAccessItems(@PathVariable(value = "workbasketId") String workbasketId)
@ -234,7 +236,7 @@ public class WorkbasketController extends AbstractPagingController {
return result;
}
@PutMapping(path = Mapping.URL_WORKBASKET_ID_ACCESSITEMS)
@PutMapping(path = RestEndpoints.URL_WORKBASKET_ID_ACCESS_ITEMS)
@Transactional(rollbackFor = Exception.class)
public ResponseEntity<TaskanaPagedModel<WorkbasketAccessItemRepresentationModel>>
setWorkbasketAccessItems(
@ -267,7 +269,9 @@ public class WorkbasketController extends AbstractPagingController {
return response;
}
@GetMapping(path = Mapping.URL_WORKBASKET_ID_DISTRIBUTION, produces = MediaTypes.HAL_JSON_VALUE)
@GetMapping(
path = RestEndpoints.URL_WORKBASKET_ID_DISTRIBUTION,
produces = MediaTypes.HAL_JSON_VALUE)
@Transactional(readOnly = true, rollbackFor = Exception.class)
public ResponseEntity<TaskanaPagedModel<WorkbasketSummaryRepresentationModel>>
getDistributionTargets(@PathVariable(value = "workbasketId") String workbasketId)
@ -288,7 +292,7 @@ public class WorkbasketController extends AbstractPagingController {
return result;
}
@PutMapping(path = Mapping.URL_WORKBASKET_ID_DISTRIBUTION)
@PutMapping(path = RestEndpoints.URL_WORKBASKET_ID_DISTRIBUTION)
@Transactional(rollbackFor = Exception.class)
public ResponseEntity<TaskanaPagedModel<WorkbasketSummaryRepresentationModel>>
setDistributionTargetsForWorkbasketId(
@ -317,7 +321,7 @@ public class WorkbasketController extends AbstractPagingController {
return response;
}
@DeleteMapping(path = Mapping.URL_WORKBASKET_ID_DISTRIBUTION)
@DeleteMapping(path = RestEndpoints.URL_WORKBASKET_ID_DISTRIBUTION)
@Transactional(rollbackFor = Exception.class)
public ResponseEntity<TaskanaPagedModel<WorkbasketSummaryRepresentationModel>>
removeDistributionTargetForWorkbasketId(

View File

@ -30,7 +30,7 @@ import pro.taskana.common.api.exceptions.ConcurrencyException;
import pro.taskana.common.api.exceptions.DomainNotFoundException;
import pro.taskana.common.api.exceptions.InvalidArgumentException;
import pro.taskana.common.api.exceptions.NotAuthorizedException;
import pro.taskana.common.rest.Mapping;
import pro.taskana.common.rest.RestEndpoints;
import pro.taskana.common.rest.models.TaskanaPagedModel;
import pro.taskana.workbasket.api.WorkbasketQuery;
import pro.taskana.workbasket.api.WorkbasketService;
@ -77,7 +77,7 @@ public class WorkbasketDefinitionController {
this.mapper = mapper;
}
@GetMapping(path = Mapping.URL_WORKBASKET_DEFINITIONS)
@GetMapping(path = RestEndpoints.URL_WORKBASKET_DEFINITIONS)
@Transactional(readOnly = true, rollbackFor = Exception.class)
public ResponseEntity<TaskanaPagedModel<WorkbasketDefinitionRepresentationModel>>
exportWorkbaskets(@RequestParam(required = false) String domain) {
@ -126,7 +126,7 @@ public class WorkbasketDefinitionController {
* workbasket and access_id already exists.
* @throws ConcurrencyException if workbasket was updated by an other user
*/
@PostMapping(path = Mapping.URL_WORKBASKET_DEFINITIONS)
@PostMapping(path = RestEndpoints.URL_WORKBASKET_DEFINITIONS)
@Transactional(rollbackFor = Exception.class)
public ResponseEntity<Void> importWorkbaskets(@RequestParam("file") MultipartFile file)
throws IOException, NotAuthorizedException, DomainNotFoundException,

View File

@ -19,7 +19,7 @@ import org.springframework.web.client.RestTemplate;
import pro.taskana.classification.rest.models.ClassificationRepresentationModel;
import pro.taskana.classification.rest.models.ClassificationSummaryRepresentationModel;
import pro.taskana.common.rest.Mapping;
import pro.taskana.common.rest.RestEndpoints;
import pro.taskana.common.rest.models.TaskanaPagedModel;
import pro.taskana.common.test.rest.RestHelper;
import pro.taskana.common.test.rest.TaskanaSpringBootTest;
@ -41,7 +41,7 @@ class ClassificationControllerIntTest {
ResponseEntity<ClassificationRepresentationModel> response =
template.exchange(
restHelper.toUrl(
Mapping.URL_CLASSIFICATIONS_ID, "CLI:100000000000000000000000000000000002"),
RestEndpoints.URL_CLASSIFICATIONS_ID, "CLI:100000000000000000000000000000000002"),
HttpMethod.GET,
restHelper.defaultRequest(),
ParameterizedTypeReference.forType(ClassificationRepresentationModel.class));
@ -54,7 +54,7 @@ class ClassificationControllerIntTest {
void testGetAllClassifications() {
ResponseEntity<TaskanaPagedModel<ClassificationSummaryRepresentationModel>> response =
template.exchange(
restHelper.toUrl(Mapping.URL_CLASSIFICATIONS),
restHelper.toUrl(RestEndpoints.URL_CLASSIFICATIONS),
HttpMethod.GET,
restHelper.defaultRequest(),
CLASSIFICATION_SUMMARY_PAGE_MODEL_TYPE);
@ -66,7 +66,8 @@ class ClassificationControllerIntTest {
void testGetAllClassificationsFilterByCustomAttribute() {
ResponseEntity<TaskanaPagedModel<ClassificationSummaryRepresentationModel>> response =
template.exchange(
restHelper.toUrl(Mapping.URL_CLASSIFICATIONS) + "?domain=DOMAIN_A&custom-1-like=RVNR",
restHelper.toUrl(RestEndpoints.URL_CLASSIFICATIONS)
+ "?domain=DOMAIN_A&custom-1-like=RVNR",
HttpMethod.GET,
restHelper.defaultRequest(),
CLASSIFICATION_SUMMARY_PAGE_MODEL_TYPE);
@ -80,7 +81,7 @@ class ClassificationControllerIntTest {
void testGetAllClassificationsKeepingFilters() {
ResponseEntity<TaskanaPagedModel<ClassificationSummaryRepresentationModel>> response =
template.exchange(
restHelper.toUrl(Mapping.URL_CLASSIFICATIONS)
restHelper.toUrl(RestEndpoints.URL_CLASSIFICATIONS)
+ "?domain=DOMAIN_A&sort-by=key&order=asc",
HttpMethod.GET,
restHelper.defaultRequest(),
@ -97,7 +98,7 @@ class ClassificationControllerIntTest {
void testGetSecondPageSortedByKey() {
ResponseEntity<TaskanaPagedModel<ClassificationSummaryRepresentationModel>> response =
template.exchange(
restHelper.toUrl(Mapping.URL_CLASSIFICATIONS)
restHelper.toUrl(RestEndpoints.URL_CLASSIFICATIONS)
+ "?domain=DOMAIN_A&sort-by=key&order=asc&page-size=5&page=2",
HttpMethod.GET,
restHelper.defaultRequest(),
@ -126,7 +127,7 @@ class ClassificationControllerIntTest {
ResponseEntity<ClassificationRepresentationModel> responseEntity =
template.exchange(
restHelper.toUrl(Mapping.URL_CLASSIFICATIONS),
restHelper.toUrl(RestEndpoints.URL_CLASSIFICATIONS),
HttpMethod.POST,
new HttpEntity<>(newClassification, restHelper.getHeadersTeamlead_1()),
ParameterizedTypeReference.forType(ClassificationRepresentationModel.class));
@ -141,7 +142,7 @@ class ClassificationControllerIntTest {
responseEntity =
template.exchange(
restHelper.toUrl(Mapping.URL_CLASSIFICATIONS),
restHelper.toUrl(RestEndpoints.URL_CLASSIFICATIONS),
HttpMethod.POST,
new HttpEntity<>(newClassification, restHelper.getHeadersTeamlead_1()),
ParameterizedTypeReference.forType(ClassificationRepresentationModel.class));
@ -160,7 +161,7 @@ class ClassificationControllerIntTest {
ThrowingCallable httpCall =
() ->
template.exchange(
restHelper.toUrl(Mapping.URL_CLASSIFICATIONS),
restHelper.toUrl(RestEndpoints.URL_CLASSIFICATIONS),
HttpMethod.POST,
new HttpEntity<>(newClassification, restHelper.getHeadersUser_1_1()),
ParameterizedTypeReference.forType(ClassificationRepresentationModel.class));
@ -182,7 +183,7 @@ class ClassificationControllerIntTest {
ResponseEntity<ClassificationRepresentationModel> responseEntity =
template.exchange(
restHelper.toUrl(Mapping.URL_CLASSIFICATIONS),
restHelper.toUrl(RestEndpoints.URL_CLASSIFICATIONS),
HttpMethod.POST,
new HttpEntity<>(newClassification, restHelper.getHeadersTeamlead_1()),
ParameterizedTypeReference.forType(ClassificationRepresentationModel.class));
@ -202,7 +203,7 @@ class ClassificationControllerIntTest {
ResponseEntity<ClassificationRepresentationModel> responseEntity =
template.exchange(
restHelper.toUrl(Mapping.URL_CLASSIFICATIONS),
restHelper.toUrl(RestEndpoints.URL_CLASSIFICATIONS),
HttpMethod.POST,
new HttpEntity<>(newClassification, restHelper.getHeadersTeamlead_1()),
ParameterizedTypeReference.forType(ClassificationRepresentationModel.class));
@ -221,7 +222,7 @@ class ClassificationControllerIntTest {
ResponseEntity<ClassificationRepresentationModel> responseEntity =
template.exchange(
restHelper.toUrl(Mapping.URL_CLASSIFICATIONS),
restHelper.toUrl(RestEndpoints.URL_CLASSIFICATIONS),
HttpMethod.POST,
new HttpEntity<>(newClassification, restHelper.getHeadersTeamlead_1()),
ParameterizedTypeReference.forType(ClassificationRepresentationModel.class));
@ -231,7 +232,7 @@ class ClassificationControllerIntTest {
ResponseEntity<TaskanaPagedModel<ClassificationSummaryRepresentationModel>> response =
template.exchange(
restHelper.toUrl(Mapping.URL_CLASSIFICATIONS),
restHelper.toUrl(RestEndpoints.URL_CLASSIFICATIONS),
HttpMethod.GET,
restHelper.defaultRequest(),
CLASSIFICATION_SUMMARY_PAGE_MODEL_TYPE);
@ -264,7 +265,7 @@ class ClassificationControllerIntTest {
ThrowingCallable httpCall =
() -> {
template.exchange(
restHelper.toUrl(Mapping.URL_CLASSIFICATIONS),
restHelper.toUrl(RestEndpoints.URL_CLASSIFICATIONS),
HttpMethod.POST,
new HttpEntity<>(newClassification, restHelper.getHeadersBusinessAdmin()),
ParameterizedTypeReference.forType(ClassificationRepresentationModel.class));
@ -286,7 +287,7 @@ class ClassificationControllerIntTest {
ThrowingCallable httpCall =
() -> {
template.exchange(
restHelper.toUrl(Mapping.URL_CLASSIFICATIONS),
restHelper.toUrl(RestEndpoints.URL_CLASSIFICATIONS),
HttpMethod.POST,
new HttpEntity<>(newClassification, restHelper.getHeadersBusinessAdmin()),
ParameterizedTypeReference.forType(ClassificationRepresentationModel.class));
@ -304,7 +305,7 @@ class ClassificationControllerIntTest {
ResponseEntity<ClassificationSummaryRepresentationModel> response =
template.exchange(
restHelper.toUrl(
Mapping.URL_CLASSIFICATIONS_ID, "CLI:100000000000000000000000000000000009"),
RestEndpoints.URL_CLASSIFICATIONS_ID, "CLI:100000000000000000000000000000000009"),
HttpMethod.GET,
request,
ParameterizedTypeReference.forType(ClassificationSummaryRepresentationModel.class));
@ -320,7 +321,7 @@ class ClassificationControllerIntTest {
ResponseEntity<ClassificationSummaryRepresentationModel> response =
template.exchange(
restHelper.toUrl(
Mapping.URL_CLASSIFICATIONS_ID, "CLI:200000000000000000000000000000000004"),
RestEndpoints.URL_CLASSIFICATIONS_ID, "CLI:200000000000000000000000000000000004"),
HttpMethod.DELETE,
request,
ParameterizedTypeReference.forType(ClassificationSummaryRepresentationModel.class));
@ -330,7 +331,7 @@ class ClassificationControllerIntTest {
() -> {
template.exchange(
restHelper.toUrl(
Mapping.URL_CLASSIFICATIONS_ID, "CLI:200000000000000000000000000000000004"),
RestEndpoints.URL_CLASSIFICATIONS_ID, "CLI:200000000000000000000000000000000004"),
HttpMethod.GET,
request,
ParameterizedTypeReference.forType(ClassificationSummaryRepresentationModel.class));

View File

@ -36,7 +36,7 @@ import pro.taskana.classification.api.ClassificationService;
import pro.taskana.classification.rest.assembler.ClassificationRepresentationModelAssembler;
import pro.taskana.classification.rest.models.ClassificationRepresentationModel;
import pro.taskana.classification.rest.models.ClassificationSummaryRepresentationModel;
import pro.taskana.common.rest.Mapping;
import pro.taskana.common.rest.RestEndpoints;
import pro.taskana.common.rest.models.TaskanaPagedModel;
import pro.taskana.common.rest.models.TaskanaPagedModelKeys;
import pro.taskana.common.test.rest.RestHelper;
@ -75,7 +75,7 @@ class ClassificationDefinitionControllerIntTest {
void testExportClassifications() {
ResponseEntity<TaskanaPagedModel<ClassificationRepresentationModel>> response =
TEMPLATE.exchange(
restHelper.toUrl(Mapping.URL_CLASSIFICATIONDEFINITIONS) + "?domain=DOMAIN_B",
restHelper.toUrl(RestEndpoints.URL_CLASSIFICATION_DEFINITIONS) + "?domain=DOMAIN_B",
HttpMethod.GET,
restHelper.defaultRequest(),
CLASSIFICATION_PAGE_MODEL_TYPE);
@ -95,7 +95,7 @@ class ClassificationDefinitionControllerIntTest {
void testExportClassificationsFromWrongDomain() {
ResponseEntity<TaskanaPagedModel<ClassificationRepresentationModel>> response =
TEMPLATE.exchange(
restHelper.toUrl(Mapping.URL_CLASSIFICATIONDEFINITIONS) + "?domain=ADdfe",
restHelper.toUrl(RestEndpoints.URL_CLASSIFICATION_DEFINITIONS) + "?domain=ADdfe",
HttpMethod.GET,
restHelper.defaultRequest(),
CLASSIFICATION_PAGE_MODEL_TYPE);
@ -440,7 +440,7 @@ class ClassificationDefinitionControllerIntTest {
body.add("file", new FileSystemResource(tmpFile));
HttpEntity<MultiValueMap<String, Object>> requestEntity = new HttpEntity<>(body, headers);
String serverUrl = restHelper.toUrl(Mapping.URL_CLASSIFICATIONDEFINITIONS);
String serverUrl = restHelper.toUrl(RestEndpoints.URL_CLASSIFICATION_DEFINITIONS);
return TEMPLATE.postForEntity(serverUrl, requestEntity, Void.class);
}

View File

@ -11,7 +11,7 @@ import pro.taskana.classification.api.ClassificationService;
import pro.taskana.classification.api.models.Classification;
import pro.taskana.classification.internal.models.ClassificationImpl;
import pro.taskana.classification.rest.models.ClassificationRepresentationModel;
import pro.taskana.common.rest.Mapping;
import pro.taskana.common.rest.RestEndpoints;
import pro.taskana.common.test.rest.TaskanaSpringBootTest;
/** Test for {@link ClassificationRepresentationModelAssembler}. */
@ -132,7 +132,9 @@ class ClassificationRepresentationModelAssemblerTest {
private void testLinks(ClassificationRepresentationModel repModel) {
assertThat(repModel.getLinks()).hasSize(1);
assertThat(Mapping.URL_CLASSIFICATIONS_ID.replaceAll("\\{.*}", repModel.getClassificationId()))
assertThat(
RestEndpoints.URL_CLASSIFICATIONS_ID.replaceAll(
"\\{.*}", repModel.getClassificationId()))
.isEqualTo(repModel.getRequiredLink("self").getHref());
}

View File

@ -36,7 +36,7 @@ class AccessIdControllerIntTest {
void testQueryGroupsByDn() {
ResponseEntity<AccessIdListResource> response =
TEMPLATE.exchange(
restHelper.toUrl(Mapping.URL_ACCESSID)
restHelper.toUrl(RestEndpoints.URL_ACCESS_ID)
+ "?search-for=cn=ksc-users,cn=groups,OU=Test,O=TASKANA",
HttpMethod.GET,
restHelper.defaultRequest(),
@ -52,7 +52,7 @@ class AccessIdControllerIntTest {
void testQueryUserByDn() {
ResponseEntity<AccessIdListResource> response =
TEMPLATE.exchange(
restHelper.toUrl(Mapping.URL_ACCESSID)
restHelper.toUrl(RestEndpoints.URL_ACCESS_ID)
+ "?search-for=uid=teamlead-1,cn=users,OU=Test,O=TASKANA",
HttpMethod.GET,
restHelper.defaultRequest(),
@ -68,7 +68,7 @@ class AccessIdControllerIntTest {
void testQueryGroupsByCn() {
ResponseEntity<AccessIdListResource> response =
TEMPLATE.exchange(
restHelper.toUrl(Mapping.URL_ACCESSID) + "?search-for=ksc-use",
restHelper.toUrl(RestEndpoints.URL_ACCESS_ID) + "?search-for=ksc-use",
HttpMethod.GET,
restHelper.defaultRequest(),
ParameterizedTypeReference.forType(AccessIdListResource.class));
@ -83,7 +83,7 @@ class AccessIdControllerIntTest {
void should_ReturnEmptyResults_ifInvalidCharacterIsUsedInCondition() {
ResponseEntity<AccessIdListResource> response =
TEMPLATE.exchange(
restHelper.toUrl(Mapping.URL_ACCESSID) + "?search-for=ksc-teamleads,cn=groups",
restHelper.toUrl(RestEndpoints.URL_ACCESS_ID) + "?search-for=ksc-teamleads,cn=groups",
HttpMethod.GET,
restHelper.defaultRequest(),
ParameterizedTypeReference.forType(AccessIdListResource.class));
@ -94,7 +94,7 @@ class AccessIdControllerIntTest {
void testGetMatches() {
ResponseEntity<List<AccessIdRepresentationModel>> response =
TEMPLATE.exchange(
restHelper.toUrl(Mapping.URL_ACCESSID) + "?search-for=rig",
restHelper.toUrl(RestEndpoints.URL_ACCESS_ID) + "?search-for=rig",
HttpMethod.GET,
restHelper.defaultRequest(),
ParameterizedTypeReference.forType(AccessIdListResource.class));
@ -109,7 +109,7 @@ class AccessIdControllerIntTest {
void should_ReturnAccessIdWithUmlauten_ifBased64EncodedUserIsLookedUp() {
ResponseEntity<List<AccessIdRepresentationModel>> response =
TEMPLATE.exchange(
restHelper.toUrl(Mapping.URL_ACCESSID) + "?search-for=läf",
restHelper.toUrl(RestEndpoints.URL_ACCESS_ID) + "?search-for=läf",
HttpMethod.GET,
restHelper.defaultRequest(),
ParameterizedTypeReference.forType(AccessIdListResource.class));
@ -125,7 +125,7 @@ class AccessIdControllerIntTest {
ThrowingCallable httpCall =
() ->
TEMPLATE.exchange(
restHelper.toUrl(Mapping.URL_ACCESSID) + "?search-for=al",
restHelper.toUrl(RestEndpoints.URL_ACCESS_ID) + "?search-for=al",
HttpMethod.GET,
restHelper.defaultRequest(),
ParameterizedTypeReference.forType(List.class));
@ -140,7 +140,7 @@ class AccessIdControllerIntTest {
void should_ReturnAccessIdsOfGroupsTheAccessIdIsMemberOf_ifAccessIdOfUserIsGiven() {
ResponseEntity<List<AccessIdRepresentationModel>> response =
TEMPLATE.exchange(
restHelper.toUrl(Mapping.URL_ACCESSID_GROUPS) + "?access-id=teamlead-2",
restHelper.toUrl(RestEndpoints.URL_ACCESS_ID_GROUPS) + "?access-id=teamlead-2",
HttpMethod.GET,
restHelper.defaultRequest(),
ParameterizedTypeReference.forType(AccessIdListResource.class));
@ -162,7 +162,8 @@ class AccessIdControllerIntTest {
ThrowingCallable call =
() ->
TEMPLATE.exchange(
restHelper.toUrl(Mapping.URL_ACCESSID_GROUPS) + "?access-id=teamlead-2,cn=users",
restHelper.toUrl(RestEndpoints.URL_ACCESS_ID_GROUPS)
+ "?access-id=teamlead-2,cn=users",
HttpMethod.GET,
restHelper.defaultRequest(),
ParameterizedTypeReference.forType(AccessIdListResource.class));
@ -178,7 +179,7 @@ class AccessIdControllerIntTest {
void should_ReturnAccessIdsOfGroupsTheAccessIdIsMemberOf_ifAccessIdOfGroupIsGiven() {
ResponseEntity<List<AccessIdRepresentationModel>> response =
TEMPLATE.exchange(
restHelper.toUrl(Mapping.URL_ACCESSID_GROUPS)
restHelper.toUrl(RestEndpoints.URL_ACCESS_ID_GROUPS)
+ "?access-id=cn=Organisationseinheit KSC 1,"
+ "cn=Organisationseinheit KSC,cn=organisation,OU=Test,O=TASKANA",
HttpMethod.GET,
@ -197,7 +198,7 @@ class AccessIdControllerIntTest {
ThrowingCallable call =
() ->
TEMPLATE.exchange(
restHelper.toUrl(Mapping.URL_ACCESSID_GROUPS) + "?access-id=teamlead-2",
restHelper.toUrl(RestEndpoints.URL_ACCESS_ID_GROUPS) + "?access-id=teamlead-2",
HttpMethod.GET,
new HttpEntity<>(restHelper.getHeadersUser_1_1()),
ParameterizedTypeReference.forType(AccessIdListResource.class));
@ -213,7 +214,7 @@ class AccessIdControllerIntTest {
ThrowingCallable call =
() ->
TEMPLATE.exchange(
restHelper.toUrl(Mapping.URL_ACCESSID) + "?search-for=al",
restHelper.toUrl(RestEndpoints.URL_ACCESS_ID) + "?search-for=al",
HttpMethod.GET,
new HttpEntity<>(restHelper.getHeadersUser_1_1()),
ParameterizedTypeReference.forType(AccessIdListResource.class));

View File

@ -38,7 +38,7 @@ class GeneralExceptionHandlingTest {
ThrowingCallable httpCall =
() -> {
template.exchange(
restHelper.toUrl(Mapping.URL_CLASSIFICATIONS_ID, "non-existing-id"),
restHelper.toUrl(RestEndpoints.URL_CLASSIFICATIONS_ID, "non-existing-id"),
HttpMethod.DELETE,
restHelper.defaultRequest(),
CLASSIFICATION_SUMMARY_PAGE_MODEL_TYPE);

View File

@ -10,13 +10,13 @@ import org.springframework.web.util.UriComponentsBuilder;
import pro.taskana.task.rest.TaskController;
/** Test Mapping and Linkbuilder. */
class MappingTest {
/** Test RestEndpoints and Linkbuilder. */
class RestEndpointsTest {
@Test
void testMapping() throws Exception {
String mapUrl = Mapping.URL_TASKS;
String mapUrl = RestEndpoints.URL_TASKS;
String buildUrl =
linkTo(methodOn(TaskController.class).getTasks(new LinkedMultiValueMap<>())).toString();
assertThat(buildUrl).isEqualTo(mapUrl);
@ -28,7 +28,7 @@ class MappingTest {
String id = "25";
String mapUrl =
UriComponentsBuilder.fromPath(Mapping.URL_TASKS_ID).buildAndExpand(id).toUriString();
UriComponentsBuilder.fromPath(RestEndpoints.URL_TASKS_ID).buildAndExpand(id).toUriString();
String buildUrl = linkTo(methodOn(TaskController.class).getTask(id)).toString();
assertThat(buildUrl).isEqualTo(mapUrl);
}

View File

@ -32,7 +32,7 @@ class TaskanaEngineControllerIntTest {
void testDomains() {
ResponseEntity<List<String>> response =
TEMPLATE.exchange(
restHelper.toUrl(Mapping.URL_DOMAIN),
restHelper.toUrl(RestEndpoints.URL_DOMAIN),
HttpMethod.GET,
restHelper.defaultRequest(),
ParameterizedTypeReference.forType(List.class));
@ -43,7 +43,7 @@ class TaskanaEngineControllerIntTest {
void testClassificationTypes() {
ResponseEntity<List<String>> response =
TEMPLATE.exchange(
restHelper.toUrl(Mapping.URL_CLASSIFICATION_TYPES),
restHelper.toUrl(RestEndpoints.URL_CLASSIFICATION_TYPES),
HttpMethod.GET,
restHelper.defaultRequest(),
ParameterizedTypeReference.forType(List.class));
@ -54,7 +54,7 @@ class TaskanaEngineControllerIntTest {
void testClassificationCategories() {
ResponseEntity<List<String>> response =
TEMPLATE.exchange(
restHelper.toUrl(Mapping.URL_CLASSIFICATION_CATEGORIES),
restHelper.toUrl(RestEndpoints.URL_CLASSIFICATION_CATEGORIES),
HttpMethod.GET,
restHelper.defaultRequest(),
ParameterizedTypeReference.forType(List.class));
@ -66,7 +66,7 @@ class TaskanaEngineControllerIntTest {
void testGetCurrentUserInfo() {
ResponseEntity<TaskanaUserInfoRepresentationModel> response =
TEMPLATE.exchange(
restHelper.toUrl(Mapping.URL_CURRENT_USER),
restHelper.toUrl(RestEndpoints.URL_CURRENT_USER),
HttpMethod.GET,
restHelper.defaultRequest(),
ParameterizedTypeReference.forType(TaskanaUserInfoRepresentationModel.class));

View File

@ -12,7 +12,7 @@ import org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders;
import org.springframework.restdocs.payload.FieldDescriptor;
import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
import pro.taskana.common.rest.Mapping;
import pro.taskana.common.rest.RestEndpoints;
import pro.taskana.common.test.doc.api.BaseRestDocumentation;
/** Generate Rest Docu for AbstractPagingController. */
@ -65,7 +65,7 @@ class AbstractPagingControllerRestDocumentation extends BaseRestDocumentation {
this.mockMvc
.perform(
RestDocumentationRequestBuilders.get(
restHelper.toUrl(Mapping.URL_CLASSIFICATIONS) + "?page=2&page-size=5")
restHelper.toUrl(RestEndpoints.URL_CLASSIFICATIONS) + "?page=2&page-size=5")
.header("Authorization", TEAMLEAD_1_CREDENTIALS))
.andExpect(MockMvcResultMatchers.status().isOk())
.andDo(

View File

@ -20,7 +20,7 @@ import org.springframework.restdocs.payload.FieldDescriptor;
import org.springframework.test.web.servlet.MvcResult;
import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
import pro.taskana.common.rest.Mapping;
import pro.taskana.common.rest.RestEndpoints;
import pro.taskana.common.test.doc.api.BaseRestDocumentation;
/** Generate REST Dokumentation for ClassificationController. */
@ -251,7 +251,7 @@ class ClassificationControllerRestDocumentation extends BaseRestDocumentation {
this.mockMvc
.perform(
RestDocumentationRequestBuilders.get(
restHelper.toUrl(Mapping.URL_CLASSIFICATIONS) + "?domain=DOMAIN_B")
restHelper.toUrl(RestEndpoints.URL_CLASSIFICATIONS) + "?domain=DOMAIN_B")
.accept("application/hal+json")
.header("Authorization", TEAMLEAD_1_CREDENTIALS))
.andExpect(MockMvcResultMatchers.status().isOk())
@ -267,7 +267,8 @@ class ClassificationControllerRestDocumentation extends BaseRestDocumentation {
.perform(
RestDocumentationRequestBuilders.get(
restHelper.toUrl(
Mapping.URL_CLASSIFICATIONS_ID, "CLI:100000000000000000000000000000000009"))
RestEndpoints.URL_CLASSIFICATIONS_ID,
"CLI:100000000000000000000000000000000009"))
.header("Authorization", TEAMLEAD_1_CREDENTIALS))
.andExpect(MockMvcResultMatchers.status().isOk())
.andDo(
@ -282,7 +283,8 @@ class ClassificationControllerRestDocumentation extends BaseRestDocumentation {
.perform(
RestDocumentationRequestBuilders.get(
restHelper.toUrl(
Mapping.URL_CLASSIFICATIONS_ID, "CLI:100000000000000000000000000000000009"))
RestEndpoints.URL_CLASSIFICATIONS_ID,
"CLI:100000000000000000000000000000000009"))
.header("Authorization", TEAMLEAD_1_CREDENTIALS))
.andExpect(MockMvcResultMatchers.status().isOk())
.andDo(
@ -295,7 +297,8 @@ class ClassificationControllerRestDocumentation extends BaseRestDocumentation {
MvcResult result =
this.mockMvc
.perform(
RestDocumentationRequestBuilders.post(restHelper.toUrl(Mapping.URL_CLASSIFICATIONS))
RestDocumentationRequestBuilders.post(
restHelper.toUrl(RestEndpoints.URL_CLASSIFICATIONS))
.contentType("application/hal+json")
.content("{\"key\":\"Key0815casdgdgh\", \"domain\":\"DOMAIN_B\"}")
.header("Authorization", TEAMLEAD_1_CREDENTIALS))
@ -313,7 +316,7 @@ class ClassificationControllerRestDocumentation extends BaseRestDocumentation {
this.mockMvc
.perform(
RestDocumentationRequestBuilders.delete(
restHelper.toUrl(Mapping.URL_CLASSIFICATIONS_ID, newId))
restHelper.toUrl(RestEndpoints.URL_CLASSIFICATIONS_ID, newId))
.header("Authorization", TEAMLEAD_1_CREDENTIALS))
.andExpect(MockMvcResultMatchers.status().isNoContent())
.andDo(MockMvcRestDocumentation.document("DeleteClassificationDocTest"));
@ -324,7 +327,7 @@ class ClassificationControllerRestDocumentation extends BaseRestDocumentation {
URL url =
new URL(
restHelper.toUrl(
Mapping.URL_CLASSIFICATIONS_ID, "CLI:100000000000000000000000000000000009"));
RestEndpoints.URL_CLASSIFICATIONS_ID, "CLI:100000000000000000000000000000000009"));
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setRequestMethod("GET");
con.setRequestProperty("Authorization", TEAMLEAD_1_CREDENTIALS);
@ -344,7 +347,8 @@ class ClassificationControllerRestDocumentation extends BaseRestDocumentation {
.perform(
RestDocumentationRequestBuilders.put(
restHelper.toUrl(
Mapping.URL_CLASSIFICATIONS_ID, "CLI:100000000000000000000000000000000009"))
RestEndpoints.URL_CLASSIFICATIONS_ID,
"CLI:100000000000000000000000000000000009"))
.header("Authorization", TEAMLEAD_1_CREDENTIALS)
.contentType("application/json")
.content(modifiedTask))

View File

@ -15,7 +15,7 @@ import org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders;
import org.springframework.restdocs.payload.FieldDescriptor;
import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
import pro.taskana.common.rest.Mapping;
import pro.taskana.common.rest.RestEndpoints;
import pro.taskana.common.test.doc.api.BaseRestDocumentation;
/** Test ClassificationDefinitionControlller. */
@ -38,7 +38,7 @@ class ClassificationDefinitionControllerRestDocumentation extends BaseRestDocume
this.mockMvc
.perform(
RestDocumentationRequestBuilders.get(
restHelper.toUrl(Mapping.URL_CLASSIFICATIONDEFINITIONS))
restHelper.toUrl(RestEndpoints.URL_CLASSIFICATION_DEFINITIONS))
.accept("application/json")
.header("Authorization", TEAMLEAD_1_CREDENTIALS))
.andExpect(MockMvcResultMatchers.status().isOk())
@ -55,7 +55,7 @@ class ClassificationDefinitionControllerRestDocumentation extends BaseRestDocume
this.mockMvc
.perform(
multipart(restHelper.toUrl(Mapping.URL_CLASSIFICATIONDEFINITIONS))
multipart(restHelper.toUrl(RestEndpoints.URL_CLASSIFICATION_DEFINITIONS))
.file("file", definitionString.getBytes(UTF_8))
.header("Authorization", TEAMLEAD_1_CREDENTIALS))
.andExpect(MockMvcResultMatchers.status().isNoContent())

View File

@ -11,7 +11,7 @@ import org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders;
import org.springframework.restdocs.payload.FieldDescriptor;
import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
import pro.taskana.common.rest.Mapping;
import pro.taskana.common.rest.RestEndpoints;
import pro.taskana.common.test.doc.api.BaseRestDocumentation;
/** Generate common REST Documentation. */
@ -66,7 +66,8 @@ class CommonRestDocumentation extends BaseRestDocumentation {
.perform(
RestDocumentationRequestBuilders.get(
restHelper.toUrl(
Mapping.URL_CLASSIFICATIONS_ID, "CLI:100000000000000000000000000000000009"))
RestEndpoints.URL_CLASSIFICATIONS_ID,
"CLI:100000000000000000000000000000000009"))
.header("Authorization", TEAMLEAD_1_CREDENTIALS))
.andExpect(MockMvcResultMatchers.status().isOk())
.andDo(

View File

@ -11,7 +11,7 @@ import org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders;
import org.springframework.restdocs.payload.FieldDescriptor;
import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
import pro.taskana.common.rest.Mapping;
import pro.taskana.common.rest.RestEndpoints;
import pro.taskana.common.test.doc.api.BaseRestDocumentation;
/** Generate REST docu for the monitor controller. */
@ -53,7 +53,8 @@ class MonitorControllerRestDocumentation extends BaseRestDocumentation {
void getTaskStatusReport() throws Exception {
this.mockMvc
.perform(
RestDocumentationRequestBuilders.get(restHelper.toUrl(Mapping.URL_MONITOR_TASKS_STATUS))
RestDocumentationRequestBuilders.get(
restHelper.toUrl(RestEndpoints.URL_MONITOR_TASKS_STATUS))
.header("Authorization", ADMIN_CREDENTIALS))
.andExpect(MockMvcResultMatchers.status().isOk())
.andDo(
@ -66,7 +67,7 @@ class MonitorControllerRestDocumentation extends BaseRestDocumentation {
this.mockMvc
.perform(
RestDocumentationRequestBuilders.get(
restHelper.toUrl(Mapping.URL_MONITOR_TASKS_WORKBASKET)
restHelper.toUrl(RestEndpoints.URL_MONITOR_TASKS_WORKBASKET)
+ "?daysInPast=4&states=READY,CLAIMED,COMPLETED")
.accept("application/hal+json")
.header("Authorization", ADMIN_CREDENTIALS))
@ -81,7 +82,7 @@ class MonitorControllerRestDocumentation extends BaseRestDocumentation {
this.mockMvc
.perform(
RestDocumentationRequestBuilders.get(
restHelper.toUrl(Mapping.URL_MONITOR_TASKS_CLASSIFICATION))
restHelper.toUrl(RestEndpoints.URL_MONITOR_TASKS_CLASSIFICATION))
.accept("application/hal+json")
.header("Authorization", ADMIN_CREDENTIALS))
.andExpect(MockMvcResultMatchers.status().isOk())
@ -94,7 +95,8 @@ class MonitorControllerRestDocumentation extends BaseRestDocumentation {
void getTimestampReport() throws Exception {
this.mockMvc
.perform(
RestDocumentationRequestBuilders.get(restHelper.toUrl(Mapping.URL_MONITOR_TIMESTAMP))
RestDocumentationRequestBuilders.get(
restHelper.toUrl(RestEndpoints.URL_MONITOR_TIMESTAMP))
.accept("application/hal+json")
.header("Authorization", ADMIN_CREDENTIALS))
.andExpect(MockMvcResultMatchers.status().isOk())

View File

@ -21,7 +21,7 @@ import org.springframework.restdocs.payload.FieldDescriptor;
import org.springframework.test.web.servlet.MvcResult;
import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
import pro.taskana.common.rest.Mapping;
import pro.taskana.common.rest.RestEndpoints;
import pro.taskana.common.rest.models.TaskanaPagedModelKeys;
import pro.taskana.common.test.doc.api.BaseRestDocumentation;
@ -96,7 +96,8 @@ class TaskCommentControllerRestDocumentation extends BaseRestDocumentation {
.perform(
RestDocumentationRequestBuilders.get(
restHelper.toUrl(
Mapping.URL_TASK_COMMENTS, "TKI:000000000000000000000000000000000000"))
RestEndpoints.URL_TASK_COMMENTS,
"TKI:000000000000000000000000000000000000"))
.accept(MediaTypes.HAL_JSON)
.header("Authorization", ADMIN_CREDENTIALS))
.andExpect(MockMvcResultMatchers.status().isOk())
@ -112,7 +113,7 @@ class TaskCommentControllerRestDocumentation extends BaseRestDocumentation {
.perform(
RestDocumentationRequestBuilders.get(
restHelper.toUrl(
Mapping.URL_TASK_COMMENT, "TCI:000000000000000000000000000000000000"))
RestEndpoints.URL_TASK_COMMENT, "TCI:000000000000000000000000000000000000"))
.accept(MediaTypes.HAL_JSON)
.header("Authorization", ADMIN_CREDENTIALS))
.andExpect(MockMvcResultMatchers.status().isOk())
@ -125,7 +126,8 @@ class TaskCommentControllerRestDocumentation extends BaseRestDocumentation {
void updateTaskCommentDocTest() throws Exception {
URL url =
new URL(
restHelper.toUrl(Mapping.URL_TASK_COMMENT, "TCI:000000000000000000000000000000000000"));
restHelper.toUrl(
RestEndpoints.URL_TASK_COMMENT, "TCI:000000000000000000000000000000000000"));
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setRequestMethod("GET");
@ -148,7 +150,7 @@ class TaskCommentControllerRestDocumentation extends BaseRestDocumentation {
.perform(
RestDocumentationRequestBuilders.put(
restHelper.toUrl(
Mapping.URL_TASK_COMMENT, "TCI:000000000000000000000000000000000000"))
RestEndpoints.URL_TASK_COMMENT, "TCI:000000000000000000000000000000000000"))
.header("Authorization", ADMIN_CREDENTIALS)
.contentType(MediaTypes.HAL_JSON)
.content(modifiedTaskComment))
@ -172,7 +174,8 @@ class TaskCommentControllerRestDocumentation extends BaseRestDocumentation {
.perform(
RestDocumentationRequestBuilders.post(
restHelper.toUrl(
Mapping.URL_TASK_COMMENTS, "TKI:000000000000000000000000000000000000"))
RestEndpoints.URL_TASK_COMMENTS,
"TKI:000000000000000000000000000000000000"))
.contentType(MediaTypes.HAL_JSON)
.content(createTaskCommentContent)
.header("Authorization", ADMIN_CREDENTIALS))
@ -191,7 +194,7 @@ class TaskCommentControllerRestDocumentation extends BaseRestDocumentation {
this.mockMvc
.perform(
RestDocumentationRequestBuilders.delete(
restHelper.toUrl(Mapping.URL_TASK_COMMENT, newId))
restHelper.toUrl(RestEndpoints.URL_TASK_COMMENT, newId))
.header("Authorization", ADMIN_CREDENTIALS)) // admin
.andExpect(MockMvcResultMatchers.status().isNoContent())
.andDo(MockMvcRestDocumentation.document("DeleteTaskCommentDocTest"));

View File

@ -20,7 +20,7 @@ import org.springframework.restdocs.payload.FieldDescriptor;
import org.springframework.test.web.servlet.MvcResult;
import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
import pro.taskana.common.rest.Mapping;
import pro.taskana.common.rest.RestEndpoints;
import pro.taskana.common.test.doc.api.BaseRestDocumentation;
/** Generate REST Documentation for the TaskController. */
@ -466,7 +466,7 @@ class TaskControllerRestDocumentation extends BaseRestDocumentation {
this.mockMvc
.perform(
RestDocumentationRequestBuilders.get(
restHelper.toUrl(Mapping.URL_TASKS) + "?por.type=VNR&por.value=22334455")
restHelper.toUrl(RestEndpoints.URL_TASKS) + "?por.type=VNR&por.value=22334455")
.accept("application/hal+json")
.header("Authorization", ADMIN_CREDENTIALS))
.andExpect(MockMvcResultMatchers.status().isOk())
@ -481,7 +481,7 @@ class TaskControllerRestDocumentation extends BaseRestDocumentation {
.perform(
RestDocumentationRequestBuilders.get(
restHelper.toUrl(
Mapping.URL_TASKS_ID, "TKI:100000000000000000000000000000000000"))
RestEndpoints.URL_TASKS_ID, "TKI:100000000000000000000000000000000000"))
.accept("application/hal+json")
.header("Authorization", ADMIN_CREDENTIALS))
.andExpect(MockMvcResultMatchers.status().isOk())
@ -496,7 +496,7 @@ class TaskControllerRestDocumentation extends BaseRestDocumentation {
.perform(
RestDocumentationRequestBuilders.get(
restHelper.toUrl(
Mapping.URL_TASKS_ID, "TKI:100000000000000000000000000000000000"))
RestEndpoints.URL_TASKS_ID, "TKI:100000000000000000000000000000000000"))
.accept("application/hal+json")
.header("Authorization", ADMIN_CREDENTIALS))
.andExpect(MockMvcResultMatchers.status().isOk())
@ -508,7 +508,9 @@ class TaskControllerRestDocumentation extends BaseRestDocumentation {
@Test
void updateTaskDocTest() throws Exception {
URL url =
new URL(restHelper.toUrl(Mapping.URL_TASKS_ID, "TKI:100000000000000000000000000000000000"));
new URL(
restHelper.toUrl(
RestEndpoints.URL_TASKS_ID, "TKI:100000000000000000000000000000000000"));
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setRequestMethod("GET");
con.setRequestProperty("Authorization", ADMIN_CREDENTIALS);
@ -528,7 +530,7 @@ class TaskControllerRestDocumentation extends BaseRestDocumentation {
.perform(
RestDocumentationRequestBuilders.put(
restHelper.toUrl(
Mapping.URL_TASKS_ID, "TKI:100000000000000000000000000000000000"))
RestEndpoints.URL_TASKS_ID, "TKI:100000000000000000000000000000000000"))
.header("Authorization", ADMIN_CREDENTIALS)
.contentType("application/json")
.content(originalTask))
@ -545,7 +547,7 @@ class TaskControllerRestDocumentation extends BaseRestDocumentation {
this.mockMvc
.perform(
RestDocumentationRequestBuilders.post(
restHelper.toUrl(Mapping.URL_TASKS_ID_SELECT_AND_CLAIM) + "?custom14=abc")
restHelper.toUrl(RestEndpoints.URL_TASKS_ID_SELECT_AND_CLAIM) + "?custom14=abc")
.accept("application/hal+json")
.header("Authorization", ADMIN_CREDENTIALS))
.andExpect(MockMvcResultMatchers.status().isOk())
@ -560,7 +562,7 @@ class TaskControllerRestDocumentation extends BaseRestDocumentation {
MvcResult result =
this.mockMvc
.perform(
RestDocumentationRequestBuilders.post(restHelper.toUrl(Mapping.URL_TASKS))
RestDocumentationRequestBuilders.post(restHelper.toUrl(RestEndpoints.URL_TASKS))
.contentType("application/hal+json")
.content(
"{\"classificationSummary\":{\"key\":\"L11010\"},"
@ -583,7 +585,8 @@ class TaskControllerRestDocumentation extends BaseRestDocumentation {
this.mockMvc
.perform(
RestDocumentationRequestBuilders.delete(restHelper.toUrl(Mapping.URL_TASKS_ID, newId))
RestDocumentationRequestBuilders.delete(
restHelper.toUrl(RestEndpoints.URL_TASKS_ID, newId))
.header("Authorization", "Basic YWRtaW46YWRtaW4=")) // admin
.andExpect(MockMvcResultMatchers.status().isNoContent())
.andDo(MockMvcRestDocumentation.document("DeleteTaskDocTest"));
@ -594,7 +597,7 @@ class TaskControllerRestDocumentation extends BaseRestDocumentation {
this.mockMvc
.perform(
RestDocumentationRequestBuilders.get(
restHelper.toUrl(Mapping.URL_TASKS)
restHelper.toUrl(RestEndpoints.URL_TASKS)
+ "?task-id=TKI:000000000000000000000000000000000036,"
+ "TKI:000000000000000000000000000000000037,"
+ "TKI:000000000000000000000000000000000038"
@ -613,7 +616,7 @@ class TaskControllerRestDocumentation extends BaseRestDocumentation {
MvcResult result =
this.mockMvc
.perform(
RestDocumentationRequestBuilders.post(restHelper.toUrl(Mapping.URL_TASKS))
RestDocumentationRequestBuilders.post(restHelper.toUrl(RestEndpoints.URL_TASKS))
.contentType("application/hal+json")
.content(
"{\"classificationSummary\":{\"key\":\"L11010\"},"
@ -633,7 +636,7 @@ class TaskControllerRestDocumentation extends BaseRestDocumentation {
this.mockMvc
.perform(
RestDocumentationRequestBuilders.post(
restHelper.toUrl(Mapping.URL_TASKS_ID_CLAIM, newId))
restHelper.toUrl(RestEndpoints.URL_TASKS_ID_CLAIM, newId))
.accept("application/hal+json")
.header("Authorization", ADMIN_CREDENTIALS)
.content("{}"))
@ -649,7 +652,7 @@ class TaskControllerRestDocumentation extends BaseRestDocumentation {
MvcResult result =
this.mockMvc
.perform(
RestDocumentationRequestBuilders.post(restHelper.toUrl(Mapping.URL_TASKS))
RestDocumentationRequestBuilders.post(restHelper.toUrl(RestEndpoints.URL_TASKS))
.contentType("application/hal+json")
.content(
"{\"classificationSummary\":{\"key\":\"L11010\"},"
@ -669,7 +672,7 @@ class TaskControllerRestDocumentation extends BaseRestDocumentation {
this.mockMvc
.perform(
RestDocumentationRequestBuilders.delete(
restHelper.toUrl(Mapping.URL_TASKS_ID_CLAIM, newId))
restHelper.toUrl(RestEndpoints.URL_TASKS_ID_CLAIM, newId))
.accept("application/hal+json")
.header("Authorization", ADMIN_CREDENTIALS)
.content("{}"))
@ -684,7 +687,7 @@ class TaskControllerRestDocumentation extends BaseRestDocumentation {
MvcResult result =
this.mockMvc
.perform(
RestDocumentationRequestBuilders.post(restHelper.toUrl(Mapping.URL_TASKS))
RestDocumentationRequestBuilders.post(restHelper.toUrl(RestEndpoints.URL_TASKS))
.contentType("application/hal+json")
.content(
"{\"classificationSummary\":{\"key\":\"L11010\"},"
@ -703,7 +706,7 @@ class TaskControllerRestDocumentation extends BaseRestDocumentation {
this.mockMvc
.perform(
RestDocumentationRequestBuilders.post(
restHelper.toUrl(Mapping.URL_TASKS_ID_COMPLETE, newId))
restHelper.toUrl(RestEndpoints.URL_TASKS_ID_COMPLETE, newId))
.accept("application/hal+json")
.header("Authorization", ADMIN_CREDENTIALS)
.content("{}"))
@ -718,7 +721,7 @@ class TaskControllerRestDocumentation extends BaseRestDocumentation {
MvcResult result =
this.mockMvc
.perform(
RestDocumentationRequestBuilders.post(restHelper.toUrl(Mapping.URL_TASKS))
RestDocumentationRequestBuilders.post(restHelper.toUrl(RestEndpoints.URL_TASKS))
.contentType("application/hal+json")
.content(
"{\"classificationSummary\":{\"key\":\"L11010\"},"
@ -741,7 +744,7 @@ class TaskControllerRestDocumentation extends BaseRestDocumentation {
.perform(
RestDocumentationRequestBuilders.post(
restHelper.toUrl(
Mapping.URL_TASKS_ID_TRANSFER_WORKBASKETID,
RestEndpoints.URL_TASKS_ID_TRANSFER_WORKBASKET_ID,
newId,
"WBI:100000000000000000000000000000000001"))
.header("Authorization", ADMIN_CREDENTIALS))

View File

@ -10,7 +10,7 @@ import org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders;
import org.springframework.restdocs.payload.FieldDescriptor;
import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
import pro.taskana.common.rest.Mapping;
import pro.taskana.common.rest.RestEndpoints;
import pro.taskana.common.test.doc.api.BaseRestDocumentation;
/** Generate REST Docu for the TaskanaEngineController. */
@ -52,7 +52,7 @@ class TaskanaEngineControllerRestDocumentation extends BaseRestDocumentation {
void getAllDomainsDocTest() throws Exception {
this.mockMvc
.perform(
RestDocumentationRequestBuilders.get(restHelper.toUrl(Mapping.URL_DOMAIN))
RestDocumentationRequestBuilders.get(restHelper.toUrl(RestEndpoints.URL_DOMAIN))
.accept("application/json")
.header("Authorization", TEAMLEAD_1_CREDENTIALS))
.andExpect(MockMvcResultMatchers.status().isOk())
@ -66,7 +66,7 @@ class TaskanaEngineControllerRestDocumentation extends BaseRestDocumentation {
this.mockMvc
.perform(
RestDocumentationRequestBuilders.get(
restHelper.toUrl(Mapping.URL_CLASSIFICATION_CATEGORIES))
restHelper.toUrl(RestEndpoints.URL_CLASSIFICATION_CATEGORIES))
.accept("application/json")
.header("Authorization", TEAMLEAD_1_CREDENTIALS))
.andExpect(MockMvcResultMatchers.status().isOk())
@ -80,7 +80,8 @@ class TaskanaEngineControllerRestDocumentation extends BaseRestDocumentation {
void getAllClassificationTypesDocTest() throws Exception {
this.mockMvc
.perform(
RestDocumentationRequestBuilders.get(restHelper.toUrl(Mapping.URL_CLASSIFICATION_TYPES))
RestDocumentationRequestBuilders.get(
restHelper.toUrl(RestEndpoints.URL_CLASSIFICATION_TYPES))
.accept("application/json")
.header("Authorization", TEAMLEAD_1_CREDENTIALS))
.andExpect(MockMvcResultMatchers.status().isOk())
@ -94,7 +95,7 @@ class TaskanaEngineControllerRestDocumentation extends BaseRestDocumentation {
void getCurrentUserInfo() throws Exception {
this.mockMvc
.perform(
RestDocumentationRequestBuilders.get(restHelper.toUrl(Mapping.URL_CURRENT_USER))
RestDocumentationRequestBuilders.get(restHelper.toUrl(RestEndpoints.URL_CURRENT_USER))
.accept("application/json")
.header("Authorization", TEAMLEAD_1_CREDENTIALS))
.andExpect(MockMvcResultMatchers.status().isOk())
@ -107,7 +108,8 @@ class TaskanaEngineControllerRestDocumentation extends BaseRestDocumentation {
void getHistoryProviderIsEnabled() throws Exception {
this.mockMvc
.perform(
RestDocumentationRequestBuilders.get(restHelper.toUrl(Mapping.URL_HISTORY_ENABLED))
RestDocumentationRequestBuilders.get(
restHelper.toUrl(RestEndpoints.URL_HISTORY_ENABLED))
.accept("application/json")
.header("Authorization", TEAMLEAD_1_CREDENTIALS))
.andExpect(MockMvcResultMatchers.status().isOk())

View File

@ -12,7 +12,7 @@ import org.springframework.restdocs.payload.FieldDescriptor;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
import pro.taskana.common.rest.Mapping;
import pro.taskana.common.rest.RestEndpoints;
import pro.taskana.common.test.doc.api.BaseRestDocumentation;
/** Generate REST Docu for the WorkbasketAccessItemController. */
@ -114,7 +114,7 @@ class WorkbasketAccessItemControllerRestDocumentation extends BaseRestDocumentat
this.mockMvc
.perform(
RestDocumentationRequestBuilders.get(
restHelper.toUrl(Mapping.URL_WORKBASKET_ACCESS_ITEMS)
restHelper.toUrl(RestEndpoints.URL_WORKBASKET_ACCESS_ITEMS)
+ "?sort-by=workbasket-key&order=asc&access-ids=user-2-2")
.accept("application/hal+json")
.header("Authorization", TEAMLEAD_1_CREDENTIALS))
@ -130,7 +130,8 @@ class WorkbasketAccessItemControllerRestDocumentation extends BaseRestDocumentat
this.mockMvc
.perform(
RestDocumentationRequestBuilders.delete(
restHelper.toUrl(Mapping.URL_WORKBASKET_ACCESS_ITEMS) + "?access-id=user-2-2")
restHelper.toUrl(RestEndpoints.URL_WORKBASKET_ACCESS_ITEMS)
+ "?access-id=user-2-2")
.header("Authorization", TEAMLEAD_1_CREDENTIALS))
.andExpect(MockMvcResultMatchers.status().isNoContent())
.andDo(MockMvcRestDocumentation.document("RemoveWorkbasketAccessItemsDocTest"));

View File

@ -20,7 +20,7 @@ import org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders;
import org.springframework.restdocs.payload.FieldDescriptor;
import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
import pro.taskana.common.rest.Mapping;
import pro.taskana.common.rest.RestEndpoints;
import pro.taskana.common.rest.models.TaskanaPagedModelKeys;
import pro.taskana.common.test.doc.api.BaseRestDocumentation;
@ -334,7 +334,7 @@ class WorkbasketControllerRestDocumentation extends BaseRestDocumentation {
this.mockMvc
.perform(
RestDocumentationRequestBuilders.get(
restHelper.toUrl(Mapping.URL_WORKBASKET) + "?type=PERSONAL")
restHelper.toUrl(RestEndpoints.URL_WORKBASKET) + "?type=PERSONAL")
.accept("application/hal+json")
.header("Authorization", TEAMLEAD_1_CREDENTIALS))
.andExpect(MockMvcResultMatchers.status().isOk())
@ -349,7 +349,8 @@ class WorkbasketControllerRestDocumentation extends BaseRestDocumentation {
.perform(
RestDocumentationRequestBuilders.get(
restHelper.toUrl(
Mapping.URL_WORKBASKET_ID, "WBI:100000000000000000000000000000000001"))
RestEndpoints.URL_WORKBASKET_ID,
"WBI:100000000000000000000000000000000001"))
.accept("application/hal+json")
.header("Authorization", TEAMLEAD_1_CREDENTIALS))
.andExpect(MockMvcResultMatchers.status().isOk())
@ -369,7 +370,7 @@ class WorkbasketControllerRestDocumentation extends BaseRestDocumentation {
.perform(
RestDocumentationRequestBuilders.get(
restHelper.toUrl(
Mapping.URL_WORKBASKET_ID_ACCESSITEMS,
RestEndpoints.URL_WORKBASKET_ID_ACCESS_ITEMS,
"WBI:100000000000000000000000000000000001"))
.accept("application/hal+json")
.header("Authorization", TEAMLEAD_1_CREDENTIALS))
@ -386,7 +387,8 @@ class WorkbasketControllerRestDocumentation extends BaseRestDocumentation {
.perform(
RestDocumentationRequestBuilders.get(
restHelper.toUrl(
Mapping.URL_WORKBASKET_ID, "WBI:100000000000000000000000000000000001"))
RestEndpoints.URL_WORKBASKET_ID,
"WBI:100000000000000000000000000000000001"))
.accept("application/hal+json")
.header("Authorization", TEAMLEAD_1_CREDENTIALS))
.andExpect(MockMvcResultMatchers.status().isOk())
@ -406,7 +408,7 @@ class WorkbasketControllerRestDocumentation extends BaseRestDocumentation {
.perform(
RestDocumentationRequestBuilders.delete(
restHelper.toUrl(
Mapping.URL_WORKBASKET_ID_DISTRIBUTION,
RestEndpoints.URL_WORKBASKET_ID_DISTRIBUTION,
"WBI:100000000000000000000000000000000007"))
.header("Authorization", TEAMLEAD_1_CREDENTIALS))
.andExpect(MockMvcResultMatchers.status().isNoContent())
@ -419,7 +421,7 @@ class WorkbasketControllerRestDocumentation extends BaseRestDocumentation {
.perform(
RestDocumentationRequestBuilders.get(
restHelper.toUrl(
Mapping.URL_WORKBASKET_ID_DISTRIBUTION,
RestEndpoints.URL_WORKBASKET_ID_DISTRIBUTION,
"WBI:100000000000000000000000000000000002"))
.header("Authorization", TEAMLEAD_1_CREDENTIALS))
.andExpect(MockMvcResultMatchers.status().isOk())
@ -438,7 +440,7 @@ class WorkbasketControllerRestDocumentation extends BaseRestDocumentation {
void createWorkbasketDocTest() throws Exception {
this.mockMvc
.perform(
RestDocumentationRequestBuilders.post(restHelper.toUrl(Mapping.URL_WORKBASKET))
RestDocumentationRequestBuilders.post(restHelper.toUrl(RestEndpoints.URL_WORKBASKET))
.contentType("application/json")
.header("Authorization", TEAMLEAD_1_CREDENTIALS)
.content(
@ -460,7 +462,7 @@ class WorkbasketControllerRestDocumentation extends BaseRestDocumentation {
URL url =
new URL(
restHelper.toUrl(
Mapping.URL_WORKBASKET_ID, "WBI:100000000000000000000000000000000002"));
RestEndpoints.URL_WORKBASKET_ID, "WBI:100000000000000000000000000000000002"));
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setRequestMethod("GET");
con.setRequestProperty("Authorization", ADMIN_CREDENTIALS);
@ -482,7 +484,8 @@ class WorkbasketControllerRestDocumentation extends BaseRestDocumentation {
.perform(
RestDocumentationRequestBuilders.put(
restHelper.toUrl(
Mapping.URL_WORKBASKET_ID, "WBI:100000000000000000000000000000000002"))
RestEndpoints.URL_WORKBASKET_ID,
"WBI:100000000000000000000000000000000002"))
.header("Authorization", TEAMLEAD_1_CREDENTIALS)
.contentType("application/json")
.content(modifiedWorkbasket))
@ -505,7 +508,8 @@ class WorkbasketControllerRestDocumentation extends BaseRestDocumentation {
.perform(
RestDocumentationRequestBuilders.delete(
restHelper.toUrl(
Mapping.URL_WORKBASKET_ID, "WBI:100000000000000000000000000000000008"))
RestEndpoints.URL_WORKBASKET_ID,
"WBI:100000000000000000000000000000000008"))
.header("Authorization", ADMIN_CREDENTIALS))
.andExpect(MockMvcResultMatchers.status().isNoContent())
.andDo(MockMvcRestDocumentation.document("DeleteWorkbasketDocTest"));
@ -517,7 +521,7 @@ class WorkbasketControllerRestDocumentation extends BaseRestDocumentation {
.perform(
RestDocumentationRequestBuilders.get(
restHelper.toUrl(
Mapping.URL_WORKBASKET_ID_ACCESSITEMS,
RestEndpoints.URL_WORKBASKET_ID_ACCESS_ITEMS,
"WBI:100000000000000000000000000000000001"))
.accept("application/hal+json")
.header("Authorization", TEAMLEAD_1_CREDENTIALS))

View File

@ -15,7 +15,7 @@ import org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders;
import org.springframework.restdocs.payload.FieldDescriptor;
import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
import pro.taskana.common.rest.Mapping;
import pro.taskana.common.rest.RestEndpoints;
import pro.taskana.common.test.doc.api.BaseRestDocumentation;
/** Generate Rest Documentation for Workbasket Definitions. */
@ -40,7 +40,7 @@ class WorkbasketDefinitionControllerRestDocumentation extends BaseRestDocumentat
this.mockMvc
.perform(
RestDocumentationRequestBuilders.get(
restHelper.toUrl(Mapping.URL_WORKBASKET_DEFINITIONS))
restHelper.toUrl(RestEndpoints.URL_WORKBASKET_DEFINITIONS))
.accept("application/json")
.header("Authorization", TEAMLEAD_1_CREDENTIALS))
.andExpect(MockMvcResultMatchers.status().isOk())
@ -65,7 +65,7 @@ class WorkbasketDefinitionControllerRestDocumentation extends BaseRestDocumentat
this.mockMvc
.perform(
multipart(restHelper.toUrl(Mapping.URL_WORKBASKET_DEFINITIONS))
multipart(restHelper.toUrl(RestEndpoints.URL_WORKBASKET_DEFINITIONS))
.file("file", definitionString.getBytes(UTF_8))
.header("Authorization", TEAMLEAD_1_CREDENTIALS))
.andExpect(MockMvcResultMatchers.status().isNoContent())

View File

@ -17,7 +17,7 @@ import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.client.HttpClientErrorException;
import pro.taskana.common.rest.Mapping;
import pro.taskana.common.rest.RestEndpoints;
import pro.taskana.common.rest.models.TaskanaPagedModel;
import pro.taskana.common.test.rest.RestHelper;
import pro.taskana.common.test.rest.TaskanaSpringBootTest;
@ -42,7 +42,7 @@ class TaskCommentControllerIntTest {
void should_FailToReturnTaskComment_When_TaskCommentIsNotExisting() {
String urlToNonExistingTaskComment =
restHelper.toUrl(Mapping.URL_TASK_COMMENT, "Non existing task comment Id");
restHelper.toUrl(RestEndpoints.URL_TASK_COMMENT, "Non existing task comment Id");
ThrowingCallable httpCall =
() ->
@ -60,7 +60,8 @@ class TaskCommentControllerIntTest {
void should_FailToReturnTaskComments_When_TaskIstNotVisible() {
String urlToNotVisibleTask =
restHelper.toUrl(Mapping.URL_TASK_COMMENTS, "TKI:000000000000000000000000000000000004");
restHelper.toUrl(
RestEndpoints.URL_TASK_COMMENTS, "TKI:000000000000000000000000000000000004");
ThrowingCallable httpCall =
() ->
@ -78,7 +79,8 @@ class TaskCommentControllerIntTest {
void should_ReturnSortedAndOrederedTaskCommentsSortedByModified_When_UsingSortAndOrderParams() {
String url =
restHelper.toUrl(Mapping.URL_TASK_COMMENTS, "TKI:000000000000000000000000000000000000");
restHelper.toUrl(
RestEndpoints.URL_TASK_COMMENTS, "TKI:000000000000000000000000000000000000");
ResponseEntity<TaskanaPagedModel<TaskCommentRepresentationModel>>
getTaskCommentsSortedByModifiedOrderedByDescendingResponse =
@ -141,7 +143,8 @@ class TaskCommentControllerIntTest {
void should_ThrowException_When_UsingInvalidSortParam() {
String url =
restHelper.toUrl(Mapping.URL_TASK_COMMENTS, "TKI:000000000000000000000000000000000000");
restHelper.toUrl(
RestEndpoints.URL_TASK_COMMENTS, "TKI:000000000000000000000000000000000000");
ThrowingCallable httpCall =
() ->
@ -159,7 +162,8 @@ class TaskCommentControllerIntTest {
void should_FailToReturnTaskComment_When_TaskIstNotVisible() {
String urlToNotVisibleTask =
restHelper.toUrl(Mapping.URL_TASK_COMMENT, "TCI:000000000000000000000000000000000012");
restHelper.toUrl(
RestEndpoints.URL_TASK_COMMENT, "TCI:000000000000000000000000000000000012");
ThrowingCallable httpCall =
() ->
@ -185,7 +189,7 @@ class TaskCommentControllerIntTest {
() ->
TEMPLATE.exchange(
restHelper.toUrl(
Mapping.URL_TASK_COMMENTS, "TKI:000000000000000000000000000000000000"),
RestEndpoints.URL_TASK_COMMENTS, "TKI:000000000000000000000000000000000000"),
HttpMethod.POST,
new HttpEntity<>(
taskCommentRepresentationModelToCreate, restHelper.getHeadersUser_b_1()),
@ -206,7 +210,7 @@ class TaskCommentControllerIntTest {
ThrowingCallable httpCall =
() ->
TEMPLATE.exchange(
restHelper.toUrl(Mapping.URL_TASK_COMMENTS, "DefinatelyNotExistingId"),
restHelper.toUrl(RestEndpoints.URL_TASK_COMMENTS, "DefinatelyNotExistingId"),
HttpMethod.POST,
new HttpEntity<>(
taskCommentRepresentationModelToCreate, restHelper.getHeadersAdmin()),
@ -219,7 +223,8 @@ class TaskCommentControllerIntTest {
@Test
void should_FailToUpdateTaskComment_When_TaskCommentWasModifiedConcurrently() {
String url =
restHelper.toUrl(Mapping.URL_TASK_COMMENT, "TCI:000000000000000000000000000000000000");
restHelper.toUrl(
RestEndpoints.URL_TASK_COMMENT, "TCI:000000000000000000000000000000000000");
ResponseEntity<TaskCommentRepresentationModel> getTaskCommentResponse =
TEMPLATE.exchange(
@ -250,7 +255,8 @@ class TaskCommentControllerIntTest {
@Test
void should_FailToUpdateTaskComment_When_UserHasNoAuthorization() {
String url =
restHelper.toUrl(Mapping.URL_TASK_COMMENT, "TCI:000000000000000000000000000000000000");
restHelper.toUrl(
RestEndpoints.URL_TASK_COMMENT, "TCI:000000000000000000000000000000000000");
ResponseEntity<TaskCommentRepresentationModel> getTaskCommentResponse =
TEMPLATE.exchange(
@ -282,7 +288,8 @@ class TaskCommentControllerIntTest {
void should_FailToUpdateTaskComment_When_TaskCommentIdInResourceDoesNotMatchPathVariable() {
String url =
restHelper.toUrl(Mapping.URL_TASK_COMMENT, "TCI:000000000000000000000000000000000000");
restHelper.toUrl(
RestEndpoints.URL_TASK_COMMENT, "TCI:000000000000000000000000000000000000");
ResponseEntity<TaskCommentRepresentationModel> getTaskCommentResponse =
TEMPLATE.exchange(
@ -320,7 +327,7 @@ class TaskCommentControllerIntTest {
getTaskCommentsBeforeDeleteionResponse =
TEMPLATE.exchange(
restHelper.toUrl(
Mapping.URL_TASK_COMMENTS, "TKI:000000000000000000000000000000000001"),
RestEndpoints.URL_TASK_COMMENTS, "TKI:000000000000000000000000000000000001"),
HttpMethod.GET,
new HttpEntity<String>(restHelper.getHeadersUser_1_2()),
TASK_COMMENT_PAGE_MODEL_TYPE);
@ -328,7 +335,8 @@ class TaskCommentControllerIntTest {
assertThat(getTaskCommentsBeforeDeleteionResponse.getBody().getContent()).hasSize(2);
String url =
restHelper.toUrl(Mapping.URL_TASK_COMMENT, "TCI:000000000000000000000000000000000004");
restHelper.toUrl(
RestEndpoints.URL_TASK_COMMENT, "TCI:000000000000000000000000000000000004");
ThrowingCallable httpCall =
() ->
@ -347,7 +355,7 @@ class TaskCommentControllerIntTest {
@Test
void should_FailToDeleteTaskComment_When_TaskCommentIsNotExisting() {
String url = restHelper.toUrl(Mapping.URL_TASK_COMMENT, "NotExistingTaskComment");
String url = restHelper.toUrl(RestEndpoints.URL_TASK_COMMENT, "NotExistingTaskComment");
ThrowingCallable httpCall =
() ->

View File

@ -29,7 +29,7 @@ import org.springframework.web.client.HttpClientErrorException;
import org.springframework.web.client.RestTemplate;
import pro.taskana.classification.rest.models.ClassificationSummaryRepresentationModel;
import pro.taskana.common.rest.Mapping;
import pro.taskana.common.rest.RestEndpoints;
import pro.taskana.common.rest.models.TaskanaPagedModel;
import pro.taskana.common.test.rest.RestHelper;
import pro.taskana.common.test.rest.TaskanaSpringBootTest;
@ -82,7 +82,7 @@ class TaskControllerIntTest {
void testGetAllTasks() {
ResponseEntity<TaskanaPagedModel<TaskSummaryRepresentationModel>> response =
TEMPLATE.exchange(
restHelper.toUrl(Mapping.URL_TASKS),
restHelper.toUrl(RestEndpoints.URL_TASKS),
HttpMethod.GET,
restHelper.defaultRequest(),
TASK_SUMMARY_PAGE_MODEL_TYPE);
@ -95,7 +95,7 @@ class TaskControllerIntTest {
void testGetAllTasksByWorkbasketId() {
ResponseEntity<TaskanaPagedModel<TaskSummaryRepresentationModel>> response =
TEMPLATE.exchange(
restHelper.toUrl(Mapping.URL_TASKS)
restHelper.toUrl(RestEndpoints.URL_TASKS)
+ "?workbasket-id=WBI:100000000000000000000000000000000001",
HttpMethod.GET,
restHelper.defaultRequest(),
@ -115,7 +115,7 @@ class TaskControllerIntTest {
ResponseEntity<TaskanaPagedModel<TaskSummaryRepresentationModel>> response =
TEMPLATE.exchange(
restHelper.toUrl(Mapping.URL_TASKS)
restHelper.toUrl(RestEndpoints.URL_TASKS)
+ "?workbasket-id=WBI:100000000000000000000000000000000001"
+ "&planned="
+ firstInstant
@ -143,7 +143,7 @@ class TaskControllerIntTest {
ResponseEntity<TaskanaPagedModel<TaskSummaryRepresentationModel>> response =
TEMPLATE.exchange(
restHelper.toUrl(Mapping.URL_TASKS)
restHelper.toUrl(RestEndpoints.URL_TASKS)
+ "?workbasket-id=WBI:100000000000000000000000000000000001"
+ "&planned-from="
+ plannedFromInstant
@ -165,7 +165,7 @@ class TaskControllerIntTest {
ResponseEntity<TaskanaPagedModel<TaskSummaryRepresentationModel>> response =
TEMPLATE.exchange(
restHelper.toUrl(Mapping.URL_TASKS)
restHelper.toUrl(RestEndpoints.URL_TASKS)
+ "?workbasket-id=WBI:100000000000000000000000000000000001"
+ "&planned-from="
+ plannedFromInstant
@ -183,7 +183,7 @@ class TaskControllerIntTest {
ThrowingCallable httpCall =
() ->
TEMPLATE.exchange(
restHelper.toUrl(Mapping.URL_TASKS)
restHelper.toUrl(RestEndpoints.URL_TASKS)
+ "?workbasket-id=WBI:100000000000000000000000000000000001"
+ "&planned=2020-01-22T09:44:47.453Z,,"
+ "2020-01-19T07:44:47.453Z,2020-01-19T19:44:47.453Z,"
@ -208,7 +208,7 @@ class TaskControllerIntTest {
ResponseEntity<TaskanaPagedModel<TaskSummaryRepresentationModel>> response =
TEMPLATE.exchange(
restHelper.toUrl(Mapping.URL_TASKS)
restHelper.toUrl(RestEndpoints.URL_TASKS)
+ "?workbasket-id=WBI:100000000000000000000000000000000001"
+ "&due="
+ firstInstant
@ -232,7 +232,7 @@ class TaskControllerIntTest {
void should_ReturnAllTasksByWildcardSearch_For_ProvidedSearchValue() {
ResponseEntity<TaskanaPagedModel<TaskSummaryRepresentationModel>> response =
TEMPLATE.exchange(
restHelper.toUrl(Mapping.URL_TASKS)
restHelper.toUrl(RestEndpoints.URL_TASKS)
+ "?wildcard-search-value=99"
+ "&wildcard-search-fields=NAME,custom_3,CuStOM_4",
HttpMethod.GET,
@ -255,7 +255,7 @@ class TaskControllerIntTest {
ThrowingCallable httpCall =
() -> {
TEMPLATE.exchange(
restHelper.toUrl(Mapping.URL_TASKS),
restHelper.toUrl(RestEndpoints.URL_TASKS),
HttpMethod.POST,
new HttpEntity<>(taskRepresentationModel, restHelper.getHeadersTeamlead_1()),
TASK_MODEL_TYPE);
@ -275,7 +275,7 @@ class TaskControllerIntTest {
httpCall =
() -> {
TEMPLATE.exchange(
restHelper.toUrl(Mapping.URL_TASKS),
restHelper.toUrl(RestEndpoints.URL_TASKS),
HttpMethod.POST,
new HttpEntity<>(taskRepresentationModel, restHelper.getHeadersTeamlead_1()),
TASK_MODEL_TYPE);
@ -295,7 +295,7 @@ class TaskControllerIntTest {
httpCall =
() -> {
TEMPLATE.exchange(
restHelper.toUrl(Mapping.URL_TASKS),
restHelper.toUrl(RestEndpoints.URL_TASKS),
HttpMethod.POST,
new HttpEntity<>(taskRepresentationModel, restHelper.getHeadersTeamlead_1()),
TASK_MODEL_TYPE);
@ -312,7 +312,7 @@ class TaskControllerIntTest {
void should_DeleteAllTasks_For_ProvidedParams() {
ResponseEntity<TaskanaPagedModel<TaskSummaryRepresentationModel>> response =
template.exchange(
restHelper.toUrl(Mapping.URL_TASKS)
restHelper.toUrl(RestEndpoints.URL_TASKS)
+ "?task-id=TKI:000000000000000000000000000000000036,"
+ "TKI:000000000000000000000000000000000037,"
+ "TKI:000000000000000000000000000000000038"
@ -332,7 +332,7 @@ class TaskControllerIntTest {
ThrowingCallable httpCall =
() ->
TEMPLATE.exchange(
restHelper.toUrl(Mapping.URL_TASKS) + "?wildcard-search-value=%rt%",
restHelper.toUrl(RestEndpoints.URL_TASKS) + "?wildcard-search-value=%rt%",
HttpMethod.GET,
restHelper.defaultRequest(),
TASK_SUMMARY_PAGE_MODEL_TYPE);
@ -345,7 +345,7 @@ class TaskControllerIntTest {
ThrowingCallable httpCall2 =
() ->
TEMPLATE.exchange(
restHelper.toUrl(Mapping.URL_TASKS)
restHelper.toUrl(RestEndpoints.URL_TASKS)
+ "?wildcard-search-fields=NAME,CUSTOM_3,CUSTOM_4",
HttpMethod.GET,
restHelper.defaultRequest(),
@ -365,7 +365,7 @@ class TaskControllerIntTest {
ResponseEntity<TaskanaPagedModel<TaskSummaryRepresentationModel>> response =
TEMPLATE.exchange(
restHelper.toUrl(Mapping.URL_TASKS)
restHelper.toUrl(RestEndpoints.URL_TASKS)
+ "?workbasket-id=WBI:100000000000000000000000000000000001"
+ "&due-from="
+ dueFromInstant
@ -387,7 +387,7 @@ class TaskControllerIntTest {
ResponseEntity<TaskanaPagedModel<TaskSummaryRepresentationModel>> response =
TEMPLATE.exchange(
restHelper.toUrl(Mapping.URL_TASKS)
restHelper.toUrl(RestEndpoints.URL_TASKS)
+ "?workbasket-id=WBI:100000000000000000000000000000000001"
+ "&due-until="
+ dueToInstant
@ -405,7 +405,7 @@ class TaskControllerIntTest {
ThrowingCallable httpCall =
() ->
TEMPLATE.exchange(
restHelper.toUrl(Mapping.URL_TASKS)
restHelper.toUrl(RestEndpoints.URL_TASKS)
+ "?workbasket-id=WBI:100000000000000000000000000000000001"
+ "&due=2020-01-22T09:44:47.453Z,,"
+ "2020-01-19T07:44:47.453Z,2020-01-19T19:44:47.453Z,"
@ -425,7 +425,7 @@ class TaskControllerIntTest {
HttpEntity<String> request = new HttpEntity<>(restHelper.getHeadersUser_1_2());
ResponseEntity<TaskanaPagedModel<TaskSummaryRepresentationModel>> response =
TEMPLATE.exchange(
restHelper.toUrl(Mapping.URL_TASKS) + "?workbasket-key=USER-1-2&domain=DOMAIN_A",
restHelper.toUrl(RestEndpoints.URL_TASKS) + "?workbasket-key=USER-1-2&domain=DOMAIN_A",
HttpMethod.GET,
request,
TASK_SUMMARY_PAGE_MODEL_TYPE);
@ -438,7 +438,7 @@ class TaskControllerIntTest {
void testGetAllTasksByExternalId() {
ResponseEntity<TaskanaPagedModel<TaskSummaryRepresentationModel>> response =
TEMPLATE.exchange(
restHelper.toUrl(Mapping.URL_TASKS)
restHelper.toUrl(RestEndpoints.URL_TASKS)
+ "?external-id=ETI:000000000000000000000000000000000003,"
+ "ETI:000000000000000000000000000000000004",
HttpMethod.GET,
@ -456,7 +456,7 @@ class TaskControllerIntTest {
ThrowingCallable httpCall =
() ->
TEMPLATE.exchange(
restHelper.toUrl(Mapping.URL_TASKS) + "?workbasket-key=USER-1-2",
restHelper.toUrl(RestEndpoints.URL_TASKS) + "?workbasket-key=USER-1-2",
HttpMethod.GET,
request,
TASK_SUMMARY_PAGE_MODEL_TYPE);
@ -469,7 +469,7 @@ class TaskControllerIntTest {
void testGetAllTasksWithAdminRole() {
ResponseEntity<TaskanaPagedModel<TaskSummaryRepresentationModel>> response =
TEMPLATE.exchange(
restHelper.toUrl(Mapping.URL_TASKS),
restHelper.toUrl(RestEndpoints.URL_TASKS),
HttpMethod.GET,
new HttpEntity<>(restHelper.getHeadersAdmin()),
TASK_SUMMARY_PAGE_MODEL_TYPE);
@ -482,7 +482,7 @@ class TaskControllerIntTest {
void testGetAllTasksKeepingFilters() {
ResponseEntity<TaskanaPagedModel<TaskSummaryRepresentationModel>> response =
TEMPLATE.exchange(
restHelper.toUrl(Mapping.URL_TASKS)
restHelper.toUrl(RestEndpoints.URL_TASKS)
+ "?por.type=VNR&por.value=22334455&sort-by=por.value&order=desc",
HttpMethod.GET,
restHelper.defaultRequest(),
@ -498,7 +498,7 @@ class TaskControllerIntTest {
ThrowingCallable httpCall =
() ->
TEMPLATE.exchange(
restHelper.toUrl(Mapping.URL_TASKS) + "?invalid=VNR",
restHelper.toUrl(RestEndpoints.URL_TASKS) + "?invalid=VNR",
HttpMethod.GET,
restHelper.defaultRequest(),
TASK_SUMMARY_PAGE_MODEL_TYPE);
@ -515,7 +515,7 @@ class TaskControllerIntTest {
HttpEntity<String> request = new HttpEntity<>(restHelper.getHeadersAdmin());
ResponseEntity<TaskanaPagedModel<TaskSummaryRepresentationModel>> response =
TEMPLATE.exchange(
restHelper.toUrl(Mapping.URL_TASKS)
restHelper.toUrl(RestEndpoints.URL_TASKS)
+ "?state=READY,CLAIMED&sort-by=por.value&order=desc&page-size=5&page=14",
HttpMethod.GET,
request,
@ -548,7 +548,7 @@ class TaskControllerIntTest {
HttpEntity<String> request = new HttpEntity<>(restHelper.getHeadersTeamlead_1());
ResponseEntity<TaskanaPagedModel<TaskSummaryRepresentationModel>> response =
TEMPLATE.exchange(
restHelper.toUrl(Mapping.URL_TASKS) + "?sort-by=due&order=desc",
restHelper.toUrl(RestEndpoints.URL_TASKS) + "?sort-by=due&order=desc",
HttpMethod.GET,
request,
TASK_SUMMARY_PAGE_MODEL_TYPE);
@ -557,7 +557,8 @@ class TaskControllerIntTest {
response =
TEMPLATE.exchange(
restHelper.toUrl(Mapping.URL_TASKS) + "?sort-by=due&order=desc&page-size=5&page=5",
restHelper.toUrl(RestEndpoints.URL_TASKS)
+ "?sort-by=due&order=desc&page-size=5&page=5",
HttpMethod.GET,
request,
TASK_SUMMARY_PAGE_MODEL_TYPE);
@ -585,7 +586,7 @@ class TaskControllerIntTest {
HttpEntity<String> request = new HttpEntity<>(restHelper.getHeadersTeamlead_1());
ResponseEntity<TaskanaPagedModel<TaskSummaryRepresentationModel>> response =
TEMPLATE.exchange(
restHelper.toUrl(Mapping.URL_TASKS)
restHelper.toUrl(RestEndpoints.URL_TASKS)
+ "?por.company=00&por.system=PASystem&por.instance=00&"
+ "por.type=VNR&por.value=22334455&sort-by=por.type&"
+ "order=asc&page-size=5&page=2",
@ -613,7 +614,8 @@ class TaskControllerIntTest {
void should_NotGetEmptyAttachmentList_When_GettingTaskWithAttachment() {
ResponseEntity<TaskRepresentationModel> response =
template.exchange(
restHelper.toUrl(Mapping.URL_TASKS_ID, "TKI:000000000000000000000000000000000002"),
restHelper.toUrl(
RestEndpoints.URL_TASKS_ID, "TKI:000000000000000000000000000000000002"),
HttpMethod.GET,
new HttpEntity<>(restHelper.getHeadersAdmin()),
TASK_MODEL_TYPE);
@ -629,7 +631,8 @@ class TaskControllerIntTest {
ResponseEntity<TaskRepresentationModel> responseGet =
template.exchange(
restHelper.toUrl(Mapping.URL_TASKS_ID, "TKI:100000000000000000000000000000000000"),
restHelper.toUrl(
RestEndpoints.URL_TASKS_ID, "TKI:100000000000000000000000000000000000"),
HttpMethod.GET,
new HttpEntity<>(restHelper.getHeadersTeamlead_1()),
TASK_MODEL_TYPE);
@ -638,7 +641,8 @@ class TaskControllerIntTest {
ResponseEntity<TaskRepresentationModel> responseUpdate =
template.exchange(
restHelper.toUrl(Mapping.URL_TASKS_ID, "TKI:100000000000000000000000000000000000"),
restHelper.toUrl(
RestEndpoints.URL_TASKS_ID, "TKI:100000000000000000000000000000000000"),
HttpMethod.PUT,
new HttpEntity<>(originalTask, restHelper.getHeadersTeamlead_1()),
TASK_MODEL_TYPE);
@ -655,7 +659,7 @@ class TaskControllerIntTest {
TaskRepresentationModel taskRepresentationModel = getTaskResourceSample();
ResponseEntity<TaskRepresentationModel> responseCreate =
TEMPLATE.exchange(
restHelper.toUrl(Mapping.URL_TASKS),
restHelper.toUrl(RestEndpoints.URL_TASKS),
HttpMethod.POST,
new HttpEntity<>(taskRepresentationModel, restHelper.getHeadersTeamlead_1()),
TASK_MODEL_TYPE);
@ -669,7 +673,7 @@ class TaskControllerIntTest {
ResponseEntity<TaskRepresentationModel> responseDeleted =
TEMPLATE.exchange(
restHelper.toUrl(Mapping.URL_TASKS_ID, taskIdOfCreatedTask),
restHelper.toUrl(RestEndpoints.URL_TASKS_ID, taskIdOfCreatedTask),
HttpMethod.DELETE,
new HttpEntity<>(restHelper.getHeadersAdmin()),
ParameterizedTypeReference.forType(Void.class));
@ -691,7 +695,7 @@ class TaskControllerIntTest {
ThrowingCallable httpCall =
() ->
template.exchange(
restHelper.toUrl(Mapping.URL_TASKS),
restHelper.toUrl(RestEndpoints.URL_TASKS),
HttpMethod.POST,
new HttpEntity<>(taskRepresentationModel, restHelper.getHeadersUser_1_1()),
TASK_MODEL_TYPE);
@ -707,7 +711,7 @@ class TaskControllerIntTest {
+ "\"primaryObjRef\":{\"company\":\"MyCompany1\",\"system\":\"MySystem1\","
+ "\"systemInstance\":\"MyInstance1\",\"type\":\"MyType1\",\"value\":\"00000001\"}}";
URL url = new URL(restHelper.toUrl(Mapping.URL_TASKS));
URL url = new URL(restHelper.toUrl(RestEndpoints.URL_TASKS));
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setRequestMethod("POST");
con.setDoOutput(true);
@ -727,7 +731,7 @@ class TaskControllerIntTest {
+ "\"primaryObjRef\":{\"company\":\"MyCompany1\",\"system\":\"MySystem1\","
+ "\"systemInstance\":\"MyInstance1\",\"type\":\"MyType1\",\"value\":\"00000001\"}}";
url = new URL(restHelper.toUrl(Mapping.URL_TASKS));
url = new URL(restHelper.toUrl(RestEndpoints.URL_TASKS));
con = (HttpURLConnection) url.openConnection();
con.setRequestMethod("POST");
con.setDoOutput(true);
@ -751,7 +755,7 @@ class TaskControllerIntTest {
// retrieve task from Rest Api
ResponseEntity<TaskRepresentationModel> getTaskResponse =
TEMPLATE.exchange(
restHelper.toUrl(Mapping.URL_TASKS_ID, claimed_task_id),
restHelper.toUrl(RestEndpoints.URL_TASKS_ID, claimed_task_id),
HttpMethod.GET,
new HttpEntity<>(restHelper.getHeadersUser_1_2()),
TASK_MODEL_TYPE);
@ -765,7 +769,7 @@ class TaskControllerIntTest {
// cancel claim
ResponseEntity<TaskRepresentationModel> cancelClaimResponse =
TEMPLATE.exchange(
restHelper.toUrl(Mapping.URL_TASKS_ID_CLAIM, claimed_task_id),
restHelper.toUrl(RestEndpoints.URL_TASKS_ID_CLAIM, claimed_task_id),
HttpMethod.DELETE,
new HttpEntity<>(restHelper.getHeadersUser_1_2()),
TASK_MODEL_TYPE);
@ -788,7 +792,7 @@ class TaskControllerIntTest {
// retrieve task from Rest Api
ResponseEntity<TaskRepresentationModel> responseGet =
TEMPLATE.exchange(
restHelper.toUrl(Mapping.URL_TASKS_ID, claimed_task_id),
restHelper.toUrl(RestEndpoints.URL_TASKS_ID, claimed_task_id),
HttpMethod.GET,
new HttpEntity<>(restHelper.getHeadersUser_1_2()),
TASK_MODEL_TYPE);
@ -802,7 +806,7 @@ class TaskControllerIntTest {
ThrowingCallable httpCall =
() ->
template.exchange(
restHelper.toUrl(Mapping.URL_TASKS_ID_CLAIM, claimed_task_id),
restHelper.toUrl(RestEndpoints.URL_TASKS_ID_CLAIM, claimed_task_id),
HttpMethod.DELETE,
new HttpEntity<>(restHelper.getHeadersUser_1_2()),
TASK_MODEL_TYPE);
@ -885,7 +889,8 @@ class TaskControllerIntTest {
@Test
void should_ThrowNotAuthorized_When_UserHasNoAuthorizationOnTask() {
String url = restHelper.toUrl(Mapping.URL_TASKS_ID, "TKI:000000000000000000000000000000000000");
String url =
restHelper.toUrl(RestEndpoints.URL_TASKS_ID, "TKI:000000000000000000000000000000000000");
ThrowingCallable httpCall =
() ->

View File

@ -13,7 +13,7 @@ import pro.taskana.classification.api.ClassificationService;
import pro.taskana.classification.api.models.ClassificationSummary;
import pro.taskana.classification.rest.models.ClassificationSummaryRepresentationModel;
import pro.taskana.common.api.exceptions.InvalidArgumentException;
import pro.taskana.common.rest.Mapping;
import pro.taskana.common.rest.RestEndpoints;
import pro.taskana.common.test.rest.TaskanaSpringBootTest;
import pro.taskana.task.api.TaskCustomField;
import pro.taskana.task.api.TaskService;
@ -270,6 +270,6 @@ class TaskRepresentationModelAssemberTest {
private void testLinks(TaskRepresentationModel repModel) {
assertThat(repModel.getLinks()).hasSize(1);
assertThat(repModel.getRequiredLink("self").getHref())
.isEqualTo(Mapping.URL_TASKS_ID.replaceAll("\\{.*}", repModel.getTaskId()));
.isEqualTo(RestEndpoints.URL_TASKS_ID.replaceAll("\\{.*}", repModel.getTaskId()));
}
}

View File

@ -22,7 +22,7 @@ import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.client.HttpClientErrorException;
import pro.taskana.common.rest.Mapping;
import pro.taskana.common.rest.RestEndpoints;
import pro.taskana.common.rest.models.TaskanaPagedModel;
import pro.taskana.common.test.rest.RestHelper;
import pro.taskana.common.test.rest.TaskanaSpringBootTest;
@ -50,7 +50,7 @@ class WorkbasketAccessItemControllerIntTest {
void testGetAllWorkbasketAccessItems() {
ResponseEntity<TaskanaPagedModel<WorkbasketAccessItemRepresentationModel>> response =
TEMPLATE.exchange(
restHelper.toUrl(Mapping.URL_WORKBASKET_ACCESS_ITEMS),
restHelper.toUrl(RestEndpoints.URL_WORKBASKET_ACCESS_ITEMS),
HttpMethod.GET,
restHelper.defaultRequest(),
WORKBASKET_ACCESS_ITEM_PAGE_MODEL_TYPE);
@ -63,7 +63,7 @@ class WorkbasketAccessItemControllerIntTest {
String parameters = "?sort-by=workbasket-key&order=asc&page-size=9&access-ids=user-1-1&page=1";
ResponseEntity<TaskanaPagedModel<WorkbasketAccessItemRepresentationModel>> response =
TEMPLATE.exchange(
restHelper.toUrl(Mapping.URL_WORKBASKET_ACCESS_ITEMS) + parameters,
restHelper.toUrl(RestEndpoints.URL_WORKBASKET_ACCESS_ITEMS) + parameters,
HttpMethod.GET,
restHelper.defaultRequest(),
WORKBASKET_ACCESS_ITEM_PAGE_MODEL_TYPE);
@ -83,7 +83,7 @@ class WorkbasketAccessItemControllerIntTest {
ThrowingCallable httpCall =
() ->
TEMPLATE.exchange(
restHelper.toUrl(Mapping.URL_WORKBASKET_ACCESS_ITEMS)
restHelper.toUrl(RestEndpoints.URL_WORKBASKET_ACCESS_ITEMS)
+ "?sort-by=workbasket-key&order=asc&page=1&page-size=9&invalid=user-1-1",
HttpMethod.GET,
restHelper.defaultRequest(),
@ -100,7 +100,7 @@ class WorkbasketAccessItemControllerIntTest {
String parameters = "?sort-by=workbasket-key&order=asc&page=2&page-size=9&access-ids=user-1-1";
ResponseEntity<TaskanaPagedModel<WorkbasketAccessItemRepresentationModel>> response =
TEMPLATE.exchange(
restHelper.toUrl(Mapping.URL_WORKBASKET_ACCESS_ITEMS) + parameters,
restHelper.toUrl(RestEndpoints.URL_WORKBASKET_ACCESS_ITEMS) + parameters,
HttpMethod.GET,
restHelper.defaultRequest(),
WORKBASKET_ACCESS_ITEM_PAGE_MODEL_TYPE);
@ -130,7 +130,7 @@ class WorkbasketAccessItemControllerIntTest {
String parameters = "?access-id=teamlead-2";
ResponseEntity<Void> response =
TEMPLATE.exchange(
restHelper.toUrl(Mapping.URL_WORKBASKET_ACCESS_ITEMS) + parameters,
restHelper.toUrl(RestEndpoints.URL_WORKBASKET_ACCESS_ITEMS) + parameters,
HttpMethod.DELETE,
restHelper.defaultRequest(),
ParameterizedTypeReference.forType(Void.class));
@ -152,7 +152,7 @@ class WorkbasketAccessItemControllerIntTest {
ThrowingCallable httpCall =
() ->
TEMPLATE.exchange(
restHelper.toUrl(Mapping.URL_WORKBASKET_ACCESS_ITEMS) + parameters,
restHelper.toUrl(RestEndpoints.URL_WORKBASKET_ACCESS_ITEMS) + parameters,
HttpMethod.DELETE,
restHelper.defaultRequest(),
ParameterizedTypeReference.forType(Void.class));

View File

@ -19,7 +19,7 @@ import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.client.HttpClientErrorException;
import pro.taskana.common.rest.Mapping;
import pro.taskana.common.rest.RestEndpoints;
import pro.taskana.common.rest.models.TaskanaPagedModel;
import pro.taskana.common.test.rest.RestHelper;
import pro.taskana.common.test.rest.TaskanaSpringBootTest;
@ -52,7 +52,8 @@ class WorkbasketControllerIntTest {
@Test
void testGetWorkbasket() {
final String url =
restHelper.toUrl(Mapping.URL_WORKBASKET_ID, "WBI:100000000000000000000000000000000006");
restHelper.toUrl(
RestEndpoints.URL_WORKBASKET_ID, "WBI:100000000000000000000000000000000006");
ResponseEntity<WorkbasketRepresentationModel> response =
TEMPLATE.exchange(
url,
@ -70,7 +71,7 @@ class WorkbasketControllerIntTest {
void testGetAllWorkbaskets() {
ResponseEntity<TaskanaPagedModel<WorkbasketSummaryRepresentationModel>> response =
TEMPLATE.exchange(
restHelper.toUrl(Mapping.URL_WORKBASKET),
restHelper.toUrl(RestEndpoints.URL_WORKBASKET),
HttpMethod.GET,
restHelper.defaultRequest(),
WORKBASKET_SUMMARY_PAGE_MODEL_TYPE);
@ -82,7 +83,7 @@ class WorkbasketControllerIntTest {
void testGetAllWorkbasketsBusinessAdminHasOpenPermission() {
ResponseEntity<TaskanaPagedModel<WorkbasketSummaryRepresentationModel>> response =
TEMPLATE.exchange(
restHelper.toUrl(Mapping.URL_WORKBASKET) + "?required-permission=OPEN",
restHelper.toUrl(RestEndpoints.URL_WORKBASKET) + "?required-permission=OPEN",
HttpMethod.GET,
restHelper.defaultRequest(),
WORKBASKET_SUMMARY_PAGE_MODEL_TYPE);
@ -96,7 +97,7 @@ class WorkbasketControllerIntTest {
String parameters = "?type=PERSONAL&sort-by=key&order=desc";
ResponseEntity<TaskanaPagedModel<WorkbasketSummaryRepresentationModel>> response =
TEMPLATE.exchange(
restHelper.toUrl(Mapping.URL_WORKBASKET) + parameters,
restHelper.toUrl(RestEndpoints.URL_WORKBASKET) + parameters,
HttpMethod.GET,
restHelper.defaultRequest(),
WORKBASKET_SUMMARY_PAGE_MODEL_TYPE);
@ -116,7 +117,7 @@ class WorkbasketControllerIntTest {
ThrowingCallable httpCall =
() ->
TEMPLATE.exchange(
restHelper.toUrl(Mapping.URL_WORKBASKET) + "?invalid=PERSONAL",
restHelper.toUrl(RestEndpoints.URL_WORKBASKET) + "?invalid=PERSONAL",
HttpMethod.GET,
restHelper.defaultRequest(),
WORKBASKET_SUMMARY_PAGE_MODEL_TYPE);
@ -134,7 +135,7 @@ class WorkbasketControllerIntTest {
ResponseEntity<WorkbasketRepresentationModel> initialWorkbasketResourceRequestResponse =
TEMPLATE.exchange(
restHelper.toUrl(Mapping.URL_WORKBASKET_ID, workbasketId),
restHelper.toUrl(RestEndpoints.URL_WORKBASKET_ID, workbasketId),
HttpMethod.GET,
new HttpEntity<String>(restHelper.getHeadersTeamlead_1()),
ParameterizedTypeReference.forType(WorkbasketRepresentationModel.class));
@ -153,7 +154,7 @@ class WorkbasketControllerIntTest {
ThrowingCallable httpCall =
() -> {
TEMPLATE.exchange(
restHelper.toUrl(Mapping.URL_WORKBASKET_ID, workbasketId),
restHelper.toUrl(RestEndpoints.URL_WORKBASKET_ID, workbasketId),
HttpMethod.PUT,
new HttpEntity<>(workbasketRepresentationModel, restHelper.getHeadersTeamlead_1()),
ParameterizedTypeReference.forType(WorkbasketRepresentationModel.class));
@ -171,7 +172,7 @@ class WorkbasketControllerIntTest {
ThrowingCallable httpCall =
() -> {
TEMPLATE.exchange(
restHelper.toUrl(Mapping.URL_WORKBASKET_ID, workbasketId),
restHelper.toUrl(RestEndpoints.URL_WORKBASKET_ID, workbasketId),
HttpMethod.GET,
new HttpEntity<String>(restHelper.getHeadersBusinessAdmin()),
ParameterizedTypeReference.forType(WorkbasketRepresentationModel.class));
@ -188,7 +189,7 @@ class WorkbasketControllerIntTest {
String parameters = "?sort-by=key&order=desc&page-size=5&page=2";
ResponseEntity<TaskanaPagedModel<WorkbasketSummaryRepresentationModel>> response =
TEMPLATE.exchange(
restHelper.toUrl(Mapping.URL_WORKBASKET) + parameters,
restHelper.toUrl(RestEndpoints.URL_WORKBASKET) + parameters,
HttpMethod.GET,
restHelper.defaultRequest(),
WORKBASKET_SUMMARY_PAGE_MODEL_TYPE);
@ -216,7 +217,7 @@ class WorkbasketControllerIntTest {
ResponseEntity<?> response =
TEMPLATE.exchange(
restHelper.toUrl(Mapping.URL_WORKBASKET_ID, workbasketID),
restHelper.toUrl(RestEndpoints.URL_WORKBASKET_ID, workbasketID),
HttpMethod.DELETE,
new HttpEntity<>(restHelper.getHeadersBusinessAdmin()),
Void.class);
@ -230,7 +231,7 @@ class WorkbasketControllerIntTest {
ThrowingCallable call =
() ->
TEMPLATE.exchange(
restHelper.toUrl(Mapping.URL_WORKBASKET_ID, workbasketWithNonCompletedTasks),
restHelper.toUrl(RestEndpoints.URL_WORKBASKET_ID, workbasketWithNonCompletedTasks),
HttpMethod.DELETE,
new HttpEntity<>(restHelper.getHeadersBusinessAdmin()),
Void.class);
@ -245,7 +246,8 @@ class WorkbasketControllerIntTest {
ResponseEntity<?> response =
TEMPLATE.exchange(
restHelper.toUrl(
Mapping.URL_WORKBASKET_ID_DISTRIBUTION, "WBI:100000000000000000000000000000000007"),
RestEndpoints.URL_WORKBASKET_ID_DISTRIBUTION,
"WBI:100000000000000000000000000000000007"),
HttpMethod.DELETE,
restHelper.defaultRequest(),
Void.class);
@ -254,7 +256,8 @@ class WorkbasketControllerIntTest {
ResponseEntity<TaskanaPagedModel<WorkbasketSummaryRepresentationModel>> response2 =
TEMPLATE.exchange(
restHelper.toUrl(
Mapping.URL_WORKBASKET_ID_DISTRIBUTION, "WBI:100000000000000000000000000000000002"),
RestEndpoints.URL_WORKBASKET_ID_DISTRIBUTION,
"WBI:100000000000000000000000000000000002"),
HttpMethod.GET,
restHelper.defaultRequest(),
WORKBASKET_SUMMARY_PAGE_MODEL_TYPE);
@ -270,7 +273,8 @@ class WorkbasketControllerIntTest {
ResponseEntity<TaskanaPagedModel<WorkbasketAccessItemRepresentationModel>> response =
TEMPLATE.exchange(
restHelper.toUrl(
Mapping.URL_WORKBASKET_ID_ACCESSITEMS, "WBI:100000000000000000000000000000000005"),
RestEndpoints.URL_WORKBASKET_ID_ACCESS_ITEMS,
"WBI:100000000000000000000000000000000005"),
HttpMethod.GET,
restHelper.defaultRequest(),
WORKBASKET_ACCESS_ITEM_PAGE_MODEL_TYPE);
@ -285,7 +289,8 @@ class WorkbasketControllerIntTest {
ResponseEntity<TaskanaPagedModel<WorkbasketSummaryRepresentationModel>> response =
TEMPLATE.exchange(
restHelper.toUrl(
Mapping.URL_WORKBASKET_ID_DISTRIBUTION, "WBI:100000000000000000000000000000000001"),
RestEndpoints.URL_WORKBASKET_ID_DISTRIBUTION,
"WBI:100000000000000000000000000000000001"),
HttpMethod.GET,
restHelper.defaultRequest(),
WORKBASKET_SUMMARY_PAGE_MODEL_TYPE);

View File

@ -34,7 +34,7 @@ import org.springframework.util.MultiValueMap;
import org.springframework.web.client.HttpClientErrorException;
import org.springframework.web.client.HttpStatusCodeException;
import pro.taskana.common.rest.Mapping;
import pro.taskana.common.rest.RestEndpoints;
import pro.taskana.common.rest.models.TaskanaPagedModel;
import pro.taskana.common.rest.models.TaskanaPagedModelKeys;
import pro.taskana.common.test.rest.RestHelper;
@ -260,7 +260,7 @@ class WorkbasketDefinitionControllerIntTest {
private ResponseEntity<TaskanaPagedModel<WorkbasketDefinitionRepresentationModel>>
executeExportRequestForDomain(String domain) {
return TEMPLATE.exchange(
restHelper.toUrl(Mapping.URL_WORKBASKET_DEFINITIONS) + "?domain=" + domain,
restHelper.toUrl(RestEndpoints.URL_WORKBASKET_DEFINITIONS) + "?domain=" + domain,
HttpMethod.GET,
restHelper.defaultRequest(),
new ParameterizedTypeReference<
@ -290,7 +290,7 @@ class WorkbasketDefinitionControllerIntTest {
body.add("file", new FileSystemResource(tmpFile));
HttpEntity<MultiValueMap<String, Object>> requestEntity = new HttpEntity<>(body, headers);
String serverUrl = restHelper.toUrl(Mapping.URL_WORKBASKET_DEFINITIONS);
String serverUrl = restHelper.toUrl(RestEndpoints.URL_WORKBASKET_DEFINITIONS);
ResponseEntity<Void> responseImport =
TEMPLATE.postForEntity(serverUrl, requestEntity, Void.class);

View File

@ -6,7 +6,7 @@ import java.time.Instant;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import pro.taskana.common.rest.Mapping;
import pro.taskana.common.rest.RestEndpoints;
import pro.taskana.common.test.rest.TaskanaSpringBootTest;
import pro.taskana.workbasket.api.WorkbasketCustomField;
import pro.taskana.workbasket.api.WorkbasketService;
@ -118,16 +118,17 @@ class WorkbasketRepresentationModelAssemblerTest {
private void testLinks(WorkbasketRepresentationModel workbasket) {
assertThat(workbasket.getLinks()).hasSize(5);
assertThat(workbasket.getRequiredLink("self").getHref())
.isEqualTo(Mapping.URL_WORKBASKET_ID.replaceAll("\\{.*}", workbasket.getWorkbasketId()));
.isEqualTo(
RestEndpoints.URL_WORKBASKET_ID.replaceAll("\\{.*}", workbasket.getWorkbasketId()));
assertThat(workbasket.getRequiredLink("distributionTargets").getHref())
.isEqualTo(
Mapping.URL_WORKBASKET_ID_DISTRIBUTION.replaceAll(
RestEndpoints.URL_WORKBASKET_ID_DISTRIBUTION.replaceAll(
"\\{.*}", workbasket.getWorkbasketId()));
assertThat(workbasket.getRequiredLink("allWorkbaskets").getHref())
.isEqualTo(Mapping.URL_WORKBASKET);
.isEqualTo(RestEndpoints.URL_WORKBASKET);
assertThat(workbasket.getRequiredLink("removeDistributionTargets").getHref())
.isEqualTo(
Mapping.URL_WORKBASKET_ID_DISTRIBUTION.replaceAll(
RestEndpoints.URL_WORKBASKET_ID_DISTRIBUTION.replaceAll(
"\\{.*}", workbasket.getWorkbasketId()));
}