Package com.sonyericsson.hudson.plugins.gerrit.gerritevents.ssh

Examples of com.sonyericsson.hudson.plugins.gerrit.gerritevents.ssh.SshConnection


      return;
    } else {

      logger.info(String.format("Sending results to gerrit for %s: %s", commit, result));

      SshConnection ssh = SshConnectionFactory.getConnection(connection);
      String command = GerritCommand.createCodeReview(commit, result);
      ssh.executeCommand(command);

      logger.info("Results sent successfully");
    }
  }
View Full Code Here


  public void testIfOneCanConnectToGerrit() throws IOException {

    //given
    GerritConnection connection = GerritConnectionFactory.createGerritConnection(authKey, authKeyPassword, userName, sshPort, hostName);
    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

    settings.appendProperty(GerritCommit.GERRIT_PATCH_KEY, "2");

    GerritNotifier gerritNotifier = new GerritNotifier(settings, server, sonarResultEvaluator);

    mockStatic(SshConnectionFactory.class);
    SshConnection sshConnection = mock(SshConnection.class);

    // when
    when(sshConnection.isConnected()).thenReturn(true);
    when(sshConnection.isAuthenticated()).thenReturn(true);
    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);
View Full Code Here

TOP

Related Classes of com.sonyericsson.hudson.plugins.gerrit.gerritevents.ssh.SshConnection

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.