Package net.sourceforge.pebble.web.view

Examples of net.sourceforge.pebble.web.view.View


    assertTrue(view instanceof NotFoundView);
  }

  public void testViewNonExistentBlogEntry() throws Exception {
    request.setParameter("entry", "1234567890123");
    View view = action.process(request, response);

    assertTrue(view instanceof NotFoundView);
  }
View Full Code Here


    BlogService service = new BlogService();
    service.putBlogEntry(blogEntry1);

    SecurityUtils.runAsUnauthenticated();
    request.setParameter("entry", blogEntry1.getId());
    View view = action.process(request, response);

    BlogEntry blogEntry2 = (BlogEntry)action.getModel().get(Constants.BLOG_ENTRY_KEY);
    assertEquals(blogEntry1.getId(), blogEntry2.getId());
    assertTrue(view instanceof BlogEntryView);
  }
View Full Code Here

    BlogService service = new BlogService();
    service.putBlogEntry(blogEntry1);

    SecurityUtils.runAsAnonymous();
    request.setParameter("entry", blogEntry1.getId());
    View view = action.process(request, response);

    BlogEntry blogEntry2 = (BlogEntry)action.getModel().get(Constants.BLOG_ENTRY_KEY);
    assertNull(blogEntry2);
    assertTrue(view instanceof NotFoundView);
  }
View Full Code Here

    BlogService service = new BlogService();
    service.putBlogEntry(blogEntry1);

    SecurityUtils.runAsBlogContributor();
    request.setParameter("entry", blogEntry1.getId());
    View view = action.process(request, response);

    BlogEntry blogEntry2 = (BlogEntry)action.getModel().get(Constants.BLOG_ENTRY_KEY);
    assertEquals(blogEntry1.getId(), blogEntry2.getId());
    assertTrue(view instanceof BlogEntryView);
  }
View Full Code Here

    request.setParameter("path", "/");
    request.setParameter("name", "afile.txt");
    request.setParameter("type", FileMetaData.BLOG_FILE);
    request.setParameter("fileContent", "Some content.");

    View view = action.process(request, response);

    // check file was saved and the right view is returned
    FileManager fileManager = new FileManager(blog, FileMetaData.BLOG_FILE);
    assertEquals("Some content.", fileManager.loadFile("/", "afile.txt"));
    assertTrue(view instanceof ForwardView);
View Full Code Here

    request.setParameter("path", "/");
    request.setParameter("name", "../afile.txt");
    request.setParameter("fileContent", "some content");
    request.setParameter("type", FileMetaData.BLOG_FILE);

    View view = action.process(request, response);

    // check a forbidden response is returned
    assertTrue(view instanceof ForbiddenView);
  }
View Full Code Here

    super.setUp();
  }

  public void testViewTags() throws Exception {
    View view = action.process(request, response);

    assertTrue(view instanceof CategoriesView);
    assertEquals("/WEB-INF/jsp/viewCategories.jsp", ((CategoriesView)view).getUri());
  }
View Full Code Here

    // now execute the action
    request.setParameter("entry", blogEntry.getId());
    request.setParameter("publishDate", "now");
    request.setParameter("submit", "Publish");
    View view = action.process(request, response);

    blogEntry = (BlogEntry)blog.getRecentBlogEntries(1).get(0);
    assertTrue(blogEntry.isPublished());
    assertEquals(new Date().getTime(), blogEntry.getDate().getTime(), 1000);
    assertTrue(view instanceof RedirectView);
View Full Code Here

    // now execute the action
    request.setParameter("entry", blogEntry.getId());
    request.setParameter("publishDate", "as-is");
    request.setParameter("submit", "Publish");
    View view = action.process(request, response);

    blogEntry = service.getBlogEntry(blog, blogEntry.getId());
    assertTrue(blogEntry.isPublished());
    assertEquals(new Date(100000), blogEntry.getDate());
View Full Code Here

    // now execute the action
    request.setParameter("entry", blogEntry.getId());
    request.setParameter("publishDate", "now");
    request.setParameter("submit", "Publish");
    View view = action.process(request, response);

    blogEntry = (BlogEntry)blog.getRecentBlogEntries(1).get(0);
    assertTrue(blogEntry.isPublished());
    assertEquals(new Date().getTime(), blogEntry.getDate().getTime(), 1000);
View Full Code Here

TOP

Related Classes of net.sourceforge.pebble.web.view.View

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.