[logback-dev] [GIT] Logback: the generic, reliable, fast and flexible logging framework. branch master updated. v_1.0.0-68-gd9c06c3

Gitbot git-noreply at pixie.qos.ch
Thu Mar 1 20:26:20 CET 2012


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Logback: the generic, reliable, fast and flexible logging framework.".

The branch, master has been updated
       via  d9c06c3183b09d38394fd0dc3faef226da6b29fe (commit)
      from  65b370c9dc28c31d23b9bf4a2269de08685e7327 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.qos.ch/gitweb/?p=logback.git;a=commit;h=d9c06c3183b09d38394fd0dc3faef226da6b29fe
http://github.com/ceki/logback/commit/d9c06c3183b09d38394fd0dc3faef226da6b29fe

commit d9c06c3183b09d38394fd0dc3faef226da6b29fe
Author: Ceki Gulcu <ceki at qos.ch>
Date:   Thu Mar 1 20:25:39 2012 +0100

    ongoing work

diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/net/SMTPAppender_GreenTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/net/SMTPAppender_GreenTest.java
index 0fdf203..cc20e17 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/net/SMTPAppender_GreenTest.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/net/SMTPAppender_GreenTest.java
@@ -13,10 +13,6 @@
  */
 package ch.qos.logback.classic.net;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
 import java.io.IOException;
 import java.util.concurrent.TimeUnit;
 
@@ -48,6 +44,8 @@ import com.icegreen.greenmail.util.GreenMail;
 import com.icegreen.greenmail.util.GreenMailUtil;
 import com.icegreen.greenmail.util.ServerSetup;
 
+import static org.junit.Assert.*;
+
 public class SMTPAppender_GreenTest {
 
   int port = RandomUtil.getRandomServerPort();
@@ -64,7 +62,7 @@ public class SMTPAppender_GreenTest {
   public void setUp() throws Exception {
     MDC.clear();
     ServerSetup serverSetup = new ServerSetup(port, "localhost",
-        ServerSetup.PROTOCOL_SMTP);
+            ServerSetup.PROTOCOL_SMTP);
     greenMail = new GreenMail(serverSetup);
     greenMail.start();
     // let the grean mail server get a head start
@@ -109,7 +107,7 @@ public class SMTPAppender_GreenTest {
   }
 
   private MimeMultipart verify(String subject) throws MessagingException,
-      IOException {
+          IOException {
     MimeMessage[] mma = greenMail.getReceivedMessages();
     assertNotNull(mma);
     assertEquals(1, mma.length);
@@ -123,6 +121,7 @@ public class SMTPAppender_GreenTest {
     lc.getExecutorService().shutdown();
     lc.getExecutorService().awaitTermination(1000, TimeUnit.MILLISECONDS);
   }
+
   @Test
   public void smoke() throws Exception {
     buildSMTPAppender();
@@ -132,7 +131,7 @@ public class SMTPAppender_GreenTest {
     logger.debug("hello");
     logger.error("en error", new Exception("an exception"));
 
-     waitUntilEmailIsSent();
+    waitUntilEmailIsSent();
 //    synchronized (smtpAppender) {
 //      smtpAppender.wait();
 //    }
@@ -187,7 +186,7 @@ public class SMTPAppender_GreenTest {
   /**
    * Checks that even when many events are processed, the output is still
    * conforms to xhtml-strict.dtd.
-   * 
+   *
    * Note that SMTPAppender only keeps only 500 or so (=buffer size) events. So
    * the generated output will be rather short.
    */
@@ -201,7 +200,7 @@ public class SMTPAppender_GreenTest {
     }
     logger.error("en error", new Exception("an exception"));
 
-     waitUntilEmailIsSent();
+    waitUntilEmailIsSent();
     MimeMultipart mp = verify(TEST_SUBJECT);
 
     // verify strict adherence to xhtml1-strict.dtd
@@ -222,7 +221,7 @@ public class SMTPAppender_GreenTest {
   @Test
   public void testCustomEvaluator() throws Exception {
     configure(ClassicTestConstants.JORAN_INPUT_PREFIX
-        + "smtp/customEvaluator.xml");
+            + "smtp/customEvaluator.xml");
 
     logger.debug("hello");
     String msg2 = "world";
@@ -237,7 +236,7 @@ public class SMTPAppender_GreenTest {
   @Test
   public void testCustomBufferSize() throws Exception {
     configure(ClassicTestConstants.JORAN_INPUT_PREFIX
-        + "smtp/customBufferSize.xml");
+            + "smtp/customBufferSize.xml");
 
     logger.debug("invisible1");
     logger.debug("invisible2");
@@ -264,4 +263,40 @@ public class SMTPAppender_GreenTest {
     assertNotNull(mma);
     assertEquals(3, mma.length);
   }
+
+
+  // http://jira.qos.ch/browse/LBCLASSIC-221
+  @Test
+  public void bufferShouldBeResetBetweenMessages() throws Exception {
+    buildSMTPAppender();
+    smtpAppender.setLayout(buildPatternLayout(lc));
+    smtpAppender.start();
+    logger.addAppender(smtpAppender);
+    String h1 = "hello one";
+    logger.debug(h1);
+    logger.error("error one");
+
+    String h2 = "hello two";
+    logger.debug(h2);
+    logger.error("error two");
+
+    waitUntilEmailIsSent();
+
+    MimeMessage[] mma = greenMail.getReceivedMessages();
+    assertNotNull(mma);
+    assertEquals(2, mma.length);
+
+    MimeMessage mm0 = mma[0];
+    MimeMultipart content0 = (MimeMultipart) mm0.getContent();
+    String body0 = GreenMailUtil.getBody(content0.getBodyPart(0));
+    System.out.println(body0);
+
+    MimeMessage mm1 = mma[1];
+    MimeMultipart content1 = (MimeMultipart) mm1.getContent();
+    String body1 = GreenMailUtil.getBody(content1.getBodyPart(0));
+    assertFalse(body1.contains(h1));
+    System.out.println(body1);
+
+
+  }
 }

-----------------------------------------------------------------------

Summary of changes:
 .../classic/net/SMTPAppender_GreenTest.java        |   57 ++++++++++++++++----
 1 files changed, 46 insertions(+), 11 deletions(-)


hooks/post-receive
-- 
Logback: the generic, reliable, fast and flexible logging framework.


More information about the logback-dev mailing list