}
@Override
- public Keyed<Optional<Key>> redirectTo(Key key) {
- this.redirectUri.set(Objects.requireNonNull(key, "key must not be null").getKey());
+ public WithUri<Optional<Key>> redirectTo(String uri) {
+ this.redirectUri.set(Objects.requireNonNull(uri, "uri must not be null"));
return this::key;
}
@Override
- public Keyed<Optional<Key>> from(File file) {
+ public WithUri<Optional<Key>> from(File file) {
this.file.set(Objects.requireNonNull(file, "file must not be null"));
return this::key;
}
@Override
- public Lengthed<Keyed<Optional<Key>>> from(InputStream inputStream) {
+ public WithLength<WithUri<Optional<Key>>> from(InputStream inputStream) {
payload.set(Objects.requireNonNull(inputStream, "inputStream must not be null"));
return this::length;
}
- private Keyed<Optional<Key>> length(long length) {
+ private WithUri<Optional<Key>> length(long length) {
this.length.set(length);
return this::key;
}
- private ListenableFuture<Optional<Key>> key(Key key) {
+ private ListenableFuture<Optional<Key>> key(String uri) {
String identifier = new RandomIdentifierGenerator().generate();
- ClientPut clientPut = createClientPutCommand(key.getKey(), identifier);
+ ClientPut clientPut = createClientPutCommand(uri, identifier);
return threadPool.submit(() -> new ClientPutReplySequence().send(clientPut).get());
}
String readContent = Files.readAllLines(new File(testDDAReply.getReadFilename()).toPath()).get(0);
sendMessage(new TestDDAResponse(directory.get(), readContent));
} catch (IOException e) {
- e.printStackTrace();
sendMessage(new TestDDAResponse(directory.get(), "failed-to-read"));
}
}