use of com.hedera.mirror.common.domain.addressbook.AddressBookEntry in project hedera-mirror-node by hashgraph.
the class AddressBookEntryRepositoryTest method save.
@Test
void save() {
addressBookRepository.save(addressBook(null, 1L, Collections.emptyList()));
AddressBookEntry addressBookEntry = addressBookEntryRepository.save(addressBookEntry(null, 1L, 3));
assertThat(addressBookEntryRepository.findById(addressBookEntry.getId())).get().isEqualTo(addressBookEntry);
}
use of com.hedera.mirror.common.domain.addressbook.AddressBookEntry 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.common.domain.addressbook.AddressBookEntry in project hedera-mirror-node by hashgraph.
the class DomainBuilder method addressBookEntry.
public DomainWrapper<AddressBookEntry, AddressBookEntry.AddressBookEntryBuilder> addressBookEntry(int endpoints) {
long consensusTimestamp = timestamp();
long nodeId = id();
var builder = AddressBookEntry.builder().consensusTimestamp(consensusTimestamp).description(text(10)).memo(text(10)).nodeId(nodeId).nodeAccountId(EntityId.of(0L, 0L, nodeId + 3, ACCOUNT)).nodeCertHash(bytes(96)).publicKey(text(64)).stake(0L);
var serviceEndpoints = new HashSet<AddressBookServiceEndpoint>();
builder.serviceEndpoints(serviceEndpoints);
for (int i = 0; i < endpoints; ++i) {
var endpoint = addressBookServiceEndpoint().customize(a -> a.consensusTimestamp(consensusTimestamp).nodeId(nodeId)).get();
serviceEndpoints.add(endpoint);
}
return new DomainWrapperImpl<>(builder, builder::build);
}
use of com.hedera.mirror.common.domain.addressbook.AddressBookEntry 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.common.domain.addressbook.AddressBookEntry 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);
}
Aggregations