use of com.hederahashgraph.api.proto.java.Query in project hedera-services by hashgraph.
the class HapiGetAccountRecords method submitWith.
@Override
protected void submitWith(HapiApiSpec spec, Transaction payment) {
Query query = getRecordsQuery(spec, payment, false);
response = spec.clients().getCryptoSvcStub(targetNodeFor(spec), useTls).getAccountRecords(query);
List<TransactionRecord> records = response.getCryptoGetAccountRecords().getRecordsList();
if (verboseLoggingOn) {
if (customLog.isPresent()) {
customLog.get().accept(log, records);
} else {
log.info(records);
}
}
if (snapshotDirPath.isPresent()) {
saveSnapshots(spec, records);
}
if (expectationsDirPath.isPresent()) {
checkExpectations(spec, records);
}
}
use of com.hederahashgraph.api.proto.java.Query in project hedera-services by hashgraph.
the class ContractCallLocalAnswerTest method noCopyPasteErrors.
@Test
void noCopyPasteErrors() throws Throwable {
// given:
Query query = validQuery(COST_ANSWER, fee);
// when:
Response response = subject.responseGiven(query, view, INSUFFICIENT_TX_FEE, fee);
// then:
assertEquals(HederaFunctionality.ContractCallLocal, subject.canonicalFunction());
assertEquals(paymentTxn, subject.extractPaymentFrom(query).get().getSignedTxnWrapper());
assertTrue(subject.needsAnswerOnlyCost(query));
assertFalse(subject.requiresNodePayment(query));
assertEquals(INSUFFICIENT_TX_FEE, subject.extractValidityFrom(response));
}
use of com.hederahashgraph.api.proto.java.Query in project hedera-services by hashgraph.
the class ContractCallLocalAnswerTest method respectsMetaValidity.
@Test
void respectsMetaValidity() throws Throwable {
// given:
Query sensibleQuery = validQuery(ANSWER_ONLY, 5L);
// when:
Response response = subject.responseGiven(sensibleQuery, view, INVALID_TRANSACTION, 0L);
// then:
var opResponse = response.getContractCallLocal();
assertEquals(INVALID_TRANSACTION, opResponse.getHeader().getNodeTransactionPrecheckCode());
}
use of com.hederahashgraph.api.proto.java.Query in project hedera-services by hashgraph.
the class GetBySolidityIdAnswerTest method assertSolidityIDHeadersWhenResponseTypeIsMissing.
@Test
void assertSolidityIDHeadersWhenResponseTypeIsMissing() {
Query query = Query.newBuilder().setGetBySolidityID(getBySolidityIDQueryBuilder.build()).build();
var result = solidityIdAnswer.responseGiven(query, null, null, 0);
assertEquals(ResponseCodeEnum.NOT_SUPPORTED, result.getGetBySolidityID().getHeader().getNodeTransactionPrecheckCode());
}
use of com.hederahashgraph.api.proto.java.Query in project hedera-services by hashgraph.
the class GetBySolidityIdAnswerTest method assertSolidityIDHeadersWhenResponseTypeIsCostAnswer.
@Test
void assertSolidityIDHeadersWhenResponseTypeIsCostAnswer() {
var header = QueryHeader.newBuilder().setResponseType(ResponseType.COST_ANSWER).build();
var getSolidityIdQuery = getBySolidityIDQueryBuilder.setHeader(header).build();
Query query = Query.newBuilder().setGetBySolidityID(getSolidityIdQuery).build();
var result = solidityIdAnswer.responseGiven(query, null, null, 0);
assertEquals(ResponseCodeEnum.NOT_SUPPORTED, result.getGetBySolidityID().getHeader().getNodeTransactionPrecheckCode());
assertEquals(ResponseType.COST_ANSWER, result.getGetBySolidityID().getHeader().getResponseType());
assertEquals(0L, result.getGetBySolidityID().getHeader().getCost());
}
Aggregations