diff --git a/Plan/common/src/main/java/com/djrapitops/plan/delivery/webserver/cache/DataID.java b/Plan/common/src/main/java/com/djrapitops/plan/delivery/webserver/cache/DataID.java index 495511e2c..755f1a27e 100644 --- a/Plan/common/src/main/java/com/djrapitops/plan/delivery/webserver/cache/DataID.java +++ b/Plan/common/src/main/java/com/djrapitops/plan/delivery/webserver/cache/DataID.java @@ -61,6 +61,6 @@ public enum DataID { public String of(ServerUUID serverUUID) { if (serverUUID == null) return name(); - return name() + '-' + serverUUID; + return name() + "_" + serverUUID; } } diff --git a/Plan/common/src/test/java/com/djrapitops/plan/delivery/webserver/cache/JSONStorageTest.java b/Plan/common/src/test/java/com/djrapitops/plan/delivery/webserver/cache/JSONStorageTest.java index e61acccac..56c2a40fb 100644 --- a/Plan/common/src/test/java/com/djrapitops/plan/delivery/webserver/cache/JSONStorageTest.java +++ b/Plan/common/src/test/java/com/djrapitops/plan/delivery/webserver/cache/JSONStorageTest.java @@ -16,6 +16,7 @@ */ package com.djrapitops.plan.delivery.webserver.cache; +import com.djrapitops.plan.identification.ServerUUID; import com.djrapitops.plan.storage.file.PlanFiles; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -145,7 +146,7 @@ class JSONStorageTest { @Test void storedWithLaterDateIsNotFetched() { long timestamp = System.currentTimeMillis(); - JSONStorage.StoredJSON stored = UNDER_TEST.storeJson("Identifier", Collections.singletonList("data"), timestamp); + UNDER_TEST.storeJson("Identifier", Collections.singletonList("data"), timestamp); assertFalse(UNDER_TEST.fetchJsonMadeAfter("Identifier", timestamp + TimeUnit.DAYS.toMillis(1L)).isPresent()); } @@ -160,14 +161,21 @@ class JSONStorageTest { @Test void storedWithEarlierDateIsNotFetched() { long timestamp = System.currentTimeMillis(); - JSONStorage.StoredJSON stored = UNDER_TEST.storeJson("Identifier", Collections.singletonList("data"), timestamp); + UNDER_TEST.storeJson("Identifier", Collections.singletonList("data"), timestamp); assertFalse(UNDER_TEST.fetchJsonMadeBefore("Identifier", timestamp - TimeUnit.DAYS.toMillis(1L)).isPresent()); } @Test void doesNotFetchWrongThing() { long timestamp = System.currentTimeMillis(); - JSONStorage.StoredJSON stored = UNDER_TEST.storeJson(DataID.SESSIONS_OVERVIEW.name(), Collections.singletonList("data"), timestamp); + UNDER_TEST.storeJson(DataID.SESSIONS_OVERVIEW.name(), Collections.singletonList("data"), timestamp); assertFalse(UNDER_TEST.fetchJsonMadeBefore(DataID.SESSIONS.name(), timestamp + TimeUnit.DAYS.toMillis(1L)).isPresent()); } + + @Test + void doesNotFetchWrongServer() { + long timestamp = System.currentTimeMillis(); + UNDER_TEST.storeJson(DataID.SESSIONS_OVERVIEW.of(ServerUUID.randomUUID()), Collections.singletonList("data"), timestamp); + assertFalse(UNDER_TEST.fetchJsonMadeBefore(DataID.SESSIONS_OVERVIEW.name(), timestamp + TimeUnit.DAYS.toMillis(1L)).isPresent()); + } } \ No newline at end of file