Package ch.entwine.weblounge.common.content.page

Examples of ch.entwine.weblounge.common.content.page.Page


    // Load the page's modification date

    String requestUrl = UrlUtils.concat(serverUrl, "system/weblounge/pages", modificationTestPageId);
    HttpGet getPageRequest = new HttpGet(requestUrl);
    HttpClient httpClient = new DefaultHttpClient();
    Page page = null;
    logger.info("Requesting the page's modification date at {}", requestUrl);
    try {
      HttpResponse response = TestUtils.request(httpClient, getPageRequest, null);
      assertEquals(HttpServletResponse.SC_OK, response.getStatusLine().getStatusCode());
      PageReader reader = new PageReader();
      page = reader.read(response.getEntity().getContent(), site);
    } finally {
      httpClient.getConnectionManager().shutdown();
    }

    DateFormat df = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss 'GMT'", Locale.US);
    df.setTimeZone(TimeZone.getTimeZone("GMT"));

    // Regularly load the page

    requestUrl = UrlUtils.concat(serverUrl, modificationTestPage);

    logger.info("Sending request to {}", requestUrl);
    HttpGet request = new HttpGet(requestUrl);
    request.addHeader("X-Cache-Debug", "yes");
    String[][] params = new String[][] { {} };

    // Send and the request and examine the response. Keep the modification
    // date.
    httpClient = new DefaultHttpClient();
    try {
      HttpResponse response = TestUtils.request(httpClient, request, params);

      int statusCode = response.getStatusLine().getStatusCode();
      boolean okOrNotModified = statusCode == HttpServletResponse.SC_OK || statusCode == HttpServletResponse.SC_NOT_MODIFIED;
      assertTrue(okOrNotModified);

      // Get the Modified header
      assertNotNull(response.getHeaders("Last-Modified"));
      assertEquals(1, response.getHeaders("Last-Modified").length);
      Date hostModified = df.parse(response.getHeaders("Last-Modified")[0].getValue());
      response.getEntity().consumeContent();

      // Make sure the page is advertised as being more recent than the page's
      // modification date
      assertTrue(hostModified.after(page.getModificationDate()));

    } finally {
      httpClient.getConnectionManager().shutdown();
    }
  }
View Full Code Here


   */
  @Test
  public void testDeleteResourceURIBoolean() throws IllegalStateException,
  ContentRepositoryException, IOException {
    ResourceURI workURI = new PageURIImpl(site, page1path, page1uuid, WORK);
    Page workPage = new PageImpl(workURI);
    workPage.setTemplate(template.getIdentifier());
    int resources = populateRepository();
    int revisions = resources;

    // Add resources and additional work resource
    repository.put(workPage);
View Full Code Here

  @Test
  public void testDeleteLinkedResource() throws Exception {
    int resources = populateRepository();

    // Add a reference
    Page page = pages[0];
    Pagelet pagelet = new PageletImpl("test", "link");
    pagelet.setProperty("resourceid", imageURI.getIdentifier());
    page.addPagelet(pagelet, "main");
    repository.put(page);

    // Delete image resource which is referenced by page
    try {
      repository.delete(imageURI);
View Full Code Here

      } else {
        subpath = root;
        rootURI = new PageURIImpl(site, root, id);
        uri = new PageURIImpl(site, root, id);
      }
      Page p = new PageImpl(uri);
      p.setTemplate(template.getIdentifier());
      repository.put(p);
    }

    // Make sure everything is the way we set it up
    SearchQuery q = new SearchQueryImpl(site).withTypes(Page.TYPE).withPath(root);
View Full Code Here

  IllegalStateException, IOException {
    ResourceURI live1URI = new PageURIImpl(site, "/weblounge");
    ResourceURI live2URI = new PageURIImpl(site, "/etc/weblounge");
    ResourceURI work2URI = new PageURIImpl(site, "/etc/weblounge", WORK);

    Page page1Live = new PageImpl(live1URI);
    Page page2Live = new PageImpl(live2URI);
    Page page2Work = new PageImpl(work2URI);

    page1Live.setTemplate(template.getIdentifier());
    page2Live.setTemplate(template.getIdentifier());
    page2Work.setTemplate(template.getIdentifier());

    // Add the pages to the index
    repository.put(page1Live);
    repository.put(page2Live);
    repository.put(page2Work);
View Full Code Here

   */
  @Test
  public void testWithoutPublication() throws IllegalStateException,
  ContentRepositoryException, IOException {
    ResourceURI workURI = new PageURIImpl(site, "/etc/weblounge", WORK);
    Page work = new PageImpl(workURI);
    work.setTemplate(template.getIdentifier());

    repository.put(work);

    SearchQuery q = new SearchQueryImpl(site);
    q.withoutPublication();
View Full Code Here

  IOException {
    int count = populateRepository();
    assertEquals(count, repository.getVersionCount() - 1);

    ResourceURI page1WorkURI = new PageURIImpl(page1URI, WORK);
    Page page2Work = new PageImpl(page1WorkURI);
    page2Work.setTemplate(template.getIdentifier());

    repository.put(page2Work);
    assertEquals(count + 1, repository.getVersionCount() - 1);
    repository.delete(page1URI, true);
    assertEquals(count - 1, repository.getVersionCount() - 1);
View Full Code Here

  @Test
  public void testLock() throws Exception {

    // Create pages and uris
    ResourceURI uriLive = new PageURIImpl(site, "/etc/weblounge");
    Page pageLive = new PageImpl(uriLive);
    pageLive.setTemplate(template.getIdentifier());
    ResourceURI uriWork = new PageURIImpl(site, "/etc/weblounge", WORK);
    Page pageWork = new PageImpl(uriWork);
    pageWork.setTemplate(template.getIdentifier());

    // Add the pages to the index
    repository.put(pageLive);
    repository.put(pageWork);
View Full Code Here

  @Test
  public void testUnlock() throws Exception {

    // Create pages and uris
    ResourceURI uriLive = new PageURIImpl(site, "/etc/weblounge");
    Page pageLive = new PageImpl(uriLive);
    pageLive.setTemplate(template.getIdentifier());
    ResourceURI uriWork = new PageURIImpl(site, "/etc/weblounge", WORK);
    Page pageWork = new PageImpl(uriWork);
    pageWork.setTemplate(template.getIdentifier());

    // Add the pages to the index
    repository.put(pageLive);
    repository.put(pageWork);
View Full Code Here

    WebUrl url = request.getUrl();
    Site site = request.getSite();

    // Load the target page used to render the action
    Page page = null;
    try {
      page = getTargetPage(action, request);
      request.setAttribute(WebloungeRequest.PAGE, page);
      // TODO: Check access rights with action configuration
    } catch (ContentRepositoryException e) {
View Full Code Here

TOP

Related Classes of ch.entwine.weblounge.common.content.page.Page

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.