Package net.sourceforge.pebble.domain

Examples of net.sourceforge.pebble.domain.BlogEntry


    Calendar cal1 = blog.getCalendar();
    cal1.set(Calendar.HOUR_OF_DAY, 9);
    Calendar cal2 = blog.getCalendar();
    cal2.set(Calendar.HOUR_OF_DAY, 10);

    BlogEntry b1 = new BlogEntry(blog);
    b1.setDate(cal1.getTime());
    BlogEntry b2 = new BlogEntry(blog);
    b2.setDate(cal2.getTime());

    assertTrue(comp.compare(b1, b1) == 0);
    assertTrue(comp.compare(b1, b2) != 0);
    assertTrue(comp.compare(b1, b2) > 0);
    assertTrue(comp.compare(b2, b1) < 0);
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);
View Full Code Here

   */
  protected void setUp() throws Exception {
    super.setUp();

    listener = new DisableResponseListener();
    blogEntry = new BlogEntry(blog);
    comment = blogEntry.createComment("Title", "Body", "Author", "me@somedomain.com", "http://www.google.com", "http://graph.facebook.com/user/picture", "127.0.0.1");
    commentEvent = new CommentEvent(comment, CommentEvent.COMMENT_ADDED);
    trackBack = blogEntry.createTrackBack("Title", "Excerpt", "url", "blogName", "127.0.0.1");
    trackBackEvent = new TrackBackEvent(trackBack, TrackBackEvent.TRACKBACK_ADDED);
  }
View Full Code Here

   */
  protected void setUp() throws Exception {
    super.setUp();

    listener = new MarkUnpublishedListener();
    blogEntry = new BlogEntry(blog);
    SecurityUtils.runAsBlogContributor();
  }
View Full Code Here

public class BlogEntryByTitleComparatorTest extends SingleBlogTestCase {

  public void testCompare() {
    PageBasedContentByTitleComparator comp = new PageBasedContentByTitleComparator();

    BlogEntry b1 = new BlogEntry(blog);
    b1.setTitle("A title");
    BlogEntry b2 = new BlogEntry(blog);
    b2.setTitle("B title");

    assertTrue(comp.compare(b1, b1) == 0);
    assertTrue(comp.compare(b1, b2) != 0);
    assertTrue(comp.compare(b1, b2) < 0);
    assertTrue(comp.compare(b2, b1) > 0);
View Full Code Here

  }

  public void testCompareIgnoreCase() {
    PageBasedContentByTitleComparator comp = new PageBasedContentByTitleComparator();

    BlogEntry b1 = new BlogEntry(blog);
    b1.setTitle("a title");
    BlogEntry b2 = new BlogEntry(blog);
    b2.setTitle("B title");

    assertTrue(comp.compare(b1, b1) == 0);
    assertTrue(comp.compare(b1, b2) != 0);
    assertTrue(comp.compare(b1, b2) < 0);
    assertTrue(comp.compare(b2, b1) > 0);
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));
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());
    String prefix = "/";
    prefix += sdf.format(blogEntry.getDate());
    String suffix = ".html";

    blogEntry.setTitle("Here is a title");
    assertEquals(prefix + "here_is_a_title" + suffix, permalinkProvider.getPermalink(blogEntry));

    blogEntry.setTitle("Here's a title");
    assertEquals(prefix + "heres_a_title" + suffix, permalinkProvider.getPermalink(blogEntry));

    blogEntry.setTitle("Here's a title!");
    assertEquals(prefix + "heres_a_title" + suffix, permalinkProvider.getPermalink(blogEntry));

    blogEntry.setTitle("Here_is_a_title");
    assertEquals(prefix + "here_is_a_title" + suffix, permalinkProvider.getPermalink(blogEntry));

    blogEntry.setTitle("Here-is-a-title");
    assertEquals(prefix + "here_is_a_title" + suffix, permalinkProvider.getPermalink(blogEntry));

    blogEntry.setTitle("Here     is    a         title");
    assertEquals(prefix + "here_is_a_title" + suffix, permalinkProvider.getPermalink(blogEntry));

    blogEntry.setTitle("Here is : a title");
    assertEquals(prefix + "here_is_a_title" + suffix, permalinkProvider.getPermalink(blogEntry));

    blogEntry.setTitle("Here is/a title");
    assertEquals(prefix + "here_is_a_title" + suffix, permalinkProvider.getPermalink(blogEntry));

    blogEntry.setTitle("Here is\\a title");
    assertEquals(prefix + "here_is_a_title" + suffix, permalinkProvider.getPermalink(blogEntry));

    blogEntry.setTitle("Here is, a title");
    assertEquals(prefix + "here_is_a_title" + suffix, permalinkProvider.getPermalink(blogEntry));

    blogEntry.setTitle("Here is; a title");
    assertEquals(prefix + "here_is_a_title" + suffix, permalinkProvider.getPermalink(blogEntry));

    blogEntry.setTitle("Here is a title.");
    assertEquals(prefix + "here_is_a_title" + suffix, permalinkProvider.getPermalink(blogEntry));

    blogEntry.setTitle(":Here is a title.");
    assertEquals(prefix + "here_is_a_title" + suffix, permalinkProvider.getPermalink(blogEntry));

    blogEntry.setTitle("Here is. a title");
    assertEquals(prefix + "here_is_a_title" + suffix, permalinkProvider.getPermalink(blogEntry));

    blogEntry.setTitle(null);
    assertEquals(prefix + blogEntry.getId() + suffix, permalinkProvider.getPermalink(blogEntry));

    blogEntry.setTitle("");
    assertEquals(prefix + blogEntry.getId() + suffix, permalinkProvider.getPermalink(blogEntry));

    blogEntry.setTitle("./:!@�$%^&*()");
    assertEquals(prefix + blogEntry.getId() + suffix, permalinkProvider.getPermalink(blogEntry));
  }
View Full Code Here

   * 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);

    SimpleDateFormat sdf = new SimpleDateFormat("yyyy'/'MM'/'dd'/'");
    sdf.setTimeZone(blog.getTimeZone());
    String prefix = "/";
    prefix += sdf.format(blogEntry1.getDate());
    String suffix = ".html";
    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));
  }
View Full Code Here

TOP

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

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.