6565import java .util .concurrent .atomic .AtomicReference ;
6666import java .util .function .Function ;
6767import java .util .function .LongConsumer ;
68- import java .util .function .ToLongBiFunction ;
6968import java .util .stream .Collectors ;
7069import java .util .stream .IntStream ;
7170import org .junit .jupiter .api .Test ;
@@ -902,13 +901,13 @@ void streamInfoShouldReturnFirstOffsetAndCommittedOffset() throws Exception {
902901 new Client .ClientParameters ()
903902 .chunkListener (chunkListener )
904903 .messageListener (messageListener ));
905- StreamInfoResponse response = client .streamInfo (stream );
906- assertThat (response .getInfo ()).containsEntry ("first_offset " , "0" );
907- assertThat (response .getInfo ()).containsEntry ("committed_offset " , "-1" );
904+ StreamInfoResponse response = client .streamStats (stream );
905+ assertThat (response .getInfo ()).containsEntry ("first_chunk_id " , - 1L );
906+ assertThat (response .getInfo ()).containsEntry ("committed_chunk_id " , - 1L );
908907 TestUtils .publishAndWaitForConfirms (cf , publishCount , stream );
909- response = client .streamInfo (stream );
910- assertThat (response .getInfo ()).containsEntry ("first_offset " , "0" );
911- assertThat (response .getInfo ().get ("committed_offset " )).isNotEqualTo ("-1" );
908+ response = client .streamStats (stream );
909+ assertThat (response .getInfo ()).containsEntry ("first_chunk_id " , 0L );
910+ assertThat (response .getInfo ().get ("committed_chunk_id " )).isNotEqualTo (- 1L );
912911
913912 client .exchangeCommandVersions ();
914913
@@ -918,13 +917,13 @@ void streamInfoShouldReturnFirstOffsetAndCommittedOffset() throws Exception {
918917
919918 assertThat (latch .await (10 , SECONDS )).isTrue ();
920919 assertThat (committedOffset .get ()).isPositive ();
921- assertThat (committedOffset . toString ()). isEqualTo (response .getInfo ().get ("committed_offset " ));
920+ assertThat (committedOffset ). hasValue (response .getInfo ().get ("committed_chunk_id " ));
922921 }
923922
924923 @ Test
925924 @ BrokerVersionAtLeast ("3.11.0" )
926925 void streamInfoShouldReturnErrorWhenStreamDoesNotExist () {
927- assertThat (cf .get ().streamInfo ("does not exist" ).getResponseCode ())
926+ assertThat (cf .get ().streamStats ("does not exist" ).getResponseCode ())
928927 .isEqualTo (Constants .RESPONSE_CODE_STREAM_DOES_NOT_EXIST );
929928 }
930929
@@ -947,20 +946,19 @@ void streamInfoFirstOffsetShouldChangeAfterRetentionKickedIn(TestInfo info) {
947946 .isOk ())
948947 .isTrue ();
949948
950- StreamInfoResponse response = client .streamInfo (s );
951- assertThat (response .getInfo ()).containsEntry ("first_offset " , "0" );
952- assertThat (response .getInfo ()).containsEntry ("committed_offset " , "-1" );
949+ StreamInfoResponse response = client .streamStats (s );
950+ assertThat (response .getInfo ()).containsEntry ("first_chunk_id " , - 1L );
951+ assertThat (response .getInfo ()).containsEntry ("committed_chunk_id " , - 1L );
953952
954953 byte [] payload = new byte [payloadSize ];
955954 Function <MessageBuilder , Message > messageCreation = mb -> mb .addData (payload ).build ();
956955
957956 TestUtils .publishAndWaitForConfirms (cf , messageCreation , messageCount , s );
958957 // publishing again, to make sure new segments trigger retention strategy
959958 TestUtils .publishAndWaitForConfirms (cf , messageCreation , messageCount , s );
960- response = client .streamInfo (s );
961- ToLongBiFunction <Map <String , String >, String > toOffset = (m , k ) -> Long .parseLong (m .get (k ));
962- assertThat (toOffset .applyAsLong (response .getInfo (), "first_offset" )).isPositive ();
963- assertThat (toOffset .applyAsLong (response .getInfo (), "committed_offset" )).isPositive ();
959+ response = client .streamStats (s );
960+ assertThat (response .getInfo ().get ("first_chunk_id" )).isPositive ();
961+ assertThat (response .getInfo ().get ("committed_chunk_id" )).isPositive ();
964962
965963 } finally {
966964 assertThat (client .delete (s ).isOk ()).isTrue ();
0 commit comments