Search in sources :

Example 6 with NicknameStoreTransaction

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

the class NicknameQueriesTest method allNicknamesAreSaved.

@Test
default void allNicknamesAreSaved() {
    db().executeTransaction(new PlayerServerRegisterTransaction(playerUUID, RandomData::randomTime, TestConstants.PLAYER_ONE_NAME, serverUUID(), TestConstants.GET_PLAYER_HOSTNAME));
    List<Nickname> saved = RandomData.randomNicknames(serverUUID());
    for (Nickname nickname : saved) {
        db().executeTransaction(new NicknameStoreTransaction(playerUUID, nickname, (uuid, name) -> false));
        db().executeTransaction(new NicknameStoreTransaction(playerUUID, nickname, (uuid, name) -> true));
    }
    forcePersistenceCheck();
    List<Nickname> fetched = db().query(NicknameQueries.fetchNicknameDataOfPlayer(playerUUID));
    assertEquals(saved, fetched);
}
Also used : PlayerServerRegisterTransaction(com.djrapitops.plan.storage.database.transactions.events.PlayerServerRegisterTransaction) RemoveEverythingTransaction(com.djrapitops.plan.storage.database.transactions.commands.RemoveEverythingTransaction) UUID(java.util.UUID) PlayerRegisterTransaction(com.djrapitops.plan.storage.database.transactions.events.PlayerRegisterTransaction) Test(org.junit.jupiter.api.Test) List(java.util.List) NicknameQueries(com.djrapitops.plan.storage.database.queries.objects.NicknameQueries) DatabaseTestPreparer(com.djrapitops.plan.storage.database.DatabaseTestPreparer) UserIdentifierQueries(com.djrapitops.plan.storage.database.queries.objects.UserIdentifierQueries) Assertions(org.junit.jupiter.api.Assertions) NicknameStoreTransaction(com.djrapitops.plan.storage.database.transactions.events.NicknameStoreTransaction) RandomData(utilities.RandomData) TestConstants(utilities.TestConstants) Nickname(com.djrapitops.plan.delivery.domain.Nickname) NicknameStoreTransaction(com.djrapitops.plan.storage.database.transactions.events.NicknameStoreTransaction) PlayerServerRegisterTransaction(com.djrapitops.plan.storage.database.transactions.events.PlayerServerRegisterTransaction) Nickname(com.djrapitops.plan.delivery.domain.Nickname) Test(org.junit.jupiter.api.Test)

Aggregations

Nickname (com.djrapitops.plan.delivery.domain.Nickname)6 NicknameStoreTransaction (com.djrapitops.plan.storage.database.transactions.events.NicknameStoreTransaction)6 UUID (java.util.UUID)6 NicknameCache (com.djrapitops.plan.gathering.cache.NicknameCache)4 ServerInfo (com.djrapitops.plan.identification.ServerInfo)4 DBSystem (com.djrapitops.plan.storage.database.DBSystem)4 ErrorContext (com.djrapitops.plan.utilities.logging.ErrorContext)4 ErrorLogger (com.djrapitops.plan.utilities.logging.ErrorLogger)4 Inject (javax.inject.Inject)4 DatabaseTestPreparer (com.djrapitops.plan.storage.database.DatabaseTestPreparer)2 NicknameQueries (com.djrapitops.plan.storage.database.queries.objects.NicknameQueries)2 UserIdentifierQueries (com.djrapitops.plan.storage.database.queries.objects.UserIdentifierQueries)2 RemoveEverythingTransaction (com.djrapitops.plan.storage.database.transactions.commands.RemoveEverythingTransaction)2 PlayerRegisterTransaction (com.djrapitops.plan.storage.database.transactions.events.PlayerRegisterTransaction)2 PlayerServerRegisterTransaction (com.djrapitops.plan.storage.database.transactions.events.PlayerServerRegisterTransaction)2 List (java.util.List)2 Assertions (org.junit.jupiter.api.Assertions)2 Test (org.junit.jupiter.api.Test)2 RandomData (utilities.RandomData)2 TestConstants (utilities.TestConstants)2