TSK-1803: add manual priority to task in REST

This commit is contained in:
ryzheboka 2022-02-08 16:20:18 +01:00 committed by Mustapha Zorgati
parent a0fe4ea468
commit bc86006877
13 changed files with 115 additions and 46 deletions

View File

@ -94,3 +94,5 @@ INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000077', 'ETI:0000000
INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000078', 'ETI:000000000000000000000000000000000078', RELATIVE_DATE(-2) , RELATIVE_DATE(-1) , null , RELATIVE_DATE(-1) , null , RELATIVE_DATE(0) , RELATIVE_DATE(1) , 'TaskXY' , 'creator_user_id' , 'TaskXY' , null , 2 , -1 , 'CLAIMED' , 'EXTERN' , 'T6310' , 'CLI:000000000000000000000000000000000011', 'WBI:100000000000000000000000000000000016' , 'TPK_VIP_2' , 'DOMAIN_A', 'PI_0000000000078' , 'DOC_0000000000000000078' , null , '00' , 'PASystem' , '00' , 'SDNR' , '98769432' , true , false , null , 'NONE' , null , null , null , null , null , null , null , null , null ,null , null , null , null , null , 'abc' , null , null , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 );
INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000079', 'ETI:000000000000000000000000000000000079', RELATIVE_DATE(-1) , null , null , RELATIVE_DATE(-1) , null , RELATIVE_DATE(0) , RELATIVE_DATE(1) , 'Schadenfall' , 'creator_user_id' , 'Schadenfall' , null , 3 , -1 , 'READY' , 'EXTERN' , 'L1050' , 'CLI:100000000000000000000000000000000003', 'WBI:100000000000000000000000000000000010' , 'TPK_VIP' , 'DOMAIN_A', 'PI_0000000000079' , 'DOC_0000000000000000079' , null , '00' , 'PASystem' , '00' , 'SDNR' , '98769432' , true , false , null , 'NONE' , null , null , null , null , null , null , null , null , null ,null , null , null , null , null , 'abc' , null , null , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 );
INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000080', 'ETI:000000000000000000000000000000000080', RELATIVE_DATE(-4) , RELATIVE_DATE(-2) , RELATIVE_DATE(0) , RELATIVE_DATE(0) , null , RELATIVE_DATE(0) , RELATIVE_DATE(1) , 'TaskXY' , 'creator_user_id' , 'TaskXY' , null , 260 , -1 , 'COMPLETED' , 'EXTERN' , 'L1050' , 'CLI:100000000000000000000000000000000003', 'WBI:100000000000000000000000000000000010' , 'TPK_VIP' , 'DOMAIN_A', 'PI_0000000000080' , 'DOC_0000000000000000080' , null , '00' , 'PASystem' , '00' , 'SDNR' , '98769432' , true , false , null , 'NONE' , null , null , null , null , null , null , null , null , null ,null , null , null , null , null , 'abc' , null , null , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 );
INSERT INTO TASK VALUES('TKI:000000000000000000070000000000000079', 'ETI:000000000000000000070000000000000079', RELATIVE_DATE(-1) , null , null , RELATIVE_DATE(-1) , null , RELATIVE_DATE(0) , RELATIVE_DATE(1) , 'Schadenfall' , 'creator_user_id' , 'Schadenfall' , null , 56 , 56 , 'READY' , 'EXTERN' , 'L1050' , 'CLI:100000000000000000000000000000000011', 'WBI:100000000000000000000000000000000010' , 'TPK_VIP' , 'DOMAIN_A', 'PI_0000000000079' , 'DOC_0000000000000000079' , null , '00' , 'PASystem' , '00' , 'SDNR' , '08769431' , true , false , null , 'NONE' , null , null , null , null , null , null , null , null , null ,null , null , null , null , null , 'abc' , null , null , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 );
INSERT INTO TASK VALUES('TKI:000000000000000000080000000000000079', 'ETI:000000000000000000080000000000000079', RELATIVE_DATE(-1) , null , null , RELATIVE_DATE(-1) , null , RELATIVE_DATE(0) , RELATIVE_DATE(1) , 'Schadenfall' , 'creator_user_id' , 'Schadenfall' , null , 72 , 72 , 'READY' , 'EXTERN' , 'L1050' , 'CLI:100000000000000000000000000000000011', 'WBI:100000000000000000000000000000000010' , 'TPK_VIP' , 'DOMAIN_A', 'PI_0000000000079' , 'DOC_0000000000000000079' , null , '00' , 'PASystem' , '00' , 'SDNR' , '08769431' , true , false , null , 'NONE' , null , null , null , null , null , null , null , null , null ,null , null , null , null , null , 'abc' , null , null , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 );

