use of com.thoughtworks.go.server.domain.Username in project gocd by gocd.
the class PipelineHistoryServiceIntegrationTest method shouldLoadPipelineInstanceWithMultipleRevisions.
@Test
public void shouldLoadPipelineInstanceWithMultipleRevisions() {
Pipeline pipeline = pipelineOne.createPipelineWithFirstStageScheduled(ModificationsMother.multipleModifications(pipelineOne.pipelineConfig()));
configHelper.setViewPermissionForGroup("group1", "foo");
PipelineInstanceModel pipelineInstance = pipelineHistoryService.load(pipeline.getId(), new Username(new CaseInsensitiveString("foo")), new HttpOperationResult());
assertThat(pipelineInstance, is(not(nullValue())));
assertThat(pipelineInstance.hasNewRevisions(), is(false));
}
use of com.thoughtworks.go.server.domain.Username in project gocd by gocd.
the class PipelinePauseServiceIntegrationTest method shouldTruncatePauseMessageIfGreaterThanAllowedLength.
@Test
public void shouldTruncatePauseMessageIfGreaterThanAllowedLength() throws Exception {
String name = "pipeline-name";
CruiseConfig cruiseConfig = GoConfigMother.configWithPipelines(name);
configHelper.writeConfigFile(cruiseConfig);
cachedGoConfig.forceReload();
Username userName = new Username(new CaseInsensitiveString("UserFoo"));
pipelinePauseService.pause(name, "tiny pause cause", userName);
assertThat(pipelinePauseService.pipelinePauseInfo(name).getPauseCause(), is("tiny pause cause"));
String stringWith255Chars = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
pipelinePauseService.pause(name, stringWith255Chars + "aa", userName);
assertThat(pipelinePauseService.pipelinePauseInfo(name).getPauseCause(), is(stringWith255Chars));
}
use of com.thoughtworks.go.server.domain.Username in project gocd by gocd.
the class PipelineScheduleServiceTest method manualSchedule.
private Pipeline manualSchedule(String pipelineName) throws Exception, StageAlreadyBuildingException {
scheduleHelper.manuallySchedulePipelineWithRealMaterials(pipelineName, new Username(new CaseInsensitiveString("some user name")));
scheduleService.autoSchedulePipelinesFromRequestBuffer();
return pipelineService.mostRecentFullPipelineByName(pipelineName);
}
use of com.thoughtworks.go.server.domain.Username in project gocd by gocd.
the class StageJsonPresentationModelTest method shouldEscapeBuildCauseMessage.
@Test
public void shouldEscapeBuildCauseMessage() throws Exception {
String userWithHtmlCharacters = "<user>";
pipeline.setBuildCause(BuildCause.createManualForced(materialRevisions(userWithHtmlCharacters), new Username(new CaseInsensitiveString(userWithHtmlCharacters))));
StageJsonPresentationModel presenter = new StageJsonPresentationModel(pipeline, stage, null, new Agents());
JsonTester jsonTester = new JsonTester(presenter.toJson());
String expected = StringEscapeUtils.escapeHtml(userWithHtmlCharacters);
jsonTester.shouldContain("{'buildCause':'Forced by " + expected + "'}");
}
use of com.thoughtworks.go.server.domain.Username in project gocd by gocd.
the class UserHelperTest method shouldGetDisplayNameForAPasswordFileUser.
@Test
public void shouldGetDisplayNameForAPasswordFileUser() {
GrantedAuthority[] authorities = { new GrantedAuthorityImpl("anything") };
TestingAuthenticationToken authentication = new TestingAuthenticationToken(new GoUserPrinciple("user", "Full Name", "password", true, true, true, true, authorities), null, authorities);
assertThat(UserHelper.getUserName(authentication), is(new Username(new CaseInsensitiveString("user"), "Full Name")));
}
Aggregations