Skip to content

Commit

Permalink
Its a constant so treat it as such
Browse files Browse the repository at this point in the history
Signed-off-by: Sam Barker <[email protected]>

rh-pre-commit.version: 2.0.1
rh-pre-commit.check-secrets: ENABLED
  • Loading branch information
SamBarker committed Jul 16, 2024
1 parent 1bd3a43 commit 4535cc0
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
* The type Strimzi Test client (java client based CLI).
*/
public class StrimziTestClient implements KafkaClient {
private static final String RECEIVED_MESSAGE_MARKER = "Received message:";
private static final Logger LOGGER = LoggerFactory.getLogger(StrimziTestClient.class);
private static final TypeReference<StrimziTestClientConsumerRecord> VALUE_TYPE_REF = new TypeReference<>() {
};
Expand Down Expand Up @@ -112,12 +113,10 @@ private List<ConsumerRecord> getConsumerRecords(Stream<String> logRecords) {
}

private Stream<String> extractRecordLinesFromLog(String log) {
String stringToSeek = "Received message:";

return Stream.of(log.split("\n"))
.filter(l -> l.contains(stringToSeek))
.filter(l -> l.contains(RECEIVED_MESSAGE_MARKER))
.map(line -> {
final String[] split = line.split(stringToSeek, 2); // Limit is 1 based so a limit of 2 means use the seek at most 1 times
final String[] split = line.split(RECEIVED_MESSAGE_MARKER, 2); // Limit is 1 based so a limit of 2 means use the seek at most 1 times
if (split.length > 1) {
return split[1];
}
Expand Down

0 comments on commit 4535cc0

Please sign in to comment.