예제 #1
0
  public static Authenticator makeAuthenticator(
      String authenticationParameter, ComponentFactory componentFactory) throws Exception {
    Authenticator authenticator = new PromiscuousAuthenticator();
    if (authenticationParameter != null) {
      if (new File(authenticationParameter).exists())
        authenticator = new MultiUserAuthenticator(authenticationParameter);
      else {
        String[] values = authenticationParameter.split(":");
        authenticator = new OneUserAuthenticator(values[0], values[1]);
      }
    }

    return componentFactory.getAuthenticator(authenticator);
  }
예제 #2
0
  private static FitNesseContext loadContext(Arguments arguments) throws Exception {
    FitNesseContext context = new FitNesseContext();
    ComponentFactory componentFactory = new ComponentFactory(context.rootPath);
    context.port = arguments.getPort();
    context.rootPath = arguments.getRootPath();
    context.rootPageName = arguments.getRootDirectory();
    context.rootPagePath = context.rootPath + "/" + context.rootPageName;
    context.root =
        componentFactory.getRootPage(
            FileSystemPage.makeRoot(context.rootPath, context.rootPageName));
    context.responderFactory = new ResponderFactory(context.rootPagePath);
    context.logger = makeLogger(arguments);
    context.authenticator = makeAuthenticator(arguments.getUserpass(), componentFactory);
    context.htmlPageFactory = componentFactory.getHtmlPageFactory(new HtmlPageFactory());

    extraOutput = componentFactory.loadResponderPlugins(context.responderFactory);
    extraOutput += componentFactory.loadWikiWidgetPlugins();
    extraOutput += componentFactory.loadWikiWidgetInterceptors();
    extraOutput += componentFactory.loadContentFilter();

    WikiImportTestEventListener.register();

    return context;
  }