Skip to content

Commit

Permalink
[Java] Fix assertion based on the client state.
Browse files Browse the repository at this point in the history
  • Loading branch information
vyazelenko committed Dec 20, 2024
1 parent a41ee99 commit f984260
Showing 1 changed file with 13 additions and 14 deletions.
27 changes: 13 additions & 14 deletions aeron-archive/src/test/java/io/aeron/archive/ArchiveTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ void shouldRecoverRecordingWithNonZeroStartPosition()
{
final Catalog.CatalogEntryProcessor catalogEntryProcessor =
(recordingDescriptorOffset, headerEncoder, headerDecoder, descriptorEncoder, descriptorDecoder) ->
descriptorEncoder.stopPosition(Aeron.NULL_VALUE);
descriptorEncoder.stopPosition(Aeron.NULL_VALUE);

assertTrue(catalog.forEntry(recordingId, catalogEntryProcessor));
}
Expand Down Expand Up @@ -939,26 +939,25 @@ void shouldTimeoutInactiveArchiveClients(final String controlRequestChannel, fin
}
catch (final ArchiveException ex)
{
assertThat(ex.getMessage(), anyOf(
equalTo("ERROR - client is closed"),
equalTo("ERROR - not connected")));
if (AeronArchive.State.DISCONNECTED == client2.state())
{
assertEquals("ERROR - not connected", ex.getMessage());
assertTrue(client2.archiveProxy().publication().isConnected());
assertFalse(client2.controlResponsePoller().subscription().isConnected());
}
else
{
assertEquals("ERROR - client is closed", ex.getMessage());
assertFalse(client2.archiveProxy().publication().isConnected());
assertFalse(client2.controlResponsePoller().subscription().isConnected());
}
break;
}
}

assertEquals(AeronArchive.State.CONNECTED, client1.state());
assertTrue(client1.archiveProxy().publication().isConnected());
assertTrue(client1.controlResponsePoller().subscription().isConnected());
assertEquals(AeronArchive.State.DISCONNECTED, client2.state());
assertTrue(client2.archiveProxy().publication().isConnected());
assertFalse(client2.controlResponsePoller().subscription().isConnected());

final ArchiveException exception =
assertThrowsExactly(ArchiveException.class, () -> client2.getMaxRecordedPosition(4));
assertEquals("ERROR - client is closed", exception.getMessage());
assertEquals(AeronArchive.State.CLOSED, client2.state());
assertFalse(client2.archiveProxy().publication().isConnected());
assertFalse(client2.controlResponsePoller().subscription().isConnected());
}
}
}
Expand Down

0 comments on commit f984260

Please sign in to comment.