public void testDefaultRootPage() throws Exception {
    WikiPageFactory wikiPageFactory = new WikiPageFactory();
    factory.loadWikiPage(wikiPageFactory);
    assertEquals(FileSystemPage.class, wikiPageFactory.getWikiPageClass());

    WikiPage page = wikiPageFactory.makeRootPage("testPath", "TestRoot", factory);
    assertNotNull(page);
    assertEquals(FileSystemPage.class, page.getClass());
    assertEquals("TestRoot", page.getName());
  }
  public void testRootPageCreation() throws Exception {
    testProperties.setProperty(ComponentFactory.WIKI_PAGE_CLASS, InMemoryPage.class.getName());

    WikiPageFactory wikiPageFactory = new WikiPageFactory();
    factory.loadWikiPage(wikiPageFactory);
    assertEquals(InMemoryPage.class, wikiPageFactory.getWikiPageClass());

    WikiPage page = wikiPageFactory.makeRootPage(null, "", factory);
    assertNotNull(page);
    assertEquals(InMemoryPage.class, page.getClass());
  }
  public void testAddPlugins() throws Exception {
    testProperties.setProperty(ComponentFactory.PLUGINS, DummyPlugin.class.getName());

    WikiPageFactory wikiPageFactory = new WikiPageFactory();
    ResponderFactory responderFactory = new ResponderFactory(".");

    assertMatch("!today", false);

    String output = factory.loadPlugins(responderFactory, wikiPageFactory);

    assertSubString(DummyPlugin.class.getName(), output);

    assertEquals(InMemoryPage.class, wikiPageFactory.getWikiPageClass());
    assertEquals(WikiPageResponder.class, responderFactory.getResponderClass("custom1"));
    assertEquals(EditResponder.class, responderFactory.getResponderClass("custom2"));
    assertMatch("!today", true);
  }
 public String loadWikiPage(WikiPageFactory factory) throws ClassNotFoundException {
   StringBuffer buffer = new StringBuffer();
   String rootPageClassName = loadedProperties.getProperty(WIKI_PAGE_CLASS);
   if (rootPageClassName != null) {
     factory.setWikiPageClass(Class.forName(rootPageClassName));
     buffer.append("\tCustom wiki page plugin loaded: ").append(rootPageClassName).append(endl);
   }
   return buffer.toString();
 }
Exemple #5
0
  private static FitNesseContext initContext(String rootPath, int port) throws Exception {
    Builder builder = new Builder();
    WikiPageFactory wikiPageFactory = new WikiPageFactory();
    ComponentFactory componentFactory = new ComponentFactory(rootPath);

    builder.port = port;
    builder.rootPath = rootPath;
    builder.rootDirectoryName = "FitNesseRoot";

    builder.pageTheme = componentFactory.getProperty(ComponentFactory.THEME);
    builder.defaultNewPageContent =
        componentFactory.getProperty(ComponentFactory.DEFAULT_NEWPAGE_CONTENT);

    builder.root =
        wikiPageFactory.makeRootPage(builder.rootPath, builder.rootDirectoryName, componentFactory);

    builder.logger = null;
    builder.authenticator = new PromiscuousAuthenticator();

    FitNesseContext context = builder.createFitNesseContext();
    return context;
  }
 public static void registerWikiPage(WikiPageFactory factory) {
   factory.setWikiPageClass(InMemoryPage.class);
 }