use of com.djrapitops.plan.storage.database.DBSystem in project Plan by plan-player-analytics.
the class VelocitySystemTest method velocityEnables.
@Test
void velocityEnables(@TempDir Path temp) throws Exception {
PlanSystem velocitySystem = new VelocityMockComponent(temp).getPlanSystem();
try {
PlanConfig config = velocitySystem.getConfigSystem().getConfig();
config.set(WebserverSettings.PORT, TEST_PORT_NUMBER);
config.set(ProxySettings.IP, "8.8.8.8");
DBSystem dbSystem = velocitySystem.getDatabaseSystem();
SQLiteDB db = dbSystem.getSqLiteFactory().usingDefaultFile();
db.setTransactionExecutorServiceProvider(MoreExecutors::newDirectExecutorService);
dbSystem.setActiveDatabase(db);
velocitySystem.enable();
assertTrue(velocitySystem.isEnabled());
} finally {
velocitySystem.disable();
}
}
use of com.djrapitops.plan.storage.database.DBSystem in project Plan by plan-player-analytics.
the class ShutdownSaveTest method setupShutdownSaveObject.
@BeforeEach
void setupShutdownSaveObject(@TempDir Path temporaryFolder) throws Exception {
PluginMockComponent pluginMockComponent = new PluginMockComponent(temporaryFolder);
PlanSystem system = pluginMockComponent.getPlanSystem();
database = system.getDatabaseSystem().getSqLiteFactory().usingFileCalled("test");
database.init();
sessionCache = system.getCacheSystem().getSessionCache();
storeNecessaryInformation();
placeSessionToCache();
DBSystem dbSystemMock = mock(DBSystem.class);
when(dbSystemMock.getDatabase()).thenReturn(database);
TestPluginLogger logger = new TestPluginLogger();
underTest = new ServerShutdownSave(new Locale(), dbSystemMock, logger, system.getErrorLogger()) {
@Override
protected boolean checkServerShuttingDownStatus() {
return shutdownStatus;
}
};
shutdownStatus = false;
}
use of com.djrapitops.plan.storage.database.DBSystem in project Plan by plan-player-analytics.
the class ExportJSErrorRegressionTest method savePlayerData.
private static void savePlayerData() {
DBSystem dbSystem = planSystem.getDatabaseSystem();
Database database = dbSystem.getDatabase();
UUID uuid = TestConstants.PLAYER_ONE_UUID;
database.executeTransaction(new PlayerRegisterTransaction(uuid, RandomData::randomTime, TestConstants.PLAYER_ONE_NAME));
FinishedSession session = new FinishedSession(uuid, serverUUID, 1000L, 11000L, 500L, new DataMap());
database.executeTransaction(new WorldNameStoreTransaction(serverUUID, "world"));
database.executeTransaction(new SessionEndTransaction(session));
}
use of com.djrapitops.plan.storage.database.DBSystem in project Plan by plan-player-analytics.
the class BungeeSystemTest method bungeeEnables.
@Test
void bungeeEnables() throws Exception {
PlanSystem bungeeSystem = component.getPlanSystem();
try {
PlanConfig config = bungeeSystem.getConfigSystem().getConfig();
config.set(WebserverSettings.PORT, TEST_PORT_NUMBER);
config.set(ProxySettings.IP, "8.8.8.8");
DBSystem dbSystem = bungeeSystem.getDatabaseSystem();
SQLiteDB db = dbSystem.getSqLiteFactory().usingDefaultFile();
db.setTransactionExecutorServiceProvider(MoreExecutors::newDirectExecutorService);
dbSystem.setActiveDatabase(db);
bungeeSystem.enable();
assertTrue(bungeeSystem.isEnabled());
} finally {
bungeeSystem.disable();
}
}
use of com.djrapitops.plan.storage.database.DBSystem in project Plan by plan-player-analytics.
the class DBPreparer method prepareDBByName.
private SQLDB prepareDBByName(String dbName) {
PlanConfig config = dependencies.config();
config.set(WebserverSettings.PORT, testPortNumber);
config.set(DatabaseSettings.TYPE, dbName);
dependencies.enable();
DBSystem dbSystem = dependencies.dbSystem();
SQLDB db = (SQLDB) dbSystem.getActiveDatabaseByName(dbName);
db.setTransactionExecutorServiceProvider(MoreExecutors::newDirectExecutorService);
db.init();
return db;
}
Aggregations