Search in sources :

Example 26 with ConfigErrors

use of com.thoughtworks.go.domain.ConfigErrors in project gocd by gocd.

the class DependencyMaterialConfigTest method shouldNOTBeValidIfTheReferencedPipelineDoesNotExist.

@Test
public void shouldNOTBeValidIfTheReferencedPipelineDoesNotExist() throws Exception {
    CruiseConfig config = GoConfigMother.configWithPipelines("pipeline1", "pipeline2", "pipeline3", "go");
    DependencyMaterialConfig dependencyMaterialConfig = new DependencyMaterialConfig(new CaseInsensitiveString("pipeline-not-exist"), new CaseInsensitiveString("stage"));
    dependencyMaterialConfig.validate(ConfigSaveValidationContext.forChain(config, pipelineConfig));
    ConfigErrors configErrors = dependencyMaterialConfig.errors();
    assertThat(configErrors.isEmpty(), is(false));
    assertThat(configErrors.on(DependencyMaterialConfig.PIPELINE_STAGE_NAME), containsString("Pipeline with name 'pipeline-not-exist' does not exist"));
}
Also used : DependencyMaterialConfig(com.thoughtworks.go.config.materials.dependency.DependencyMaterialConfig) ConfigErrors(com.thoughtworks.go.domain.ConfigErrors) Test(org.junit.Test)

Aggregations

ConfigErrors (com.thoughtworks.go.domain.ConfigErrors)26 Test (org.junit.Test)17 ArrayList (java.util.ArrayList)4 GoConfigInvalidException (com.thoughtworks.go.config.exceptions.GoConfigInvalidException)3 DependencyMaterialConfig (com.thoughtworks.go.config.materials.dependency.DependencyMaterialConfig)3 StringContains.containsString (org.hamcrest.core.StringContains.containsString)3 Cloner (com.rits.cloning.Cloner)2 IOException (java.io.IOException)2 AgentConfig (com.thoughtworks.go.config.AgentConfig)1 EnvironmentAgentConfig (com.thoughtworks.go.config.EnvironmentAgentConfig)1 EnvironmentConfig (com.thoughtworks.go.config.EnvironmentConfig)1 GoConfigDao (com.thoughtworks.go.config.GoConfigDao)1 IgnoreTraversal (com.thoughtworks.go.config.IgnoreTraversal)1 Validatable (com.thoughtworks.go.config.Validatable)1 ConfigFileHasChangedException (com.thoughtworks.go.config.exceptions.ConfigFileHasChangedException)1 ConfigMergeException (com.thoughtworks.go.config.exceptions.ConfigMergeException)1 GoConfigInvalidMergeException (com.thoughtworks.go.config.exceptions.GoConfigInvalidMergeException)1 MaterialConfigs (com.thoughtworks.go.config.materials.MaterialConfigs)1 UpdateEnvironmentsCommand (com.thoughtworks.go.config.update.UpdateEnvironmentsCommand)1 UpdateResourceCommand (com.thoughtworks.go.config.update.UpdateResourceCommand)1