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));
}
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));
}
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)));
}
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");
}
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)"));
}
Aggregations