Add a test for Bungee enabling with MySQL

This commit is contained in:
Rsl1122 2019-05-05 17:11:55 +03:00
parent 2e22e4d18e
commit 20e788d2c8

View File

@ -21,6 +21,7 @@ import com.djrapitops.plan.db.SQLiteDB;
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.DatabaseSettings;
import com.djrapitops.plan.system.settings.paths.ProxySettings;
import com.djrapitops.plan.system.settings.paths.WebserverSettings;
import com.google.common.util.concurrent.MoreExecutors;
@ -33,9 +34,11 @@ import org.junit.runner.RunWith;
import org.mockito.junit.MockitoJUnitRunner;
import rules.BungeeComponentMocker;
import rules.ComponentMocker;
import utilities.CIProperties;
import utilities.RandomData;
import static org.junit.Assert.assertTrue;
import static org.junit.Assume.assumeTrue;
/**
* Test for Bungee PlanSystem.
@ -112,4 +115,28 @@ public class BungeeSystemTest {
bungeeSystem.disable();
}
}
@Test
public void testEnableWithMySQL() throws EnableException {
boolean isCI = Boolean.parseBoolean(System.getenv(CIProperties.IS_CI_SERVICE));
assumeTrue(isCI);
PlanSystem bungeeSystem = component.getPlanSystem();
try {
PlanConfig config = bungeeSystem.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");
config.set(WebserverSettings.PORT, TEST_PORT_NUMBER);
config.set(ProxySettings.IP, "8.8.8.8");
bungeeSystem.enable();
assertTrue(bungeeSystem.isEnabled());
} finally {
bungeeSystem.disable();
}
}
}