Package org.sonar.api.issue

Examples of org.sonar.api.issue.ActionPlan


    assertThat(issue.mustSendNotifications()).isFalse();
  }

  @Test
  public void plan_with_no_existing_plan() throws Exception {
    ActionPlan newActionPlan = DefaultActionPlan.create("newName");

    boolean updated = updater.plan(issue, newActionPlan, context);
    assertThat(updated).isTrue();
    assertThat(issue.actionPlanKey()).isEqualTo(newActionPlan.key());

    FieldDiffs.Diff diff = issue.currentChange().get(ACTION_PLAN);
    assertThat(diff.oldValue()).isEqualTo(UNUSED);
    assertThat(diff.newValue()).isEqualTo("newName");
    assertThat(issue.mustSendNotifications()).isTrue();
View Full Code Here


  @Test
  public void plan_with_existing_plan() throws Exception {
    issue.setActionPlanKey("formerActionPlan");

    ActionPlan newActionPlan = DefaultActionPlan.create("newName").setKey("newKey");

    boolean updated = updater.plan(issue, newActionPlan, context);
    assertThat(updated).isTrue();
    assertThat(issue.actionPlanKey()).isEqualTo(newActionPlan.key());

    FieldDiffs.Diff diff = issue.currentChange().get(ACTION_PLAN);
    assertThat(diff.oldValue()).isEqualTo(UNUSED);
    assertThat(diff.newValue()).isEqualTo("newName");
    assertThat(issue.mustSendNotifications()).isTrue();
View Full Code Here

  @Test
  public void not_plan_again() throws Exception {
    issue.setActionPlanKey("existingActionPlan");

    ActionPlan newActionPlan = DefaultActionPlan.create("existingActionPlan").setKey("existingActionPlan");

    boolean updated = updater.plan(issue, newActionPlan, context);
    assertThat(updated).isFalse();
    assertThat(issue.currentChange()).isNull();
    assertThat(issue.mustSendNotifications()).isFalse();
View Full Code Here

  @Override
  public boolean verify(Map<String, Object> properties, List<Issue> issues, UserSession userSession) {
    String actionPlanValue = planValue(properties);
    if (!Strings.isNullOrEmpty(actionPlanValue)) {
      ActionPlan actionPlan = selectActionPlan(actionPlanValue, userSession);
      if (actionPlan == null) {
        throw new IllegalArgumentException("Unknown action plan: " + actionPlanValue);
      }
      verifyIssuesAreAllRelatedOnActionPlanProject(issues, actionPlan);
      properties.put(VERIFIED_ACTION_PLAN, actionPlan);
View Full Code Here

  @Override
  public boolean execute(Map<String, Object> properties, Context context) {
    if(!properties.containsKey(VERIFIED_ACTION_PLAN)) {
      throw new IllegalArgumentException("Action plan is missing from the execution parameters");
    }
    ActionPlan actionPlan = (ActionPlan) properties.get(VERIFIED_ACTION_PLAN);
    return issueUpdater.plan((DefaultIssue) context.issue(), actionPlan, context.issueChangeContext());
  }
View Full Code Here

        json.prop(REPORTER_NAME_EXTRA_FIELD, user != null ? user.name() : null);
      }

      String actionPlanKey = issue.actionPlanKey();
      if (extraFields.contains(ACTION_PLAN_NAME_EXTRA_FIELD) && actionPlanKey != null) {
        ActionPlan actionPlan = actionPlanByKeys.get(actionPlanKey);
        json.prop(ACTION_PLAN_NAME_EXTRA_FIELD, actionPlan != null ? actionPlan.name() : null);
      }
    }
  }
View Full Code Here

  public Issue plan(String issueKey, @Nullable String actionPlanKey) {
    verifyLoggedIn();

    DbSession session = dbClient.openSession(false);
    try {
      ActionPlan actionPlan = null;
      if (!Strings.isNullOrEmpty(actionPlanKey)) {
        actionPlan = actionPlanService.findByKey(actionPlanKey, UserSession.get());
        if (actionPlan == null) {
          throw new NotFoundException("Unknown action plan: " + actionPlanKey);
        }
View Full Code Here

    Result result = service.createActionPlan(parameters);
    assertThat(result.ok()).isTrue();

    ArgumentCaptor<ActionPlan> actionPlanCaptor = ArgumentCaptor.forClass(ActionPlan.class);
    verify(actionPlanService).create(actionPlanCaptor.capture(), any(UserSession.class));
    ActionPlan actionPlan = actionPlanCaptor.getValue();

    assertThat(actionPlan).isNotNull();
    assertThat(actionPlan.key()).isNotNull();
    assertThat(actionPlan.name()).isEqualTo("Long term");
    assertThat(actionPlan.description()).isEqualTo("Long term issues");
    assertThat(actionPlan.deadLine()).isNotNull();
  }
View Full Code Here

    Result result = service.updateActionPlan("ABCD", parameters);
    assertThat(result.ok()).isTrue();

    ArgumentCaptor<ActionPlan> actionPlanCaptor = ArgumentCaptor.forClass(ActionPlan.class);
    verify(actionPlanService).update(actionPlanCaptor.capture(), any(UserSession.class));
    ActionPlan actionPlan = actionPlanCaptor.getValue();

    assertThat(actionPlan).isNotNull();
    assertThat(actionPlan.key()).isNotNull();
    assertThat(actionPlan.name()).isEqualTo("New Long term");
    assertThat(actionPlan.description()).isEqualTo("New Long term issues");
    assertThat(actionPlan.deadLine()).isNotNull();
  }
View Full Code Here

    ArgumentCaptor<ActionPlan> actionPlanCaptor = ArgumentCaptor.forClass(ActionPlan.class);
    Result result = service.updateActionPlan("ABCD", parameters);
    assertThat(result.ok()).isTrue();

    verify(actionPlanService).update(actionPlanCaptor.capture(), any(UserSession.class));
    ActionPlan actionPlan = actionPlanCaptor.getValue();

    assertThat(actionPlan).isNotNull();
    assertThat(actionPlan.key()).isNotNull();
    assertThat(actionPlan.name()).isEqualTo("New Long term");
    assertThat(actionPlan.description()).isEqualTo("New Long term issues");
    assertThat(actionPlan.deadLine()).isNotNull();
    assertThat(actionPlan.projectKey()).isEqualTo("org.sonar.MultiSample");
  }
View Full Code Here

TOP

Related Classes of org.sonar.api.issue.ActionPlan

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.