Search in sources :

Example 1 with SessionId

use of sonia.scm.security.SessionId in project scm-review-plugin by scm-manager.

the class EventListenerTest method shouldSendSessionIdWithMessage.

@Test
void shouldSendSessionIdWithMessage() {
    SessionId sessionId = bindSessionId("1-2-3");
    PullRequestEvent event = createPullRequestEvent();
    listener.handle(event);
    verify(channel).broadcast(captor.capture());
    assertMessageHasCorrectTypeAndName(PullRequestEvent.class);
    assertThat(captor.getValue().getSender()).contains(sessionId);
}
Also used : BasicPullRequestEvent(com.cloudogu.scm.review.pullrequest.service.BasicPullRequestEvent) PullRequestEvent(com.cloudogu.scm.review.pullrequest.service.PullRequestEvent) SessionId(sonia.scm.security.SessionId) Test(org.junit.jupiter.api.Test)

Example 2 with SessionId

use of sonia.scm.security.SessionId in project scm-review-plugin by scm-manager.

the class EventListenerTest method bindSessionId.

private SessionId bindSessionId(String sessionIdString) {
    SessionId sessionId = SessionId.valueOf(sessionIdString);
    when(principalCollection.oneByType(SessionId.class)).thenReturn(sessionId);
    return sessionId;
}
Also used : SessionId(sonia.scm.security.SessionId)

Example 3 with SessionId

use of sonia.scm.security.SessionId in project scm-review-plugin by scm-manager.

the class EventListenerTest method shouldBroadcastMessageForReplyEvent.

@Test
void shouldBroadcastMessageForReplyEvent() {
    SessionId sessionId = bindSessionId("4-2");
    ReplyEvent event = createReplyEvent();
    listener.handle(event);
    verify(channel).broadcast(captor.capture());
    assertMessageHasCorrectTypeAndName(ReplyEvent.class);
}
Also used : ReplyEvent(com.cloudogu.scm.review.comment.service.ReplyEvent) SessionId(sonia.scm.security.SessionId) Test(org.junit.jupiter.api.Test)

Aggregations

SessionId (sonia.scm.security.SessionId)3 Test (org.junit.jupiter.api.Test)2 ReplyEvent (com.cloudogu.scm.review.comment.service.ReplyEvent)1 BasicPullRequestEvent (com.cloudogu.scm.review.pullrequest.service.BasicPullRequestEvent)1 PullRequestEvent (com.cloudogu.scm.review.pullrequest.service.PullRequestEvent)1