use of org.springframework.extensions.webscripts.TestWebScriptServer.Response in project alfresco-remote-api by Alfresco.
the class AbstractWorkflowRestApiTest method runReviewPooledFlow.
protected void runReviewPooledFlow(boolean approve) throws Exception {
// Start workflow as USER1
personManager.setUser(USER1);
WorkflowDefinition reviewDef = workflowService.getDefinitionByName(getReviewPooledWorkflowDefinitionName());
Map<QName, Serializable> params = new HashMap<QName, Serializable>();
// Reviewer is group GROUP
params.put(WorkflowModel.ASSOC_GROUP_ASSIGNEE, groupManager.get(GROUP));
Date dueDate = new Date();
params.put(WorkflowModel.PROP_DUE_DATE, dueDate);
params.put(WorkflowModel.PROP_PRIORITY, 1);
params.put(WorkflowModel.ASSOC_PACKAGE, packageRef);
params.put(WorkflowModel.PROP_CONTEXT, packageRef);
WorkflowPath reviewPath = workflowService.startWorkflow(reviewDef.getId(), params);
String workflowId = reviewPath.getInstance().getId();
workflows.add(workflowId);
WorkflowTask startTask = workflowService.getTasksForWorkflowPath(reviewPath.getId()).get(0);
// End start task
startTask = workflowService.endTask(startTask.getId(), null);
// Check if task is NOT available in list USER3, not a member of the
// group
personManager.setUser(USER3);
Response response = sendRequest(new GetRequest(MessageFormat.format(URL_USER_TASKS, USER3)), 200);
assertEquals(Status.STATUS_OK, response.getStatus());
String jsonStr = response.getContentAsString();
JSONObject json = new JSONObject(jsonStr);
JSONArray results = json.getJSONArray("data");
assertNotNull(results);
assertEquals(0, results.length());
// Check if task is available in list of reviewer, member of GROUP:
// USER2
personManager.setUser(USER2);
response = sendRequest(new GetRequest(MessageFormat.format(URL_USER_TASKS, USER2)), 200);
assertEquals(Status.STATUS_OK, response.getStatus());
jsonStr = response.getContentAsString();
json = new JSONObject(jsonStr);
results = json.getJSONArray("data");
assertNotNull(results);
assertEquals(1, results.length());
// Check if task is claimable and pooled
JSONObject taskJson = results.getJSONObject(0);
String taskId = taskJson.getString("id");
assertTrue(taskJson.getBoolean("isClaimable"));
assertTrue(taskJson.getBoolean("isPooled"));
// Claim task, using PUT, updating the owner
JSONObject properties = new JSONObject();
properties.put(qnameToString(ContentModel.PROP_OWNER), USER2);
sendRequest(new PutRequest(URL_TASKS + "/" + taskId, properties.toString(), "application/json"), 200);
// Check if task insn't claimable anymore
response = sendRequest(new GetRequest(MessageFormat.format(URL_USER_TASKS, USER2)), 200);
assertEquals(Status.STATUS_OK, response.getStatus());
jsonStr = response.getContentAsString();
json = new JSONObject(jsonStr);
results = json.getJSONArray("data");
assertNotNull(results);
assertEquals(1, results.length());
taskJson = results.getJSONObject(0);
assertFalse(taskJson.getBoolean("isClaimable"));
assertTrue(taskJson.getBoolean("isPooled"));
// Delegate approval/rejection to implementing engine-test
if (approve) {
approveTask(taskId);
} else {
rejectTask(taskId);
}
// 'Approved'/'Rejected' task should be available for initiator
personManager.setUser(USER1);
response = sendRequest(new GetRequest(MessageFormat.format(URL_USER_TASKS, USER1)), 200);
assertEquals(Status.STATUS_OK, response.getStatus());
jsonStr = response.getContentAsString();
json = new JSONObject(jsonStr);
results = json.getJSONArray("data");
assertNotNull(results);
assertEquals(1, results.length());
// Correct task type check
String taskType = results.getJSONObject(0).getString("name");
if (approve) {
assertEquals("wf:approvedTask", taskType);
} else {
assertEquals("wf:rejectedTask", taskType);
}
workflowService.cancelWorkflow(workflowId);
}
use of org.springframework.extensions.webscripts.TestWebScriptServer.Response in project alfresco-remote-api by Alfresco.
the class AbstractWorkflowRestApiTest method testWorkflowInstanceGet.
public void testWorkflowInstanceGet() throws Exception {
// Start workflow as USER1 and assign task to USER2.
personManager.setUser(USER1);
WorkflowDefinition adhocDef = workflowService.getDefinitionByName(getAdhocWorkflowDefinitionName());
Map<QName, Serializable> params = new HashMap<QName, Serializable>();
params.put(WorkflowModel.ASSOC_ASSIGNEE, personManager.get(USER2));
Date dueDate = new Date();
params.put(WorkflowModel.PROP_WORKFLOW_DUE_DATE, dueDate);
params.put(WorkflowModel.PROP_WORKFLOW_PRIORITY, 1);
params.put(WorkflowModel.ASSOC_PACKAGE, packageRef);
params.put(WorkflowModel.PROP_CONTEXT, packageRef);
WorkflowPath adhocPath = workflowService.startWorkflow(adhocDef.getId(), params);
String WorkflowId = adhocPath.getInstance().getId();
workflows.add(WorkflowId);
// End start task.
WorkflowTask startTask = workflowService.getTasksForWorkflowPath(adhocPath.getId()).get(0);
startTask = workflowService.endTask(startTask.getId(), null);
WorkflowInstance adhocInstance = startTask.getPath().getInstance();
Response response = sendRequest(new GetRequest(URL_WORKFLOW_INSTANCES + "/" + adhocInstance.getId() + "?includeTasks=true"), 200);
assertEquals(Status.STATUS_OK, response.getStatus());
String jsonStr = response.getContentAsString();
JSONObject json = new JSONObject(jsonStr);
JSONObject result = json.getJSONObject("data");
assertNotNull(result);
assertEquals(adhocInstance.getId(), result.getString("id"));
assertTrue(result.opt("message").equals(JSONObject.NULL));
assertEquals(adhocInstance.getDefinition().getName(), result.getString("name"));
assertEquals(adhocInstance.getDefinition().getTitle(), result.getString("title"));
assertEquals(adhocInstance.getDefinition().getDescription(), result.getString("description"));
assertEquals(adhocInstance.isActive(), result.getBoolean("isActive"));
assertEquals(org.springframework.extensions.surf.util.ISO8601DateFormat.format(adhocInstance.getStartDate()), result.getString("startDate"));
assertNotNull(result.get("dueDate"));
assertNotNull(result.get("endDate"));
assertEquals(1, result.getInt("priority"));
JSONObject initiator = result.getJSONObject("initiator");
assertEquals(USER1, initiator.getString("userName"));
assertEquals(personManager.getFirstName(USER1), initiator.getString("firstName"));
assertEquals(personManager.getLastName(USER1), initiator.getString("lastName"));
assertEquals(adhocInstance.getContext().toString(), result.getString("context"));
assertEquals(adhocInstance.getWorkflowPackage().toString(), result.getString("package"));
assertNotNull(result.getString("startTaskInstanceId"));
JSONObject jsonDefinition = result.getJSONObject("definition");
WorkflowDefinition adhocDefinition = adhocInstance.getDefinition();
assertNotNull(jsonDefinition);
assertEquals(adhocDefinition.getId(), jsonDefinition.getString("id"));
assertEquals(adhocDefinition.getName(), jsonDefinition.getString("name"));
assertEquals(adhocDefinition.getTitle(), jsonDefinition.getString("title"));
assertEquals(adhocDefinition.getDescription(), jsonDefinition.getString("description"));
assertEquals(adhocDefinition.getVersion(), jsonDefinition.getString("version"));
assertEquals(adhocDefinition.getStartTaskDefinition().getMetadata().getName().toPrefixString(namespaceService), jsonDefinition.getString("startTaskDefinitionType"));
assertTrue(jsonDefinition.has("taskDefinitions"));
JSONArray tasks = result.getJSONArray("tasks");
assertTrue(tasks.length() > 1);
}
use of org.springframework.extensions.webscripts.TestWebScriptServer.Response in project alfresco-remote-api by Alfresco.
the class AbstractWorkflowRestApiTest method testWorkflowInstancesGet.
public void testWorkflowInstancesGet() throws Exception {
// Should work even with definitions hidden.
wfTestHelper.setVisible(false);
// Start workflow as USER1 and assign task to USER2.
personManager.setUser(USER1);
WorkflowDefinition adhocDef = workflowService.getDefinitionByName(getAdhocWorkflowDefinitionName());
Map<QName, Serializable> params = new HashMap<QName, Serializable>();
params.put(WorkflowModel.ASSOC_ASSIGNEE, personManager.get(USER2));
Date dueDate = new Date();
params.put(WorkflowModel.PROP_WORKFLOW_DUE_DATE, dueDate);
params.put(WorkflowModel.PROP_WORKFLOW_PRIORITY, 1);
params.put(WorkflowModel.ASSOC_PACKAGE, packageRef);
params.put(WorkflowModel.PROP_CONTEXT, packageRef);
WorkflowPath adhocPath = workflowService.startWorkflow(adhocDef.getId(), params);
String WorkflowId = adhocPath.getInstance().getId();
workflows.add(WorkflowId);
WorkflowTask startTask = workflowService.getTasksForWorkflowPath(adhocPath.getId()).get(0);
WorkflowInstance adhocInstance = startTask.getPath().getInstance();
workflowService.endTask(startTask.getId(), null);
// Get Workflow Instance Collection
Response response = sendRequest(new GetRequest(URL_WORKFLOW_INSTANCES), 200);
assertEquals(Status.STATUS_OK, response.getStatus());
String jsonStr = response.getContentAsString();
JSONObject json = new JSONObject(jsonStr);
JSONArray result = json.getJSONArray("data");
assertNotNull(result);
int totalItems = result.length();
for (int i = 0; i < result.length(); i++) {
checkSimpleWorkflowInstanceResponse(result.getJSONObject(i));
}
Response forDefinitionResponse = sendRequest(new GetRequest(MessageFormat.format(URL_WORKFLOW_INSTANCES_FOR_DEFINITION, adhocDef.getId())), 200);
assertEquals(Status.STATUS_OK, forDefinitionResponse.getStatus());
String forDefinitionJsonStr = forDefinitionResponse.getContentAsString();
JSONObject forDefinitionJson = new JSONObject(forDefinitionJsonStr);
JSONArray forDefinitionResult = forDefinitionJson.getJSONArray("data");
assertNotNull(forDefinitionResult);
for (int i = 0; i < forDefinitionResult.length(); i++) {
checkSimpleWorkflowInstanceResponse(forDefinitionResult.getJSONObject(i));
}
// create a date an hour ago to test filtering
Calendar hourAgoCal = Calendar.getInstance();
hourAgoCal.setTime(dueDate);
hourAgoCal.add(Calendar.HOUR_OF_DAY, -1);
Date anHourAgo = hourAgoCal.getTime();
Calendar hourLater = Calendar.getInstance();
hourLater.setTime(dueDate);
hourLater.add(Calendar.HOUR_OF_DAY, 1);
Date anHourLater = hourLater.getTime();
// filter by initiator
checkFiltering(URL_WORKFLOW_INSTANCES + "?initiator=" + USER1);
// filter by startedAfter
checkFiltering(URL_WORKFLOW_INSTANCES + "?startedAfter=" + ISO8601DateFormat.format(anHourAgo));
// filter by startedBefore
checkFiltering(URL_WORKFLOW_INSTANCES + "?startedBefore=" + ISO8601DateFormat.format(anHourLater));
// filter by dueAfter
checkFiltering(URL_WORKFLOW_INSTANCES + "?dueAfter=" + ISO8601DateFormat.format(anHourAgo));
// filter by dueBefore
checkFiltering(URL_WORKFLOW_INSTANCES + "?dueBefore=" + ISO8601DateFormat.format(anHourLater));
if (adhocInstance.getEndDate() != null) {
// filter by completedAfter
checkFiltering(URL_WORKFLOW_INSTANCES + "?completedAfter=" + ISO8601DateFormat.format(adhocInstance.getEndDate()));
// filter by completedBefore
checkFiltering(URL_WORKFLOW_INSTANCES + "?completedBefore=" + ISO8601DateFormat.format(adhocInstance.getEndDate()));
}
// filter by priority
checkFiltering(URL_WORKFLOW_INSTANCES + "?priority=1");
// filter by state
checkFiltering(URL_WORKFLOW_INSTANCES + "?state=active");
// filter by definition name
checkFiltering(URL_WORKFLOW_INSTANCES + "?definitionName=" + getAdhocWorkflowDefinitionName());
// paging
int maxItems = 3;
for (int skipCount = 0; skipCount < totalItems; skipCount += maxItems) {
checkPaging(URL_WORKFLOW_INSTANCES + "?maxItems=" + maxItems + "&skipCount=" + skipCount, totalItems, maxItems, skipCount);
}
// check the exclude filtering
String exclude = getAdhocWorkflowDefinitionName();
response = sendRequest(new GetRequest(URL_WORKFLOW_INSTANCES + "?exclude=" + exclude), 200);
assertEquals(Status.STATUS_OK, response.getStatus());
jsonStr = response.getContentAsString();
json = new JSONObject(jsonStr);
JSONArray results = json.getJSONArray("data");
assertNotNull(results);
boolean adhocWorkflowPresent = false;
for (int i = 0; i < results.length(); i++) {
JSONObject workflowInstanceJSON = results.getJSONObject(i);
String type = workflowInstanceJSON.getString("name");
if (exclude.equals(type)) {
adhocWorkflowPresent = true;
break;
}
}
assertFalse("Found adhoc workflows when they were supposed to be excluded", adhocWorkflowPresent);
}
use of org.springframework.extensions.webscripts.TestWebScriptServer.Response in project alfresco-remote-api by Alfresco.
the class AbstractWorkflowRestApiTest method testWorkflowDefinitionsGet.
public void testWorkflowDefinitionsGet() throws Exception {
personManager.setUser(USER1);
Response response = sendRequest(new GetRequest(URL_WORKFLOW_DEFINITIONS), 200);
assertEquals(Status.STATUS_OK, response.getStatus());
JSONObject json = new JSONObject(response.getContentAsString());
JSONArray results = json.getJSONArray("data");
assertNotNull(results);
assertTrue(results.length() > 0);
boolean adhocWorkflowPresent = false;
String adhocDefName = getAdhocWorkflowDefinitionName();
for (int i = 0; i < results.length(); i++) {
JSONObject workflowDefinitionJSON = results.getJSONObject(i);
assertTrue(workflowDefinitionJSON.has("id"));
assertTrue(workflowDefinitionJSON.getString("id").length() > 0);
assertTrue(workflowDefinitionJSON.has("url"));
String url = workflowDefinitionJSON.getString("url");
assertTrue(url.length() > 0);
assertTrue(url.startsWith("api/workflow-definitions/"));
assertTrue(workflowDefinitionJSON.has("name"));
assertTrue(workflowDefinitionJSON.getString("name").length() > 0);
assertTrue(workflowDefinitionJSON.has("title"));
String title = workflowDefinitionJSON.getString("title");
assertTrue(title.length() > 0);
assertTrue(workflowDefinitionJSON.has("description"));
String description = workflowDefinitionJSON.getString("description");
assertTrue(description.length() > 0);
if (adhocDefName.equals(workflowDefinitionJSON.getString("name"))) {
assertEquals(getAdhocWorkflowDefinitionTitle(), title);
assertEquals(getAdhocWorkflowDefinitionDescription(), description);
adhocWorkflowPresent = true;
}
}
assertTrue("Adhoc workflow definition was not present!", adhocWorkflowPresent);
// filter the workflow definitions and check they are not returned
String exclude = adhocDefName;
response = sendRequest(new GetRequest(URL_WORKFLOW_DEFINITIONS + "?exclude=" + exclude), 200);
assertEquals(Status.STATUS_OK, response.getStatus());
json = new JSONObject(response.getContentAsString());
results = json.getJSONArray("data");
assertNotNull(results);
adhocWorkflowPresent = false;
for (int i = 0; i < results.length(); i++) {
JSONObject workflowDefinitionJSON = results.getJSONObject(i);
String name = workflowDefinitionJSON.getString("name");
if (exclude.equals(name)) {
adhocWorkflowPresent = true;
break;
}
}
assertFalse("Found adhoc workflow when it was supposed to be excluded", adhocWorkflowPresent);
// filter with a wildcard and ensure they all get filtered out
exclude = adhocDefName;
response = sendRequest(new GetRequest(URL_WORKFLOW_DEFINITIONS + "?exclude=" + exclude), 200);
assertEquals(Status.STATUS_OK, response.getStatus());
json = new JSONObject(response.getContentAsString());
results = json.getJSONArray("data");
assertNotNull(results);
adhocWorkflowPresent = false;
for (int i = 0; i < results.length(); i++) {
JSONObject workflowDefinitionJSON = results.getJSONObject(i);
String name = workflowDefinitionJSON.getString("name");
if (name.equals(adhocDefName)) {
adhocWorkflowPresent = true;
}
}
assertFalse("Found adhoc workflow when it was supposed to be excluded", adhocWorkflowPresent);
}
use of org.springframework.extensions.webscripts.TestWebScriptServer.Response in project alfresco-remote-api by Alfresco.
the class AbstractWorkflowRestApiTest method testTaskInstancesGet.
public void testTaskInstancesGet() throws Exception {
// Check USER2 starts with no tasks.
personManager.setUser(USER2);
Response response = sendRequest(new GetRequest(MessageFormat.format(URL_USER_TASKS, USER2)), 200);
assertEquals(Status.STATUS_OK, response.getStatus());
String jsonStr = response.getContentAsString();
JSONObject json = new JSONObject(jsonStr);
JSONArray results = json.getJSONArray("data");
assertNotNull(results);
assertTrue(results.length() == 0);
// Start workflow as USER1 and assign task to USER2.
personManager.setUser(USER1);
WorkflowDefinition adhocDef = workflowService.getDefinitionByName(getAdhocWorkflowDefinitionName());
Map<QName, Serializable> params = new HashMap<QName, Serializable>();
params.put(WorkflowModel.ASSOC_ASSIGNEE, personManager.get(USER2));
Calendar dueDateCal = Calendar.getInstance();
Date dueDate = dueDateCal.getTime();
params.put(WorkflowModel.PROP_DUE_DATE, dueDate);
params.put(WorkflowModel.PROP_PRIORITY, 1);
params.put(WorkflowModel.ASSOC_PACKAGE, packageRef);
WorkflowPath adhocPath = workflowService.startWorkflow(adhocDef.getId(), params);
String workflowId = adhocPath.getInstance().getId();
workflows.add(workflowId);
WorkflowTask startTask = workflowService.getStartTask(workflowId);
workflowService.endTask(startTask.getId(), null);
// Check USER2 now has one task.
List<WorkflowTask> tasks = workflowService.getAssignedTasks(USER2, WorkflowTaskState.IN_PROGRESS);
WorkflowTask task = tasks.get(0);
Map<QName, Serializable> updateParams = new HashMap<QName, Serializable>(1);
updateParams.put(WorkflowModel.PROP_DUE_DATE, new Date());
workflowService.updateTask(task.getId(), updateParams, null, null);
personManager.setUser(USER2);
response = sendRequest(new GetRequest(MessageFormat.format(URL_USER_TASKS, USER2)), 200);
jsonStr = response.getContentAsString();
json = new JSONObject(jsonStr);
results = json.getJSONArray("data");
assertNotNull(results);
assertTrue(results.length() == tasks.size());
JSONObject result = results.getJSONObject(0);
int totalItems = results.length();
String expUrl = "api/task-instances/" + task.getId();
assertEquals(expUrl, result.getString("url"));
assertEquals(task.getName(), result.getString("name"));
assertEquals(task.getTitle(), result.getString("title"));
assertEquals(task.getDescription(), result.getString("description"));
assertEquals(task.getState().name(), result.getString("state"));
assertEquals("api/workflow-paths/" + adhocPath.getId(), result.getString("path"));
assertFalse(result.getBoolean("isPooled"));
assertTrue(result.getBoolean("isEditable"));
assertTrue(result.getBoolean("isReassignable"));
assertFalse(result.getBoolean("isClaimable"));
assertFalse(result.getBoolean("isReleasable"));
JSONObject owner = result.getJSONObject("owner");
assertEquals(USER2, owner.getString("userName"));
assertEquals(personManager.getFirstName(USER2), owner.getString("firstName"));
assertEquals(personManager.getLastName(USER2), owner.getString("lastName"));
JSONObject properties = result.getJSONObject("properties");
assertNotNull(properties);
JSONObject instance = result.getJSONObject("workflowInstance");
assertNotNull(instance);
// Check state filtering
checkTasksState(URL_TASKS + "?state=completed", WorkflowTaskState.COMPLETED);
checkTasksState(URL_TASKS + "?state=in_progress", WorkflowTaskState.IN_PROGRESS);
// TODO: Add more tests to check pooled actors.
// Check for priority filtering
checkPriorityFiltering(URL_TASKS + "?priority=2");
// Due after yesterday, started task should be in it
dueDateCal.add(Calendar.DAY_OF_MONTH, -1);
checkTasksPresent(MessageFormat.format(URL_TASKS_DUE_AFTER, ISO8601DateFormat.format(dueDateCal.getTime())), true, task.getId());
// Due before yesterday, started task shouldn't be in it
checkTasksPresent(MessageFormat.format(URL_TASKS_DUE_BEFORE, ISO8601DateFormat.format(dueDateCal.getTime())), false, task.getId());
// Due before tomorrow, started task should be in it
dueDateCal.add(Calendar.DAY_OF_MONTH, 2);
checkTasksPresent(MessageFormat.format(URL_TASKS_DUE_BEFORE, ISO8601DateFormat.format(dueDateCal.getTime())), true, task.getId());
// Due after tomorrow, started task shouldn't be in it
checkTasksPresent(MessageFormat.format(URL_TASKS_DUE_AFTER, ISO8601DateFormat.format(dueDateCal.getTime())), false, task.getId());
// checkFiltering(URL_TASKS + "?dueAfter=" +
// ISO8601DateFormat.format(dueDate));
// checkFiltering(URL_TASKS + "?dueBefore=" +
// ISO8601DateFormat.format(new Date()));
// Check property filtering on the task assigned to USER2
String customProperties = "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
customProperties = "bpm_unexistingProperty,bpm_description,bpm_priority";
checkTaskPropertyFiltering(customProperties, Arrays.asList("bpm_description", "bpm_priority", "bpm_unexistingProperty"));
// Check paging
int maxItems = 3;
for (int skipCount = 0; skipCount < totalItems; skipCount += maxItems) {
// one of this should test situation when skipCount + maxItems >
// totalItems
checkPaging(MessageFormat.format(URL_USER_TASKS, USER2) + "&maxItems=" + maxItems + "&skipCount=" + skipCount, totalItems, maxItems, skipCount);
}
// testing when skipCount > totalItems
checkPaging(MessageFormat.format(URL_USER_TASKS, USER2) + "&maxItems=" + maxItems + "&skipCount=" + (totalItems + 1), totalItems, maxItems, totalItems + 1);
// check the exclude filtering
String exclude = "wf:submitAdhocTask";
response = sendRequest(new GetRequest(URL_TASKS + "?exclude=" + exclude), 200);
assertEquals(Status.STATUS_OK, response.getStatus());
jsonStr = response.getContentAsString();
json = new JSONObject(jsonStr);
results = json.getJSONArray("data");
assertNotNull(results);
boolean adhocTasksPresent = false;
for (int i = 0; i < results.length(); i++) {
JSONObject taskJSON = results.getJSONObject(i);
String type = taskJSON.getString("name");
if (exclude.equals(type)) {
adhocTasksPresent = true;
break;
}
}
assertFalse("Found wf:submitAdhocTask when they were supposed to be excluded", adhocTasksPresent);
// CLOUD-1928: Check skip-count works toghether with filter, start another process
personManager.setUser(USER1);
params.clear();
params.put(WorkflowModel.ASSOC_ASSIGNEE, personManager.get(USER2));
dueDateCal.add(Calendar.DAY_OF_YEAR, 2);
params.put(WorkflowModel.PROP_DUE_DATE, dueDateCal.getTime());
params.put(WorkflowModel.PROP_PRIORITY, 1);
params.put(WorkflowModel.ASSOC_PACKAGE, workflowService.createPackage(null));
WorkflowPath adhocPath2 = workflowService.startWorkflow(adhocDef.getId(), params);
String workflowId2 = adhocPath2.getInstance().getId();
workflows.add(workflowId2);
WorkflowTask startTask2 = workflowService.getStartTask(workflowId2);
workflowService.endTask(startTask2.getId(), null);
// Filter based on due-date and skip first result. Should return nothing instead of
// the second task, since only one matches and one is skipped
// Due after tomorrow, started task shouldn't be in it
String url = MessageFormat.format(URL_TASKS_DUE_AFTER_AND_SKIP, ISO8601DateFormat.format(dueDateCal.getTime()), 1);
json = getDataFromRequest(url);
JSONArray resultArray = json.getJSONArray("data");
assertEquals(0, resultArray.length());
}
Aggregations