Search in sources :

Example 81 with GoConfigMother

use of com.thoughtworks.go.helper.GoConfigMother in project gocd by gocd.

the class PipelineConfigSaveValidationContextTest method shouldGetAllMaterialsByFingerPrint.

@Test
void shouldGetAllMaterialsByFingerPrint() throws Exception {
    CruiseConfig cruiseConfig = new GoConfigMother().cruiseConfigWithPipelineUsingTwoMaterials();
    MaterialConfig expectedMaterial = MaterialConfigsMother.multipleMaterialConfigs().get(1);
    PipelineConfigSaveValidationContext context = PipelineConfigSaveValidationContext.forChain(true, "group", cruiseConfig);
    MaterialConfigs allMaterialsByFingerPrint = context.getAllMaterialsByFingerPrint(expectedMaterial.getFingerprint());
    assertThat(allMaterialsByFingerPrint.size()).isEqualTo(1);
    assertThat(allMaterialsByFingerPrint.first()).isEqualTo(expectedMaterial);
}
Also used : MaterialConfigs(com.thoughtworks.go.config.materials.MaterialConfigs) DependencyMaterialConfig(com.thoughtworks.go.config.materials.dependency.DependencyMaterialConfig) MaterialConfig(com.thoughtworks.go.domain.materials.MaterialConfig) HgMaterialConfig(com.thoughtworks.go.config.materials.mercurial.HgMaterialConfig) GoConfigMother(com.thoughtworks.go.helper.GoConfigMother) Test(org.junit.jupiter.api.Test)

Example 82 with GoConfigMother

use of com.thoughtworks.go.helper.GoConfigMother in project gocd by gocd.

the class PipelineConfigValidationTest method setup.

@BeforeEach
void setup() {
    config = GoConfigMother.configWithPipelines("pipeline1", "pipeline2", "pipeline3", "go");
    pipeline = config.pipelineConfigByName(new CaseInsensitiveString("go"));
    goConfigMother = new GoConfigMother();
}
Also used : GoConfigMother(com.thoughtworks.go.helper.GoConfigMother) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 83 with GoConfigMother

use of com.thoughtworks.go.helper.GoConfigMother in project gocd by gocd.

the class UpdatePackageConfigCommandTest method setup.

@BeforeEach
public void setup() throws Exception {
    currentUser = new Username(new CaseInsensitiveString("user"));
    cruiseConfig = new GoConfigMother().defaultCruiseConfig();
    packageUuid = "random-uuid";
    configuration = new Configuration(new ConfigurationProperty(new ConfigurationKey("PACKAGE_ID"), new ConfigurationValue("foo")));
    oldPackageDefinition = new PackageDefinition(packageUuid, "prettyjson", configuration);
    newPackageName = "prettyjson";
    newPackageDefinition = new PackageDefinition(packageUuid, newPackageName, configuration);
    result = new HttpLocalizedOperationResult();
    PackageRepositories repositories = cruiseConfig.getPackageRepositories();
    PackageRepository repository = new PackageRepository("repoId", "repoName", new PluginConfiguration("plugin-id", "1"), new Configuration(new ConfigurationProperty(new ConfigurationKey("foo"), new ConfigurationValue("bar"))));
    repository.addPackage(oldPackageDefinition);
    oldPackageDefinition.setRepository(repository);
    repositories.add(repository);
    cruiseConfig.setPackageRepositories(repositories);
}
Also used : HttpLocalizedOperationResult(com.thoughtworks.go.server.service.result.HttpLocalizedOperationResult) Username(com.thoughtworks.go.server.domain.Username) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString) GoConfigMother(com.thoughtworks.go.helper.GoConfigMother) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 84 with GoConfigMother

use of com.thoughtworks.go.helper.GoConfigMother in project gocd by gocd.

the class CcTrayConfigChangeHandlerTest method setUp.

@BeforeEach
public void setUp() throws Exception {
    goConfigMother = new GoConfigMother();
    handler = new CcTrayConfigChangeHandler(cache, stageStatusLoader, pipelinePermissionsAuthority);
    pluginRoleUsersStore = PluginRoleUsersStore.instance();
}
Also used : GoConfigMother(com.thoughtworks.go.helper.GoConfigMother) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 85 with GoConfigMother

use of com.thoughtworks.go.helper.GoConfigMother in project gocd by gocd.

the class GoDashboardConfigChangeHandlerTest method shouldReplaceOnlyTheExistingPipelineEntryInCacheWithANewEntryWhenOnlyPipelineConfigHasChanged.

@Test
public void shouldReplaceOnlyTheExistingPipelineEntryInCacheWithANewEntryWhenOnlyPipelineConfigHasChanged() throws Exception {
    BasicCruiseConfig config = GoConfigMother.defaultCruiseConfig();
    PipelineConfig pipelineConfig = new GoConfigMother().addPipeline(config, "pipeline1", "stage1", "job1");
    handler.call(pipelineConfig);
    verify(cacheUpdateService).updateCacheForPipeline(pipelineConfig);
}
Also used : PipelineConfig(com.thoughtworks.go.config.PipelineConfig) BasicCruiseConfig(com.thoughtworks.go.config.BasicCruiseConfig) GoConfigMother(com.thoughtworks.go.helper.GoConfigMother) Test(org.junit.jupiter.api.Test)

Aggregations

GoConfigMother (com.thoughtworks.go.helper.GoConfigMother)102 Test (org.junit.jupiter.api.Test)64 Username (com.thoughtworks.go.server.domain.Username)30 BeforeEach (org.junit.jupiter.api.BeforeEach)19 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)15 HttpLocalizedOperationResult (com.thoughtworks.go.server.service.result.HttpLocalizedOperationResult)13 GoConfigValidity (com.thoughtworks.go.config.validation.GoConfigValidity)12 File (java.io.File)9 ArrayList (java.util.ArrayList)9 Test (org.junit.Test)9 MaterialConfigs (com.thoughtworks.go.config.materials.MaterialConfigs)8 PartialConfig (com.thoughtworks.go.config.remote.PartialConfig)8 ByteArrayOutputStream (java.io.ByteArrayOutputStream)7 SCM (com.thoughtworks.go.domain.scm.SCM)4 CruiseConfig (com.thoughtworks.go.config.CruiseConfig)3 GoConfigInvalidException (com.thoughtworks.go.config.exceptions.GoConfigInvalidException)3 SvnMaterialConfig (com.thoughtworks.go.config.materials.svn.SvnMaterialConfig)3 FullConfigUpdateCommand (com.thoughtworks.go.config.update.FullConfigUpdateCommand)3 Configuration (com.thoughtworks.go.domain.config.Configuration)3 PackageRepositories (com.thoughtworks.go.domain.packagerepository.PackageRepositories)3