use of com.radixdlt.api.core.openapitools.model.PartialStateIdentifier in project radixdlt by radixdlt.
the class TransactionsHandlerTest method retrieving_illegal_state_version_should_throw_exception.
@Test
public void retrieving_illegal_state_version_should_throw_exception() throws Exception {
// Arrange
start();
// Act
var request = new CommittedTransactionsRequest().networkIdentifier(new NetworkIdentifier().network("localnet")).limit(1L).stateIdentifier(new PartialStateIdentifier().stateVersion(-1L));
var response = handleRequestWithExpectedResponse(sut, request, UnexpectedError.class);
// Assert
assertThat(response.getDetails()).isInstanceOf(InvalidPartialStateIdentifierError.class);
}
use of com.radixdlt.api.core.openapitools.model.PartialStateIdentifier in project radixdlt by radixdlt.
the class TransactionsHandlerTest method retrieve_last_state_version.
@Test
public void retrieve_last_state_version() throws Exception {
// Arrange
start();
// Act
var request = new CommittedTransactionsRequest().networkIdentifier(new NetworkIdentifier().network("localnet")).limit(1L).stateIdentifier(new PartialStateIdentifier().stateVersion(1L));
var response = handleRequestWithExpectedResponse(sut, request, CommittedTransactionsResponse.class);
// Assert
assertThat(response.getTransactions()).isEmpty();
var stateAccumulator = response.getStateIdentifier().getTransactionAccumulator();
var genesisAccumulator = genesis.getProof().getAccumulatorState().getAccumulatorHash().asBytes();
assertThat(stateAccumulator).isEqualTo(Bytes.toHexString(genesisAccumulator));
}
use of com.radixdlt.api.core.openapitools.model.PartialStateIdentifier in project radixdlt by radixdlt.
the class TransactionsHandlerTest method retrieve_genesis_in_transaction_stream.
@Test
public void retrieve_genesis_in_transaction_stream() throws Exception {
// Arrange
start();
// Act
var request = new CommittedTransactionsRequest().networkIdentifier(new NetworkIdentifier().network("localnet")).limit(1L).stateIdentifier(new PartialStateIdentifier().stateVersion(0L));
var response = handleRequestWithExpectedResponse(sut, request, CommittedTransactionsResponse.class);
// Assert
assertThat(response.getTransactions()).hasSize(1);
var hex = response.getTransactions().get(0).getMetadata().getHex();
assertThat(hex).isEqualTo(Bytes.toHexString(genesis.getTxns().get(0).getPayload()));
}
use of com.radixdlt.api.core.openapitools.model.PartialStateIdentifier in project radixdlt by radixdlt.
the class TransactionsHandlerTest method retrieving_past_last_state_version_should_throw_exception.
@Test
public void retrieving_past_last_state_version_should_throw_exception() throws Exception {
// Arrange
start();
// Act
var request = new CommittedTransactionsRequest().networkIdentifier(new NetworkIdentifier().network("localnet")).limit(1L).stateIdentifier(new PartialStateIdentifier().stateVersion(2L));
var response = handleRequestWithExpectedResponse(sut, request, UnexpectedError.class);
// Assert
assertThat(response.getDetails()).isInstanceOf(StateIdentifierNotFoundError.class);
}
Aggregations