use of com.thoughtworks.go.util.command.ConsoleResult in project gocd by gocd.
the class P4OutputParserTest method shouldParseCommentWithAffectedFilesCorrectly.
@Test
void shouldParseCommentWithAffectedFilesCorrectly() throws P4OutputParseException {
String description = "Change 5 by cceuser@CceDev01 on 2009/08/06 14:21:30\n" + "\n" + "\tAffected files ...\n" + "\t\n" + "\t... //DEPOT/FILE#943 edit\n" + "\n" + "Affected files ...\n" + "\n" + "... //depot/file#5 edit";
Modification modification = parser.modificationFromDescription(description, new ConsoleResult(0, new ArrayList<>(), new ArrayList<>(), new ArrayList<>(), new ArrayList<>()));
assertThat(modification.getComment()).isEqualTo("Affected files ...\n" + "\n" + "... //DEPOT/FILE#943 edit");
}
use of com.thoughtworks.go.util.command.ConsoleResult in project gocd by gocd.
the class P4OutputParserTest method shouldMatchWhenCommentsAreMultipleLines.
@Test
void shouldMatchWhenCommentsAreMultipleLines() throws P4OutputParseException, ParseException {
Modification modification = parser.modificationFromDescription(BUG_2503_OUTPUT, new ConsoleResult(0, new ArrayList<>(), new ArrayList<>(), new ArrayList<>(), new ArrayList<>()));
assertThat(parser.revisionFromChange(BUG_2503_OUTPUT)).isEqualTo(122636L);
assertThat(modification.getModifiedTime()).isEqualTo(DESCRIPTION_FORMAT.parse("2009/02/06 17:53:57"));
assertThat(modification.getModifiedFiles().size()).isEqualTo(1);
assertThat(modification.getUserName()).isEqualTo("ipaipa@ipaipa-STANDARD-DHTML");
}
use of com.thoughtworks.go.util.command.ConsoleResult in project gocd by gocd.
the class P4OutputParserTest method shouldThrowExceptionWhenCannotParseChanges.
@Test
void shouldThrowExceptionWhenCannotParseChanges() {
String line = "Some line I don't understand";
try {
parser.modificationFromDescription(line, new ConsoleResult(0, new ArrayList<>(), new ArrayList<>(), new ArrayList<>(), new ArrayList<>()));
fail("Should throw exception if can't parse the description");
} catch (P4OutputParseException expected) {
assertThat(expected.getMessage()).contains(line);
}
}
use of com.thoughtworks.go.util.command.ConsoleResult in project gocd by gocd.
the class GoConfigRepoConfigDataSourceIntegrationTest method setupExternalConfigRepo.
private String setupExternalConfigRepo(File configRepo, String configRepoTestResource) throws IOException {
ClassPathResource resource = new ClassPathResource(configRepoTestResource);
FileUtils.copyDirectory(resource.getFile(), configRepo);
CommandLine.createCommandLine("git").withEncoding("utf-8").withArg("init").withArg(configRepo.getAbsolutePath()).runOrBomb(null);
CommandLine.createCommandLine("git").withEncoding("utf-8").withArgs("config", "commit.gpgSign", "false").withWorkingDir(configRepo.getAbsoluteFile()).runOrBomb(null);
gitAddDotAndCommit(configRepo);
ConsoleResult consoleResult = CommandLine.createCommandLine("git").withEncoding("utf-8").withArg("log").withArg("-1").withArg("--pretty=format:%h").withWorkingDir(configRepo).runOrBomb(null);
return consoleResult.outputAsString();
}
Aggregations