Skip to content

Commit

Permalink
chore: correct the variable name in roster.proto (#15465)
Browse files Browse the repository at this point in the history
Signed-off-by: Edward Wertz <[email protected]>
  • Loading branch information
edward-swirldslabs authored Sep 13, 2024
1 parent 4eb9c5b commit 68fd768
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 24 deletions.
2 changes: 1 addition & 1 deletion hapi/hedera-protobufs/services/state/roster/roster.proto
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ message Roster {
* This list SHALL contain roster entries in natural order of ascending node ids.
* This list SHALL NOT be empty.<br/>
*/
repeated RosterEntry rosters = 1;
repeated RosterEntry roster_entries = 1;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ public static long getRound(@NonNull final State state) {
@NonNull
public static Roster buildRoster(@NonNull final AddressBook addressBook) {
return Roster.newBuilder()
.rosters(addressBook.getNodeIdSet().stream()
.rosterEntries(addressBook.getNodeIdSet().stream()
.map(addressBook::getAddress)
.map(address -> {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public static void validate(@NonNull final Roster roster) {
throw new InvalidRosterException("roster is null");
}

final List<RosterEntry> rosterEntries = roster.rosters();
final List<RosterEntry> rosterEntries = roster.rosterEntries();

if (rosterEntries.isEmpty()) {
throw new InvalidRosterException("roster is empty");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ public static Roster createRoster(@NonNull final AddressBook bootstrapAddressBoo
final RosterEntry rosterEntry = AddressBookUtils.toRosterEntry(address, nodeId);
rosterEntries.add(rosterEntry);
}
return Roster.newBuilder().rosters(rosterEntries).build();
return Roster.newBuilder().rosterEntries(rosterEntries).build();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public class RosterRetrieverTests {
.build();

private static final Roster ROSTER_FROM_ADDRESS_BOOK = Roster.newBuilder()
.rosters(List.of(
.rosterEntries(List.of(
RosterEntry.newBuilder()
.nodeId(1L)
.weight(1L)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ void zeroWeightTest() {
final Exception ex = assertThrows(
InvalidRosterException.class,
() -> RosterValidator.validate(Roster.newBuilder()
.rosters(
.rosterEntries(
RosterEntry.newBuilder()
.nodeId(1)
.weight(0)
Expand Down Expand Up @@ -83,7 +83,7 @@ void negativeWeightTest() {
final Exception ex = assertThrows(
InvalidRosterException.class,
() -> RosterValidator.validate(Roster.newBuilder()
.rosters(
.rosterEntries(
RosterEntry.newBuilder()
.nodeId(1)
.weight(0)
Expand Down Expand Up @@ -123,7 +123,7 @@ void duplicateNodeIdTest() {
final Exception ex = assertThrows(
InvalidRosterException.class,
() -> RosterValidator.validate(Roster.newBuilder()
.rosters(
.rosterEntries(
RosterEntry.newBuilder()
.nodeId(1)
.weight(1)
Expand Down Expand Up @@ -163,7 +163,7 @@ void invalidGossipCertTest() {
final Exception ex = assertThrows(
InvalidRosterException.class,
() -> RosterValidator.validate(Roster.newBuilder()
.rosters(
.rosterEntries(
RosterEntry.newBuilder()
.nodeId(1)
.weight(1)
Expand Down Expand Up @@ -203,7 +203,7 @@ void emptyGossipEndpointsTest() {
final Exception ex = assertThrows(
InvalidRosterException.class,
() -> RosterValidator.validate(Roster.newBuilder()
.rosters(
.rosterEntries(
RosterEntry.newBuilder()
.nodeId(1)
.weight(1)
Expand Down Expand Up @@ -239,7 +239,7 @@ void zeroPortTest() {
final Exception ex = assertThrows(
InvalidRosterException.class,
() -> RosterValidator.validate(Roster.newBuilder()
.rosters(
.rosterEntries(
RosterEntry.newBuilder()
.nodeId(1)
.weight(1)
Expand Down Expand Up @@ -281,7 +281,7 @@ void domainAndIpTest() {
final Exception ex = assertThrows(
InvalidRosterException.class,
() -> RosterValidator.validate(Roster.newBuilder()
.rosters(
.rosterEntries(
RosterEntry.newBuilder()
.nodeId(1)
.weight(1)
Expand Down Expand Up @@ -324,7 +324,7 @@ void wrongNodeIdOrderTest() {
final Exception ex = assertThrows(
InvalidRosterException.class,
() -> RosterValidator.validate(Roster.newBuilder()
.rosters(
.rosterEntries(
RosterEntry.newBuilder()
.nodeId(1)
.weight(1)
Expand Down Expand Up @@ -364,7 +364,7 @@ void invalidIPv4Test() {
final Exception ex = assertThrows(
InvalidRosterException.class,
() -> RosterValidator.validate(Roster.newBuilder()
.rosters(
.rosterEntries(
RosterEntry.newBuilder()
.nodeId(1)
.weight(1)
Expand Down Expand Up @@ -404,7 +404,7 @@ void invalidIPv4Test() {
@Test
void validTest() {
RosterValidator.validate(Roster.newBuilder()
.rosters(
.rosterEntries(
RosterEntry.newBuilder()
.nodeId(1)
.weight(1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,9 @@ void testCreateRosterFromNonEmptyAddressBook() {
final Roster roster = AddressBookUtils.createRoster(addressBook);

assertNotNull(roster);
assertEquals(2, roster.rosters().size());
assertEquals(1L, roster.rosters().getFirst().nodeId());
assertEquals(2L, roster.rosters().getLast().nodeId());
assertEquals(2, roster.rosterEntries().size());
assertEquals(1L, roster.rosterEntries().getFirst().nodeId());
assertEquals(2L, roster.rosterEntries().getLast().nodeId());
}

@Test
Expand All @@ -136,7 +136,7 @@ void testCreateRosterFromEmptyAddressBook() {
final Roster roster = AddressBookUtils.createRoster(addressBook);

assertNotNull(roster);
assertTrue(roster.rosters().isEmpty());
assertTrue(roster.rosterEntries().isEmpty());
}

@Test
Expand All @@ -148,7 +148,7 @@ void testToRosterEntryWithCertificateEncodingException() throws CertificateEncod
final AddressBook addressBook = new AddressBook(List.of(address));
final Roster roster = AddressBookUtils.createRoster(addressBook);

assertEquals(Bytes.EMPTY, roster.rosters().getFirst().gossipCaCertificate());
assertEquals(Bytes.EMPTY, roster.rosterEntries().getFirst().gossipCaCertificate());
}

@Test
Expand All @@ -157,10 +157,10 @@ void testToRosterEntryWithExternalHostname() {
final AddressBook addressBook = new AddressBook(List.of(address));
final Roster roster = AddressBookUtils.createRoster(addressBook);

assertEquals(1, roster.rosters().size());
assertEquals(1, roster.rosterEntries().size());
assertEquals(
"hostnameExternal",
roster.rosters().getFirst().gossipEndpoint().getFirst().domainName());
roster.rosterEntries().getFirst().gossipEndpoint().getFirst().domainName());
}

@Test
Expand All @@ -169,10 +169,10 @@ void testToRosterEntryWithInternalHostname() {
final AddressBook addressBook = new AddressBook(List.of(address));
final Roster roster = AddressBookUtils.createRoster(addressBook);

assertEquals(1, roster.rosters().size());
assertEquals(1, roster.rosterEntries().size());
assertEquals(
"hostnameInternal",
roster.rosters().getFirst().gossipEndpoint().getFirst().domainName());
roster.rosterEntries().getFirst().gossipEndpoint().getFirst().domainName());
}

@Test
Expand Down

0 comments on commit 68fd768

Please sign in to comment.