@Test public void testStatusUpdate() { int taskId = 1; // status update String status = "IN_PROGRESS"; Task task = taskManager.readTask(taskId); task.setStatus(TaskStatus.valueOf(status)); User createdBy = userServiceManager.readUser(1); task.setCreatedByUser(createdBy); taskManager.updateTask(task); Task updatedTask = taskManager.readTask(taskId); assertEquals(TaskStatus.IN_PROGRESS, updatedTask.getStatus()); }
@Test public void testTaskCreate() { String storyId = "1"; String username = "******"; String assignee = null; String timeInDays = "1"; String milestonePeriod = "1"; // fetch the task count and compare in the end of it succeeds- no method currently to get // the count or taskId Task task = new Task(); List<Task> result = new ArrayList<Task>(); try { User createdBy = userServiceManager.readUser(username); task.setContent("teste"); task.setCreatedByUser(createdBy); // if(milestonePeriod != null) task.setMilestonePeriod(milestonePeriod); // if(timeInDays != null) task.setTimeInDays(Integer.parseInt(timeInDays)); User assigneeUser = userServiceManager.readUser(assignee); if (assigneeUser != null) task.setUser(assigneeUser); // independent task support is ok if (storyId != null) task.setStory(storyManager.readStory(Integer.parseInt(storyId))); taskManager.createTask(task); } catch (Exception e) { e.printStackTrace(); // return result; } }
private void debug(List tasks) { logger.info("tasks size:", tasks.size()); for (Iterator iterator = tasks.iterator(); iterator.hasNext(); ) { // Object[] object = (Object[]) iterator.next(); Object object = (Object) iterator.next(); // System.out.println(object.getClass().getSimpleName()); // Task task = (Task) object[0]; Task task = (Task) object; // System.out.println(object[1].getClass().getSimpleName()); // Long sum = (Long) object[1]; // System.out.println(object.getClass().getSimpleName()); if (task != null) { User user = task.getUser(); if (user != null) logger.info("createdBy to : " + user.getDisplayname()); logger.info( "createdBy:" + user + " Days: " + task.getTimeInDays() + " Primary Key" + task.getPkey() + "content" + task.getContent() + "status:" + task.getStatus()); } // System.out.println("Sum:" + sum); // System.out.println("Status" + (TaskStatus) object[3]); } }