use of com.hedera.mirror.common.domain.addressbook.AddressBook in project hedera-mirror-node by hashgraph.
the class NetworkServiceTest method limitReached.
@Test
void limitReached() {
AddressBook addressBook = addressBook();
AddressBookEntry addressBookEntry1 = addressBookEntry();
addressBookEntry();
AddressBookFilter filter = AddressBookFilter.builder().fileId(addressBook.getFileId()).limit(1).build();
assertThat(getNodes(filter)).containsExactly(addressBookEntry1);
}
use of com.hedera.mirror.common.domain.addressbook.AddressBook in project hedera-mirror-node by hashgraph.
the class NetworkServiceTest method equalToPageSize.
@Test
void equalToPageSize() {
addressBookProperties.setPageSize(2);
AddressBook addressBook = addressBook();
AddressBookEntry addressBookEntry1 = addressBookEntry();
AddressBookEntry addressBookEntry2 = addressBookEntry();
AddressBookFilter filter = AddressBookFilter.builder().fileId(addressBook.getFileId()).build();
assertThat(getNodes(filter)).containsExactly(addressBookEntry1, addressBookEntry2);
}
use of com.hedera.mirror.common.domain.addressbook.AddressBook in project hedera-mirror-node by hashgraph.
the class NetworkServiceTest method noNodes.
@Test
void noNodes() {
AddressBook addressBook = addressBook();
AddressBookFilter filter = AddressBookFilter.builder().fileId(addressBook.getFileId()).build();
networkService.getNodes(filter).as(StepVerifier::create).thenAwait(Duration.ofMillis(100)).expectNextCount(0L).expectComplete().verify(Duration.ofMillis(500));
}
use of com.hedera.mirror.common.domain.addressbook.AddressBook in project hedera-mirror-node by hashgraph.
the class AddressBookServiceImpl method validateAndCompleteAddressBookList.
/**
* Ensure all addressBook file_data entries prior to this fileData and after the current address book have been
* parsed. If not parse them and populate the address_book tables to complete the list. This does not handle initial
* startup and only ensure any unprocessed address book files are processed.
*
* @param fileData
*/
private void validateAndCompleteAddressBookList(FileData fileData) {
AddressBook currentAddressBook = getCurrent();
long startConsensusTimestamp = currentAddressBook == null ? 0 : currentAddressBook.getStartConsensusTimestamp();
transactionTemplate.executeWithoutResult(status -> parseHistoricAddressBooks(startConsensusTimestamp, fileData.getConsensusTimestamp()));
}
use of com.hedera.mirror.common.domain.addressbook.AddressBook in project hedera-mirror-node by hashgraph.
the class AddressBookRepositoryTest method cascade.
@Test
@Transactional
void cascade() {
AddressBook addressBook = domainBuilder.addressBook().persist();
assertThat(addressBookRepository.findById(addressBook.getStartConsensusTimestamp())).get().extracting(AddressBook::getEntries).isNull();
domainBuilder.addressBookEntry(1).customize(a -> a.consensusTimestamp(addressBook.getStartConsensusTimestamp())).persist();
assertThat(addressBookRepository.findById(addressBook.getStartConsensusTimestamp())).get().extracting(AddressBook::getEntries).as("Ensure entries aren't eagerly loaded").isNull();
}
Aggregations