Search in sources :

Example 11 with GeoInfo

use of com.djrapitops.plan.gathering.domain.GeoInfo in project Plan by plan-player-analytics.

the class GeolocationQueriesTest method storeSpecificGeolocations.

default UUID[] storeSpecificGeolocations() {
    UUID firstUuid = UUID.randomUUID();
    UUID secondUuid = UUID.randomUUID();
    UUID thirdUuid = UUID.randomUUID();
    UUID fourthUuid = UUID.randomUUID();
    UUID fifthUuid = UUID.randomUUID();
    UUID sixthUuid = UUID.randomUUID();
    UUID[] uuids = { firstUuid, secondUuid, thirdUuid, fourthUuid, fifthUuid, sixthUuid };
    Database db = db();
    for (UUID uuid : uuids) {
        db.executeTransaction(new PlayerServerRegisterTransaction(uuid, () -> 0L, "", serverUUID(), TestConstants.GET_PLAYER_HOSTNAME));
    }
    save(firstUuid, new GeoInfo("Norway", 0));
    save(firstUuid, new GeoInfo("Finland", 5));
    save(secondUuid, new GeoInfo("Sweden", 0));
    save(thirdUuid, new GeoInfo("Denmark", 0));
    save(fourthUuid, new GeoInfo("Denmark", 0));
    save(fifthUuid, new GeoInfo("Not Known", 0));
    save(sixthUuid, new GeoInfo("Local Machine", 0));
    return uuids;
}
Also used : Database(com.djrapitops.plan.storage.database.Database) PlayerServerRegisterTransaction(com.djrapitops.plan.storage.database.transactions.events.PlayerServerRegisterTransaction) GeoInfo(com.djrapitops.plan.gathering.domain.GeoInfo)

Example 12 with GeoInfo

use of com.djrapitops.plan.gathering.domain.GeoInfo in project Plan by plan-player-analytics.

the class GeolocationQueriesTest method geoInformationIsStored.

@Test
default void geoInformationIsStored() {
    db().executeTransaction(new PlayerServerRegisterTransaction(playerUUID, RandomData::randomTime, TestConstants.PLAYER_ONE_NAME, serverUUID(), TestConstants.GET_PLAYER_HOSTNAME));
    List<GeoInfo> expected = RandomData.randomGeoInfo();
    for (GeoInfo geoInfo : expected) {
        save(playerUUID, geoInfo);
    }
    forcePersistenceCheck();
    List<GeoInfo> result = db().query(GeoInfoQueries.fetchAllGeoInformation()).get(playerUUID);
    assertEquals(expected, result);
}
Also used : PlayerServerRegisterTransaction(com.djrapitops.plan.storage.database.transactions.events.PlayerServerRegisterTransaction) GeoInfo(com.djrapitops.plan.gathering.domain.GeoInfo) Test(org.junit.jupiter.api.Test)

Aggregations

GeoInfo (com.djrapitops.plan.gathering.domain.GeoInfo)12 Test (org.junit.jupiter.api.Test)6 PlayerContainer (com.djrapitops.plan.delivery.domain.container.PlayerContainer)4 PlayerServerRegisterTransaction (com.djrapitops.plan.storage.database.transactions.events.PlayerServerRegisterTransaction)4 FinishedSession (com.djrapitops.plan.gathering.domain.FinishedSession)3 ServerUUID (com.djrapitops.plan.identification.ServerUUID)3 com.djrapitops.plan.storage.database.queries.objects (com.djrapitops.plan.storage.database.queries.objects)3 com.djrapitops.plan.storage.database.transactions.events (com.djrapitops.plan.storage.database.transactions.events)3 Nickname (com.djrapitops.plan.delivery.domain.Nickname)2 TablePlayer (com.djrapitops.plan.delivery.domain.TablePlayer)2 Key (com.djrapitops.plan.delivery.domain.keys.Key)2 PlayerKeys (com.djrapitops.plan.delivery.domain.keys.PlayerKeys)2 ActiveSession (com.djrapitops.plan.gathering.domain.ActiveSession)2 BaseUser (com.djrapitops.plan.gathering.domain.BaseUser)2 QuerySvc (com.djrapitops.plan.query.QuerySvc)2 Config (com.djrapitops.plan.settings.config.Config)2 PlanConfig (com.djrapitops.plan.settings.config.PlanConfig)2 Locale (com.djrapitops.plan.settings.locale.Locale)2 Database (com.djrapitops.plan.storage.database.Database)2 com.djrapitops.plan.storage.database.queries (com.djrapitops.plan.storage.database.queries)2