You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by gg...@apache.org on 2014/05/08 19:23:14 UTC

svn commit: r1593336 - /logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/layout/SerializedLayoutTest.java

Author: ggregory
Date: Thu May  8 17:23:13 2014
New Revision: 1593336

URL: http://svn.apache.org/r1593336
Log:
Tsk, don't rely on method order ;)

Modified:
    logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/layout/SerializedLayoutTest.java

Modified: logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/layout/SerializedLayoutTest.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/layout/SerializedLayoutTest.java?rev=1593336&r1=1593335&r2=1593336&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/layout/SerializedLayoutTest.java (original)
+++ logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/layout/SerializedLayoutTest.java Thu May  8 17:23:13 2014
@@ -49,6 +49,7 @@ import static org.junit.Assert.assertNot
  *
  */
 public class SerializedLayoutTest {
+    private static final String DAT_PATH = "target/test-classes/serializedEvent.dat";
     LoggerContext ctx = (LoggerContext) LogManager.getContext();
     Logger root = ctx.getLogger("");
 
@@ -147,15 +148,16 @@ public class SerializedLayoutTest {
             "org.apache.logging.log4j.core.Logger", Level.INFO, new SimpleMessage("Hello, world!"), throwable);
         final byte[] result = layout.toByteArray(event);
         assertNotNull(result);
-        //FileOutputStream fos = new FileOutputStream("target/serializedEvent.dat");
-        //fos.write(layout.getHeader());
-        //fos.write(result);
-        //fos.close();
+        FileOutputStream fos = new FileOutputStream(DAT_PATH);
+        fos.write(layout.getHeader());
+        fos.write(result);
+        fos.close();
     }
 
     @Test
     public void testDeserialization() throws Exception {
-        File file = new File("target/test-classes/serializedEvent.dat");
+        testSerialization();
+        File file = new File(DAT_PATH);
         FileInputStream fis = new FileInputStream(file);
         ObjectInputStream ois = new ObjectInputStream(fis);
         final LogEvent event = (LogEvent) ois.readObject();