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);
}
}
Aggregations