logging-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r1563302 - in /logging/log4j/log4j2/trunk/log4j-api: pom.xml src/test/java/org/apache/logging/log4j/message/LocalizedMessageTest.java
Date Fri, 31 Jan 2014 22:19:38 GMT
Author: ggregory
Date: Fri Jan 31 22:19:38 2014
New Revision: 1563302

URL: http://svn.apache.org/r1563302
Log:
Cannot serialize LocalizedMessage: org.apache.commons.lang3.SerializationException: java.io.EOFException

Modified:
    logging/log4j/log4j2/trunk/log4j-api/pom.xml
    logging/log4j/log4j2/trunk/log4j-api/src/test/java/org/apache/logging/log4j/message/LocalizedMessageTest.java

Modified: logging/log4j/log4j2/trunk/log4j-api/pom.xml
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-api/pom.xml?rev=1563302&r1=1563301&r2=1563302&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-api/pom.xml (original)
+++ logging/log4j/log4j2/trunk/log4j-api/pom.xml Fri Jan 31 22:19:38 2014
@@ -60,6 +60,12 @@
       <artifactId>maven-core</artifactId>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>org.apache.commons</groupId>
+      <artifactId>commons-lang3</artifactId>
+      <version>3.2.1</version>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
   <build>
     <plugins>

Modified: logging/log4j/log4j2/trunk/log4j-api/src/test/java/org/apache/logging/log4j/message/LocalizedMessageTest.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-api/src/test/java/org/apache/logging/log4j/message/LocalizedMessageTest.java?rev=1563302&r1=1563301&r2=1563302&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-api/src/test/java/org/apache/logging/log4j/message/LocalizedMessageTest.java
(original)
+++ logging/log4j/log4j2/trunk/log4j-api/src/test/java/org/apache/logging/log4j/message/LocalizedMessageTest.java
Fri Jan 31 22:19:38 2014
@@ -16,26 +16,51 @@
  */
 package org.apache.logging.log4j.message;
 
-import org.junit.Test;
+import static org.junit.Assert.assertEquals;
 
 import java.util.Locale;
 
-import static org.junit.Assert.assertEquals;
+import org.apache.commons.lang3.SerializationUtils;
+import org.junit.Ignore;
+import org.junit.Test;
 
 /**
  * Tests LocalizedMessage.
  */
 public class LocalizedMessageTest {
 
+    private LocalizedMessage roundtrip(final LocalizedMessage msg) {
+        return SerializationUtils.deserialize(SerializationUtils.serialize(msg));
+    }
+
     @Test
     public void testMessageFormat() {
         final LocalizedMessage msg = new LocalizedMessage("MF", new Locale("en", "US"), "msg1",
new Object[] { "1", "Test" });
         assertEquals("This is test number 1 with string argument Test.", msg.getFormattedMessage());
     }
 
+    @Ignore("org.apache.commons.lang3.SerializationException: java.io.EOFException")
+    @Test
+    public void testSerializationMessageFormat() {
+        final LocalizedMessage msg = new LocalizedMessage("MF", new Locale("en", "US"), "msg1",
new Object[] { "1", "Test" });
+        assertEquals("This is test number 1 with string argument Test.", msg.getFormattedMessage());
+        final LocalizedMessage msg2 = roundtrip(msg);
+        assertEquals("This is test number 1 with string argument Test.", msg2.getFormattedMessage());
+    }
+
+    @Ignore("org.apache.commons.lang3.SerializationException: java.io.EOFException")
+    @Test
+    public void testSerializationStringFormat() {
+        final LocalizedMessage msg = new LocalizedMessage("SF", new Locale("en", "US"), "msg1",
new Object[] { "1", "Test" });
+        assertEquals("This is test number 1 with string argument Test.", msg.getFormattedMessage());
+        final LocalizedMessage msg2 = roundtrip(msg);
+        assertEquals("This is test number 1 with string argument Test.", msg2.getFormattedMessage());
+    }
+
     @Test
     public void testStringFormat() {
         final LocalizedMessage msg = new LocalizedMessage("SF", new Locale("en", "US"), "msg1",
new Object[] { "1", "Test" });
         assertEquals("This is test number 1 with string argument Test.", msg.getFormattedMessage());
     }
+
 }



Mime
View raw message