use of com.djrapitops.plan.PlanSystem 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.PlanSystem in project Plan by plan-player-analytics.
the class DBPatchMySQLRegressionTest method setUpDBWithOldSchema.
@BeforeEach
void setUpDBWithOldSchema() throws Exception {
PlanSystem system = component.getPlanSystem();
Optional<Database> db = new DBPreparer(system, TEST_PORT_NUMBER).prepareMySQL();
assumeTrue(db.isPresent());
underTest = (MySQLDB) db.get();
dropAllTables();
// Initialize database with the old table schema
underTest.executeTransaction(new Transaction() {
@Override
protected void performOperations() {
execute(serverTable);
execute(usersTable);
execute(userInfoTable);
execute(geoInfoTable);
execute(nicknameTable);
execute(sessionsTable);
execute(killsTable);
execute(pingTable);
execute(commandUseTable);
execute(tpsTable);
execute(worldsTable);
execute(worldTimesTable);
execute(securityTable);
execute(transferTable);
}
});
underTest.executeTransaction(new CreateTablesTransaction());
insertData(underTest);
}
use of com.djrapitops.plan.PlanSystem in project Plan by plan-player-analytics.
the class SQLiteTest method system.
@Override
public PlanSystem system() {
PlanSystem mockSystem = Mockito.mock(PlanSystem.class);
when(mockSystem.getPlanFiles()).thenReturn(component.files());
return mockSystem;
}
use of com.djrapitops.plan.PlanSystem in project Plan by plan-player-analytics.
the class ShutdownDataPreservationTest method setupPreservation.
@BeforeEach
void setupPreservation(@TempDir Path temporaryFolder) throws Exception {
PluginMockComponent pluginMockComponent = new PluginMockComponent(temporaryFolder);
PlanSystem system = pluginMockComponent.getPlanSystem();
PlatformAbstractionLayer abstractionLayer = pluginMockComponent.getAbstractionLayer();
underTest = new ShutdownDataPreservation(system.getPlanFiles(), system.getLocaleSystem().getLocale(), system.getDatabaseSystem(), abstractionLayer.getPluginLogger(), system.getErrorLogger());
}
use of com.djrapitops.plan.PlanSystem in project Plan by plan-player-analytics.
the class MySQLTest method system.
@Override
public PlanSystem system() {
PlanSystem mockSystem = Mockito.mock(PlanSystem.class);
when(mockSystem.getPlanFiles()).thenReturn(component.files());
return mockSystem;
}
Aggregations