use of com.thoughtworks.go.config.CaseInsensitiveString in project gocd by gocd.
the class UsernameTest method shouldAllowBuildingUsernameFromString.
@Test
public void shouldAllowBuildingUsernameFromString() {
Username one = new Username(new CaseInsensitiveString("myusername"));
Username two = Username.valueOf("myusername");
assertThat(one, is(two));
}
use of com.thoughtworks.go.config.CaseInsensitiveString in project gocd by gocd.
the class MaterialCheckerTest method updateChangedRevisionsShouldRetainLatestRevisionIfAllHaveBuiltBefore.
@Test
public void updateChangedRevisionsShouldRetainLatestRevisionIfAllHaveBuiltBefore() {
CaseInsensitiveString pipelineName = new CaseInsensitiveString("pipelineName");
GitMaterial gitMaterial = new GitMaterial("git://foo");
BuildCause buildCause = BuildCause.createWithModifications(new MaterialRevisions(new MaterialRevision(gitMaterial, mod(10L), mod(9L), mod(8L))), "user");
when(materialRepository.latestModificationRunByPipeline(pipelineName, gitMaterial)).thenReturn(10L);
materialChecker.updateChangedRevisions(pipelineName, buildCause);
MaterialRevisions actualRevisions = buildCause.getMaterialRevisions();
assertThat(actualRevisions.getModifications(gitMaterial), is(new Modifications(mod(10L), mod(9L), mod(8L))));
assertThat(actualRevisions.findRevisionFor(gitMaterial).isChanged(), is(false));
}
use of com.thoughtworks.go.config.CaseInsensitiveString in project gocd by gocd.
the class MaterialCheckerTest method shouldUseLatestPipelineInstanceForDependentPipeline.
@Test
public void shouldUseLatestPipelineInstanceForDependentPipeline() throws Exception {
DependencyMaterial dependencyMaterial = new DependencyMaterial(new CaseInsensitiveString("pipeline-name"), new CaseInsensitiveString("stage-name"));
Stage passedStage = StageMother.passedStageInstance("stage-name", "job-name", "pipeline-name");
Modification modification = new Modification("Unknown", "Unknown", null, passedStage.completedDate(), "pipeline-name/1[LABEL-1]/stage-name/0");
Mockito.when(materialRepository.findLatestModification(dependencyMaterial)).thenReturn(revisions(dependencyMaterial, modification));
materialChecker.findLatestRevisions(new MaterialRevisions(), new Materials(dependencyMaterial));
Mockito.verify(materialRepository).findLatestModification(dependencyMaterial);
}
use of com.thoughtworks.go.config.CaseInsensitiveString in project gocd by gocd.
the class MaterialCheckerTest method shouldUseLatestPipelineInstanceForDependentPipelineGivenThePreviousRevision.
@Test
public void shouldUseLatestPipelineInstanceForDependentPipelineGivenThePreviousRevision() throws Exception {
DependencyMaterial dependencyMaterial = new DependencyMaterial(new CaseInsensitiveString("pipeline-name"), new CaseInsensitiveString("stage-name"));
Stage passedStage = StageMother.passedStageInstance("stage-name", "job-name", "pipeline-name");
MaterialRevisions materialRevisions = new MaterialRevisions();
Modification previous = new Modification("Unknown", "Unknown", null, passedStage.completedDate(), "pipeline-name/1/stage-name/0");
MaterialRevision previousRevision = revisions(dependencyMaterial, previous).getMaterialRevision(0);
when(materialRepository.findModificationsSince(dependencyMaterial, previousRevision)).thenReturn(Arrays.asList(new Modification(new Date(), "pipeline-name/2/stage-name/0", "MOCK_LABEL-12", null)));
MaterialRevisions revisionsSince = materialChecker.findRevisionsSince(materialRevisions, new Materials(dependencyMaterial), new MaterialRevisions(previousRevision), new MaterialRevisions());
assertThat(revisionsSince.getMaterialRevision(0).getRevision().getRevision(), is("pipeline-name/2/stage-name/0"));
}
use of com.thoughtworks.go.config.CaseInsensitiveString in project gocd by gocd.
the class MaterialCheckerTest method updateChangedRevisionsShouldFilterRevisionsThatHaveBuiltBefore.
@Test
public void updateChangedRevisionsShouldFilterRevisionsThatHaveBuiltBefore() {
CaseInsensitiveString pipelineName = new CaseInsensitiveString("pipelineName");
GitMaterial gitMaterial = new GitMaterial("git://foo");
BuildCause buildCause = BuildCause.createWithModifications(new MaterialRevisions(new MaterialRevision(gitMaterial, mod(10L), mod(9L), mod(8L))), "user");
when(materialRepository.latestModificationRunByPipeline(pipelineName, gitMaterial)).thenReturn(9L);
materialChecker.updateChangedRevisions(pipelineName, buildCause);
MaterialRevisions actualRevisions = buildCause.getMaterialRevisions();
assertThat(actualRevisions.getModifications(gitMaterial), is(new Modifications(mod(10L))));
assertThat(actualRevisions.findRevisionFor(gitMaterial).isChanged(), is(true));
}
Aggregations