Package org.uned.agonzalo16.bitacora.domain

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


  }

  @RequestMapping(method = RequestMethod.POST, value = "/contributors/add")
  public String addContributor(@ModelAttribute BlogContributorForm form) {

    BlogContribution bc = new BlogContribution();
    bc.setCreationDate(new Date());
    bc.setBlog(blogDao.get(form.getBlogId()));
    bc.setUser(userDao.get(form.getContributorId()));

    blogContributionDao.merge(bc);

    return "redirect:/admin/blog/contributors/" + form.getBlogId();
  }
View Full Code Here


  @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);
View Full Code Here

  @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);
      bc.setUser(user);

      blogContributionDao.merge(bc);
    }

    assertEquals("100 contributions in datastore", blogContributionDao.findAll().size(), 100);
View Full Code Here

    assertEquals("100 contributions in datastore", blogContributionDao.findAll().size(), 100);
  }

  @Test
  public void testSave() {
    BlogContribution bc = new BlogContribution();
    bc.setCreationDate(new Date());
    bc.setBlog(createBlog());
    bc.setUser(createUser());

    BlogContribution newBc = blogContributionDao.merge(bc);

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

    assertEquals("Id must be the same", bc.getId(), newBc.getId());
  }

  @Test
  public void testDelete() {
    BlogContribution bc = new BlogContribution();
    bc.setCreationDate(new Date());
    bc.setBlog(createBlog());
    bc.setUser(createUser());

    BlogContribution newBc = blogContributionDao.merge(bc);

    blogContributionDao.delete(newBc.getId());

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

  @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());

      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("10 articles in blog 1", blogContributionDao.findByBlog(blog1).size(), 10);
View Full Code Here

  @Test
  public void testFindByUser() {
    User user1 = createUser();
    User user2 = createUser();
    for (int i = 0; i < 10; i++) {
      BlogContribution bc = new BlogContribution();
      bc.setCreationDate(new Date());
      bc.setBlog(createBlog());
      bc.setUser(user1);

      blogContributionDao.merge(bc);
    }

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

      blogContributionDao.merge(bc);
    }

    assertEquals("10 articles in user 1", blogContributionDao.findByUser(user1).size(), 10);
View Full Code Here

  @Test
  public void testList() {
    Article article = createArticle(createBlog());
    for (int i = 0; i < 100; i++) {
      Comment comment = new Comment();
      comment.setContent("comment " + i);
      comment.setCreationDate(new Date());
      comment.setArticle(article);
      comment.setUser(createUser());

      commentDao.merge(comment);
    }

    List<Comment> allComments = commentDao.findAll();
View Full Code Here

  }

  @Test
  public void testSave() {
    Article article = createArticle(createBlog());
    Comment comment = new Comment();
    comment.setContent("comment 1");
    comment.setCreationDate(new Date());
    comment.setArticle(article);
    comment.setUser(createUser());

    Comment newComment = commentDao.merge(comment);

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

  }

  @Test
  public void testDelete() {
    Article article = createArticle(createBlog());
    Comment comment = new Comment();
    comment.setContent("comment 1");
    comment.setCreationDate(new Date());
    comment.setArticle(article);
    comment.setUser(createUser());

    Comment newComment = commentDao.merge(comment);

    commentDao.delete(article, newComment.getId());

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

TOP

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

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.