53 lines
1.7 KiB
Java
53 lines
1.7 KiB
Java
/*
|
|
* License is provided in the jar as LICENSE also here:
|
|
* https://github.com/Rsl1122/Plan-PlayerAnalytics/blob/master/Plan/src/main/resources/LICENSE
|
|
*/
|
|
package com.djrapitops.plan;
|
|
|
|
import com.djrapitops.plan.system.PlanSystem;
|
|
import com.djrapitops.plan.system.database.DBSystem;
|
|
import com.djrapitops.plan.system.settings.config.PlanConfig;
|
|
import com.djrapitops.plan.system.settings.paths.ProxySettings;
|
|
import com.djrapitops.plan.system.settings.paths.WebserverSettings;
|
|
import org.junit.ClassRule;
|
|
import org.junit.Test;
|
|
import org.junit.rules.TemporaryFolder;
|
|
import org.junit.runner.RunWith;
|
|
import org.mockito.junit.MockitoJUnitRunner;
|
|
import rules.ComponentMocker;
|
|
import rules.VelocityComponentMocker;
|
|
import utilities.RandomData;
|
|
|
|
/**
|
|
* Test for Velocity PlanSystem.
|
|
*
|
|
* @author Rsl1122
|
|
*/
|
|
@RunWith(MockitoJUnitRunner.Silent.class)
|
|
public class VelocitySystemTest {
|
|
|
|
@ClassRule
|
|
public static TemporaryFolder temporaryFolder = new TemporaryFolder();
|
|
@ClassRule
|
|
public static ComponentMocker component = new VelocityComponentMocker(temporaryFolder);
|
|
|
|
private final int TEST_PORT_NUMBER = RandomData.randomInt(9005, 9500);
|
|
|
|
@Test
|
|
public void velocityEnables() throws Exception {
|
|
PlanSystem velocitySystem = component.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();
|
|
dbSystem.setActiveDatabase(dbSystem.getSqLiteFactory().usingDefaultFile());
|
|
|
|
velocitySystem.enable();
|
|
} finally {
|
|
velocitySystem.disable();
|
|
}
|
|
}
|
|
}
|