예제 #1
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;
  }
예제 #2
0
  private FitNesseContext loadContext(Arguments arguments) throws Exception {
    Properties properties = loadConfigFile(arguments.getConfigFile());
    // Enrich properties with command line values:
    properties.setProperty(
        ComponentFactory.VERSIONS_CONTROLLER_DAYS,
        Integer.toString(arguments.getDaysTillVersionsExpire()));

    Builder builder = new Builder();
    ComponentFactory componentFactory = new ComponentFactory(properties);

    WikiPageFactory wikiPageFactory =
        (WikiPageFactory)
            componentFactory.createComponent(
                ComponentFactory.WIKI_PAGE_FACTORY_CLASS, FileSystemPageFactory.class);

    builder.properties = properties;
    builder.port = arguments.getPort();
    builder.rootPath = arguments.getRootPath();
    builder.rootDirectoryName = arguments.getRootDirectory();

    builder.versionsController =
        (VersionsController)
            componentFactory.createComponent(
                ComponentFactory.VERSIONS_CONTROLLER_CLASS, ZipFileVersionsController.class);
    builder.versionsController.setHistoryDepth(
        Integer.parseInt(properties.getProperty(ComponentFactory.VERSIONS_CONTROLLER_DAYS, "14")));
    builder.recentChanges =
        (RecentChanges)
            componentFactory.createComponent(
                ComponentFactory.RECENT_CHANGES_CLASS, RecentChangesWikiPage.class);

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

    PluginsLoader pluginsLoader = new PluginsLoader(componentFactory);

    builder.logger = pluginsLoader.makeLogger(arguments.getLogDirectory());
    builder.authenticator = pluginsLoader.makeAuthenticator(arguments.getUserpass());

    FitNesseContext context = builder.createFitNesseContext();

    SymbolProvider symbolProvider = SymbolProvider.wikiParsingProvider;

    pluginsLoader.loadPlugins(context.responderFactory, symbolProvider);
    pluginsLoader.loadResponders(context.responderFactory);
    pluginsLoader.loadSymbolTypes(symbolProvider);
    pluginsLoader.loadContentFilter();
    pluginsLoader.loadSlimTables();
    pluginsLoader.loadCustomComparators();

    WikiImportTestEventListener.register();

    LOG.info("root page: " + context.root);
    LOG.info("logger: " + (context.logger == null ? "none" : context.logger.toString()));
    LOG.info("authenticator: " + context.authenticator);
    LOG.info("page factory: " + context.pageFactory);
    LOG.info("page theme: " + context.pageFactory.getTheme());
    LOG.info("Starting FitNesse on port: " + context.port);

    return context;
  }