Package net.sourceforge.pebble.web.view

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


    service.putBlogEntry(blogEntry);

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

    blogEntry = service.getBlogEntry(blog, blogEntry.getId());
    assertTrue(blogEntry.isUnpublished());
    assertTrue(view instanceof RedirectView);
  }
View Full Code Here


    String yearAsStriing = request.getParameter("year");
    String monthAsString = request.getParameter("month");

    Calendar cal = blog.getCalendar();
    LogSummary logSummary;
    View view;

    if (yearAsStriing != null && yearAsStriing.length() > 0 &&
        monthAsString != null && monthAsString.length() > 0) {
      int year = Integer.parseInt(yearAsStriing);
      int month = Integer.parseInt(monthAsString)-1;
View Full Code Here

        try {
          Model model = new Model();
          model.put(Constants.BLOG_KEY, blog);
          model.put(Constants.BLOG_URL, blog.getUrl());
          action.setModel(model);
          View view;
          try {
            view = action.process(request, response);
          } catch (ClassCastException cce) {
            // PEBBLE-45 Actions intended for single blog mode should fail nicely.  This is a simple method that will
            // allow has to handle all actions with minimal effort
            if (cce.getMessage().contains(MultiBlog.class.getName()) && cce.getMessage().contains(Blog.class.getName())) {
              view = new MultiBlogNotSupportedView();
            } else {
              throw cce;
            }
          }
          if (view != null) {

            view.setModel(model);
            view.setServletContext(servletContext);

            view.prepare();

            for (Object key : model.keySet()) {
              request.setAttribute(key.toString(), model.get(key.toString()));
            }

            response.setContentType(view.getContentType());
            view.dispatch(request, response, servletContext);

          }
        } catch (Exception e) {
          request.setAttribute("exception", e);
          throw new ServletException(e);
View Full Code Here

  /**
   * Tests that the resulting view is decorated in the standard theme.
   */
  public void testLoginPage() throws Exception {
    View view = action.process(request, response);
    assertTrue(view instanceof LoginPageView);
  }
View Full Code Here

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

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

    // check file information available and the right view is returned
    assertEquals("Testing...", action.getModel().get("fileContent"));
    assertEquals(FileMetaData.BLOG_FILE, action.getModel().get("type"));
    FileMetaData fileMetaData = (FileMetaData)action.getModel().get("file");
View Full Code Here

  public void testEditFileReturnsForbiddenWheOutsideOfRoot() throws Exception {
    request.setParameter("path", "/");
    request.setParameter("name", "../afile.txt");
    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

    assertEquals(1, roles.length);
    assertEquals(Constants.BLOG_CONTRIBUTOR_ROLE, roles[0]);
  }

  public void testActionCalledWithDefaultParameters() throws Exception {
    View view = action.process(request, response);
    assertTrue(view instanceof ResponsesView);

    assertEquals("approved", model.get("type"));
    Pageable pageable = (Pageable)model.get("pageable");
    assertNotNull("pageable", pageable);
View Full Code Here

      comment.setApproved();
    }
    service.putBlogEntry(blogEntry);
   

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

    assertEquals("approved", model.get("type"));
    Pageable pageable = (Pageable)model.get("pageable");
    assertNotNull("pageable", pageable);
View Full Code Here

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

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

    BlogEntry blogEntry = (BlogEntry)action.getModel().get(Constants.BLOG_ENTRY_KEY);
    assertEquals(newBlogEntry, blogEntry);

    assertTrue(view instanceof BlogEntryFormView);
View Full Code Here

  /**
   * Tests that the action works.
   */
  public void testViewFeeds() throws Exception {
    View view = action.process(request, response);

    assertTrue(view instanceof FeedsView);
    assertNotNull(action.getModel().get("categories"));
    assertTrue(action.getModel().get("categories") instanceof Collection);
//
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.