@Test
 public void testGetTasksWithFilter() throws Exception {
   List<Task> tasks = taskService.getTasks(TaskService.Filter.ALL);
   for (Task task : tasks) {
     assertNotNull(task);
     assertTrue(task.getId() > 0);
     assertNotNull(task.getName());
     assertNotNull(task.getDescription());
     assertNotNull(task.getTestSteps());
     assertNotNull(task.getCreator());
     assertNotNull(task.getAssignee());
     assertNotNull(task.getStatus());
     assertNotNull(task.getPriority());
     assertNotNull(task.getType());
   }
   tasks = taskService.getTasks(TaskService.Filter.CREATOR, "1");
   for (Task task : tasks) {
     assertNotNull(task);
     assertTrue(task.getId() > 0);
     assertNotNull(task.getName());
     assertNotNull(task.getDescription());
     assertNotNull(task.getTestSteps());
     assertNotNull(task.getCreator());
     assertNotNull(task.getAssignee());
     assertNotNull(task.getStatus());
     assertNotNull(task.getPriority());
     assertNotNull(task.getType());
   }
 }
Exemplo n.º 2
0
  @Override
  public void updateTask(Task task) {
    SQLiteDatabase db = null;
    try {
      db = DBHelper.getReadableDatabase();
      ContentValues taskValues = new ContentValues();
      taskValues.put(TasKingDBNames.TaskEntry.COLUMN_TASK_NAME, task.getName());
      taskValues.put(TasKingDBNames.TaskEntry.COLUMN_TASK_DATE, task.convertDateString());
      taskValues.put(TasKingDBNames.TaskEntry.COLUMN_TASK_TIME, task.convertTimeString());
      taskValues.put(TasKingDBNames.TaskEntry.COLUMN_TASK_CATEGORY, task.getCategory());
      taskValues.put(TasKingDBNames.TaskEntry.COLUMN_TASK_PRIORITY, task.getPriority());
      taskValues.put(TasKingDBNames.TaskEntry.COLUMN_TASK_LOCATION, task.getLocation());
      taskValues.put(TasKingDBNames.TaskEntry.COLUMN_TASK_STATUS, task.getStatus());
      taskValues.put(TasKingDBNames.TaskEntry.COLUMN_TASK_ASSIGNEE, task.getAssignee());
      taskValues.put(TasKingDBNames.TaskEntry.COLUMN_TASK_FIREBASE_ID, task.getFirebaseId());
      taskValues.put(TasKingDBNames.TaskEntry.COLUMN_TASK_PICTURE, task.getPicture());
      taskValues.put(TasKingDBNames.TaskEntry.COLUMN_TASK_ACCEPT_STATUS, task.getAcceptStatus());
      taskValues.put(
          TasKingDBNames.TaskEntry.COLUMN_TASK_TIME_STAMP,
          new SimpleDateFormat("yyyy-MM-dd HH:mm", Locale.US).format(new Date()));
      taskValues.put(TasKingDBNames.TaskEntry.COLUMN_TASK_MANAGER_ID, task.getManagerUid());
      taskValues.put(TasKingDBNames.TaskEntry.COLUMN_TASK_ASSIGNEE_ID, task.getAssigneeUid());
      db.update(
          TasKingDBNames.TaskEntry.TABLE_NAME,
          taskValues,
          TasKingDBNames.TaskEntry.COLUMN_TASK_FIREBASE_ID + "=?",
          new String[] {task.getFirebaseId()});

    } finally {
      if (db != null) {
        db.close();
      }
    }
  }
