Search in sources :

Example 1 with ConfigWrapper

use of mage.server.util.ConfigWrapper in project mage by magefree.

the class CustomTestCard method init.

@BeforeClass
public static void init() {
    Logger.getRootLogger().setLevel(Level.DEBUG);
    logger.debug("Starting MAGE tests");
    logger.debug("Logging level: " + logger.getLevel());
    logger.debug("Default charset: " + Charset.defaultCharset());
    // one time init for all tests
    if (GameFactory.instance.getGameTypes().isEmpty()) {
        deleteSavedGames();
        ConfigSettings config = new ConfigWrapper(ConfigFactory.loadFromFile("config/config.xml"));
        for (GamePlugin plugin : config.getGameTypes()) {
            GameFactory.instance.addGameType(plugin.getName(), loadGameType(plugin), loadPlugin(plugin));
        }
        Copier.setLoader(classLoader);
    }
}
Also used : ConfigSettings(mage.server.managers.ConfigSettings) ConfigWrapper(mage.server.util.ConfigWrapper) GamePlugin(mage.server.util.config.GamePlugin) BeforeClass(org.junit.BeforeClass)

Example 2 with ConfigWrapper

use of mage.server.util.ConfigWrapper in project mage by magefree.

the class MageTestBase method init.

@BeforeClass
public static void init() {
    Logger.getRootLogger().setLevel(Level.DEBUG);
    // one time init for all tests
    if (GameFactory.instance.getGameTypes().isEmpty()) {
        deleteSavedGames();
        ConfigSettings config = new ConfigWrapper(ConfigFactory.loadFromFile("config/config.xml"));
        config.getGameTypes().forEach((gameType) -> {
            GameFactory.instance.addGameType(gameType.getName(), loadGameType(gameType), loadPlugin(gameType));
        });
        config.getTournamentTypes().forEach((tournamentType) -> {
            TournamentFactory.instance.addTournamentType(tournamentType.getName(), loadTournamentType(tournamentType), loadPlugin(tournamentType));
        });
        config.getPlayerTypes().forEach((playerType) -> {
            PlayerFactory.instance.addPlayerType(playerType.getName(), loadPlugin(playerType));
        });
        // for (Plugin plugin : config.getDeckTypes()) {
        // DeckValidatorFactory.getInstance().addDeckType(plugin.getName(), loadPlugin(plugin));
        // }
        Copier.setLoader(classLoader);
    }
}
Also used : ConfigSettings(mage.server.managers.ConfigSettings) ConfigWrapper(mage.server.util.ConfigWrapper) BeforeClass(org.junit.BeforeClass)

Aggregations

ConfigSettings (mage.server.managers.ConfigSettings)2 ConfigWrapper (mage.server.util.ConfigWrapper)2 BeforeClass (org.junit.BeforeClass)2 GamePlugin (mage.server.util.config.GamePlugin)1