mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2025-01-06 15:44:49 +08:00
Finished some things marked //TODO
This commit is contained in:
parent
fdf2a650df
commit
4f3eea967a
@ -180,16 +180,16 @@ public class Plan extends BukkitPlugin<Plan> implements IPlan {
|
||||
|
||||
this.api = new API(this);
|
||||
|
||||
// Data view settings // TODO Rewrite. (TextUI removed & webServer might be running on bungee
|
||||
// boolean usingAlternativeIP = Settings.SHOW_ALTERNATIVE_IP.isTrue();
|
||||
// boolean hasDataViewCapability = usingAlternativeIP;
|
||||
//
|
||||
// if (!hasDataViewCapability) {
|
||||
// Log.infoColor(Locale.get(Msg.ENABLE_NOTIFY_NO_DATA_VIEW).toString());
|
||||
// }
|
||||
// if (!usingAlternativeIP && serverVariableHolder.getIp().isEmpty()) {
|
||||
// Log.infoColor(Locale.get(Msg.ENABLE_NOTIFY_EMPTY_IP).toString());
|
||||
// }
|
||||
boolean usingBungeeWebServer = infoManager.isUsingBungeeWebServer();
|
||||
boolean usingAlternativeIP = Settings.SHOW_ALTERNATIVE_IP.isTrue();
|
||||
|
||||
if (!usingAlternativeIP && serverVariableHolder.getIp().isEmpty()) {
|
||||
Log.infoColor(Locale.get(Msg.ENABLE_NOTIFY_EMPTY_IP).toString());
|
||||
}
|
||||
if (usingBungeeWebServer && usingAlternativeIP) {
|
||||
// TODO Move to Locale
|
||||
Log.info("Make sure that the alternative IP points to Bungee Server: " + Settings.ALTERNATIVE_IP.toString());
|
||||
}
|
||||
|
||||
registerCommand(new PlanCommand(this));
|
||||
|
||||
|
@ -67,7 +67,9 @@ public class PlanBungee extends BungeePlugin<PlanBungee> implements IPlan {
|
||||
|
||||
String ip = variableHolder.getIp();
|
||||
if ("0.0.0.0".equals(ip)) {
|
||||
Log.error("IP setting still 0.0.0.0 - Set up AlternativeIP/IP that connects to the Proxy server.");
|
||||
Log.error("IP setting still 0.0.0.0 - Config AlternativeIP/IP that connects to the Proxy server.");
|
||||
disablePlugin();
|
||||
return;
|
||||
}
|
||||
|
||||
Benchmark.start("WebServer Initialization");
|
||||
|
@ -18,7 +18,9 @@ import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* //TODO Class Javadoc Comment
|
||||
* Thread that is run when JVM shuts down.
|
||||
* <p>
|
||||
* Saves active sessions to the Database (PlayerQuitEvent is not called)
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
|
@ -5,7 +5,7 @@
|
||||
package main.java.com.djrapitops.plan.api.exceptions;
|
||||
|
||||
/**
|
||||
* //TODO Class Javadoc Comment
|
||||
* Thrown when WebAPI returns 404, usually when response is supposed to be false.
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
|
@ -19,7 +19,7 @@ import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* //TODO Class Javadoc Comment
|
||||
* Command used for testing functions that are too difficult to unit test.
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
|
@ -37,7 +37,9 @@ import java.io.Serializable;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* //TODO Class Javadoc Comment
|
||||
* Manages the Information going to the PageCache.
|
||||
* <p>
|
||||
* This means Inspect and Analysis pages as well as managing what is sent to Bungee WebServer when one is in use.
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
@ -231,4 +233,9 @@ public class BukkitInformationManager extends InformationManager {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getWebServerAddress() {
|
||||
return webServerAddress != null ? webServerAddress : plugin.getWebServer().getAccessAddress();
|
||||
}
|
||||
}
|
@ -25,7 +25,7 @@ import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* //TODO Class Javadoc Comment
|
||||
* Manages information going to the PageCache from Bukkit servers.
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
@ -175,4 +175,8 @@ public class BungeeInformationManager extends InformationManager {
|
||||
return plugin.getWebServer().getWebAPI();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getWebServerAddress() {
|
||||
return plugin.getWebServer().getAccessAddress();
|
||||
}
|
||||
}
|
@ -15,7 +15,9 @@ import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* //TODO Class Javadoc Comment
|
||||
* Abstract layer for Bukkit and Bungee Information managers.
|
||||
* <p>
|
||||
* Manages analysis notification sending.
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
@ -77,4 +79,6 @@ public abstract class InformationManager {
|
||||
public boolean isUsingBungeeWebServer() {
|
||||
return usingBungeeWebServer;
|
||||
}
|
||||
|
||||
public abstract String getWebServerAddress();
|
||||
}
|
@ -17,7 +17,7 @@ import main.java.com.djrapitops.plan.utilities.html.HtmlUtils;
|
||||
import java.io.FileNotFoundException;
|
||||
|
||||
/**
|
||||
* //TODO Class Javadoc Comment
|
||||
* Used for parsing a Html String out of AnalysisData and the html file.
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
|
@ -35,7 +35,7 @@ import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* //TODO Class Javadoc Comment
|
||||
* Used for parsing Inspect page out of database data and the html.
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
|
@ -11,7 +11,7 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* //TODO Class Javadoc Comment
|
||||
* Abstract class that is responsible for parsing data and html together into a String.
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
|
@ -10,7 +10,7 @@ import main.java.com.djrapitops.plan.Plan;
|
||||
import java.sql.SQLException;
|
||||
|
||||
/**
|
||||
* //TODO Class Javadoc Comment
|
||||
* Updates Command usage amount in the database.
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
|
@ -1,28 +0,0 @@
|
||||
/*
|
||||
* Licence is provided in the jar as license.yml also here:
|
||||
* https://github.com/Rsl1122/Plan-PlayerAnalytics/blob/master/Plan/src/main/resources/license.yml
|
||||
*/
|
||||
package main.java.com.djrapitops.plan.systems.processing;
|
||||
|
||||
import main.java.com.djrapitops.plan.database.Database;
|
||||
|
||||
/**
|
||||
* Processor for queueing a Database Commit after changes.
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
public class DBCommitProcessor extends Processor<Database> {
|
||||
public DBCommitProcessor(Database object) {
|
||||
super(object);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void process() {
|
||||
// TODO Prevent Commit during batch operations.
|
||||
// try {
|
||||
// object.commit();
|
||||
// } catch (SQLException e) {
|
||||
// Log.toLog(this.getClass().getName(), e);
|
||||
// }
|
||||
}
|
||||
}
|
@ -13,7 +13,7 @@ import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* //TODO Class Javadoc Comment
|
||||
* Processes 60s average of a TPS list.
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
|
@ -15,7 +15,7 @@ import main.java.com.djrapitops.plan.utilities.html.HtmlUtils;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* //TODO Class Javadoc Comment
|
||||
* Sends a request to cache players inspect page to the PageCache on the appropriate WebServer.
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
|
@ -11,7 +11,7 @@ import java.sql.SQLException;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* //TODO Class Javadoc Comment
|
||||
* Updates ban and OP status of the player to the database.
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
|
@ -7,7 +7,7 @@ import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* // TODO Write Javadoc Class Description
|
||||
* Updates death count of the current session.
|
||||
*
|
||||
* @author Rsl1122
|
||||
* @since 4.0.0
|
||||
|
@ -9,7 +9,7 @@ import main.java.com.djrapitops.plan.Plan;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* //TODO Class Javadoc Comment
|
||||
* Ends a session and saves it to the database.
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
|
@ -12,7 +12,7 @@ import java.sql.SQLException;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* //TODO Class Javadoc Comment
|
||||
* Updates the IP and Geolocation of a user.
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
|
@ -11,7 +11,7 @@ import java.sql.SQLException;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* //TODO Class Javadoc Comment
|
||||
* Updates the Kick count of a user.
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
|
@ -7,11 +7,13 @@ package main.java.com.djrapitops.plan.systems.webserver;
|
||||
import main.java.com.djrapitops.plan.Log;
|
||||
import main.java.com.djrapitops.plan.Plan;
|
||||
import main.java.com.djrapitops.plan.systems.webserver.response.ForbiddenResponse;
|
||||
import main.java.com.djrapitops.plan.systems.webserver.response.NotFoundResponse;
|
||||
import main.java.com.djrapitops.plan.systems.webserver.response.Response;
|
||||
import main.java.com.djrapitops.plan.systems.webserver.response.api.BadRequestResponse;
|
||||
import main.java.com.djrapitops.plan.systems.webserver.webapi.WebAPI;
|
||||
import main.java.com.djrapitops.plan.systems.webserver.webapi.WebAPIManager;
|
||||
import main.java.com.djrapitops.plan.utilities.MiscUtils;
|
||||
import main.java.com.djrapitops.plan.utilities.html.Html;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
@ -25,7 +27,7 @@ import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* //TODO Class Javadoc Comment
|
||||
* Handles choosing of the correct API response to an API request.
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
@ -41,6 +43,13 @@ public class APIResponseHandler {
|
||||
String target = request.getTarget();
|
||||
String[] args = target.split("/");
|
||||
|
||||
if (args.length < 2 || !"api".equals(args[1])) {
|
||||
String address = MiscUtils.getIPlan().getInfoManager().getWebServerAddress() + target;
|
||||
String link = Html.LINK.parse(address, address);
|
||||
return PageCache.loadPage("Non-API Request", () -> new NotFoundResponse("WebServer is in WebAPI-only mode, " +
|
||||
"connect to the Bungee server instead: " + link));
|
||||
}
|
||||
|
||||
if (args.length < 3) {
|
||||
String error = "API Method not specified";
|
||||
return PageCache.loadPage(error, () -> new BadRequestResponse(error));
|
||||
|
@ -12,7 +12,9 @@ import java.io.InputStream;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* //TODO Class Javadoc Comment
|
||||
* Represents a HttpExchange Request.
|
||||
* <p>
|
||||
* Automatically gets the Basic Auth from headers.
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
|
@ -20,7 +20,7 @@ import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* //TODO Class Javadoc Comment
|
||||
* Handles choosing of the correct response to a request.
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
|
@ -15,7 +15,13 @@ import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* //TODO Class Javadoc Comment
|
||||
* WebAPI for requesting Inspect plugins tab contents from a Bukkit Server.
|
||||
* <p>
|
||||
* Call: Bungee -> Bukkit
|
||||
* <p>
|
||||
* Bad Requests:
|
||||
* - Called a Bungee Server
|
||||
* - Did not include uuid variable
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
|
@ -4,7 +4,6 @@
|
||||
*/
|
||||
package main.java.com.djrapitops.plan.systems.webserver.webapi.bungee;
|
||||
|
||||
import com.djrapitops.plugin.utilities.Verify;
|
||||
import main.java.com.djrapitops.plan.api.IPlan;
|
||||
import main.java.com.djrapitops.plan.api.exceptions.WebAPIException;
|
||||
import main.java.com.djrapitops.plan.systems.info.BungeeInformationManager;
|
||||
@ -15,7 +14,12 @@ import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* //TODO Class Javadoc Comment
|
||||
* WebAPI for posting Inspect page Plugins tab contents to the Bungee server.
|
||||
* <p>
|
||||
* Call: Bukkit -> Bungee
|
||||
* <p>
|
||||
* Bad Requests:
|
||||
* - Did not include uuid
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
@ -23,13 +27,12 @@ public class PostInspectPluginsTabWebAPI extends WebAPI {
|
||||
@Override
|
||||
public Response onRequest(IPlan plugin, Map<String, String> variables) {
|
||||
String uuidS = variables.get("uuid");
|
||||
String sender = variables.get("sender");
|
||||
if (Verify.notNull(uuidS, sender)) {
|
||||
return badRequest("uuid or sender not included");
|
||||
if (uuidS == null) {
|
||||
return badRequest("uuid not included");
|
||||
}
|
||||
|
||||
UUID uuid = UUID.fromString(uuidS);
|
||||
UUID serverUUID = UUID.fromString(sender);
|
||||
UUID serverUUID = UUID.fromString(variables.get("sender"));
|
||||
String html = variables.get("html");
|
||||
|
||||
((BungeeInformationManager) plugin.getInfoManager()).cachePluginsTabContent(serverUUID, uuid, html);
|
||||
|
@ -20,7 +20,13 @@ import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* //TODO Class Javadoc Comment
|
||||
* WebAPI for requesting Bungee Server to request Plugins tab contents from every server.
|
||||
* <p>
|
||||
* Call: Bukkit -> Bungee
|
||||
* <p>
|
||||
* Bad Requests:
|
||||
* - Called a Bukkit Server
|
||||
* - Did not include uuid variable
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
|
@ -1,72 +0,0 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package main.java.com.djrapitops.plan.utilities.html.graphs;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author Rsl1122
|
||||
*/
|
||||
@Deprecated // Not going to be used TODO REMOVE
|
||||
public class SessionLengthDistributionGraphCreator {
|
||||
|
||||
/**
|
||||
* Constructor used to hide the public constructor
|
||||
*/
|
||||
private SessionLengthDistributionGraphCreator() {
|
||||
throw new IllegalStateException("Utility class");
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a data series of session lengths for Sessions bar chart.
|
||||
* <p>
|
||||
* Contains values from 0 up to 120 minutes
|
||||
*
|
||||
* @param lengths Lengths of all sessions in a list.
|
||||
* @return Data for HighCharts series.
|
||||
*/
|
||||
public static String createDataSeries(List<Long> lengths) {
|
||||
Map<Long, Integer> bars = getValues(lengths);
|
||||
List<Long> keys = new ArrayList<>(bars.keySet());
|
||||
Collections.sort(keys);
|
||||
|
||||
StringBuilder arrayBuilder = new StringBuilder("[");
|
||||
int i = 0;
|
||||
int size = keys.size();
|
||||
for (Long key : keys) {
|
||||
if (key > 120) {
|
||||
break;
|
||||
}
|
||||
Integer value = bars.get(key);
|
||||
arrayBuilder.append("['").append(key - 5).append(" - ").append(key).append(" min',").append(value).append("]");
|
||||
if (i < size) {
|
||||
arrayBuilder.append(", ");
|
||||
}
|
||||
i++;
|
||||
}
|
||||
arrayBuilder.append("]");
|
||||
return arrayBuilder.toString();
|
||||
}
|
||||
|
||||
private static Map<Long, Integer> getValues(Collection<Long> lengths) {
|
||||
List<Long> unused = new ArrayList<>(lengths);
|
||||
Map<Long, Integer> values = new HashMap<>();
|
||||
long lengthInMinutes = 5;
|
||||
|
||||
while (!unused.isEmpty() || lengthInMinutes <= 120) {
|
||||
long length = lengthInMinutes * 60 * 1000;
|
||||
List<Long> lessThan = unused.stream().filter(l -> l < length).collect(Collectors.toList());
|
||||
int amount = lessThan.size();
|
||||
if (amount != 0) {
|
||||
values.put(lengthInMinutes, amount);
|
||||
unused.removeAll(lessThan);
|
||||
}
|
||||
lengthInMinutes += 5;
|
||||
}
|
||||
return values;
|
||||
}
|
||||
}
|
@ -23,7 +23,6 @@ ${playerKillCount} num
|
||||
${mobKillCount} num
|
||||
${deathCount} num
|
||||
|
||||
// TODO All these after SessionData has been updated.
|
||||
${sessionCountDay} num
|
||||
${sessionCountWeek} num
|
||||
${playtimeDay} timeamount
|
||||
@ -132,9 +131,6 @@ ${punchCardSeries}
|
||||
|
||||
${playersGraphColor} // done
|
||||
|
||||
|
||||
${gmData} // TODO Remove
|
||||
${gmTotal} timeamount // TODO Remove
|
||||
${gmColors} // TODO Move to World Graph
|
||||
|
||||
// done
|
||||
|
@ -537,26 +537,6 @@
|
||||
y: ${banned}
|
||||
}]
|
||||
};
|
||||
var gmData = ${gmData};
|
||||
var gmSeries = {
|
||||
name: 'GM Usage',
|
||||
colorByPoint: true,
|
||||
data: [{
|
||||
name: 'Survival',
|
||||
y: gmData[0],
|
||||
sliced: true,
|
||||
selected: true
|
||||
}, {
|
||||
name: 'Creative',
|
||||
y: gmData[1]
|
||||
}, {
|
||||
name: 'Adventure',
|
||||
y: gmData[2]
|
||||
}, {
|
||||
name: 'Spectator',
|
||||
y: gmData[3]
|
||||
}]
|
||||
};
|
||||
var worldSeries = {
|
||||
name: 'World Playtime',
|
||||
colorByPoint: true,
|
||||
|
@ -1,59 +0,0 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package main.java.com.djrapitops.plan.data.cache.queue;
|
||||
|
||||
import main.java.com.djrapitops.plan.Plan;
|
||||
import main.java.com.djrapitops.plan.database.Database;
|
||||
import main.java.com.djrapitops.plan.database.databases.SQLiteDB;
|
||||
import main.java.com.djrapitops.plan.systems.cache.DataCache;
|
||||
import main.java.com.djrapitops.plan.utilities.MiscUtils;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.powermock.core.classloader.annotations.PrepareForTest;
|
||||
import org.powermock.modules.junit4.PowerMockRunner;
|
||||
import test.java.utils.TestInit;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static org.powermock.api.mockito.PowerMockito.when;
|
||||
|
||||
// TODO Rewrite
|
||||
@RunWith(PowerMockRunner.class)
|
||||
@PrepareForTest({JavaPlugin.class})
|
||||
public class QueueTest {
|
||||
|
||||
private Database db;
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
TestInit t = TestInit.init();
|
||||
Plan plan = t.getPlanMock();
|
||||
|
||||
db = new SQLiteDB(plan, "debug" + MiscUtils.getTime());
|
||||
db.init();
|
||||
when(plan.getDB()).thenReturn(db);
|
||||
|
||||
DataCache dataCache = new DataCache(plan);
|
||||
when(plan.getDataCache()).thenReturn(dataCache);
|
||||
}
|
||||
|
||||
@After
|
||||
public void tearDown() throws SQLException {
|
||||
db.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testProcessQueue() {
|
||||
List<Integer> processCalls = new ArrayList<>();
|
||||
List<Integer> errors = new ArrayList<>();
|
||||
// TODO Rewrite
|
||||
}
|
||||
}
|
@ -4,11 +4,6 @@ import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
/**
|
||||
* //TODO Class Javadoc Comment
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
public class ActionsTest {
|
||||
|
||||
@Test
|
||||
|
@ -10,11 +10,6 @@ import java.util.UUID;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
/**
|
||||
* //TODO Class Javadoc Comment
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
public class SessionCacheTest {
|
||||
|
||||
private final UUID uuid = MockUtils.getPlayerUUID();
|
||||
|
@ -19,11 +19,6 @@ import java.util.stream.Collectors;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
/**
|
||||
* //TODO Class Javadoc Comment
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
@RunWith(PowerMockRunner.class)
|
||||
@PrepareForTest(JavaPlugin.class)
|
||||
public class HtmlStructureTest {
|
||||
|
@ -11,6 +11,7 @@ import org.apache.commons.lang3.RandomStringUtils;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
|
||||
public class RandomData {
|
||||
@ -65,7 +66,12 @@ public class RandomData {
|
||||
}
|
||||
|
||||
public static List<UserInfo> randomUserData() {
|
||||
return new ArrayList<>();
|
||||
// TODO Rewrite
|
||||
List<UserInfo> test = new ArrayList<>();
|
||||
for (int i = 0; i < 20; i++) {
|
||||
UserInfo info = new UserInfo(UUID.randomUUID(), randomString(10), r.nextLong(), r.nextBoolean(), r.nextBoolean());
|
||||
info.setLastSeen(r.nextLong());
|
||||
test.add(info);
|
||||
}
|
||||
return test;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user