use of com.thoughtworks.go.config.remote.RepoConfigOrigin in project gocd by gocd.
the class EnvironmentsConfigTest method shouldGetLocalPartsWhenOriginIsMixed.
@Test
public void shouldGetLocalPartsWhenOriginIsMixed() {
env.setOrigins(new FileConfigOrigin());
BasicEnvironmentConfig prodLocalPart = new BasicEnvironmentConfig(new CaseInsensitiveString("PROD"));
prodLocalPart.addAgent("1235");
prodLocalPart.setOrigins(new FileConfigOrigin());
BasicEnvironmentConfig prodRemotePart = new BasicEnvironmentConfig(new CaseInsensitiveString("PROD"));
prodRemotePart.setOrigins(new RepoConfigOrigin());
MergeEnvironmentConfig pairEnvironmentConfig = new MergeEnvironmentConfig(prodLocalPart, prodRemotePart);
configs.add(pairEnvironmentConfig);
assertThat(configs.getLocal().size(), is(2));
assertThat(configs.getLocal(), hasItem(env));
assertThat(configs.getLocal(), hasItem(prodLocalPart));
}
use of com.thoughtworks.go.config.remote.RepoConfigOrigin in project gocd by gocd.
the class EnvironmentsConfigTest method shouldGetLocalPartsWhenOriginIsRepo.
@Test
public void shouldGetLocalPartsWhenOriginIsRepo() {
env.setOrigins(new RepoConfigOrigin());
assertThat(configs.getLocal().size(), is(0));
}
use of com.thoughtworks.go.config.remote.RepoConfigOrigin in project gocd by gocd.
the class BasicPipelineConfigsTest method shouldReturnNullGetLocalPartsWhenOriginIsRepo.
@Test
public void shouldReturnNullGetLocalPartsWhenOriginIsRepo() {
PipelineConfigs pipelineConfigs = createEmpty();
pipelineConfigs.setOrigins(new RepoConfigOrigin());
assertNull(pipelineConfigs.getLocal());
}
use of com.thoughtworks.go.config.remote.RepoConfigOrigin 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(new ConfigRepoConfig(materialConfig, "plug"), "revision2"));
buildCause.assertPipelineConfigAndMaterialRevisionMatch(pipelineConfig);
}
use of com.thoughtworks.go.config.remote.RepoConfigOrigin 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(new ConfigRepoConfig(materialConfig, "plug"), "revision2"));
try {
buildCause.assertPipelineConfigAndMaterialRevisionMatch(pipelineConfig);
} catch (BuildCauseOutOfDateException ex) {
//good
return;
}
fail("should have thrown");
}
Aggregations