Package com.pawelmaslyk.gerritintegration4sonar.sonar

Examples of com.pawelmaslyk.gerritintegration4sonar.sonar.SonarAnalysisResult


      return;
    }

    GerritCommit commit = GerritCommitFactory.createGerritCommitFromSonarSettings(settings);
    String dashboardUrl = getDashboardUrl(project);
    SonarAnalysisResult result = sonarResultEvaluator.getResult(context, dashboardUrl);

    if (commit instanceof EmptyGerritCommit) {
      logger.info("Gerrit has not been notified, because the commit information is missing, please check if all parameters are passed while running sonar");
      return;
    } else {
View Full Code Here


    GerritCommit commit = GerritCommitFactory.createGerritCommitFromSonarSettings("gerrit-integration-plugin", "1", "1");
    SshConnection ssh = SshConnectionFactory.getConnection(connection);

    //when
    //the analysis is run, the local sonar instance must be up
    final SonarAnalysisResult result = new SonarAnalysisResult("test", SonarAnalysisStatus.ERRORS);
    String codeReview = GerritCommand.createCodeReview(commit, result);
    ssh.executeCommand(codeReview);

    //then
View Full Code Here

    when(sshConnection.isSessionOpen()).thenReturn(true);
    when(SshConnectionFactory.getConnection((GerritConnection) any())).thenReturn(sshConnection);
    when(sshConnection.executeCommand(anyString())).thenReturn("OK");

    when(sonarResultEvaluator.getResult(context, URL)).thenReturn(
        new SonarAnalysisResult("message", SonarAnalysisStatus.NO_PROBLEMS));

    gerritNotifier.executeOn(project, context);

    // then
    verify(sshConnection).executeCommand(anyString());
View Full Code Here

    if (status == SonarAnalysisStatus.NO_PROBLEMS) {
      messageBuilder.append("  No alerts.");
    }
    messageBuilder.append(getIssuesMessage());

    return new SonarAnalysisResult(messageBuilder.toString(), status);
  }
View Full Code Here

    when(context.getMeasures((MeasuresFilter) anyObject())).thenReturn(
        Arrays.<Measure> asList(newMeasure(CoreMetrics.LINES, null, "Message1"),
            newMeasure(CoreMetrics.COVERAGE, Metric.Level.OK, "Message2"),
            newMeasure(CoreMetrics.CLASS_COMPLEXITY, Metric.Level.OK, "Message3")));

    SonarAnalysisResult result = sonarResultEvaluator.getResult(context, ADDRESS);

    assertEquals(SonarAnalysisStatus.NO_PROBLEMS, result.getStatus());
    assertEquals("Sonar analysis (" + ADDRESS + "):\n  No alerts.", result.getMessage());
  }
View Full Code Here

    when(context.getMeasures((MeasuresFilter) anyObject())).thenReturn(
        Arrays.<Measure> asList(newMeasure(CoreMetrics.LINES, Metric.Level.OK, "Message1"),
            newMeasure(CoreMetrics.COVERAGE, Metric.Level.WARN, "Coverage<80"),
            newMeasure(CoreMetrics.CLASS_COMPLEXITY, Metric.Level.OK, "Message2")));

    SonarAnalysisResult result = sonarResultEvaluator.getResult(context, ADDRESS);

    assertEquals(SonarAnalysisStatus.WARNINGS, result.getStatus());
    assertEquals("Sonar analysis (" + ADDRESS + "):\n  Warnings:\n    Coverage<80", result.getMessage());
  }
View Full Code Here

    when(context.getMeasures((MeasuresFilter) anyObject())).thenReturn(
        Arrays.<Measure> asList(newMeasure(CoreMetrics.LINES, Metric.Level.OK, "Message1"),
            newMeasure(CoreMetrics.COVERAGE, Metric.Level.ERROR, "Coverage<80"),
            newMeasure(CoreMetrics.CLASS_COMPLEXITY, Metric.Level.OK, "Message2")));

    SonarAnalysisResult result = sonarResultEvaluator.getResult(context, ADDRESS);

    assertEquals(SonarAnalysisStatus.ERRORS, result.getStatus());
    assertEquals("Sonar analysis (" + ADDRESS + "):\n  Errors:\n    Coverage<80", result.getMessage());
  }
View Full Code Here

    when(context.getMeasures((MeasuresFilter) anyObject())).thenReturn(
        Arrays.<Measure> asList(newMeasure(CoreMetrics.LINES, Metric.Level.OK, "Message1"),
            newMeasure(CoreMetrics.COVERAGE, Metric.Level.WARN, "Coverage<80"),
            newMeasure(CoreMetrics.CLASS_COMPLEXITY, Metric.Level.ERROR, "Complexity>20")));

    SonarAnalysisResult result = sonarResultEvaluator.getResult(context, ADDRESS);

    assertEquals(SonarAnalysisStatus.ERRORS, result.getStatus());
    assertEquals("Sonar analysis (" + ADDRESS + "):\n  Warnings:\n    Coverage<80\n  Errors:\n    Complexity>20",
        result.getMessage());
  }
View Full Code Here

    Issue issue = mock(Issue.class);
    when(issue.isNew()).thenReturn(false);
    issues.add(issue);
    when(projectIssues.issues()).thenReturn(issues);

    SonarAnalysisResult result = sonarResultEvaluator.getResult(context, ADDRESS);

    assertEquals(SonarAnalysisStatus.ERRORS, result.getStatus());
    assertEquals("Sonar analysis (" + ADDRESS + "):\n  Warnings:\n    Coverage<80\n  Errors:\n    Complexity>20",
        result.getMessage());
  }
View Full Code Here

    List<Issue> issues = new ArrayList<Issue>();
    issues.add(issue);
    when(projectIssues.issues()).thenReturn(issues);

    SonarAnalysisResult result = sonarResultEvaluator.getResult(context, ADDRESS);

    assertEquals(SonarAnalysisStatus.ERRORS, result.getStatus());
    assertEquals(
        "Sonar analysis ("
            + ADDRESS
            + "):\n  Warnings:\n    Coverage<80\n  Errors:\n    Complexity>20\nBLOCKER issues:\n  issue message\n    componentKey:12",
        result.getMessage());
  }
View Full Code Here

TOP

Related Classes of com.pawelmaslyk.gerritintegration4sonar.sonar.SonarAnalysisResult

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.