Use a String instead of a Key for redirects
authorDavid ‘Bombe’ Roden <bombe@freenetproject.org>
Fri, 10 Jul 2015 05:14:54 +0000 (07:14 +0200)
committerDavid ‘Bombe’ Roden <bombe@freenetproject.org>
Fri, 10 Jul 2015 05:15:00 +0000 (07:15 +0200)
src/main/java/net/pterodactylus/fcp/quelaton/ClientPutCommand.java
src/main/java/net/pterodactylus/fcp/quelaton/ClientPutCommandImpl.java
src/test/java/net/pterodactylus/fcp/quelaton/DefaultFcpClientTest.java

index bc8046f..231af10 100644 (file)
@@ -14,7 +14,7 @@ import net.pterodactylus.fcp.Key;
 public interface ClientPutCommand {
 
        ClientPutCommand named(String targetFilename);
-       Keyed<Optional<Key>> redirectTo(Key key);
+       Keyed<Optional<Key>> redirectTo(String uri);
        Keyed<Optional<Key>> from(File file);
        Lengthed<Keyed<Optional<Key>>> from(InputStream inputStream);
 
index eab1632..39d525a 100644 (file)
@@ -54,8 +54,8 @@ class ClientPutCommandImpl implements ClientPutCommand {
        }
 
        @Override
-       public Keyed<Optional<Key>> redirectTo(Key key) {
-               this.redirectUri.set(Objects.requireNonNull(key, "key must not be null").getKey());
+       public Keyed<Optional<Key>> redirectTo(String uri) {
+               this.redirectUri.set(Objects.requireNonNull(uri, "uri must not be null"));
                return this::key;
        }
 
index b547ca7..6af103c 100644 (file)
@@ -365,7 +365,7 @@ public class DefaultFcpClientTest {
        @Test
        public void clientPutWithRedirectSendsCorrectCommand()
        throws IOException, ExecutionException, InterruptedException {
-               fcpClient.clientPut().redirectTo(new Key("KSK@bar.txt")).key(new Key("KSK@foo.txt"));
+               fcpClient.clientPut().redirectTo("KSK@bar.txt").key(new Key("KSK@foo.txt"));
                connectNode();
                List<String> lines = fcpServer.collectUntil(is("EndMessage"));
                assertThat(lines,