Examples of CommentRepository


Examples of com.nurkiewicz.jdbcrepository.repositories.CommentRepository

  public static final int ORACLE_PORT = Integer.parseInt(System.getProperty("oracle.port", "1521"));

  @Bean
  @Override
  public CommentRepository commentRepository() {
    return new CommentRepository("comments");
  }
View Full Code Here

Examples of com.nurkiewicz.jdbcrepository.repositories.CommentRepository

  public static final int MSSQL_PORT = Integer.parseInt(System.getProperty("mssql.port", "1433"));

  @Bean
  @Override
  public CommentRepository commentRepository() {
    return new CommentRepository("comments");
  }
View Full Code Here

Examples of com.nurkiewicz.jdbcrepository.repositories.CommentRepository

@Configuration
public class JdbcRepositoryTestDerbyConfig extends JdbcRepositoryTestConfig {

  @Override
  public CommentRepository commentRepository() {
    return new CommentRepository(CommentRepository.MAPPER,
        new RowUnmapper<Comment>() {
          @Override
          public Map<String, Object> mapColumns(Comment comment) {
            Map<String, Object> mapping = new LinkedHashMap<String, Object>();
            mapping.put("ID", comment.getId());
View Full Code Here

Examples of com.nurkiewicz.jdbcrepository.repositories.CommentRepository

  @Bean
  public abstract DataSource dataSource();

  @Bean
  public CommentRepository commentRepository() {
    return new CommentRepository("COMMENTS");
  }
View Full Code Here

Examples of com.nurkiewicz.jdbcrepository.repositories.CommentRepository

  public static final int POSTGRESQL_PORT = 5432;

  @Bean
  @Override
  public CommentRepository commentRepository() {
    return new CommentRepository("comments");
  }
View Full Code Here

Examples of com.nurkiewicz.jdbcrepository.repositories.CommentRepository

  public static final int MSSQL_PORT = Integer.parseInt(System.getProperty("mssql2012.port", "1433"));

  @Bean
  @Override
  public CommentRepository commentRepository() {
    return new CommentRepository("comments");
  }
View Full Code Here

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

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

Examples of org.b3log.solo.repository.CommentRepository

     *
     * @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

Examples of org.b3log.solo.repository.CommentRepository

     *
     * @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
Copyright © 2018 www.massapi.com. 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.