Search in sources :

Example 6 with PlanConfig

use of com.djrapitops.plan.settings.config.PlanConfig in project Plan by plan-player-analytics.

the class VelocitySystemTest method velocityEnables.

@Test
void velocityEnables(@TempDir Path temp) throws Exception {
    PlanSystem velocitySystem = new VelocityMockComponent(temp).getPlanSystem();
    try {
        PlanConfig config = velocitySystem.getConfigSystem().getConfig();
        config.set(WebserverSettings.PORT, TEST_PORT_NUMBER);
        config.set(ProxySettings.IP, "8.8.8.8");
        DBSystem dbSystem = velocitySystem.getDatabaseSystem();
        SQLiteDB db = dbSystem.getSqLiteFactory().usingDefaultFile();
        db.setTransactionExecutorServiceProvider(MoreExecutors::newDirectExecutorService);
        dbSystem.setActiveDatabase(db);
        velocitySystem.enable();
        assertTrue(velocitySystem.isEnabled());
    } finally {
        velocitySystem.disable();
    }
}
Also used : VelocityMockComponent(utilities.mocks.VelocityMockComponent) DBSystem(com.djrapitops.plan.storage.database.DBSystem) SQLiteDB(com.djrapitops.plan.storage.database.SQLiteDB) MoreExecutors(com.google.common.util.concurrent.MoreExecutors) PlanConfig(com.djrapitops.plan.settings.config.PlanConfig) Test(org.junit.jupiter.api.Test)

Example 7 with PlanConfig

use of com.djrapitops.plan.settings.config.PlanConfig in project Plan by plan-player-analytics.

the class BukkitSystemTest method bukkitSystemHasDefaultConfigValuesAfterEnable.

@Test
void bukkitSystemHasDefaultConfigValuesAfterEnable() throws IllegalAccessException {
    try {
        system.enable();
        PlanConfig config = system.getConfigSystem().getConfig();
        TestSettings.assertValidDefaultValuesForAllSettings(config, TestSettings.getServerSettings());
    } finally {
        system.disable();
    }
}
Also used : PlanConfig(com.djrapitops.plan.settings.config.PlanConfig) Test(org.junit.jupiter.api.Test)

Example 8 with PlanConfig

use of com.djrapitops.plan.settings.config.PlanConfig 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);
    config.set(PluginSettings.FRONTEND_BETA, true);
    // Avoid accidentally DDoS:ing head image service during tests.
    config.set(DisplaySettings.PLAYER_HEAD_IMG_URL, "http://localhost:" + TEST_PORT_NUMBER + "/${playerUUID}/img/Flaticon_circle.png");
    planSystem.enable();
    serverUUID = planSystem.getServerInfo().getServerUUID();
    savePlayerData();
}
Also used : PluginMockComponent(utilities.mocks.PluginMockComponent) PlanConfig(com.djrapitops.plan.settings.config.PlanConfig)

Example 9 with PlanConfig

use of com.djrapitops.plan.settings.config.PlanConfig 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));
}
Also used : User(com.djrapitops.plan.delivery.domain.auth.User) RegisterWebUserTransaction(com.djrapitops.plan.storage.database.transactions.commands.RegisterWebUserTransaction) PluginMockComponent(utilities.mocks.PluginMockComponent) File(java.io.File) PlanConfig(com.djrapitops.plan.settings.config.PlanConfig) BeforeAll(org.junit.jupiter.api.BeforeAll)

Example 10 with PlanConfig

use of com.djrapitops.plan.settings.config.PlanConfig 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));
}
Also used : User(com.djrapitops.plan.delivery.domain.auth.User) RegisterWebUserTransaction(com.djrapitops.plan.storage.database.transactions.commands.RegisterWebUserTransaction) PluginMockComponent(utilities.mocks.PluginMockComponent) File(java.io.File) PlanConfig(com.djrapitops.plan.settings.config.PlanConfig) BeforeAll(org.junit.jupiter.api.BeforeAll)

Aggregations

PlanConfig (com.djrapitops.plan.settings.config.PlanConfig)31 Test (org.junit.jupiter.api.Test)17 BeforeAll (org.junit.jupiter.api.BeforeAll)7 Path (java.nio.file.Path)5 TestPluginLogger (utilities.TestPluginLogger)5 PluginMockComponent (utilities.mocks.PluginMockComponent)5 DBSystem (com.djrapitops.plan.storage.database.DBSystem)4 MoreExecutors (com.google.common.util.concurrent.MoreExecutors)4 User (com.djrapitops.plan.delivery.domain.auth.User)3 SessionCache (com.djrapitops.plan.gathering.cache.SessionCache)3 ActiveSession (com.djrapitops.plan.gathering.domain.ActiveSession)3 SQLiteDB (com.djrapitops.plan.storage.database.SQLiteDB)3 RegisterWebUserTransaction (com.djrapitops.plan.storage.database.transactions.commands.RegisterWebUserTransaction)3 File (java.io.File)3 TimeAmountFormatter (com.djrapitops.plan.delivery.formatting.time.TimeAmountFormatter)2 Setting (com.djrapitops.plan.settings.config.paths.key.Setting)2 SQLDB (com.djrapitops.plan.storage.database.SQLDB)2 StoreConfigTransaction (com.djrapitops.plan.storage.database.transactions.StoreConfigTransaction)2 ErrorLogger (com.djrapitops.plan.utilities.logging.ErrorLogger)2 BeforeEach (org.junit.jupiter.api.BeforeEach)2