Skip to content

Commit

Permalink
chore(engine-rest): expose version tag to fetched external tasks
Browse files Browse the repository at this point in the history
related to CAM-10693
  • Loading branch information
mboskamp authored and tasso94 committed Sep 11, 2019
1 parent 445f723 commit 00bd993
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -73,6 +74,9 @@ public String getProcessDefinitionId() {
public String getProcessDefinitionKey() {
return processDefinitionKey;
}
public String getProcessDefinitionVersionTag() {
return processDefinitionVersionTag;
}
public String getProcessInstanceId() {
return processInstanceId;
}
Expand Down Expand Up @@ -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();
Expand All @@ -141,11 +146,26 @@ public static List<LockedExternalTaskDto> fromLockedExternalTasks(List<LockedExt
}
@Override
public String toString() {
return "LockedExternalTaskDto [activityId=" + activityId + ", activityInstanceId=" + activityInstanceId + ", errorMessage=" + errorMessage
+ ", errorDetails=" + errorDetails + ", executionId=" + executionId + ", id=" + id + ", lockExpirationTime=" + lockExpirationTime
+ ", processDefinitionId=" + processDefinitionId + ", processDefinitionKey=" + processDefinitionKey + ", processInstanceId=" + processInstanceId
+ ", retries=" + retries + ", suspended=" + suspended + ", workerId=" + workerId + ", topicName=" + topicName + ", tenantId=" + tenantId
+ ", variables=" + variables + ", priority=" + priority + ", businessKey=" + businessKey + "]";
return
"LockedExternalTaskDto [activityId=" + activityId
+ ", activityInstanceId=" + activityInstanceId
+ ", errorMessage=" + errorMessage
+ ", errorDetails=" + errorDetails
+ ", executionId=" + executionId
+ ", id=" + id
+ ", lockExpirationTime=" + lockExpirationTime
+ ", processDefinitionId=" + processDefinitionId
+ ", processDefinitionKey=" + processDefinitionKey
+ ", processDefinitionVersionTag=" + processDefinitionVersionTag
+ ", processInstanceId=" + processInstanceId
+ ", retries=" + retries
+ ", suspended=" + suspended
+ ", workerId=" + workerId
+ ", topicName=" + topicName
+ ", tenantId=" + tenantId
+ ", variables=" + variables
+ ", priority=" + priority
+ ", businessKey=" + businessKey + "]";
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ public void testSimpleTaskQuery() {
String lockExpirationTime = from(content).getString("[0].lockExpirationTime");
String processDefinitionId = from(content).getString("[0].processDefinitionId");
String processDefinitionKey = from(content).getString("[0].processDefinitionKey");
String processDefinitionVersionTag = from(content).getString("[0].processDefinitionVersionTag");
String processInstanceId = from(content).getString("[0].processInstanceId");
Integer retries = from(content).getInt("[0].retries");
Boolean suspended = from(content).getBoolean("[0].suspended");
Expand All @@ -150,6 +151,7 @@ public void testSimpleTaskQuery() {
Assert.assertEquals(MockProvider.EXTERNAL_TASK_LOCK_EXPIRATION_TIME, lockExpirationTime);
Assert.assertEquals(MockProvider.EXAMPLE_PROCESS_DEFINITION_ID, processDefinitionId);
Assert.assertEquals(MockProvider.EXAMPLE_PROCESS_DEFINITION_KEY, processDefinitionKey);
Assert.assertEquals(MockProvider.EXAMPLE_PROCESS_DEFINITION_VERSION_TAG, processDefinitionVersionTag);
Assert.assertEquals(MockProvider.EXAMPLE_PROCESS_INSTANCE_ID, processInstanceId);
Assert.assertEquals(MockProvider.EXTERNAL_TASK_RETRIES, retries);
Assert.assertEquals(MockProvider.EXTERNAL_TASK_SUSPENDED, suspended);
Expand All @@ -175,6 +177,7 @@ public void testCompleteGETQuery() {
parameters.put("processInstanceId", "someProcessInstanceId");
parameters.put("processInstanceIdIn", "aProcessInstanceId,anotherProcessInstanceId");
parameters.put("processDefinitionId", "someProcessDefinitionId");
parameters.put("processDefinitionVersionTag", "someProcessDefinitionVersionTag");
parameters.put("active", "true");
parameters.put("suspended", "true");
parameters.put("withRetriesLeft", "true");
Expand All @@ -200,6 +203,7 @@ public void testCompleteGETQuery() {
verify(mockQuery).processInstanceId("someProcessInstanceId");
verify(mockQuery).processInstanceIdIn("aProcessInstanceId", "anotherProcessInstanceId");
verify(mockQuery).processDefinitionId("someProcessDefinitionId");
verify(mockQuery).processDefinitionId("someProcessDefinitionId");
verify(mockQuery).active();
verify(mockQuery).suspended();
verify(mockQuery).withRetriesLeft();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,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;
Expand Down Expand Up @@ -91,6 +92,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;
Expand Down Expand Up @@ -146,6 +152,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);
Expand All @@ -168,6 +175,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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ public abstract class MockProvider {
public static final String EXAMPLE_PROCESS_DEFINITION_CATEGORY = "aCategory";
public static final String EXAMPLE_PROCESS_DEFINITION_DESCRIPTION = "aDescription";
public static final int EXAMPLE_PROCESS_DEFINITION_VERSION = 42;
public static final String EXAMPLE_PROCESS_DEFINITION_VERSION_TAG = "42";
public static final String EXAMPLE_PROCESS_DEFINITION_RESOURCE_NAME = "aResourceName";
public static final String EXAMPLE_PROCESS_DEFINITION_DIAGRAM_RESOURCE_NAME = "aResourceName.png";
public static final boolean EXAMPLE_PROCESS_DEFINITION_IS_SUSPENDED = true;
Expand Down Expand Up @@ -2933,6 +2934,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)
Expand Down

0 comments on commit 00bd993

Please sign in to comment.