mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2025-01-27 01:51:41 +01:00
#547 Create ProcessService
- Create ProcessService for common tasks within processes - Integrate service into AsyncAddEmail
This commit is contained in:
parent
28108f00f1
commit
d664e7be26
@ -42,6 +42,7 @@ import fr.xephi.authme.output.Messages;
|
||||
import fr.xephi.authme.permission.PermissionsManager;
|
||||
import fr.xephi.authme.permission.PlayerStatePermission;
|
||||
import fr.xephi.authme.process.Management;
|
||||
import fr.xephi.authme.process.ProcessService;
|
||||
import fr.xephi.authme.security.PasswordSecurity;
|
||||
import fr.xephi.authme.security.crypts.SHA256;
|
||||
import fr.xephi.authme.settings.NewSetting;
|
||||
@ -304,7 +305,8 @@ public class AuthMe extends JavaPlugin {
|
||||
setupApi();
|
||||
|
||||
// Set up the management
|
||||
management = new Management(this, newSettings);
|
||||
ProcessService processService = new ProcessService(newSettings, messages);
|
||||
management = new Management(this, processService, database, PlayerCache.getInstance());
|
||||
|
||||
// Set up the BungeeCord hook
|
||||
setupBungeeCordHook();
|
||||
|
@ -2,6 +2,7 @@ package fr.xephi.authme.process;
|
||||
|
||||
import fr.xephi.authme.AuthMe;
|
||||
import fr.xephi.authme.cache.auth.PlayerCache;
|
||||
import fr.xephi.authme.datasource.DataSource;
|
||||
import fr.xephi.authme.process.email.AsyncAddEmail;
|
||||
import fr.xephi.authme.process.email.AsyncChangeEmail;
|
||||
import fr.xephi.authme.process.join.AsynchronousJoin;
|
||||
@ -20,18 +21,25 @@ public class Management {
|
||||
|
||||
private final AuthMe plugin;
|
||||
private final BukkitScheduler sched;
|
||||
private final ProcessService processService;
|
||||
private final DataSource dataSource;
|
||||
private final PlayerCache playerCache;
|
||||
private final NewSetting settings;
|
||||
|
||||
/**
|
||||
* Constructor for Management.
|
||||
*
|
||||
* @param plugin AuthMe
|
||||
* @param settings The plugin settings
|
||||
*/
|
||||
public Management(AuthMe plugin, NewSetting settings) {
|
||||
public Management(AuthMe plugin, ProcessService processService, DataSource dataSource, PlayerCache playerCache) {
|
||||
this.plugin = plugin;
|
||||
this.sched = this.plugin.getServer().getScheduler();
|
||||
this.settings = settings;
|
||||
this.processService = processService;
|
||||
this.dataSource = dataSource;
|
||||
this.playerCache = playerCache;
|
||||
|
||||
// FIXME don't pass settings anymore -> go through the service in the processes
|
||||
this.settings = processService.getSettings();
|
||||
}
|
||||
|
||||
public void performLogin(final Player player, final String password, final boolean forceLogin) {
|
||||
@ -39,7 +47,7 @@ public class Management {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
new AsynchronousLogin(player, password, forceLogin, plugin, plugin.getDataSource(), settings)
|
||||
new AsynchronousLogin(player, password, forceLogin, plugin, dataSource, settings)
|
||||
.process();
|
||||
}
|
||||
});
|
||||
@ -60,7 +68,7 @@ public class Management {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
new AsyncRegister(player, password, email, plugin, plugin.getDataSource(), settings).process();
|
||||
new AsyncRegister(player, password, email, plugin, dataSource, settings).process();
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -80,7 +88,7 @@ public class Management {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
new AsynchronousJoin(player, plugin, plugin.getDataSource()).process();
|
||||
new AsynchronousJoin(player, plugin, dataSource).process();
|
||||
}
|
||||
|
||||
});
|
||||
@ -91,28 +99,26 @@ public class Management {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
new AsynchronousQuit(player, plugin, plugin.getDataSource(), isKick).process();
|
||||
new AsynchronousQuit(player, plugin, dataSource, isKick).process();
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
public void performAddEmail(final Player player, final String newEmail) {
|
||||
sched.runTaskAsynchronously(plugin, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
new AsyncAddEmail(player, plugin, newEmail, plugin.getDataSource(),
|
||||
PlayerCache.getInstance(), settings).process();
|
||||
}
|
||||
});
|
||||
runTask(new AsyncAddEmail(player, newEmail, dataSource, playerCache, processService));
|
||||
}
|
||||
|
||||
public void performChangeEmail(final Player player, final String oldEmail, final String newEmail) {
|
||||
sched.runTaskAsynchronously(plugin, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
new AsyncChangeEmail(player, plugin, oldEmail, newEmail, plugin.getDataSource(), PlayerCache.getInstance(), settings).process();
|
||||
new AsyncChangeEmail(player, plugin, oldEmail, newEmail, dataSource, playerCache, settings).process();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void runTask(Process process) {
|
||||
sched.runTaskAsynchronously(plugin, process);
|
||||
}
|
||||
}
|
||||
|
8
src/main/java/fr/xephi/authme/process/Process.java
Normal file
8
src/main/java/fr/xephi/authme/process/Process.java
Normal file
@ -0,0 +1,8 @@
|
||||
package fr.xephi.authme.process;
|
||||
|
||||
/**
|
||||
* Common interface for AuthMe processes.
|
||||
*/
|
||||
public interface Process extends Runnable {
|
||||
|
||||
}
|
34
src/main/java/fr/xephi/authme/process/ProcessService.java
Normal file
34
src/main/java/fr/xephi/authme/process/ProcessService.java
Normal file
@ -0,0 +1,34 @@
|
||||
package fr.xephi.authme.process;
|
||||
|
||||
import fr.xephi.authme.output.MessageKey;
|
||||
import fr.xephi.authme.output.Messages;
|
||||
import fr.xephi.authme.settings.NewSetting;
|
||||
import fr.xephi.authme.settings.domain.Property;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
/**
|
||||
* Service for asynchronous and synchronous processes.
|
||||
*/
|
||||
public class ProcessService {
|
||||
|
||||
private final NewSetting settings;
|
||||
private final Messages messages;
|
||||
|
||||
public ProcessService(NewSetting settings, Messages messages) {
|
||||
this.settings = settings;
|
||||
this.messages = messages;
|
||||
}
|
||||
|
||||
public <T> T getProperty(Property<T> property) {
|
||||
return settings.getProperty(property);
|
||||
}
|
||||
|
||||
public NewSetting getSettings() {
|
||||
return settings;
|
||||
}
|
||||
|
||||
public void send(CommandSender sender, MessageKey key) {
|
||||
messages.send(sender, key);
|
||||
}
|
||||
|
||||
}
|
@ -1,40 +1,38 @@
|
||||
package fr.xephi.authme.process.email;
|
||||
|
||||
import fr.xephi.authme.AuthMe;
|
||||
import fr.xephi.authme.ConsoleLogger;
|
||||
import fr.xephi.authme.cache.auth.PlayerAuth;
|
||||
import fr.xephi.authme.cache.auth.PlayerCache;
|
||||
import fr.xephi.authme.datasource.DataSource;
|
||||
import fr.xephi.authme.output.MessageKey;
|
||||
import fr.xephi.authme.output.Messages;
|
||||
import fr.xephi.authme.settings.NewSetting;
|
||||
import fr.xephi.authme.settings.Settings;
|
||||
import fr.xephi.authme.process.Process;
|
||||
import fr.xephi.authme.process.ProcessService;
|
||||
import fr.xephi.authme.settings.properties.RegistrationSettings;
|
||||
import fr.xephi.authme.util.Utils;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
/**
|
||||
* Async task to add an email to an account.
|
||||
*/
|
||||
public class AsyncAddEmail {
|
||||
public class AsyncAddEmail implements Process {
|
||||
|
||||
private final Player player;
|
||||
private final String email;
|
||||
private final Messages messages;
|
||||
private final ProcessService service;
|
||||
private final DataSource dataSource;
|
||||
private final PlayerCache playerCache;
|
||||
private final NewSetting settings;
|
||||
|
||||
public AsyncAddEmail(Player player, AuthMe plugin, String email, DataSource dataSource,
|
||||
PlayerCache playerCache, NewSetting settings) {
|
||||
this.messages = plugin.getMessages();
|
||||
public AsyncAddEmail(Player player, String email, DataSource dataSource, PlayerCache playerCache,
|
||||
ProcessService service) {
|
||||
this.player = player;
|
||||
this.email = email;
|
||||
this.dataSource = dataSource;
|
||||
this.playerCache = playerCache;
|
||||
this.settings = settings;
|
||||
this.service = service;
|
||||
}
|
||||
|
||||
public void process() {
|
||||
@Override
|
||||
public void run() {
|
||||
String playerName = player.getName().toLowerCase();
|
||||
|
||||
if (playerCache.isAuthenticated(playerName)) {
|
||||
@ -42,19 +40,19 @@ public class AsyncAddEmail {
|
||||
final String currentEmail = auth.getEmail();
|
||||
|
||||
if (currentEmail != null && !"your@email.com".equals(currentEmail)) {
|
||||
messages.send(player, MessageKey.USAGE_CHANGE_EMAIL);
|
||||
} else if (!Utils.isEmailCorrect(email, settings)) {
|
||||
messages.send(player, MessageKey.INVALID_EMAIL);
|
||||
service.send(player, MessageKey.USAGE_CHANGE_EMAIL);
|
||||
} else if (!Utils.isEmailCorrect(email, service.getSettings())) {
|
||||
service.send(player, MessageKey.INVALID_EMAIL);
|
||||
} else if (dataSource.isEmailStored(email)) {
|
||||
messages.send(player, MessageKey.EMAIL_ALREADY_USED_ERROR);
|
||||
service.send(player, MessageKey.EMAIL_ALREADY_USED_ERROR);
|
||||
} else {
|
||||
auth.setEmail(email);
|
||||
if (dataSource.updateEmail(auth)) {
|
||||
playerCache.updatePlayer(auth);
|
||||
messages.send(player, MessageKey.EMAIL_ADDED_SUCCESS);
|
||||
service.send(player, MessageKey.EMAIL_ADDED_SUCCESS);
|
||||
} else {
|
||||
ConsoleLogger.showError("Could not save email for player '" + player + "'");
|
||||
messages.send(player, MessageKey.ERROR);
|
||||
service.send(player, MessageKey.ERROR);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -64,11 +62,11 @@ public class AsyncAddEmail {
|
||||
|
||||
private void sendUnloggedMessage(DataSource dataSource) {
|
||||
if (dataSource.isAuthAvailable(player.getName())) {
|
||||
messages.send(player, MessageKey.LOGIN_MESSAGE);
|
||||
} else if (Settings.emailRegistration) {
|
||||
messages.send(player, MessageKey.REGISTER_EMAIL_MESSAGE);
|
||||
service.send(player, MessageKey.LOGIN_MESSAGE);
|
||||
} else if (service.getProperty(RegistrationSettings.USE_EMAIL_REGISTRATION)) {
|
||||
service.send(player, MessageKey.REGISTER_EMAIL_MESSAGE);
|
||||
} else {
|
||||
messages.send(player, MessageKey.REGISTER_MESSAGE);
|
||||
service.send(player, MessageKey.REGISTER_MESSAGE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -60,7 +60,7 @@ public final class Settings {
|
||||
useCaptcha, emailRegistration, multiverse, bungee,
|
||||
banUnsafeIp, doubleEmailCheck, sessionExpireOnIpChange,
|
||||
disableSocialSpy, useEssentialsMotd, usePurge,
|
||||
purgePlayerDat, purgeEssentialsFile, supportOldPassword,
|
||||
purgePlayerDat, purgeEssentialsFile,
|
||||
purgeLimitedCreative, purgeAntiXray, purgePermissions,
|
||||
enableProtection, enableAntiBot, recallEmail, useWelcomeMessage,
|
||||
broadcastWelcomeMessage, forceRegKick, forceRegLogin,
|
||||
@ -72,19 +72,16 @@ public final class Settings {
|
||||
getMySQLColumnGroup, unRegisteredGroup,
|
||||
backupWindowsPath, getRegisteredGroup,
|
||||
rakamakUsers, rakamakUsersIp, getmailAccount, defaultWorld,
|
||||
getPhpbbPrefix, getWordPressPrefix,
|
||||
spawnPriority, crazyloginFileName, getPassRegex, sendPlayerTo;
|
||||
public static int getWarnMessageInterval, getSessionTimeout,
|
||||
getRegistrationTimeout, getMaxNickLength, getMinNickLength,
|
||||
getPasswordMinLen, getMovementRadius, getmaxRegPerIp,
|
||||
getNonActivatedGroup, passwordMaxLength, getRecoveryPassLength,
|
||||
getMailPort, maxLoginTry, captchaLength, saltLength,
|
||||
getmaxRegPerEmail, bCryptLog2Rounds, getPhpbbGroup,
|
||||
getmaxRegPerEmail, bCryptLog2Rounds,
|
||||
antiBotSensibility, antiBotDuration, delayRecall, getMaxLoginPerIp,
|
||||
getMaxJoinPerIp;
|
||||
protected static FileConfiguration configFile;
|
||||
private static AuthMe plugin;
|
||||
private static Settings instance;
|
||||
|
||||
/**
|
||||
* Constructor for Settings.
|
||||
@ -92,13 +89,11 @@ public final class Settings {
|
||||
* @param pl AuthMe
|
||||
*/
|
||||
public Settings(AuthMe pl) {
|
||||
instance = this;
|
||||
plugin = pl;
|
||||
configFile = plugin.getConfig();
|
||||
configFile = pl.getConfig();
|
||||
loadVariables();
|
||||
}
|
||||
|
||||
public static void loadVariables() {
|
||||
private static void loadVariables() {
|
||||
isPermissionCheckEnabled = load(PluginSettings.ENABLE_PERMISSION_CHECK);
|
||||
isForcedRegistrationEnabled = configFile.getBoolean("settings.registration.force", true);
|
||||
isRegistrationEnabled = configFile.getBoolean("settings.registration.enabled", true);
|
||||
@ -172,7 +167,7 @@ public final class Settings {
|
||||
useCaptcha = configFile.getBoolean("Security.captcha.useCaptcha", false);
|
||||
maxLoginTry = configFile.getInt("Security.captcha.maxLoginTry", 5);
|
||||
captchaLength = configFile.getInt("Security.captcha.captchaLength", 5);
|
||||
emailRegistration = configFile.getBoolean("settings.registration.enableEmailRegistrationSystem", false);
|
||||
emailRegistration = load(RegistrationSettings.USE_EMAIL_REGISTRATION);
|
||||
saltLength = configFile.getInt("settings.security.doubleMD5SaltLength", 8);
|
||||
getmaxRegPerEmail = configFile.getInt("Email.maxRegPerEmail", 1);
|
||||
multiverse = load(HooksSettings.MULTIVERSE);
|
||||
@ -190,10 +185,6 @@ public final class Settings {
|
||||
purgePlayerDat = configFile.getBoolean("Purge.removePlayerDat", false);
|
||||
purgeEssentialsFile = configFile.getBoolean("Purge.removeEssentialsFile", false);
|
||||
defaultWorld = configFile.getString("Purge.defaultWorld", "world");
|
||||
getPhpbbPrefix = configFile.getString("ExternalBoardOptions.phpbbTablePrefix", "phpbb_");
|
||||
getPhpbbGroup = configFile.getInt("ExternalBoardOptions.phpbbActivatedGroupId", 2);
|
||||
supportOldPassword = configFile.getBoolean("settings.security.supportOldPasswordHash", false);
|
||||
getWordPressPrefix = configFile.getString("ExternalBoardOptions.wordpressTablePrefix", "wp_");
|
||||
purgeLimitedCreative = configFile.getBoolean("Purge.removeLimitedCreativesInventories", false);
|
||||
purgeAntiXray = configFile.getBoolean("Purge.removeAntiXRayFile", false);
|
||||
purgePermissions = configFile.getBoolean("Purge.removePermissions", false);
|
||||
|
@ -53,12 +53,12 @@ public class ChangePasswordTask implements Runnable {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
ByteArrayDataOutput out = ByteStreams.newDataOutput();
|
||||
out.writeUTF("Forward");
|
||||
out.writeUTF("ALL");
|
||||
out.writeUTF("AuthMe");
|
||||
out.writeUTF("changepassword;" + name + ";" + hash + ";" + salt);
|
||||
player.sendPluginMessage(plugin, "BungeeCord", out.toByteArray());
|
||||
ByteArrayDataOutput out = ByteStreams.newDataOutput();
|
||||
out.writeUTF("Forward");
|
||||
out.writeUTF("ALL");
|
||||
out.writeUTF("AuthMe");
|
||||
out.writeUTF("changepassword;" + name + ";" + hash + ";" + salt);
|
||||
player.sendPluginMessage(plugin, "BungeeCord", out.toByteArray());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -1,14 +1,13 @@
|
||||
package fr.xephi.authme.process.email;
|
||||
|
||||
import fr.xephi.authme.AuthMe;
|
||||
import fr.xephi.authme.ConsoleLoggerTestInitializer;
|
||||
import fr.xephi.authme.cache.auth.PlayerAuth;
|
||||
import fr.xephi.authme.cache.auth.PlayerCache;
|
||||
import fr.xephi.authme.datasource.DataSource;
|
||||
import fr.xephi.authme.output.MessageKey;
|
||||
import fr.xephi.authme.output.Messages;
|
||||
import fr.xephi.authme.process.ProcessService;
|
||||
import fr.xephi.authme.settings.NewSetting;
|
||||
import fr.xephi.authme.settings.Settings;
|
||||
import fr.xephi.authme.settings.properties.RegistrationSettings;
|
||||
import fr.xephi.authme.util.WrapperMock;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.junit.After;
|
||||
@ -27,11 +26,10 @@ import static org.mockito.Mockito.when;
|
||||
*/
|
||||
public class AsyncAddEmailTest {
|
||||
|
||||
private Messages messages;
|
||||
private Player player;
|
||||
private DataSource dataSource;
|
||||
private PlayerCache playerCache;
|
||||
private NewSetting settings;
|
||||
private ProcessService service;
|
||||
|
||||
@BeforeClass
|
||||
public static void setUp() {
|
||||
@ -42,10 +40,10 @@ public class AsyncAddEmailTest {
|
||||
// Clean up the fields to ensure that no test uses elements of another test
|
||||
@After
|
||||
public void removeFieldValues() {
|
||||
messages = null;
|
||||
player = null;
|
||||
dataSource = null;
|
||||
playerCache = null;
|
||||
service = null;
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -61,11 +59,11 @@ public class AsyncAddEmailTest {
|
||||
given(dataSource.updateEmail(any(PlayerAuth.class))).willReturn(true);
|
||||
|
||||
// when
|
||||
process.process();
|
||||
process.run();
|
||||
|
||||
// then
|
||||
verify(dataSource).updateEmail(auth);
|
||||
verify(messages).send(player, MessageKey.EMAIL_ADDED_SUCCESS);
|
||||
verify(service).send(player, MessageKey.EMAIL_ADDED_SUCCESS);
|
||||
verify(auth).setEmail("my.mail@example.org");
|
||||
verify(playerCache).updatePlayer(auth);
|
||||
}
|
||||
@ -83,11 +81,11 @@ public class AsyncAddEmailTest {
|
||||
given(dataSource.updateEmail(any(PlayerAuth.class))).willReturn(false);
|
||||
|
||||
// when
|
||||
process.process();
|
||||
process.run();
|
||||
|
||||
// then
|
||||
verify(dataSource).updateEmail(auth);
|
||||
verify(messages).send(player, MessageKey.ERROR);
|
||||
verify(service).send(player, MessageKey.ERROR);
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -102,10 +100,10 @@ public class AsyncAddEmailTest {
|
||||
given(dataSource.isEmailStored("some.mail@example.org")).willReturn(false);
|
||||
|
||||
// when
|
||||
process.process();
|
||||
process.run();
|
||||
|
||||
// then
|
||||
verify(messages).send(player, MessageKey.USAGE_CHANGE_EMAIL);
|
||||
verify(service).send(player, MessageKey.USAGE_CHANGE_EMAIL);
|
||||
verify(playerCache, never()).updatePlayer(any(PlayerAuth.class));
|
||||
}
|
||||
|
||||
@ -121,10 +119,10 @@ public class AsyncAddEmailTest {
|
||||
given(dataSource.isEmailStored("invalid_mail")).willReturn(false);
|
||||
|
||||
// when
|
||||
process.process();
|
||||
process.run();
|
||||
|
||||
// then
|
||||
verify(messages).send(player, MessageKey.INVALID_EMAIL);
|
||||
verify(service).send(player, MessageKey.INVALID_EMAIL);
|
||||
verify(playerCache, never()).updatePlayer(any(PlayerAuth.class));
|
||||
}
|
||||
|
||||
@ -140,10 +138,10 @@ public class AsyncAddEmailTest {
|
||||
given(dataSource.isEmailStored("player@mail.tld")).willReturn(true);
|
||||
|
||||
// when
|
||||
process.process();
|
||||
process.run();
|
||||
|
||||
// then
|
||||
verify(messages).send(player, MessageKey.EMAIL_ALREADY_USED_ERROR);
|
||||
verify(service).send(player, MessageKey.EMAIL_ALREADY_USED_ERROR);
|
||||
verify(playerCache, never()).updatePlayer(any(PlayerAuth.class));
|
||||
}
|
||||
|
||||
@ -156,10 +154,10 @@ public class AsyncAddEmailTest {
|
||||
given(dataSource.isAuthAvailable("Username12")).willReturn(true);
|
||||
|
||||
// when
|
||||
process.process();
|
||||
process.run();
|
||||
|
||||
// then
|
||||
verify(messages).send(player, MessageKey.LOGIN_MESSAGE);
|
||||
verify(service).send(player, MessageKey.LOGIN_MESSAGE);
|
||||
verify(playerCache, never()).updatePlayer(any(PlayerAuth.class));
|
||||
}
|
||||
|
||||
@ -170,13 +168,13 @@ public class AsyncAddEmailTest {
|
||||
given(player.getName()).willReturn("user");
|
||||
given(playerCache.isAuthenticated("user")).willReturn(false);
|
||||
given(dataSource.isAuthAvailable("user")).willReturn(false);
|
||||
Settings.emailRegistration = true;
|
||||
given(service.getProperty(RegistrationSettings.USE_EMAIL_REGISTRATION)).willReturn(true);
|
||||
|
||||
// when
|
||||
process.process();
|
||||
process.run();
|
||||
|
||||
// then
|
||||
verify(messages).send(player, MessageKey.REGISTER_EMAIL_MESSAGE);
|
||||
verify(service).send(player, MessageKey.REGISTER_EMAIL_MESSAGE);
|
||||
verify(playerCache, never()).updatePlayer(any(PlayerAuth.class));
|
||||
}
|
||||
|
||||
@ -187,13 +185,13 @@ public class AsyncAddEmailTest {
|
||||
given(player.getName()).willReturn("user");
|
||||
given(playerCache.isAuthenticated("user")).willReturn(false);
|
||||
given(dataSource.isAuthAvailable("user")).willReturn(false);
|
||||
Settings.emailRegistration = false;
|
||||
given(service.getProperty(RegistrationSettings.USE_EMAIL_REGISTRATION)).willReturn(false);
|
||||
|
||||
// when
|
||||
process.process();
|
||||
process.run();
|
||||
|
||||
// then
|
||||
verify(messages).send(player, MessageKey.REGISTER_MESSAGE);
|
||||
verify(service).send(player, MessageKey.REGISTER_MESSAGE);
|
||||
verify(playerCache, never()).updatePlayer(any(PlayerAuth.class));
|
||||
}
|
||||
|
||||
@ -204,14 +202,12 @@ public class AsyncAddEmailTest {
|
||||
* @return The created process
|
||||
*/
|
||||
private AsyncAddEmail createProcess(String email) {
|
||||
messages = mock(Messages.class);
|
||||
AuthMe authMe = mock(AuthMe.class);
|
||||
when(authMe.getMessages()).thenReturn(messages);
|
||||
player = mock(Player.class);
|
||||
dataSource = mock(DataSource.class);
|
||||
playerCache = mock(PlayerCache.class);
|
||||
settings = mock(NewSetting.class);
|
||||
return new AsyncAddEmail(player, authMe, email, dataSource, playerCache, settings);
|
||||
service = mock(ProcessService.class);
|
||||
when(service.getSettings()).thenReturn(mock(NewSetting.class));
|
||||
return new AsyncAddEmail(player, email, dataSource, playerCache, service);
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user