use of utilities.mocks.PluginMockComponent in project Plan by plan-player-analytics.
the class JSErrorRegressionTest method setUpClass.
@BeforeAll
static void setUpClass(@TempDir Path tempDir) throws Exception {
component = new PluginMockComponent(tempDir);
planSystem = component.getPlanSystem();
PlanConfig config = planSystem.getConfigSystem().getConfig();
config.set(WebserverSettings.PORT, TEST_PORT_NUMBER);
config.set(ProxySettings.IP, "localhost:" + TEST_PORT_NUMBER);
planSystem.enable();
serverUUID = planSystem.getServerInfo().getServerUUID();
savePlayerData();
}
use of utilities.mocks.PluginMockComponent in project Plan by plan-player-analytics.
the class Pkcs12HttpsServerTest method setUpClass.
@BeforeAll
static void setUpClass(@TempDir Path tempDir) throws Exception {
File file = tempDir.resolve("TestCert.p12").toFile();
File testCert = TestResources.getTestResourceFile("TestCert.p12", ConfigUpdater.class);
Files.copy(testCert.toPath(), file.toPath(), StandardCopyOption.REPLACE_EXISTING);
String absolutePath = file.getAbsolutePath();
PluginMockComponent component = new PluginMockComponent(tempDir);
system = component.getPlanSystem();
PlanConfig config = system.getConfigSystem().getConfig();
config.set(WebserverSettings.CERTIFICATE_PATH, absolutePath);
config.set(WebserverSettings.CERTIFICATE_KEYPASS, "test");
config.set(WebserverSettings.CERTIFICATE_STOREPASS, "test");
config.set(WebserverSettings.CERTIFICATE_ALIAS, "test");
config.set(WebserverSettings.PORT, TEST_PORT_NUMBER);
system.enable();
User user = new User("test", "console", null, PassEncryptUtil.createHash("testPass"), 0, Collections.emptyList());
system.getDatabaseSystem().getDatabase().executeTransaction(new RegisterWebUserTransaction(user));
}
use of utilities.mocks.PluginMockComponent 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.mocks.PluginMockComponent in project Plan by plan-player-analytics.
the class DBPatchSQLiteRegressionTest method setUpDBWithOldSchema.
@BeforeEach
void setUpDBWithOldSchema(@TempDir Path tempDir) throws Exception {
component = new PluginMockComponent(tempDir);
underTest = this.component.getPlanSystem().getDatabaseSystem().getSqLiteFactory().usingFileCalled("test");
underTest.setTransactionExecutorServiceProvider(MoreExecutors::newDirectExecutorService);
underTest.init();
// Initialize database with the old table schema
dropAllTables(underTest);
underTest.executeTransaction(new Transaction() {
@Override
protected void performOperations() {
execute(serverTable);
execute(usersTable);
execute(userInfoTable);
execute(geoInfoTable);
execute(nicknameTable);
execute(sessionsTable);
execute(killsTable);
execute(pingTable);
execute(commandUseTable);
execute(tpsTable);
execute(worldsTable);
execute(worldTimesTable);
execute(securityTable);
execute(transferTable);
}
});
underTest.executeTransaction(new CreateTablesTransaction());
insertData(underTest);
}
use of utilities.mocks.PluginMockComponent in project Plan by plan-player-analytics.
the class JksHttpsServerTest method setUpClass.
@BeforeAll
static void setUpClass(@TempDir Path tempDir) throws Exception {
File file = tempDir.resolve("PlanCert.jks").toFile();
TestResources.copyResourceIntoFile(file, "/PlanCert.jks");
String absolutePath = file.getAbsolutePath();
PluginMockComponent component = new PluginMockComponent(tempDir);
system = component.getPlanSystem();
PlanConfig config = system.getConfigSystem().getConfig();
config.set(WebserverSettings.CERTIFICATE_PATH, absolutePath);
config.set(WebserverSettings.CERTIFICATE_KEYPASS, "MnD3bU5HpmPXag0e");
config.set(WebserverSettings.CERTIFICATE_STOREPASS, "wDwwf663NLTm73gL");
config.set(WebserverSettings.CERTIFICATE_ALIAS, "DefaultPlanCert");
config.set(WebserverSettings.PORT, TEST_PORT_NUMBER);
system.enable();
User user = new User("test", "console", null, PassEncryptUtil.createHash("testPass"), 0, Collections.emptyList());
system.getDatabaseSystem().getDatabase().executeTransaction(new RegisterWebUserTransaction(user));
}
Aggregations