Package fitnesse.wiki

Examples of fitnesse.wiki.PageData


  }

  @Test
  public void testResponse() throws Exception {
    WikiPage page= WikiPageUtil.addPage(root, PathParser.parse("ChildPage"), "child content with <html>");
    PageData data = page.getData();
    WikiPageProperties properties = data.getProperties();
    properties.set(PageData.PropertySUITES, "Edit Page tags");
    page.commit(data);

    SimpleResponse response = makeResponse();
    assertEquals(200, response.getStatus());
View Full Code Here


  @Test
  public void testCreatePage() throws Exception {
    WikiPage testPage = makePage("TestPage", "contents", "attr=val");
    assertNotNull(testPage);
    PageData data = testPage.getData();
    assertEquals("contents", data.getContent());
    assertEquals("val", data.getAttribute("attr"));
  }
View Full Code Here

  }

  @Test
  public void testMultipleAttributes() throws Exception {
    WikiPage testPage = makePage("TestPage", "Contents", "att1=one,att2=two");
    PageData data = testPage.getData();
    assertEquals("one", data.getAttribute("att1"));
    assertEquals("two", data.getAttribute("att2"));
  }
View Full Code Here

  public void createNewPageBasedOnTemplate() throws Exception {
    final String newContent = "To be saved data";
    final String dummyKey = "DummyKey";

    WikiPage template = WikiPageUtil.addPage(root, PathParser.parse("TemplatePage"), "Template data");
    PageData templateData = template.getData();
    templateData.setAttribute(dummyKey, "true");
    template.commit(templateData);

    request.setResource("");
    request.addInput(EditResponder.PAGE_NAME, "TestChildPage");
    request.addInput(EditResponder.CONTENT_INPUT_NAME, newContent);
View Full Code Here

  public void testResponse() throws Exception {
    createRequest();

    Response response = responder.makeResponse(FitNesseUtil.makeTestContext(root), request);

    PageData data = page.getData();
    assertTrue(data.hasAttribute("Test"));
    assertTrue(data.hasAttribute("Properties"));
    assertTrue(data.hasAttribute("Search"));
    assertFalse(data.hasAttribute("Edit"));
    assertTrue(data.hasAttribute("RecentChanges"));
    assertTrue(data.hasAttribute(PageData.PropertySECURE_READ));
    assertFalse(data.hasAttribute(PageData.PropertySECURE_WRITE));
    assertTrue(data.hasAttribute(PageData.PropertyPRUNE));
    assertEquals("Suite A, Suite B", data.getAttribute(PageData.PropertySUITES));
    assertEquals("Help text literal", data.getAttribute(PageData.PropertyHELP));

    assertEquals(303, response.getStatus());
    assertEquals("/" + PAGE_NAME, response.getHeader("Location"));
  }
View Full Code Here

    request.addInput("Suites", "");
    request.addInput("HelpText", "");
   
    responder.makeResponse(FitNesseUtil.makeTestContext(root), request);
   
    PageData data = page.getData();
    assertFalse("should not have help attribute", data.hasAttribute(PageData.PropertyHELP));
    assertFalse("should not have suites attribute", data.hasAttribute(PageData.PropertySUITES));
  }
View Full Code Here

    // The old way the default attributes were set in PageData.initializeAttributes()
    // was to set them with a value of "true"
    // The SavePropertiesResponder saves them by setting the attribute without a value.
    // This test ensures that the behavior is the same (i.e. without value)
    page = WikiPageUtil.addPage(root, PathParser.parse(PAGE_NAME), "");
    PageData defaultData = page.getData();

    request = new MockRequest();
    request.setResource(PAGE_NAME);
    setBooleanAttributesOnRequest(defaultData, PageData.NON_SECURITY_ATTRIBUTES);
    setBooleanAttributesOnRequest(defaultData, PageData.SECURITY_ATTRIBUTES);

    responder.makeResponse(FitNesseUtil.makeTestContext(root), request);

    PageData dataToSave = page.getData();
    // The LasModified Attribute is the only one that might be different, so fix it here
    dataToSave.setAttribute(PropertyLAST_MODIFIED, defaultData.getAttribute(PropertyLAST_MODIFIED));
    WikiPageProperties defaultWikiPagePropertiesDefault = new WikiPageProperties(defaultData.getProperties());
    WikiPageProperties wikiPagePropertiesToSave = new WikiPageProperties(dataToSave.getProperties());
    assertEquals(defaultWikiPagePropertiesDefault.toXml(), wikiPagePropertiesToSave.toXml());
  }
View Full Code Here

    request.addInput(EditResponder.SUITES, "some suite");

    responder.makeResponse(FitNesseUtil.makeTestContext(root), request);

    assertEquals(true, root.hasChildPage("ChildPageTwo"));
    PageData pageData = root.getChildPage("ChildPageTwo").getData();
    String newContent = pageData.getContent();
    assertEquals("some new content", newContent);
    assertEquals("some help", pageData.getAttribute(PageData.PropertyHELP));
    assertEquals("some suite", pageData.getAttribute(PageData.PropertySUITES));
    assertTrue("RecentChanges should exist", root.hasChildPage("RecentChanges"));
    checkRecentChanges(root, "ChildPageTwo");
  }
View Full Code Here

    request.addInput(EditResponder.HELP_TEXT, "");
    request.addInput(EditResponder.SUITES, "");
   
    responder.makeResponse(FitNesseUtil.makeTestContext(root), request);
   
    PageData pageData = root.getChildPage("ChildPageTwo").getData();
    assertFalse("should not have help attribute", pageData.hasAttribute(PageData.PropertyHELP));
    assertFalse("should not have suites attribute", pageData.hasAttribute(PageData.PropertySUITES));
  }
View Full Code Here

  }

  private void createAndSaveANewPage(String pageName) throws Exception {
    WikiPage simplePage = WikiPageUtil.addPage(root, PathParser.parse(pageName));

    PageData data = simplePage.getData();
    SaveRecorder.pageSaved(simplePage, 0);
    simplePage.commit(data);
  }
View Full Code Here

TOP

Related Classes of fitnesse.wiki.PageData

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.