Add method to request detailed plugin info
authorDavid ‘Bombe’ Roden <bombe@freenetproject.org>
Fri, 21 Aug 2015 22:45:47 +0000 (00:45 +0200)
committerDavid ‘Bombe’ Roden <bombe@freenetproject.org>
Fri, 21 Aug 2015 22:45:47 +0000 (00:45 +0200)
src/main/java/net/pterodactylus/fcp/quelaton/GetPluginInfoCommand.java
src/main/java/net/pterodactylus/fcp/quelaton/GetPluginInfoCommandImpl.java
src/test/java/net/pterodactylus/fcp/quelaton/DefaultFcpClientTest.java

index 047024b..03e887c 100644 (file)
@@ -11,6 +11,7 @@ import net.pterodactylus.fcp.PluginInfo;
  */
 public interface GetPluginInfoCommand {
 
  */
 public interface GetPluginInfoCommand {
 
+       GetPluginInfoCommand detailed();
        Executable<Optional<PluginInfo>> plugin(String pluginName);
 
 }
        Executable<Optional<PluginInfo>> plugin(String pluginName);
 
 }
index 8063bc7..67c3e30 100644 (file)
@@ -33,6 +33,12 @@ public class GetPluginInfoCommandImpl implements GetPluginInfoCommand {
        }
 
        @Override
        }
 
        @Override
+       public GetPluginInfoCommand detailed() {
+               getPluginInfo.setDetailed(true);
+               return this;
+       }
+
+       @Override
        public Executable<Optional<PluginInfo>> plugin(String pluginName) {
                getPluginInfo.setPluginName(pluginName);
                return this::execute;
        public Executable<Optional<PluginInfo>> plugin(String pluginName) {
                getPluginInfo.setPluginName(pluginName);
                return this::execute;
index 002086d..78aa52a 100644 (file)
@@ -2250,6 +2250,16 @@ public class DefaultFcpClientTest {
                                verifyPluginInfo(pluginInfo);
                        }
 
                                verifyPluginInfo(pluginInfo);
                        }
 
+                       @Test
+                       public void gettingPluginInfoWithDetailsWorks()
+                       throws InterruptedException, ExecutionException, IOException {
+                               Future<Optional<PluginInfo>> pluginInfo =
+                                       fcpClient.getPluginInfo().detailed().plugin(CLASS_NAME).execute();
+                               connectAndAssert(() -> allOf(matchGetPluginInfoMessage(), hasItem("Detailed=true")));
+                               replyWithPluginInfo();
+                               verifyPluginInfo(pluginInfo);
+                       }
+
                        private Matcher<List<String>> matchGetPluginInfoMessage() {
                                return matchesFcpMessage(
                                        "GetPluginInfo",
                        private Matcher<List<String>> matchGetPluginInfoMessage() {
                                return matchesFcpMessage(
                                        "GetPluginInfo",