#933 Add MySQL to SQLite converter

- Create common parent for converting from one datasource type to another
- Add MySQL to SQLite child
- Create tests
This commit is contained in:
ljacqu
2016-09-04 13:59:23 +02:00
parent 6e5c901c4b
commit 589e589e45
9 changed files with 270 additions and 61 deletions
@@ -282,7 +282,7 @@ public class CommandInitializer {
.description("Converter command")
.detailedDescription("Converter command for AuthMeReloaded.")
.withArgument("job", "Conversion job: xauth / crazylogin / rakamak / " +
"royalauth / vauth / sqlitetosql", false)
"royalauth / vauth / sqliteToSql / mysqlToSqlite", false)
.permission(AdminPermission.CONVERTER)
.executableCommand(ConverterCommand.class)
.build();
@@ -7,6 +7,7 @@ import fr.xephi.authme.command.CommandService;
import fr.xephi.authme.command.ExecutableCommand;
import fr.xephi.authme.converter.Converter;
import fr.xephi.authme.converter.CrazyLoginConverter;
import fr.xephi.authme.converter.MySqlToSqlite;
import fr.xephi.authme.converter.RakamakConverter;
import fr.xephi.authme.converter.RoyalAuthConverter;
import fr.xephi.authme.converter.SqliteToSql;
@@ -55,13 +56,14 @@ public class ConverterCommand implements ExecutableCommand {
try {
converter.execute(sender);
} catch (Exception e) {
commandService.send(sender, MessageKey.ERROR);
ConsoleLogger.logException("Error during conversion:", e);
}
}
});
// Show a status message
sender.sendMessage("[AuthMe] Successfully converted from " + jobType.getName());
sender.sendMessage("[AuthMe] Successfully started " + jobType.getName());
}
@VisibleForTesting
@@ -71,7 +73,8 @@ public class ConverterCommand implements ExecutableCommand {
RAKAMAK("rakamak", RakamakConverter.class),
ROYALAUTH("royalauth", RoyalAuthConverter.class),
VAUTH("vauth", vAuthConverter.class),
SQLITETOSQL("sqlitetosql", SqliteToSql.class);
SQLITE_TO_SQL("sqlitetosql", SqliteToSql.class),
MYSQL_TO_SQLITE("mysqltosqlite", MySqlToSqlite.class);
private final String name;
private final Class<? extends Converter> converterClass;