Exemplo n.º 3
0
  @Test
  public void createTasks() throws Exception {
    List<int[]> selectedCubes = new ArrayList<>();
    Statement stmt = f.createPrint(new True(), null);
    List<Task> tasks = f.createTasks("blub", 10, stmt, selectedCubes);

    assertEquals(1, tasks.size());
    assertEquals("blub", tasks.get(0).getName());
    assertEquals(10, tasks.get(0).getPriority());
    assertEquals(stmt, tasks.get(0).getActivity());
    assertEquals(null, tasks.get(0).getSelectedCube());

    selectedCubes.addAll(Arrays.asList(new int[] {0, 0, 0}, new int[] {1, 1, 1}));
    tasks = f.createTasks("test", 25, stmt, selectedCubes);

    assertEquals(2, tasks.size());
    for (Task t : tasks) {
      assertEquals("test", t.getName());
      assertEquals(25, t.getPriority());
      assertEquals(stmt, t.getActivity());
      assertTrue(
          t.getSelectedCube().equals(new Vector(0, 0, 0))
              || t.getSelectedCube().equals(new Vector(1, 1, 1)));
    }
  }
  @Test
  public void testCreateTask() throws Exception {
    TaskBuilder builder = taskService.createTask();
    builder.creator(user);
    builder.project(project);
    builder.name(name);
    builder.description(desc);
    builder.testSteps(teststeps);
    builder.type(type);
    builder.estimated(8);
    builder.priority(priority);
    Task task = builder.build();

    task.store();

    assertNotNull(task);
    assertTrue(task.getId() > 0);
    assertEquals(name, task.getName());
    assertEquals(desc, task.getDescription());
    assertEquals(teststeps, task.getTestSteps());
    assertEquals(user.getName(), task.getCreator().getName());
    assertEquals(user.getName(), task.getAssignee().getName());
    assertEquals("New", task.getStatus().getName());
    assertEquals(priority, task.getPriority());
    assertEquals(type, task.getType());
  }
  public List<TaskJAXB> generateJAXBObject(List<Task> taskModelList) {
    for (Task task : taskModelList) {
      TaskJAXB taskJAXB = new TaskJAXB();
      taskJAXB.setTaskId(task.getTaskId());
      taskJAXB.setTaskName(task.getTaskName());
      taskJAXB.setPriority(task.getPriority());
      taskJAXB.setStatus(task.getStatus());
      taskList.add(taskJAXB);
    }

    return taskList;
  }
 @Test
 public void testGetTaskByUserCommented() throws Exception {
   List<Task> tasks = taskService.getTaskByUserCommented(1);
   for (Task task : tasks) {
     assertNotNull(task);
     assertTrue(task.getId() > 0);
     assertNotNull(task.getName());
     assertNotNull(task.getDescription());
     assertNotNull(task.getTestSteps());
     assertNotNull(task.getCreator());
     assertNotNull(task.getAssignee());
     assertNotNull(task.getStatus());
     assertNotNull(task.getPriority());
     assertNotNull(task.getType());
   }
 }
 @Test
 public void testGetTaskByID() throws Exception {
   Optional<Task> optTask = taskService.getTaskByID(1);
   assertTrue(optTask.isPresent());
   Task task = optTask.get();
   assertNotNull(task);
   assertEquals(1, task.getId());
   assertNotNull(task.getName());
   assertNotNull(task.getDescription());
   assertNotNull(task.getTestSteps());
   assertNotNull(task.getCreator());
   assertNotNull(task.getAssignee());
   assertNotNull(task.getStatus());
   assertNotNull(task.getPriority());
   assertNotNull(task.getType());
 }
Exemplo n.º 8
0
  /**
   * Month conversion from entity object to jaxb model.
   *
   * @param data month entity object
   * @return jaxb model of month
   */
  public static Month transformMonthToModel(org.kaleta.scheduler.backend.entity.Month data) {
    Month model = new Month();

    model.setId(String.valueOf(data.getId()));

    Month.Specification specification = new Month.Specification();
    specification.setName(data.getName());
    specification.setDays(String.valueOf(data.getDaysNumber()));
    specification.setFirstDay(String.valueOf(data.getDayStartsWith()));
    for (Integer day : data.getPublicFreeDays()) {
      Month.Specification.FreeDay freeDay = new Month.Specification.FreeDay();
      freeDay.setDay(String.valueOf(day));
      specification.getFreeDayList().add(freeDay);
    }
    model.setSpecification(specification);

    Month.Schedule schedule = new Month.Schedule();
    for (Task task : data.getTasks()) {
      Month.Schedule.Task taskModel = new Month.Schedule.Task();
      taskModel.setId(String.valueOf(task.getId()));
      taskModel.setType(task.getType());
      taskModel.setDescription(task.getDescription());
      taskModel.setDay(String.valueOf(task.getDay()));
      taskModel.setStarts(task.getStarts().toString());
      taskModel.setDuration(task.getDuration().toString());
      taskModel.setPriority(String.valueOf(task.getPriority()));
      taskModel.setSuccessful(String.valueOf(task.getSuccessful()));
      schedule.getTaskList().add(taskModel);
    }
    model.setSchedule(schedule);

    Month.Accounting accounting = new Month.Accounting();
    for (Item item : data.getItems()) {
      Month.Accounting.Item itemModel = new Month.Accounting.Item();
      itemModel.setId(String.valueOf(item.getId()));
      itemModel.setType(item.getType());
      itemModel.setDescription(item.getDescription());
      itemModel.setDay(String.valueOf(item.getDay()));
      itemModel.setIncome(String.valueOf(item.getIncome()));
      itemModel.setAmount(String.valueOf(item.getAmount()));
      accounting.getItemList().add(itemModel);
    }
    model.setAccounting(accounting);

    return model;
  }
