use of com.thoughtworks.go.domain.materials.MaterialConfig in project gocd by gocd.
the class BuildCauseTest method shouldThrowWhenMaterialAndConfigOriginRevisionDontMatch_WhenAutoTrigger.
@Test
public void shouldThrowWhenMaterialAndConfigOriginRevisionDontMatch_WhenAutoTrigger() {
SvnMaterial material = MaterialsMother.svnMaterial();
MaterialConfig materialConfig = material.config();
MaterialRevisions first = new MaterialRevisions(new MaterialRevision(material, oneModifiedFile("revision1")));
BuildCause buildCause = BuildCause.createWithModifications(first, "");
buildCause.setMaterialRevisions(first);
PipelineConfig pipelineConfig = PipelineConfigMother.createPipelineConfigWithStages("pipe1", "build");
pipelineConfig.materialConfigs().clear();
pipelineConfig.materialConfigs().add(materialConfig);
pipelineConfig.setOrigin(new RepoConfigOrigin(ConfigRepoConfig.createConfigRepoConfig(materialConfig, "plug", "id"), "revision2"));
try {
buildCause.assertPipelineConfigAndMaterialRevisionMatch(pipelineConfig);
} catch (BuildCauseOutOfDateException ex) {
// good
return;
}
fail("should have thrown");
}
use of com.thoughtworks.go.domain.materials.MaterialConfig in project gocd by gocd.
the class BuildCauseTest method shouldNotThrowWhenMaterialAndConfigOriginRevisionDontMatch_WhenManualTrigger.
@Test
public void shouldNotThrowWhenMaterialAndConfigOriginRevisionDontMatch_WhenManualTrigger() {
SvnMaterial material = MaterialsMother.svnMaterial();
MaterialConfig materialConfig = material.config();
MaterialRevisions first = new MaterialRevisions(new MaterialRevision(material, oneModifiedFile("revision1")));
BuildCause buildCause = BuildCause.createManualForced();
buildCause.setMaterialRevisions(first);
PipelineConfig pipelineConfig = PipelineConfigMother.createPipelineConfigWithStages("pipe1", "build");
pipelineConfig.materialConfigs().clear();
pipelineConfig.materialConfigs().add(materialConfig);
pipelineConfig.setOrigin(new RepoConfigOrigin(ConfigRepoConfig.createConfigRepoConfig(materialConfig, "plug", "id"), "revision2"));
buildCause.assertPipelineConfigAndMaterialRevisionMatch(pipelineConfig);
}
use of com.thoughtworks.go.domain.materials.MaterialConfig in project gocd by gocd.
the class ConfigRepoConfigTest method hasMaterialWithFingerprint_shouldReturnFalseWhenFingerprintNotEquals.
@Test
public void hasMaterialWithFingerprint_shouldReturnFalseWhenFingerprintNotEquals() {
MaterialConfig configRepo = git("url", "branch");
GitMaterialConfig someRepo = git("url", "branch1");
ConfigRepoConfig config = ConfigRepoConfig.createConfigRepoConfig(configRepo, "myplugin", "id");
assertThat(config.hasMaterialWithFingerprint(someRepo.getFingerprint())).isFalse();
}
use of com.thoughtworks.go.domain.materials.MaterialConfig in project gocd by gocd.
the class ConfigRepoConfigTest method validateTree_shouldValidateTheMaterialConfig.
@Test
public void validateTree_shouldValidateTheMaterialConfig() {
CruiseConfig cruiseConfig = new BasicCruiseConfig();
MaterialConfig materialConfig = mock(MaterialConfig.class);
when(materialConfig.errors()).thenReturn(new ConfigErrors());
ConfigRepoConfig configRepoConfig = ConfigRepoConfig.createConfigRepoConfig(materialConfig, "plug", "id");
cruiseConfig.setConfigRepos(new ConfigReposConfig(configRepoConfig));
ConfigSaveValidationContext validationContext = ConfigSaveValidationContext.forChain(cruiseConfig);
configRepoConfig.validateTree(validationContext);
verify(materialConfig).validateTree(validationContext);
}
use of com.thoughtworks.go.domain.materials.MaterialConfig in project gocd by gocd.
the class ConfigRepoConfigTest method hasSameMaterial_shouldReturnTrueWhenFingerprintEquals_AndDestinationDirectoriesAreDifferent.
@Test
public void hasSameMaterial_shouldReturnTrueWhenFingerprintEquals_AndDestinationDirectoriesAreDifferent() {
MaterialConfig configRepo = git("url", "branch");
GitMaterialConfig someRepo = git("url", "branch");
someRepo.setFolder("someFolder");
ConfigRepoConfig config = ConfigRepoConfig.createConfigRepoConfig(configRepo, "myplugin", "id");
assertThat(config.hasSameMaterial(someRepo)).isTrue();
}
Aggregations