Examples of ActionPlan


Examples of org.sonar.api.issue.ActionPlan

    json.endObject().endObject().close();
  }

  private void writeIssue(DbSession session, Issue issue, JsonWriter json) {
    String actionPlanKey = issue.actionPlanKey();
    ActionPlan actionPlan = actionPlanKey != null ? actionPlanService.findByKey(actionPlanKey, UserSession.get()) : null;
    Duration debt = issue.debt();
    Rule rule = ruleService.getNonNullByKey(issue.ruleKey());
    Date updateDate = issue.updateDate();
    Date closeDate = issue.closeDate();

    json
      .prop("key", issue.key())
      .prop("rule", issue.ruleKey().toString())
      .prop("ruleName", rule.name())
      .prop("line", issue.line())
      .prop("message", issue.message())
      .prop("resolution", issue.resolution())
      .prop("status", issue.status())
      .prop("severity", issue.severity())
      .prop("author", issue.authorLogin())
      .prop("actionPlan", actionPlanKey)
      .prop("actionPlanName", actionPlan != null ? actionPlan.name() : null)
      .prop("debt", debt != null ? durations.encode(debt) : null)
      .prop("creationDate", DateUtils.formatDateTime(issue.creationDate()))
      .prop("fCreationDate", formatDate(issue.creationDate()))
      .prop("updateDate", updateDate != null ? DateUtils.formatDateTime(updateDate) : null)
      .prop("fUpdateDate", formatDate(updateDate))
View Full Code Here

Examples of org.sonar.api.issue.ActionPlan

    action = new PlanAction(actionPlanService, issueUpdater);
  }

  @Test
  public void should_execute(){
    ActionPlan actionPlan = new DefaultActionPlan();
    Map<String, Object> properties = newHashMap();
    properties.put(PlanAction.VERIFIED_ACTION_PLAN, actionPlan);
    DefaultIssue issue = mock(DefaultIssue.class);

    Action.Context context = mock(Action.Context.class);
View Full Code Here

Examples of org.sonar.api.issue.ActionPlan

  @Test
  public void should_verify(){
    String planKey = "ABCD";
    Map<String, Object> properties = newHashMap();
    properties.put("plan", planKey);
    ActionPlan actionPlan = new DefaultActionPlan().setProjectKey("struts");

    List<Issue> issues = newArrayList((Issue) new DefaultIssue().setKey("ABC").setProjectKey("struts"));
    when(actionPlanService.findByKey(eq(planKey), any(UserSession.class))).thenReturn(actionPlan);
    assertThat(action.verify(properties, issues, mock(UserSession.class))).isTrue();
    assertThat(properties.get(PlanAction.VERIFIED_ACTION_PLAN)).isEqualTo(actionPlan);
View Full Code Here

Examples of org.sonar.api.issue.ActionPlan

  }

  @Test
  public void create() {
    when(resourceDao.getResource(any(ResourceQuery.class))).thenReturn(new ResourceDto().setKey(projectKey).setId(1l));
    ActionPlan actionPlan = DefaultActionPlan.create("Long term");

    actionPlanService.create(actionPlan, projectAdministratorUserSession);
    verify(actionPlanDao).save(any(ActionPlanDto.class));
  }
View Full Code Here

Examples of org.sonar.api.issue.ActionPlan

  }

  @Test
  public void create_required_admin_role() {
    when(resourceDao.getResource(any(ResourceQuery.class))).thenReturn(new ResourceDto().setKey(projectKey).setId(1l));
    ActionPlan actionPlan = DefaultActionPlan.create("Long term");

    try {
      actionPlanService.create(actionPlan, unauthorizedUserSession);
      Fail.fail();
    } catch (Exception e) {
View Full Code Here

Examples of org.sonar.api.issue.ActionPlan

  @Test
  public void set_status() {
    when(actionPlanDao.findByKey("ABCD")).thenReturn(new ActionPlanDto().setKey("ABCD").setProjectKey_unit_test_only(projectKey));
    when(resourceDao.getResource(any(ResourceQuery.class))).thenReturn(new ResourceDto().setKey(projectKey).setId(1l));

    ActionPlan result = actionPlanService.setStatus("ABCD", "CLOSED", projectAdministratorUserSession);
    verify(actionPlanDao).update(any(ActionPlanDto.class));

    assertThat(result).isNotNull();
    assertThat(result.status()).isEqualTo("CLOSED");
  }
View Full Code Here

Examples of org.sonar.api.issue.ActionPlan

  }

  @Test
  public void update() {
    when(resourceDao.getResource(any(ResourceQuery.class))).thenReturn(new ResourceDto().setKey(projectKey).setId(1l));
    ActionPlan actionPlan = DefaultActionPlan.create("Long term");

    actionPlanService.update(actionPlan, projectAdministratorUserSession);
    verify(actionPlanDao).update(any(ActionPlanDto.class));
  }
View Full Code Here

Examples of org.sonar.api.issue.ActionPlan

  @Test
  public void find_by_key() {
    when(actionPlanDao.findByKey("ABCD")).thenReturn(new ActionPlanDto().setKey("ABCD").setProjectKey_unit_test_only(projectKey));
    when(resourceDao.getResource(any(ResourceQuery.class))).thenReturn(new ResourceDto().setKey(projectKey).setId(1l));

    ActionPlan result = actionPlanService.findByKey("ABCD", projectUserSession);
    assertThat(result).isNotNull();
    assertThat(result.key()).isEqualTo("ABCD");
  }
View Full Code Here

Examples of org.sonar.wsclient.issue.ActionPlan

    @Override
    public Component getListCellRendererComponent(JList<?> list, Object value, int index, boolean isSelected, boolean hasFocus) {
        JLabel label = (JLabel) super.getListCellRendererComponent(list, value, index, isSelected, hasFocus);
        if (value instanceof ActionPlan) {
            ActionPlan actionPlan = (ActionPlan) value;
            DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.MEDIUM);
            label.setText(actionPlan.name() + " - " + dateFormat.format((actionPlan).deadLine()));
        }
        return label;
    }
View Full Code Here

Examples of org.sonar.wsclient.issue.ActionPlan

    ActionPlanClient client = new DefaultActionPlanClient(requestFactory);
    List<ActionPlan> actionPlans = client.find("com.sonarsource.it.samples:simple-sample");

    assertThat(httpServer.requestedPath()).isEqualTo("/api/action_plans/search?project=com.sonarsource.it.samples:simple-sample");
    assertThat(actionPlans).hasSize(1);
    ActionPlan actionPlan = actionPlans.get(0);
    assertThat(actionPlan.key()).isEqualTo("382f6f2e-ad9d-424a-b973-9b065e04348a");
    assertThat(actionPlan.name()).isEqualTo("Long term");
    assertThat(actionPlan.description()).isEqualTo("Long term acton plan");
    assertThat(actionPlan.project()).isEqualTo("com.sonarsource.it.samples:simple-sample");
    assertThat(actionPlan.status()).isEqualTo("CLOSED");
    assertThat(actionPlan.userLogin()).isEqualTo("admin");
    assertThat(actionPlan.deadLine()).isNotNull();
    assertThat(actionPlan.totalIssues()).isEqualTo(3);
    assertThat(actionPlan.unresolvedIssues()).isEqualTo(2);
    assertThat(actionPlan.createdAt()).isNotNull();
    assertThat(actionPlan.updatedAt()).isNotNull();
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.