use of com.radixdlt.sync.messages.remote.SyncRequest in project radixdlt by radixdlt.
the class RemoteSyncServiceTest method when_remote_sync_request_and_unable__then_dont_do_anything.
@Test
public void when_remote_sync_request_and_unable__then_dont_do_anything() {
SyncRequest request = mock(SyncRequest.class);
DtoLedgerProof header = mock(DtoLedgerProof.class);
when(header.getOpaque()).thenReturn(HashUtils.zero256());
when(header.getLedgerHeader()).thenReturn(mock(LedgerHeader.class));
when(header.getSignatures()).thenReturn(mock(TimestampedECDSASignatures.class));
when(request.getHeader()).thenReturn(header);
processor.syncRequestEventProcessor().process(BFTNode.random(), SyncRequest.create(header));
verify(syncResponseDispatcher, never()).dispatch(any(BFTNode.class), any());
}
use of com.radixdlt.sync.messages.remote.SyncRequest in project radixdlt by radixdlt.
the class RemoteSyncServiceTest method when_remote_sync_request__then_process_it.
@Test
public void when_remote_sync_request__then_process_it() {
SyncRequest request = mock(SyncRequest.class);
DtoLedgerProof header = mock(DtoLedgerProof.class);
when(header.getOpaque()).thenReturn(HashUtils.zero256());
when(header.getLedgerHeader()).thenReturn(mock(LedgerHeader.class));
when(header.getSignatures()).thenReturn(mock(TimestampedECDSASignatures.class));
when(request.getHeader()).thenReturn(header);
BFTNode node = mock(BFTNode.class);
VerifiedTxnsAndProof verifiedTxnsAndProof = mock(VerifiedTxnsAndProof.class);
LedgerProof verifiedHeader = mock(LedgerProof.class);
when(verifiedHeader.toDto()).thenReturn(header);
when(verifiedTxnsAndProof.getProof()).thenReturn(verifiedHeader);
when(reader.getNextCommittedTxns(any())).thenReturn(verifiedTxnsAndProof);
processor.syncRequestEventProcessor().process(node, SyncRequest.create(header));
verify(syncResponseDispatcher, times(1)).dispatch(eq(node), any());
}
Aggregations