Remove bucket and access type from command interface
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Sun, 8 Jan 2017 14:57:57 +0000 (15:57 +0100)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Sun, 8 Jan 2017 14:57:57 +0000 (15:57 +0100)
25 files changed:
src/main/java/net/pterodactylus/sone/fcp/CreatePostCommand.java
src/main/java/net/pterodactylus/sone/fcp/CreateReplyCommand.java
src/main/java/net/pterodactylus/sone/fcp/DeletePostCommand.java
src/main/java/net/pterodactylus/sone/fcp/DeleteReplyCommand.java
src/main/java/net/pterodactylus/sone/fcp/FcpInterface.java
src/main/java/net/pterodactylus/sone/fcp/GetLocalSonesCommand.java
src/main/java/net/pterodactylus/sone/fcp/GetPostCommand.java
src/main/java/net/pterodactylus/sone/fcp/GetPostFeedCommand.java
src/main/java/net/pterodactylus/sone/fcp/GetPostsCommand.java
src/main/java/net/pterodactylus/sone/fcp/GetSoneCommand.java
src/main/java/net/pterodactylus/sone/fcp/GetSonesCommand.java
src/main/java/net/pterodactylus/sone/fcp/LikePostCommand.java
src/main/java/net/pterodactylus/sone/fcp/LikeReplyCommand.java
src/main/java/net/pterodactylus/sone/fcp/LockSoneCommand.java
src/main/java/net/pterodactylus/sone/fcp/UnlockSoneCommand.java
src/main/java/net/pterodactylus/sone/fcp/VersionCommand.java
src/main/java/net/pterodactylus/sone/freenet/fcp/Command.java
src/test/java/net/pterodactylus/sone/fcp/FcpInterfaceTest.kt
src/test/java/net/pterodactylus/sone/fcp/LockSoneCommandTest.java
src/test/java/net/pterodactylus/sone/fcp/UnlockSoneCommandTest.java
src/test/kotlin/net/pterodactylus/sone/fcp/CreatePostCommandTest.kt
src/test/kotlin/net/pterodactylus/sone/fcp/CreateReplyCommandTest.kt
src/test/kotlin/net/pterodactylus/sone/fcp/DeletePostCommandTest.kt
src/test/kotlin/net/pterodactylus/sone/fcp/DeleteReplyCommandTest.kt
src/test/kotlin/net/pterodactylus/sone/fcp/SoneCommandTest.kt

index 6f1e82c..b139ba2 100644 (file)
@@ -25,7 +25,6 @@ import net.pterodactylus.sone.data.Sone;
 import net.pterodactylus.sone.freenet.SimpleFieldSetBuilder;
 import net.pterodactylus.sone.freenet.fcp.FcpException;
 import freenet.support.SimpleFieldSet;
 import net.pterodactylus.sone.freenet.SimpleFieldSetBuilder;
 import net.pterodactylus.sone.freenet.fcp.FcpException;
 import freenet.support.SimpleFieldSet;
-import freenet.support.api.Bucket;
 
 /**
  * FCP command that creates a new {@link Post}.
 
 /**
  * FCP command that creates a new {@link Post}.
@@ -49,7 +48,7 @@ public class CreatePostCommand extends AbstractSoneCommand {
         * {@inheritDoc}
         */
        @Override
         * {@inheritDoc}
         */
        @Override
