From f3d3d61a9e9ae147a68d3c00a93eb911dbd50f20 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Fri, 21 Aug 2015 23:03:44 +0200 Subject: [PATCH] Add method to store plugin in config after reloading --- .../net/pterodactylus/fcp/quelaton/ReloadPluginCommand.java | 1 + .../pterodactylus/fcp/quelaton/ReloadPluginCommandImpl.java | 6 ++++++ .../net/pterodactylus/fcp/quelaton/DefaultFcpClientTest.java | 10 ++++++++++ 3 files changed, 17 insertions(+) diff --git a/src/main/java/net/pterodactylus/fcp/quelaton/ReloadPluginCommand.java b/src/main/java/net/pterodactylus/fcp/quelaton/ReloadPluginCommand.java index 8495ad2..5024267 100644 --- a/src/main/java/net/pterodactylus/fcp/quelaton/ReloadPluginCommand.java +++ b/src/main/java/net/pterodactylus/fcp/quelaton/ReloadPluginCommand.java @@ -13,6 +13,7 @@ public interface ReloadPluginCommand { ReloadPluginCommand waitFor(int milliseconds); ReloadPluginCommand purge(); + ReloadPluginCommand addToConfig(); Executable> plugin(String pluginClassName); } diff --git a/src/main/java/net/pterodactylus/fcp/quelaton/ReloadPluginCommandImpl.java b/src/main/java/net/pterodactylus/fcp/quelaton/ReloadPluginCommandImpl.java index 2c2e6c4..e544ec6 100644 --- a/src/main/java/net/pterodactylus/fcp/quelaton/ReloadPluginCommandImpl.java +++ b/src/main/java/net/pterodactylus/fcp/quelaton/ReloadPluginCommandImpl.java @@ -45,6 +45,12 @@ public class ReloadPluginCommandImpl implements ReloadPluginCommand { } @Override + public ReloadPluginCommand addToConfig() { + reloadPlugin.setStore(true); + return this; + } + + @Override public Executable> plugin(String pluginClassName) { reloadPlugin.setPluginName(pluginClassName); return this::execute; diff --git a/src/test/java/net/pterodactylus/fcp/quelaton/DefaultFcpClientTest.java b/src/test/java/net/pterodactylus/fcp/quelaton/DefaultFcpClientTest.java index 0974d40..6cc61d6 100644 --- a/src/test/java/net/pterodactylus/fcp/quelaton/DefaultFcpClientTest.java +++ b/src/test/java/net/pterodactylus/fcp/quelaton/DefaultFcpClientTest.java @@ -2171,6 +2171,16 @@ public class DefaultFcpClientTest { verifyPluginInfo(pluginInfo); } + @Test + public void reloadingPluginWithStoreWorks() + throws InterruptedException, ExecutionException, IOException { + Future> pluginInfo = + fcpClient.reloadPlugin().addToConfig().plugin(CLASS_NAME).execute(); + connectAndAssert(() -> allOf(matchReloadPluginMessage(), hasItem("Store=true"))); + replyWithPluginInfo(); + verifyPluginInfo(pluginInfo); + } + private Matcher> matchReloadPluginMessage() { return matchesFcpMessage( "ReloadPlugin", -- 2.7.4