Package net.sourceforge.pebble.domain

Examples of net.sourceforge.pebble.domain.BlogService


  /**
   * Tests that a permalink can be generated for a blog entry.
   */
  public void testBlogEntryPermalink() throws Exception {
    BlogService service = new BlogService();
    BlogEntry blogEntry = new BlogEntry(blog);
    service.putBlogEntry(blogEntry);

    String prefix = "/";
    String suffix = "";

    blogEntry.setTitle("Here is a title");
View Full Code Here


  /**
   * Tests that a permalink can be generated for a blog entry when there are
   * duplicate titles for the same day.
   */
  public void testBlogEntryPermalinkForEntriesWithSameTitle() throws Exception {
    BlogService service = new BlogService();

    BlogEntry blogEntry1 = new BlogEntry(blog);
    blogEntry1.setTitle("A Title");
    service.putBlogEntry(blogEntry1);

    String prefix = "/";
    String suffix = "";
    assertEquals(prefix + "a-title" + suffix, permalinkProvider.getPermalink(blogEntry1));

    // now add another with the same name
    BlogEntry blogEntry2 = new BlogEntry(blog);
    blogEntry2.setTitle("A Title");
    service.putBlogEntry(blogEntry2);

    assertEquals(prefix + "a-title" + suffix, permalinkProvider.getPermalink(blogEntry1));
    assertEquals(prefix + "a-title_" + blogEntry2.getId() + suffix, permalinkProvider.getPermalink(blogEntry2));

    // now add another with the same name a year ahead
    BlogEntry blogEntry3 = new BlogEntry(blog);
    blogEntry3.setTitle("A Title");
    Calendar cal = Calendar.getInstance();
    cal.add(Calendar.YEAR, 1);
    blogEntry3.setDate(cal.getTime());
    service.putBlogEntry(blogEntry3);

    assertEquals(prefix + "a-title" + suffix, permalinkProvider.getPermalink(blogEntry1));
    assertEquals(prefix + "a-title_" + blogEntry2.getId() + suffix, permalinkProvider.getPermalink(blogEntry2));
    assertEquals(prefix + "a-title_" + blogEntry3.getId() + suffix, permalinkProvider.getPermalink(blogEntry3));
  }
View Full Code Here

  /**
   * Tests that the correct blog entry can be found from a permalink.
   */
  public void testGetBlogEntry() throws Exception {
    BlogService service = new BlogService();

    BlogEntry blogEntry1 = new BlogEntry(blog);
    blogEntry1.setTitle("A Title");
    service.putBlogEntry(blogEntry1);

    BlogEntry blogEntry2 = new BlogEntry(blog);
    blogEntry2.setTitle("Some other title");
    service.putBlogEntry(blogEntry2);

    BlogEntry blogEntry3 = new BlogEntry(blog);
    blogEntry3.setTitle("Some other itle");
    service.putBlogEntry(blogEntry3);

    BlogEntry blogEntry4 = new BlogEntry(blog);
    blogEntry4.setTitle("������");
    service.putBlogEntry(blogEntry4);

    String uri = permalinkProvider.getPermalink(blogEntry1);
    assertEquals(blogEntry1, permalinkProvider.getBlogEntry(uri));
    uri = permalinkProvider.getPermalink(blogEntry2);
    assertEquals(blogEntry2, permalinkProvider.getBlogEntry(uri));
View Full Code Here

    String trackBackUrl = request.getParameter("url");
    String excerpt = request.getParameter("excerpt");
    String trackBackResponseMessage;
    Integer trackBackResponseCode;

    BlogService service = new BlogService();
    BlogEntry blogEntry = null;
    if (entryId != null) {
      try {
        blogEntry = service.getBlogEntry(blog, entryId);
      } catch (BlogServiceException e) {
        throw new ServletException(e);
      }
    }
View Full Code Here

  /**
   * Tests that the correct aggregated blog entry can be found from a permalink.
   */
  public void testGetAggregatedBlogEntry() throws Exception {
    BlogService service = new BlogService();

    BlogEntry blogEntry = new BlogEntry(blog);
    blogEntry.setTitle("A Title");
    blogEntry.setOriginalPermalink("http://www.someotherdomain.com/blog/abc.html");
    service.putBlogEntry(blogEntry);

    String uri = permalinkProvider.getPermalink(blogEntry);
    assertEquals(blogEntry, permalinkProvider.getBlogEntry(uri));
  }
View Full Code Here

   * Tests that a permalink is changed when the blog entry title changes.
   */
  public void testBlogEntryPermalinkChangesWithTitle() throws Exception {
    blog.setPermalinkProvider(new Latin1SeoPermalinkProvider());

    BlogService service = new BlogService();

    BlogEntry blogEntry = new BlogEntry(blog);
    service.putBlogEntry(blogEntry);

    String prefix = blog.getUrl();
    String suffix = "";

    blogEntry.setTitle("Here is a title");
View Full Code Here

  /**
   * Tests that a permalink can be generated for a blog entry.
   */
  public void testBlogEntryPermalink() throws Exception {
    BlogService service = new BlogService();
    BlogEntry blogEntry = new BlogEntry(blog);
    service.putBlogEntry(blogEntry);

    SimpleDateFormat sdf = new SimpleDateFormat("yyyy'/'MM'/'dd'/'");
    sdf.setTimeZone(blog.getTimeZone());
    StringBuffer buf = new StringBuffer();
    buf.append("/");
View Full Code Here

  /**
   * Tests that the correct blog entry can be found from a permalink.
   */
  public void testGetBlogEntry() throws Exception {
    BlogService service = new BlogService();
    BlogEntry blogEntry1 = new BlogEntry(blog);
    BlogEntry blogEntry2 = new BlogEntry(blog);
    service.putBlogEntry(blogEntry1);

    Calendar cal = blog.getCalendar();
    cal.set(Calendar.YEAR, 2000);
    blogEntry2.setDate(cal.getTime());
    service.putBlogEntry(blogEntry2);

    String uri = permalinkProvider.getPermalink(blogEntry1);
    assertEquals(blogEntry1, permalinkProvider.getBlogEntry(uri));
    uri = permalinkProvider.getPermalink(blogEntry2);
    assertEquals(blogEntry2, permalinkProvider.getBlogEntry(uri));
View Full Code Here

  /**
   * Tests that a permalink can be generated for a blog entry.
   */
  public void testBlogEntryPermalink() throws Exception {
    BlogService service = new BlogService();
    BlogEntry blogEntry = new BlogEntry(blog);
    service.putBlogEntry(blogEntry);

    assertEquals("/" + blogEntry.getId() + ".html", permalinkProvider.getPermalink(blogEntry));
  }
View Full Code Here

  /**
   * Tests that the correct blog entry can be found from a permalink.
   */
  public void testGetBlogEntry() throws Exception {
    BlogService service = new BlogService();
    BlogEntry blogEntry1 = new BlogEntry(blog);
    BlogEntry blogEntry2 = new BlogEntry(blog);
    service.putBlogEntry(blogEntry1);
    service.putBlogEntry(blogEntry2);

    String uri = permalinkProvider.getPermalink(blogEntry1);
    assertEquals(blogEntry1, permalinkProvider.getBlogEntry(uri));
    uri = permalinkProvider.getPermalink(blogEntry2);
    assertEquals(blogEntry2, permalinkProvider.getBlogEntry(uri));
View Full Code Here

TOP

Related Classes of net.sourceforge.pebble.domain.BlogService

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.