From 6c7ed43baae963240ad54996a5ebdc63d36c6b2b Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Sat, 22 Aug 2015 00:07:28 +0200 Subject: [PATCH] Add method to remove cached plugin after removing plugin --- .../java/net/pterodactylus/fcp/quelaton/RemovePluginCommand.java | 1 + .../net/pterodactylus/fcp/quelaton/RemovePluginCommandImpl.java | 6 ++++++ .../net/pterodactylus/fcp/quelaton/DefaultFcpClientTest.java | 9 +++++++++ 3 files changed, 16 insertions(+) diff --git a/src/main/java/net/pterodactylus/fcp/quelaton/RemovePluginCommand.java b/src/main/java/net/pterodactylus/fcp/quelaton/RemovePluginCommand.java index 56fafa1..031e903 100644 --- a/src/main/java/net/pterodactylus/fcp/quelaton/RemovePluginCommand.java +++ b/src/main/java/net/pterodactylus/fcp/quelaton/RemovePluginCommand.java @@ -8,6 +8,7 @@ package net.pterodactylus.fcp.quelaton; public interface RemovePluginCommand { RemovePluginCommand waitFor(int milliseconds); + RemovePluginCommand purge(); Executable plugin(String pluginClass); } diff --git a/src/main/java/net/pterodactylus/fcp/quelaton/RemovePluginCommandImpl.java b/src/main/java/net/pterodactylus/fcp/quelaton/RemovePluginCommandImpl.java index 4bc0781..026682d 100644 --- a/src/main/java/net/pterodactylus/fcp/quelaton/RemovePluginCommandImpl.java +++ b/src/main/java/net/pterodactylus/fcp/quelaton/RemovePluginCommandImpl.java @@ -37,6 +37,12 @@ public class RemovePluginCommandImpl implements RemovePluginCommand { } @Override + public RemovePluginCommand purge() { + removePlugin.setPurge(true); + return this; + } + + @Override public Executable plugin(String pluginClass) { removePlugin.setPluginName(pluginClass); 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 3495588..ed8a02e 100644 --- a/src/test/java/net/pterodactylus/fcp/quelaton/DefaultFcpClientTest.java +++ b/src/test/java/net/pterodactylus/fcp/quelaton/DefaultFcpClientTest.java @@ -2211,6 +2211,15 @@ public class DefaultFcpClientTest { assertThat(pluginRemoved.get(), is(true)); } + @Test + public void removingPluginWithPurgeWorks() + throws InterruptedException, ExecutionException, IOException { + Future pluginRemoved = fcpClient.removePlugin().purge().plugin(CLASS_NAME).execute(); + connectAndAssert(() -> allOf(matchPluginRemovedMessage(), hasItem("Purge=true"))); + replyWithPluginRemoved(); + assertThat(pluginRemoved.get(), is(true)); + } + private void replyWithPluginRemoved() throws IOException { fcpServer.writeLine( "PluginRemoved", -- 2.7.4