Package fitnesse.wiki

Examples of fitnesse.wiki.WikiPage


  @Test
  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);
    request.addInput(EditResponder.TIME_STAMP, "" + SaveRecorder.timeStamp());
    request.addInput(EditResponder.TICKET_ID, "" + SaveRecorder.newTicket());
    request.addInput(NewPageResponder.PAGE_TEMPLATE, ".TemplatePage");

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

    WikiPage newPage = root.getChildPage("TestChildPage");
    assertNotNull(newPage);
    assertTrue(newPage.getData().hasAttribute(dummyKey));
    assertEquals("true", newPage.getData().getAttribute(dummyKey));
    assertEquals(newContent, newPage.getData().getContent());
  }
View Full Code Here


  private boolean isTest() {
    return childPageData.hasAttribute("Test");
  }

  private void getChildPage(String childName) throws Exception {
    WikiPage childPage = crawler.getPage(PathParser.parse("TestPage." + childName));
    childPageData = childPage.getData();
  }
View Full Code Here

   
    WikiPageUtil.addPage(root, PathParser.parse(".LibraryParent"), "library parent");
    WikiPageUtil.addPage(root, PathParser.parse(".LibraryParent.TemplateLibrary"), "template library 2");
    WikiPageUtil.addPage(root, PathParser.parse(".LibraryParent.TemplateLibrary.TemplateOne"), "template 1");
   
    WikiPage childPage = WikiPageUtil.addPage(root, PathParser.parse(".LibraryParent.ChildPage"), "library parent");
   
    List<String> pathList = TemplateUtil.getTemplatesFromUncles(childPage);

    assertTrue(pathList.contains(REGULAR_PARENT_PATH));
    assertTrue(pathList.contains(ROOT_PARENT_PATH));
View Full Code Here

    WikiPageUtil.addPage(root, PathParser.parse(".TemplateLibrary"), "template library");
    WikiPageUtil.addPage(root, PathParser.parse(".TemplateLibrary.TemplateFromRoot"), "template from root");
    WikiPageUtil.addPage(root, PathParser.parse(".TemplateLibrary.TemplateFromRoot.TemplateFromRootChild"), "template from root child");
   
    WikiPageUtil.addPage(root, PathParser.parse(".LibraryParent"), "library parent");
    WikiPage childPage = WikiPageUtil.addPage(root, PathParser.parse(".LibraryParent.ChildPage"), "library parent");
   
    List<String> pathList = TemplateUtil.getTemplatesFromUncles(childPage);

    assertTrue(pathList.contains(ROOT_PARENT_PATH));
    assertFalse(pathList.contains(ROOT_PARENT_PATH + ".TemplateFromRootChild"));
View Full Code Here

        runNewParser(definePageContent);
    }

    private void runNewParser(String input) throws Exception {
        long start = System.currentTimeMillis();
        WikiPage page = new TestRoot().makePage("NewTest");
        //String result = ParserTest.translateTo(new TestRoot().makePage("NewTest"), pageContent);
        Symbol list = Parser.make(new ParsingPage(new WikiSourcePage(page), null), input).parse();
        System.out.println(System.currentTimeMillis() - start);
        start = System.currentTimeMillis();
        /*String result =*/ new HtmlTranslator(new WikiSourcePage(page), new ParsingPage(new WikiSourcePage(page), null)).translateTree(list);
View Full Code Here

public class WikiSourcePageTest {

    @Test
    public void getsChildren() {
        TestRoot root = new TestRoot();
        WikiPage page = root.makePage("PageOne");
        root.makePage(page, "PageTwo");
        root.makePage(page, "PageThree");
        WikiSourcePage source = new WikiSourcePage(page);
        ArrayList<String> names = new ArrayList<String>();
        for (SourcePage child: source.getChildren()) names.add(child.getName());
View Full Code Here

        assertTrue(names.contains("PageThree"));
    }

    @Test
    public void getsUrlForPage() {
        WikiPage test = new TestRoot().makePage("MyPage");
        assertEquals("WikiPath", new WikiSourcePage(test).makeUrl("WikiPath"));
    }
View Full Code Here

    @Test
    public void imageWithWidth() throws Exception {
        ParserTestHelper.assertParses("!img -w 640 name", "SymbolList[Link[SymbolList[Text]]]");
        TestRoot root = new TestRoot();
        WikiPage testPage = root.makePage("ImagePage", "!img -w 640 name");
        ParserTestHelper.assertTranslatesTo(testPage, "<img src=\"name\" width=\"640\"/>");
    }
View Full Code Here

    }

    @Test
    public void imageWidthHandleMistyped() throws Exception {
        TestRoot root = new TestRoot();
        WikiPage testPage = root.makePage("ImagePage", "!img -w name");
        ParserTestHelper.assertTranslatesTo(testPage, "!img -w name");
        testPage = root.makePage("ImagePage", "!img -w nnn name");
        ParserTestHelper.assertTranslatesTo(testPage, "<img src=\"name\" width=\"nnn\"/>");
        testPage = root.makePage("ImagePage", "!img -w N");
        ParserTestHelper.assertTranslatesTo(testPage, "!img -w N");
View Full Code Here

    @Test
    public void imageWithMargin() throws Exception {
        ParserTestHelper.assertParses("!img -m 10 name", "SymbolList[Link[SymbolList[Text]]]");
        TestRoot root = new TestRoot();
        WikiPage testPage = root.makePage("ImagePage", "!img -m 10 name");
        ParserTestHelper.assertTranslatesTo(testPage, "<img src=\"name\" style=\"margin:10px 10px 10px 10px;\"/>");
    }
View Full Code Here

TOP

Related Classes of fitnesse.wiki.WikiPage

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.