Search in sources :

Example 21 with ResponseCodeEnum

use of com.hederahashgraph.api.proto.java.ResponseCodeEnum in project hedera-services by hashgraph.

the class GetContractInfoAnswerTest method returnsInvalidContractIdFromValidator.

@Test
void returnsInvalidContractIdFromValidator() throws Throwable {
    // setup:
    Query query = validQuery(COST_ANSWER, fee, target);
    given(optionValidator.queryableContractStatus(asContract(target), contracts)).willReturn(INVALID_CONTRACT_ID);
    given(view.contracts()).willReturn(contracts);
    // when:
    ResponseCodeEnum validity = subject.checkValidity(query, view);
    // then:
    assertEquals(INVALID_CONTRACT_ID, validity);
}
Also used : ResponseCodeEnum(com.hederahashgraph.api.proto.java.ResponseCodeEnum) Query(com.hederahashgraph.api.proto.java.Query) ContractGetInfoQuery(com.hederahashgraph.api.proto.java.ContractGetInfoQuery) Test(org.junit.jupiter.api.Test)

Example 22 with ResponseCodeEnum

use of com.hederahashgraph.api.proto.java.ResponseCodeEnum in project hedera-services by hashgraph.

the class GetMerkleTopicInfoAnswerTest method syntaxCheckValidatesTidIfPresent.

@Test
void syntaxCheckValidatesTidIfPresent() {
    // setup:
    TopicID tid = asTopic(idLit);
    // given:
    ConsensusGetTopicInfoQuery op = ConsensusGetTopicInfoQuery.newBuilder().setTopicID(tid).build();
    Query query = Query.newBuilder().setConsensusGetTopicInfo(op).build();
    // and:
    given(optionValidator.queryableTopicStatus(tid, topics)).willReturn(TOPIC_EXPIRED);
    // when:
    ResponseCodeEnum status = subject.checkValidity(query, view);
    // expect:
    assertEquals(TOPIC_EXPIRED, status);
}
Also used : ConsensusGetTopicInfoQuery(com.hederahashgraph.api.proto.java.ConsensusGetTopicInfoQuery) ResponseCodeEnum(com.hederahashgraph.api.proto.java.ResponseCodeEnum) Query(com.hederahashgraph.api.proto.java.Query) ConsensusGetTopicInfoQuery(com.hederahashgraph.api.proto.java.ConsensusGetTopicInfoQuery) TopicID(com.hederahashgraph.api.proto.java.TopicID) Test(org.junit.jupiter.api.Test)

Example 23 with ResponseCodeEnum

use of com.hederahashgraph.api.proto.java.ResponseCodeEnum in project hedera-services by hashgraph.

the class GetMerkleTopicInfoAnswerTest method syntaxCheckRequiresId.

@Test
void syntaxCheckRequiresId() {
    // given:
    ConsensusGetTopicInfoQuery op = ConsensusGetTopicInfoQuery.newBuilder().build();
    Query query = Query.newBuilder().setConsensusGetTopicInfo(op).build();
    // when:
    ResponseCodeEnum status = subject.checkValidity(query, view);
    // expect:
    assertEquals(INVALID_TOPIC_ID, status);
}
Also used : ConsensusGetTopicInfoQuery(com.hederahashgraph.api.proto.java.ConsensusGetTopicInfoQuery) ResponseCodeEnum(com.hederahashgraph.api.proto.java.ResponseCodeEnum) Query(com.hederahashgraph.api.proto.java.Query) ConsensusGetTopicInfoQuery(com.hederahashgraph.api.proto.java.ConsensusGetTopicInfoQuery) Test(org.junit.jupiter.api.Test)

Example 24 with ResponseCodeEnum

use of com.hederahashgraph.api.proto.java.ResponseCodeEnum 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());
}
Also used : ConsensusGetTopicInfoQuery(com.hederahashgraph.api.proto.java.ConsensusGetTopicInfoQuery) Response(com.hederahashgraph.api.proto.java.Response) ConsensusGetTopicInfoResponse(com.hederahashgraph.api.proto.java.ConsensusGetTopicInfoResponse) ResponseCodeEnum(com.hederahashgraph.api.proto.java.ResponseCodeEnum) Query(com.hederahashgraph.api.proto.java.Query) ConsensusGetTopicInfoQuery(com.hederahashgraph.api.proto.java.ConsensusGetTopicInfoQuery) TopicID(com.hederahashgraph.api.proto.java.TopicID) Test(org.junit.jupiter.api.Test)

Example 25 with ResponseCodeEnum

use of com.hederahashgraph.api.proto.java.ResponseCodeEnum in project hedera-services by hashgraph.

the class AbstractAnswerTest method usesValidator.

@Test
void usesValidator() throws Throwable {
    given(validityCheck.apply(query, view)).willReturn(FILE_DELETED);
    // when:
    ResponseCodeEnum validity = subject.checkValidity(query, view);
    // then:
    assertEquals(FILE_DELETED, validity);
}
Also used : ResponseCodeEnum(com.hederahashgraph.api.proto.java.ResponseCodeEnum) Test(org.junit.jupiter.api.Test)

Aggregations

ResponseCodeEnum (com.hederahashgraph.api.proto.java.ResponseCodeEnum)52 Test (org.junit.jupiter.api.Test)38 Query (com.hederahashgraph.api.proto.java.Query)24 CryptoGetAccountBalanceQuery (com.hederahashgraph.api.proto.java.CryptoGetAccountBalanceQuery)8 AccountID (com.hederahashgraph.api.proto.java.AccountID)6 Response (com.hederahashgraph.api.proto.java.Response)6 CryptoGetAccountBalanceResponse (com.hederahashgraph.api.proto.java.CryptoGetAccountBalanceResponse)4 TransactionBody (com.hederahashgraph.api.proto.java.TransactionBody)4 SignedTxnAccessor (com.hedera.services.utils.SignedTxnAccessor)3 ConsensusGetTopicInfoQuery (com.hederahashgraph.api.proto.java.ConsensusGetTopicInfoQuery)3 ContractID (com.hederahashgraph.api.proto.java.ContractID)3 TokenGetNftInfoQuery (com.hederahashgraph.api.proto.java.TokenGetNftInfoQuery)3 AliasManager (com.hedera.services.ledger.accounts.AliasManager)2 HfsSigMetaLookup (com.hedera.services.sigs.metadata.lookups.HfsSigMetaLookup)2 EntityNum (com.hedera.services.utils.EntityNum)2 TopicID (com.hederahashgraph.api.proto.java.TopicID)2 TransactionID (com.hederahashgraph.api.proto.java.TransactionID)2 Instant (java.time.Instant)2 ByteString (com.google.protobuf.ByteString)1 EntityNumbers (com.hedera.services.config.EntityNumbers)1