Search in sources :

Example 1 with StoreJoinAddressTransaction

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

the class JoinAddressQueriesTest method joinAddressFilterOptionsAreFetchedWhenThereAreMultiple.

@Test
default void joinAddressFilterOptionsAreFetchedWhenThereAreMultiple() {
    executeTransactions(new StoreJoinAddressTransaction(TestConstants.GET_PLAYER_HOSTNAME.get()), new StoreJoinAddressTransaction(TestConstants.GET_PLAYER_HOSTNAME.get() + "_a"), new StoreJoinAddressTransaction(TestConstants.GET_PLAYER_HOSTNAME.get() + "_b"));
    List<String> expected = Arrays.asList(TestConstants.GET_PLAYER_HOSTNAME.get().toLowerCase(), TestConstants.GET_PLAYER_HOSTNAME.get().toLowerCase() + "_a", TestConstants.GET_PLAYER_HOSTNAME.get().toLowerCase() + "_b", JoinAddressTable.DEFAULT_VALUE_FOR_LOOKUP);
    List<String> result = db().query(JoinAddressQueries.uniqueJoinAddresses());
    assertEquals(expected, result);
}
Also used : StoreJoinAddressTransaction(com.djrapitops.plan.storage.database.transactions.events.StoreJoinAddressTransaction) Test(org.junit.jupiter.api.Test)

Example 2 with StoreJoinAddressTransaction

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

the class JoinAddressQueriesTest method removeEverythingRemovesJoinAddresses.

@Test
default void removeEverythingRemovesJoinAddresses() {
    String joinAddress = TestConstants.GET_PLAYER_HOSTNAME.get();
    executeTransactions(new StoreJoinAddressTransaction(joinAddress));
    List<String> expected = List.of(joinAddress, JoinAddressTable.DEFAULT_VALUE_FOR_LOOKUP);
    List<String> result = db().query(JoinAddressQueries.uniqueJoinAddresses());
    assertEquals(expected, result);
    executeTransactions(new RemoveEverythingTransaction());
    expected = List.of(JoinAddressTable.DEFAULT_VALUE_FOR_LOOKUP);
    result = db().query(JoinAddressQueries.uniqueJoinAddresses());
    assertEquals(expected, result);
}
Also used : StoreJoinAddressTransaction(com.djrapitops.plan.storage.database.transactions.events.StoreJoinAddressTransaction) RemoveEverythingTransaction(com.djrapitops.plan.storage.database.transactions.commands.RemoveEverythingTransaction) Test(org.junit.jupiter.api.Test)

Example 3 with StoreJoinAddressTransaction

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

the class RemoveEverythingTransaction method applyPatch.

@Override
protected void applyPatch() {
    clearTable(SettingsTable.TABLE_NAME);
    clearTable(GeoInfoTable.TABLE_NAME);
    clearTable(NicknamesTable.TABLE_NAME);
    clearTable(KillsTable.TABLE_NAME);
    clearTable(WorldTimesTable.TABLE_NAME);
    clearTable(SessionsTable.TABLE_NAME);
    clearTable(JoinAddressTable.TABLE_NAME);
    clearTable(WorldTable.TABLE_NAME);
    clearTable(PingTable.TABLE_NAME);
    clearTable(UserInfoTable.TABLE_NAME);
    clearTable(UsersTable.TABLE_NAME);
    clearTable(TPSTable.TABLE_NAME);
    clearTable(SecurityTable.TABLE_NAME);
    clearTable(ServerTable.TABLE_NAME);
    clearTable(CookieTable.TABLE_NAME);
    clearTable(ExtensionPlayerValueTable.TABLE_NAME);
    clearTable(ExtensionServerValueTable.TABLE_NAME);
    clearTable(ExtensionGroupsTable.TABLE_NAME);
    clearTable(ExtensionProviderTable.TABLE_NAME);
    clearTable(ExtensionPlayerTableValueTable.TABLE_NAME);
    clearTable(ExtensionServerTableValueTable.TABLE_NAME);
    clearTable(ExtensionTableProviderTable.TABLE_NAME);
    clearTable(ExtensionTabTable.TABLE_NAME);
    clearTable(ExtensionPluginTable.TABLE_NAME);
    clearTable(ExtensionIconTable.TABLE_NAME);
    executeOther(new StoreJoinAddressTransaction(JoinAddressTable.DEFAULT_VALUE_FOR_LOOKUP));
}
Also used : StoreJoinAddressTransaction(com.djrapitops.plan.storage.database.transactions.events.StoreJoinAddressTransaction)

