logging-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r1512783 - /logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/XMLConfigurationTest.java
Date Sat, 10 Aug 2013 15:59:52 GMT
Author: ggregory
Date: Sat Aug 10 15:59:52 2013
New Revision: 1512783

URL: http://svn.apache.org/r1512783
Log:
Sort members.

Modified:
    logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/XMLConfigurationTest.java

Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/XMLConfigurationTest.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/XMLConfigurationTest.java?rev=1512783&r1=1512782&r2=1512783&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/XMLConfigurationTest.java
(original)
+++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/XMLConfigurationTest.java
Sat Aug 10 15:59:52 2013
@@ -50,20 +50,42 @@ import org.junit.runners.Parameterized.P
 @RunWith(Parameterized.class)
 public class XMLConfigurationTest {
 
+    @Parameters
+    public static Collection<Object[]> data() {
+        return Arrays.asList(new Object[][] {
+                {"log4j-test1.xml", "target/test.log"}, 
+                {"log4j-xinclude.xml", "target/test.log"}});
+    }
+
+    private final String configFile;
+    private final String logFile ;
+
     public XMLConfigurationTest(String configFile, String logFile) {
         super();
         this.configFile = configFile;
         this.logFile = logFile;
     }
 
-    private final String configFile;
-    private final String logFile ;
-
-    @Parameters
-    public static Collection<Object[]> data() {
-        return Arrays.asList(new Object[][] {
-                {"log4j-test1.xml", "target/test.log"}, 
-                {"log4j-xinclude.xml", "target/test.log"}});
+    @Test
+    public void logToFile() throws Exception {
+        final FileOutputStream fos = new FileOutputStream(logFile, false);
+        fos.flush();
+        fos.close();
+        final Logger logger = LogManager.getLogger("org.apache.logging.log4j.test2.Test");
+        logger.debug("This is a test");
+        final BufferedReader is = new BufferedReader(new InputStreamReader(new FileInputStream(logFile)));
+        try {
+            int count = 0;
+            String str = "";
+            while (is.ready()) {
+                str = is.readLine();
+                ++count;
+            }
+            assertTrue("Incorrect count " + count, count == 1);
+            assertTrue("Bad data", str.endsWith("This is a test"));
+        } finally {
+            is.close();
+        }
     }
 
     @Before
@@ -80,7 +102,7 @@ public class XMLConfigurationTest {
             ctx.reconfigure();
         }
     }
-
+   
     @After
     public void tearDown() {
         System.clearProperty(XMLConfigurationFactory.CONFIGURATION_FILE_PROPERTY);
@@ -90,6 +112,15 @@ public class XMLConfigurationTest {
     }
 
     @Test
+    public void testConfiguredAppenders() {
+        final LoggerContext ctx = (LoggerContext) LogManager.getContext();
+        final Configuration c = ctx.getConfiguration();
+        final Map<String, Appender<?>> apps = c.getAppenders();
+        assertNotNull(apps);
+        assertEquals(3, apps.size());
+    }
+
+    @Test
     public void testLogger() {
         final Logger logger = LogManager.getLogger("org.apache.logging.log4j.test1.Test");
         assertTrue(logger instanceof org.apache.logging.log4j.core.Logger);
@@ -108,35 +139,4 @@ public class XMLConfigurationTest {
         assertEquals(a.getName(), "STDOUT");
     }
 
-    @Test
-    public void testConfiguredAppenders() {
-        final LoggerContext ctx = (LoggerContext) LogManager.getContext();
-        final Configuration c = ctx.getConfiguration();
-        final Map<String, Appender<?>> apps = c.getAppenders();
-        assertNotNull(apps);
-        assertEquals(3, apps.size());
-    }
-
-    @Test
-    public void logToFile() throws Exception {
-        final FileOutputStream fos = new FileOutputStream(logFile, false);
-        fos.flush();
-        fos.close();
-        final Logger logger = LogManager.getLogger("org.apache.logging.log4j.test2.Test");
-        logger.debug("This is a test");
-        final BufferedReader is = new BufferedReader(new InputStreamReader(new FileInputStream(logFile)));
-        try {
-            int count = 0;
-            String str = "";
-            while (is.ready()) {
-                str = is.readLine();
-                ++count;
-            }
-            assertTrue("Incorrect count " + count, count == 1);
-            assertTrue("Bad data", str.endsWith("This is a test"));
-        } finally {
-            is.close();
-        }
-    }
-
 }



Mime
View raw message