Search in sources :

Example 6 with RemoveEverythingTransaction

use of com.djrapitops.plan.storage.database.transactions.commands.RemoveEverythingTransaction in project Plan by plan-player-analytics.

the class SessionQueriesTest method removeEverythingRemovesWorldNames.

@Test
default void removeEverythingRemovesWorldNames() {
    prepareForSessionSave();
    db().executeTransaction(new RemoveEverythingTransaction());
    assertTrue(db().query(LargeFetchQueries.fetchAllWorldNames()).isEmpty());
}
Also used : RemoveEverythingTransaction(com.djrapitops.plan.storage.database.transactions.commands.RemoveEverythingTransaction) RepeatedTest(org.junit.jupiter.api.RepeatedTest) Test(org.junit.jupiter.api.Test)

Example 7 with RemoveEverythingTransaction

use of com.djrapitops.plan.storage.database.transactions.commands.RemoveEverythingTransaction in project Plan by plan-player-analytics.

the class TPSQueriesTest method removeEverythingRemovesTPS.

@Test
default void removeEverythingRemovesTPS() {
    tpsIsStored();
    db().executeTransaction(new RemoveEverythingTransaction());
    assertTrue(db().query(TPSQueries.fetchTPSDataOfAllServersBut(0, System.currentTimeMillis(), ServerUUID.randomUUID())).isEmpty());
}
Also used : RemoveEverythingTransaction(com.djrapitops.plan.storage.database.transactions.commands.RemoveEverythingTransaction) Test(org.junit.jupiter.api.Test)

Example 8 with RemoveEverythingTransaction

use of com.djrapitops.plan.storage.database.transactions.commands.RemoveEverythingTransaction in project Plan by plan-player-analytics.

the class UserInfoQueriesTest method removeEverythingRemovesUserInfo.

@Test
default void removeEverythingRemovesUserInfo() {
    playerIsRegisteredToBothTables();
    db().executeTransaction(new RemoveEverythingTransaction());
    assertTrue(db().query(UserInfoQueries.fetchAllUserInformation()).isEmpty());
}
Also used : RemoveEverythingTransaction(com.djrapitops.plan.storage.database.transactions.commands.RemoveEverythingTransaction) Test(org.junit.jupiter.api.Test)

Example 9 with RemoveEverythingTransaction

use of com.djrapitops.plan.storage.database.transactions.commands.RemoveEverythingTransaction in project Plan by plan-player-analytics.

the class DatabaseCommands method performClear.

private void performClear(CMDSender sender, DBType fromDB) {
    try {
        Database fromDatabase = dbSystem.getActiveDatabaseByType(fromDB);
        fromDatabase.init();
        sender.send(locale.getString(CommandLang.DB_REMOVAL, fromDB.getName()));
        fromDatabase.executeTransaction(new RemoveEverythingTransaction()).get();
        queryService.dataCleared();
        sender.send(locale.getString(CommandLang.PROGRESS_SUCCESS));
        // Reload plugin to register the server into the database
        // Otherwise errors will start.
        statusCommands.onReload(sender);
    } catch (InterruptedException e) {
        Thread.currentThread().interrupt();
    } catch (DBOpException | ExecutionException e) {
        sender.send(locale.getString(CommandLang.PROGRESS_FAIL, e.getMessage()));
        errorLogger.error(e, ErrorContext.builder().related(sender, fromDB.getName()).build());
    }
}
Also used : DBOpException(com.djrapitops.plan.exceptions.database.DBOpException) RemoveEverythingTransaction(com.djrapitops.plan.storage.database.transactions.commands.RemoveEverythingTransaction) Database(com.djrapitops.plan.storage.database.Database) ExecutionException(java.util.concurrent.ExecutionException)

Example 10 with RemoveEverythingTransaction

use of com.djrapitops.plan.storage.database.transactions.commands.RemoveEverythingTransaction in project Plan by plan-player-analytics.

the class MySQLTest method setUp.

@BeforeEach
void setUp() {
    TestErrorLogger.throwErrors(true);
    db().executeTransaction(new RemoveEverythingTransaction());
    db().executeTransaction(new StoreServerInformationTransaction(new Server(serverUUID(), TestConstants.SERVER_NAME, "", TestConstants.VERSION)));
    assertEquals(serverUUID(), ((SQLDB) db()).getServerUUIDSupplier().get());
}
Also used : Server(com.djrapitops.plan.identification.Server) RemoveEverythingTransaction(com.djrapitops.plan.storage.database.transactions.commands.RemoveEverythingTransaction) StoreServerInformationTransaction(com.djrapitops.plan.storage.database.transactions.StoreServerInformationTransaction) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

RemoveEverythingTransaction (com.djrapitops.plan.storage.database.transactions.commands.RemoveEverythingTransaction)18 Test (org.junit.jupiter.api.Test)13 Server (com.djrapitops.plan.identification.Server)3 StoreServerInformationTransaction (com.djrapitops.plan.storage.database.transactions.StoreServerInformationTransaction)3 Patch (com.djrapitops.plan.storage.database.transactions.patches.Patch)3 PlayerContainer (com.djrapitops.plan.delivery.domain.container.PlayerContainer)2 BeforeEach (org.junit.jupiter.api.BeforeEach)2 RepeatedTest (org.junit.jupiter.api.RepeatedTest)2 DBOpException (com.djrapitops.plan.exceptions.database.DBOpException)1 ExtensionPlayerDataQuery (com.djrapitops.plan.extension.implementation.storage.queries.ExtensionPlayerDataQuery)1 ExtensionServerDataQuery (com.djrapitops.plan.extension.implementation.storage.queries.ExtensionServerDataQuery)1 ServerUUID (com.djrapitops.plan.identification.ServerUUID)1 Database (com.djrapitops.plan.storage.database.Database)1 PlayerRegisterTransaction (com.djrapitops.plan.storage.database.transactions.events.PlayerRegisterTransaction)1 StoreJoinAddressTransaction (com.djrapitops.plan.storage.database.transactions.events.StoreJoinAddressTransaction)1 WorldNameStoreTransaction (com.djrapitops.plan.storage.database.transactions.events.WorldNameStoreTransaction)1 CreateTablesTransaction (com.djrapitops.plan.storage.database.transactions.init.CreateTablesTransaction)1 KillsOptimizationPatch (com.djrapitops.plan.storage.database.transactions.patches.KillsOptimizationPatch)1 UUID (java.util.UUID)1 ExecutionException (java.util.concurrent.ExecutionException)1