From: David ‘Bombe’ Roden Date: Fri, 21 Aug 2015 21:00:08 +0000 (+0200) Subject: Add method to purge plugin while reloading X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=99684a6bd1dd741ce2d7fd708257393dc2d2d7ba;p=jFCPlib.git Add method to purge plugin while reloading --- diff --git a/src/main/java/net/pterodactylus/fcp/quelaton/ReloadPluginCommand.java b/src/main/java/net/pterodactylus/fcp/quelaton/ReloadPluginCommand.java index 65febba..8495ad2 100644 --- a/src/main/java/net/pterodactylus/fcp/quelaton/ReloadPluginCommand.java +++ b/src/main/java/net/pterodactylus/fcp/quelaton/ReloadPluginCommand.java @@ -12,6 +12,7 @@ import net.pterodactylus.fcp.PluginInfo; public interface ReloadPluginCommand { ReloadPluginCommand waitFor(int milliseconds); + ReloadPluginCommand purge(); 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 f7c11a9..2c2e6c4 100644 --- a/src/main/java/net/pterodactylus/fcp/quelaton/ReloadPluginCommandImpl.java +++ b/src/main/java/net/pterodactylus/fcp/quelaton/ReloadPluginCommandImpl.java @@ -39,6 +39,12 @@ public class ReloadPluginCommandImpl implements ReloadPluginCommand { } @Override + public ReloadPluginCommand purge() { + reloadPlugin.setPurge(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 d4d67c5..0974d40 100644 --- a/src/test/java/net/pterodactylus/fcp/quelaton/DefaultFcpClientTest.java +++ b/src/test/java/net/pterodactylus/fcp/quelaton/DefaultFcpClientTest.java @@ -2161,6 +2161,16 @@ public class DefaultFcpClientTest { verifyPluginInfo(pluginInfo); } + @Test + public void reloadingPluginWithPurgeWorks() + throws InterruptedException, ExecutionException, IOException { + Future> pluginInfo = + fcpClient.reloadPlugin().purge().plugin(CLASS_NAME).execute(); + connectAndAssert(() -> allOf(matchReloadPluginMessage(), hasItem("Purge=true"))); + replyWithPluginInfo(); + verifyPluginInfo(pluginInfo); + } + private Matcher> matchReloadPluginMessage() { return matchesFcpMessage( "ReloadPlugin",