Example 4 with StoreJoinAddressTransaction

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

the class CreateTablesTransaction method performOperations.

@Override
protected void performOperations() {
    // DBType is required for SQL creation, as MySQL and SQLite primary key format differs.
    // Create statements are run in a specific order as some tables have foreign keys,
    // or had at some point in the past.
    execute(ServerTable.createTableSQL(dbType));
    execute(UsersTable.createTableSQL(dbType));
    execute(UserInfoTable.createTableSQL(dbType));
    execute(GeoInfoTable.createTableSQL(dbType));
    execute(NicknamesTable.createTableSQL(dbType));
    execute(JoinAddressTable.createTableSQL(dbType));
    executeOther(new StoreJoinAddressTransaction(JoinAddressTable.DEFAULT_VALUE_FOR_LOOKUP));
    execute(SessionsTable.createTableSQL(dbType));
    execute(KillsTable.createTableSQL(dbType));
    execute(PingTable.createTableSQL(dbType));
    execute(TPSTable.createTableSQL(dbType));
    execute(WorldTable.createTableSQL(dbType));
    execute(WorldTimesTable.createTableSQL(dbType));
    execute(SecurityTable.createTableSQL(dbType));
    execute(SettingsTable.createTableSQL(dbType));
    execute(CookieTable.createTableSQL(dbType));
    // DataExtension tables
    execute(ExtensionIconTable.createTableSQL(dbType));
    execute(ExtensionPluginTable.createTableSQL(dbType));
    execute(ExtensionTabTable.createTableSQL(dbType));
    execute(ExtensionProviderTable.createTableSQL(dbType));
    execute(ExtensionPlayerValueTable.createTableSQL(dbType));
    execute(ExtensionServerValueTable.createTableSQL(dbType));
    execute(ExtensionTableProviderTable.createTableSQL(dbType));
    execute(ExtensionPlayerTableValueTable.createTableSQL(dbType));
    execute(ExtensionServerTableValueTable.createTableSQL(dbType));
    execute(ExtensionGroupsTable.createTableSQL(dbType));
}
Also used : StoreJoinAddressTransaction(com.djrapitops.plan.storage.database.transactions.events.StoreJoinAddressTransaction)

Example 5 with StoreJoinAddressTransaction

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

the class JoinAddressQueriesTest method joinAddressFilterOptionsAreFetched.

@Test
default void joinAddressFilterOptionsAreFetched() {
    executeTransactions(new StoreJoinAddressTransaction(TestConstants.GET_PLAYER_HOSTNAME.get()));
    List<String> expected = List.of(TestConstants.GET_PLAYER_HOSTNAME.get().toLowerCase(), JoinAddressTable.DEFAULT_VALUE_FOR_LOOKUP);
    List<String> result = db().query(JoinAddressQueries.uniqueJoinAddresses());
    assertEquals(expected, result);
}
Also used : StoreJoinAddressTransaction(com.djrapitops.plan.storage.database.transactions.events.StoreJoinAddressTransaction) Test(org.junit.jupiter.api.Test)

Aggregations

StoreJoinAddressTransaction (com.djrapitops.plan.storage.database.transactions.events.StoreJoinAddressTransaction)5 Test (org.junit.jupiter.api.Test)3 RemoveEverythingTransaction (com.djrapitops.plan.storage.database.transactions.commands.RemoveEverythingTransaction)1