Search in sources :

Example 46 with GoConfigMother

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

the class SCMConfigCommandTest method setup.

@Before
public void setup() throws Exception {
    initMocks(this);
    currentUser = new Username(new CaseInsensitiveString("user"));
    cruiseConfig = new GoConfigMother().defaultCruiseConfig();
    scm = new SCM("id", new PluginConfiguration("non-existent-plugin-id", "1"), new Configuration(new ConfigurationProperty(new ConfigurationKey("key"), new ConfigurationValue("value"))));
    scms = new SCMs();
    scms.add(scm);
}
Also used : SCMs(com.thoughtworks.go.domain.scm.SCMs) Username(com.thoughtworks.go.server.domain.Username) SCM(com.thoughtworks.go.domain.scm.SCM) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString) GoConfigMother(com.thoughtworks.go.helper.GoConfigMother) Before(org.junit.Before)

Example 47 with GoConfigMother

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

the class UpdatePackageConfigCommandTest method setup.

@Before
public void setup() throws Exception {
    initMocks(this);
    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) 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 48 with GoConfigMother

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

the class CcTrayConfigChangeHandlerTest method setUp.

@Before
public void setUp() throws Exception {
    initMocks(this);
    goConfigMother = new GoConfigMother();
    handler = new CcTrayConfigChangeHandler(cache, stageStatusLoader, ccTrayViewAuthority);
}
Also used : GoConfigMother(com.thoughtworks.go.helper.GoConfigMother) Before(org.junit.Before)

Example 49 with GoConfigMother

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

the class UpdateEnvironmentCommandTest method setup.

@Before
public void setup() throws Exception {
    initMocks(this);
    currentUser = new Username(new CaseInsensitiveString("user"));
    cruiseConfig = new GoConfigMother().defaultCruiseConfig();
    oldEnvironmentName = new CaseInsensitiveString("Dev");
    newEnvironmentName = new CaseInsensitiveString("Test");
    oldEnvironmentConfig = new BasicEnvironmentConfig(oldEnvironmentName);
    newEnvironmentConfig = new BasicEnvironmentConfig(newEnvironmentName);
    result = new HttpLocalizedOperationResult();
    md5 = "md5";
    cruiseConfig.addEnvironment(oldEnvironmentConfig);
    actionFailed = LocalizedMessage.string("ENV_UPDATE_FAILED", oldEnvironmentConfig.name());
}
Also used : HttpLocalizedOperationResult(com.thoughtworks.go.server.service.result.HttpLocalizedOperationResult) Username(com.thoughtworks.go.server.domain.Username) BasicEnvironmentConfig(com.thoughtworks.go.config.BasicEnvironmentConfig) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString) GoConfigMother(com.thoughtworks.go.helper.GoConfigMother) Before(org.junit.Before)

Example 50 with GoConfigMother

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

the class ServerHealthServiceTest method shouldReturnErrorLogs.

@Test
public void shouldReturnErrorLogs() throws Exception {
    serverHealthService.update(ServerHealthState.error("message", "description", pipelineId));
    CruiseConfig cruiseConfig = new BasicCruiseConfig();
    new GoConfigMother().addPipeline(cruiseConfig, PIPELINE_NAME, "stageName", "jon");
    assertThat(serverHealthService.getAllValidLogs(cruiseConfig).size(), is(1));
}
Also used : GoConfigMother(com.thoughtworks.go.helper.GoConfigMother) Test(org.junit.Test)

Aggregations

GoConfigMother (com.thoughtworks.go.helper.GoConfigMother)55 Test (org.junit.Test)34 Before (org.junit.Before)19 Username (com.thoughtworks.go.server.domain.Username)18 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)15 HttpLocalizedOperationResult (com.thoughtworks.go.server.service.result.HttpLocalizedOperationResult)15 GoConfigValidity (com.thoughtworks.go.config.validation.GoConfigValidity)11 StringContains.containsString (org.hamcrest.core.StringContains.containsString)8 ByteArrayOutputStream (java.io.ByteArrayOutputStream)7 Matchers.containsString (org.hamcrest.Matchers.containsString)7 PartialConfig (com.thoughtworks.go.config.remote.PartialConfig)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 File (java.io.File)4 BasicEnvironmentConfig (com.thoughtworks.go.config.BasicEnvironmentConfig)3 CruiseConfig (com.thoughtworks.go.config.CruiseConfig)3 GoConfigInvalidException (com.thoughtworks.go.config.exceptions.GoConfigInvalidException)3 PackageDefinition (com.thoughtworks.go.domain.packagerepository.PackageDefinition)3 SCM (com.thoughtworks.go.domain.scm.SCM)3