You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by rg...@apache.org on 2012/05/29 00:24:50 UTC

svn commit: r1343409 - in /logging/log4j/log4j2/trunk: ./ jcl-bridge/src/test/java/org/apache/logging/log4j/jcl/ log4j12-api/src/test/java/org/apache/log4j/ slf4j-impl/src/test/java/org/apache/logging/slf4j/

Author: rgoers
Date: Mon May 28 22:24:50 2012
New Revision: 1343409

URL: http://svn.apache.org/viewvc?rev=1343409&view=rev
Log:
Fix tests with newlines on Windows. Force Windows to server mode

Modified:
    logging/log4j/log4j2/trunk/jcl-bridge/src/test/java/org/apache/logging/log4j/jcl/LoggerTest.java
    logging/log4j/log4j2/trunk/log4j12-api/src/test/java/org/apache/log4j/CategoryTest.java
    logging/log4j/log4j2/trunk/pom.xml
    logging/log4j/log4j2/trunk/slf4j-impl/src/test/java/org/apache/logging/slf4j/LoggerTest.java

Modified: logging/log4j/log4j2/trunk/jcl-bridge/src/test/java/org/apache/logging/log4j/jcl/LoggerTest.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/jcl-bridge/src/test/java/org/apache/logging/log4j/jcl/LoggerTest.java?rev=1343409&r1=1343408&r2=1343409&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/jcl-bridge/src/test/java/org/apache/logging/log4j/jcl/LoggerTest.java (original)
+++ logging/log4j/log4j2/trunk/jcl-bridge/src/test/java/org/apache/logging/log4j/jcl/LoggerTest.java Mon May 28 22:24:50 2012
@@ -43,6 +43,8 @@ public class LoggerTest {
 
     private static final String CONFIG = "log4j-test1.xml";
 
+    private static final String LINE_SEP = System.getProperty("line.separator");
+
     @BeforeClass
     public static void setupClass() {
         System.setProperty(XMLConfigurationFactory.CONFIGURATION_FILE_PROPERTY, CONFIG);
@@ -63,13 +65,13 @@ public class LoggerTest {
     @Test
     public void testLog() {
         logger.debug("Test message");
-        verify("List", "o.a.l.l.j.LoggerTest Test message MDC{}\n");
+        verify("List", "o.a.l.l.j.LoggerTest Test message MDC{}" + LINE_SEP);
         logger.debug("Exception: " , new NullPointerException("Test"));
-        verify("List", "o.a.l.l.j.LoggerTest Exception:  MDC{}\n");
+        verify("List", "o.a.l.l.j.LoggerTest Exception:  MDC{}" + LINE_SEP);
         logger.info("Info Message");
-        verify("List", "o.a.l.l.j.LoggerTest Info Message MDC{}\n");
+        verify("List", "o.a.l.l.j.LoggerTest Info Message MDC{}" + LINE_SEP);
         logger.info("Info Message {}");
-        verify("List", "o.a.l.l.j.LoggerTest Info Message {} MDC{}\n");
+        verify("List", "o.a.l.l.j.LoggerTest Info Message {} MDC{}" + LINE_SEP);
     }
 
     private void verify(String name, String expected) {

Modified: logging/log4j/log4j2/trunk/log4j12-api/src/test/java/org/apache/log4j/CategoryTest.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j12-api/src/test/java/org/apache/log4j/CategoryTest.java?rev=1343409&r1=1343408&r2=1343409&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j12-api/src/test/java/org/apache/log4j/CategoryTest.java (original)
+++ logging/log4j/log4j2/trunk/log4j12-api/src/test/java/org/apache/log4j/CategoryTest.java Mon May 28 22:24:50 2012
@@ -45,6 +45,8 @@ public class CategoryTest {
 
     static ConfigurationFactory cf = new BasicConfigurationFactory();
 
+    private static final String LINE_SEP = System.getProperty("line.separator");
+
     private ListAppender appender = new ListAppender("List");
 
     @BeforeClass
@@ -152,7 +154,7 @@ public class CategoryTest {
         assertTrue("Incorrect number of messages. Expected 1 got " + msgs.size(), msgs.size() == 1);
         String msg = msgs.get(0);
         appender.clear();
-        String expected = "ERROR o.a.l.CategoryTest [main] Test Message\n";
+        String expected = "ERROR o.a.l.CategoryTest [main] Test Message" + LINE_SEP;
         assertTrue("Incorrect message \"" + msg + "\"" + " expected \"" + expected +"\"", msg.endsWith(expected));
     }
 

Modified: logging/log4j/log4j2/trunk/pom.xml
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/pom.xml?rev=1343409&r1=1343408&r2=1343409&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/pom.xml (original)
+++ logging/log4j/log4j2/trunk/pom.xml Mon May 28 22:24:50 2012
@@ -383,6 +383,25 @@
   </modules>
   <profiles>
     <profile>
+        <id>Windows</id>
+        <activation>
+            <os>
+                <family>Windows</family>
+            </os>
+        </activation>
+        <build>
+            <plugins>
+                <plugin>
+                    <groupId>org.apache.maven.plugins</groupId>
+                    <artifactId>maven-surefire-plugin</artifactId>
+                    <configuration>
+                        <argLine>-server</argLine>
+                    </configuration>
+                </plugin>
+            </plugins>
+        </build>
+    </profile>
+    <profile>
       <id>include-flume</id>
       <modules>
         <module>flume-og</module>

Modified: logging/log4j/log4j2/trunk/slf4j-impl/src/test/java/org/apache/logging/slf4j/LoggerTest.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/slf4j-impl/src/test/java/org/apache/logging/slf4j/LoggerTest.java?rev=1343409&r1=1343408&r2=1343409&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/slf4j-impl/src/test/java/org/apache/logging/slf4j/LoggerTest.java (original)
+++ logging/log4j/log4j2/trunk/slf4j-impl/src/test/java/org/apache/logging/slf4j/LoggerTest.java Mon May 28 22:24:50 2012
@@ -51,6 +51,8 @@ import static org.junit.Assert.assertTru
  */
 public class LoggerTest {
 
+    private static final String LINE_SEP = System.getProperty("line.separator");
+    
     private static final String CONFIG = "log4j-test1.xml";
     private static LoggerContext ctx;
 
@@ -74,23 +76,23 @@ public class LoggerTest {
     @Test
     public void basicFlow() {
         xlogger.entry();
-        verify("List", "o.a.l.s.LoggerTest entry MDC{}\n");
+        verify("List", "o.a.l.s.LoggerTest entry MDC{}" + LINE_SEP);
         xlogger.exit();
-        verify("List", "o.a.l.s.LoggerTest exit MDC{}\n");
+        verify("List", "o.a.l.s.LoggerTest exit MDC{}" + LINE_SEP);
     }
 
     @Test
     public void simpleFlow() {
         xlogger.entry(CONFIG);
-        verify("List", "o.a.l.s.LoggerTest entry with (log4j-test1.xml) MDC{}\n");
+        verify("List", "o.a.l.s.LoggerTest entry with (log4j-test1.xml) MDC{}" + LINE_SEP);
         xlogger.exit(0);
-        verify("List", "o.a.l.s.LoggerTest exit with (0) MDC{}\n");
+        verify("List", "o.a.l.s.LoggerTest exit with (0) MDC{}" + LINE_SEP);
     }
 
     @Test
     public void throwing() {
         xlogger.throwing(new IllegalArgumentException("Test Exception"));
-        verify("List", "o.a.l.s.LoggerTest throwing MDC{}\n");
+        verify("List", "o.a.l.s.LoggerTest throwing MDC{}" + LINE_SEP);
     }
 
     @Test
@@ -99,32 +101,32 @@ public class LoggerTest {
             throw new NullPointerException();
         } catch (Exception e) {
             xlogger.catching(e);
-            verify("List", "o.a.l.s.LoggerTest catching MDC{}\n");
+            verify("List", "o.a.l.s.LoggerTest catching MDC{}" + LINE_SEP);
         }
     }
 
     @Test
     public void debug() {
         logger.debug("Debug message");
-        verify("List", "o.a.l.s.LoggerTest Debug message MDC{}\n");
+        verify("List", "o.a.l.s.LoggerTest Debug message MDC{}" + LINE_SEP);
     }
 
     @Test
     public void debugNoParms() {
         logger.debug("Debug message {}");
-        verify("List", "o.a.l.s.LoggerTest Debug message {} MDC{}\n");
+        verify("List", "o.a.l.s.LoggerTest Debug message {} MDC{}" + LINE_SEP);
         logger.debug("Debug message {}", (Object[]) null);
-        verify("List", "o.a.l.s.LoggerTest Debug message {} MDC{}\n");
+        verify("List", "o.a.l.s.LoggerTest Debug message {} MDC{}" + LINE_SEP);
         ((LocationAwareLogger)logger).log(null, SLF4JLogger.class.getName(), LocationAwareLogger.DEBUG_INT,
             "Debug message {}", null, null);
-        verify("List", "o.a.l.s.LoggerTest Debug message {} MDC{}\n");
+        verify("List", "o.a.l.s.LoggerTest Debug message {} MDC{}" + LINE_SEP);
     }
 
 
     @Test
     public void debugWithParms() {
         logger.debug("Hello, {}", "World");
-        verify("List", "o.a.l.s.LoggerTest Hello, World MDC{}\n");
+        verify("List", "o.a.l.s.LoggerTest Hello, World MDC{}" + LINE_SEP);
     }
 
     @Test
@@ -132,10 +134,10 @@ public class LoggerTest {
 
         MDC.put("TestYear", "2010");
         logger.debug("Debug message");
-        verify("List", "o.a.l.s.LoggerTest Debug message MDC{TestYear=2010}\n");
+        verify("List", "o.a.l.s.LoggerTest Debug message MDC{TestYear=2010}" + LINE_SEP);
         MDC.clear();
         logger.debug("Debug message");
-        verify("List", "o.a.l.s.LoggerTest Debug message MDC{}\n");
+        verify("List", "o.a.l.s.LoggerTest Debug message MDC{}" + LINE_SEP);
     }
 
     @Test
@@ -148,9 +150,9 @@ public class LoggerTest {
     @Test
     public void doubleSubst() {
         logger.debug("Hello, {}", "Log4j {}");
-        verify("List", "o.a.l.s.LoggerTest Hello, Log4j {} MDC{}\n");
+        verify("List", "o.a.l.s.LoggerTest Hello, Log4j {} MDC{}" + LINE_SEP);
         xlogger.debug("Hello, {}", "Log4j {}");
-        verify("List", "o.a.l.s.LoggerTest Hello, Log4j Log4j {} MDC{}\n");
+        verify("List", "o.a.l.s.LoggerTest Hello, Log4j Log4j {} MDC{}" + LINE_SEP);
     }
 
     @Test
@@ -167,7 +169,7 @@ public class LoggerTest {
         data.put("Amount", "200.00");
         EventLogger.logEvent(data);
         MDC.clear();
-        verify("EventLogger", "o.a.l.s.LoggerTest Transfer [Audit@18060 Amount=\"200.00\" FromAccount=\"123457\" ToAccount=\"123456\"] Transfer Complete\n");
+        verify("EventLogger", "o.a.l.s.LoggerTest Transfer [Audit@18060 Amount=\"200.00\" FromAccount=\"123457\" ToAccount=\"123456\"] Transfer Complete" + LINE_SEP);
     }
 
     private void verify(String name, String expected) {