Package org.uned.agonzalo16.bitacora.domain

Examples of org.uned.agonzalo16.bitacora.domain.Message


  @Autowired
  private UserDao userDao;

  private Blog createBlog() {
    Blog blog = new Blog();
    blog.setName("blog 1");
    blog.setCreationDate(new Date());
    blog.setDescription("description 1");

    return blogDao.merge(blog);
  }
View Full Code Here


    assertNull("The entity has been deleted", commentDao.get(article, newComment.getId()));
  }

  @Test
  public void testFindByArticle() {
    Blog blog = createBlog();
    Article article1 = createArticle(blog);
    Article article2 = createArticle(blog);
    for (int i = 0; i < 10; i++) {
      Comment comment = new Comment();
      comment.setContent("comment " + i);
View Full Code Here

    assertEquals("20 comments in article 2", article2Comments.size(), 20);
  }

  @Test
  public void testCountByArticle() {
    Blog blog = createBlog();
    Article article1 = createArticle(blog);
    Article article2 = createArticle(blog);
    for (int i = 0; i < 10; i++) {
      Comment comment = new Comment();
      comment.setContent("comment " + i);
View Full Code Here

    assertEquals("20 comments in article 2", commentDao.countByArticle(article2), 20);
  }

  @Test
  public void testDeleteAricleWithComments() {
    Blog blog = createBlog();
    Article article1 = createArticle(blog);
    Article article2 = createArticle(blog);
    for (int i = 0; i < 10; i++) {
      Comment comment = new Comment();
      comment.setContent("comment " + i);
View Full Code Here

  private BlogDao blogDao;

  @Test
  public void testList() {
    for (int i = 0; i < 100; i++) {
      Blog blog = new Blog();
      blog.setName("blog " + i);
      blog.setCreationDate(new Date());
      blog.setDescription("description " + i);

      blogDao.merge(blog);
    }

    List<Blog> allBlogs = blogDao.findAll();
View Full Code Here

    assertEquals("100 blogs in datastore", allBlogs.size(), 100);
  }

  @Test
  public void testSave() {
    Blog blog = new Blog();
    blog.setName("blog 1");
    blog.setCreationDate(new Date());
    blog.setDescription("description 1");

    Blog newBlog = blogDao.merge(blog);

    assertEquals("Id must be the same", blog.getId(), newBlog.getId());
  }
View Full Code Here

  @Autowired
  private UserDao userDao;

  private Blog createBlog() {
    Blog blog = new Blog();
    blog.setName("blog 1");
    blog.setCreationDate(new Date());
    blog.setDescription("description 1");

    return blogDao.merge(blog);
  }
View Full Code Here

    return userDao.merge(user);
  }

  @Test
  public void testList() {
    Blog blog = createBlog();
    User user = createUser();
    for (int i = 0; i < 100; i++) {
      BlogContribution bc = new BlogContribution();
      bc.setCreationDate(new Date());
      bc.setBlog(blog);
View Full Code Here

    assertNull("The entity has been deleted", blogContributionDao.get(newBc.getId()));
  }

  @Test
  public void testFindByBlog() {
    Blog blog1 = createBlog();
    Blog blog2 = createBlog();
    for (int i = 0; i < 10; i++) {
      BlogContribution bc = new BlogContribution();
      bc.setCreationDate(new Date());
      bc.setBlog(blog1);
      bc.setUser(createUser());
View Full Code Here

    assertEquals("20 articles in user 2", blogContributionDao.findByUser(user2).size(), 20);
  }

  @Test
  public void testDeleteBlog() {
    Blog blog1 = createBlog();
    Blog blog2 = createBlog();
    for (int i = 0; i < 10; i++) {
      BlogContribution bc = new BlogContribution();
      bc.setCreationDate(new Date());
      bc.setBlog(blog1);
      bc.setUser(createUser());

      blogContributionDao.merge(bc);
    }

    for (int i = 10; i < 30; i++) {
      BlogContribution bc = new BlogContribution();
      bc.setCreationDate(new Date());
      bc.setBlog(blog2);
      bc.setUser(createUser());

      blogContributionDao.merge(bc);
    }

    assertEquals("30 contributions in datastore", blogContributionDao.findAll().size(), 30);
    assertEquals("10 articles in blog 1", blogContributionDao.findByBlog(blog1).size(), 10);
    assertEquals("20 articles in blog 2", blogContributionDao.findByBlog(blog2).size(), 20);

    blogDao.delete(blog1.getId());
    assertEquals("20 contributions in datastore", blogContributionDao.findAll().size(), 20);

    blogDao.delete(blog2.getId());
    assertEquals("0 contributions in datastore", blogContributionDao.findAll().size(), 0);
  }
View Full Code Here

TOP

Related Classes of org.uned.agonzalo16.bitacora.domain.Message

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.