Search in sources :

Example 26 with GoConfigMother

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

the class CreateConfigRepoCommandTest method setup.

@Before
public void setup() throws Exception {
    initMocks(this);
    currentUser = new Username(new CaseInsensitiveString("user"));
    actionFailed = LocalizedMessage.string("RESOURCE_ADD_FAILED", "Configs repo");
    result = new HttpLocalizedOperationResult();
    cruiseConfig = new GoConfigMother().defaultCruiseConfig();
    configRepo = new ConfigRepoConfig(new GitMaterialConfig("https://foo.git", "master"), "json-plugin", repoId);
}
Also used : HttpLocalizedOperationResult(com.thoughtworks.go.server.service.result.HttpLocalizedOperationResult) Username(com.thoughtworks.go.server.domain.Username) ConfigRepoConfig(com.thoughtworks.go.config.remote.ConfigRepoConfig) GitMaterialConfig(com.thoughtworks.go.config.materials.git.GitMaterialConfig) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString) GoConfigMother(com.thoughtworks.go.helper.GoConfigMother) Before(org.junit.Before)

Example 27 with GoConfigMother

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

the class CreatePackageConfigCommandTest method setup.

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

Example 28 with GoConfigMother

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

the class DeleteConfigRepoCommandTest method setup.

@Before
public void setup() throws Exception {
    initMocks(this);
    currentUser = new Username(new CaseInsensitiveString("user"));
    cruiseConfig = new GoConfigMother().defaultCruiseConfig();
    repoId = "repo-1";
    configRepo = new ConfigRepoConfig(new GitMaterialConfig("http://foo.git", "master"), "plugin-id", repoId);
    result = new HttpLocalizedOperationResult();
    cruiseConfig.getConfigRepos().add(configRepo);
}
Also used : HttpLocalizedOperationResult(com.thoughtworks.go.server.service.result.HttpLocalizedOperationResult) Username(com.thoughtworks.go.server.domain.Username) ConfigRepoConfig(com.thoughtworks.go.config.remote.ConfigRepoConfig) GitMaterialConfig(com.thoughtworks.go.config.materials.git.GitMaterialConfig) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString) GoConfigMother(com.thoughtworks.go.helper.GoConfigMother) Before(org.junit.Before)

Example 29 with GoConfigMother

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

the class DeletePackageRepositoryCommandTest method setup.

@Before
public void setup() throws Exception {
    initMocks(this);
    currentUser = new Username(new CaseInsensitiveString("user"));
    cruiseConfig = new GoConfigMother().defaultCruiseConfig();
    packageRepository = new PackageRepository();
    repoId = "npm";
    packageRepository.setId(repoId);
    result = new HttpLocalizedOperationResult();
    cruiseConfig.setPackageRepositories(new PackageRepositories(packageRepository));
}
Also used : HttpLocalizedOperationResult(com.thoughtworks.go.server.service.result.HttpLocalizedOperationResult) Username(com.thoughtworks.go.server.domain.Username) PackageRepositories(com.thoughtworks.go.domain.packagerepository.PackageRepositories) PackageRepository(com.thoughtworks.go.domain.packagerepository.PackageRepository) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString) GoConfigMother(com.thoughtworks.go.helper.GoConfigMother) Before(org.junit.Before)

Example 30 with GoConfigMother

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

the class DeleteTemplateConfigCommandTest method setup.

@Before
public void setup() {
    initMocks(this);
    currentUser = new Username(new CaseInsensitiveString("user"));
    cruiseConfig = new GoConfigMother().defaultCruiseConfig();
    pipelineTemplateConfig = new PipelineTemplateConfig(new CaseInsensitiveString("template"), StageConfigMother.oneBuildPlanWithResourcesAndMaterials("stage", "job"));
    result = new HttpLocalizedOperationResult();
}
Also used : HttpLocalizedOperationResult(com.thoughtworks.go.server.service.result.HttpLocalizedOperationResult) Username(com.thoughtworks.go.server.domain.Username) PipelineTemplateConfig(com.thoughtworks.go.config.PipelineTemplateConfig) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString) GoConfigMother(com.thoughtworks.go.helper.GoConfigMother) Before(org.junit.Before)

Aggregations

GoConfigMother (com.thoughtworks.go.helper.GoConfigMother)80 Test (org.junit.Test)48 Username (com.thoughtworks.go.server.domain.Username)33 Before (org.junit.Before)25 HttpLocalizedOperationResult (com.thoughtworks.go.server.service.result.HttpLocalizedOperationResult)18 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)17 GoConfigValidity (com.thoughtworks.go.config.validation.GoConfigValidity)11 StringContains.containsString (org.hamcrest.core.StringContains.containsString)8 PartialConfig (com.thoughtworks.go.config.remote.PartialConfig)7 ByteArrayOutputStream (java.io.ByteArrayOutputStream)7 Matchers.containsString (org.hamcrest.Matchers.containsString)7 File (java.io.File)6 MaterialConfigs (com.thoughtworks.go.config.materials.MaterialConfigs)5 PackageRepositories (com.thoughtworks.go.domain.packagerepository.PackageRepositories)4 PackageRepository (com.thoughtworks.go.domain.packagerepository.PackageRepository)4 BasicEnvironmentConfig (com.thoughtworks.go.config.BasicEnvironmentConfig)3 CruiseConfig (com.thoughtworks.go.config.CruiseConfig)3 GoConfigInvalidException (com.thoughtworks.go.config.exceptions.GoConfigInvalidException)3 GitMaterialConfig (com.thoughtworks.go.config.materials.git.GitMaterialConfig)3 ConfigRepoConfig (com.thoughtworks.go.config.remote.ConfigRepoConfig)3