Search in sources :

Example 96 with CaseInsensitiveString

use of com.thoughtworks.go.config.CaseInsensitiveString in project gocd by gocd.

the class UpdateEnvironmentsCommandTest method shouldNotThrowUpIfEnvironmentNameIsInvalid.

@Test
public void shouldNotThrowUpIfEnvironmentNameIsInvalid() throws Exception {
    String agentUuid = "uuid";
    UpdateEnvironmentsCommand command = new UpdateEnvironmentsCommand(agentUuid, "foo, bar, monkey");
    CruiseConfig cruiseConfig = new GoConfigMother().defaultCruiseConfig();
    cruiseConfig.addEnvironment("foo");
    cruiseConfig.addEnvironment("bar");
    command.update(cruiseConfig);
    EnvironmentsConfig environments = cruiseConfig.getEnvironments();
    assertThat(environments.named(new CaseInsensitiveString("foo")).getAgents().getUuids().contains(agentUuid), is(true));
    assertThat(environments.named(new CaseInsensitiveString("bar")).getAgents().getUuids().contains(agentUuid), is(true));
}
Also used : CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString) CruiseConfig(com.thoughtworks.go.config.CruiseConfig) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString) GoConfigMother(com.thoughtworks.go.helper.GoConfigMother) EnvironmentsConfig(com.thoughtworks.go.config.EnvironmentsConfig) Test(org.junit.Test)

Example 97 with CaseInsensitiveString

use of com.thoughtworks.go.config.CaseInsensitiveString in project gocd by gocd.

the class UpdatePackageRepositoryCommandTest method setup.

@Before
public void setup() throws Exception {
    initMocks(this);
    currentUser = new Username(new CaseInsensitiveString("user"));
    cruiseConfig = GoConfigMother.defaultCruiseConfig();
    repoId = "npmOrg";
    newPackageRepo = new PackageRepository(repoId, repoId, new PluginConfiguration("npm", "1"), new Configuration(new ConfigurationProperty(new ConfigurationKey("REPO_URL"), new ConfigurationValue("http://bar"))));
    oldPackageRepo = new PackageRepository(repoId, repoId, new PluginConfiguration("npm", "1"), new Configuration(new ConfigurationProperty(new ConfigurationKey("REPO_URL"), new ConfigurationValue("http://foo"))));
    result = new HttpLocalizedOperationResult();
    cruiseConfig.setPackageRepositories(new PackageRepositories(oldPackageRepo));
}
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) Before(org.junit.Before)

Example 98 with CaseInsensitiveString

use of com.thoughtworks.go.config.CaseInsensitiveString in project gocd by gocd.

the class ManualBuildTest method setUp.

@Before
public void setUp() {
    manualBuild = new ManualBuild(new Username(new CaseInsensitiveString("cruise-user")));
    SvnMaterial material = new SvnMaterial("http://foo.bar/baz", "user", "pass", false);
    materialRevisions = new MaterialRevisions(new MaterialRevision(material, new Modification(new Date(), "1234", "MOCK_LABEL-12", null)));
}
Also used : Modification(com.thoughtworks.go.domain.materials.Modification) Username(com.thoughtworks.go.server.domain.Username) MaterialRevisions(com.thoughtworks.go.domain.MaterialRevisions) SvnMaterial(com.thoughtworks.go.config.materials.svn.SvnMaterial) MaterialRevision(com.thoughtworks.go.domain.MaterialRevision) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString) Date(java.util.Date) Before(org.junit.Before)

Example 99 with CaseInsensitiveString

use of com.thoughtworks.go.config.CaseInsensitiveString in project gocd by gocd.

the class PipelineStagesFeedServiceTest method setUp.

@Before
public void setUp() throws Exception {
    user = new Username(new CaseInsensitiveString("barrow"));
    expected = new FeedEntries();
    stageService = mock(StageService.class);
    securityService = mock(SecurityService.class);
    operationResult = new HttpLocalizedOperationResult();
    pipelineStagesFeedResolver = new PipelineStagesFeedService(stageService, securityService).feedResolverFor("cruise");
}
Also used : FeedEntries(com.thoughtworks.go.domain.feed.FeedEntries) HttpLocalizedOperationResult(com.thoughtworks.go.server.service.result.HttpLocalizedOperationResult) Username(com.thoughtworks.go.server.domain.Username) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString) Before(org.junit.Before)

Example 100 with CaseInsensitiveString

use of com.thoughtworks.go.config.CaseInsensitiveString in project gocd by gocd.

the class PipelineUnlockApiServiceTest method unlockShouldSetResultToNotAcceptableWhenAPipelineInstanceIsCurrentlyRunning.

@Test
public void unlockShouldSetResultToNotAcceptableWhenAPipelineInstanceIsCurrentlyRunning() throws Exception {
    Mockito.when(securityService.hasOperatePermissionForPipeline(new CaseInsensitiveString("username"), "pipeline-name")).thenReturn(true);
    Mockito.when(goConfigService.hasPipelineNamed(new CaseInsensitiveString("pipeline-name"))).thenReturn(true);
    Mockito.when(goConfigService.isLockable("pipeline-name")).thenReturn(true);
    StageIdentifier identifier = new StageIdentifier("pipeline-name", 10, "10", "stage", "1");
    Mockito.when(pipelineLockService.lockedPipeline("pipeline-name")).thenReturn(identifier);
    Mockito.when(currentActivityService.isAnyStageActive(identifier.pipelineIdentifier())).thenReturn(true);
    HttpOperationResult result = new HttpOperationResult();
    pipelineUnlockApiService.unlock("pipeline-name", new Username(new CaseInsensitiveString("username")), result);
    assertThat(result.httpCode(), is(406));
    assertThat(result.message(), is("locked pipeline instance is currently running (one of the stages is in progress)"));
}
Also used : StageIdentifier(com.thoughtworks.go.domain.StageIdentifier) HttpOperationResult(com.thoughtworks.go.server.service.result.HttpOperationResult) Username(com.thoughtworks.go.server.domain.Username) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString) Test(org.junit.Test)

Aggregations

CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)373 Test (org.junit.Test)276 Username (com.thoughtworks.go.server.domain.Username)84 PipelineConfig (com.thoughtworks.go.config.PipelineConfig)69 DependencyMaterial (com.thoughtworks.go.config.materials.dependency.DependencyMaterial)65 MaterialRevision (com.thoughtworks.go.domain.MaterialRevision)58 MaterialRevisions (com.thoughtworks.go.domain.MaterialRevisions)56 Date (java.util.Date)55 Modification (com.thoughtworks.go.domain.materials.Modification)46 SvnMaterial (com.thoughtworks.go.config.materials.svn.SvnMaterial)30 HashMap (java.util.HashMap)30 HttpLocalizedOperationResult (com.thoughtworks.go.server.service.result.HttpLocalizedOperationResult)29 HgMaterial (com.thoughtworks.go.config.materials.mercurial.HgMaterial)27 Before (org.junit.Before)25 CruiseConfig (com.thoughtworks.go.config.CruiseConfig)24 GitMaterial (com.thoughtworks.go.config.materials.git.GitMaterial)24 Pipeline (com.thoughtworks.go.domain.Pipeline)23 DependencyMaterialConfig (com.thoughtworks.go.config.materials.dependency.DependencyMaterialConfig)21 ArrayList (java.util.ArrayList)21 Stage (com.thoughtworks.go.domain.Stage)20