Search in sources :

Example 1 with MirrorTransaction

use of com.hedera.mirror.monitor.subscribe.rest.response.MirrorTransaction in project hedera-mirror-node by hashgraph.

the class RestSubscriberTest method response.

private Mono<ClientResponse> response(HttpStatus httpStatus) {
    if (!httpStatus.is2xxSuccessful()) {
        return Mono.defer(() -> Mono.error(WebClientResponseException.create(httpStatus.value(), "", HttpHeaders.EMPTY, null, null)));
    }
    MirrorTransaction mirrorTransaction = new MirrorTransaction();
    mirrorTransaction.setConsensusTimestamp(Instant.now());
    mirrorTransaction.setName(TransactionType.CONSENSUS_SUBMIT_MESSAGE);
    mirrorTransaction.setResult("SUCCESS");
    mirrorTransaction.setValidStartTimestamp(Instant.now().minusSeconds(1L));
    try {
        String json = OBJECT_MAPPER.writeValueAsString(mirrorTransaction);
        return Mono.just(ClientResponse.create(httpStatus).header("Content-Type", "application/json").body(json).build());
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
Also used : MirrorTransaction(com.hedera.mirror.monitor.subscribe.rest.response.MirrorTransaction) IOException(java.io.IOException) WebClientResponseException(org.springframework.web.reactive.function.client.WebClientResponseException)

Aggregations

MirrorTransaction (com.hedera.mirror.monitor.subscribe.rest.response.MirrorTransaction)1 IOException (java.io.IOException)1 WebClientResponseException (org.springframework.web.reactive.function.client.WebClientResponseException)1