Search in sources :

Example 6 with StageResultMessage

use of com.thoughtworks.go.server.messaging.StageResultMessage in project gocd by gocd.

the class StageNotificationServiceIntegrationTest method shouldSendEmailWithCancelledInfo.

@Test
public void shouldSendEmailWithCancelledInfo() throws SQLException {
    String jezMail = prepareOneMatchedUser();
    Pipeline pipeline = pipelineFixture.createPipelineWithFirstStagePassedAndSecondStageRunning();
    Stage ftStage = mockStageServiceWithStage(pipeline);
    stageNotificationListener.onMessage(new StageResultMessage(ftStage.getIdentifier(), StageEvent.Passes, new Username(new CaseInsensitiveString("chris"))));
    assertThat(inMemoryEmailNotificationTopic.getBody(jezMail), containsString("The stage was cancelled by chris."));
}
Also used : StageResultMessage(com.thoughtworks.go.server.messaging.StageResultMessage) Username(com.thoughtworks.go.server.domain.Username) Stage(com.thoughtworks.go.domain.Stage) StringContains.containsString(org.hamcrest.core.StringContains.containsString) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString) Pipeline(com.thoughtworks.go.domain.Pipeline) Test(org.junit.Test)

Example 7 with StageResultMessage

use of com.thoughtworks.go.server.messaging.StageResultMessage in project gocd by gocd.

the class StageNotificationServiceIntegrationTest method shouldSendEmailWhenStageBreaks.

@Test
public void shouldSendEmailWhenStageBreaks() throws SQLException {
    String jezMail = prepareOneMatchedUser(StageEvent.Breaks);
    Pipeline pipeline = pipelineFixture.createdPipelineWithAllStagesPassed();
    Stage ftStage = mockStageServiceWithStage(pipeline);
    stageNotificationListener.onMessage(new StageResultMessage(ftStage.getIdentifier(), StageEvent.Breaks, Username.BLANK));
    String subject = "Stage [" + ftStage.getIdentifier().stageLocator() + "]" + " is broken";
    assertThat(inMemoryEmailNotificationTopic.getSubject(jezMail), is(subject));
    assertThat(inMemoryEmailNotificationTopic.getBody(jezMail), containsString("Sent by Go on behalf of jez"));
}
Also used : StageResultMessage(com.thoughtworks.go.server.messaging.StageResultMessage) Stage(com.thoughtworks.go.domain.Stage) StringContains.containsString(org.hamcrest.core.StringContains.containsString) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString) Pipeline(com.thoughtworks.go.domain.Pipeline) Test(org.junit.Test)

Aggregations

Pipeline (com.thoughtworks.go.domain.Pipeline)7 StageResultMessage (com.thoughtworks.go.server.messaging.StageResultMessage)7 Test (org.junit.Test)7 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)6 Stage (com.thoughtworks.go.domain.Stage)6 StringContains.containsString (org.hamcrest.core.StringContains.containsString)6 StageIdentifier (com.thoughtworks.go.domain.StageIdentifier)1 Username (com.thoughtworks.go.server.domain.Username)1 StageStatusMessage (com.thoughtworks.go.server.messaging.StageStatusMessage)1