use of com.djrapitops.plan.storage.database.transactions.commands.RemoveEverythingTransaction in project Plan by plan-player-analytics.
the class SQLiteTest method setUp.
@BeforeEach
void setUp() {
TestErrorLogger.throwErrors(true);
db().executeTransaction(new Patch() {
@Override
public boolean hasBeenApplied() {
return false;
}
@Override
public void applyPatch() {
dropTable("plan_world_times");
dropTable("plan_kills");
dropTable("plan_sessions");
dropTable("plan_worlds");
dropTable("plan_users");
}
});
db().executeTransaction(new CreateTablesTransaction());
db().executeTransaction(new RemoveEverythingTransaction());
db().executeTransaction(new StoreServerInformationTransaction(new Server(serverUUID(), "ServerName", "", TestConstants.VERSION)));
assertEquals(serverUUID(), ((SQLDB) db()).getServerUUIDSupplier().get());
}
use of com.djrapitops.plan.storage.database.transactions.commands.RemoveEverythingTransaction in project Plan by plan-player-analytics.
the class ShutdownSaveTest method storeNecessaryInformation.
private void storeNecessaryInformation() throws Exception {
database.executeTransaction(new RemoveEverythingTransaction());
ServerUUID serverUUID = TestConstants.SERVER_UUID;
UUID playerUUID = TestConstants.PLAYER_ONE_UUID;
String worldName = TestConstants.WORLD_ONE_NAME;
database.executeTransaction(new StoreServerInformationTransaction(new Server(serverUUID, "-", "", TestConstants.VERSION)));
database.executeTransaction(new PlayerRegisterTransaction(playerUUID, () -> 0L, TestConstants.PLAYER_ONE_NAME));
database.executeTransaction(new WorldNameStoreTransaction(serverUUID, worldName)).get();
}
use of com.djrapitops.plan.storage.database.transactions.commands.RemoveEverythingTransaction in project Plan by plan-player-analytics.
the class ExtensionsDatabaseTest method removeEverythingRemovesServerExtensionData.
@Test
default void removeEverythingRemovesServerExtensionData() {
extensionServerValuesAreStored();
db().executeTransaction(new RemoveEverythingTransaction());
assertTrue(db().query(new ExtensionServerDataQuery(serverUUID())).isEmpty());
}
use of com.djrapitops.plan.storage.database.transactions.commands.RemoveEverythingTransaction in project Plan by plan-player-analytics.
the class NicknameQueriesTest method removeEverythingRemovesNicknames.
@Test
default void removeEverythingRemovesNicknames() {
allNicknamesAreSaved();
db().executeTransaction(new RemoveEverythingTransaction());
assertTrue(db().query(NicknameQueries.fetchAllNicknameData()).isEmpty());
}
use of com.djrapitops.plan.storage.database.transactions.commands.RemoveEverythingTransaction in project Plan by plan-player-analytics.
the class DBPatchMySQLRegressionTest method mysqlPatchesAreApplied.
@Test
void mysqlPatchesAreApplied() {
Patch[] patches = underTest.patches();
for (Patch patch : patches) {
underTest.executeTransaction(patch);
}
assertPatchesHaveBeenApplied(patches);
// Make sure that a fetch works.
PlayerContainer player = underTest.query(ContainerFetchQueries.fetchPlayerContainer(TestConstants.PLAYER_ONE_UUID));
OptionalAssert.equals(1, player.getValue(PlayerKeys.PLAYER_KILL_COUNT));
// Make sure no foreign key checks fail on removal
underTest.executeTransaction(new RemoveEverythingTransaction());
}
Aggregations