use of com.djrapitops.plan.settings.config.PlanConfig in project Plan by plan-player-analytics.
the class NukkitSystemTest method nukkitSystemHasDefaultConfigValuesAfterEnable.
@Test
void nukkitSystemHasDefaultConfigValuesAfterEnable() throws EnableException, IllegalAccessException {
try {
system.enable();
PlanConfig config = system.getConfigSystem().getConfig();
Collection<Setting> serverSettings = TestSettings.getServerSettings();
TestSettings.assertValidDefaultValuesForAllSettings(config, serverSettings);
} finally {
system.disable();
}
}
use of com.djrapitops.plan.settings.config.PlanConfig in project Plan by plan-player-analytics.
the class SpongeSystemTest method spongeSystemHasDefaultConfigValuesAfterEnable.
@Test
void spongeSystemHasDefaultConfigValuesAfterEnable() throws EnableException, IllegalAccessException {
try {
system.enable();
PlanConfig config = system.getConfigSystem().getConfig();
Collection<Setting> serverSettings = TestSettings.getServerSettings();
TestSettings.assertValidDefaultValuesForAllSettings(config, serverSettings);
} finally {
system.disable();
}
}
use of com.djrapitops.plan.settings.config.PlanConfig in project Plan by plan-player-analytics.
the class DatabaseTest method unchangedConfigDoesNotUpdateInDatabase.
@Test
default void unchangedConfigDoesNotUpdateInDatabase() {
configIsStoredInTheDatabase();
long savedMs = System.currentTimeMillis();
PlanConfig config = config();
db().executeTransaction(new StoreConfigTransaction(serverUUID(), config, System.currentTimeMillis()));
assertFalse(db().query(new NewerConfigQuery(serverUUID(), savedMs)).isPresent());
}
use of com.djrapitops.plan.settings.config.PlanConfig in project Plan by plan-player-analytics.
the class DatabaseTest method configIsStoredInTheDatabase.
@Test
default void configIsStoredInTheDatabase() {
PlanConfig config = config();
db().executeTransaction(new StoreConfigTransaction(serverUUID(), config, System.currentTimeMillis()));
Optional<Config> foundConfig = db().query(new NewerConfigQuery(serverUUID(), 0));
assertTrue(foundConfig.isPresent());
assertEquals(config, foundConfig.get());
}
use of com.djrapitops.plan.settings.config.PlanConfig in project Plan by plan-player-analytics.
the class DBPreparer method prepareMySQL.
public Optional<Database> prepareMySQL() {
PlanConfig config = dependencies.config();
Optional<String> formattedDB = setUpMySQLSettings(config);
if (formattedDB.isPresent()) {
String formattedDatabase = formattedDB.get();
SQLDB mysql = prepareDBByName(DBType.MYSQL.getName());
mysql.executeTransaction(new Transaction() {
@Override
protected void performOperations() {
execute("SET GLOBAL innodb_file_per_table=0");
execute("SET GLOBAL innodb_fast_shutdown=2");
execute("DROP DATABASE " + formattedDatabase);
execute("CREATE DATABASE " + formattedDatabase);
execute("USE " + formattedDatabase);
}
});
return Optional.of(mysql);
}
return Optional.empty();
}
Aggregations