lhotari commented on code in PR #25207:
URL: https://github.com/apache/pulsar/pull/25207#discussion_r2763700209
##########
pulsar-client/src/test/java/org/apache/pulsar/client/impl/ProducerImplTest.java:
##########
@@ -67,4 +70,79 @@ public void testPopulateMessageSchema() {
assertTrue(producer.populateMessageSchema(msg, null));
verify(msg).setSchemaState(MessageImpl.SchemaState.Ready);
}
+
+ @Test
+ public void testFailPendingMessagesSyncRetry()
+ throws Exception {
+ ProducerImpl<byte[]> producer =
+ Mockito.mock(ProducerImpl.class, Mockito.CALLS_REAL_METHODS);
+ Mockito.doNothing()
+ .when(producer)
+ .semaphoreRelease(Mockito.anyInt());
+ Mockito.doReturn(false)
+ .when(producer)
+ .isBatchMessagingEnabled();
+
+ // Real pending queue
+ ProducerImpl.OpSendMsgQueue pendingQueue = new
ProducerImpl.OpSendMsgQueue();
+ Field pendingField =
ProducerImpl.class.getDeclaredField("pendingMessages");
+ pendingField.setAccessible(true);
+ pendingField.set(producer, pendingQueue);
Review Comment:
In many cases we use `org.apache.commons.lang3.reflect.FieldUtils` or add a
getter to the field (could use `@Getter(value = AccessLevel.PACKAGE, onMethod_
= @__({@VisibleForTesting}))` to add package protected getter in Lombok.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]