return this::execute;
}
+ @Override
+ public Executable<Boolean> byIdentifier(String identifier) {
+ nodeIdentifier.set(identifier);
+ return this::execute;
+ }
+
private ListenableFuture<Boolean> execute() {
if (darknetComment.get() == null) {
return Futures.immediateFuture(false);
assertThat(noteUpdated.get(), is(false));
}
+ @Test
+ public void defaultFcpClientCanModifyPeerNoteByIdentifier()
+ throws InterruptedException, ExecutionException, IOException {
+ Future<Boolean> noteUpdated = fcpClient.modifyPeerNote().darknetComment("foo").byIdentifier("id1").execute();
+ connectNode();
+ List<String> lines = fcpServer.collectUntil(is("EndMessage"));
+ String identifier = extractIdentifier(lines);
+ assertThat(lines, matchesFcpMessage(
+ "ModifyPeerNote",
+ "Identifier=" + identifier,
+ "NodeIdentifier=id1",
+ "PeerNoteType=1",
+ "NoteText=Zm9v",
+ "EndMessage"
+ ));
+ fcpServer.writeLine(
+ "PeerNote",
+ "Identifier=" + identifier,
+ "NodeIdentifier=id1",
+ "NoteText=Zm9v",
+ "PeerNoteType=1",
+ "EndMessage"
+ );
+ assertThat(noteUpdated.get(), is(true));
+ }
+
}