return this::execute;
}
+ @Override
+ public Executable<Optional<Peer>> byIdentity(String nodeIdentity) {
+ nodeIdentifier.set(nodeIdentity);
+ return this::execute;
+ }
+
private ListenableFuture<Optional<Peer>> execute() {
return threadPool.submit(this::executeSequence);
}
assertThat(peer.get().get().getIdentity(), is("id1"));
}
+ @Test
+ public void defaultFcpClientCanEnablePeerByIdentity() throws InterruptedException, ExecutionException, IOException {
+ Future<Optional<Peer>> peer = fcpClient.modifyPeer().enable().byIdentity("id1").execute();
+ connectNode();
+ List<String> lines = fcpServer.collectUntil(is("EndMessage"));
+ String identifier = extractIdentifier(lines);
+ assertThat(lines, matchesFcpMessage(
+ "ModifyPeer",
+ "Identifier=" + identifier,
+ "NodeIdentifier=id1",
+ "IsDisabled=false",
+ "EndMessage"
+ ));
+ fcpServer.writeLine(
+ "Peer",
+ "Identifier=" + identifier,
+ "NodeIdentifier=Friend1",
+ "identity=id1",
+ "EndMessage"
+ );
+ assertThat(peer.get().get().getIdentity(), is("id1"));
+ }
+
}