From: David ‘Bombe’ Roden Date: Fri, 21 Aug 2015 21:03:44 +0000 (+0200) Subject: Add method to store plugin in config after reloading X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=f3d3d61a9e9ae147a68d3c00a93eb911dbd50f20;p=jFCPlib.git Add method to store plugin in config after reloading --- 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",