use of com.hedera.mirror.grpc.domain.AddressBookFilter in project hedera-mirror-node by hashgraph.
the class NetworkServiceTest method lessThanPageSize.
@Test
void lessThanPageSize() {
addressBookProperties.setPageSize(2);
AddressBook addressBook = addressBook();
AddressBookEntry addressBookEntry = addressBookEntry();
AddressBookFilter filter = AddressBookFilter.builder().fileId(addressBook.getFileId()).build();
assertThat(getNodes(filter)).containsExactly(addressBookEntry);
}
use of com.hedera.mirror.grpc.domain.AddressBookFilter in project hedera-mirror-node by hashgraph.
the class NetworkServiceTest method cached.
@Test
void cached() {
addressBookProperties.setPageSize(2);
AddressBook addressBook = addressBook();
AddressBookEntry addressBookEntry1 = addressBookEntry();
AddressBookEntry addressBookEntry2 = addressBookEntry();
AddressBookEntry addressBookEntry3 = addressBookEntry();
AddressBookFilter filter = AddressBookFilter.builder().fileId(addressBook.getFileId()).build();
assertThat(getNodes(filter)).containsExactly(addressBookEntry1, addressBookEntry2, addressBookEntry3);
addressBookEntryRepository.deleteAll();
assertThat(getNodes(filter)).containsExactly(addressBookEntry1, addressBookEntry2, addressBookEntry3);
}
use of com.hedera.mirror.grpc.domain.AddressBookFilter in project hedera-mirror-node by hashgraph.
the class NetworkServiceTest method invalidAddressBookFile.
@Test
void invalidAddressBookFile() {
AddressBookFilter filter = AddressBookFilter.builder().fileId(EntityId.of(999L, EntityType.FILE)).build();
assertThatThrownBy(() -> networkService.getNodes(filter)).isInstanceOf(IllegalArgumentException.class).hasMessageContaining(INVALID_FILE_ID);
}
use of com.hedera.mirror.grpc.domain.AddressBookFilter in project hedera-mirror-node by hashgraph.
the class NetworkServiceTest method invalidFilter.
@Test
void invalidFilter() {
AddressBookFilter filter = AddressBookFilter.builder().fileId(null).limit(-1).build();
assertThatThrownBy(() -> networkService.getNodes(filter)).isInstanceOf(ConstraintViolationException.class).hasMessageContaining("limit: must be greater than or equal to 0").hasMessageContaining("fileId: must not be null");
}
use of com.hedera.mirror.grpc.domain.AddressBookFilter in project hedera-mirror-node by hashgraph.
the class NetworkServiceTest method moreThanPageSize.
@Test
void moreThanPageSize() {
addressBookProperties.setPageSize(2);
AddressBook addressBook = addressBook();
AddressBookEntry addressBookEntry1 = addressBookEntry();
AddressBookEntry addressBookEntry2 = addressBookEntry();
AddressBookEntry addressBookEntry3 = addressBookEntry();
AddressBookFilter filter = AddressBookFilter.builder().fileId(addressBook.getFileId()).build();
assertThat(getNodes(filter)).containsExactly(addressBookEntry1, addressBookEntry2, addressBookEntry3);
}
Aggregations