From f139824e6ffca8794dda5ff67d5194e6b0d4bc92 Mon Sep 17 00:00:00 2001 From: Ray Mattingly Date: Thu, 14 Sep 2023 17:15:23 -0400 Subject: [PATCH] fix tests --- .../hbase/namequeues/impl/SlowLogQueueService.java | 3 +++ .../hbase/namequeues/TestNamedQueueRecorder.java | 11 +++++------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/namequeues/impl/SlowLogQueueService.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/namequeues/impl/SlowLogQueueService.java index 9072f4294894..62e4c5d96696 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/namequeues/impl/SlowLogQueueService.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/namequeues/impl/SlowLogQueueService.java @@ -185,6 +185,9 @@ public void consumeEventFromDisruptor(NamedQueuePayload namedQueuePayload) { private static Collection buildNameBytesPairs(Map attributes) { + if (attributes == null) { + return Collections.emptySet(); + } return attributes.entrySet().stream().map(attr -> HBaseProtos.NameBytesPair.newBuilder() .setName(attr.getKey()).setValue(ByteString.copyFrom(attr.getValue())).build()) .collect(Collectors.toSet()); diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/namequeues/TestNamedQueueRecorder.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/namequeues/TestNamedQueueRecorder.java index 1cd6b03f20c6..af6c51260fd5 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/namequeues/TestNamedQueueRecorder.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/namequeues/TestNamedQueueRecorder.java @@ -756,20 +756,19 @@ public long getSize() { @Override public RPCProtos.RequestHeader getHeader() { - RPCProtos.RequestHeader.Builder builder = RPCProtos.RequestHeader.newBuilder(); - REQUEST_HEADERS.forEach(builder::addAttribute); - return builder.build(); + return null; } @Override public Map getConnectionAttributes() { - return CONNECTION_HEADERS.stream().collect(Collectors.toMap( - nameBytesPair -> nameBytesPair.getName(), nameBytesPair -> nameBytesPair.toByteArray())); + return CONNECTION_HEADERS.stream().collect(Collectors + .toMap(HBaseProtos.NameBytesPair::getName, pair -> pair.getValue().toByteArray())); } @Override public Map getRequestAttributes() { - return null; + return REQUEST_HEADERS.stream().collect(Collectors.toMap(HBaseProtos.NameBytesPair::getName, + pair -> pair.getValue().toByteArray())); } @Override