-       public Response execute(SimpleFieldSet parameters, Bucket data, AccessType accessType) throws FcpException {
+       public Response execute(SimpleFieldSet parameters) throws FcpException {
                Sone sone = getSone(parameters, "Sone", true);
                String text = getString(parameters, "Text");
                Sone recipient = null;
                Sone sone = getSone(parameters, "Sone", true);
                String text = getString(parameters, "Text");
                Sone recipient = null;
index 9369529..d268a07 100644 (file)
@@ -25,7 +25,6 @@ import net.pterodactylus.sone.data.Sone;
 import net.pterodactylus.sone.freenet.SimpleFieldSetBuilder;
 import net.pterodactylus.sone.freenet.fcp.FcpException;
 import freenet.support.SimpleFieldSet;
 import net.pterodactylus.sone.freenet.SimpleFieldSetBuilder;
 import net.pterodactylus.sone.freenet.fcp.FcpException;
 import freenet.support.SimpleFieldSet;
-import freenet.support.api.Bucket;
 
 /**
  * FCP command that creates a new {@link Reply}.
 
 /**
  * FCP command that creates a new {@link Reply}.
@@ -49,7 +48,7 @@ public class CreateReplyCommand extends AbstractSoneCommand {
         * {@inheritDoc}
         */
        @Override
         * {@inheritDoc}
         */
        @Override
-       public Response execute(SimpleFieldSet parameters, Bucket data, AccessType accessType) throws FcpException {
+       public Response execute(SimpleFieldSet parameters) throws FcpException {
                Sone sone = getSone(parameters, "Sone", true);
                Post post = getPost(parameters, "Post");
                String text = getString(parameters, "Text");
                Sone sone = getSone(parameters, "Sone", true);
                Post post = getPost(parameters, "Post");
                String text = getString(parameters, "Text");
index 3cfb102..b5ace1d 100644 (file)
@@ -22,7 +22,6 @@ import net.pterodactylus.sone.data.Post;
 import net.pterodactylus.sone.freenet.SimpleFieldSetBuilder;
 import net.pterodactylus.sone.freenet.fcp.FcpException;
 import freenet.support.SimpleFieldSet;
 import net.pterodactylus.sone.freenet.SimpleFieldSetBuilder;
 import net.pterodactylus.sone.freenet.fcp.FcpException;
 import freenet.support.SimpleFieldSet;
-import freenet.support.api.Bucket;
 
 /**
  * FCP command that deletes a {@link Post}.
 
 /**
  * FCP command that deletes a {@link Post}.
@@ -46,7 +45,7 @@ public class DeletePostCommand extends AbstractSoneCommand {
         * {@inheritDoc}
         */
        @Override
         * {@inheritDoc}
         */
        @Override
-       public Response execute(SimpleFieldSet parameters, Bucket data, AccessType accessType) throws FcpException {
+       public Response execute(SimpleFieldSet parameters) throws FcpException {
                Post post = getPost(parameters, "Post");
                if (!post.getSone().isLocal()) {
                        return new ErrorResponse(401, "Not allowed.");
                Post post = getPost(parameters, "Post");
                if (!post.getSone().isLocal()) {
                        return new ErrorResponse(401, "Not allowed.");
index 6a018fa..d75603e 100644 (file)
@@ -22,7 +22,6 @@ import net.pterodactylus.sone.data.PostReply;
 import net.pterodactylus.sone.freenet.SimpleFieldSetBuilder;
 import net.pterodactylus.sone.freenet.fcp.FcpException;
 import freenet.support.SimpleFieldSet;
 import net.pterodactylus.sone.freenet.SimpleFieldSetBuilder;
 import net.pterodactylus.sone.freenet.fcp.FcpException;
 import freenet.support.SimpleFieldSet;
-import freenet.support.api.Bucket;
 
 /**
  * FCP command that deletes a {@link PostReply}.
 
 /**
  * FCP command that deletes a {@link PostReply}.
@@ -46,7 +45,7 @@ public class DeleteReplyCommand extends AbstractSoneCommand {
         * {@inheritDoc}
         */
        @Override
         * {@inheritDoc}
         */
        @Override
-       public Response execute(SimpleFieldSet parameters, Bucket data, AccessType accessType) throws FcpException {
+       public Response execute(SimpleFieldSet parameters) throws FcpException {
                PostReply reply = getReply(parameters, "Reply");
                if (!reply.getSone().isLocal()) {
                        return new ErrorResponse(401, "Not allowed.");
                PostReply reply = getReply(parameters, "Reply");
                if (!reply.getSone().isLocal()) {
                        return new ErrorResponse(401, "Not allowed.");
index 9448210..c6957f4 100644 (file)
@@ -163,7 +163,7 @@ public class FcpInterface {
                        return;
                }
                try {
                        return;
                }
                try {
-                       Response response = command.execute(parameters, data, AccessType.values()[accessType]);
+                       Response response = command.execute(parameters);
                        sendReply(pluginReplySender, identifier, response);
                } catch (Exception e1) {
                        logger.log(Level.WARNING, "Could not process FCP command “%s”.", command);
                        sendReply(pluginReplySender, identifier, response);
                } catch (Exception e1) {
                        logger.log(Level.WARNING, "Could not process FCP command “%s”.", command);
index 8ac80cc..a55a81c 100644 (file)
@@ -19,7 +19,6 @@ package net.pterodactylus.sone.fcp;
 
 import net.pterodactylus.sone.core.Core;
 import freenet.support.SimpleFieldSet;
 
 import net.pterodactylus.sone.core.Core;
 import freenet.support.SimpleFieldSet;
-import freenet.support.api.Bucket;
 
 /**
  * Implements the “GetLocalSones” FCP command that returns the list of local
 
 /**
  * Implements the “GetLocalSones” FCP command that returns the list of local
@@ -43,7 +42,7 @@ public class GetLocalSonesCommand extends AbstractSoneCommand {
         * {@inheritDoc}
         */
        @Override
         * {@inheritDoc}
         */
        @Override
-       public Response execute(SimpleFieldSet parameters, Bucket data, AccessType accessType) {
+       public Response execute(SimpleFieldSet parameters) {
                return new Response("ListLocalSones", encodeSones(getCore().getLocalSones(), "LocalSones."));
        }
 
                return new Response("ListLocalSones", encodeSones(getCore().getLocalSones(), "LocalSones."));
        }
 
index 1e02dae..a6f1ae8 100644 (file)
@@ -21,7 +21,6 @@ import net.pterodactylus.sone.core.Core;
 import net.pterodactylus.sone.data.Post;
 import net.pterodactylus.sone.freenet.fcp.FcpException;
 import freenet.support.SimpleFieldSet;
 import net.pterodactylus.sone.data.Post;
 import net.pterodactylus.sone.freenet.fcp.FcpException;
 import freenet.support.SimpleFieldSet;
-import freenet.support.api.Bucket;
 
 /**
  * The “GetPost” FCP command returns a single {@link Post} to an FCP client.
 
 /**
  * The “GetPost” FCP command returns a single {@link Post} to an FCP client.
@@ -44,7 +43,7 @@ public class GetPostCommand extends AbstractSoneCommand {
         * {@inheritDoc}
         */
        @Override
         * {@inheritDoc}
         */
        @Override
-       public Response execute(SimpleFieldSet parameters, Bucket data, AccessType accessType) throws FcpException {
+       public Response execute(SimpleFieldSet parameters) throws FcpException {
                Post post = getPost(parameters, "Post");
                boolean includeReplies = getBoolean(parameters, "IncludeReplies", true);
 
                Post post = getPost(parameters, "Post");
                boolean includeReplies = getBoolean(parameters, "IncludeReplies", true);
 
index dea5156..7b804fb 100644 (file)
@@ -32,7 +32,6 @@ import com.google.common.base.Optional;
 import com.google.common.collect.Collections2;
 
 import freenet.support.SimpleFieldSet;
 import com.google.common.collect.Collections2;
 
 import freenet.support.SimpleFieldSet;
-import freenet.support.api.Bucket;
 
 /**
  * Implementation of an FCP interface for other clients or plugins to
 
 /**
  * Implementation of an FCP interface for other clients or plugins to
@@ -56,7 +55,7 @@ public class GetPostFeedCommand extends AbstractSoneCommand {
         * {@inheritDoc}
         */
        @Override
         * {@inheritDoc}
         */
        @Override
-       public Response execute(SimpleFieldSet parameters, Bucket data, AccessType accessType) throws FcpException {
+       public Response execute(SimpleFieldSet parameters) throws FcpException {
                Sone sone = getSone(parameters, "Sone", true);
                int startPost = getInt(parameters, "StartPost", 0);
                int maxPosts = getInt(parameters, "MaxPosts", -1);
                Sone sone = getSone(parameters, "Sone", true);
                int startPost = getInt(parameters, "StartPost", 0);
                int maxPosts = getInt(parameters, "MaxPosts", -1);
index 4059bf5..b9932a6 100644 (file)
@@ -25,7 +25,6 @@ import net.pterodactylus.sone.data.Post;
 import net.pterodactylus.sone.data.Sone;
 import net.pterodactylus.sone.freenet.fcp.FcpException;
 import freenet.support.SimpleFieldSet;
 import net.pterodactylus.sone.data.Sone;
 import net.pterodactylus.sone.freenet.fcp.FcpException;
 import freenet.support.SimpleFieldSet;
-import freenet.support.api.Bucket;
 
 /**
  * Implements the “GetPosts” FCP command that returns the list of posts a Sone
 
 /**
  * Implements the “GetPosts” FCP command that returns the list of posts a Sone
@@ -49,7 +48,7 @@ public class GetPostsCommand extends AbstractSoneCommand {
         * {@inheritDoc}
         */
        @Override
         * {@inheritDoc}
         */
        @Override
-       public Response execute(SimpleFieldSet parameters, Bucket data, AccessType accessType) throws FcpException {
+       public Response execute(SimpleFieldSet parameters) throws FcpException {
                Sone sone = getSone(parameters, "Sone", false);
                int startPost = getInt(parameters, "StartPost", 0);
                int maxPosts = getInt(parameters, "MaxPosts", -1);
                Sone sone = getSone(parameters, "Sone", false);
                int startPost = getInt(parameters, "StartPost", 0);
                int maxPosts = getInt(parameters, "MaxPosts", -1);
index f23be19..d0bd5cc 100644 (file)
@@ -25,7 +25,6 @@ import net.pterodactylus.sone.freenet.fcp.FcpException;
 import com.google.common.base.Optional;
 
 import freenet.support.SimpleFieldSet;
 import com.google.common.base.Optional;
 
 import freenet.support.SimpleFieldSet;
-import freenet.support.api.Bucket;
 
 /**
  * Implements the “GetSone“ FCP command which returns {@link Profile}
 
 /**
  * Implements the “GetSone“ FCP command which returns {@link Profile}
@@ -49,7 +48,7 @@ public class GetSoneCommand extends AbstractSoneCommand {
         * {@inheritDoc}
         */
        @Override
         * {@inheritDoc}
         */
        @Override
-       public Response execute(SimpleFieldSet parameters, Bucket data, AccessType accessType) throws FcpException {
+       public Response execute(SimpleFieldSet parameters) throws FcpException {
                Sone sone = getSone(parameters, "Sone", false);
                Optional<Sone> localSone = getSone(parameters, "LocalSone", false, false);
                return new Response("Sone", encodeSone(sone, "", localSone));
                Sone sone = getSone(parameters, "Sone", false);
                Optional<Sone> localSone = getSone(parameters, "LocalSone", false, false);
                return new Response("Sone", encodeSone(sone, "", localSone));
index 97c8842..10595ff 100644 (file)
@@ -24,7 +24,6 @@ import java.util.List;
 import net.pterodactylus.sone.core.Core;
 import net.pterodactylus.sone.data.Sone;
 import freenet.support.SimpleFieldSet;
 import net.pterodactylus.sone.core.Core;
 import net.pterodactylus.sone.data.Sone;
 import freenet.support.SimpleFieldSet;
-import freenet.support.api.Bucket;
 
 /**
  * Implements the “GetSones” FCP command that returns the list of known Sones.
 
 /**
  * Implements the “GetSones” FCP command that returns the list of known Sones.
@@ -47,7 +46,7 @@ public class GetSonesCommand extends AbstractSoneCommand {
         * {@inheritDoc}
         */
        @Override
         * {@inheritDoc}
         */
        @Override
-       public Response execute(SimpleFieldSet parameters, Bucket data, AccessType accessType) {
+       public Response execute(SimpleFieldSet parameters) {
                int startSone = getInt(parameters, "StartSone", 0);
                int maxSones = getInt(parameters, "MaxSones", -1);
                List<Sone> sones = new ArrayList<Sone>(getCore().getSones());
                int startSone = getInt(parameters, "StartSone", 0);
                int maxSones = getInt(parameters, "MaxSones", -1);
                List<Sone> sones = new ArrayList<Sone>(getCore().getSones());
index 583b8e4..a2fdd18 100644 (file)
@@ -23,7 +23,6 @@ import net.pterodactylus.sone.data.Sone;
 import net.pterodactylus.sone.freenet.SimpleFieldSetBuilder;
 import net.pterodactylus.sone.freenet.fcp.FcpException;
 import freenet.support.SimpleFieldSet;
 import net.pterodactylus.sone.freenet.SimpleFieldSetBuilder;
 import net.pterodactylus.sone.freenet.fcp.FcpException;
 import freenet.support.SimpleFieldSet;
-import freenet.support.api.Bucket;
 
 /**
  * Implements the “LikePost” FCP command which allows the user to like a post.
 
 /**
  * Implements the “LikePost” FCP command which allows the user to like a post.
@@ -46,7 +45,7 @@ public class LikePostCommand extends AbstractSoneCommand {
         * {@inheritDoc}
         */
        @Override
         * {@inheritDoc}
         */
        @Override
-       public Response execute(SimpleFieldSet parameters, Bucket data, AccessType accessType) throws FcpException {
+       public Response execute(SimpleFieldSet parameters) throws FcpException {
                Post post = getPost(parameters, "Post");
                Sone sone = getSone(parameters, "Sone", true);
                sone.addLikedPostId(post.getId());
                Post post = getPost(parameters, "Post");
                Sone sone = getSone(parameters, "Sone", true);
                sone.addLikedPostId(post.getId());
index 63d8893..6fba11b 100644 (file)
@@ -23,7 +23,6 @@ import net.pterodactylus.sone.data.Sone;
 import net.pterodactylus.sone.freenet.SimpleFieldSetBuilder;
 import net.pterodactylus.sone.freenet.fcp.FcpException;
 import freenet.support.SimpleFieldSet;
 import net.pterodactylus.sone.freenet.SimpleFieldSetBuilder;
 import net.pterodactylus.sone.freenet.fcp.FcpException;
 import freenet.support.SimpleFieldSet;
-import freenet.support.api.Bucket;
 
 /**
  * Implements the “LikeReply” FCP command which allows the user to like a reply.
 
 /**
  * Implements the “LikeReply” FCP command which allows the user to like a reply.
@@ -46,7 +45,7 @@ public class LikeReplyCommand extends AbstractSoneCommand {
         * {@inheritDoc}
         */
        @Override
         * {@inheritDoc}
         */
        @Override
-       public Response execute(SimpleFieldSet parameters, Bucket data, AccessType accessType) throws FcpException {
+       public Response execute(SimpleFieldSet parameters) throws FcpException {
                PostReply reply = getReply(parameters, "Reply");
                Sone sone = getSone(parameters, "Sone", true);
                sone.addLikedReplyId(reply.getId());
                PostReply reply = getReply(parameters, "Reply");
                Sone sone = getSone(parameters, "Sone", true);
                sone.addLikedReplyId(reply.getId());
index e05ac93..f39a18c 100644 (file)
@@ -23,7 +23,6 @@ import net.pterodactylus.sone.freenet.SimpleFieldSetBuilder;
 import net.pterodactylus.sone.freenet.fcp.FcpException;
 
 import freenet.support.SimpleFieldSet;
 import net.pterodactylus.sone.freenet.fcp.FcpException;
 
 import freenet.support.SimpleFieldSet;
-import freenet.support.api.Bucket;
 
 import com.google.common.base.Optional;
 
 
 import com.google.common.base.Optional;
 
@@ -51,7 +50,7 @@ public class LockSoneCommand extends AbstractSoneCommand {
        //
 
        @Override
        //
 
        @Override
-       public Response execute(SimpleFieldSet parameters, Bucket data, AccessType accessType) throws FcpException {
+       public Response execute(SimpleFieldSet parameters) throws FcpException {
                Optional<Sone> sone = getSone(parameters, "Sone", true, true);
                getCore().lockSone(sone.get());
                return new Response("SoneLocked", new SimpleFieldSetBuilder().put("Sone", sone.get().getId()).get());
                Optional<Sone> sone = getSone(parameters, "Sone", true, true);
                getCore().lockSone(sone.get());
                return new Response("SoneLocked", new SimpleFieldSetBuilder().put("Sone", sone.get().getId()).get());
index 311a7ca..bc78441 100644 (file)
@@ -23,7 +23,6 @@ import net.pterodactylus.sone.freenet.SimpleFieldSetBuilder;
 import net.pterodactylus.sone.freenet.fcp.FcpException;
 
 import freenet.support.SimpleFieldSet;
 import net.pterodactylus.sone.freenet.fcp.FcpException;
 
 import freenet.support.SimpleFieldSet;
-import freenet.support.api.Bucket;
 
 import com.google.common.base.Optional;
 
 
 import com.google.common.base.Optional;
 
@@ -51,7 +50,7 @@ public class UnlockSoneCommand extends AbstractSoneCommand {
        //
 
        @Override
        //
 
        @Override
-       public Response execute(SimpleFieldSet parameters, Bucket data, AccessType accessType) throws FcpException {
+       public Response execute(SimpleFieldSet parameters) throws FcpException {
                Optional<Sone> sone = getSone(parameters, "Sone", true, true);
                getCore().unlockSone(sone.get());
                return new Response("SoneUnlocked", new SimpleFieldSetBuilder().put("Sone", sone.get().getId()).get());
                Optional<Sone> sone = getSone(parameters, "Sone", true, true);
                getCore().unlockSone(sone.get());
                return new Response("SoneUnlocked", new SimpleFieldSetBuilder().put("Sone", sone.get().getId()).get());
index ee0f2e5..5f50b4d 100644 (file)
@@ -21,7 +21,6 @@ import net.pterodactylus.sone.core.Core;
 import net.pterodactylus.sone.freenet.SimpleFieldSetBuilder;
 import net.pterodactylus.sone.main.SonePlugin;
 import freenet.support.SimpleFieldSet;
 import net.pterodactylus.sone.freenet.SimpleFieldSetBuilder;
 import net.pterodactylus.sone.main.SonePlugin;
 import freenet.support.SimpleFieldSet;
-import freenet.support.api.Bucket;
 
 /**
  * Returns version information about the Sone plugin.
 
 /**
  * Returns version information about the Sone plugin.
@@ -44,7 +43,7 @@ public class VersionCommand extends AbstractSoneCommand {
         * {@inheritDoc}
         */
        @Override
         * {@inheritDoc}
         */
        @Override
-       public Response execute(SimpleFieldSet parameters, Bucket data, AccessType accessType) {
+       public Response execute(SimpleFieldSet parameters) {
                return new Response("Version", new SimpleFieldSetBuilder().put("Version", SonePlugin.getPluginVersion()).put("ProtocolVersion", 1).get());
        }
 
                return new Response("Version", new SimpleFieldSetBuilder().put("Version", SonePlugin.getPluginVersion()).put("ProtocolVersion", 1).get());
        }
 
index 03ecf1d..17f8370 100644 (file)
@@ -19,7 +19,6 @@ package net.pterodactylus.sone.freenet.fcp;
 
 import net.pterodactylus.sone.freenet.SimpleFieldSetBuilder;
 import freenet.support.SimpleFieldSet;
 
 import net.pterodactylus.sone.freenet.SimpleFieldSetBuilder;
 import freenet.support.SimpleFieldSet;
-import freenet.support.api.Bucket;
 
 /**
  * Implementation of an FCP interface for other clients or plugins to
 
 /**
  * Implementation of an FCP interface for other clients or plugins to
@@ -35,15 +34,11 @@ public interface Command {
         *
         * @param parameters
         *            The parameters of the comand
         *
         * @param parameters
         *            The parameters of the comand
-        * @param data
-        *            The data of the command (may be {@code null})
-        * @param accessType
-        *            The access type
         * @return A reply to send back to the plugin
         * @throws FcpException
         *             if an error processing the parameters occurs
         */
         * @return A reply to send back to the plugin
         * @throws FcpException
         *             if an error processing the parameters occurs
         */
-       public Response execute(SimpleFieldSet parameters, Bucket data, AccessType accessType) throws FcpException;
+       public Response execute(SimpleFieldSet parameters) throws FcpException;
 
        /**
         * The access type of the request.
 
        /**
         * The access type of the request.
index ac08bb4..e9137b0 100644 (file)
@@ -41,12 +41,12 @@ class FcpInterfaceTest {
 
        private val core = mock<Core>()
        private val workingCommand = mock<AbstractSoneCommand>().apply {
 
        private val core = mock<Core>()
        private val workingCommand = mock<AbstractSoneCommand>().apply {
-               whenever(execute(any(), any(), any())).thenReturn(Response("Working", SimpleFieldSet(true).apply {
+               whenever(execute(any())).thenReturn(Response("Working", SimpleFieldSet(true).apply {
                        putSingle("ReallyWorking", "true")
                }))
        }
        private val brokenCommand = mock<AbstractSoneCommand>().apply {
                        putSingle("ReallyWorking", "true")
                }))
        }
        private val brokenCommand = mock<AbstractSoneCommand>().apply {
-               whenever(execute(any(), any(), any())).thenThrow(RuntimeException::class.java)
+               whenever(execute(any())).thenThrow(RuntimeException::class.java)
        }
        private val commandSupplier = object : CommandSupplier() {
                override fun supplyCommands(core: Core): Map<String, AbstractSoneCommand> {
        }
        private val commandSupplier = object : CommandSupplier() {
                override fun supplyCommands(core: Core): Map<String, AbstractSoneCommand> {
index 8d6ee61..d2adbd7 100644 (file)
@@ -54,7 +54,7 @@ public class LockSoneCommandTest {
                SimpleFieldSet fields = new SimpleFieldSetBuilder().put("Sone", "LocalSone").get();
 
                LockSoneCommand lockSoneCommand = new LockSoneCommand(core);
                SimpleFieldSet fields = new SimpleFieldSetBuilder().put("Sone", "LocalSone").get();
 
                LockSoneCommand lockSoneCommand = new LockSoneCommand(core);
-               Response response = lockSoneCommand.execute(fields, null, null);
+               Response response = lockSoneCommand.execute(fields);
 
                verify(core).lockSone(eq(localSone));
                assertThat(response, notNullValue());
 
                verify(core).lockSone(eq(localSone));
                assertThat(response, notNullValue());
@@ -71,7 +71,7 @@ public class LockSoneCommandTest {
                SimpleFieldSet fields = new SimpleFieldSetBuilder().put("Sone", "RemoteSone").get();
 
                LockSoneCommand lockSoneCommand = new LockSoneCommand(core);
                SimpleFieldSet fields = new SimpleFieldSetBuilder().put("Sone", "RemoteSone").get();
 
                LockSoneCommand lockSoneCommand = new LockSoneCommand(core);
-               lockSoneCommand.execute(fields, null, null);
+               lockSoneCommand.execute(fields);
        }
 
        @Test(expected = FcpException.class)
        }
 
        @Test(expected = FcpException.class)
@@ -80,7 +80,7 @@ public class LockSoneCommandTest {
                SimpleFieldSet fields = new SimpleFieldSetBuilder().get();
 
                LockSoneCommand lockSoneCommand = new LockSoneCommand(core);
                SimpleFieldSet fields = new SimpleFieldSetBuilder().get();
 
                LockSoneCommand lockSoneCommand = new LockSoneCommand(core);
-               lockSoneCommand.execute(fields, null, null);
+               lockSoneCommand.execute(fields);
        }
 
 }
        }
 
 }
index 842d0e8..e33e1bc 100644 (file)
@@ -54,7 +54,7 @@ public class UnlockSoneCommandTest {
                SimpleFieldSet fields = new SimpleFieldSetBuilder().put("Sone", "LocalSone").get();
 
                UnlockSoneCommand unlockSoneCommand = new UnlockSoneCommand(core);
                SimpleFieldSet fields = new SimpleFieldSetBuilder().put("Sone", "LocalSone").get();
 
                UnlockSoneCommand unlockSoneCommand = new UnlockSoneCommand(core);
-               Response response = unlockSoneCommand.execute(fields, null, null);
+               Response response = unlockSoneCommand.execute(fields);
 
                verify(core).unlockSone(eq(localSone));
                assertThat(response, notNullValue());
 
                verify(core).unlockSone(eq(localSone));
                assertThat(response, notNullValue());
@@ -71,7 +71,7 @@ public class UnlockSoneCommandTest {
                SimpleFieldSet fields = new SimpleFieldSetBuilder().put("Sone", "RemoteSone").get();
 
                UnlockSoneCommand unlockSoneCommand = new UnlockSoneCommand(core);
                SimpleFieldSet fields = new SimpleFieldSetBuilder().put("Sone", "RemoteSone").get();
 
                UnlockSoneCommand unlockSoneCommand = new UnlockSoneCommand(core);
-               unlockSoneCommand.execute(fields, null, null);
+               unlockSoneCommand.execute(fields);
        }
 
        @Test(expected = FcpException.class)
        }
 
        @Test(expected = FcpException.class)
@@ -80,7 +80,7 @@ public class UnlockSoneCommandTest {
                SimpleFieldSet fields = new SimpleFieldSetBuilder().get();
 
                UnlockSoneCommand unlockSoneCommand = new UnlockSoneCommand(core);
                SimpleFieldSet fields = new SimpleFieldSetBuilder().get();
 
                UnlockSoneCommand unlockSoneCommand = new UnlockSoneCommand(core);
-               unlockSoneCommand.execute(fields, null, null);
+               unlockSoneCommand.execute(fields);
        }
 
 }
        }
 
 }
index 98b0a67..6d2cc81 100644 (file)
@@ -58,7 +58,7 @@ class CreatePostCommandTest : SoneCommandTest() {
                whenever(core.getSone("LocalSoneId")).thenReturn(of(localSone))
                val post = mock<Post>().apply { whenever(id).thenReturn("PostId") }
                whenever(core.createPost(localSone, absent(), "Test")).thenReturn(post)
                whenever(core.getSone("LocalSoneId")).thenReturn(of(localSone))
                val post = mock<Post>().apply { whenever(id).thenReturn("PostId") }
                whenever(core.createPost(localSone, absent(), "Test")).thenReturn(post)
-               val response = command.execute(parameters, null, null)
+               val response = command.execute(parameters)
                assertThat(response.replyParameters.get("Message"), equalTo("PostCreated"))
                assertThat(response.replyParameters.get("Post"), equalTo("PostId"))
        }
                assertThat(response.replyParameters.get("Message"), equalTo("PostCreated"))
                assertThat(response.replyParameters.get("Post"), equalTo("PostId"))
        }
@@ -78,7 +78,7 @@ class CreatePostCommandTest : SoneCommandTest() {
                parameters.putSingle("Text", "Test")
                parameters.putSingle("Recipient", "LocalSoneId")
                whenever(core.getSone("LocalSoneId")).thenReturn(of(localSone))
                parameters.putSingle("Text", "Test")
                parameters.putSingle("Recipient", "LocalSoneId")
                whenever(core.getSone("LocalSoneId")).thenReturn(of(localSone))
-               val response = command.execute(parameters, null, null)
+               val response = command.execute(parameters)
                assertThat(response.replyParameters["Message"], equalTo("Error"))
                assertThat(response.replyParameters["ErrorMessage"], notNullValue())
        }
                assertThat(response.replyParameters["Message"], equalTo("Error"))
                assertThat(response.replyParameters["ErrorMessage"], notNullValue())
        }
@@ -92,7 +92,7 @@ class CreatePostCommandTest : SoneCommandTest() {
                whenever(core.getSone("RemoteSoneId")).thenReturn(of(remoteSone))
                val post = mock<Post>().apply { whenever(id).thenReturn("PostId") }
                whenever(core.createPost(localSone, of(remoteSone), "Test")).thenReturn(post)
                whenever(core.getSone("RemoteSoneId")).thenReturn(of(remoteSone))
                val post = mock<Post>().apply { whenever(id).thenReturn("PostId") }
                whenever(core.createPost(localSone, of(remoteSone), "Test")).thenReturn(post)
-               val response = command.execute(parameters, null, null)
+               val response = command.execute(parameters)
                assertThat(response.replyParameters.get("Message"), equalTo("PostCreated"))
                assertThat(response.replyParameters.get("Post"), equalTo("PostId"))
        }
                assertThat(response.replyParameters.get("Message"), equalTo("PostCreated"))
                assertThat(response.replyParameters.get("Post"), equalTo("PostId"))
        }
index 1269272..b30b765 100644 (file)
@@ -81,7 +81,7 @@ class CreateReplyCommandTest : SoneCommandTest() {
                parameters.putSingle("Text", "Test")
                val postReply = mock<PostReply>().apply { whenever(id).thenReturn("ReplyId") }
                whenever(core.createReply(localSone, post, "Test")).thenReturn(postReply)
                parameters.putSingle("Text", "Test")
                val postReply = mock<PostReply>().apply { whenever(id).thenReturn("ReplyId") }
                whenever(core.createReply(localSone, post, "Test")).thenReturn(postReply)
-               val response = command.execute(parameters, null, null)
+               val response = command.execute(parameters)
                assertThat(response.replyParameters["Message"], equalTo("ReplyCreated"))
                assertThat(response.replyParameters["Reply"], equalTo("ReplyId"))
        }
                assertThat(response.replyParameters["Message"], equalTo("ReplyCreated"))
                assertThat(response.replyParameters["Reply"], equalTo("ReplyId"))
        }
index 71e6eee..a2b4198 100644 (file)
@@ -39,7 +39,7 @@ class DeletePostCommandTest : SoneCommandTest() {
        fun `request with post from remote sone returns error response`() {
                parameters.putSingle("Post", "RemotePostId")
                whenever(core.getPost("RemotePostId")).thenReturn(of(postFromRemoteSone))
        fun `request with post from remote sone returns error response`() {
                parameters.putSingle("Post", "RemotePostId")
                whenever(core.getPost("RemotePostId")).thenReturn(of(postFromRemoteSone))
-               val response = command.execute(parameters, null, null)
+               val response = command.execute(parameters)
                assertThat(response.replyParameters["Message"], equalTo("Error"))
                assertThat(response.replyParameters["ErrorCode"], equalTo("401"))
        }
                assertThat(response.replyParameters["Message"], equalTo("Error"))
                assertThat(response.replyParameters["ErrorCode"], equalTo("401"))
        }
@@ -48,7 +48,7 @@ class DeletePostCommandTest : SoneCommandTest() {
        fun `request with post from local sone deletes posts`() {
                parameters.putSingle("Post", "LocalPostId")
                whenever(core.getPost("LocalPostId")).thenReturn(of(postFromLocalSone))
        fun `request with post from local sone deletes posts`() {
                parameters.putSingle("Post", "LocalPostId")
                whenever(core.getPost("LocalPostId")).thenReturn(of(postFromLocalSone))
-               val response = command.execute(parameters, null, null)
+               val response = command.execute(parameters)
                assertThat(response.replyParameters["Message"], equalTo("PostDeleted"))
                verify(core).deletePost(postFromLocalSone)
        }
                assertThat(response.replyParameters["Message"], equalTo("PostDeleted"))
                verify(core).deletePost(postFromLocalSone)
        }
index 0819a60..57c4c30 100644 (file)
@@ -40,7 +40,7 @@ class DeleteReplyCommandTest : SoneCommandTest() {
        fun `request with remote post reply parameter results in error response`() {
            parameters.putSingle("Reply", "RemoteReplyId")
                whenever(core.getPostReply("RemoteReplyId")).thenReturn(of(remotePostReply))
        fun `request with remote post reply parameter results in error response`() {
            parameters.putSingle("Reply", "RemoteReplyId")
                whenever(core.getPostReply("RemoteReplyId")).thenReturn(of(remotePostReply))
-               val response = command.execute(parameters, null, null)
+               val response = command.execute(parameters)
                assertThat(response.replyParameters["Message"], equalTo("Error"))
                assertThat(response.replyParameters["ErrorCode"], equalTo("401"))
        }
                assertThat(response.replyParameters["Message"], equalTo("Error"))
                assertThat(response.replyParameters["ErrorCode"], equalTo("401"))
        }
@@ -49,7 +49,7 @@ class DeleteReplyCommandTest : SoneCommandTest() {
        fun `request with local post reply parameter deletes reply`() {
            parameters.putSingle("Reply", "RemoteReplyId")
                whenever(core.getPostReply("RemoteReplyId")).thenReturn(of(localPostReply))
        fun `request with local post reply parameter deletes reply`() {
            parameters.putSingle("Reply", "RemoteReplyId")
                whenever(core.getPostReply("RemoteReplyId")).thenReturn(of(localPostReply))
-               val response = command.execute(parameters, null, null)
+               val response = command.execute(parameters)
                assertThat(response.replyParameters["Message"], equalTo("ReplyDeleted"))
                verify(core).deleteReply(localPostReply)
        }
                assertThat(response.replyParameters["Message"], equalTo("ReplyDeleted"))
                verify(core).deleteReply(localPostReply)
        }
index b02aa9e..f34b19c 100644 (file)
@@ -40,12 +40,12 @@ abstract class SoneCommandTest {
 
        protected fun executeCommandAndExpectFcpException() {
                expectedException.expect(FcpException::class.java)
 
        protected fun executeCommandAndExpectFcpException() {
                expectedException.expect(FcpException::class.java)
-               command.execute(parameters, null, null)
+               command.execute(parameters)
        }
 
        protected fun requestWithoutAnyParameterResultsInFcpException() {
                expectedException.expect(FcpException::class.java)
        }
 
        protected fun requestWithoutAnyParameterResultsInFcpException() {
                expectedException.expect(FcpException::class.java)
-               command.execute(parameters, null, null)
+               command.execute(parameters)
        }
 
        protected fun requestWithEmptySoneParameterResultsInFcpException() {
        }
 
        protected fun requestWithEmptySoneParameterResultsInFcpException() {