use of com.djrapitops.plan.delivery.domain.container.DataContainer in project Plan by plan-player-analytics.
the class PerServerContainerQuery method executeQuery.
@Override
public PerServerContainer executeQuery(SQLDB db) {
PerServerContainer perServerContainer = new PerServerContainer();
userInformation(db, perServerContainer);
lastSeen(db, perServerContainer);
playerKillCount(db, perServerContainer);
mobKillCount(db, perServerContainer);
totalDeathCount(db, perServerContainer);
worldTimes(db, perServerContainer);
Map<ServerUUID, List<FinishedSession>> sessions = db.query(SessionQueries.fetchSessionsOfPlayer(playerUUID));
for (Map.Entry<ServerUUID, List<FinishedSession>> entry : sessions.entrySet()) {
ServerUUID serverUUID = entry.getKey();
List<FinishedSession> serverSessions = entry.getValue();
DataContainer serverContainer = perServerContainer.getOrDefault(serverUUID, new SupplierDataContainer());
serverContainer.putRawData(PerServerKeys.SESSIONS, serverSessions);
perServerContainer.put(serverUUID, serverContainer);
}
return perServerContainer;
}
use of com.djrapitops.plan.delivery.domain.container.DataContainer in project Plan by plan-player-analytics.
the class SupplierDataContainerTest method safeUnsafeKeyRawDifferentObject.
@Test
void safeUnsafeKeyRawDifferentObject() {
DataContainer container = new SupplierDataContainer();
container.putRawData(TEST_KEY, "Success");
assertEquals("Success", container.getUnsafe(TEST_KEY_COPY));
}
use of com.djrapitops.plan.delivery.domain.container.DataContainer in project Plan by plan-player-analytics.
the class SupplierDataContainerTest method cachingSupplier.
@Test
void cachingSupplier() {
DataContainer container = new SupplierDataContainer();
String firstObj = "First";
String secondObj = "Second";
assertNotSame(firstObj, secondObj);
container.putCachingSupplier(TEST_KEY, () -> firstObj);
String found = container.getUnsafe(TEST_KEY);
assertEquals(firstObj, found);
assertSame(firstObj, found);
assertNotSame(secondObj, found);
String secondCall = container.getUnsafe(TEST_KEY);
assertSame(found, secondCall);
}
use of com.djrapitops.plan.delivery.domain.container.DataContainer in project Plan by plan-player-analytics.
the class SupplierDataContainerTest method safeUnsafeKeySupplierDifferentObject.
@Test
void safeUnsafeKeySupplierDifferentObject() {
DataContainer container = new SupplierDataContainer();
container.putSupplier(TEST_KEY, () -> "Success");
assertEquals("Success", container.getUnsafe(TEST_KEY_COPY));
}
use of com.djrapitops.plan.delivery.domain.container.DataContainer in project Plan by plan-player-analytics.
the class SupplierDataContainerTest method safeUnsafeKeyRawSameObject.
@Test
void safeUnsafeKeyRawSameObject() {
DataContainer container = new SupplierDataContainer();
container.putRawData(TEST_KEY, "Success");
assertEquals("Success", container.getUnsafe(TEST_KEY));
}
Aggregations