Search in sources :

Example 6 with BasicComment

use of com.cloudogu.scm.review.comment.service.BasicComment in project scm-review-plugin by scm-manager.

the class PermissionCheckTest method shouldNotFailOnModificationsForAuthor.

@Test
@SubjectAware(username = "trillian", password = "secret")
public void shouldNotFailOnModificationsForAuthor() {
    BasicComment comment = createComment("trillian");
    PermissionCheck.checkModifyComment(createRepository(), comment);
}
Also used : BasicComment(com.cloudogu.scm.review.comment.service.BasicComment) Test(org.junit.Test) SubjectAware(com.github.sdorra.shiro.SubjectAware)

Example 7 with BasicComment

use of com.cloudogu.scm.review.comment.service.BasicComment in project scm-review-plugin by scm-manager.

the class PermissionCheckTest method shouldAllowModificationsForPushPermission.

@Test
@SubjectAware(username = "slarti", password = "secret")
public void shouldAllowModificationsForPushPermission() {
    BasicComment comment = createComment("author");
    boolean modificationsAllowed = PermissionCheck.mayModifyComment(createRepository(), comment);
    assertTrue(modificationsAllowed);
}
Also used : BasicComment(com.cloudogu.scm.review.comment.service.BasicComment) Test(org.junit.Test) SubjectAware(com.github.sdorra.shiro.SubjectAware)

Example 8 with BasicComment

use of com.cloudogu.scm.review.comment.service.BasicComment in project scm-review-plugin by scm-manager.

the class PermissionCheckTest method shouldNotFailOnModificationsForPushPermission.

@Test
@SubjectAware(username = "slarti", password = "secret")
public void shouldNotFailOnModificationsForPushPermission() {
    BasicComment comment = createComment("trillian");
    PermissionCheck.checkModifyComment(createRepository(), comment);
}
Also used : BasicComment(com.cloudogu.scm.review.comment.service.BasicComment) Test(org.junit.Test) SubjectAware(com.github.sdorra.shiro.SubjectAware)

Example 9 with BasicComment

use of com.cloudogu.scm.review.comment.service.BasicComment in project scm-review-plugin by scm-manager.

the class MentionMapperTest method shouldParseUserIdsToDisplayNames.

@Test
void shouldParseUserIdsToDisplayNames() {
    setupExistingUserMock("dent", "Arthur Dent", "dent@hitchhiker.org");
    setupExistingUserMock("_anonymous", "SCM Anonymous", "anonymous@hitchhiker.org");
    BasicComment unparsedComment = Comment.createComment("1", "new comment @[dent] @[_anonymous]", "author", new Location());
    unparsedComment.setMentionUserIds(ImmutableSet.of("dent", "_anonymous"));
    BasicComment parsedComment = mentionMapper.parseMentionsUserIdsToDisplayNames(unparsedComment);
    assertThat(parsedComment.getComment()).isEqualTo("new comment @Arthur Dent @SCM Anonymous");
}
Also used : BasicComment(com.cloudogu.scm.review.comment.service.BasicComment) Location(com.cloudogu.scm.review.comment.service.Location) Test(org.junit.jupiter.api.Test)

Aggregations

BasicComment (com.cloudogu.scm.review.comment.service.BasicComment)9 SubjectAware (com.github.sdorra.shiro.SubjectAware)6 Test (org.junit.Test)6 Location (com.cloudogu.scm.review.comment.service.Location)2 BasicCommentEvent (com.cloudogu.scm.review.comment.service.BasicCommentEvent)1 Comment (com.cloudogu.scm.review.comment.service.Comment)1 CommentEvent (com.cloudogu.scm.review.comment.service.CommentEvent)1 CommentService (com.cloudogu.scm.review.comment.service.CommentService)1 Reply (com.cloudogu.scm.review.comment.service.Reply)1 ReplyEvent (com.cloudogu.scm.review.comment.service.ReplyEvent)1 Subscribe (com.github.legman.Subscribe)1 Collection (java.util.Collection)1 Objects (java.util.Objects)1 Function (java.util.function.Function)1 Collectors (java.util.stream.Collectors)1 Inject (javax.inject.Inject)1 Test (org.junit.jupiter.api.Test)1 EagerSingleton (sonia.scm.EagerSingleton)1 HandlerEventType (sonia.scm.HandlerEventType)1 Extension (sonia.scm.plugin.Extension)1