Fixing build failures caused by ActivitiSprintTest leaving the DB in a dirty state.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@26027 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
N Smith
2011-03-04 16:12:29 +00:00
parent abde694951
commit 5e78575ca7

View File

@@ -24,6 +24,7 @@ import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@@ -107,10 +108,9 @@ public abstract class AbstractWorkflowRestApiTest extends BaseWebScriptTest
private NodeRef contentNodeRef; private NodeRef contentNodeRef;
private AuthenticationComponent authenticationComponent; private AuthenticationComponent authenticationComponent;
private List<String> workflows = new LinkedList<String>();
public void testTaskInstancesGet() throws Exception public void testTaskInstancesGet() throws Exception
{
String startedWorkflowId = null;
try
{ {
// Check USER2 starts with no tasks. // Check USER2 starts with no tasks.
personManager.setUser(USER2); personManager.setUser(USER2);
@@ -135,8 +135,10 @@ public abstract class AbstractWorkflowRestApiTest extends BaseWebScriptTest
params.put(WorkflowModel.ASSOC_PACKAGE, packageRef); params.put(WorkflowModel.ASSOC_PACKAGE, packageRef);
WorkflowPath adhocPath = workflowService.startWorkflow(adhocDef.getId(), params); WorkflowPath adhocPath = workflowService.startWorkflow(adhocDef.getId(), params);
startedWorkflowId = adhocPath.getInstance().getId(); String workflowId = adhocPath.getInstance().getId();
WorkflowTask startTask = workflowService.getTasksForWorkflowPath(adhocPath.getId()).get(0); workflows.add(workflowId);
WorkflowTask startTask = workflowService.getStartTask(workflowId);
workflowService.endTask(startTask.getId(), null); workflowService.endTask(startTask.getId(), null);
// Check USER2 now has one task. // Check USER2 now has one task.
@@ -194,47 +196,50 @@ public abstract class AbstractWorkflowRestApiTest extends BaseWebScriptTest
// Due after yesterday, started task should be in it // Due after yesterday, started task should be in it
dueDateCal.add(Calendar.DAY_OF_MONTH, -1); dueDateCal.add(Calendar.DAY_OF_MONTH, -1);
checkTasksPresent(MessageFormat.format(URL_TASKS_DUE_AFTER, ISO8601DateFormat.format(dueDateCal.getTime())), checkTasksPresent(MessageFormat.format(URL_TASKS_DUE_AFTER, ISO8601DateFormat.format(dueDateCal.getTime())),
true, true, task.getId());
task.getId());
// Due before yesterday, started task shouldn't be in it // Due before yesterday, started task shouldn't be in it
checkTasksPresent(MessageFormat.format(URL_TASKS_DUE_BEFORE, ISO8601DateFormat.format(dueDateCal.getTime())), checkTasksPresent(MessageFormat.format(URL_TASKS_DUE_BEFORE, ISO8601DateFormat.format(dueDateCal.getTime())),
false, false, task.getId());
task.getId());
// Due before tomorrow, started task should be in it // Due before tomorrow, started task should be in it
dueDateCal.add(Calendar.DAY_OF_MONTH, 2); dueDateCal.add(Calendar.DAY_OF_MONTH, 2);
checkTasksPresent(MessageFormat.format(URL_TASKS_DUE_BEFORE, ISO8601DateFormat.format(dueDateCal.getTime())), checkTasksPresent(MessageFormat.format(URL_TASKS_DUE_BEFORE, ISO8601DateFormat.format(dueDateCal.getTime())),
true, true, task.getId());
task.getId());
// Due after tomorrow, started task shouldn't be in it // Due after tomorrow, started task shouldn't be in it
checkTasksPresent(MessageFormat.format(URL_TASKS_DUE_AFTER, ISO8601DateFormat.format(dueDateCal.getTime())), checkTasksPresent(MessageFormat.format(URL_TASKS_DUE_AFTER, ISO8601DateFormat.format(dueDateCal.getTime())),
false, false, task.getId());
task.getId());
//checkFiltering(URL_TASKS + "?dueAfter=" + ISO8601DateFormat.format(dueDate)); // checkFiltering(URL_TASKS + "?dueAfter=" +
// ISO8601DateFormat.format(dueDate));
//checkFiltering(URL_TASKS + "?dueBefore=" + ISO8601DateFormat.format(new Date())); // checkFiltering(URL_TASKS + "?dueBefore=" +
// ISO8601DateFormat.format(new Date()));
// Check property filtering on the task assigned to USER2 // Check property filtering on the task assigned to USER2
String customProperties = "bpm_description,bpm_priority"; String customProperties = "bpm_description,bpm_priority";
checkTaskPropertyFiltering(customProperties, Arrays.asList("bpm_description", "bpm_priority")); checkTaskPropertyFiltering(customProperties, Arrays.asList("bpm_description", "bpm_priority"));
// Properties that aren't explicitally present on task should be returned as wel // Properties that aren't explicitally present on task should be
// returned as wel
customProperties = "bpm_unexistingProperty,bpm_description,bpm_priority"; customProperties = "bpm_unexistingProperty,bpm_description,bpm_priority";
checkTaskPropertyFiltering(customProperties, Arrays.asList("bpm_description", "bpm_priority", "bpm_unexistingProperty")); checkTaskPropertyFiltering(customProperties,
Arrays.asList("bpm_description", "bpm_priority", "bpm_unexistingProperty"));
// Check paging // Check paging
int maxItems = 3; int maxItems = 3;
for (int skipCount = 0; skipCount < totalItems; skipCount += maxItems) for (int skipCount = 0; skipCount < totalItems; skipCount += maxItems)
{ {
// one of this should test situation when skipCount + maxItems > totalItems // one of this should test situation when skipCount + maxItems >
checkPaging(MessageFormat.format(URL_USER_TASKS, USER2) + "&maxItems=" + maxItems + "&skipCount=" + skipCount, totalItems, maxItems, skipCount); // totalItems
checkPaging(MessageFormat.format(URL_USER_TASKS, USER2) + "&maxItems=" + maxItems + "&skipCount="
+ skipCount, totalItems, maxItems, skipCount);
} }
// testing when skipCount > totalItems // testing when skipCount > totalItems
checkPaging(MessageFormat.format(URL_USER_TASKS, USER2) + "&maxItems=" + maxItems + "&skipCount=" + (totalItems + 1), totalItems, maxItems, totalItems + 1); checkPaging(MessageFormat.format(URL_USER_TASKS, USER2) + "&maxItems=" + maxItems + "&skipCount="
+ (totalItems + 1), totalItems, maxItems, totalItems + 1);
// check the exclude filtering // check the exclude filtering
String exclude = "wf:submitAdhocTask"; String exclude = "wf:submitAdhocTask";
@@ -257,29 +262,10 @@ public abstract class AbstractWorkflowRestApiTest extends BaseWebScriptTest
break; break;
} }
} }
assertFalse("Found wf:submitAdhocTask when they were supposed to be excluded", adhocTasksPresent); assertFalse("Found wf:submitAdhocTask when they were supposed to be excluded", adhocTasksPresent);
} }
finally
{
if(startedWorkflowId != null)
{
try {
// Cleanup
workflowService.cancelWorkflow(startedWorkflowId);
}
catch(Throwable t)
{
// Ignore exception while cleaning up
}
}
}
}
public void testTaskInstancesForWorkflowGet() throws Exception public void testTaskInstancesForWorkflowGet() throws Exception
{
String startedWorkflowId = null;
try
{ {
// Check starts with no workflow. // Check starts with no workflow.
personManager.setUser(USER2); personManager.setUser(USER2);
@@ -298,10 +284,11 @@ public abstract class AbstractWorkflowRestApiTest extends BaseWebScriptTest
params.put(WorkflowModel.ASSOC_PACKAGE, packageRef); params.put(WorkflowModel.ASSOC_PACKAGE, packageRef);
WorkflowPath adhocPath = workflowService.startWorkflow(adhocDef.getId(), params); WorkflowPath adhocPath = workflowService.startWorkflow(adhocDef.getId(), params);
startedWorkflowId = adhocPath.getInstance().getId(); String workflowId = adhocPath.getInstance().getId();
workflows.add(workflowId);
// End start task. // End start task.
WorkflowTask startTask = workflowService.getStartTask(startedWorkflowId); WorkflowTask startTask = workflowService.getStartTask(workflowId);
String startTaskId = startTask.getId(); String startTaskId = startTask.getId();
workflowService.endTask(startTaskId, null); workflowService.endTask(startTaskId, null);
@@ -311,7 +298,7 @@ public abstract class AbstractWorkflowRestApiTest extends BaseWebScriptTest
WorkflowTask task = tasks.get(0); WorkflowTask task = tasks.get(0);
// Retrieve tasks using the workflow instance // Retrieve tasks using the workflow instance
String baseUrl = MessageFormat.format(URL_WORKFLOW_TASKS, startedWorkflowId); String baseUrl = MessageFormat.format(URL_WORKFLOW_TASKS, workflowId);
// Check returns the completed start task and the current task. // Check returns the completed start task and the current task.
String adhocTaskId = task.getId(); String adhocTaskId = task.getId();
@@ -341,27 +328,9 @@ public abstract class AbstractWorkflowRestApiTest extends BaseWebScriptTest
String user2InProgressURL = user2Url + "&state=" + WorkflowTaskState.IN_PROGRESS; String user2InProgressURL = user2Url + "&state=" + WorkflowTaskState.IN_PROGRESS;
checkTasksMatch(user2InProgressURL, adhocTaskId); checkTasksMatch(user2InProgressURL, adhocTaskId);
} }
finally
{
if(startedWorkflowId != null)
{
try {
// Cleanup
workflowService.cancelWorkflow(startedWorkflowId);
}
catch(Throwable t)
{
// Ignore exception while cleaning up
}
}
}
}
public void testTaskInstanceGet() throws Exception public void testTaskInstanceGet() throws Exception
{ {
String startedWorkflowId = null;
try {
//Start workflow as USER1 and assign task to USER2. //Start workflow as USER1 and assign task to USER2.
personManager.setUser(USER1); personManager.setUser(USER1);
WorkflowDefinition adhocDef = workflowService.getDefinitionByName(getAdhocWorkflowDefinitionName()); WorkflowDefinition adhocDef = workflowService.getDefinitionByName(getAdhocWorkflowDefinitionName());
@@ -372,7 +341,9 @@ public abstract class AbstractWorkflowRestApiTest extends BaseWebScriptTest
params.put(WorkflowModel.ASSOC_PACKAGE, packageRef); params.put(WorkflowModel.ASSOC_PACKAGE, packageRef);
WorkflowPath adhocPath = workflowService.startWorkflow(adhocDef.getId(), params); WorkflowPath adhocPath = workflowService.startWorkflow(adhocDef.getId(), params);
startedWorkflowId = adhocPath.getInstance().getId(); String workflowId = adhocPath.getInstance().getId();
workflows.add(workflowId);
WorkflowTask startTask = workflowService.getTasksForWorkflowPath(adhocPath.getId()).get(0); WorkflowTask startTask = workflowService.getTasksForWorkflowPath(adhocPath.getId()).get(0);
// Get the start-task // Get the start-task
@@ -482,22 +453,6 @@ public abstract class AbstractWorkflowRestApiTest extends BaseWebScriptTest
checkWorkflowInstance(firstTask.getPath().getInstance(), result.getJSONObject("workflowInstance")); checkWorkflowInstance(firstTask.getPath().getInstance(), result.getJSONObject("workflowInstance"));
checkWorkflowTaskDefinition(firstTask.getDefinition(), result.getJSONObject("definition")); checkWorkflowTaskDefinition(firstTask.getDefinition(), result.getJSONObject("definition"));
}
finally
{
if(startedWorkflowId != null)
{
try {
// Cleanup
workflowService.deleteWorkflow(startedWorkflowId);
}
catch(Throwable t)
{
// Ignore exception while cleaning up
}
}
}
} }
private void checkWorkflowTaskPropertiesPresent(JSONObject taskJson) throws Exception private void checkWorkflowTaskPropertiesPresent(JSONObject taskJson) throws Exception
@@ -604,10 +559,6 @@ public abstract class AbstractWorkflowRestApiTest extends BaseWebScriptTest
} }
public void testTaskInstancePut() throws Exception public void testTaskInstancePut() throws Exception
{
String startedWorkflowId = null;
try
{ {
// Start workflow as USER1 and assign task to USER2. // Start workflow as USER1 and assign task to USER2.
personManager.setUser(USER1); personManager.setUser(USER1);
@@ -619,7 +570,9 @@ public abstract class AbstractWorkflowRestApiTest extends BaseWebScriptTest
params.put(WorkflowModel.ASSOC_PACKAGE, packageRef); params.put(WorkflowModel.ASSOC_PACKAGE, packageRef);
WorkflowPath adhocPath = workflowService.startWorkflow(adhocDef.getId(), params); WorkflowPath adhocPath = workflowService.startWorkflow(adhocDef.getId(), params);
startedWorkflowId = adhocPath.getInstance().getId(); String worfklowId = adhocPath.getInstance().getId();
workflows.add(worfklowId);
WorkflowTask startTask = workflowService.getStartTask(adhocPath.getInstance().getId()); WorkflowTask startTask = workflowService.getStartTask(adhocPath.getInstance().getId());
// Finish the start-task // Finish the start-task
@@ -697,26 +650,8 @@ public abstract class AbstractWorkflowRestApiTest extends BaseWebScriptTest
editedJsonProperties = result.getJSONObject("properties"); editedJsonProperties = result.getJSONObject("properties");
compareProperties(jsonProperties, editedJsonProperties); compareProperties(jsonProperties, editedJsonProperties);
} }
finally
{
if(startedWorkflowId != null)
{
try {
// Cleanup
workflowService.deleteWorkflow(startedWorkflowId);
}
catch(Throwable t)
{
// Ignore exception while cleaning up
}
}
}
}
public void testTaskInstancePutCompletedTask() throws Exception public void testTaskInstancePutCompletedTask() throws Exception
{
String startedWorkflowId = null;
try
{ {
// Start workflow as USER1 and assign to self // Start workflow as USER1 and assign to self
personManager.setUser(USER1); personManager.setUser(USER1);
@@ -728,7 +663,9 @@ public abstract class AbstractWorkflowRestApiTest extends BaseWebScriptTest
params.put(WorkflowModel.ASSOC_PACKAGE, packageRef); params.put(WorkflowModel.ASSOC_PACKAGE, packageRef);
WorkflowPath adhocPath = workflowService.startWorkflow(adhocDef.getId(), params); WorkflowPath adhocPath = workflowService.startWorkflow(adhocDef.getId(), params);
startedWorkflowId = adhocPath.getInstance().getId(); String WorkflowId = adhocPath.getInstance().getId();
workflows.add(WorkflowId);
WorkflowTask startTask = workflowService.getTasksForWorkflowPath(adhocPath.getId()).get(0); WorkflowTask startTask = workflowService.getTasksForWorkflowPath(adhocPath.getId()).get(0);
// Finish the start-task // Finish the start-task
@@ -742,23 +679,7 @@ public abstract class AbstractWorkflowRestApiTest extends BaseWebScriptTest
jsonProperties.put(qnameToString(WorkflowModel.PROP_DESCRIPTION), "Edited description"); jsonProperties.put(qnameToString(WorkflowModel.PROP_DESCRIPTION), "Edited description");
// Update task. An error is expected, since the task is completed (and not editable) // Update task. An error is expected, since the task is completed (and not editable)
sendRequest(new PutRequest(URL_TASKS + "/" + startTask.getId(), jsonProperties.toString(), "application/json"), sendRequest(new PutRequest(URL_TASKS + "/" + startTask.getId(), jsonProperties.toString(), "application/json"), Status.STATUS_UNAUTHORIZED);
Status.STATUS_UNAUTHORIZED);
}
finally
{
if(startedWorkflowId != null)
{
try {
// Cleanup
workflowService.deleteWorkflow(startedWorkflowId);
}
catch(Throwable t)
{
// Ignore exception while cleaning up
}
}
}
} }
public void testWorkflowDefinitionsGet() throws Exception public void testWorkflowDefinitionsGet() throws Exception
@@ -928,10 +849,6 @@ public abstract class AbstractWorkflowRestApiTest extends BaseWebScriptTest
public void testWorkflowInstanceGet() throws Exception public void testWorkflowInstanceGet() throws Exception
{
String startedWorkflowId = null;
try
{ {
//Start workflow as USER1 and assign task to USER2. //Start workflow as USER1 and assign task to USER2.
personManager.setUser(USER1); personManager.setUser(USER1);
@@ -945,7 +862,10 @@ public abstract class AbstractWorkflowRestApiTest extends BaseWebScriptTest
params.put(WorkflowModel.PROP_CONTEXT, packageRef); params.put(WorkflowModel.PROP_CONTEXT, packageRef);
WorkflowPath adhocPath = workflowService.startWorkflow(adhocDef.getId(), params); WorkflowPath adhocPath = workflowService.startWorkflow(adhocDef.getId(), params);
startedWorkflowId = adhocPath.getInstance().getId(); String WorkflowId = adhocPath.getInstance().getId();
workflows.add(WorkflowId);
// End start task.
WorkflowTask startTask = workflowService.getTasksForWorkflowPath(adhocPath.getId()).get(0); WorkflowTask startTask = workflowService.getTasksForWorkflowPath(adhocPath.getId()).get(0);
startTask = workflowService.endTask(startTask.getId(), null); startTask = workflowService.endTask(startTask.getId(), null);
@@ -994,26 +914,8 @@ public abstract class AbstractWorkflowRestApiTest extends BaseWebScriptTest
JSONArray tasks = result.getJSONArray("tasks"); JSONArray tasks = result.getJSONArray("tasks");
assertTrue(tasks.length() > 1); assertTrue(tasks.length() > 1);
} }
finally
{
if(startedWorkflowId != null)
{
try {
// Cleanup
workflowService.deleteWorkflow(startedWorkflowId);
}
catch(Throwable t)
{
// Ignore exception while cleaning up
}
}
}
}
public void testWorkflowInstancesGet() throws Exception public void testWorkflowInstancesGet() throws Exception
{
String startedWorkflowId = null;
try
{ {
//Start workflow as USER1 and assign task to USER2. //Start workflow as USER1 and assign task to USER2.
personManager.setUser(USER1); personManager.setUser(USER1);
@@ -1027,7 +929,9 @@ public abstract class AbstractWorkflowRestApiTest extends BaseWebScriptTest
params.put(WorkflowModel.PROP_CONTEXT, packageRef); params.put(WorkflowModel.PROP_CONTEXT, packageRef);
WorkflowPath adhocPath = workflowService.startWorkflow(adhocDef.getId(), params); WorkflowPath adhocPath = workflowService.startWorkflow(adhocDef.getId(), params);
startedWorkflowId = adhocPath.getInstance().getId(); String WorkflowId = adhocPath.getInstance().getId();
workflows.add(WorkflowId);
WorkflowTask startTask = workflowService.getTasksForWorkflowPath(adhocPath.getId()).get(0); WorkflowTask startTask = workflowService.getTasksForWorkflowPath(adhocPath.getId()).get(0);
WorkflowInstance adhocInstance = startTask.getPath().getInstance(); WorkflowInstance adhocInstance = startTask.getPath().getInstance();
workflowService.endTask(startTask.getId(), null); workflowService.endTask(startTask.getId(), null);
@@ -1131,22 +1035,6 @@ public abstract class AbstractWorkflowRestApiTest extends BaseWebScriptTest
} }
} }
assertFalse("Found adhoc workflows when they were supposed to be excluded", adhocWorkflowPresent); assertFalse("Found adhoc workflows when they were supposed to be excluded", adhocWorkflowPresent);
}
finally
{
if(startedWorkflowId != null)
{
try {
// Cleanup
workflowService.deleteWorkflow(startedWorkflowId);
}
catch(Throwable t)
{
// Ignore exception while cleaning up
}
}
}
} }
public void testWorkflowInstancesForNodeGet() throws Exception public void testWorkflowInstancesForNodeGet() throws Exception
@@ -1263,9 +1151,6 @@ public abstract class AbstractWorkflowRestApiTest extends BaseWebScriptTest
} }
protected void runReviewFlow(boolean approve) throws Exception protected void runReviewFlow(boolean approve) throws Exception
{
String startedWorkflowId = null;
try
{ {
// Start workflow as USER1 // Start workflow as USER1
personManager.setUser(USER1); personManager.setUser(USER1);
@@ -1280,7 +1165,9 @@ public abstract class AbstractWorkflowRestApiTest extends BaseWebScriptTest
params.put(WorkflowModel.PROP_CONTEXT, packageRef); params.put(WorkflowModel.PROP_CONTEXT, packageRef);
WorkflowPath reviewPath = workflowService.startWorkflow(reviewDef.getId(), params); WorkflowPath reviewPath = workflowService.startWorkflow(reviewDef.getId(), params);
startedWorkflowId = reviewPath.getInstance().getId(); String workflowId = reviewPath.getInstance().getId();
workflows.add(workflowId);
WorkflowTask startTask = workflowService.getTasksForWorkflowPath(reviewPath.getId()).get(0); WorkflowTask startTask = workflowService.getTasksForWorkflowPath(reviewPath.getId()).get(0);
// End start task // End start task
@@ -1328,27 +1215,10 @@ public abstract class AbstractWorkflowRestApiTest extends BaseWebScriptTest
{ {
assertEquals("wf:rejectedTask", taskType); assertEquals("wf:rejectedTask", taskType);
} }
} workflowService.cancelWorkflow(workflowId);
finally
{
if(startedWorkflowId != null)
{
try {
// Cleanup
workflowService.deleteWorkflow(startedWorkflowId);
}
catch(Throwable t)
{
// Ignore exception while cleaning up
}
}
}
} }
protected void runReviewPooledFlow(boolean approve) throws Exception protected void runReviewPooledFlow(boolean approve) throws Exception
{
String startedWorkflowId = null;
try
{ {
// Start workflow as USER1 // Start workflow as USER1
personManager.setUser(USER1); personManager.setUser(USER1);
@@ -1364,14 +1234,16 @@ public abstract class AbstractWorkflowRestApiTest extends BaseWebScriptTest
params.put(WorkflowModel.PROP_CONTEXT, packageRef); params.put(WorkflowModel.PROP_CONTEXT, packageRef);
WorkflowPath reviewPath = workflowService.startWorkflow(reviewDef.getId(), params); WorkflowPath reviewPath = workflowService.startWorkflow(reviewDef.getId(), params);
startedWorkflowId = reviewPath.getInstance().getId(); String workflowId = reviewPath.getInstance().getId();
workflows.add(workflowId);
WorkflowTask startTask = workflowService.getTasksForWorkflowPath(reviewPath.getId()).get(0); WorkflowTask startTask = workflowService.getTasksForWorkflowPath(reviewPath.getId()).get(0);
// End start task // End start task
startTask = workflowService.endTask(startTask.getId(), null); startTask = workflowService.endTask(startTask.getId(), null);
// Check if task is NOT available in list USER3, not a member of the group // Check if task is NOT available in list USER3, not a member of the
// group
personManager.setUser(USER3); personManager.setUser(USER3);
Response response = sendRequest(new GetRequest(MessageFormat.format(URL_USER_TASKS, USER3)), 200); Response response = sendRequest(new GetRequest(MessageFormat.format(URL_USER_TASKS, USER3)), 200);
assertEquals(Status.STATUS_OK, response.getStatus()); assertEquals(Status.STATUS_OK, response.getStatus());
@@ -1381,7 +1253,8 @@ public abstract class AbstractWorkflowRestApiTest extends BaseWebScriptTest
assertNotNull(results); assertNotNull(results);
assertEquals(0, results.length()); assertEquals(0, results.length());
// Check if task is available in list of reviewer, member of GROUP: USER2 // Check if task is available in list of reviewer, member of GROUP:
// USER2
personManager.setUser(USER2); personManager.setUser(USER2);
response = sendRequest(new GetRequest(MessageFormat.format(URL_USER_TASKS, USER2)), 200); response = sendRequest(new GetRequest(MessageFormat.format(URL_USER_TASKS, USER2)), 200);
assertEquals(Status.STATUS_OK, response.getStatus()); assertEquals(Status.STATUS_OK, response.getStatus());
@@ -1415,7 +1288,6 @@ public abstract class AbstractWorkflowRestApiTest extends BaseWebScriptTest
assertFalse(taskJson.getBoolean("isClaimable")); assertFalse(taskJson.getBoolean("isClaimable"));
assertTrue(taskJson.getBoolean("isPooled")); assertTrue(taskJson.getBoolean("isPooled"));
// Delegate approval/rejection to implementing engine-test // Delegate approval/rejection to implementing engine-test
if (approve) if (approve)
{ {
@@ -1446,22 +1318,7 @@ public abstract class AbstractWorkflowRestApiTest extends BaseWebScriptTest
{ {
assertEquals("wf:rejectedTask", taskType); assertEquals("wf:rejectedTask", taskType);
} }
} workflowService.cancelWorkflow(workflowId);
finally
{
if(startedWorkflowId != null)
{
try {
// Cleanup
workflowService.deleteWorkflow(startedWorkflowId);
}
catch(Throwable t)
{
// Ignore exception while cleaning up
}
}
}
} }
protected abstract void approveTask(String taskId) throws Exception; protected abstract void approveTask(String taskId) throws Exception;
@@ -1519,6 +1376,17 @@ public abstract class AbstractWorkflowRestApiTest extends BaseWebScriptTest
{ {
super.tearDown(); super.tearDown();
authenticationComponent.setSystemUserAsCurrentUser(); authenticationComponent.setSystemUserAsCurrentUser();
for (String id: workflows)
{
try
{
workflowService.cancelWorkflow(id);
}
catch(Throwable t)
{
// Do nothing
}
}
groupManager.clearGroups(); groupManager.clearGroups();
personManager.clearPeople(); personManager.clearPeople();
authenticationComponent.clearCurrentSecurityContext(); authenticationComponent.clearCurrentSecurityContext();