Package org.sonar.wsclient.issue

Examples of org.sonar.wsclient.issue.Issues


    final ImmutableList.Builder<Issue> builder = ImmutableList.builder();
    IssueQuery query = IssueQuery.create()
        .componentRoots(resourceKey)
        .resolved(false)
        .pageSize(-1);
    Issues issues = sonarClient.issueClient().find(query);
    builder.addAll(issues.list());
    for (int pageIndex = 2; pageIndex <= issues.paging().pages(); pageIndex++) {
      final ProgressIndicator progressIndicator = ProgressManager.getInstance().getProgressIndicator();
      if (progressIndicator.isCanceled())
        break;
      progressIndicator.setText2(pageIndex + " / " + issues.paging().pages());
      progressIndicator.setFraction(pageIndex * 1.0 / issues.paging().pages());

      query = IssueQuery.create()
          .componentRoots(resourceKey)
          .resolved(false)
          .pageSize(-1)
          .pageIndex(pageIndex);
      issues = sonarClient.issueClient().find(query);
      builder.addAll(issues.list());
    }
    return builder.build();
  }
View Full Code Here


  private static void testGetIssues() {
    SonarServer sonarServer = SonarServer.create("https://sonar.corp.mobile.de/sonar");
    final String resourceKey = "de.mobile.dealer:dealer-admin";
//    final String resourceKey = "de.mobile:mobile-multimodule-pom";
    final Issues issues = sonarServer.getIssuesFor(resourceKey);
    System.out.println(issues.size() + " issues for " + resourceKey + " | total: " + issues.paging().total() +
    " pages: " + issues.paging().pages() + " max results reached: " + issues.maxResultsReached());
  }
View Full Code Here

                client=SonarClient.builder().url(serverUrl).login(userCredentials.getUsername()).password(PassEncoder.decodeAsString(userCredentials.getPassword())).build();
            }
            IssueClient issueClient = client.issueClient();
            List<RadarIssue> issues=new LinkedList<>();
            Map<String, Rule> rulesCache=new HashMap<>();
            Issues result;
            int pageIndex=1;
            do{
                query.pageIndex(pageIndex);
                result = issueClient.find(query);
                for(Issue issue:result.list()) {
                    Rule rule = rulesCache.get(issue.ruleKey());
                    if(rule == null) {
                        rule=getRule(userCredentials, issue.ruleKey());
                        if(rule == null){
                            throw new IllegalStateException("No such rule in server: "+issue.ruleKey());
                        }
                        rulesCache.put(issue.ruleKey(), rule);
                    }
                    issues.add(new RadarIssue(issue, rule));
                }
                pageIndex++;
            }while(pageIndex <= result.paging().pages());
            return issues;
        }catch(HttpException ex) {
            if(ex.status() == UNAUTHORIZED_RESPONSE_STATUS){
                throw new AuthorizationException(ex);
            }else{
View Full Code Here

TOP

Related Classes of org.sonar.wsclient.issue.Issues

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.