mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-12-21 05:50:18 +08:00
Removed WorldTable#saveWorlds
This commit is contained in:
parent
9e9196b181
commit
a548ae6cf6
@ -97,10 +97,6 @@ public class WorldTable extends Table {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void saveWorlds(Collection<String> worlds) {
|
|
||||||
saveWorlds(worlds, getServerUUID());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to save a list of world names.
|
* Used to save a list of world names.
|
||||||
* <p>
|
* <p>
|
||||||
|
@ -83,7 +83,7 @@ public abstract class CommonDBTest {
|
|||||||
public static SQLDB db;
|
public static SQLDB db;
|
||||||
public static PlanSystem system;
|
public static PlanSystem system;
|
||||||
|
|
||||||
public final List<String> worlds = Arrays.asList("TestWorld", "TestWorld2");
|
public final String[] worlds = new String[]{"TestWorld", "TestWorld2"};
|
||||||
public final UUID playerUUID = TestConstants.PLAYER_ONE_UUID;
|
public final UUID playerUUID = TestConstants.PLAYER_ONE_UUID;
|
||||||
public final UUID player2UUID = TestConstants.PLAYER_TWO_UUID;
|
public final UUID player2UUID = TestConstants.PLAYER_TWO_UUID;
|
||||||
|
|
||||||
@ -297,19 +297,28 @@ public abstract class CommonDBTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testWorldTable() throws DBInitException {
|
public void worldNamesAreStored() throws DBInitException {
|
||||||
WorldTable worldTable = db.getWorldTable();
|
String[] expected = {"Test", "Test2", "Test3"};
|
||||||
List<String> worlds = Arrays.asList("Test", "Test2", "Test3");
|
saveWorlds(expected);
|
||||||
worldTable.saveWorlds(worlds);
|
|
||||||
|
|
||||||
commitTest();
|
commitTest();
|
||||||
|
|
||||||
List<String> saved = worldTable.getWorlds(serverUUID);
|
Collection<String> result = db.query(LargeFetchQueries.fetchAllWorldNames()).getOrDefault(serverUUID, new HashSet<>());
|
||||||
assertEquals(new HashSet<>(worlds), new HashSet<>(saved));
|
assertEquals(Arrays.asList(expected), result);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void saveWorld(String worldName) {
|
||||||
|
db.executeTransaction(new WorldNameStoreTransaction(serverUUID, worldName));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void saveWorlds(String... worldNames) {
|
||||||
|
for (String worldName : worldNames) {
|
||||||
|
saveWorld(worldName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void saveTwoWorlds() {
|
private void saveTwoWorlds() {
|
||||||
db.getWorldTable().saveWorlds(worlds);
|
saveWorlds(worlds);
|
||||||
}
|
}
|
||||||
|
|
||||||
private WorldTimes createWorldTimes() {
|
private WorldTimes createWorldTimes() {
|
||||||
@ -321,7 +330,7 @@ public abstract class CommonDBTest {
|
|||||||
gm.put(gms[2], 3000L);
|
gm.put(gms[2], 3000L);
|
||||||
gm.put(gms[3], 4000L);
|
gm.put(gms[3], 4000L);
|
||||||
|
|
||||||
String worldName = worlds.get(0);
|
String worldName = worlds[0];
|
||||||
times.put(worldName, new GMTimes(gm));
|
times.put(worldName, new GMTimes(gm));
|
||||||
db.executeTransaction(new WorldNameStoreTransaction(serverUUID, worldName));
|
db.executeTransaction(new WorldNameStoreTransaction(serverUUID, worldName));
|
||||||
|
|
||||||
@ -794,13 +803,6 @@ public abstract class CommonDBTest {
|
|||||||
assertTrue(db.check().isPlayerRegisteredOnThisServer(playerUUID));
|
assertTrue(db.check().isPlayerRegisteredOnThisServer(playerUUID));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testWorldTableGetWorldNamesNoException() throws NoSuchAlgorithmException {
|
|
||||||
saveAllData();
|
|
||||||
Set<String> worldNames = db.getWorldTable().getWorldNames(serverUUID);
|
|
||||||
assertEquals(new HashSet<>(worlds), worldNames);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetNetworkGeolocations() {
|
public void testGetNetworkGeolocations() {
|
||||||
GeoInfoTable geoInfoTable = db.getGeoInfoTable();
|
GeoInfoTable geoInfoTable = db.getGeoInfoTable();
|
||||||
|
Loading…
Reference in New Issue
Block a user