From 00bd993eac73705da6e8e2bc2f55197b20ef18db Mon Sep 17 00:00:00 2001 From: Miklas Boskamp Date: Wed, 11 Sep 2019 08:15:21 +0200 Subject: [PATCH] chore(engine-rest): expose version tag to fetched external tasks related to CAM-10693 --- .../rest/helper/MockExternalTaskBuilder.java | 8 +++++ .../bpm/engine/rest/helper/MockProvider.java | 2 ++ .../externaltask/LockedExternalTaskDto.java | 30 +++++++++++++++---- .../ExternalTaskRestServiceQueryTest.java | 4 +++ .../rest/helper/MockExternalTaskBuilder.java | 8 +++++ .../bpm/engine/rest/helper/MockProvider.java | 2 ++ 6 files changed, 49 insertions(+), 5 deletions(-) diff --git a/engine-rest/engine-rest-jaxrs2/src/test/java/org/camunda/bpm/engine/rest/helper/MockExternalTaskBuilder.java b/engine-rest/engine-rest-jaxrs2/src/test/java/org/camunda/bpm/engine/rest/helper/MockExternalTaskBuilder.java index 1e715d96182..fa94f8219c2 100644 --- a/engine-rest/engine-rest-jaxrs2/src/test/java/org/camunda/bpm/engine/rest/helper/MockExternalTaskBuilder.java +++ b/engine-rest/engine-rest-jaxrs2/src/test/java/org/camunda/bpm/engine/rest/helper/MockExternalTaskBuilder.java @@ -37,6 +37,7 @@ public class MockExternalTaskBuilder { protected Date lockExpirationTime; protected String processDefinitionId; protected String processDefinitionKey; + protected String processDefinitionVersionTag; protected String processInstanceId; protected Integer retries; protected boolean suspended; @@ -86,6 +87,11 @@ public MockExternalTaskBuilder processDefinitionKey(String processDefinitionKey) return this; } + public MockExternalTaskBuilder processDefinitionVersionTag(String processDefinitionVersionTag) { + this.processDefinitionVersionTag = processDefinitionVersionTag; + return this; + } + public MockExternalTaskBuilder processInstanceId(String processInstanceId) { this.processInstanceId = processInstanceId; return this; @@ -136,6 +142,7 @@ public ExternalTask buildExternalTask() { when(task.getLockExpirationTime()).thenReturn(lockExpirationTime); when(task.getProcessDefinitionId()).thenReturn(processDefinitionId); when(task.getProcessDefinitionKey()).thenReturn(processDefinitionKey); + when(task.getProcessDefinitionVersionTag()).thenReturn(processDefinitionVersionTag); when(task.getProcessInstanceId()).thenReturn(processInstanceId); when(task.getRetries()).thenReturn(retries); when(task.isSuspended()).thenReturn(suspended); @@ -157,6 +164,7 @@ public LockedExternalTask buildLockedExternalTask() { when(task.getLockExpirationTime()).thenReturn(lockExpirationTime); when(task.getProcessDefinitionId()).thenReturn(processDefinitionId); when(task.getProcessDefinitionKey()).thenReturn(processDefinitionKey); + when(task.getProcessDefinitionVersionTag()).thenReturn(processDefinitionVersionTag); when(task.getProcessInstanceId()).thenReturn(processInstanceId); when(task.getRetries()).thenReturn(retries); when(task.getTopicName()).thenReturn(topicName); diff --git a/engine-rest/engine-rest-jaxrs2/src/test/java/org/camunda/bpm/engine/rest/helper/MockProvider.java b/engine-rest/engine-rest-jaxrs2/src/test/java/org/camunda/bpm/engine/rest/helper/MockProvider.java index 31b853b5479..ca6e0bf3239 100644 --- a/engine-rest/engine-rest-jaxrs2/src/test/java/org/camunda/bpm/engine/rest/helper/MockProvider.java +++ b/engine-rest/engine-rest-jaxrs2/src/test/java/org/camunda/bpm/engine/rest/helper/MockProvider.java @@ -52,6 +52,7 @@ public abstract class MockProvider { public static final String EXAMPLE_ACTIVITY_INSTANCE_ID = "anActivityInstanceId"; public static final String EXAMPLE_PROCESS_DEFINITION_ID = "aProcDefId"; public static final String EXAMPLE_PROCESS_DEFINITION_KEY = "aKey"; + public static final String EXAMPLE_PROCESS_DEFINITION_VERSION_TAG = "42"; public static final String EXAMPLE_TENANT_ID = "aTenantId"; public static final Integer EXTERNAL_TASK_RETRIES = new Integer(5); public static final String EXTERNAL_TASK_ERROR_MESSAGE = "some error"; @@ -87,6 +88,7 @@ public static MockExternalTaskBuilder mockExternalTask() { .lockExpirationTime(DateTimeUtil.parseDate(EXTERNAL_TASK_LOCK_EXPIRATION_TIME)) .processDefinitionId(EXAMPLE_PROCESS_DEFINITION_ID) .processDefinitionKey(EXAMPLE_PROCESS_DEFINITION_KEY) + .processDefinitionVersionTag(EXAMPLE_PROCESS_DEFINITION_VERSION_TAG) .processInstanceId(EXAMPLE_PROCESS_INSTANCE_ID) .retries(EXTERNAL_TASK_RETRIES) .suspended(EXTERNAL_TASK_SUSPENDED) diff --git a/engine-rest/engine-rest/src/main/java/org/camunda/bpm/engine/rest/dto/externaltask/LockedExternalTaskDto.java b/engine-rest/engine-rest/src/main/java/org/camunda/bpm/engine/rest/dto/externaltask/LockedExternalTaskDto.java index d4203d11084..18b5cf3477a 100644 --- a/engine-rest/engine-rest/src/main/java/org/camunda/bpm/engine/rest/dto/externaltask/LockedExternalTaskDto.java +++ b/engine-rest/engine-rest/src/main/java/org/camunda/bpm/engine/rest/dto/externaltask/LockedExternalTaskDto.java @@ -39,6 +39,7 @@ public class LockedExternalTaskDto { protected Date lockExpirationTime; protected String processDefinitionId; protected String processDefinitionKey; + protected String processDefinitionVersionTag; protected String processInstanceId; protected Integer retries; protected boolean suspended; @@ -73,6 +74,9 @@ public String getProcessDefinitionId() { public String getProcessDefinitionKey() { return processDefinitionKey; } + public String getProcessDefinitionVersionTag() { + return processDefinitionVersionTag; + } public String getProcessInstanceId() { return processInstanceId; } @@ -118,6 +122,7 @@ public static LockedExternalTaskDto fromLockedExternalTask(LockedExternalTask ta dto.lockExpirationTime = task.getLockExpirationTime(); dto.processDefinitionId = task.getProcessDefinitionId(); dto.processDefinitionKey = task.getProcessDefinitionKey(); + dto.processDefinitionVersionTag = task.getProcessDefinitionVersionTag(); dto.processInstanceId = task.getProcessInstanceId(); dto.retries = task.getRetries(); dto.topicName = task.getTopicName(); @@ -141,11 +146,26 @@ public static List fromLockedExternalTasks(List