Search in sources :

Example 1 with Settings

use of org.batfish.coordinator.config.Settings in project batfish by batfish.

the class WorkMgrServiceV2Test method initContainerEnvironment.

@Before
public void initContainerEnvironment() throws Exception {
    BatfishLogger logger = new BatfishLogger("debug", false);
    Settings settings = new Settings(new String[] {});
    Main.mainInit(new String[] { "-containerslocation", _folder.getRoot().toString() });
    Main.setLogger(logger);
    Main.initAuthorizer();
    Main.setWorkMgr(new WorkMgr(settings, logger));
}
Also used : BatfishLogger(org.batfish.common.BatfishLogger) Settings(org.batfish.coordinator.config.Settings) Before(org.junit.Before)

Example 2 with Settings

use of org.batfish.coordinator.config.Settings in project batfish by batfish.

the class WorkMgrTest method initManager.

@Before
public void initManager() throws Exception {
    Settings settings = new Settings(new String[] {});
    BatfishLogger logger = new BatfishLogger("debug", false);
    Main.mainInit(new String[] { "-containerslocation", _folder.getRoot().toString() });
    Main.setLogger(logger);
    _manager = new WorkMgr(settings, logger);
}
Also used : BatfishLogger(org.batfish.common.BatfishLogger) Settings(org.batfish.coordinator.config.Settings) Before(org.junit.Before)

Example 3 with Settings

use of org.batfish.coordinator.config.Settings in project batfish by batfish.

the class Main method mainInit.

public static void mainInit(String[] args) {
    _settings = null;
    try {
        _settings = new Settings(args);
        networkListenerLogger.setLevel(Level.WARNING);
        httpServerLogger.setLevel(Level.WARNING);
    } catch (Exception e) {
        System.err.print("org.batfish.coordinator: Initialization failed: " + ExceptionUtils.getStackTrace(e));
        System.exit(1);
    }
}
Also used : Settings(org.batfish.coordinator.config.Settings) BatfishException(org.batfish.common.BatfishException) IOException(java.io.IOException) JSONException(org.codehaus.jettison.json.JSONException)

Example 4 with Settings

use of org.batfish.coordinator.config.Settings in project batfish by batfish.

the class WorkMgrServiceTest method initContainerEnvironment.

private void initContainerEnvironment() throws Exception {
    Settings settings = new Settings(new String[] {});
    BatfishLogger logger = new BatfishLogger("debug", false);
    Main.mainInit(new String[] { "-containerslocation", _containersFolder.getRoot().toString(), "-templatedirs", _questionsTemplatesFolder.getRoot().toString() });
    Main.setLogger(logger);
    Main.initAuthorizer();
    WorkMgr manager = new WorkMgr(settings, logger);
    Main.setWorkMgr(manager);
    manager.initContainer(_containerName, null);
    _service = new WorkMgrService();
}
Also used : BatfishLogger(org.batfish.common.BatfishLogger) Settings(org.batfish.coordinator.config.Settings)

Example 5 with Settings

use of org.batfish.coordinator.config.Settings in project batfish by batfish.

the class Main method initAuthorizer.

static void initAuthorizer() throws Exception {
    Settings settings = getSettings();
    Authorizer.Type type = settings.getAuthorizationType();
    switch(type) {
        case none:
            _authorizer = NoneAuthorizer.INSTANCE;
            break;
        case file:
            _authorizer = FileAuthorizer.createFromSettings(settings);
            break;
        case database:
            _authorizer = DbAuthorizer.createFromSettings(settings);
            break;
        default:
            System.err.print("org.batfish.coordinator: Initialization failed. Unsupported authorizer type " + type);
            System.exit(1);
    }
    getLogger().infof("Using authorizer %s\n", _authorizer);
}
Also used : Authorizer(org.batfish.coordinator.authorizer.Authorizer) FileAuthorizer(org.batfish.coordinator.authorizer.FileAuthorizer) DbAuthorizer(org.batfish.coordinator.authorizer.DbAuthorizer) NoneAuthorizer(org.batfish.coordinator.authorizer.NoneAuthorizer) Settings(org.batfish.coordinator.config.Settings)

Aggregations

Settings (org.batfish.coordinator.config.Settings)5 BatfishLogger (org.batfish.common.BatfishLogger)3 Before (org.junit.Before)2 IOException (java.io.IOException)1 BatfishException (org.batfish.common.BatfishException)1 Authorizer (org.batfish.coordinator.authorizer.Authorizer)1 DbAuthorizer (org.batfish.coordinator.authorizer.DbAuthorizer)1 FileAuthorizer (org.batfish.coordinator.authorizer.FileAuthorizer)1 NoneAuthorizer (org.batfish.coordinator.authorizer.NoneAuthorizer)1 JSONException (org.codehaus.jettison.json.JSONException)1