Fixed yet another test
This commit is contained in:
parent
05d9ea93d2
commit
a67ac27921
@ -69,7 +69,7 @@ public class BitmessageContext {
|
|||||||
private BitmessageContext(Builder builder) {
|
private BitmessageContext(Builder builder) {
|
||||||
ctx = new InternalContext(builder);
|
ctx = new InternalContext(builder);
|
||||||
labeler = builder.labeler;
|
labeler = builder.labeler;
|
||||||
ctx.getProofOfWorkService().doMissingProofOfWork();
|
ctx.getProofOfWorkService().doMissingProofOfWork(30_000); // TODO: this should be configurable
|
||||||
|
|
||||||
networkListener = new DefaultMessageListener(ctx, labeler, builder.listener);
|
networkListener = new DefaultMessageListener(ctx, labeler, builder.listener);
|
||||||
sendPubkeyOnIdentityCreation = builder.sendPubkeyOnIdentityCreation;
|
sendPubkeyOnIdentityCreation = builder.sendPubkeyOnIdentityCreation;
|
||||||
|
@ -30,7 +30,7 @@ public class ProofOfWorkService implements ProofOfWorkEngine.Callback, InternalC
|
|||||||
private ProofOfWorkRepository powRepo;
|
private ProofOfWorkRepository powRepo;
|
||||||
private MessageRepository messageRepo;
|
private MessageRepository messageRepo;
|
||||||
|
|
||||||
public void doMissingProofOfWork() {
|
public void doMissingProofOfWork(long delayInMilliseconds) {
|
||||||
final List<byte[]> items = powRepo.getItems();
|
final List<byte[]> items = powRepo.getItems();
|
||||||
if (items.isEmpty()) return;
|
if (items.isEmpty()) return;
|
||||||
|
|
||||||
@ -45,7 +45,7 @@ public class ProofOfWorkService implements ProofOfWorkEngine.Callback, InternalC
|
|||||||
ProofOfWorkService.this);
|
ProofOfWorkService.this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, 30_000);
|
}, delayInMilliseconds);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void doProofOfWork(ObjectMessage object) {
|
public void doProofOfWork(ObjectMessage object) {
|
||||||
|
@ -77,9 +77,9 @@ public class ProofOfWorkServiceTest {
|
|||||||
when(proofOfWorkRepo.getItem(any(byte[].class))).thenReturn(new ProofOfWorkRepository.Item(null, 1001, 1002));
|
when(proofOfWorkRepo.getItem(any(byte[].class))).thenReturn(new ProofOfWorkRepository.Item(null, 1001, 1002));
|
||||||
doNothing().when(cryptography).doProofOfWork(any(ObjectMessage.class), anyLong(), anyLong(), any(ProofOfWorkEngine.Callback.class));
|
doNothing().when(cryptography).doProofOfWork(any(ObjectMessage.class), anyLong(), anyLong(), any(ProofOfWorkEngine.Callback.class));
|
||||||
|
|
||||||
proofOfWorkService.doMissingProofOfWork();
|
proofOfWorkService.doMissingProofOfWork(10);
|
||||||
|
|
||||||
verify(cryptography).doProofOfWork((ObjectMessage) isNull(), eq(1001L), eq(1002L),
|
verify(cryptography, timeout(1000)).doProofOfWork((ObjectMessage) isNull(), eq(1001L), eq(1002L),
|
||||||
any(ProofOfWorkEngine.Callback.class));
|
any(ProofOfWorkEngine.Callback.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user