mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2025-01-25 00:51:29 +01:00
Disable regular Hikari log statements during test execution
- Also use mock logger instead of a real one in a few select tests to reduce the log output during tests
This commit is contained in:
parent
901b9adb8a
commit
51260fd22d
@ -9,9 +9,11 @@ import org.junit.runners.Parameterized;
|
||||
import java.lang.reflect.Method;
|
||||
import java.sql.Connection;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static org.mockito.Mockito.mock;
|
||||
|
||||
@ -21,7 +23,7 @@ import static org.mockito.Mockito.mock;
|
||||
public abstract class AbstractSqlDataSourceResourceClosingTest extends AbstractResourceClosingTest {
|
||||
|
||||
/** List of DataSource method names not to test. */
|
||||
private static final Set<String> IGNORED_METHODS = ImmutableSet.of("reload", "getType");
|
||||
private static final Set<String> IGNORED_METHODS = ImmutableSet.of("reload", "getType", "isCached");
|
||||
|
||||
private static Settings settings;
|
||||
|
||||
@ -64,12 +66,8 @@ public abstract class AbstractSqlDataSourceResourceClosingTest extends AbstractR
|
||||
|
||||
/* Get all methods of the DataSource interface, minus the ones in the ignored list. */
|
||||
private static List<Method> getDataSourceMethods() {
|
||||
List<Method> publicMethods = new ArrayList<>();
|
||||
for (Method method : DataSource.class.getDeclaredMethods()) {
|
||||
if (!IGNORED_METHODS.contains(method.getName()) && !method.isSynthetic()) {
|
||||
publicMethods.add(method);
|
||||
}
|
||||
}
|
||||
return publicMethods;
|
||||
return Arrays.stream(DataSource.class.getDeclaredMethods())
|
||||
.filter(method -> !IGNORED_METHODS.contains(method.getName()) && !method.isSynthetic())
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ public class SQLiteIntegrationTest extends AbstractDataSourceIntegrationTest {
|
||||
TestHelper.returnDefaultsForAllProperties(settings);
|
||||
set(DatabaseSettings.MYSQL_DATABASE, "sqlite-test");
|
||||
set(DatabaseSettings.MYSQL_TABLE, "authme");
|
||||
TestHelper.setRealLogger();
|
||||
TestHelper.setupLogger();
|
||||
|
||||
Path sqlInitFile = TestHelper.getJarPath(TestHelper.PROJECT_ROOT + "datasource/sql-initialize.sql");
|
||||
// Note ljacqu 20160221: It appears that we can only run one statement per Statement.execute() so we split
|
||||
|
@ -64,7 +64,7 @@ public class PermissionsManagerInitializationTest {
|
||||
|
||||
@BeforeClass
|
||||
public static void setUpLogger() {
|
||||
TestHelper.setRealLogger();
|
||||
TestHelper.setupLogger();
|
||||
}
|
||||
|
||||
@Before
|
||||
|
2
src/test/resources/simplelogger.properties
Normal file
2
src/test/resources/simplelogger.properties
Normal file
@ -0,0 +1,2 @@
|
||||
# Suppress INFO statements when a new Hikari pool is being created
|
||||
org.slf4j.simpleLogger.log.com.zaxxer.hikari=WARN
|
Loading…
Reference in New Issue
Block a user