logging-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rgo...@apache.org
Subject svn commit: r1397896 - /logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/net/SocketServerTest.java
Date Sat, 13 Oct 2012 17:10:05 GMT
Author: rgoers
Date: Sat Oct 13 17:10:04 2012
New Revision: 1397896

URL: http://svn.apache.org/viewvc?rev=1397896&view=rev
Log:
Add a second log event to the test

Modified:
    logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/net/SocketServerTest.java

Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/net/SocketServerTest.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/net/SocketServerTest.java?rev=1397896&r1=1397895&r2=1397896&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/net/SocketServerTest.java
(original)
+++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/net/SocketServerTest.java
Sat Oct 13 17:10:04 2012
@@ -92,12 +92,10 @@ public class SocketServerTest {
     public void testServer() throws Exception {
         Filter socketFilter = new ThreadFilter(Filter.Result.NEUTRAL, Filter.Result.DENY);
         Filter serverFilter = new ThreadFilter(Filter.Result.DENY, Filter.Result.NEUTRAL);
-        CompositeFilter socketFilters = CompositeFilter.createFilters(new Filter[]{socketFilter});
         SocketAppender appender = SocketAppender.createAppender("localhost", PORT, "tcp",
"-1",
-            "Test", null, null, null, socketFilters);
+            "Test", null, null, null, socketFilter);
         appender.start();
-        CompositeFilter serverFilters = CompositeFilter.createFilters(new Filter[]{serverFilter});
-        ListAppender listApp = new ListAppender("Events", serverFilters, null, false, false);
+        ListAppender listApp = new ListAppender("Events", serverFilter, null, false, false);
         appender.start();
         PatternLayout layout = PatternLayout.createLayout("%m %ex%n", null, null, null);
         ConsoleAppender console = ConsoleAppender.createAppender(layout, null, "SYSTEM_OUT",
"Console", "true");
@@ -111,11 +109,14 @@ public class SocketServerTest {
         root.setAdditive(false);
         root.setLevel(Level.DEBUG);
         root.debug("This is a test message");
+        root.debug("This is test message 2");
         Thread.sleep(100);
         List<LogEvent> events = listApp.getEvents();
         assertNotNull("No event retrieved", events);
         assertTrue("No events retrieved", events.size() > 0);
         assertTrue("Incorrect event", events.get(0).getMessage().getFormattedMessage().equals("This
is a test message"));
+        assertTrue("Incorrect number of events received", events.size() == 2);
+        assertTrue("Incorrect event", events.get(1).getMessage().getFormattedMessage().equals("This
is test message 2"));
     }
 
     private class ThreadFilter extends AbstractFilter {



Mime
View raw message