Exemplo n.º 1
0
  public String createCustomFieldTask() throws Exception {
    final TaskMapping taskMappingInit =
        new TaskMapping() {

          @Override
          public String getProduct() {
            return "ManualTest";
          }
        };
    final TaskMapping taskMappingSelect =
        new TaskMapping() {
          @Override
          public String getComponent() {
            return "ManualC2";
          }

          @Override
          public String getSummary() {
            return "test Bug with Custom Fields";
          }

          @Override
          public String getDescription() {
            return "The Description of the test with Custom Fields Bug";
          }
        };

    // create Task
    TaskData taskDataNew = createTaskData(taskMappingInit, taskMappingSelect, null);
    RepositoryResponse response = createNewTask(taskDataNew);
    assertNotNull(response);
    assertEquals(ResponseKind.TASK_CREATED.toString(), response.getReposonseKind().toString());
    String taskId = response.getTaskId();

    ITask task = getTask(taskId);
    assertNotNull(task);
    TaskData taskData = fixture.connector().getTaskData(repository(), task.getTaskId(), null);
    assertNotNull(taskData);

    TaskMapper mapper = new TaskMapper(taskData);
    TaskAttribute cf_multiselect = mapper.getTaskData().getRoot().getAttribute("cf_multiselect");
    cf_multiselect.setValue("Green");
    response = fixture.submitTask(taskData, priviledgedClient());

    return taskId;
  }
 @Override
 public boolean initializeTaskData(
     TaskRepository repository,
     TaskData data,
     ITaskMapping initializationData,
     IProgressMonitor monitor)
     throws CoreException {
   TaskMapper mapper = this.connector.getTaskMapping(data);
   mapper.setCreationDate(new Date());
   mapper.setDescription("");
   mapper.setModificationDate(mapper.getCreationDate());
   mapper.setOwner("");
   mapper.setProduct("Product1");
   mapper.setReporter("");
   mapper.setStatus("NEW");
   mapper.setSummary("");
   return true;
 }