use of org.hyperledger.besu.ethereum.p2p.permissions.PeerPermissions.Action in project besu by hyperledger.
the class PeerPermissionsAdapterTest method allowOutboundBonding_outOfSyncRemoteIsABootnode.
@Test
public void allowOutboundBonding_outOfSyncRemoteIsABootnode() {
mockSyncStatusNodePermissioning(true, false);
bootNodes.add(remoteNode.getEnodeURL());
final Action action = Action.DISCOVERY_ALLOW_OUTBOUND_BONDING;
mockControllerPermissions(true, false);
assertThat(adapter.isPermitted(localNode, remoteNode, action)).isTrue();
mockControllerPermissions(false, true);
assertThat(adapter.isPermitted(localNode, remoteNode, action)).isFalse();
mockControllerPermissions(true, true);
assertThat(adapter.isPermitted(localNode, remoteNode, action)).isTrue();
mockControllerPermissions(false, false);
assertThat(adapter.isPermitted(localNode, remoteNode, action)).isFalse();
}
use of org.hyperledger.besu.ethereum.p2p.permissions.PeerPermissions.Action in project besu by hyperledger.
the class PeerPermissionsAdapterTest method allowOutboundNeighborsRequest_inSyncRemoteIsBootnode.
@Test
public void allowOutboundNeighborsRequest_inSyncRemoteIsBootnode() {
mockSyncStatusNodePermissioning(true, true);
bootNodes.add(remoteNode.getEnodeURL());
final Action action = Action.DISCOVERY_ALLOW_OUTBOUND_NEIGHBORS_REQUEST;
mockControllerPermissions(true, false);
assertThat(adapter.isPermitted(localNode, remoteNode, action)).isTrue();
mockControllerPermissions(false, true);
assertThat(adapter.isPermitted(localNode, remoteNode, action)).isFalse();
mockControllerPermissions(true, true);
assertThat(adapter.isPermitted(localNode, remoteNode, action)).isTrue();
mockControllerPermissions(false, false);
assertThat(adapter.isPermitted(localNode, remoteNode, action)).isFalse();
}
use of org.hyperledger.besu.ethereum.p2p.permissions.PeerPermissions.Action in project besu by hyperledger.
the class PeerPermissionsAdapterTest method allowRemotelyInitiatedConnection.
@Test
public void allowRemotelyInitiatedConnection() {
final Action action = Action.RLPX_ALLOW_NEW_INBOUND_CONNECTION;
mockControllerPermissions(true, false);
assertThat(adapter.isPermitted(localNode, remoteNode, action)).isFalse();
mockControllerPermissions(false, true);
assertThat(adapter.isPermitted(localNode, remoteNode, action)).isTrue();
mockControllerPermissions(true, true);
assertThat(adapter.isPermitted(localNode, remoteNode, action)).isTrue();
mockControllerPermissions(false, false);
assertThat(adapter.isPermitted(localNode, remoteNode, action)).isFalse();
}
use of org.hyperledger.besu.ethereum.p2p.permissions.PeerPermissions.Action in project besu by hyperledger.
the class PeerPermissionsAdapterTest method allowOutboundNeighborsRequest_inSyncRemoteIsNotABootnode.
@Test
public void allowOutboundNeighborsRequest_inSyncRemoteIsNotABootnode() {
mockSyncStatusNodePermissioning(true, true);
final Action action = Action.DISCOVERY_ALLOW_OUTBOUND_NEIGHBORS_REQUEST;
mockControllerPermissions(true, false);
assertThat(adapter.isPermitted(localNode, remoteNode, action)).isTrue();
mockControllerPermissions(false, true);
assertThat(adapter.isPermitted(localNode, remoteNode, action)).isFalse();
mockControllerPermissions(true, true);
assertThat(adapter.isPermitted(localNode, remoteNode, action)).isTrue();
mockControllerPermissions(false, false);
assertThat(adapter.isPermitted(localNode, remoteNode, action)).isFalse();
}
use of org.hyperledger.besu.ethereum.p2p.permissions.PeerPermissions.Action in project besu by hyperledger.
the class PeerPermissionsAdapterTest method allowOutboundNeighborsRequest_outOfSyncRemoteIsABootnode.
@Test
public void allowOutboundNeighborsRequest_outOfSyncRemoteIsABootnode() {
mockSyncStatusNodePermissioning(true, false);
bootNodes.add(remoteNode.getEnodeURL());
final Action action = Action.DISCOVERY_ALLOW_OUTBOUND_NEIGHBORS_REQUEST;
mockControllerPermissions(true, false);
assertThat(adapter.isPermitted(localNode, remoteNode, action)).isFalse();
mockControllerPermissions(false, true);
assertThat(adapter.isPermitted(localNode, remoteNode, action)).isFalse();
mockControllerPermissions(true, true);
assertThat(adapter.isPermitted(localNode, remoteNode, action)).isFalse();
mockControllerPermissions(false, false);
assertThat(adapter.isPermitted(localNode, remoteNode, action)).isFalse();
}
Aggregations