Skip to content

Commit a585266

Browse files
committed
add comments and address feedback on tests from lukasz
1 parent eaa9173 commit a585266

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

core/src/main/java/com/datastax/oss/driver/api/core/tracker/RequestIdGenerator.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ default Statement<?> getDecoratedStatement(
7575
// Add or overwrite
7676
existing.put(key, ByteBuffer.wrap(requestId.getBytes(StandardCharsets.UTF_8)));
7777

78+
// Allowing null key/values
79+
// Wrap a map inside to be immutable without instanciating a new map
7880
Map<String, ByteBuffer> unmodifiableMap = Collections.unmodifiableMap(existing);
7981

8082
return statement.setCustomPayload(unmodifiableMap);

integration-tests/src/test/java/com/datastax/oss/driver/core/tracker/RequestIdGeneratorIT.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ public void should_not_write_id_to_custom_payload_when_key_is_not_set() {
121121
try (CqlSession session = SessionUtils.newSession(ccmRule, loader)) {
122122
String query = "SELECT * FROM system.local";
123123
ResultSet rs = session.execute(query);
124-
assertThat(rs.getExecutionInfo().getRequest().getCustomPayload().get("trace_key")).isNull();
124+
assertThat(rs.getExecutionInfo().getRequest().getCustomPayload().get("request-id")).isNull();
125125
}
126126
}
127127

@@ -139,8 +139,6 @@ public void should_succeed_with_null_value_in_custom_payload() {
139139
SimpleStatement statement =
140140
SimpleStatement.newInstance(query).setCustomPayload(customPayload);
141141
assertThatStage(session.executeAsync(statement)).isSuccess();
142-
ResultSet rs = session.execute(query);
143-
assertThat(rs.getExecutionInfo().getRequest().getCustomPayload().get("trace_key")).isNull();
144142
}
145143
}
146144
}

0 commit comments

Comments
 (0)