You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by GitBox <gi...@apache.org> on 2021/10/18 16:30:08 UTC

[GitHub] [logging-log4j2] vy commented on a change in pull request #588: LOG4J2-3172: buffer immutable log events in the SmtpManager

vy commented on a change in pull request #588:
URL: https://github.com/apache/logging-log4j2/pull/588#discussion_r731110308



##########
File path: log4j-core/src/test/java/org/apache/logging/log4j/core/net/SmtpManagerTest.java
##########
@@ -33,4 +45,41 @@ void testCreateManagerName() {
         assertEquals("SMTP:to:cc::from::LOG4J2-3107:proto:smtp.log4j.com:4711:username::filter", managerName);
     }
 
+    private void testAdd(LogEvent event) {
+        SmtpManager smtpManager = SmtpManager.getSmtpManager(null, "to", "cc", "bcc", "from", "replyTo", "subject", "protocol", "host", 0, "username", "password", false, "filterName", 10, null);
+        smtpManager.removeAllBufferedEvents(); // in case this smtpManager is reused

Review comment:
       I see that you have moved `buffer.removeAll()` into the package-local `removeAllBufferedEvents()` method, so that here you can reset the reused `SmptManager` instances. I would suggest calling `SmptManager.getSmptManager()` with a unique combination each time (e.g., via a unique `to` field) to ensure a fresh instance. This way, you wouldn't also need to leak any methods in `SmptManager` for just tests.




-- 
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: notifications-unsubscribe@logging.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org