Package org.sonar.core.issue.db

Examples of org.sonar.core.issue.db.IssueDto


    Assertions.assertThat(result.get(2).getIssueCloseDate()).isEqualTo(date1);
  }

  @Test
  public void should_not_sort_with_null_sort() {
    IssueDto issue1 = new IssueDto().setId(1L).setAssignee("perceval");
    IssueDto issue2 = new IssueDto().setId(2L).setAssignee("arthur");
    IssueDto issue3 = new IssueDto().setId(3L).setAssignee("vincent");
    IssueDto issue4 = new IssueDto().setId(4L).setAssignee(null);
    List<IssueDto> dtoList = newArrayList(issue1, issue2, issue3, issue4);

    IssueQuery query = IssueQuery.builder().sort(null).build();
    IssuesFinderSort issuesFinderSort = new IssuesFinderSort(dtoList, query);
View Full Code Here


    session.close();
  }

  @Test
  public void get_by_key() throws Exception {
    IssueDto issue = newIssue();
    tester.get(IssueDao.class).insert(session, issue);
    session.commit();

    assertThat(service.getByKey(issue.getKey())).isNotNull();
  }
View Full Code Here

    assertThat(service.getByKey(issue.getKey())).isNotNull();
  }

  @Test
  public void can_facet() throws Exception {
    IssueDto issue1 = newIssue().setActionPlanKey("P1");
    IssueDto issue2 = newIssue().setActionPlanKey("P2").setResolution("NONE");
    tester.get(IssueDao.class).insert(session, issue1, issue2);
    session.commit();

    org.sonar.server.search.Result<Issue> result = service.search(IssueQuery.builder().build(), new QueryContext());
    assertThat(result.getHits()).hasSize(2);
View Full Code Here

    assertThat(service.listStatus()).containsExactly("OPEN", "CONFIRMED", "REOPENED", "RESOLVED", "CLOSED");
  }

  @Test
  public void list_transitions() {
    IssueDto issue = newIssue().setStatus(Issue.STATUS_RESOLVED).setResolution(Issue.RESOLUTION_FALSE_POSITIVE);
    tester.get(IssueDao.class).insert(session, issue);
    session.commit();

    List<Transition> result = service.listTransitions(issue.getKey());
    assertThat(result).hasSize(1);
    assertThat(result.get(0).key()).isEqualTo("reopen");
  }
View Full Code Here

    assertThat(result.get(0).key()).isEqualTo("reopen");
  }

  @Test
  public void do_transition() {
    IssueDto issue = newIssue().setStatus(Issue.STATUS_OPEN);
    tester.get(IssueDao.class).insert(session, issue);
    session.commit();

    assertThat(db.issueDao().getByKey(session, issue.getKey())).isNotNull();
    IssueTesting.assertIsEquivalent(issue, (IssueDoc) indexClient.get(IssueIndex.class).getByKey(issue.getKey()));

    assertThat(indexClient.get(IssueIndex.class).getByKey(issue.getKey()).status()).isEqualTo(Issue.STATUS_OPEN);

    service.doTransition(issue.getKey(), DefaultTransitions.CONFIRM);

    assertThat(indexClient.get(IssueIndex.class).getByKey(issue.getKey()).status()).isEqualTo(Issue.STATUS_CONFIRMED);
  }
View Full Code Here

    assertThat(indexClient.get(IssueIndex.class).getByKey(issue.getKey()).status()).isEqualTo(Issue.STATUS_CONFIRMED);
  }

  @Test
  public void assign() {
    IssueDto issue = newIssue();
    tester.get(IssueDao.class).insert(session, issue);

    UserDto user = new UserDto().setLogin("perceval").setName("Perceval");
    db.userDao().insert(session, user);
    session.commit();

    assertThat(indexClient.get(IssueIndex.class).getByKey(issue.getKey()).assignee()).isNull();

    service.assign(issue.getKey(), user.getLogin());

    assertThat(indexClient.get(IssueIndex.class).getByKey(issue.getKey()).assignee()).isEqualTo("perceval");
  }
View Full Code Here

    assertThat(indexClient.get(IssueIndex.class).getByKey(issue.getKey()).assignee()).isEqualTo("perceval");
  }

  @Test
  public void un_assign() {
    IssueDto issue = newIssue().setAssignee("perceval");
    tester.get(IssueDao.class).insert(session, issue);

    UserDto user = new UserDto().setLogin("perceval").setName("Perceval");
    db.userDao().insert(session, user);
    session.commit();

    assertThat(indexClient.get(IssueIndex.class).getByKey(issue.getKey()).assignee()).isEqualTo("perceval");

    service.assign(issue.getKey(), "");

    assertThat(indexClient.get(IssueIndex.class).getByKey(issue.getKey()).assignee()).isNull();
  }
View Full Code Here

    assertThat(indexClient.get(IssueIndex.class).getByKey(issue.getKey()).assignee()).isNull();
  }

  @Test
  public void fail_to_assign_on_unknown_user() {
    IssueDto issue = newIssue();
    tester.get(IssueDao.class).insert(session, issue);
    session.commit();

    try {
      service.assign(issue.getKey(), "unknown");
      fail();
    } catch (Exception e) {
      assertThat(e).isInstanceOf(NotFoundException.class).hasMessage("Unknown user: unknown");
    }
  }
View Full Code Here

    }
  }

  @Test
  public void plan() {
    IssueDto issue = newIssue();
    tester.get(IssueDao.class).insert(session, issue);

    String actionPlanKey = "EFGH";
    db.actionPlanDao().save(new ActionPlanDto().setKey(actionPlanKey).setProjectId(project.getId()));
    session.commit();

    assertThat(indexClient.get(IssueIndex.class).getByKey(issue.getKey()).actionPlanKey()).isNull();

    service.plan(issue.getKey(), actionPlanKey);

    assertThat(indexClient.get(IssueIndex.class).getByKey(issue.getKey()).actionPlanKey()).isEqualTo(actionPlanKey);
  }
View Full Code Here

  @Test
  public void un_plan() {
    String actionPlanKey = "EFGH";
    db.actionPlanDao().save(new ActionPlanDto().setKey(actionPlanKey).setProjectId(project.getId()));

    IssueDto issue = newIssue().setActionPlanKey(actionPlanKey);
    tester.get(IssueDao.class).insert(session, issue);
    session.commit();

    assertThat(indexClient.get(IssueIndex.class).getByKey(issue.getKey()).actionPlanKey()).isEqualTo(actionPlanKey);

    service.plan(issue.getKey(), null);

    assertThat(indexClient.get(IssueIndex.class).getByKey(issue.getKey()).actionPlanKey()).isNull();
  }
View Full Code Here

TOP

Related Classes of org.sonar.core.issue.db.IssueDto

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.