use of com.djrapitops.plan.utilities.logging.ErrorLogger in project Plan by plan-player-analytics.
the class ConfigUpdaterTest method prepareConfigFiles.
@BeforeAll
static void prepareConfigFiles() throws URISyntaxException, IOException {
oldConfig = tempDir.resolve("config.yml").toFile();
File configResource = TestResources.getTestResourceFile("config/4.5.2-config.yml", ConfigUpdater.class);
Files.copy(configResource.toPath(), oldConfig.toPath(), StandardCopyOption.REPLACE_EXISTING);
oldBungeeConfig = tempDir.resolve("bungeeconfig.yml").toFile();
File bungeeConfigResource = TestResources.getTestResourceFile("config/4.5.2-bungeeconfig.yml", ConfigUpdater.class);
Files.copy(bungeeConfigResource.toPath(), oldBungeeConfig.toPath(), StandardCopyOption.REPLACE_EXISTING);
newConfig = tempDir.resolve("newconfig.yml");
TestResources.copyResourceIntoFile(newConfig.toFile(), "/assets/plan/config.yml");
newBungeeConfig = tempDir.resolve("newbungeeconfig.yml");
TestResources.copyResourceIntoFile(newBungeeConfig.toFile(), "/assets/plan/bungeeconfig.yml");
PluginLogger testLogger = new TestPluginLogger();
errorLogger = Mockito.mock(ErrorLogger.class);
UNDER_TEST = new ConfigUpdater(testLogger, errorLogger);
}
use of com.djrapitops.plan.utilities.logging.ErrorLogger in project Plan by plan-player-analytics.
the class BukkitAFKListenerTest method setUp.
@BeforeAll
static void setUp() {
PlanConfig config = Mockito.mock(PlanConfig.class);
when(config.get(TimeSettings.AFK_THRESHOLD)).thenReturn(TimeUnit.MINUTES.toMillis(3));
errorLogger = Mockito.mock(ErrorLogger.class);
underTest = new BukkitAFKListener(config, errorLogger);
new SessionCache().cacheSession(TestConstants.PLAYER_ONE_UUID, new ActiveSession(null, null, 0, null, null));
new SessionCache().cacheSession(TestConstants.PLAYER_TWO_UUID, new ActiveSession(null, null, 0, null, null));
}
use of com.djrapitops.plan.utilities.logging.ErrorLogger in project Plan by plan-player-analytics.
the class ExportScheduler method scheduleServerPageExport.
private void scheduleServerPageExport() {
if (config.isFalse(ExportSettings.SERVER_PAGE))
return;
Collection<Server> servers = dbSystem.getDatabase().query(ServerQueries.fetchPlanServerInformationCollection());
int serverCount = servers.size();
if (serverCount == 0)
return;
long period = TimeAmount.toTicks(config.get(ExportSettings.EXPORT_PERIOD), TimeUnit.MILLISECONDS);
long offset = period / serverCount;
Optional<Server> proxy = servers.stream().filter(Server::isProxy).findFirst();
proxy.ifPresent(mainServer -> runnableFactory.create(new ExportTask(exporter, same -> same.exportServerPage(mainServer), errorLogger)).runTaskTimerAsynchronously(TimeAmount.toTicks(1, TimeUnit.MINUTES), period));
// Delay first server export if on a network.
int offsetMultiplier = proxy.isPresent() ? 1 : 0;
for (Server server : servers) {
runnableFactory.create(new ExportTask(exporter, same -> {
same.exportServerPage(server);
same.exportServerJSON(server);
}, errorLogger)).runTaskTimerAsynchronously(offset * offsetMultiplier, period);
offsetMultiplier++;
}
}
use of com.djrapitops.plan.utilities.logging.ErrorLogger in project Plan by plan-player-analytics.
the class NukkitAFKListenerTest method setUp.
@BeforeAll
static void setUp() {
PlanConfig config = Mockito.mock(PlanConfig.class);
when(config.get(TimeSettings.AFK_THRESHOLD)).thenReturn(TimeUnit.MINUTES.toMillis(3));
errorLogger = Mockito.mock(ErrorLogger.class);
underTest = new NukkitAFKListener(config, errorLogger);
new SessionCache().cacheSession(TestConstants.PLAYER_ONE_UUID, new ActiveSession(null, null, 0, null, null));
new SessionCache().cacheSession(TestConstants.PLAYER_TWO_UUID, new ActiveSession(null, null, 0, null, null));
}
Aggregations