From 99684a6bd1dd741ce2d7fd708257393dc2d2d7ba 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:00:08 +0200 Subject: [PATCH] Add method to purge plugin while 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 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", -- 2.7.4