|
|
@ -91,6 +91,35 @@ public class AdminAddPeerTest { |
|
|
|
assertThat(actualResponse).isEqualToComparingFieldByField(expectedResponse); |
|
|
|
assertThat(actualResponse).isEqualToComparingFieldByField(expectedResponse); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
|
|
|
public void requestRefusesListOfNodes() { |
|
|
|
|
|
|
|
final JsonRpcRequest request = |
|
|
|
|
|
|
|
new JsonRpcRequest( |
|
|
|
|
|
|
|
"2.0", |
|
|
|
|
|
|
|
"admin_addPeer", |
|
|
|
|
|
|
|
new String[] { |
|
|
|
|
|
|
|
"enode://" |
|
|
|
|
|
|
|
+ "00000000000000000000000000000000" |
|
|
|
|
|
|
|
+ "00000000000000000000000000000000" |
|
|
|
|
|
|
|
+ "00000000000000000000000000000000" |
|
|
|
|
|
|
|
+ "00000000000000000000000000000000" |
|
|
|
|
|
|
|
+ "@127.0.0.1:30303", |
|
|
|
|
|
|
|
"enode://" |
|
|
|
|
|
|
|
+ "00000000000000000000000000000000" |
|
|
|
|
|
|
|
+ "00000000000000000000000000000000" |
|
|
|
|
|
|
|
+ "00000000000000000000000000000000" |
|
|
|
|
|
|
|
+ "00000000000000000000000000000001" |
|
|
|
|
|
|
|
+ "@127.0.0.2:30303" |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
final JsonRpcResponse expectedResponse = |
|
|
|
|
|
|
|
new JsonRpcErrorResponse(request.getId(), JsonRpcError.INVALID_PARAMS); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
final JsonRpcResponse actualResponse = method.response(request); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assertThat(actualResponse).isEqualToComparingFieldByField(expectedResponse); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void requestReturnsFalseIfAddFails() { |
|
|
|
public void requestReturnsFalseIfAddFails() { |
|
|
|
when(p2pNetwork.addMaintainConnectionPeer(any())).thenReturn(false); |
|
|
|
when(p2pNetwork.addMaintainConnectionPeer(any())).thenReturn(false); |
|
|
|