From: David ‘Bombe’ Roden Date: Sun, 8 Jan 2017 14:57:57 +0000 (+0100) Subject: Remove bucket and access type from command interface X-Git-Tag: 0.9.7^2~351 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=914d5522692e7714ba5bdefb002fedc8e293f5fc;p=Sone.git Remove bucket and access type from command interface --- diff --git a/src/main/java/net/pterodactylus/sone/fcp/CreatePostCommand.java b/src/main/java/net/pterodactylus/sone/fcp/CreatePostCommand.java index 6f1e82c..b139ba2 100644 --- a/src/main/java/net/pterodactylus/sone/fcp/CreatePostCommand.java +++ b/src/main/java/net/pterodactylus/sone/fcp/CreatePostCommand.java @@ -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 freenet.support.api.Bucket; /** * FCP command that creates a new {@link Post}. @@ -49,7 +48,7 @@ public class CreatePostCommand extends AbstractSoneCommand { * {@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; diff --git a/src/main/java/net/pterodactylus/sone/fcp/CreateReplyCommand.java b/src/main/java/net/pterodactylus/sone/fcp/CreateReplyCommand.java index 9369529..d268a07 100644 --- a/src/main/java/net/pterodactylus/sone/fcp/CreateReplyCommand.java +++ b/src/main/java/net/pterodactylus/sone/fcp/CreateReplyCommand.java @@ -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 freenet.support.api.Bucket; /** * FCP command that creates a new {@link Reply}. @@ -49,7 +48,7 @@ public class CreateReplyCommand extends AbstractSoneCommand { * {@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"); diff --git a/src/main/java/net/pterodactylus/sone/fcp/DeletePostCommand.java b/src/main/java/net/pterodactylus/sone/fcp/DeletePostCommand.java index 3cfb102..b5ace1d 100644 --- a/src/main/java/net/pterodactylus/sone/fcp/DeletePostCommand.java +++ b/src/main/java/net/pterodactylus/sone/fcp/DeletePostCommand.java @@ -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 freenet.support.api.Bucket; /** * FCP command that deletes a {@link Post}. @@ -46,7 +45,7 @@ public class DeletePostCommand extends AbstractSoneCommand { * {@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."); diff --git a/src/main/java/net/pterodactylus/sone/fcp/DeleteReplyCommand.java b/src/main/java/net/pterodactylus/sone/fcp/DeleteReplyCommand.java index 6a018fa..d75603e 100644 --- a/src/main/java/net/pterodactylus/sone/fcp/DeleteReplyCommand.java +++ b/src/main/java/net/pterodactylus/sone/fcp/DeleteReplyCommand.java @@ -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 freenet.support.api.Bucket; /** * FCP command that deletes a {@link PostReply}. @@ -46,7 +45,7 @@ public class DeleteReplyCommand extends AbstractSoneCommand { * {@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."); diff --git a/src/main/java/net/pterodactylus/sone/fcp/FcpInterface.java b/src/main/java/net/pterodactylus/sone/fcp/FcpInterface.java index 9448210..c6957f4 100644 --- a/src/main/java/net/pterodactylus/sone/fcp/FcpInterface.java +++ b/src/main/java/net/pterodactylus/sone/fcp/FcpInterface.java @@ -163,7 +163,7 @@ public class FcpInterface { 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); diff --git a/src/main/java/net/pterodactylus/sone/fcp/GetLocalSonesCommand.java b/src/main/java/net/pterodactylus/sone/fcp/GetLocalSonesCommand.java index 8ac80cc..a55a81c 100644 --- a/src/main/java/net/pterodactylus/sone/fcp/GetLocalSonesCommand.java +++ b/src/main/java/net/pterodactylus/sone/fcp/GetLocalSonesCommand.java @@ -19,7 +19,6 @@ package net.pterodactylus.sone.fcp; 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 @@ -43,7 +42,7 @@ public class GetLocalSonesCommand extends AbstractSoneCommand { * {@inheritDoc} */ @Override - public Response execute(SimpleFieldSet parameters, Bucket data, AccessType accessType) { + public Response execute(SimpleFieldSet parameters) { return new Response("ListLocalSones", encodeSones(getCore().getLocalSones(), "LocalSones.")); } diff --git a/src/main/java/net/pterodactylus/sone/fcp/GetPostCommand.java b/src/main/java/net/pterodactylus/sone/fcp/GetPostCommand.java index 1e02dae..a6f1ae8 100644 --- a/src/main/java/net/pterodactylus/sone/fcp/GetPostCommand.java +++ b/src/main/java/net/pterodactylus/sone/fcp/GetPostCommand.java @@ -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 freenet.support.api.Bucket; /** * The “GetPost” FCP command returns a single {@link Post} to an FCP client. @@ -44,7 +43,7 @@ public class GetPostCommand extends AbstractSoneCommand { * {@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); diff --git a/src/main/java/net/pterodactylus/sone/fcp/GetPostFeedCommand.java b/src/main/java/net/pterodactylus/sone/fcp/GetPostFeedCommand.java index dea5156..7b804fb 100644 --- a/src/main/java/net/pterodactylus/sone/fcp/GetPostFeedCommand.java +++ b/src/main/java/net/pterodactylus/sone/fcp/GetPostFeedCommand.java @@ -32,7 +32,6 @@ import com.google.common.base.Optional; 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 @@ -56,7 +55,7 @@ public class GetPostFeedCommand extends AbstractSoneCommand { * {@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); diff --git a/src/main/java/net/pterodactylus/sone/fcp/GetPostsCommand.java b/src/main/java/net/pterodactylus/sone/fcp/GetPostsCommand.java index 4059bf5..b9932a6 100644 --- a/src/main/java/net/pterodactylus/sone/fcp/GetPostsCommand.java +++ b/src/main/java/net/pterodactylus/sone/fcp/GetPostsCommand.java @@ -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 freenet.support.api.Bucket; /** * Implements the “GetPosts” FCP command that returns the list of posts a Sone @@ -49,7 +48,7 @@ public class GetPostsCommand extends AbstractSoneCommand { * {@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); diff --git a/src/main/java/net/pterodactylus/sone/fcp/GetSoneCommand.java b/src/main/java/net/pterodactylus/sone/fcp/GetSoneCommand.java index f23be19..d0bd5cc 100644 --- a/src/main/java/net/pterodactylus/sone/fcp/GetSoneCommand.java +++ b/src/main/java/net/pterodactylus/sone/fcp/GetSoneCommand.java @@ -25,7 +25,6 @@ import net.pterodactylus.sone.freenet.fcp.FcpException; import com.google.common.base.Optional; import freenet.support.SimpleFieldSet; -import freenet.support.api.Bucket; /** * Implements the “GetSone“ FCP command which returns {@link Profile} @@ -49,7 +48,7 @@ public class GetSoneCommand extends AbstractSoneCommand { * {@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 localSone = getSone(parameters, "LocalSone", false, false); return new Response("Sone", encodeSone(sone, "", localSone)); diff --git a/src/main/java/net/pterodactylus/sone/fcp/GetSonesCommand.java b/src/main/java/net/pterodactylus/sone/fcp/GetSonesCommand.java index 97c8842..10595ff 100644 --- a/src/main/java/net/pterodactylus/sone/fcp/GetSonesCommand.java +++ b/src/main/java/net/pterodactylus/sone/fcp/GetSonesCommand.java @@ -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 freenet.support.api.Bucket; /** * Implements the “GetSones” FCP command that returns the list of known Sones. @@ -47,7 +46,7 @@ public class GetSonesCommand extends AbstractSoneCommand { * {@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 sones = new ArrayList(getCore().getSones()); diff --git a/src/main/java/net/pterodactylus/sone/fcp/LikePostCommand.java b/src/main/java/net/pterodactylus/sone/fcp/LikePostCommand.java index 583b8e4..a2fdd18 100644 --- a/src/main/java/net/pterodactylus/sone/fcp/LikePostCommand.java +++ b/src/main/java/net/pterodactylus/sone/fcp/LikePostCommand.java @@ -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 freenet.support.api.Bucket; /** * Implements the “LikePost” FCP command which allows the user to like a post. @@ -46,7 +45,7 @@ public class LikePostCommand extends AbstractSoneCommand { * {@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()); diff --git a/src/main/java/net/pterodactylus/sone/fcp/LikeReplyCommand.java b/src/main/java/net/pterodactylus/sone/fcp/LikeReplyCommand.java index 63d8893..6fba11b 100644 --- a/src/main/java/net/pterodactylus/sone/fcp/LikeReplyCommand.java +++ b/src/main/java/net/pterodactylus/sone/fcp/LikeReplyCommand.java @@ -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 freenet.support.api.Bucket; /** * Implements the “LikeReply” FCP command which allows the user to like a reply. @@ -46,7 +45,7 @@ public class LikeReplyCommand extends AbstractSoneCommand { * {@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()); diff --git a/src/main/java/net/pterodactylus/sone/fcp/LockSoneCommand.java b/src/main/java/net/pterodactylus/sone/fcp/LockSoneCommand.java index e05ac93..f39a18c 100644 --- a/src/main/java/net/pterodactylus/sone/fcp/LockSoneCommand.java +++ b/src/main/java/net/pterodactylus/sone/fcp/LockSoneCommand.java @@ -23,7 +23,6 @@ import net.pterodactylus.sone.freenet.SimpleFieldSetBuilder; import net.pterodactylus.sone.freenet.fcp.FcpException; import freenet.support.SimpleFieldSet; -import freenet.support.api.Bucket; import com.google.common.base.Optional; @@ -51,7 +50,7 @@ public class LockSoneCommand extends AbstractSoneCommand { // @Override - public Response execute(SimpleFieldSet parameters, Bucket data, AccessType accessType) throws FcpException { + public Response execute(SimpleFieldSet parameters) throws FcpException { Optional sone = getSone(parameters, "Sone", true, true); getCore().lockSone(sone.get()); return new Response("SoneLocked", new SimpleFieldSetBuilder().put("Sone", sone.get().getId()).get()); diff --git a/src/main/java/net/pterodactylus/sone/fcp/UnlockSoneCommand.java b/src/main/java/net/pterodactylus/sone/fcp/UnlockSoneCommand.java index 311a7ca..bc78441 100644 --- a/src/main/java/net/pterodactylus/sone/fcp/UnlockSoneCommand.java +++ b/src/main/java/net/pterodactylus/sone/fcp/UnlockSoneCommand.java @@ -23,7 +23,6 @@ import net.pterodactylus.sone.freenet.SimpleFieldSetBuilder; import net.pterodactylus.sone.freenet.fcp.FcpException; import freenet.support.SimpleFieldSet; -import freenet.support.api.Bucket; import com.google.common.base.Optional; @@ -51,7 +50,7 @@ public class UnlockSoneCommand extends AbstractSoneCommand { // @Override - public Response execute(SimpleFieldSet parameters, Bucket data, AccessType accessType) throws FcpException { + public Response execute(SimpleFieldSet parameters) throws FcpException { Optional sone = getSone(parameters, "Sone", true, true); getCore().unlockSone(sone.get()); return new Response("SoneUnlocked", new SimpleFieldSetBuilder().put("Sone", sone.get().getId()).get()); diff --git a/src/main/java/net/pterodactylus/sone/fcp/VersionCommand.java b/src/main/java/net/pterodactylus/sone/fcp/VersionCommand.java index ee0f2e5..5f50b4d 100644 --- a/src/main/java/net/pterodactylus/sone/fcp/VersionCommand.java +++ b/src/main/java/net/pterodactylus/sone/fcp/VersionCommand.java @@ -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 freenet.support.api.Bucket; /** * Returns version information about the Sone plugin. @@ -44,7 +43,7 @@ public class VersionCommand extends AbstractSoneCommand { * {@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()); } diff --git a/src/main/java/net/pterodactylus/sone/freenet/fcp/Command.java b/src/main/java/net/pterodactylus/sone/freenet/fcp/Command.java index 03ecf1d..17f8370 100644 --- a/src/main/java/net/pterodactylus/sone/freenet/fcp/Command.java +++ b/src/main/java/net/pterodactylus/sone/freenet/fcp/Command.java @@ -19,7 +19,6 @@ package net.pterodactylus.sone.freenet.fcp; 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 @@ -35,15 +34,11 @@ public interface Command { * * @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 */ - public Response execute(SimpleFieldSet parameters, Bucket data, AccessType accessType) throws FcpException; + public Response execute(SimpleFieldSet parameters) throws FcpException; /** * The access type of the request. diff --git a/src/test/java/net/pterodactylus/sone/fcp/FcpInterfaceTest.kt b/src/test/java/net/pterodactylus/sone/fcp/FcpInterfaceTest.kt index ac08bb4..e9137b0 100644 --- a/src/test/java/net/pterodactylus/sone/fcp/FcpInterfaceTest.kt +++ b/src/test/java/net/pterodactylus/sone/fcp/FcpInterfaceTest.kt @@ -41,12 +41,12 @@ class FcpInterfaceTest { private val core = mock() private val workingCommand = mock().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().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 { diff --git a/src/test/java/net/pterodactylus/sone/fcp/LockSoneCommandTest.java b/src/test/java/net/pterodactylus/sone/fcp/LockSoneCommandTest.java index 8d6ee61..d2adbd7 100644 --- a/src/test/java/net/pterodactylus/sone/fcp/LockSoneCommandTest.java +++ b/src/test/java/net/pterodactylus/sone/fcp/LockSoneCommandTest.java @@ -54,7 +54,7 @@ public class LockSoneCommandTest { 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()); @@ -71,7 +71,7 @@ public class LockSoneCommandTest { 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) @@ -80,7 +80,7 @@ public class LockSoneCommandTest { SimpleFieldSet fields = new SimpleFieldSetBuilder().get(); LockSoneCommand lockSoneCommand = new LockSoneCommand(core); - lockSoneCommand.execute(fields, null, null); + lockSoneCommand.execute(fields); } } diff --git a/src/test/java/net/pterodactylus/sone/fcp/UnlockSoneCommandTest.java b/src/test/java/net/pterodactylus/sone/fcp/UnlockSoneCommandTest.java index 842d0e8..e33e1bc 100644 --- a/src/test/java/net/pterodactylus/sone/fcp/UnlockSoneCommandTest.java +++ b/src/test/java/net/pterodactylus/sone/fcp/UnlockSoneCommandTest.java @@ -54,7 +54,7 @@ public class UnlockSoneCommandTest { 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()); @@ -71,7 +71,7 @@ public class UnlockSoneCommandTest { 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) @@ -80,7 +80,7 @@ public class UnlockSoneCommandTest { SimpleFieldSet fields = new SimpleFieldSetBuilder().get(); UnlockSoneCommand unlockSoneCommand = new UnlockSoneCommand(core); - unlockSoneCommand.execute(fields, null, null); + unlockSoneCommand.execute(fields); } } diff --git a/src/test/kotlin/net/pterodactylus/sone/fcp/CreatePostCommandTest.kt b/src/test/kotlin/net/pterodactylus/sone/fcp/CreatePostCommandTest.kt index 98b0a67..6d2cc81 100644 --- a/src/test/kotlin/net/pterodactylus/sone/fcp/CreatePostCommandTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/fcp/CreatePostCommandTest.kt @@ -58,7 +58,7 @@ class CreatePostCommandTest : SoneCommandTest() { whenever(core.getSone("LocalSoneId")).thenReturn(of(localSone)) val post = mock().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")) } @@ -78,7 +78,7 @@ class CreatePostCommandTest : SoneCommandTest() { 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()) } @@ -92,7 +92,7 @@ class CreatePostCommandTest : SoneCommandTest() { whenever(core.getSone("RemoteSoneId")).thenReturn(of(remoteSone)) val post = mock().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")) } diff --git a/src/test/kotlin/net/pterodactylus/sone/fcp/CreateReplyCommandTest.kt b/src/test/kotlin/net/pterodactylus/sone/fcp/CreateReplyCommandTest.kt index 1269272..b30b765 100644 --- a/src/test/kotlin/net/pterodactylus/sone/fcp/CreateReplyCommandTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/fcp/CreateReplyCommandTest.kt @@ -81,7 +81,7 @@ class CreateReplyCommandTest : SoneCommandTest() { parameters.putSingle("Text", "Test") val postReply = mock().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")) } diff --git a/src/test/kotlin/net/pterodactylus/sone/fcp/DeletePostCommandTest.kt b/src/test/kotlin/net/pterodactylus/sone/fcp/DeletePostCommandTest.kt index 71e6eee..a2b4198 100644 --- a/src/test/kotlin/net/pterodactylus/sone/fcp/DeletePostCommandTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/fcp/DeletePostCommandTest.kt @@ -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)) - val response = command.execute(parameters, null, null) + val response = command.execute(parameters) 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)) - val response = command.execute(parameters, null, null) + val response = command.execute(parameters) assertThat(response.replyParameters["Message"], equalTo("PostDeleted")) verify(core).deletePost(postFromLocalSone) } diff --git a/src/test/kotlin/net/pterodactylus/sone/fcp/DeleteReplyCommandTest.kt b/src/test/kotlin/net/pterodactylus/sone/fcp/DeleteReplyCommandTest.kt index 0819a60..57c4c30 100644 --- a/src/test/kotlin/net/pterodactylus/sone/fcp/DeleteReplyCommandTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/fcp/DeleteReplyCommandTest.kt @@ -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)) - val response = command.execute(parameters, null, null) + val response = command.execute(parameters) 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)) - val response = command.execute(parameters, null, null) + val response = command.execute(parameters) assertThat(response.replyParameters["Message"], equalTo("ReplyDeleted")) verify(core).deleteReply(localPostReply) } diff --git a/src/test/kotlin/net/pterodactylus/sone/fcp/SoneCommandTest.kt b/src/test/kotlin/net/pterodactylus/sone/fcp/SoneCommandTest.kt index b02aa9e..f34b19c 100644 --- a/src/test/kotlin/net/pterodactylus/sone/fcp/SoneCommandTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/fcp/SoneCommandTest.kt @@ -40,12 +40,12 @@ abstract class SoneCommandTest { protected fun executeCommandAndExpectFcpException() { expectedException.expect(FcpException::class.java) - command.execute(parameters, null, null) + command.execute(parameters) } protected fun requestWithoutAnyParameterResultsInFcpException() { expectedException.expect(FcpException::class.java) - command.execute(parameters, null, null) + command.execute(parameters) } protected fun requestWithEmptySoneParameterResultsInFcpException() {