Package org.b3log.solo.repository

Examples of org.b3log.solo.repository.CommentRepository


        }

        final LatkeBeanManager beanManager = Lifecycle.getBeanManager();
        final PreferenceQueryService preferenceQueryService = beanManager.getReference(PreferenceQueryService.class);
       
        final CommentRepository commentRepository = beanManager.getReference(CommentRepositoryImpl.class);
       
        try {
            final String commentEmail = comment.getString(Comment.COMMENT_EMAIL);
            final JSONObject originalComment = commentRepository.get(originalCommentId);
            final String originalCommentEmail = originalComment.getString(Comment.COMMENT_EMAIL);

            if (originalCommentEmail.equalsIgnoreCase(commentEmail)) {
                return;
            }
View Full Code Here


        }

        final LatkeBeanManager beanManager = Lifecycle.getBeanManager();
        final PreferenceQueryService preferenceQueryService = beanManager.getReference(PreferenceQueryService.class);
       
        final CommentRepository commentRepository = beanManager.getReference(CommentRepositoryImpl.class);
       
        try {
            final String commentEmail = comment.getString(Comment.COMMENT_EMAIL);
            final JSONObject originalComment = commentRepository.get(originalCommentId);
            final String originalCommentEmail = originalComment.getString(Comment.COMMENT_EMAIL);

            if (originalCommentEmail.equalsIgnoreCase(commentEmail)) {
                return;
            }
View Full Code Here

     *
     * @throws Exception exception
     */
    @Test
    public void add() throws Exception {
        final CommentRepository commentRepository = getCommentRepository();

        final JSONObject comment = new JSONObject();

        comment.put(Comment.COMMENT_CONTENT, "comment1 content");
        comment.put(Comment.COMMENT_DATE, new Date());
        comment.put(Comment.COMMENT_EMAIL, "test@gmail.com");
        comment.put(Comment.COMMENT_NAME, "comment1 name");
        comment.put(Comment.COMMENT_ON_ID, "comment1 on id");
        comment.put(Comment.COMMENT_ON_TYPE, "comment1 on type");
        comment.put(Comment.COMMENT_ORIGINAL_COMMENT_ID, "");
        comment.put(Comment.COMMENT_ORIGINAL_COMMENT_NAME, "");
        comment.put(Comment.COMMENT_SHARP_URL, "comment1 sharp url");
        comment.put(Comment.COMMENT_URL, "comment1 url");
        comment.put(Comment.COMMENT_THUMBNAIL_URL, "comment1 thumbnail url");

        final Transaction transaction = commentRepository.beginTransaction();
        commentRepository.add(comment);
        transaction.commit();

        final List<JSONObject> comments =
                commentRepository.getComments("comment1 on id", 1,
                                              Integer.MAX_VALUE);
        Assert.assertNotNull(comments);
        Assert.assertEquals(comments.size(), 1);

        Assert.assertEquals(
                commentRepository.getComments("not found", 1, Integer.MAX_VALUE).
                size(), 0);
       
        Assert.assertEquals(commentRepository.getRecentComments(3).size(), 1);
    }
View Full Code Here

     *
     * @throws Exception exception
     */
    @Test
    public void add() throws Exception {
        final CommentRepository commentRepository = getCommentRepository();

        final JSONObject comment = new JSONObject();

        comment.put(Comment.COMMENT_CONTENT, "comment1 content");
        comment.put(Comment.COMMENT_DATE, new Date());
        comment.put(Comment.COMMENT_EMAIL, "test@gmail.com");
        comment.put(Comment.COMMENT_NAME, "comment1 name");
        comment.put(Comment.COMMENT_ON_ID, "comment1 on id");
        comment.put(Comment.COMMENT_ON_TYPE, "comment1 on type");
        comment.put(Comment.COMMENT_ORIGINAL_COMMENT_ID, "");
        comment.put(Comment.COMMENT_ORIGINAL_COMMENT_NAME, "");
        comment.put(Comment.COMMENT_SHARP_URL, "comment1 sharp url");
        comment.put(Comment.COMMENT_URL, "comment1 url");
        comment.put(Comment.COMMENT_THUMBNAIL_URL, "comment1 thumbnail url");

        final Transaction transaction = commentRepository.beginTransaction();
        commentRepository.add(comment);
        transaction.commit();

        final List<JSONObject> comments =
                commentRepository.getComments("comment1 on id", 1,
                                              Integer.MAX_VALUE);
        Assert.assertNotNull(comments);
        Assert.assertEquals(comments.size(), 1);

        Assert.assertEquals(
                commentRepository.getComments("not found", 1, Integer.MAX_VALUE).
                size(), 0);
       
        Assert.assertEquals(commentRepository.getRecentComments(3).size(), 1);
    }
View Full Code Here

TOP

Related Classes of org.b3log.solo.repository.CommentRepository

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.