Package org.apache.wicket.pageStore.PageWindowManager

Examples of org.apache.wicket.pageStore.PageWindowManager.PageWindow


    // Add few pages.
    // All of them fully occupy the max space in the pageWindowManager.
    // So adding N+1st page removes the Nth page.
    manager.createPageWindow(page0id, maxSize);
    PageWindow page0Window = manager.getPageWindow(page0id);
    assertWindow(page0Window, page0id, page0Window.getFilePartOffset(), page0Window.getFilePartSize());

    manager.createPageWindow(page1id, maxSize);
    PageWindow page1Window = manager.getPageWindow(page1id);
    assertWindow(page1Window, page1id, page1Window.getFilePartOffset(), page1Window.getFilePartSize());

    // Try to get a page which has been lost with the adding of page1
    assertNull("Page0 must be lost when Page1 has been added.", manager.getPageWindow(page0id));

    manager.createPageWindow(page2id, maxSize);
    PageWindow page2Window = manager.getPageWindow(page2id);
    assertWindow(page2Window, page2id, page2Window.getFilePartOffset(), page2Window.getFilePartSize());

    // Try to get a page which has been lost with the adding of page2
    assertNull("Page1 must be lost when Page2 has been added.", manager.getPageWindow(page1id));
  }
View Full Code Here


   */
  @Test
  public void addRemove()
  {
    PageWindowManager manager = new PageWindowManager(300);
    PageWindow window;

    window = manager.createPageWindow(1, 50);
    assertWindow(window, 1, 0, 50);

    window = manager.createPageWindow(2, 40);
View Full Code Here

   */
  @Test
  public void pageWindowCycle()
  {
    PageWindowManager manager = new PageWindowManager(100);
    PageWindow window;

    window = manager.createPageWindow(1, 30);

    window = manager.createPageWindow(2, 30);

View Full Code Here

      }
      // only save page that has some data
      if (data != null)
      {
        // allocate window for page
        PageWindow window = getManager().createPageWindow(pageId, data.length);

        FileChannel channel = getFileChannel(true);
        if (channel != null)
        {
          try
          {
            // write the content
            channel.write(ByteBuffer.wrap(data), window.getFilePartOffset());
          }
          catch (IOException e)
          {
            log.error("Error writing to a channel " + channel, e);
          }
View Full Code Here

      if (unbound)
      {
        return null;
      }
      byte[] result = null;
      PageWindow window = getManager().getPageWindow(id);
      if (window != null)
      {
        result = loadPage(window);
      }
      return result;
View Full Code Here

      }
      // only save page that has some data
      if (data != null)
      {
        // allocate window for page
        PageWindow window = getManager().createPageWindow(pageId, data.length);

        FileChannel channel = getFileChannel(true);
        if (channel != null)
        {
          try
          {
            // write the content
            channel.write(ByteBuffer.wrap(data), window.getFilePartOffset());
          }
          catch (IOException e)
          {
            log.error("Error writing to a channel " + channel, e);
          }
View Full Code Here

      if (unbound)
      {
        return null;
      }
      byte[] result = null;
      PageWindow window = getManager().getPageWindow(id);
      if (window != null)
      {
        result = loadPage(window);
      }
      return result;
View Full Code Here

      }
      // only save page that has some data
      if (data != null)
      {
        // allocate window for page
        PageWindow window = getManager().createPageWindow(pageId, data.length);

        FileChannel channel = getFileChannel(true);
        if (channel != null)
        {
          try
          {
            // write the content
            channel.write(ByteBuffer.wrap(data), window.getFilePartOffset());
          }
          catch (IOException e)
          {
            log.error("Error writing to a channel " + channel, e);
          }
View Full Code Here

      if (unbound)
      {
        return null;
      }
      byte[] result = null;
      PageWindow window = getManager().getPageWindow(id);
      if (window != null)
      {
        result = loadPage(window);
      }
      return result;
View Full Code Here

    // Add few pages.
    // All of them fully occupy the max space in the pageWindowManager.
    // So adding N+1st page removes the Nth page.
    manager.createPageWindow(page0id, maxSize);
    PageWindow page0Window = manager.getPageWindow(page0id);
    assertWindow(page0Window, page0id, page0Window.getFilePartOffset(), page0Window.getFilePartSize());

    manager.createPageWindow(page1id, maxSize);
    PageWindow page1Window = manager.getPageWindow(page1id);
    assertWindow(page1Window, page1id, page1Window.getFilePartOffset(), page1Window.getFilePartSize());

    // Try to get a page which has been lost with the adding of page1
    assertNull("Page0 must be lost when Page1 has been added.", manager.getPageWindow(page0id));

    manager.createPageWindow(page2id, maxSize);
    PageWindow page2Window = manager.getPageWindow(page2id);
    assertWindow(page2Window, page2id, page2Window.getFilePartOffset(), page2Window.getFilePartSize());

    // Try to get a page which has been lost with the adding of page2
    assertNull("Page1 must be lost when Page2 has been added.", manager.getPageWindow(page1id));
  }
View Full Code Here

TOP

Related Classes of org.apache.wicket.pageStore.PageWindowManager.PageWindow

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.