use of com.thoughtworks.go.domain.GoConfigRevision in project gocd by gocd.
the class ConfigRepositoryTest method shouldShowDiffForAnyTwoConfigMd5s.
@Test
public void shouldShowDiffForAnyTwoConfigMd5s() throws Exception {
configRepo.checkin(goConfigRevision(ConfigFileFixture.configWithPipeline(ConfigFileFixture.SIMPLE_PIPELINE, 33), "md5-1"));
configRepo.checkin(new GoConfigRevision(ConfigFileFixture.configWithPipeline(ConfigFileFixture.SIMPLE_PIPELINE, 60), "md5-2", "user-2", "13.2", new TimeProvider()));
configRepo.checkin(new GoConfigRevision(ConfigFileFixture.configWithPipeline(ConfigFileFixture.SIMPLE_PIPELINE, 55), "md5-3", "user-2", "13.2", new TimeProvider()));
String configChangesLine1 = "-<cruise schemaVersion='33'>";
String configChangesLine2 = "+<cruise schemaVersion='60'>";
String configChangesLine3 = "+<cruise schemaVersion='55'>";
String actual = configRepo.configChangesFor("md5-2", "md5-1");
assertThat(actual, containsString(configChangesLine1));
assertThat(actual, containsString(configChangesLine2));
actual = configRepo.configChangesFor("md5-3", "md5-1");
assertThat(actual, containsString(configChangesLine1));
assertThat(actual, containsString(configChangesLine3));
}
use of com.thoughtworks.go.domain.GoConfigRevision in project gocd by gocd.
the class ConfigRepositoryTest method shouldShowDiffBetweenAnyTwoGitRevisionsGivenTheirMd5s.
@Test
public void shouldShowDiffBetweenAnyTwoGitRevisionsGivenTheirMd5s() throws Exception {
configRepo.checkin(goConfigRevision(ConfigFileFixture.configWithPipeline(ConfigFileFixture.SIMPLE_PIPELINE, 33), "md5-1"));
configRepo.checkin(new GoConfigRevision(ConfigFileFixture.configWithPipeline(ConfigFileFixture.SIMPLE_PIPELINE, 60), "md5-2", "user-2", "13.2", new TimeProvider()));
configRepo.checkin(new GoConfigRevision(ConfigFileFixture.configWithPipeline(ConfigFileFixture.SIMPLE_PIPELINE, 55), "md5-3", "user-1", "13.2", new TimeProvider()));
String configChangesLine1 = "-<cruise schemaVersion='33'>";
String configChangesLine2 = "+<cruise schemaVersion='55'>";
String actual = configRepo.findDiffBetweenTwoRevisions(configRepo.getRevCommitForMd5("md5-3"), configRepo.getRevCommitForMd5("md5-1"));
assertThat(actual, containsString(configChangesLine1));
assertThat(actual, containsString(configChangesLine2));
}
use of com.thoughtworks.go.domain.GoConfigRevision in project gocd by gocd.
the class ConfigRepositoryTest method shouldShowDiffForAnyTwoCommitSHAs.
@Test
public void shouldShowDiffForAnyTwoCommitSHAs() throws Exception {
configRepo.checkin(goConfigRevision(ConfigFileFixture.configWithPipeline(ConfigFileFixture.SIMPLE_PIPELINE, 33), "md5-1"));
configRepo.checkin(new GoConfigRevision(ConfigFileFixture.configWithPipeline(ConfigFileFixture.SIMPLE_PIPELINE, 60), "md5-2", "user-2", "13.2", new TimeProvider()));
configRepo.checkin(new GoConfigRevision(ConfigFileFixture.configWithPipeline(ConfigFileFixture.SIMPLE_PIPELINE, 55), "md5-3", "user-2", "13.2", new TimeProvider()));
GoConfigRevisions commits = configRepo.getCommits(10, 0);
String firstCommitSHA = commits.get(2).getCommitSHA();
String secondCommitSHA = commits.get(1).getCommitSHA();
String thirdCommitSHA = commits.get(0).getCommitSHA();
String configChangesLine1 = "-<cruise schemaVersion='33'>";
String configChangesLine2 = "+<cruise schemaVersion='60'>";
String configChangesLine3 = "+<cruise schemaVersion='55'>";
String actual = configRepo.configChangesForCommits(secondCommitSHA, firstCommitSHA);
assertThat(actual, containsString(configChangesLine1));
assertThat(actual, containsString(configChangesLine2));
actual = configRepo.configChangesForCommits(thirdCommitSHA, firstCommitSHA);
assertThat(actual, containsString(configChangesLine1));
assertThat(actual, containsString(configChangesLine3));
}
use of com.thoughtworks.go.domain.GoConfigRevision in project gocd by gocd.
the class ConfigRepositoryTest method shouldShowDiffBetweenTwoConsecutiveGitRevisions.
@Test
public void shouldShowDiffBetweenTwoConsecutiveGitRevisions() throws Exception {
configRepo.checkin(goConfigRevision(ConfigFileFixture.configWithPipeline(ConfigFileFixture.SIMPLE_PIPELINE, 33), "md5-1"));
RevCommit previousCommit = configRepo.revisions().iterator().next();
configRepo.checkin(new GoConfigRevision(ConfigFileFixture.configWithPipeline(ConfigFileFixture.SIMPLE_PIPELINE, 60), "md5-2", "user-2", "13.2", new TimeProvider()));
RevCommit latestCommit = configRepo.revisions().iterator().next();
String configChangesLine1 = "-<cruise schemaVersion='33'>";
String configChangesLine2 = "+<cruise schemaVersion='60'>";
String actual = configRepo.findDiffBetweenTwoRevisions(latestCommit, previousCommit);
assertThat(actual, containsString(configChangesLine1));
assertThat(actual, containsString(configChangesLine2));
}
use of com.thoughtworks.go.domain.GoConfigRevision in project gocd by gocd.
the class ConfigRepositoryTest method shouldUnderstandRevision_current_asLatestRevision.
@Test
public void shouldUnderstandRevision_current_asLatestRevision() throws Exception {
configRepo.checkin(new GoConfigRevision("v1", "md5-v1", "user-name", "100.3.9", new TimeProvider()));
configRepo.checkin(new GoConfigRevision("v1 v2", "md5-v2", "user-name", "100.9.8", new TimeProvider()));
assertThat(configRepo.getRevision("current").getMd5(), is("md5-v2"));
}
Aggregations