use of com.hederahashgraph.api.proto.java.Response in project hedera-services by hashgraph.
the class GetContractInfoAnswerTest method recognizesMissingInfoWhenCtxGiven.
@Test
void recognizesMissingInfoWhenCtxGiven() throws Throwable {
// setup:
Query sensibleQuery = validQuery(ANSWER_ONLY, 5L, target);
// when:
Response response = subject.responseGiven(sensibleQuery, view, OK, 0L, Collections.emptyMap());
// then:
ContractGetInfoResponse opResponse = response.getContractGetInfo();
assertTrue(opResponse.hasHeader(), "Missing response header!");
assertEquals(INVALID_CONTRACT_ID, opResponse.getHeader().getNodeTransactionPrecheckCode());
verify(view, never()).infoForContract(any(), any());
}
use of com.hederahashgraph.api.proto.java.Response in project hedera-services by hashgraph.
the class GetContractInfoAnswerTest method getsValidity.
@Test
void getsValidity() {
// given:
Response response = Response.newBuilder().setContractGetInfo(ContractGetInfoResponse.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 GetContractInfoAnswerTest method getsCostAnswerResponse.
@Test
void getsCostAnswerResponse() throws Throwable {
// setup:
Query query = validQuery(COST_ANSWER, fee, target);
// when:
Response response = subject.responseGiven(query, view, OK, fee);
// then:
assertTrue(response.hasContractGetInfo());
assertEquals(OK, response.getContractGetInfo().getHeader().getNodeTransactionPrecheckCode());
assertEquals(COST_ANSWER, response.getContractGetInfo().getHeader().getResponseType());
assertEquals(fee, response.getContractGetInfo().getHeader().getCost());
}
use of com.hederahashgraph.api.proto.java.Response in project hedera-services by hashgraph.
the class GetMerkleTopicInfoAnswerTest method requiresOkMetaValidity.
@Test
void requiresOkMetaValidity() {
// setup:
TopicID id = asTopic(idLit);
// given:
ConsensusGetTopicInfoQuery op = ConsensusGetTopicInfoQuery.newBuilder().setTopicID(id).build();
Query query = Query.newBuilder().setConsensusGetTopicInfo(op).build();
// when:
Response response = subject.responseGiven(query, view, PLATFORM_NOT_ACTIVE);
ResponseCodeEnum status = response.getConsensusGetTopicInfo().getHeader().getNodeTransactionPrecheckCode();
// expect:
assertEquals(PLATFORM_NOT_ACTIVE, status);
assertEquals(id, response.getConsensusGetTopicInfo().getTopicID());
}
use of com.hederahashgraph.api.proto.java.Response in project hedera-services by hashgraph.
the class GetMerkleTopicInfoAnswerTest method failsAsExpectedWhenFetchingMissingTopicInfo.
@Test
void failsAsExpectedWhenFetchingMissingTopicInfo() throws Throwable {
given(topics.get(key)).willReturn(null);
Query query = validQuery(ANSWER_ONLY, fee, target);
Response response = subject.responseGiven(query, view, OK, fee);
assertTrue(response.hasConsensusGetTopicInfo());
assertEquals(INVALID_TOPIC_ID, response.getConsensusGetTopicInfo().getHeader().getNodeTransactionPrecheckCode());
}
Aggregations