Package org.uned.agonzalo16.bitacora.domain

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


    if (result.hasErrors()) {
      return "blog/create";
    }

    Blog blog = new Blog();
    blog.setCreationDate(new Date());
    blog.setDescription(form.getDescription());
    blog.setName(form.getName());

    blogDao.merge(blog);
    searchService.addBlog(blog);

    return "redirect:/admin/blog/list";
View Full Code Here


    if (result.hasErrors()) {
      return "blog/update";
    }

    Blog blog = blogDao.get(form.getId());
    blog.setDescription(form.getDescription());
    blog.setName(form.getName());

    blogDao.merge(blog);
    searchService.addBlog(blog);

    return "redirect:/admin/blog/list";
View Full Code Here

  @Autowired
  private AuthenticationProvider authenticationProvider;

  @RequestMapping(method = RequestMethod.GET, value = "/{id}")
  public String show(@PathVariable("id") Long id, @RequestParam(value = "day", required = false) String day, Model model) {
    Blog blog = blogDao.get(id);
    model.addAttribute("blog", blog);

    List<Article> articles = articleDao.findByBlog(blog);

    if (day != null) {
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

    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

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.