Package org.sonar.api.utils.command

Examples of org.sonar.api.utils.command.StreamConsumer


    when(commandExecutor.execute(any(Command.class), any(StreamConsumer.class), any(StreamConsumer.class), anyLong())).thenAnswer(new Answer<Integer>() {

      @Override
      public Integer answer(InvocationOnMock invocation) throws Throwable {
        StreamConsumer outConsumer = (StreamConsumer) invocation.getArguments()[1];
        List<String> lines = IOUtils.readLines(getClass().getResourceAsStream("/blame.xml"), "UTF-8");
        for (String line : lines) {
          outConsumer.consumeLine(line);
        }
        return 0;
      }
    });
View Full Code Here


    when(commandExecutor.execute(any(Command.class), any(StreamConsumer.class), any(StreamConsumer.class), anyLong())).thenAnswer(new Answer<Integer>() {

      @Override
      public Integer answer(InvocationOnMock invocation) throws Throwable {
        StreamConsumer outConsumer = (StreamConsumer) invocation.getArguments()[1];
        List<String> lines = IOUtils.readLines(getClass().getResourceAsStream("/blame-with-anonymous-commit.xml"), "UTF-8");
        for (String line : lines) {
          outConsumer.consumeLine(line);
        }
        return 0;
      }
    });
View Full Code Here

    when(commandExecutor.execute(any(Command.class), any(StreamConsumer.class), any(StreamConsumer.class), anyLong())).thenAnswer(new Answer<Integer>() {

      @Override
      public Integer answer(InvocationOnMock invocation) throws Throwable {
        StreamConsumer outConsumer = (StreamConsumer) invocation.getArguments()[1];
        List<String> lines = IOUtils.readLines(getClass().getResourceAsStream("/blame-with-merge-history.xml"), "UTF-8");
        for (String line : lines) {
          outConsumer.consumeLine(line);
        }
        return 0;
      }
    });
View Full Code Here

    when(commandExecutor.execute(any(Command.class), any(StreamConsumer.class), any(StreamConsumer.class), anyLong())).thenAnswer(new Answer<Integer>() {

      @Override
      public Integer answer(InvocationOnMock invocation) throws Throwable {
        StreamConsumer outConsumer = (StreamConsumer) invocation.getArguments()[1];
        List<String> lines = IOUtils.readLines(getClass().getResourceAsStream("/blame-with-uncomitted-changes.xml"), "UTF-8");
        for (String line : lines) {
          outConsumer.consumeLine(line);
        }
        return 0;
      }
    });
View Full Code Here

    when(commandExecutor.execute(any(Command.class), any(StreamConsumer.class), any(StreamConsumer.class), anyLong())).thenAnswer(new Answer<Integer>() {

      @Override
      public Integer answer(InvocationOnMock invocation) throws Throwable {
        StreamConsumer errConsumer = (StreamConsumer) invocation.getArguments()[2];
        errConsumer.consumeLine("My error");
        return 1;
      }
    });

    thrown.expect(IllegalStateException.class);
View Full Code Here

    when(commandExecutor.execute(any(Command.class), any(StreamConsumer.class), any(StreamConsumer.class), anyLong())).thenAnswer(new Answer<Integer>() {

      @Override
      public Integer answer(InvocationOnMock invocation) throws Throwable {
        StreamConsumer outConsumer = (StreamConsumer) invocation.getArguments()[1];
        outConsumer.consumeLine("2c68c473da7fc293e12ca50f19380c5118be7ead 68 54 1");
        outConsumer.consumeLine("author Simon Brandhof");
        outConsumer.consumeLine("author-mail <simon.brandhof@gmail.com>");
        outConsumer.consumeLine("author-time 1312534171");
        outConsumer.consumeLine("author-tz +0200");
        outConsumer.consumeLine("committer Simon Brandhof");
        outConsumer.consumeLine("committer-mail <simon.brandhof@gmail.com>");
        outConsumer.consumeLine("committer-time 1312534171");
        outConsumer.consumeLine("committer-tz +0200");
        outConsumer.consumeLine("summary Move to nexus.codehaus.org + configuration of maven release plugin is back");
        outConsumer.consumeLine("previous 1bec1c3a77f6957175be13e4433110f7fc8e387e pom.xml");
        outConsumer.consumeLine("filename pom.xml");
        outConsumer.consumeLine("\t<id>codehaus-nexus-staging</id>");
        outConsumer.consumeLine("2c68c473da7fc293e12ca50f19380c5118be7ead 72 60 1");
        outConsumer.consumeLine("\t<url>${sonar.snapshotRepository.url}</url>");
        return 0;
      }
    });
    when(input.filesToBlame()).thenReturn(Arrays.<InputFile>asList(inputFile));
    new GitBlameCommand(commandExecutor).blame(input, result);
View Full Code Here

    when(commandExecutor.execute(any(Command.class), any(StreamConsumer.class), any(StreamConsumer.class), anyLong())).thenAnswer(new Answer<Integer>() {

      @Override
      public Integer answer(InvocationOnMock invocation) throws Throwable {
        StreamConsumer outConsumer = (StreamConsumer) invocation.getArguments()[1];
        outConsumer.consumeLine("000000000000000000000000000000000000000 68 54 1");
        outConsumer.consumeLine("author Not Committed Yet");
        outConsumer.consumeLine("author-mail <not.committed.yet>");
        outConsumer.consumeLine("author-time 1312534171");
        outConsumer.consumeLine("author-tz +0200");
        outConsumer.consumeLine("committer Not Committed Yet");
        outConsumer.consumeLine("committer-mail <not.committed.yet>");
        outConsumer.consumeLine("committer-time 1312534171");
        outConsumer.consumeLine("committer-tz +0200");
        outConsumer.consumeLine("summary Move to nexus.codehaus.org + configuration of maven release plugin is back");
        outConsumer.consumeLine("previous 1bec1c3a77f6957175be13e4433110f7fc8e387e pom.xml");
        outConsumer.consumeLine("filename pom.xml");
        outConsumer.consumeLine("\t<id>codehaus-nexus-staging</id>");
        outConsumer.consumeLine("2c68c473da7fc293e12ca50f19380c5118be7ead 72 60 1");
        outConsumer.consumeLine("\t<url>${sonar.snapshotRepository.url}</url>");
        return 0;
      }
    });

    thrown.expect(IllegalStateException.class);
View Full Code Here

    when(commandExecutor.execute(any(Command.class), any(StreamConsumer.class), any(StreamConsumer.class), anyLong())).thenAnswer(new Answer<Integer>() {

      @Override
      public Integer answer(InvocationOnMock invocation) throws Throwable {
        StreamConsumer errConsumer = (StreamConsumer) invocation.getArguments()[2];
        errConsumer.consumeLine("My error");
        return 1;
      }
    });

    thrown.expect(IllegalStateException.class);
View Full Code Here

TOP

Related Classes of org.sonar.api.utils.command.StreamConsumer

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.