mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2024-12-25 18:17:34 +01:00
Code householding
- Move console initialization for tests into TestHelper - Remove unused properties in legacy Settings - Add issue number to TODO comments where applicable
This commit is contained in:
parent
3bb7ff2b85
commit
ca0cbe6caf
@ -106,23 +106,25 @@ public class AuthMe extends JavaPlugin {
|
|||||||
private static Server server;
|
private static Server server;
|
||||||
/*
|
/*
|
||||||
* Maps and stuff
|
* Maps and stuff
|
||||||
* TODO: Clean up and Move into a manager
|
|
||||||
*/
|
*/
|
||||||
|
// TODO #601: Integrate CaptchaManager
|
||||||
public final ConcurrentHashMap<String, BukkitTask> sessions = new ConcurrentHashMap<>();
|
public final ConcurrentHashMap<String, BukkitTask> sessions = new ConcurrentHashMap<>();
|
||||||
public final ConcurrentHashMap<String, Integer> captcha = new ConcurrentHashMap<>();
|
public final ConcurrentHashMap<String, Integer> captcha = new ConcurrentHashMap<>();
|
||||||
public final ConcurrentHashMap<String, String> cap = new ConcurrentHashMap<>();
|
public final ConcurrentHashMap<String, String> cap = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Public Instances
|
* Public Instances
|
||||||
* TODO #432: Encapsulation
|
|
||||||
*/
|
*/
|
||||||
public NewAPI api;
|
public NewAPI api;
|
||||||
|
// TODO #655: Encapsulate mail
|
||||||
public SendMailSSL mail;
|
public SendMailSSL mail;
|
||||||
|
// TODO #656: Encapsulate data manager
|
||||||
public DataManager dataManager;
|
public DataManager dataManager;
|
||||||
/*
|
/*
|
||||||
* Plugin Hooks
|
* Private instances
|
||||||
* TODO: Move into modules
|
* TODO #432: Move instantiation and management of these services
|
||||||
*/
|
*/
|
||||||
|
// TODO #604: Encapsulate ProtocolLib members
|
||||||
public AuthMeInventoryPacketAdapter inventoryProtector;
|
public AuthMeInventoryPacketAdapter inventoryProtector;
|
||||||
public AuthMeTabCompletePacketAdapter tabComplete;
|
public AuthMeTabCompletePacketAdapter tabComplete;
|
||||||
public AuthMeTablistPacketAdapter tablistHider;
|
public AuthMeTablistPacketAdapter tablistHider;
|
||||||
|
@ -122,69 +122,85 @@ public interface DataSource {
|
|||||||
void close();
|
void close();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method purgeBanned.
|
* Purge all given players, i.e. delete all players whose name is in the list.
|
||||||
*
|
*
|
||||||
* @param banned List of String
|
* @param banned the list of players to delete
|
||||||
*/
|
*/
|
||||||
void purgeBanned(List<String> banned);
|
void purgeBanned(List<String> banned);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method getType.
|
* Return the data source type.
|
||||||
*
|
*
|
||||||
* @return DataSourceType
|
* @return the data source type
|
||||||
*/
|
*/
|
||||||
DataSourceType getType();
|
DataSourceType getType();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method isLogged.
|
* Query the datasource whether the player is logged in or not.
|
||||||
*
|
*
|
||||||
* @param user String
|
* @param user The name of the player to verify
|
||||||
*
|
* @return True if logged in, false otherwise
|
||||||
* @return boolean
|
|
||||||
*/
|
*/
|
||||||
boolean isLogged(String user);
|
boolean isLogged(String user);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method setLogged.
|
* Set a player as logged in.
|
||||||
*
|
*
|
||||||
* @param user String
|
* @param user The name of the player to change
|
||||||
*/
|
*/
|
||||||
void setLogged(String user);
|
void setLogged(String user);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method setUnlogged.
|
* Set a player as unlogged (not logged in).
|
||||||
*
|
*
|
||||||
* @param user String
|
* @param user The name of the player to change
|
||||||
*/
|
*/
|
||||||
void setUnlogged(String user);
|
void setUnlogged(String user);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set all players who are marked as logged in as NOT logged in.
|
||||||
|
*/
|
||||||
void purgeLogged();
|
void purgeLogged();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method getAccountsRegistered.
|
* Return all players which are logged in.
|
||||||
*
|
*
|
||||||
* @return int
|
* @return All logged in players
|
||||||
|
*/
|
||||||
|
List<PlayerAuth> getLoggedPlayers();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the number of registered accounts.
|
||||||
|
*
|
||||||
|
* @return Total number of accounts
|
||||||
*/
|
*/
|
||||||
int getAccountsRegistered();
|
int getAccountsRegistered();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update a player's real name (capitalization).
|
||||||
|
*
|
||||||
|
* @param user The name of the user (lowercase)
|
||||||
|
* @param realName The real name of the user (proper casing)
|
||||||
|
* @return True upon success, false upon failure
|
||||||
|
*/
|
||||||
boolean updateRealName(String user, String realName);
|
boolean updateRealName(String user, String realName);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update a player's IP address.
|
||||||
|
*
|
||||||
|
* @param user The name of the user (lowercase)
|
||||||
|
* @param ip The IP address to save
|
||||||
|
* @return True upon success, false upon failure
|
||||||
|
*/
|
||||||
boolean updateIp(String user, String ip);
|
boolean updateIp(String user, String ip);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method getAllAuths.
|
* Return all players of the database.
|
||||||
*
|
*
|
||||||
* @return List of PlayerAuth
|
* @return List of all players
|
||||||
*/
|
*/
|
||||||
List<PlayerAuth> getAllAuths();
|
List<PlayerAuth> getAllAuths();
|
||||||
|
|
||||||
/**
|
|
||||||
* Method getLoggedPlayers.
|
|
||||||
*
|
|
||||||
* @return List of PlayerAuth
|
|
||||||
*/
|
|
||||||
List<PlayerAuth> getLoggedPlayers();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reload the data source.
|
* Reload the data source.
|
||||||
*/
|
*/
|
||||||
|
@ -33,7 +33,7 @@ public class AuthMeEntityListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO #360: npc status can be used to bypass security!!!
|
// Note #360: npc status can be used to bypass security!!!
|
||||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
|
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
|
||||||
public void onEntityDamage(EntityDamageEvent event) {
|
public void onEntityDamage(EntityDamageEvent event) {
|
||||||
if (shouldCancelEvent(event)) {
|
if (shouldCancelEvent(event)) {
|
||||||
|
@ -24,7 +24,6 @@ import java.util.regex.Pattern;
|
|||||||
public final class Settings {
|
public final class Settings {
|
||||||
|
|
||||||
public static final File PLUGIN_FOLDER = Wrapper.getInstance().getDataFolder();
|
public static final File PLUGIN_FOLDER = Wrapper.getInstance().getDataFolder();
|
||||||
public static final File MODULE_FOLDER = new File(PLUGIN_FOLDER, "modules");
|
|
||||||
public static final File CACHE_FOLDER = new File(PLUGIN_FOLDER, "cache");
|
public static final File CACHE_FOLDER = new File(PLUGIN_FOLDER, "cache");
|
||||||
public static List<String> allowCommands;
|
public static List<String> allowCommands;
|
||||||
public static List<String> getJoinPermissions;
|
public static List<String> getJoinPermissions;
|
||||||
@ -62,7 +61,7 @@ public final class Settings {
|
|||||||
spawnPriority, crazyloginFileName, sendPlayerTo;
|
spawnPriority, crazyloginFileName, sendPlayerTo;
|
||||||
public static int getWarnMessageInterval, getSessionTimeout,
|
public static int getWarnMessageInterval, getSessionTimeout,
|
||||||
getRegistrationTimeout, getMaxNickLength, getMinNickLength,
|
getRegistrationTimeout, getMaxNickLength, getMinNickLength,
|
||||||
getPasswordMinLen, getMovementRadius, getNonActivatedGroup, passwordMaxLength,
|
getMovementRadius, getNonActivatedGroup,
|
||||||
maxLoginTry, captchaLength, saltLength,
|
maxLoginTry, captchaLength, saltLength,
|
||||||
bCryptLog2Rounds, getMaxLoginPerIp, getMaxJoinPerIp;
|
bCryptLog2Rounds, getMaxLoginPerIp, getMaxJoinPerIp;
|
||||||
protected static FileConfiguration configFile;
|
protected static FileConfiguration configFile;
|
||||||
@ -88,7 +87,6 @@ public final class Settings {
|
|||||||
isChatAllowed = load(RestrictionSettings.ALLOW_CHAT);
|
isChatAllowed = load(RestrictionSettings.ALLOW_CHAT);
|
||||||
getMaxNickLength = configFile.getInt("settings.restrictions.maxNicknameLength", 20);
|
getMaxNickLength = configFile.getInt("settings.restrictions.maxNicknameLength", 20);
|
||||||
getMinNickLength = configFile.getInt("settings.restrictions.minNicknameLength", 3);
|
getMinNickLength = configFile.getInt("settings.restrictions.minNicknameLength", 3);
|
||||||
getPasswordMinLen = configFile.getInt("settings.security.minPasswordLength", 4);
|
|
||||||
getNickRegex = configFile.getString("settings.restrictions.allowedNicknameCharacters", "[a-zA-Z0-9_?]*");
|
getNickRegex = configFile.getString("settings.restrictions.allowedNicknameCharacters", "[a-zA-Z0-9_?]*");
|
||||||
nickPattern = Pattern.compile(getNickRegex);
|
nickPattern = Pattern.compile(getNickRegex);
|
||||||
isAllowRestrictedIp = load(RestrictionSettings.ENABLE_RESTRICTED_USERS);
|
isAllowRestrictedIp = load(RestrictionSettings.ENABLE_RESTRICTED_USERS);
|
||||||
@ -120,7 +118,6 @@ public final class Settings {
|
|||||||
denyTabcompleteBeforeLogin = load(RestrictionSettings.DENY_TABCOMPLETE_BEFORE_LOGIN);
|
denyTabcompleteBeforeLogin = load(RestrictionSettings.DENY_TABCOMPLETE_BEFORE_LOGIN);
|
||||||
hideTablistBeforeLogin = load(RestrictionSettings.HIDE_TABLIST_BEFORE_LOGIN);
|
hideTablistBeforeLogin = load(RestrictionSettings.HIDE_TABLIST_BEFORE_LOGIN);
|
||||||
|
|
||||||
passwordMaxLength = load(SecuritySettings.MAX_PASSWORD_LENGTH);
|
|
||||||
backupWindowsPath = configFile.getString("BackupSystem.MysqlWindowsPath", "C:\\Program Files\\MySQL\\MySQL Server 5.1\\");
|
backupWindowsPath = configFile.getString("BackupSystem.MysqlWindowsPath", "C:\\Program Files\\MySQL\\MySQL Server 5.1\\");
|
||||||
isStopEnabled = configFile.getBoolean("Security.SQLProblem.stopServer", true);
|
isStopEnabled = configFile.getBoolean("Security.SQLProblem.stopServer", true);
|
||||||
reloadSupport = configFile.getBoolean("Security.ReloadCommand.useReloadCommandSupport", true);
|
reloadSupport = configFile.getBoolean("Security.ReloadCommand.useReloadCommandSupport", true);
|
||||||
|
@ -1,20 +0,0 @@
|
|||||||
package fr.xephi.authme;
|
|
||||||
|
|
||||||
import org.mockito.Mockito;
|
|
||||||
|
|
||||||
import java.util.logging.Logger;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Test initializer for {@link ConsoleLogger}.
|
|
||||||
*/
|
|
||||||
public class ConsoleLoggerTestInitializer {
|
|
||||||
|
|
||||||
private ConsoleLoggerTestInitializer() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Logger setupLogger() {
|
|
||||||
Logger logger = Mockito.mock(Logger.class);
|
|
||||||
ConsoleLogger.setLogger(logger);
|
|
||||||
return logger;
|
|
||||||
}
|
|
||||||
}
|
|
@ -3,11 +3,13 @@ package fr.xephi.authme;
|
|||||||
import fr.xephi.authme.command.CommandService;
|
import fr.xephi.authme.command.CommandService;
|
||||||
import fr.xephi.authme.util.BukkitService;
|
import fr.xephi.authme.util.BukkitService;
|
||||||
import org.mockito.ArgumentCaptor;
|
import org.mockito.ArgumentCaptor;
|
||||||
|
import org.mockito.Mockito;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import static org.mockito.Matchers.anyLong;
|
import static org.mockito.Matchers.anyLong;
|
||||||
import static org.mockito.Mockito.verify;
|
import static org.mockito.Mockito.verify;
|
||||||
@ -68,20 +70,6 @@ public final class TestHelper {
|
|||||||
runnable.run();
|
runnable.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Execute a {@link Runnable} passed to a mock's {@link BukkitService#scheduleSyncDelayedTask(Runnable)} method.
|
|
||||||
* Note that calling this method expects that there be a runnable sent to the method and will fail
|
|
||||||
* otherwise.
|
|
||||||
*
|
|
||||||
* @param service The mock service
|
|
||||||
*/
|
|
||||||
public static void runSyncDelayedTask(BukkitService service) {
|
|
||||||
ArgumentCaptor<Runnable> captor = ArgumentCaptor.forClass(Runnable.class);
|
|
||||||
verify(service).scheduleSyncDelayedTask(captor.capture());
|
|
||||||
Runnable runnable = captor.getValue();
|
|
||||||
runnable.run();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Execute a {@link Runnable} passed to a mock's {@link BukkitService#scheduleSyncDelayedTask(Runnable, long)}
|
* Execute a {@link Runnable} passed to a mock's {@link BukkitService#scheduleSyncDelayedTask(Runnable, long)}
|
||||||
* method. Note that calling this method expects that there be a runnable sent to the method and will fail
|
* method. Note that calling this method expects that there be a runnable sent to the method and will fail
|
||||||
@ -96,4 +84,9 @@ public final class TestHelper {
|
|||||||
runnable.run();
|
runnable.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Logger setupLogger() {
|
||||||
|
Logger logger = Mockito.mock(Logger.class);
|
||||||
|
ConsoleLogger.setLogger(logger);
|
||||||
|
return logger;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package fr.xephi.authme.command.executable.authme;
|
package fr.xephi.authme.command.executable.authme;
|
||||||
|
|
||||||
import fr.xephi.authme.ConsoleLoggerTestInitializer;
|
import fr.xephi.authme.TestHelper;
|
||||||
import fr.xephi.authme.cache.auth.PlayerAuth;
|
import fr.xephi.authme.cache.auth.PlayerAuth;
|
||||||
import fr.xephi.authme.cache.auth.PlayerCache;
|
import fr.xephi.authme.cache.auth.PlayerCache;
|
||||||
import fr.xephi.authme.command.CommandService;
|
import fr.xephi.authme.command.CommandService;
|
||||||
@ -36,7 +36,7 @@ public class ChangePasswordAdminCommandTest {
|
|||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void setUpLogger() {
|
public static void setUpLogger() {
|
||||||
ConsoleLoggerTestInitializer.setupLogger();
|
TestHelper.setupLogger();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package fr.xephi.authme.command.executable.authme;
|
package fr.xephi.authme.command.executable.authme;
|
||||||
|
|
||||||
import fr.xephi.authme.ConsoleLoggerTestInitializer;
|
|
||||||
import fr.xephi.authme.TestHelper;
|
import fr.xephi.authme.TestHelper;
|
||||||
import fr.xephi.authme.cache.auth.PlayerAuth;
|
import fr.xephi.authme.cache.auth.PlayerAuth;
|
||||||
import fr.xephi.authme.command.CommandService;
|
import fr.xephi.authme.command.CommandService;
|
||||||
@ -43,7 +42,7 @@ public class RegisterAdminCommandTest {
|
|||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void setUpLogger() {
|
public static void setUpLogger() {
|
||||||
ConsoleLoggerTestInitializer.setupLogger();
|
TestHelper.setupLogger();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package fr.xephi.authme.command.executable.authme;
|
package fr.xephi.authme.command.executable.authme;
|
||||||
|
|
||||||
import fr.xephi.authme.AuthMe;
|
import fr.xephi.authme.AuthMe;
|
||||||
import fr.xephi.authme.ConsoleLoggerTestInitializer;
|
import fr.xephi.authme.TestHelper;
|
||||||
import fr.xephi.authme.command.CommandService;
|
import fr.xephi.authme.command.CommandService;
|
||||||
import fr.xephi.authme.command.ExecutableCommand;
|
import fr.xephi.authme.command.ExecutableCommand;
|
||||||
import fr.xephi.authme.output.MessageKey;
|
import fr.xephi.authme.output.MessageKey;
|
||||||
@ -24,7 +24,7 @@ public class ReloadCommandTest {
|
|||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void setUpLogger() {
|
public static void setUpLogger() {
|
||||||
ConsoleLoggerTestInitializer.setupLogger();
|
TestHelper.setupLogger();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package fr.xephi.authme.converter;
|
package fr.xephi.authme.converter;
|
||||||
|
|
||||||
import com.google.common.io.Files;
|
import com.google.common.io.Files;
|
||||||
import fr.xephi.authme.ConsoleLoggerTestInitializer;
|
|
||||||
import fr.xephi.authme.TestHelper;
|
import fr.xephi.authme.TestHelper;
|
||||||
import fr.xephi.authme.cache.auth.PlayerAuth;
|
import fr.xephi.authme.cache.auth.PlayerAuth;
|
||||||
import fr.xephi.authme.datasource.DataSource;
|
import fr.xephi.authme.datasource.DataSource;
|
||||||
@ -37,7 +36,7 @@ public class ForceFlatToSqliteTest {
|
|||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void setup() {
|
public static void setup() {
|
||||||
ConsoleLoggerTestInitializer.setupLogger();
|
TestHelper.setupLogger();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
|
@ -4,7 +4,7 @@ import com.google.common.base.Objects;
|
|||||||
import com.google.common.base.Preconditions;
|
import com.google.common.base.Preconditions;
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
import fr.xephi.authme.ConsoleLoggerTestInitializer;
|
import fr.xephi.authme.TestHelper;
|
||||||
import fr.xephi.authme.cache.auth.PlayerAuth;
|
import fr.xephi.authme.cache.auth.PlayerAuth;
|
||||||
import fr.xephi.authme.security.HashAlgorithm;
|
import fr.xephi.authme.security.HashAlgorithm;
|
||||||
import fr.xephi.authme.security.crypts.HashedPassword;
|
import fr.xephi.authme.security.crypts.HashedPassword;
|
||||||
@ -107,7 +107,7 @@ public abstract class AbstractResourceClosingTest {
|
|||||||
return ((Property) invocation.getArguments()[0]).getDefaultValue();
|
return ((Property) invocation.getArguments()[0]).getDefaultValue();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
ConsoleLoggerTestInitializer.setupLogger();
|
TestHelper.setupLogger();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Initialize the dataSource implementation to test based on a mock connection. */
|
/** Initialize the dataSource implementation to test based on a mock connection. */
|
||||||
|
@ -2,7 +2,6 @@ package fr.xephi.authme.datasource;
|
|||||||
|
|
||||||
import com.zaxxer.hikari.HikariConfig;
|
import com.zaxxer.hikari.HikariConfig;
|
||||||
import com.zaxxer.hikari.HikariDataSource;
|
import com.zaxxer.hikari.HikariDataSource;
|
||||||
import fr.xephi.authme.ConsoleLoggerTestInitializer;
|
|
||||||
import fr.xephi.authme.TestHelper;
|
import fr.xephi.authme.TestHelper;
|
||||||
import fr.xephi.authme.settings.NewSetting;
|
import fr.xephi.authme.settings.NewSetting;
|
||||||
import fr.xephi.authme.settings.domain.Property;
|
import fr.xephi.authme.settings.domain.Property;
|
||||||
@ -53,7 +52,7 @@ public class MySqlIntegrationTest extends AbstractDataSourceIntegrationTest {
|
|||||||
});
|
});
|
||||||
set(DatabaseSettings.MYSQL_DATABASE, "h2_test");
|
set(DatabaseSettings.MYSQL_DATABASE, "h2_test");
|
||||||
set(DatabaseSettings.MYSQL_TABLE, "authme");
|
set(DatabaseSettings.MYSQL_TABLE, "authme");
|
||||||
ConsoleLoggerTestInitializer.setupLogger();
|
TestHelper.setupLogger();
|
||||||
|
|
||||||
Path sqlInitFile = TestHelper.getJarPath("/datasource-integration/sql-initialize.sql");
|
Path sqlInitFile = TestHelper.getJarPath("/datasource-integration/sql-initialize.sql");
|
||||||
sqlInitialize = new String(Files.readAllBytes(sqlInitFile));
|
sqlInitialize = new String(Files.readAllBytes(sqlInitFile));
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package fr.xephi.authme.datasource;
|
package fr.xephi.authme.datasource;
|
||||||
|
|
||||||
import fr.xephi.authme.ConsoleLoggerTestInitializer;
|
|
||||||
import fr.xephi.authme.TestHelper;
|
import fr.xephi.authme.TestHelper;
|
||||||
import fr.xephi.authme.settings.NewSetting;
|
import fr.xephi.authme.settings.NewSetting;
|
||||||
import fr.xephi.authme.settings.domain.Property;
|
import fr.xephi.authme.settings.domain.Property;
|
||||||
@ -52,8 +51,7 @@ public class SQLiteIntegrationTest extends AbstractDataSourceIntegrationTest {
|
|||||||
});
|
});
|
||||||
set(DatabaseSettings.MYSQL_DATABASE, "sqlite-test");
|
set(DatabaseSettings.MYSQL_DATABASE, "sqlite-test");
|
||||||
set(DatabaseSettings.MYSQL_TABLE, "authme");
|
set(DatabaseSettings.MYSQL_TABLE, "authme");
|
||||||
set(DatabaseSettings.MYSQL_COL_SALT, "salt");
|
TestHelper.setupLogger();
|
||||||
ConsoleLoggerTestInitializer.setupLogger();
|
|
||||||
|
|
||||||
Path sqlInitFile = TestHelper.getJarPath("/datasource-integration/sql-initialize.sql");
|
Path sqlInitFile = TestHelper.getJarPath("/datasource-integration/sql-initialize.sql");
|
||||||
// Note ljacqu 20160221: It appears that we can only run one statement per Statement.execute() so we split
|
// Note ljacqu 20160221: It appears that we can only run one statement per Statement.execute() so we split
|
||||||
|
@ -2,8 +2,8 @@ package fr.xephi.authme.hooks;
|
|||||||
|
|
||||||
import com.earth2me.essentials.Essentials;
|
import com.earth2me.essentials.Essentials;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.User;
|
||||||
import fr.xephi.authme.ConsoleLoggerTestInitializer;
|
|
||||||
import fr.xephi.authme.ReflectionTestUtils;
|
import fr.xephi.authme.ReflectionTestUtils;
|
||||||
|
import fr.xephi.authme.TestHelper;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
import org.bukkit.plugin.PluginManager;
|
import org.bukkit.plugin.PluginManager;
|
||||||
@ -29,7 +29,7 @@ public class PluginHooksTest {
|
|||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void setLogger() {
|
public static void setLogger() {
|
||||||
ConsoleLoggerTestInitializer.setupLogger();
|
TestHelper.setupLogger();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package fr.xephi.authme.output;
|
package fr.xephi.authme.output;
|
||||||
|
|
||||||
import fr.xephi.authme.ConsoleLogger;
|
import fr.xephi.authme.ConsoleLogger;
|
||||||
import fr.xephi.authme.ConsoleLoggerTestInitializer;
|
|
||||||
import fr.xephi.authme.TestHelper;
|
import fr.xephi.authme.TestHelper;
|
||||||
import fr.xephi.authme.util.WrapperMock;
|
import fr.xephi.authme.util.WrapperMock;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
@ -36,7 +35,7 @@ public class MessagesIntegrationTest {
|
|||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void setup() {
|
public static void setup() {
|
||||||
WrapperMock.createInstance();
|
WrapperMock.createInstance();
|
||||||
ConsoleLoggerTestInitializer.setupLogger();
|
TestHelper.setupLogger();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package fr.xephi.authme.process.email;
|
package fr.xephi.authme.process.email;
|
||||||
|
|
||||||
import fr.xephi.authme.ConsoleLoggerTestInitializer;
|
import fr.xephi.authme.TestHelper;
|
||||||
import fr.xephi.authme.cache.auth.PlayerAuth;
|
import fr.xephi.authme.cache.auth.PlayerAuth;
|
||||||
import fr.xephi.authme.cache.auth.PlayerCache;
|
import fr.xephi.authme.cache.auth.PlayerCache;
|
||||||
import fr.xephi.authme.datasource.DataSource;
|
import fr.xephi.authme.datasource.DataSource;
|
||||||
@ -37,7 +37,7 @@ public class AsyncAddEmailTest {
|
|||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void setUp() {
|
public static void setUp() {
|
||||||
ConsoleLoggerTestInitializer.setupLogger();
|
TestHelper.setupLogger();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package fr.xephi.authme.security.crypts;
|
package fr.xephi.authme.security.crypts;
|
||||||
|
|
||||||
import fr.xephi.authme.ConsoleLoggerTestInitializer;
|
import fr.xephi.authme.TestHelper;
|
||||||
import fr.xephi.authme.settings.Settings;
|
import fr.xephi.authme.settings.Settings;
|
||||||
import fr.xephi.authme.util.WrapperMock;
|
import fr.xephi.authme.util.WrapperMock;
|
||||||
import org.junit.BeforeClass;
|
import org.junit.BeforeClass;
|
||||||
@ -14,7 +14,7 @@ public class BcryptTest extends AbstractEncryptionMethodTest {
|
|||||||
public static void setUpSettings() {
|
public static void setUpSettings() {
|
||||||
WrapperMock.createInstance();
|
WrapperMock.createInstance();
|
||||||
Settings.bCryptLog2Rounds = 8;
|
Settings.bCryptLog2Rounds = 8;
|
||||||
ConsoleLoggerTestInitializer.setupLogger();
|
TestHelper.setupLogger();
|
||||||
}
|
}
|
||||||
|
|
||||||
public BcryptTest() {
|
public BcryptTest() {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package fr.xephi.authme.security.crypts;
|
package fr.xephi.authme.security.crypts;
|
||||||
|
|
||||||
import fr.xephi.authme.ConsoleLoggerTestInitializer;
|
import fr.xephi.authme.TestHelper;
|
||||||
import org.junit.BeforeClass;
|
import org.junit.BeforeClass;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -10,7 +10,7 @@ public class CryptPBKDF2DjangoTest extends AbstractEncryptionMethodTest {
|
|||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void setupLogger() {
|
public static void setupLogger() {
|
||||||
ConsoleLoggerTestInitializer.setupLogger();
|
TestHelper.setupLogger();
|
||||||
}
|
}
|
||||||
|
|
||||||
public CryptPBKDF2DjangoTest() {
|
public CryptPBKDF2DjangoTest() {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package fr.xephi.authme.security.crypts;
|
package fr.xephi.authme.security.crypts;
|
||||||
|
|
||||||
import fr.xephi.authme.ConsoleLoggerTestInitializer;
|
import fr.xephi.authme.TestHelper;
|
||||||
import fr.xephi.authme.util.WrapperMock;
|
import fr.xephi.authme.util.WrapperMock;
|
||||||
import org.junit.BeforeClass;
|
import org.junit.BeforeClass;
|
||||||
|
|
||||||
@ -12,7 +12,7 @@ public class IPB4Test extends AbstractEncryptionMethodTest {
|
|||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void setUpSettings() {
|
public static void setUpSettings() {
|
||||||
WrapperMock.createInstance();
|
WrapperMock.createInstance();
|
||||||
ConsoleLoggerTestInitializer.setupLogger();
|
TestHelper.setupLogger();
|
||||||
}
|
}
|
||||||
|
|
||||||
public IPB4Test() {
|
public IPB4Test() {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package fr.xephi.authme.security.crypts;
|
package fr.xephi.authme.security.crypts;
|
||||||
|
|
||||||
import fr.xephi.authme.ConsoleLoggerTestInitializer;
|
import fr.xephi.authme.TestHelper;
|
||||||
import fr.xephi.authme.util.WrapperMock;
|
import fr.xephi.authme.util.WrapperMock;
|
||||||
import org.junit.BeforeClass;
|
import org.junit.BeforeClass;
|
||||||
|
|
||||||
@ -12,7 +12,7 @@ public class XFBCRYPTTest extends AbstractEncryptionMethodTest {
|
|||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void setup() {
|
public static void setup() {
|
||||||
WrapperMock.createInstance();
|
WrapperMock.createInstance();
|
||||||
ConsoleLoggerTestInitializer.setupLogger();
|
TestHelper.setupLogger();
|
||||||
}
|
}
|
||||||
|
|
||||||
public XFBCRYPTTest() {
|
public XFBCRYPTTest() {
|
||||||
|
@ -2,7 +2,6 @@ package fr.xephi.authme.settings;
|
|||||||
|
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
import com.google.common.io.Files;
|
import com.google.common.io.Files;
|
||||||
import fr.xephi.authme.ConsoleLoggerTestInitializer;
|
|
||||||
import fr.xephi.authme.TestHelper;
|
import fr.xephi.authme.TestHelper;
|
||||||
import fr.xephi.authme.settings.domain.Property;
|
import fr.xephi.authme.settings.domain.Property;
|
||||||
import fr.xephi.authme.settings.properties.TestConfiguration;
|
import fr.xephi.authme.settings.properties.TestConfiguration;
|
||||||
@ -48,7 +47,7 @@ public class NewSettingIntegrationTest {
|
|||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void setUpLogger() {
|
public static void setUpLogger() {
|
||||||
ConsoleLoggerTestInitializer.setupLogger();
|
TestHelper.setupLogger();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package fr.xephi.authme.settings;
|
package fr.xephi.authme.settings;
|
||||||
|
|
||||||
import fr.xephi.authme.ConsoleLoggerTestInitializer;
|
import fr.xephi.authme.TestHelper;
|
||||||
import fr.xephi.authme.settings.domain.Property;
|
import fr.xephi.authme.settings.domain.Property;
|
||||||
import fr.xephi.authme.settings.properties.RegistrationSettings;
|
import fr.xephi.authme.settings.properties.RegistrationSettings;
|
||||||
import fr.xephi.authme.settings.properties.TestConfiguration;
|
import fr.xephi.authme.settings.properties.TestConfiguration;
|
||||||
@ -48,7 +48,7 @@ public class NewSettingTest {
|
|||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void setUpLogger() {
|
public static void setUpLogger() {
|
||||||
ConsoleLoggerTestInitializer.setupLogger();
|
TestHelper.setupLogger();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package fr.xephi.authme.util;
|
package fr.xephi.authme.util;
|
||||||
|
|
||||||
import fr.xephi.authme.AuthMe;
|
import fr.xephi.authme.AuthMe;
|
||||||
import fr.xephi.authme.ConsoleLoggerTestInitializer;
|
|
||||||
import fr.xephi.authme.ReflectionTestUtils;
|
import fr.xephi.authme.ReflectionTestUtils;
|
||||||
|
import fr.xephi.authme.TestHelper;
|
||||||
import fr.xephi.authme.settings.Settings;
|
import fr.xephi.authme.settings.Settings;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
@ -37,7 +37,7 @@ public class UtilsTest {
|
|||||||
public static void setUpMocks() {
|
public static void setUpMocks() {
|
||||||
WrapperMock wrapperMock = WrapperMock.createInstance();
|
WrapperMock wrapperMock = WrapperMock.createInstance();
|
||||||
authMeMock = wrapperMock.getAuthMe();
|
authMeMock = wrapperMock.getAuthMe();
|
||||||
ConsoleLoggerTestInitializer.setupLogger();
|
TestHelper.setupLogger();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
|
Loading…
Reference in New Issue
Block a user