TSK-1665: object-reference can now be used as parameter to a task query. It is interpreted as json.
This commit is contained in:
parent
4133b83037
commit
ae5774b340
|
@ -7,6 +7,7 @@ import org.springframework.web.bind.annotation.ControllerAdvice;
|
|||
import org.springframework.web.bind.annotation.InitBinder;
|
||||
|
||||
import pro.taskana.monitor.rest.models.PriorityColumnHeaderRepresentationModel;
|
||||
import pro.taskana.task.api.models.ObjectReference;
|
||||
|
||||
@ControllerAdvice
|
||||
public class JsonPropertyEditorRegistrator {
|
||||
|
@ -23,5 +24,7 @@ public class JsonPropertyEditorRegistrator {
|
|||
binder.registerCustomEditor(
|
||||
PriorityColumnHeaderRepresentationModel.class,
|
||||
new JsonPropertyEditor(objectMapper, PriorityColumnHeaderRepresentationModel.class));
|
||||
binder.registerCustomEditor(
|
||||
ObjectReference.class, new JsonPropertyEditor(objectMapper, ObjectReference.class));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ import java.io.BufferedWriter;
|
|||
import java.io.OutputStreamWriter;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.net.URLEncoder;
|
||||
import java.time.Instant;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.Arrays;
|
||||
|
@ -222,6 +223,22 @@ class TaskControllerIntTest {
|
|||
assertThat(response.getBody().getContent()).hasSize(22);
|
||||
}
|
||||
|
||||
@Test
|
||||
void should_ReturnAllTasks_For_ProvidedPrimaryObjectReference() throws Exception {
|
||||
String url =
|
||||
restHelper.toUrl(RestEndpoints.URL_TASKS)
|
||||
+ "?por="
|
||||
+ URLEncoder.encode(
|
||||
"{\"systemInstance\":\"MyInstance1\",\"type\":\"MyType1\"}", "UTF-8");
|
||||
HttpEntity<Object> auth = new HttpEntity<>(RestHelper.generateHeadersForUser("teamlead-1"));
|
||||
ResponseEntity<TaskSummaryPagedRepresentationModel> response =
|
||||
TEMPLATE.exchange(url, HttpMethod.GET, auth, TASK_SUMMARY_PAGE_MODEL_TYPE);
|
||||
assertThat(response.getBody()).isNotNull();
|
||||
assertThat(response.getStatusCode()).isEqualTo(HttpStatus.OK);
|
||||
assertThat((response.getBody()).getLink(IanaLinkRelations.SELF)).isNotNull();
|
||||
assertThat(response.getBody().getContent()).hasSize(4);
|
||||
}
|
||||
|
||||
@Test
|
||||
void should_ReturnAllTasksByWildcardSearch_For_ProvidedSearchValue() {
|
||||
String url =
|
||||
|
|
Loading…
Reference in New Issue