Exemplo n.º 9
0
 private TaskOrderInfo(Task t, long order) {
   this.created = t.getCreated();
   this.priority = t.getPriority();
   this.order = order;
   this.taskId = t.getId();
 }
Exemplo n.º 10
0
  public TaskScreen(Task task) {
    super(Manager.NO_VERTICAL_SCROLL | Manager.NO_VERTICAL_SCROLLBAR);

    internalManager =
        new VerticalFieldManager(Manager.NO_VERTICAL_SCROLL | Manager.NO_VERTICAL_SCROLLBAR);
    super.add(internalManager);
    internalManager.add(new TitleField(TaskUtils.getPath(task)));

    manager = new VerticalFieldManager(Manager.VERTICAL_SCROLL | Manager.VERTICAL_SCROLLBAR);
    internalManager.add(manager);

    this.task = task;

    Font bold = getFont().derive(Font.BOLD);

    HeaderLabel name = new HeaderLabel(task.getName());
    name.setFont(bold);
    RichTextField description =
        new RichTextField(task.getDescription()) {
          public void paint(Graphics graphics) {
            graphics.setColor(0x00777777);
            super.paint(graphics);
          }
        };

    add(name);

    if (task.getPriority() != Task.NORMAL_PRIORITY) {
      BitmapInput priority =
          new BitmapInput(
              "Priority",
              task.getPriority() == Task.LOW_PRIORITY ? "low_priority.png" : "high_priority");
      priority.setEditable(false);
      priority.setSelected(task.getPriority());
      add(priority);
    }

    String statusRes = "";
    switch (task.getStatus()) {
      case Task.NOT_STARTED:
        statusRes = ("not_started.png");
        break;
      case Task.IN_PROGRESS:
        statusRes = ("progress.png");
        break;
      case Task.WAITING:
        statusRes = ("waiting.png");
        break;
      case Task.DEFERRED:
        statusRes = ("deferred.png");
        break;
      case Task.COMPLETED:
        statusRes = ("completed.png");
        break;
    }
    status = new BitmapInput("Status", statusRes);
    status.setEditable(false);
    status.setSelected(task.getStatus());
    add(status);

    percent_complete =
        new BitmapInput(
            "Percent Complete", task.getPercentComplete() + "% Complete", "percent_complete.png");
    percent_complete.setEditable(false);
    add(percent_complete);

    BitmapInput tags = new BitmapInput("Tags", "tags.png");
    tags.setTextQuiet(TaskUtils.getTags(task));
    tags.setEditable(false);
    add(tags);

    if (task.getDescription().length() > 0) add(description);

    Font header = getFont().derive(Font.BOLD, getFont().getHeight() - 4);
    HeaderLabel l_dr = new HeaderLabel("Due Date");
    l_dr.setFont(header);
    BitmapInput dueDate = new BitmapInput("Due Date", "soon.png");
    if (task.getDateDue() > 0) {
      dueDate.setTextQuiet(
          "Due date: "
              + new SimpleDateFormat(DateFormat.DATETIME_DEFAULT).formatLocal(task.getDateDue()));
      System.out.println("REMINDER: " + task.getDateDue());
    } else dueDate.setTextQuiet("No due date set.");
    dueDate.setEditable(false);
    BitmapInput reminder = new BitmapInput("Reminder", "reminder.png");
    if (task.getReminder() > 0) {
      reminder.setTextQuiet(
          "Reminder: "
              + new SimpleDateFormat(DateFormat.DATETIME_DEFAULT)
                  .formatLocal(task.getDateDue() - (task.getReminder() * 1000)));
      System.out.println("REMINDER: " + task.getReminder());
    } else reminder.setTextQuiet("No reminder set.");
    reminder.setEditable(false);
    add(l_dr);
    add(dueDate);
    add(reminder);
    if (task.getDateDue() > 0) {
      BitmapInput viewInCalendar = new BitmapInput("View in Calendar", "today.png");
      viewInCalendar.setTask(task);
      add(viewInCalendar);
    }

    HeaderLabel l_notes = new HeaderLabel("Notes");
    l_notes.setFont(header);
    notes = new NoteManager(task);
    add(l_notes);
    add(notes);
  }
Exemplo n.º 11
0
 @Override
 public int compare(Task o1, Task o2) {
   return o1.getPriority() - o2.getPriority();
 }