use of com.hedera.hashgraph.sdk.proto.ResponseCodeEnum in project hedera-sdk-java by hashgraph.
the class StatusTest method statusToResponseCode.
@Test
@DisplayName("Status can be constructed from any ResponseCode")
void statusToResponseCode() {
for (ResponseCodeEnum code : ResponseCodeEnum.values()) {
// this is what we're given if an unexpected value was decoded
if (code == ResponseCodeEnum.UNRECOGNIZED) {
continue;
}
Status status = Status.valueOf(code);
assertThat(code.getNumber()).isEqualTo(status.code.getNumber());
}
}
use of com.hedera.hashgraph.sdk.proto.ResponseCodeEnum in project hedera-mirror-node by hashgraph.
the class TransactionPublisherTest method publishRetrySameRequest.
@Test
@Timeout(3)
void publishRetrySameRequest() {
ResponseCodeEnum errorResponseCode = ResponseCodeEnum.PLATFORM_NOT_ACTIVE;
cryptoServiceStub.addTransactions(Mono.just(response(errorResponseCode)), Mono.just(response(errorResponseCode)));
var request = request().build();
transactionPublisher.publish(request).as(StepVerifier::create).expectErrorSatisfies(t -> assertThat(t).isInstanceOf(PublishException.class).hasMessageContaining("exceeded maximum attempts for request with last exception being").getRootCause().hasMessageContaining(errorResponseCode.toString())).verify(Duration.ofSeconds(2L));
cryptoServiceStub.addTransactions(Mono.just(response(OK)));
transactionPublisher.publish(request).as(StepVerifier::create).expectNextCount(1L).expectComplete().verify(Duration.ofSeconds(1L));
}
use of com.hedera.hashgraph.sdk.proto.ResponseCodeEnum in project hedera-mirror-node by hashgraph.
the class TransactionPublisherTest method publishPreCheckError.
@Test
@Timeout(3)
void publishPreCheckError() {
ResponseCodeEnum errorResponseCode = ResponseCodeEnum.INSUFFICIENT_ACCOUNT_BALANCE;
cryptoServiceStub.addTransactions(Mono.just(response(errorResponseCode)));
transactionPublisher.publish(request().build()).as(StepVerifier::create).expectErrorSatisfies(t -> assertThat(t).isInstanceOf(PublishException.class).hasMessageContaining(errorResponseCode.toString())).verify(Duration.ofSeconds(1L));
}
use of com.hedera.hashgraph.sdk.proto.ResponseCodeEnum in project hedera-mirror-node by hashgraph.
the class TransactionPublisherTest method publishRetryError.
@Test
@Timeout(3)
void publishRetryError() {
ResponseCodeEnum errorResponseCode = ResponseCodeEnum.PLATFORM_TRANSACTION_NOT_CREATED;
cryptoServiceStub.addTransactions(Mono.just(response(errorResponseCode)), Mono.just(response(errorResponseCode)));
transactionPublisher.publish(request().build()).as(StepVerifier::create).expectErrorSatisfies(t -> assertThat(t).isInstanceOf(PublishException.class).hasMessageContaining("exceeded maximum attempts for request with last exception being").getRootCause().hasMessageContaining(errorResponseCode.toString())).verify(Duration.ofSeconds(2L));
}
Aggregations