projects
/
Sone.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
b32c813
)
Remove bucket and access type from command interface
author
David ‘Bombe’ Roden
<bombe@pterodactylus.net>
Sun, 8 Jan 2017 14:57:57 +0000
(15:57 +0100)
committer
David ‘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
patch
|
blob
|
history
src/main/java/net/pterodactylus/sone/fcp/CreateReplyCommand.java
patch
|
blob
|
history
src/main/java/net/pterodactylus/sone/fcp/DeletePostCommand.java
patch
|
blob
|
history
src/main/java/net/pterodactylus/sone/fcp/DeleteReplyCommand.java
patch
|
blob
|
history
src/main/java/net/pterodactylus/sone/fcp/FcpInterface.java
patch
|
blob
|
history
src/main/java/net/pterodactylus/sone/fcp/GetLocalSonesCommand.java
patch
|
blob
|
history
src/main/java/net/pterodactylus/sone/fcp/GetPostCommand.java
patch
|
blob
|
history
src/main/java/net/pterodactylus/sone/fcp/GetPostFeedCommand.java
patch
|
blob
|
history
src/main/java/net/pterodactylus/sone/fcp/GetPostsCommand.java
patch
|
blob
|
history
src/main/java/net/pterodactylus/sone/fcp/GetSoneCommand.java
patch
|
blob
|
history
src/main/java/net/pterodactylus/sone/fcp/GetSonesCommand.java
patch
|
blob
|
history
src/main/java/net/pterodactylus/sone/fcp/LikePostCommand.java
patch
|
blob
|
history
src/main/java/net/pterodactylus/sone/fcp/LikeReplyCommand.java
patch
|
blob
|
history
src/main/java/net/pterodactylus/sone/fcp/LockSoneCommand.java
patch
|
blob
|
history
src/main/java/net/pterodactylus/sone/fcp/UnlockSoneCommand.java
patch
|
blob
|
history
src/main/java/net/pterodactylus/sone/fcp/VersionCommand.java
patch
|
blob
|
history
src/main/java/net/pterodactylus/sone/freenet/fcp/Command.java
patch
|
blob
|
history
src/test/java/net/pterodactylus/sone/fcp/FcpInterfaceTest.kt
patch
|
blob
|
history
src/test/java/net/pterodactylus/sone/fcp/LockSoneCommandTest.java
patch
|
blob
|
history
src/test/java/net/pterodactylus/sone/fcp/UnlockSoneCommandTest.java
patch
|
blob
|
history
src/test/kotlin/net/pterodactylus/sone/fcp/CreatePostCommandTest.kt
patch
|
blob
|
history
src/test/kotlin/net/pterodactylus/sone/fcp/CreateReplyCommandTest.kt
patch
|
blob
|
history
src/test/kotlin/net/pterodactylus/sone/fcp/DeletePostCommandTest.kt
patch
|
blob
|
history
src/test/kotlin/net/pterodactylus/sone/fcp/DeleteReplyCommandTest.kt
patch
|
blob
|
history
src/test/kotlin/net/pterodactylus/sone/fcp/SoneCommandTest.kt
patch
|
blob
|
history
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
(file)
--- 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 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;
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
(file)
--- 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 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");
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
(file)
--- 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 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.");
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
(file)
--- 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 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.");
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
(file)
--- 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 {
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);
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
(file)
--- 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 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."));
}
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
(file)
--- 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 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);
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
(file)
--- 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 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);
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
(file)
--- 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 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);
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
(file)
--- 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 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));
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
(file)
--- 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 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());
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
(file)
--- 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 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());
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
(file)
--- 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 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());
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
(file)
--- 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 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());
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
(file)
--- 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 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());
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
(file)
--- 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 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());
}
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
(file)
--- 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 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.
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
(file)
--- 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<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> {
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
(file)
--- 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);
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);
}
}
}
}
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
(file)
--- 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);
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);
}
}
}
}
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
(file)
--- 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<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"))
}
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
(file)
--- 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<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"))
}
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
(file)
--- 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))
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)
}
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
(file)
--- 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))
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)
}
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
(file)
--- 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)
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() {