Add method to remove cached plugin after removing plugin
authorDavid ‘Bombe’ Roden <bombe@freenetproject.org>
Fri, 21 Aug 2015 22:07:28 +0000 (00:07 +0200)
committerDavid ‘Bombe’ Roden <bombe@freenetproject.org>
Fri, 21 Aug 2015 22:07:28 +0000 (00:07 +0200)
src/main/java/net/pterodactylus/fcp/quelaton/RemovePluginCommand.java
src/main/java/net/pterodactylus/fcp/quelaton/RemovePluginCommandImpl.java
src/test/java/net/pterodactylus/fcp/quelaton/DefaultFcpClientTest.java

index 56fafa1..031e903 100644 (file)
@@ -8,6 +8,7 @@ package net.pterodactylus.fcp.quelaton;
 public interface RemovePluginCommand {
 
        RemovePluginCommand waitFor(int milliseconds);
+       RemovePluginCommand purge();
        Executable<Boolean> plugin(String pluginClass);
 
 }
index 4bc0781..026682d 100644 (file)
@@ -37,6 +37,12 @@ public class RemovePluginCommandImpl implements RemovePluginCommand {
        }
 
        @Override
+       public RemovePluginCommand purge() {
+               removePlugin.setPurge(true);
+               return this;
+       }
+
+       @Override
        public Executable<Boolean> plugin(String pluginClass) {
                removePlugin.setPluginName(pluginClass);
                return this::execute;
index 3495588..ed8a02e 100644 (file)
@@ -2211,6 +2211,15 @@ public class DefaultFcpClientTest {
                                assertThat(pluginRemoved.get(), is(true));
                        }
 
+                       @Test
+                       public void removingPluginWithPurgeWorks()
+                       throws InterruptedException, ExecutionException, IOException {
+                               Future<Boolean> 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",