View File

@ -26,7 +26,7 @@ class WorkingTimeCalculatorTest {
}
@Test
void should_throwInvalidArgumentException_WhenFromTimeIsAfterUntilTime() {
void should_throwInvalidArgumentException_When_FromTimeIsAfterUntilTime() {
Instant from = Instant.parse("2021-09-30T12:00:00.000Z");
Instant to = Instant.parse("2021-09-30T09:00:00.000Z");
@ -36,7 +36,7 @@ class WorkingTimeCalculatorTest {
}
@Test
void should_throwInvalidArgumentException_WhenFromIsNull() {
void should_throwInvalidArgumentException_When_FromIsNull() {
Instant to = Instant.parse("2021-09-30T09:00:00.000Z");
assertThatThrownBy(() -> calculator.workingTimeBetweenTwoTimestamps(null, to))

View File

@ -40,7 +40,7 @@ class CreateClassificationAccTest {
@WithAccessId(user = "businessadmin")
@Test
void should_OnlyCreateOneClassification_WhenCreatingMasterClassification() throws Exception {
void should_OnlyCreateOneClassification_When_CreatingMasterClassification() throws Exception {
Classification classification = classificationService.newClassification("Key0", "", "TASK");
classification = classificationService.createClassification(classification);
@ -52,7 +52,7 @@ class CreateClassificationAccTest {
@WithAccessId(user = "businessadmin")
@Test
void should_CreateMasterClassification_WhenCreatingClassificationWithDomain() throws Exception {
void should_CreateMasterClassification_When_CreatingClassificationWithDomain() throws Exception {
Classification classification =
classificationService.newClassification("Key1", "DOMAIN_A", "TASK");
@ -268,7 +268,7 @@ class CreateClassificationAccTest {
@WithAccessId(user = "businessadmin")
@Test
void should_ThrowException_WhenClassificationWithKeyAlreadyExisting() throws Exception {
void should_ThrowException_When_ClassificationWithKeyAlreadyExisting() throws Exception {
String existingKey = "Key4";
DefaultTestEntities.defaultTestClassification()
.key(existingKey)

View File

@ -79,7 +79,7 @@ class DeleteWorkbasketAccTest extends AbstractAccTest {
@WithAccessId(user = "businessadmin")
@Test
void should_RemoveWorkbasketsFromDistributionTargets_WhenWorkbasketIsDeleted() throws Exception {
void should_RemoveWorkbasketsFromDistributionTargets_When_WorkbasketIsDeleted() throws Exception {
Workbasket wb = workbasketService.getWorkbasket("GPK_KSC_1", "DOMAIN_A");
int distTargets =
workbasketService

View File

@ -85,7 +85,7 @@ public class TaskanaWildflyTest extends AbstractAccTest {
@Test
@RunAsClient
public void should_ReturnUserFromLdap_WhenWildcardSearchIsConducted() {
public void should_ReturnUserFromLdap_When_WildcardSearchIsConducted() {
ResponseEntity<List<AccessIdRepresentationModel>> response =
TEMPLATE.exchange(
restHelper.toUrl("/taskana" + RestEndpoints.URL_ACCESS_ID + "?search-for=rig"),
@ -98,7 +98,7 @@ public class TaskanaWildflyTest extends AbstractAccTest {
@Test
@RunAsClient
public void should_ReturnTask_WhenRequested() {
public void should_ReturnTask_When_Requested() {
ResponseEntity<TaskRepresentationModel> response =
TEMPLATE.exchange(
restHelper.toUrl(

View File

@ -65,6 +65,7 @@ public class TaskRepresentationModelAssembler
repModel.setNote(task.getNote());
repModel.setDescription(task.getDescription());
repModel.setPriority(task.getPriority());
repModel.setManualPriority(task.getManualPriority());
repModel.setState(task.getState());
repModel.setClassificationSummary(
classificationAssembler.toModel(task.getClassificationSummary()));
@ -133,6 +134,7 @@ public class TaskRepresentationModelAssembler
task.setNote(repModel.getNote());
task.setDescription(repModel.getDescription());
task.setPriority(repModel.getPriority());
task.setManualPriority(repModel.getManualPriority());
task.setState(repModel.getState());
if (repModel.getClassificationSummary() != null) {
task.setClassificationSummary(

View File

@ -66,6 +66,7 @@ public class TaskSummaryRepresentationModelAssembler
repModel.setNote(taskSummary.getNote());
repModel.setDescription(taskSummary.getDescription());
repModel.setPriority(taskSummary.getPriority());
repModel.setManualPriority(taskSummary.getManualPriority());
repModel.setState(taskSummary.getState());
repModel.setClassificationSummary(
classificationAssembler.toModel(taskSummary.getClassificationSummary()));
@ -120,6 +121,7 @@ public class TaskSummaryRepresentationModelAssembler
taskSummary.setNote(repModel.getNote());
taskSummary.setDescription(repModel.getDescription());
taskSummary.setPriority(repModel.getPriority());
taskSummary.setManualPriority(repModel.getManualPriority());
taskSummary.setState(repModel.getState());
taskSummary.setClassificationSummary(
classificationAssembler.toEntityModel(repModel.getClassificationSummary()));

View File

@ -54,6 +54,12 @@ public class TaskSummaryRepresentationModel
protected String description;
/** The priority of the task. */
protected int priority;
/**
* The manual priority of the task. If the value of manualPriority is zero or greater, the
* 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.
*/
protected int manualPriority;
/** The current task state. */
protected TaskState state;
/** The classification of this task. */
@ -223,6 +229,14 @@ public class TaskSummaryRepresentationModel
this.priority = priority;
}
public int getManualPriority() {
return manualPriority;
}
public void setManualPriority(int manualPriority) {
this.manualPriority = manualPriority;
}
public TaskState getState() {
return state;
}

View File

@ -199,7 +199,7 @@ class ClassificationControllerIntTest {
@Test
@DirtiesContext
void should_ThrowNotAuthorized_WhenUserIsNotInRoleAdminOrBusinessAdmin_whileCreating() {
void should_ThrowNotAuthorized_When_UserIsNotInRoleAdminOrBusinessAdmin_whileCreating() {
ClassificationRepresentationModel newClassification = new ClassificationRepresentationModel();
newClassification.setType("TASK");
newClassification.setCategory("MANUAL");

View File

@ -153,7 +153,7 @@ class MonitorControllerIntTest {
assertThat(report).isNotNull();
assertThat(report.getSumRow()).extracting(RowRepresentationModel::getTotal).containsExactly(26);
assertThat(report.getSumRow()).extracting(RowRepresentationModel::getTotal).containsExactly(28);
}
@Test

View File

@ -83,7 +83,7 @@ class TaskControllerIntTest {
}
@Test
void testGetAllTasks() {
void should_GetAllTasks() {
String url = restHelper.toUrl(RestEndpoints.URL_TASKS);
HttpEntity<Object> auth = new HttpEntity<>(RestHelper.generateHeadersForUser("teamlead-1"));
@ -92,11 +92,11 @@ class TaskControllerIntTest {
assertThat(response.getBody()).isNotNull();
assertThat((response.getBody()).getLink(IanaLinkRelations.SELF)).isNotNull();
assertThat(response.getBody().getContent()).hasSize(57);
assertThat(response.getBody().getContent()).hasSize(59);
}
@Test
void testGetAllTasksByWorkbasketId() {
void should_GetAllTasks_For_SpecifiedWorkbasketId() {
String url =
restHelper.toUrl(RestEndpoints.URL_TASKS)
+ "?workbasket-id=WBI:100000000000000000000000000000000001";
@ -111,7 +111,7 @@ class TaskControllerIntTest {
}
@Test
void testGetAllTasksByWorkbasketIdWithinMultiplePlannedTimeIntervals() {
void should_GetAllTasks_For_SpecifiedWorkbasketIdWithinMultiplePlannedTimeIntervals() {
Instant firstInstant = Instant.now().minus(7, ChronoUnit.DAYS);
Instant secondInstant = Instant.now().minus(10, ChronoUnit.DAYS);
Instant thirdInstant = Instant.now().minus(10, ChronoUnit.DAYS);
@ -136,7 +136,7 @@ class TaskControllerIntTest {
}
@Test
void testGetAllTasksByWorkbasketIdWithinSinglePlannedTimeInterval() {
void should_GetAllTasks_For_SpecifiesWorkbasketIdWithinSinglePlannedTimeInterval() {
Instant plannedFromInstant = Instant.now().minus(6, ChronoUnit.DAYS);
Instant plannedToInstant = Instant.now().minus(3, ChronoUnit.DAYS);
String url =
@ -158,7 +158,7 @@ class TaskControllerIntTest {
}
@Test
void testGetAllTasksByWorkbasketIdWithinSingleIndefinitePlannedTimeInterval() {
void should_GetAllTasks_For_SpecifiedWorkbasketIdWithinSingleIndefinitePlannedTimeInterval() {
Instant plannedFromInstant = Instant.now().minus(6, ChronoUnit.DAYS);
String url =
restHelper.toUrl(RestEndpoints.URL_TASKS)
@ -177,7 +177,7 @@ class TaskControllerIntTest {
}
@Test
void testGetAllTasksByWorkbasketIdWithInvalidPlannedParamsCombination() {
void should_ThrowException_When_GettingTasksByWorkbasketIdWithInvalidPlannedParamsCombination() {
String url =
restHelper.toUrl(RestEndpoints.URL_TASKS)
+ "?workbasket-id=WBI:100000000000000000000000000000000001"
@ -199,7 +199,7 @@ class TaskControllerIntTest {
}
@Test
void testGetAllTasksByWorkbasketIdWithinMultipleDueTimeIntervals() {
void should_GetAllTasks_For_SpecifiedWorkbasketIdWithinMultipleDueTimeIntervals() {
Instant firstInstant = Instant.now().minus(7, ChronoUnit.DAYS);
Instant secondInstant = Instant.now().minus(10, ChronoUnit.DAYS);
Instant thirdInstant = Instant.now().minus(10, ChronoUnit.DAYS);
@ -379,7 +379,7 @@ class TaskControllerIntTest {
}
@Test
void testGetAllTasksByWorkbasketIdWithinSingleDueTimeInterval() {
void should_GetAllTasks_For_SpecifiedWorkbasketIdWithinSingleDueTimeInterval() {
Instant dueFromInstant = Instant.now().minus(8, ChronoUnit.DAYS);
Instant dueToInstant = Instant.now().minus(3, ChronoUnit.DAYS);
String url =
@ -401,7 +401,7 @@ class TaskControllerIntTest {
}
@Test
void testGetAllTasksByWorkbasketIdWithinSingleIndefiniteDueTimeInterval() {
void should_GetAllTasks_For_SpecifiedWorkbasketIdWithinSingleIndefiniteDueTimeInterval() {
Instant dueToInstant = Instant.now().minus(1, ChronoUnit.DAYS);
String url =
restHelper.toUrl(RestEndpoints.URL_TASKS)
@ -420,7 +420,7 @@ class TaskControllerIntTest {
}
@Test
void testGetAllTasksByWorkbasketIdWithInvalidDueParamsCombination() {
void should_GetAllTasks_For_WorkbasketIdWithInvalidDueParamsCombination() {
String url =
restHelper.toUrl(RestEndpoints.URL_TASKS)
+ "?workbasket-id=WBI:100000000000000000000000000000000001"
@ -444,7 +444,7 @@ class TaskControllerIntTest {
}
@Test
void testGetAllTasksByWorkbasketKeyAndDomain() {
void should_GetAllTasks_For_SpecifiedWorkbasketKeyAndDomain() {
String url =
restHelper.toUrl(RestEndpoints.URL_TASKS) + "?workbasket-key=USER-1-2&domain=DOMAIN_A";
HttpEntity<String> auth = new HttpEntity<>(RestHelper.generateHeadersForUser("user-1-2"));
@ -458,7 +458,7 @@ class TaskControllerIntTest {
}
@Test
void testGetAllTasksByExternalId() {
void should_GetAllTasks_For_SpecifiedExternalId() {
String url =
restHelper.toUrl(RestEndpoints.URL_TASKS)
+ "?external-id=ETI:000000000000000000000000000000000003"
@ -474,7 +474,7 @@ class TaskControllerIntTest {
}
@Test
void testExceptionIfKeyIsSetButDomainIsMissing() {
void should_ThrowException_When_KeyIsSetButDomainIsMissing() {
String url = restHelper.toUrl(RestEndpoints.URL_TASKS) + "?workbasket-key=USER-1-2";
HttpEntity<String> auth = new HttpEntity<>(RestHelper.generateHeadersForUser("user-1-2"));
@ -489,7 +489,7 @@ class TaskControllerIntTest {
}
@Test
void testGetAllTasksWithAdminRole() {
void should_GetAllTasksWithAdminRole() {
String url = restHelper.toUrl(RestEndpoints.URL_TASKS);
HttpEntity<Object> auth = new HttpEntity<>(RestHelper.generateHeadersForUser("admin"));
@ -498,11 +498,11 @@ class TaskControllerIntTest {
assertThat(response.getBody()).isNotNull();
assertThat((response.getBody()).getLink(IanaLinkRelations.SELF)).isNotNull();
assertThat(response.getBody().getContent()).hasSize(88);
assertThat(response.getBody().getContent()).hasSize(90);
}
@Test
void testGetAllTasksKeepingFilters() {
void should_KeepFiltersInTheLinkOfTheResponse_When_GettingTasks() {
String url =
restHelper.toUrl(RestEndpoints.URL_TASKS)
+ "?por-type=VNR&por-value=22334455&sort-by=POR_VALUE&order=DESCENDING";
@ -520,7 +520,7 @@ class TaskControllerIntTest {
}
@Test
void testGetLastPageSortedByPorValue() {
void should_GetAllTasks_For_GettingLastTaskSummaryPageSortedByPorValue() {
String url =
restHelper.toUrl(RestEndpoints.URL_TASKS)
+ "?state=READY&state=CLAIMED&sort-by=POR_VALUE"
@ -531,7 +531,7 @@ class TaskControllerIntTest {
TEMPLATE.exchange(url, HttpMethod.GET, auth, TASK_SUMMARY_PAGE_MODEL_TYPE);
assertThat(response.getBody()).isNotNull();
assertThat((response.getBody()).getContent()).hasSize(3);
assertThat((response.getBody()).getContent()).hasSize(5);
assertThat(response.getBody().getRequiredLink(IanaLinkRelations.LAST).getHref())
.contains("page=16");
assertThat(response.getBody().getContent().iterator().next().getTaskId())
@ -574,7 +574,7 @@ class TaskControllerIntTest {
TEMPLATE.exchange(url, HttpMethod.GET, auth, TASK_SUMMARY_PAGE_MODEL_TYPE);
assertThat(response.getBody()).isNotNull();
assertThat((response.getBody()).getContent()).hasSize(57);
assertThat((response.getBody()).getContent()).hasSize(59);
String url2 =
restHelper.toUrl(RestEndpoints.URL_TASKS)
@ -596,7 +596,7 @@ class TaskControllerIntTest {
}
@Test
void testGetQueryByPorSecondPageSortedByType() {
void should_GetAllTasks_For_GettingSecondPageFilteredByPorAttributesSortedByType() {
resetDb(); // required because
// ClassificationControllerIntTest.testGetQueryByPorSecondPageSortedByType changes
// tasks and this test depends on the tasks as they are in sampledata
@ -654,7 +654,7 @@ class TaskControllerIntTest {
}
@Test
void should_ReturnFilteredTasks_WhenGettingTasksBySecondaryObjectReferenceValue() {
void should_ReturnFilteredTasks_When_GettingTasksBySecondaryObjectReferenceValue() {
String url = restHelper.toUrl(RestEndpoints.URL_TASKS) + "?sor-value=Value2";
HttpEntity<Object> auth = new HttpEntity<>(RestHelper.generateHeadersForUser("teamlead-1"));
@ -667,7 +667,7 @@ class TaskControllerIntTest {
}
@Test
void should_ReturnFilteredTasks_WhenGettingTasksBySecondaryObjectReferenceTypeLike() {
void should_ReturnFilteredTasks_When_GettingTasksBySecondaryObjectReferenceTypeLike() {
String url = restHelper.toUrl(RestEndpoints.URL_TASKS) + "?sor-type-like=Type";
HttpEntity<Object> auth = new HttpEntity<>(RestHelper.generateHeadersForUser("teamlead-1"));
@ -680,7 +680,7 @@ class TaskControllerIntTest {
}
@Test
void should_ReturnFilteredTasks_WhenGettingTasksBySecondaryObjectReferenceValueAndCompany() {
void should_ReturnFilteredTasks_When_GettingTasksBySecondaryObjectReferenceValueAndCompany() {
String url =
restHelper.toUrl(RestEndpoints.URL_TASKS) + "?sor-value=Value2&&sor-company=Company1";
HttpEntity<Object> auth = new HttpEntity<>(RestHelper.generateHeadersForUser("teamlead-1"));
@ -694,7 +694,7 @@ class TaskControllerIntTest {
}
@Test
void should_CreateAndDeleteTaskWithObjectReferences_WhenSpecifyingObjectReferences() {
void should_CreateAndDeleteTaskWithSecondaryObjectReferences_When_SpecifyingObjectReferences() {
TaskRepresentationModel taskRepresentationModel = getTaskResourceSample();
ObjectReferenceRepresentationModel obj0 = getSampleSecondaryObjectReference("0");
obj0.setTaskId(taskRepresentationModel.getTaskId());
@ -722,6 +722,48 @@ class TaskControllerIntTest {
assertThat(responseDeleted.getStatusCode()).isEqualTo(HttpStatus.NO_CONTENT);
}
@Test
void should_CreateAndDeleteTaskWithManualPriority_When_SpecifyingManualPriority() {
TaskRepresentationModel taskRepresentationModel = getTaskResourceSample();
taskRepresentationModel.setManualPriority(7);
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();
assertThat(responseCreate.getBody().getPriority())
.isEqualTo((responseCreate.getBody().getManualPriority()))
.isEqualTo(7);
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
void should_GetPriorityCorrectly_When_GettingTaskWithManualPriority() {
String url =
restHelper.toUrl(RestEndpoints.URL_TASKS_ID, "TKI:000000000000000000070000000000000079");
HttpEntity<Object> auth = new HttpEntity<>(RestHelper.generateHeadersForUser("teamlead-1"));
ResponseEntity<TaskRepresentationModel> response =
TEMPLATE.exchange(url, HttpMethod.GET, auth, TASK_MODEL_TYPE);
assertThat(response.getBody()).isNotNull();
assertThat(response.getBody().getPriority())
.isEqualTo((response.getBody().getManualPriority()))
.isEqualTo(56);
}
@Test
void should_ReturnReceivedDate_When_GettingTask() {
String url =
@ -784,7 +826,7 @@ class TaskControllerIntTest {
}
@Test
void testCreateAndDeleteTask() {
void should_CreateAndDeleteTask() {
TaskRepresentationModel taskRepresentationModel = getTaskResourceSample();
String url = restHelper.toUrl(RestEndpoints.URL_TASKS);
HttpEntity<TaskRepresentationModel> auth =
@ -812,7 +854,7 @@ class TaskControllerIntTest {
* throw an exception One is calculated by other other date +- service level.
*/
@Test
void testCreateWithPlannedAndDueDate() {
void should_ThrowException_When_CreatingTaskWithPlannedAndDueDateNotMatchingServiceLevel() {
TaskRepresentationModel taskRepresentationModel = getTaskResourceSample();
Instant plannedTime = Instant.parse("2019-09-13T08:44:17.588Z");
taskRepresentationModel.setPlanned(plannedTime);
@ -854,7 +896,7 @@ class TaskControllerIntTest {
}
@Test
void testCreateTaskWithInvalidParameter() throws Exception {
void should_ThrowException_When_CreatingTaskWithInvalidParameter() throws Exception {
final String taskToCreateJson =
"{\"classificationKey\":\"L11010\","
+ "\"workbasketSummaryResource\":"
@ -900,7 +942,7 @@ class TaskControllerIntTest {
@Test
void should_CancelTask_when_CallingCancelEndpoint() {
String url =
restHelper.toUrl(RestEndpoints.URL_TASKS_ID, "TKI:000000000000000000000000000000000026");
restHelper.toUrl(RestEndpoints.URL_TASKS_ID, "TKI:000000000000000000000000000000000103");
HttpEntity<Object> auth = new HttpEntity<>(RestHelper.generateHeadersForUser("user-1-2"));
// retrieve task from Rest Api
@ -914,7 +956,7 @@ class TaskControllerIntTest {
// cancel the task
String url2 =
restHelper.toUrl(
RestEndpoints.URL_TASKS_ID_CANCEL, "TKI:000000000000000000000000000000000026");
RestEndpoints.URL_TASKS_ID_CANCEL, "TKI:000000000000000000000000000000000103");
responseGet = TEMPLATE.exchange(url2, HttpMethod.POST, auth, TASK_MODEL_TYPE);
assertThat(responseGet.getBody()).isNotNull();
@ -922,9 +964,9 @@ class TaskControllerIntTest {
}
@Test
void testCancelClaimTask() {
void should_CancelClaimTask() {
String url =
restHelper.toUrl(RestEndpoints.URL_TASKS_ID, "TKI:000000000000000000000000000000000027");
restHelper.toUrl(RestEndpoints.URL_TASKS_ID, "TKI:000000000000000000000000000000000032");
HttpEntity<Object> auth = new HttpEntity<>(RestHelper.generateHeadersForUser("user-1-2"));
// retrieve task from Rest Api
@ -938,7 +980,7 @@ class TaskControllerIntTest {
// cancel claim
String url2 =
restHelper.toUrl(
RestEndpoints.URL_TASKS_ID_CLAIM, "TKI:000000000000000000000000000000000027");
RestEndpoints.URL_TASKS_ID_CLAIM, "TKI:000000000000000000000000000000000032");
ResponseEntity<TaskRepresentationModel> cancelClaimResponse =
TEMPLATE.exchange(url2, HttpMethod.DELETE, auth, TASK_MODEL_TYPE);
@ -980,7 +1022,7 @@ class TaskControllerIntTest {
}
@Test
void testCancelClaimOfClaimedTaskByAnotherUserShouldThrowException() {
void should_ThrowException_When_CancelClaimingOfClaimedTaskByAnotherUser() {
String url =
restHelper.toUrl(RestEndpoints.URL_TASKS_ID, "TKI:000000000000000000000000000000000026");
HttpEntity<Object> auth = new HttpEntity<>(RestHelper.generateHeadersForUser("user-1-2"));
@ -1008,7 +1050,7 @@ class TaskControllerIntTest {
}
@Test
void testUpdateTaskOwnerOfReadyTaskSucceeds() {
void should_UpdateTaskOwnerOfReadyTask() {
final String url = restHelper.toUrl("/api/v1/tasks/TKI:000000000000000000000000000000000025");
HttpEntity<Object> auth = new HttpEntity<>(RestHelper.generateHeadersForUser("user-1-2"));
@ -1036,7 +1078,7 @@ class TaskControllerIntTest {
}
@Test
void testUpdateTaskOwnerOfClaimedTaskFails() {
void should_ThrowException_When_UpdatingTaskOwnerOfClaimedTask() {
final String url = restHelper.toUrl("/api/v1/tasks/TKI:000000000000000000000000000000000026");
HttpEntity<Object> auth = new HttpEntity<>(RestHelper.generateHeadersForUser("user-1-2"));

View File

@ -82,6 +82,7 @@ class TaskRepresentationModelAssemblerTest {
repModel.setCreator("creator");
repModel.setDescription("desc");
repModel.setNote("note");
repModel.setManualPriority(123);
repModel.setPriority(123);
repModel.setState(TaskState.READY);
repModel.setClassificationSummary(classificationSummary);
@ -176,6 +177,7 @@ class TaskRepresentationModelAssemblerTest {
task.setDescription("desc");
task.setNote("note");
task.setPriority(123);
task.setManualPriority(-5);
task.setState(TaskState.READY);
task.setClassificationSummary(classification);
task.setWorkbasketSummary(workbasket.asSummary());
@ -240,6 +242,7 @@ class TaskRepresentationModelAssemblerTest {
task.setDescription("desc");
task.setNote("note");
task.setPriority(123);
task.setManualPriority(123);
task.setState(TaskState.READY);
task.setClassificationSummary(classification);
task.setWorkbasketSummary(workbasket);

View File

@ -95,6 +95,7 @@ class TaskSummaryRepresentationModelAssemblerTest {
task.setDescription("desc");
task.setNote("note");
task.setPriority(123);
task.setManualPriority(-1);
task.setState(TaskState.READY);
task.setBusinessProcessId("businessProcessId");
task.setParentBusinessProcessId("parentBusinessProcessId");
@ -161,6 +162,7 @@ class TaskSummaryRepresentationModelAssemblerTest {
repModel.setDescription("desc");
repModel.setNote("note");
repModel.setPriority(123);
repModel.setManualPriority(123);
repModel.setState(TaskState.READY);
repModel.setBusinessProcessId("businessProcessId");
repModel.setParentBusinessProcessId("parentBusinessProcessId");
@ -247,6 +249,7 @@ class TaskSummaryRepresentationModelAssemblerTest {
task.setDescription("desc");
task.setNote("note");
task.setPriority(123);
task.setManualPriority(-5);
task.setState(TaskState.READY);
task.setClassificationSummary(classification);
task.setWorkbasketSummary(workbasket);
@ -298,6 +301,7 @@ class TaskSummaryRepresentationModelAssemblerTest {
assertThat(taskSummary.getNote()).isEqualTo(repModel.getNote());
assertThat(taskSummary.getDescription()).isEqualTo(repModel.getDescription());
assertThat(taskSummary.getPriority()).isEqualTo(repModel.getPriority());
assertThat(taskSummary.getManualPriority()).isEqualTo(repModel.getManualPriority());
assertThat(taskSummary.getState()).isEqualTo(repModel.getState());
assertThat(taskSummary.getClassificationSummary().getId())
.isEqualTo(repModel.getClassificationSummary().getClassificationId());