Search in sources :

Example 1 with PlanSystem

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;
}
Also used : Locale(com.djrapitops.plan.settings.locale.Locale) DBSystem(com.djrapitops.plan.storage.database.DBSystem) TestPluginLogger(utilities.TestPluginLogger) PlanSystem(com.djrapitops.plan.PlanSystem) PluginMockComponent(utilities.mocks.PluginMockComponent) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 2 with PlanSystem

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);
}
Also used : Transaction(com.djrapitops.plan.storage.database.transactions.Transaction) RemoveEverythingTransaction(com.djrapitops.plan.storage.database.transactions.commands.RemoveEverythingTransaction) CreateTablesTransaction(com.djrapitops.plan.storage.database.transactions.init.CreateTablesTransaction) PlanSystem(com.djrapitops.plan.PlanSystem) CreateTablesTransaction(com.djrapitops.plan.storage.database.transactions.init.CreateTablesTransaction)

Example 3 with PlanSystem

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;
}
Also used : PlanSystem(com.djrapitops.plan.PlanSystem)

Example 4 with PlanSystem

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());
}
Also used : PlanSystem(com.djrapitops.plan.PlanSystem) PluginMockComponent(utilities.mocks.PluginMockComponent) PlatformAbstractionLayer(net.playeranalytics.plugin.PlatformAbstractionLayer) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 5 with PlanSystem

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;
}
Also used : PlanSystem(com.djrapitops.plan.PlanSystem)

Aggregations

PlanSystem (com.djrapitops.plan.PlanSystem)5 BeforeEach (org.junit.jupiter.api.BeforeEach)2 PluginMockComponent (utilities.mocks.PluginMockComponent)2 Locale (com.djrapitops.plan.settings.locale.Locale)1 DBSystem (com.djrapitops.plan.storage.database.DBSystem)1 Transaction (com.djrapitops.plan.storage.database.transactions.Transaction)1 RemoveEverythingTransaction (com.djrapitops.plan.storage.database.transactions.commands.RemoveEverythingTransaction)1 CreateTablesTransaction (com.djrapitops.plan.storage.database.transactions.init.CreateTablesTransaction)1 PlatformAbstractionLayer (net.playeranalytics.plugin.PlatformAbstractionLayer)1 TestPluginLogger (utilities.TestPluginLogger)1