Beispiel #1
0
  @Test
  public void testOnlyActiveTasks() {
    Task task =
        new TaskFluent()
            .setName("This is my task name")
            .addPotentialUser("salaboy")
            .setAdminUser("Administrator")
            .getTask();
    taskService.addTask(task, new HashMap<String, Object>());

    List<TaskSummary> allActiveTasks =
        taskService.getTasksAssignedAsPotentialOwner("salaboy", null, null, null);
    assertEquals(1, allActiveTasks.size());
    assertTrue(allActiveTasks.get(0).getStatusId().equals("Reserved"));
    QueryFilter queryFilter = new QueryFilter(0, 0);
    Map<String, Object> params = new HashMap<String, Object>();
    List<String> statuses = new ArrayList<String>();
    statuses.add(Status.Reserved.toString());
    params.put("statuses", statuses);
    queryFilter.setParams(params);
    List<AuditTask> allActiveAuditTasksByUser =
        taskAuditService.getAllAuditTasksByStatus("salaboy", queryFilter);
    assertEquals(1, allActiveAuditTasksByUser.size());
    assertTrue(allActiveAuditTasksByUser.get(0).getStatus().equals("Reserved"));

    statuses = new ArrayList<String>();
    statuses.add(Status.Completed.toString());
    params.put("statuses", statuses);
    queryFilter.setParams(params);
    allActiveAuditTasksByUser = taskAuditService.getAllAuditTasksByStatus("salaboy", queryFilter);
    assertEquals(0, allActiveAuditTasksByUser.size());
  }
 private QueryFilter addLanguageFilter(String language) {
   if (language == null) {
     return null;
   }
   QueryFilter filter = new QueryFilter();
   filter.setCount(null);
   filter.setOffset(null);
   filter.setLanguage(language);
   return filter;
 }