Package org.jtalks.jcommune.model.entity

Examples of org.jtalks.jcommune.model.entity.CodeReviewComment


        permissionService.checkPermission(
                review.getTopic().getBranch().getId(),
                AclClassName.BRANCH,
                BranchPermission.LEAVE_COMMENTS_IN_CODE_REVIEW);

        CodeReviewComment comment = new CodeReviewComment();
        comment.setLineNumber(lineNumber);
        comment.setBody(body);
        comment.setCreationDate(new DateTime(System.currentTimeMillis()));
        comment.setAuthor(currentUser);
        if (currentUser.isAutosubscribe()) {
            review.getSubscribers().add(currentUser);
        }

        review.addComment(comment);
View Full Code Here


     * {@inheritDoc}
     */
    @Override
    public CodeReviewComment updateComment(long id, String body, long branchId) throws NotFoundException {

        CodeReviewComment comment = get(id);
        checkHasUpdatePermission(comment, branchId);

        comment.setBody(body);
        getDao().saveOrUpdate(comment);

        return comment;
    }
View Full Code Here


    @Test
    public void testDeletionReview() {
        CodeReview review = PersistedObjectsFactory.getDefaultCodeReview();
        CodeReviewComment comment0 = review.getComments().get(0);
        CodeReviewComment comment1 = review.getComments().get(1);

        codeReviewDao.delete(review);
        session.flush();
        session.evict(review);

        assertNull(codeReviewDao.get(review.getId()));
        assertNull(codeReviewCommentDao.get(comment0.getId()));
        assertNull(codeReviewCommentDao.get(comment1.getId()));
    }
View Full Code Here

        breadcrumbList.add(section);
        Breadcrumb branch = new Breadcrumb(1L, BreadcrumbLocation.BRANCH, "Russian Hockey");
        breadcrumbList.add(branch);
        List<Post> posts = new ArrayList<>();
        JCUser mrVasiliy = new JCUser("Mr. Vasiliy", "", "");
        CodeReviewComment comment = new CodeReviewComment();
        comment.setAuthor(mrVasiliy);
        comment.setBody("Lorem ipsum <strong>dolor</strong> sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.");
        comment.setCreationDate(new DateTime());
        Post p1 = new Post(mrVasiliy, "Lorem ipsum <strong>dolor</strong> sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.");
        p1.getComments().add(comment);
        p1.getComments().add(comment);
        p1.getComments().add(comment);
        p1.getComments().add(comment);
View Full Code Here

   
    private CodeReview getCodeReview() {
        CodeReview review = new CodeReview();
        review.setId(REVIEW_ID);
       
        CodeReviewComment comment1 = new CodeReviewComment();
        comment1.setId(1L);
        comment1.setAuthor(new JCUser("username1", "mail1", "password1" ));
        comment1.setBody("Comment1 body");
        comment1.setLineNumber(1);
        comment1.setCreationDate(new DateTime(1));
        review.addComment(comment1);
       
        CodeReviewComment comment2 = new CodeReviewComment();
        comment2.setId(2L);
        comment2.setAuthor(new JCUser("username2", "mail2", "password2" ));
        comment2.setBody("Comment2 body");
        comment2.setLineNumber(2);
        comment2.setCreationDate(new DateTime(2));
        review.addComment(comment1);

        return review;
    }
View Full Code Here

public class CodeReviewCommentDtoTest {

    @Test
    public void testConstructor() {
        CodeReviewComment comment = createComment();
       
        CodeReviewCommentDto dto = new CodeReviewCommentDto(comment);
       
        assertEquals(dto.getId(), comment.getId());
        assertEquals(dto.getLineNumber(), comment.getLineNumber());
        assertEquals(dto.getBody(), comment.getBody());
        assertEquals(dto.getAuthorId(), comment.getAuthor().getId());
        assertEquals(dto.getAuthorUsername(), comment.getAuthor().getEncodedUsername());
    }
View Full Code Here

        assertEquals(dto.getAuthorId(), comment.getAuthor().getId());
        assertEquals(dto.getAuthorUsername(), comment.getAuthor().getEncodedUsername());
    }
   
    private CodeReviewComment createComment() {
        CodeReviewComment comment = new CodeReviewComment();
        comment.setId(1L);
        comment.setAuthor(new JCUser("username1", "mail1", "password1" ));
        comment.setBody("Comment1 body");
        comment.setLineNumber(1);
        comment.setCreationDate(new DateTime(1));
       
        return comment;
    }
View Full Code Here

    }

    @Test
    public void testDeleteComment() throws NotFoundException {
        CodeReview cr = new CodeReview();
        CodeReviewComment crc = new CodeReviewComment();

        when(codeReviewService.get(REVIEW_ID)).thenReturn(cr);
        when(codeReviewCommentService.get(COMMENT_ID)).thenReturn(crc);
        JsonResponse jsonResponse = controller.deleteComment(COMMENT_ID, REVIEW_ID);
View Full Code Here

        assertEquals(response.getReason(), JsonResponseReason.ENTITY_NOT_FOUND);
        assertNull(response.getResult());
    }

    private CodeReviewComment createComment() {
        CodeReviewComment comment = new CodeReviewComment();
        comment.setId(COMMENT_ID);
        comment.setBody(COMMENT_BODY);
        comment.setLineNumber(COMMENT_LINE_NUMBER);
        codeReview.addComment(comment);

        JCUser user = currentUser();
        comment.setAuthor(user);

        return comment;
    }
View Full Code Here

   
    /*===== Common methods =====*/

    @Test
    public void testGet() {
        CodeReviewComment review = PersistedObjectsFactory.getDefaultCodeReviewComment();
        session.save(review);

        CodeReviewComment result = codeReviewCommentDao.get(review.getId());

        assertNotNull(result);
        assertEquals(result.getId(), review.getId());
        assertEquals(result.getBody(), review.getBody());
        assertEquals(result.getCreationDate(), review.getCreationDate());
        assertEquals(result.getAuthor(), review.getAuthor());
    }
View Full Code Here

TOP

Related Classes of org.jtalks.jcommune.model.entity.CodeReviewComment

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.