use of com.hederahashgraph.api.proto.java.Response in project hedera-services by hashgraph.
the class GetTxnReceiptAnswerTest method getsValidity.
@Test
void getsValidity() {
// given:
Response response = Response.newBuilder().setTransactionGetReceipt(TransactionGetReceiptResponse.newBuilder().setHeader(subject.answerOnlyHeader(RESULT_SIZE_LIMIT_EXCEEDED))).build();
// expect:
assertEquals(RESULT_SIZE_LIMIT_EXCEEDED, subject.extractValidityFrom(response));
}
use of com.hederahashgraph.api.proto.java.Response in project hedera-services by hashgraph.
the class GetTxnReceiptAnswerTest method returnsChildrenIfRequested.
@Test
void returnsChildrenIfRequested() {
// setup:
Query sensibleQuery = queryWith(validTxnId, ANSWER_ONLY, false, true);
var childReceipts = List.of(duplicateReceipt.toGrpc(), unclassifiableReceipt.toGrpc());
given(recordCache.getPriorityReceipt(validTxnId)).willReturn(receipt);
given(recordCache.getChildReceipts(validTxnId)).willReturn(childReceipts);
// when:
Response response = subject.responseGiven(sensibleQuery, view, OK, 0L);
// then:
TransactionGetReceiptResponse opResponse = response.getTransactionGetReceipt();
assertTrue(opResponse.hasHeader(), "Missing response header!");
assertEquals(OK, opResponse.getHeader().getNodeTransactionPrecheckCode());
assertEquals(ANSWER_ONLY, opResponse.getHeader().getResponseType());
assertEquals(receipt.toGrpc(), opResponse.getReceipt());
assertEquals(childReceipts, opResponse.getChildTransactionReceiptsList());
}
use of com.hederahashgraph.api.proto.java.Response in project hedera-services by hashgraph.
the class GetTxnReceiptAnswerTest method rejectsQueryForMissingReceipt.
@Test
void rejectsQueryForMissingReceipt() {
// setup:
Query sensibleQuery = queryWith(validTxnId);
given(recordCache.getPriorityReceipt(validTxnId)).willReturn(null);
// when:
Response response = subject.responseGiven(sensibleQuery, view, OK, 0L);
// then:
TransactionGetReceiptResponse opResponse = response.getTransactionGetReceipt();
assertEquals(RECEIPT_NOT_FOUND, opResponse.getHeader().getNodeTransactionPrecheckCode());
}
use of com.hederahashgraph.api.proto.java.Response in project hedera-services by hashgraph.
the class GetAccountBalanceAnswerTest method requiresOkMetaValidity.
@Test
void requiresOkMetaValidity() {
// setup:
AccountID id = asAccount(accountIdLit);
// given:
CryptoGetAccountBalanceQuery op = CryptoGetAccountBalanceQuery.newBuilder().setAccountID(id).build();
Query query = Query.newBuilder().setCryptogetAccountBalance(op).build();
// when:
Response response = subject.responseGiven(query, view, PLATFORM_NOT_ACTIVE);
ResponseCodeEnum status = response.getCryptogetAccountBalance().getHeader().getNodeTransactionPrecheckCode();
// expect:
assertEquals(PLATFORM_NOT_ACTIVE, status);
assertEquals(id, response.getCryptogetAccountBalance().getAccountID());
}
use of com.hederahashgraph.api.proto.java.Response in project hedera-services by hashgraph.
the class GetAccountBalanceAnswerTest method getsValidity.
@Test
void getsValidity() {
// given:
Response response = Response.newBuilder().setCryptogetAccountBalance(CryptoGetAccountBalanceResponse.newBuilder().setHeader(subject.answerOnlyHeader(RESULT_SIZE_LIMIT_EXCEEDED))).build();
// expect:
assertEquals(RESULT_SIZE_LIMIT_EXCEEDED, subject.extractValidityFrom(response));
}
Aggregations