コード例 #1
0
 /** Uuids of all the components that have open issues on this project. */
 public Set<String> loadUuidsOfComponentsWithOpenIssues() {
   DbSession session = dbClient.openSession(false);
   try {
     return dbClient
         .issueDao()
         .selectComponentUuidsOfOpenIssuesForProjectUuid(
             session, treeRootHolder.getRoot().getUuid());
   } finally {
     MyBatis.closeQuietly(session);
   }
 }
コード例 #2
0
ファイル: DeleteActionTest.java プロジェクト: Godin/sonar
  private long insertNewProjectInDbAndReturnSnapshotId(int id) {
    String suffix = String.valueOf(id);
    ComponentDto project =
        ComponentTesting.newProjectDto("project-uuid-" + suffix).setKey("project-key-" + suffix);
    RuleDto rule = RuleTesting.newDto(RuleKey.of("sonarqube", "rule-" + suffix));
    dbClient.ruleDao().insert(dbSession, rule);
    IssueDto issue = IssueTesting.newDto(rule, project, project).setKee("issue-key-" + suffix);
    dbClient.componentDao().insert(dbSession, project);
    SnapshotDto snapshot =
        dbClient.snapshotDao().insert(dbSession, SnapshotTesting.newAnalysis(project));
    dbClient.issueDao().insert(dbSession, issue);
    dbSession.commit();

    return snapshot.getId();
  }
コード例 #3
0
ファイル: DeleteActionTest.java プロジェクト: Godin/sonar
  @Test
  public void delete_project_and_data_in_db_by_uuid() throws Exception {
    long snapshotId1 = insertNewProjectInDbAndReturnSnapshotId(1);
    long snapshotId2 = insertNewProjectInDbAndReturnSnapshotId(2);

    newRequest().setParam(PARAM_ID, "project-uuid-1").execute();
    dbSession.commit();

    assertThat(dbClient.componentDao().selectByUuid(dbSession, "project-uuid-1")).isAbsent();
    assertThat(dbClient.componentDao().selectOrFailByUuid(dbSession, "project-uuid-2")).isNotNull();
    assertThat(dbClient.snapshotDao().selectById(dbSession, snapshotId1)).isNull();
    assertThat(dbClient.snapshotDao().selectById(dbSession, snapshotId2)).isNotNull();
    assertThat(dbClient.issueDao().selectByKey(dbSession, "issue-key-1").isPresent()).isFalse();
    assertThat(dbClient.issueDao().selectOrFailByKey(dbSession, "issue-key-2")).isNotNull();
  }
コード例 #4
0
ファイル: IssueService.java プロジェクト: icloudkit/sonarqube
 IssueDto getByKeyForUpdate(DbSession session, String key) {
   // Load from index to check permission : if the user has no permission to see the issue an
   // exception will be generated
   Issue authorizedIssueIndex = getByKey(key);
   return dbClient.issueDao().selectOrFailByKey(session, authorizedIssueIndex.key());
 }