From: David ‘Bombe’ Roden Date: Fri, 21 Aug 2015 22:07:28 +0000 (+0200) Subject: Add method to remove cached plugin after removing plugin X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=6c7ed43baae963240ad54996a5ebdc63d36c6b2b;p=jFCPlib.git Add method to remove cached plugin after removing plugin --- 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",