use of utilities.TestPluginLogger in project Plan by plan-player-analytics.
the class JSONStorageTest method setUp.
@BeforeEach
void setUp(@TempDir Path tempDir) {
PlanFiles files = Mockito.mock(PlanFiles.class);
this.tempDir = tempDir;
when(files.getJSONStorageDirectory()).thenReturn(this.tempDir);
UNDER_TEST = new JSONFileStorage(files, value -> Long.toString(value), new TestPluginLogger());
}
use of utilities.TestPluginLogger in project Plan by plan-player-analytics.
the class ShutdownSaveTest method setupShutdownSaveObject.
@BeforeEach
void setupShutdownSaveObject(@TempDir Path temporaryFolder) throws Exception {
PluginMockComponent pluginMockComponent = new PluginMockComponent(temporaryFolder);
PlanSystem system = pluginMockComponent.getPlanSystem();
database = system.getDatabaseSystem().getSqLiteFactory().usingFileCalled("test");
database.init();
sessionCache = system.getCacheSystem().getSessionCache();
storeNecessaryInformation();
placeSessionToCache();
DBSystem dbSystemMock = mock(DBSystem.class);
when(dbSystemMock.getDatabase()).thenReturn(database);
TestPluginLogger logger = new TestPluginLogger();
underTest = new ServerShutdownSave(new Locale(), dbSystemMock, logger, system.getErrorLogger()) {
@Override
protected boolean checkServerShuttingDownStatus() {
return shutdownStatus;
}
};
shutdownStatus = false;
}
use of utilities.TestPluginLogger 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 utilities.TestPluginLogger in project Plan by plan-player-analytics.
the class ConfigUpdaterTest method proxyConfigIsPatchedCorrectly.
@Test
void proxyConfigIsPatchedCorrectly() throws IOException, IllegalAccessException {
Path configPath = tempDir.resolve("oldconfig.yml");
Files.copy(oldBungeeConfig.toPath(), configPath, StandardCopyOption.REPLACE_EXISTING);
PlanConfig config = new PlanConfig(configPath.toFile(), null, null, new TestPluginLogger());
UNDER_TEST.applyConfigUpdate(config);
// Ensure that added settings are present
copyMissingFrom(config, newBungeeConfig);
TestSettings.assertValidDefaultValuesForAllSettings(config, TestSettings.getProxySettings());
}
use of utilities.TestPluginLogger in project Plan by plan-player-analytics.
the class ConfigUpdaterTest method serverMoveChangesDoNotLeaveNewEmptyValues.
@Test
void serverMoveChangesDoNotLeaveNewEmptyValues() throws IOException {
Path configPath = tempDir.resolve("oldconfig.yml");
Files.copy(oldConfig.toPath(), configPath, StandardCopyOption.REPLACE_EXISTING);
PlanConfig config = new PlanConfig(configPath.toFile(), null, null, new TestPluginLogger());
ConfigChange[] changes = UNDER_TEST.configEnhancementPatch();
assertMoveChangesAreAppliedProperly(config, changes);
}
Aggregations