use of org.hyperledger.besu.ethereum.p2p.discovery.internal.PeerTable.EvictResult in project besu by hyperledger.
the class PeerTableTest method evictPeerFromEmptyTableShouldNotEvict.
@Test
public void evictPeerFromEmptyTableShouldNotEvict() {
final PeerTable table = new PeerTable(Peer.randomId(), 16);
final DiscoveryPeer peer = helper.createDiscoveryPeer();
final EvictResult evictResult = table.tryEvict(peer);
assertThat(evictResult.getOutcome()).isEqualTo(EvictOutcome.ABSENT);
}
use of org.hyperledger.besu.ethereum.p2p.discovery.internal.PeerTable.EvictResult in project besu by hyperledger.
the class PeerTableTest method evictAbsentPeerShouldNotEvict.
@Test
public void evictAbsentPeerShouldNotEvict() {
final PeerTable table = new PeerTable(Peer.randomId(), 16);
final DiscoveryPeer peer = helper.createDiscoveryPeer();
final List<DiscoveryPeer> otherPeers = helper.createDiscoveryPeers(5);
otherPeers.forEach(table::tryAdd);
final EvictResult evictResult = table.tryEvict(peer);
assertThat(evictResult.getOutcome()).isEqualTo(EvictOutcome.ABSENT);
}
use of org.hyperledger.besu.ethereum.p2p.discovery.internal.PeerTable.EvictResult in project besu by hyperledger.
the class PeerTableTest method evictSelfPeerShouldReturnSelfOutcome.
@Test
public void evictSelfPeerShouldReturnSelfOutcome() {
final DiscoveryPeer peer = helper.createDiscoveryPeer();
final PeerTable table = new PeerTable(peer.getId(), 16);
final EvictResult evictResult = table.tryEvict(peer);
assertThat(evictResult.getOutcome()).isEqualTo(EvictOutcome.SELF);
}
use of org.hyperledger.besu.ethereum.p2p.discovery.internal.PeerTable.EvictResult in project besu by hyperledger.
the class PeerTableTest method evictExistingPeerShouldEvict.
@Test
public void evictExistingPeerShouldEvict() {
final PeerTable table = new PeerTable(Peer.randomId(), 16);
final DiscoveryPeer peer = helper.createDiscoveryPeer();
table.tryAdd(peer);
final EvictResult evictResult = table.tryEvict(peer);
assertThat(evictResult.getOutcome()).isEqualTo(EvictOutcome.EVICTED);
}
Aggregations