TSK-1894: set manual priority to default in rest
This commit is contained in:
parent
691370f096
commit
3bbd7446e2
|
|
@ -15,6 +15,8 @@ import pro.taskana.workbasket.api.models.WorkbasketSummary;
|
||||||
*/
|
*/
|
||||||
public interface TaskSummary {
|
public interface TaskSummary {
|
||||||
|
|
||||||
|
public static int DEFAULT_MANUAL_PRIORITY = -1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the id of the {@linkplain Task}.
|
* Returns the id of the {@linkplain Task}.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -21,8 +21,6 @@ import pro.taskana.workbasket.internal.models.WorkbasketSummaryImpl;
|
||||||
/** Entity which contains the most important information about a Task. */
|
/** Entity which contains the most important information about a Task. */
|
||||||
public class TaskSummaryImpl implements TaskSummary {
|
public class TaskSummaryImpl implements TaskSummary {
|
||||||
|
|
||||||
private static final int DEFAULT_MANUAL_PRIORITY = -1;
|
|
||||||
|
|
||||||
protected String id;
|
protected String id;
|
||||||
protected String externalId;
|
protected String externalId;
|
||||||
protected Instant received;
|
protected Instant received;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
package pro.taskana.task.rest.models;
|
package pro.taskana.task.rest.models;
|
||||||
|
|
||||||
|
import static pro.taskana.task.api.models.TaskSummary.DEFAULT_MANUAL_PRIORITY;
|
||||||
|
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -59,7 +61,7 @@ public class TaskSummaryRepresentationModel
|
||||||
* priority is automatically set to manualPriority. In this case, all computations of priority are
|
* priority is automatically set to manualPriority. In this case, all computations of priority are
|
||||||
* disabled. If the value of manualPriority is negative, Tasks are not prioritized manually.
|
* disabled. If the value of manualPriority is negative, Tasks are not prioritized manually.
|
||||||
*/
|
*/
|
||||||
protected int manualPriority;
|
protected int manualPriority = DEFAULT_MANUAL_PRIORITY;
|
||||||
/** The current task state. */
|
/** The current task state. */
|
||||||
protected TaskState state;
|
protected TaskState state;
|
||||||
/** The classification of this task. */
|
/** The classification of this task. */
|
||||||
|
|
|
||||||
|
|
@ -749,6 +749,32 @@ class TaskControllerIntTest {
|
||||||
assertThat(responseDeleted.getStatusCode()).isEqualTo(HttpStatus.NO_CONTENT);
|
assertThat(responseDeleted.getStatusCode()).isEqualTo(HttpStatus.NO_CONTENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void should_CreateTaskWithCorrectPriorityAndThenDeleteIt_When_NotSpecifyingManualPriority() {
|
||||||
|
TaskRepresentationModel taskRepresentationModel = getTaskResourceSample();
|
||||||
|
|
||||||
|
String url = restHelper.toUrl(RestEndpoints.URL_TASKS);
|
||||||
|
HttpEntity<TaskRepresentationModel> auth =
|
||||||
|
new HttpEntity<>(taskRepresentationModel, RestHelper.generateHeadersForUser("teamlead-1"));
|
||||||
|
|
||||||
|
ResponseEntity<TaskRepresentationModel> responseCreate =
|
||||||
|
TEMPLATE.exchange(url, HttpMethod.POST, auth, TASK_MODEL_TYPE);
|
||||||
|
assertThat(responseCreate.getStatusCode()).isEqualTo(HttpStatus.CREATED);
|
||||||
|
assertThat(responseCreate.getBody()).isNotNull();
|
||||||
|
// The classification of taskRepresentationModel with the key "L11010" has priority=1
|
||||||
|
assertThat(responseCreate.getBody().getPriority()).isEqualTo(1);
|
||||||
|
assertThat(responseCreate.getBody().getManualPriority()).isEqualTo(-1);
|
||||||
|
|
||||||
|
String taskIdOfCreatedTask = responseCreate.getBody().getTaskId();
|
||||||
|
String url2 = restHelper.toUrl(RestEndpoints.URL_TASKS_ID, taskIdOfCreatedTask);
|
||||||
|
HttpEntity<Object> auth2 = new HttpEntity<>(RestHelper.generateHeadersForUser("admin"));
|
||||||
|
|
||||||
|
ResponseEntity<TaskRepresentationModel> responseDeleted =
|
||||||
|
TEMPLATE.exchange(
|
||||||
|
url2, HttpMethod.DELETE, auth2, ParameterizedTypeReference.forType(Void.class));
|
||||||
|
assertThat(responseDeleted.getStatusCode()).isEqualTo(HttpStatus.NO_CONTENT);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void should_GetPriorityCorrectly_When_GettingTaskWithManualPriority() {
|
void should_GetPriorityCorrectly_When_GettingTaskWithManualPriority() {
|
||||||
String url =
|
String url =
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue