use of com.radixdlt.engine.RadixEngine in project radixdlt by radixdlt.
the class InMemorySystemInfoTest method if_validator_data_missing_then_retrieved_via_radix_engine.
@Test
public void if_validator_data_missing_then_retrieved_via_radix_engine() {
var self = BFTNode.random();
var radixEngine = TypedMocks.cmock(new TypeLiteral<RadixEngine<LedgerAndBFTProof>>() {
});
var systemInfo = new InMemorySystemInfo(null, null, self, radixEngine);
var validatorBFTData = Optional.of(new ValidatorBFTDataEvent(self.getKey(), 10, 1));
when(radixEngine.read(any())).thenReturn(validatorBFTData);
var result = systemInfo.getValidatorBFTData();
var expected = Optional.of(new ValidatorBFTDataEvent(self.getKey(), 10, 1));
assertEquals(expected, result);
}
use of com.radixdlt.engine.RadixEngine in project radixdlt by radixdlt.
the class InMemorySystemInfoTest method radix_engine_is_not_invoked_on_subsequent_request.
@Test
public void radix_engine_is_not_invoked_on_subsequent_request() {
var self = BFTNode.random();
var radixEngine = TypedMocks.cmock(new TypeLiteral<RadixEngine<LedgerAndBFTProof>>() {
});
var systemInfo = new InMemorySystemInfo(null, null, self, radixEngine);
var validatorBFTData = Optional.of(new ValidatorBFTDataEvent(self.getKey(), 10, 1));
System.out.println(new TxAction.CreateSystem(1L));
when(radixEngine.read(any())).thenReturn(validatorBFTData);
var result1 = systemInfo.getValidatorBFTData();
var expected = Optional.of(new ValidatorBFTDataEvent(self.getKey(), 10, 1));
assertEquals(expected, result1);
var result2 = systemInfo.getValidatorBFTData();
assertEquals(result1, result2);
verify(radixEngine).read(any());
}
use of com.radixdlt.engine.RadixEngine in project radixdlt by radixdlt.
the class InMemorySystemInfoTest method if_validator_data_present_then_radix_engine_is_not_invoked.
@Test
public void if_validator_data_present_then_radix_engine_is_not_invoked() {
var self = BFTNode.random();
var radixEngine = TypedMocks.cmock(new TypeLiteral<RadixEngine<LedgerAndBFTProof>>() {
});
var systemInfo = new InMemorySystemInfo(null, null, self, radixEngine);
systemInfo.ledgerUpdateEventProcessor().process(createLedgerUpdate(self));
var result = systemInfo.getValidatorBFTData();
var expected = Optional.of(new ValidatorBFTDataEvent(self.getKey(), 10, 1));
assertEquals(expected, result);
verifyNoInteractions(radixEngine);
}
Aggregations