mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2025-04-18 18:30:31 +08:00
MySQL Test + CIProperties
This commit is contained in:
parent
c17b1c1aca
commit
131585179d
@ -9,6 +9,7 @@ import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.WebElement;
|
||||
import org.openqa.selenium.chrome.ChromeDriver;
|
||||
import org.openqa.selenium.chrome.ChromeOptions;
|
||||
import utilities.CIProperties;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
@ -50,7 +51,7 @@ public class SeleniumExtension implements ParameterResolver, BeforeAllCallback,
|
||||
}
|
||||
|
||||
private WebDriver getChromeWebDriver() {
|
||||
if (System.getProperty("TRAVIS").equals("true")) {
|
||||
if (Boolean.parseBoolean(System.getProperty(CIProperties.IS_TRAVIS))) {
|
||||
ChromeOptions chromeOptions = new ChromeOptions();
|
||||
chromeOptions.setBinary("/usr/bin/google-chrome-stable");
|
||||
chromeOptions.setHeadless(true);
|
||||
|
15
Plan/common/src/test/java/utilities/CIProperties.java
Normal file
15
Plan/common/src/test/java/utilities/CIProperties.java
Normal file
@ -0,0 +1,15 @@
|
||||
package utilities;
|
||||
|
||||
/**
|
||||
* Test Utility class that holds System property names used in Travis.
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
public class CIProperties {
|
||||
|
||||
public static final String IS_TRAVIS = "TRAVIS";
|
||||
|
||||
private CIProperties() {
|
||||
/* Static variable class */
|
||||
}
|
||||
}
|
@ -98,7 +98,7 @@ public abstract class CommonDBTest {
|
||||
|
||||
@AfterClass
|
||||
public static void tearDownClass() {
|
||||
Optional.ofNullable(system).ifPresent(PlanSystem::disable);
|
||||
if (system != null) system.disable();
|
||||
}
|
||||
|
||||
@Before
|
||||
|
@ -0,0 +1,34 @@
|
||||
package com.djrapitops.plan.system.database.databases;
|
||||
|
||||
import com.djrapitops.plan.system.settings.config.PlanConfig;
|
||||
import com.djrapitops.plan.system.settings.paths.DatabaseSettings;
|
||||
import org.junit.BeforeClass;
|
||||
import utilities.CIProperties;
|
||||
|
||||
import static org.junit.Assume.assumeTrue;
|
||||
|
||||
/**
|
||||
* Tests for {@link com.djrapitops.plan.system.database.databases.sql.MySQLDB}.
|
||||
* <p>
|
||||
* These settings assume Travis CI environment with MySQL service running.
|
||||
* 'Plan' database should be created before the test.
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
public class MySQLTest extends CommonDBTest {
|
||||
|
||||
@BeforeClass
|
||||
public static void setUpDatabase() throws Exception {
|
||||
boolean isTravis = Boolean.parseBoolean(System.getProperty(CIProperties.IS_TRAVIS));
|
||||
assumeTrue(isTravis);
|
||||
|
||||
PlanConfig config = component.getPlanSystem().getConfigSystem().getConfig();
|
||||
config.set(DatabaseSettings.MYSQL_DATABASE, "Plan");
|
||||
config.set(DatabaseSettings.MYSQL_USER, "travis");
|
||||
config.set(DatabaseSettings.MYSQL_PASS, "");
|
||||
config.set(DatabaseSettings.MYSQL_HOST, "127.0.0.1");
|
||||
config.set(DatabaseSettings.TYPE, "MySQL");
|
||||
|
||||
handleSetup("MySQL");
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user