use of com.hedera.mirror.api.proto.AddressBookQuery in project hedera-mirror-node by hashgraph.
the class NetworkControllerTest method notFound.
@Test
void notFound() {
AddressBookQuery query = AddressBookQuery.newBuilder().setFileId(FileID.newBuilder().setFileNum(102L).build()).build();
reactiveService.getNodes(Mono.just(query)).as(StepVerifier::create).expectErrorSatisfies(t -> assertException(t, Status.Code.NOT_FOUND, "does not exist")).verify(Duration.ofSeconds(1L));
}
use of com.hedera.mirror.api.proto.AddressBookQuery in project hedera-mirror-node by hashgraph.
the class NetworkControllerTest method invalidLimit.
@Test
void invalidLimit() {
AddressBookQuery query = AddressBookQuery.newBuilder().setFileId(FileID.newBuilder().build()).setLimit(-1).build();
reactiveService.getNodes(Mono.just(query)).as(StepVerifier::create).expectErrorSatisfies(t -> assertException(t, Status.Code.INVALID_ARGUMENT, "limit: must be greater " + "than or equal to 0")).verify(Duration.ofSeconds(1L));
}
use of com.hedera.mirror.api.proto.AddressBookQuery in project hedera-mirror-node by hashgraph.
the class NetworkControllerTest method limitReached.
@Test
void limitReached() {
AddressBook addressBook = addressBook();
AddressBookEntry addressBookEntry1 = addressBookEntry();
addressBookEntry();
AddressBookQuery query = AddressBookQuery.newBuilder().setFileId(FileID.newBuilder().setFileNum(addressBook.getFileId().getEntityNum()).build()).setLimit(1).build();
reactiveService.getNodes(Mono.just(query)).as(StepVerifier::create).thenAwait(Duration.ofMillis(50)).consumeNextWith(n -> assertEntry(addressBookEntry1, n)).expectComplete().verify(Duration.ofSeconds(1L));
}
use of com.hedera.mirror.api.proto.AddressBookQuery in project hedera-mirror-node by hashgraph.
the class NetworkControllerTest method nullFields.
@Test
void nullFields() {
AddressBook addressBook = addressBook();
AddressBookEntry addressBookEntry = domainBuilder.addressBookEntry().customize(a -> a.consensusTimestamp(CONSENSUS_TIMESTAMP).description(null).memo(null).nodeCertHash(null).publicKey(null).stake(null)).persist();
AddressBookQuery query = AddressBookQuery.newBuilder().setFileId(FileID.newBuilder().setFileNum(addressBook.getFileId().getEntityNum()).build()).build();
reactiveService.getNodes(Mono.just(query)).as(StepVerifier::create).thenAwait(Duration.ofMillis(50)).consumeNextWith(n -> assertThat(n).isNotNull().returns("", NodeAddress::getDescription).returns(ByteString.EMPTY, NodeAddress::getMemo).returns(addressBookEntry.getNodeAccountId(), t -> EntityId.of(n.getNodeAccountId())).returns(ByteString.EMPTY, NodeAddress::getNodeCertHash).returns(addressBookEntry.getNodeId(), NodeAddress::getNodeId).returns("", NodeAddress::getRSAPubKey).returns(0L, NodeAddress::getStake)).expectComplete().verify(Duration.ofSeconds(1L));
}
use of com.hedera.mirror.api.proto.AddressBookQuery in project hedera-mirror-node by hashgraph.
the class NetworkControllerTest method invalidFileId.
@Test
void invalidFileId() {
AddressBookQuery query = AddressBookQuery.newBuilder().setFileId(FileID.newBuilder().setFileNum(-1).build()).build();
reactiveService.getNodes(Mono.just(query)).as(StepVerifier::create).expectErrorSatisfies(t -> assertException(t, Status.Code.INVALID_ARGUMENT, "Invalid entity ID")).verify(Duration.ofSeconds(1L));
}
Aggregations