Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ public class ConsumerConnection extends RemotingSerializable {
private ConsumeFromWhere consumeFromWhere;

public int computeMinVersion() {
if (this.connectionSet.isEmpty()) {
return 0;
}
int minVersion = Integer.MAX_VALUE;
for (Connection c : this.connectionSet) {
if (c.getVersion() < minVersion) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,11 @@ public void testComputeMinVersion() {
int version = consumerConnection.computeMinVersion();
assertThat(version).isEqualTo(1);
}

@Test
public void testComputeMinVersionWithNoConnection() {
// a group without live connections must not be reported as HighestVersion
ConsumerConnection consumerConnection = new ConsumerConnection();
assertThat(consumerConnection.computeMinVersion()).isEqualTo(0);
}
}