From: David ‘Bombe’ Roden Date: Mon, 13 Jul 2015 18:39:38 +0000 (+0200) Subject: Add test for unknown node identifiers on modify peer command X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=e591c6488b692e3dfcf2efd1905d399f39c6067f;p=jFCPlib.git Add test for unknown node identifiers on modify peer command --- diff --git a/src/test/java/net/pterodactylus/fcp/quelaton/DefaultFcpClientTest.java b/src/test/java/net/pterodactylus/fcp/quelaton/DefaultFcpClientTest.java index cf7a4ae..5979284 100644 --- a/src/test/java/net/pterodactylus/fcp/quelaton/DefaultFcpClientTest.java +++ b/src/test/java/net/pterodactylus/fcp/quelaton/DefaultFcpClientTest.java @@ -1338,6 +1338,29 @@ public class DefaultFcpClientTest { } @Test + public void defaultFcpClientCanNotModifyPeerOfUnknownNode() + throws InterruptedException, ExecutionException, IOException { + Future> peer = fcpClient.modifyPeer().enable().byIdentity("id1").execute(); + connectNode(); + List lines = fcpServer.collectUntil(is("EndMessage")); + String identifier = extractIdentifier(lines); + assertThat(lines, matchesFcpMessage( + "ModifyPeer", + "Identifier=" + identifier, + "NodeIdentifier=id1", + "IsDisabled=false", + "EndMessage" + )); + fcpServer.writeLine( + "UnknownNodeIdentifier", + "Identifier=" + identifier, + "NodeIdentifier=id1", + "EndMessage" + ); + assertThat(peer.get().isPresent(), is(false)); + } + + @Test public void defaultFcpClientCanAllowLocalAddressesOfPeer() throws InterruptedException, ExecutionException, IOException { Future> peer = fcpClient.modifyPeer().allowLocalAddresses().byIdentity("id1").execute();