Unignored 2 BungeeSystem tests

- Caught a PoolInitializationException in MySQL to throw EnableException
  properly.
This commit is contained in:
Rsl1122 2018-12-27 18:51:11 +02:00
parent 217867ab52
commit 3d65e8c745
3 changed files with 6 additions and 8 deletions

View File

@ -11,7 +11,6 @@ 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.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
@ -32,11 +31,11 @@ public class BungeeSystemTest {
@ClassRule
public static TemporaryFolder temporaryFolder = new TemporaryFolder();
@ClassRule
public static ComponentMocker component = new BungeeComponentMocker(temporaryFolder);
private final int TEST_PORT_NUMBER = RandomData.randomInt(9005, 9500);
@Rule
public ComponentMocker component = new BungeeComponentMocker(temporaryFolder);
@Rule
public ExpectedException thrown = ExpectedException.none();
@ -58,7 +57,6 @@ public class BungeeSystemTest {
}
@Test
@Ignore("First test causes config settings to be wrong")
public void bungeeDoesNotEnableWithDefaultIP() throws Exception {
thrown.expect(EnableException.class);
thrown.expectMessage("IP setting still 0.0.0.0 - Configure AlternativeIP/IP that connects to the Proxy server.");
@ -79,10 +77,9 @@ public class BungeeSystemTest {
}
@Test
@Ignore("MySQL Driver unavailable for some reason.")
public void testEnableNoMySQL() throws EnableException {
thrown.expect(EnableException.class);
thrown.expectMessage("Database failed to initialize");
thrown.expectMessage("Failed to initialize pool: Communications link failure");
PlanSystem bungeeSystem = component.getPlanSystem();
try {

View File

@ -32,6 +32,7 @@ import com.djrapitops.plugin.logging.error.ErrorHandler;
import com.djrapitops.plugin.task.RunnableFactory;
import com.zaxxer.hikari.HikariConfig;
import com.zaxxer.hikari.HikariDataSource;
import com.zaxxer.hikari.pool.HikariPool;
import dagger.Lazy;
import javax.inject.Inject;
@ -108,7 +109,7 @@ public class MySQLDB extends SQLDB {
this.dataSource = new HikariDataSource(hikariConfig);
getConnection();
} catch (SQLException e) {
} catch (HikariPool.PoolInitializationException | SQLException e) {
throw new DBInitException("Failed to set-up HikariCP Datasource: " + e.getMessage(), e);
}
}

View File

@ -77,7 +77,7 @@ public class BungeeBukkitConnectionTest {
}
@Test
@Ignore("Causes next BungeeSystem test to fail")
@Ignore("InfoRequestFactory not available via getters")
public void testRequest() throws Exception {
enable();