use of com.djrapitops.plan.gathering.domain.UserInfo in project Plan by plan-player-analytics.
the class UserInfoQueriesTest method userInfoTableStoresCorrectUserInformation.
@Test
default void userInfoTableStoresCorrectUserInformation() {
assertFalse(db().query(BaseUserQueries.fetchBaseUserOfPlayer(playerUUID)).isPresent());
db().executeTransaction(new PlayerServerRegisterTransaction(playerUUID, () -> TestConstants.REGISTER_TIME, TestConstants.PLAYER_ONE_NAME, serverUUID(), TestConstants.GET_PLAYER_HOSTNAME));
Set<UserInfo> userInfo = db().query(UserInfoQueries.fetchUserInformationOfUser(playerUUID));
Set<UserInfo> expected = Collections.singleton(new UserInfo(playerUUID, serverUUID(), TestConstants.REGISTER_TIME, false, TestConstants.GET_PLAYER_HOSTNAME.get(), false));
assertEquals(expected, userInfo);
}
use of com.djrapitops.plan.gathering.domain.UserInfo in project Plan by plan-player-analytics.
the class UserInfoQueriesTest method joinAddressIsUpdatedUponSecondLogin.
@Test
default void joinAddressIsUpdatedUponSecondLogin() {
assertFalse(db().query(BaseUserQueries.fetchBaseUserOfPlayer(playerUUID)).isPresent());
db().executeTransaction(new PlayerServerRegisterTransaction(playerUUID, () -> TestConstants.REGISTER_TIME, TestConstants.PLAYER_ONE_NAME, serverUUID(), () -> null));
db().executeTransaction(new PlayerServerRegisterTransaction(playerUUID, () -> TestConstants.REGISTER_TIME, TestConstants.PLAYER_ONE_NAME, serverUUID(), TestConstants.GET_PLAYER_HOSTNAME));
Set<UserInfo> userInfo = db().query(UserInfoQueries.fetchUserInformationOfUser(playerUUID));
Set<UserInfo> expected = Collections.singleton(new UserInfo(playerUUID, serverUUID(), TestConstants.REGISTER_TIME, false, TestConstants.GET_PLAYER_HOSTNAME.get(), false));
assertEquals(expected, userInfo);
}
use of com.djrapitops.plan.gathering.domain.UserInfo in project Plan by plan-player-analytics.
the class UserInfoQueriesTest method userInfoTableUpdatesBanStatus.
@Test
default void userInfoTableUpdatesBanStatus() {
db().executeTransaction(new PlayerServerRegisterTransaction(playerUUID, () -> TestConstants.REGISTER_TIME, TestConstants.PLAYER_ONE_NAME, serverUUID(), TestConstants.GET_PLAYER_HOSTNAME));
db().executeTransaction(new BanStatusTransaction(playerUUID, serverUUID(), () -> true));
Set<UserInfo> userInfo = db().query(UserInfoQueries.fetchUserInformationOfUser(playerUUID));
Set<UserInfo> expected = Collections.singleton(new UserInfo(playerUUID, serverUUID(), TestConstants.REGISTER_TIME, false, TestConstants.GET_PLAYER_HOSTNAME.get(), true));
assertEquals(expected, userInfo);
}
use of com.djrapitops.plan.gathering.domain.UserInfo in project Plan by plan-player-analytics.
the class UserInfoQueriesTest method cleanRemovesOnlyDuplicatedUserInfo.
@Test
default void cleanRemovesOnlyDuplicatedUserInfo() throws ExecutionException, InterruptedException {
// Store one duplicate
db().executeTransaction(new Transaction() {
@Override
protected void performOperations() {
execute(DataStoreQueries.registerUserInfo(playerUUID, 0L, serverUUID(), TestConstants.GET_PLAYER_HOSTNAME.get()));
execute(DataStoreQueries.registerUserInfo(playerUUID, 0L, serverUUID(), TestConstants.GET_PLAYER_HOSTNAME.get()));
execute(DataStoreQueries.registerUserInfo(player2UUID, 0L, serverUUID(), TestConstants.GET_PLAYER_HOSTNAME.get()));
}
}).get();
db().executeTransaction(new RemoveDuplicateUserInfoTransaction());
Set<UserInfo> found = db().query(UserInfoQueries.fetchUserInformationOfUser(playerUUID));
assertEquals(Collections.singleton(new UserInfo(playerUUID, serverUUID(), 0, false, TestConstants.GET_PLAYER_HOSTNAME.get(), false)), found);
Set<UserInfo> found2 = db().query(UserInfoQueries.fetchUserInformationOfUser(player2UUID));
assertEquals(Collections.singleton(new UserInfo(player2UUID, serverUUID(), 0, false, TestConstants.GET_PLAYER_HOSTNAME.get(), false)), found2);
}
use of com.djrapitops.plan.gathering.domain.UserInfo in project Plan by plan-player-analytics.
the class UserInfoQueriesTest method joinAddressCanBeNull.
@Test
default void joinAddressCanBeNull() {
assertFalse(db().query(BaseUserQueries.fetchBaseUserOfPlayer(playerUUID)).isPresent());
db().executeTransaction(new PlayerServerRegisterTransaction(playerUUID, () -> TestConstants.REGISTER_TIME, TestConstants.PLAYER_ONE_NAME, serverUUID(), () -> null));
Set<UserInfo> userInfo = db().query(UserInfoQueries.fetchUserInformationOfUser(playerUUID));
Set<UserInfo> expected = Collections.singleton(new UserInfo(playerUUID, serverUUID(), TestConstants.REGISTER_TIME, false, null, false));
assertEquals(expected, userInfo);
}
Aggregations