Author: ningjiang
Date: Thu Jun 16 02:05:23 2011
New Revision: 1136270
URL: http://svn.apache.org/viewvc?rev=1136270&view=rev
Log:
CXF-3590 removed the PrettyLoggingOutInterceptor fixed the unit test
Added:
cxf/trunk/rt/core/src/test/java/org/apache/cxf/interceptor/LoggingOutInterceptorTest.java
(contents, props changed)
- copied, changed from r1135912,
cxf/trunk/rt/core/src/test/java/org/apache/cxf/interceptor/PrettyLoggingOutInterceptorTest.java
Removed:
cxf/trunk/rt/core/src/test/java/org/apache/cxf/interceptor/PrettyLoggingOutInterceptorTest.java
Modified:
cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AbstractLoggingInterceptor.java
Modified:
cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AbstractLoggingInterceptor.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AbstractLoggingInterceptor.java?rev=1136270&r1=1136269&r2=1136270&view=diff
==============================================================================
---
cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AbstractLoggingInterceptor.java
(original)
+++
cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AbstractLoggingInterceptor.java
Thu Jun 16 02:05:23 2011
@@ -145,6 +145,8 @@ public abstract class AbstractLoggingInt
message = transform(message);
if (writer != null) {
writer.println(message);
+ // Flush the writer to make sure the message is wrote
+ writer.flush();
} else if (getLogger().isLoggable(Level.INFO)) {
getLogger().info(message);
}
Copied:
cxf/trunk/rt/core/src/test/java/org/apache/cxf/interceptor/LoggingOutInterceptorTest.java
(from r1135912,
cxf/trunk/rt/core/src/test/java/org/apache/cxf/interceptor/PrettyLoggingOutInterceptorTest.java)
URL:
http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/test/java/org/apache/cxf/interceptor/LoggingOutInterceptorTest.java?p2=cxf/trunk/rt/core/src/test/java/org/apache/cxf/interceptor/LoggingOutInterceptorTest.java&p1=cxf/trunk/rt/core/src/test/java/org/apache/cxf/interceptor/PrettyLoggingOutInterceptorTest.java&r1=1135912&r2=1136270&rev=1136270&view=diff
==============================================================================
---
cxf/trunk/rt/core/src/test/java/org/apache/cxf/interceptor/PrettyLoggingOutInterceptorTest.java
(original)
+++
cxf/trunk/rt/core/src/test/java/org/apache/cxf/interceptor/LoggingOutInterceptorTest.java
Thu Jun 16 02:05:23 2011
@@ -23,25 +23,31 @@ import java.io.ByteArrayOutputStream;
import java.io.PrintWriter;
import org.apache.cxf.io.CachedOutputStream;
+import org.apache.cxf.message.ExchangeImpl;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.message.MessageImpl;
import org.junit.Assert;
import org.junit.Test;
-public class PrettyLoggingOutInterceptorTest extends Assert {
+public class LoggingOutInterceptorTest extends Assert {
@Test
public void testFormatting() throws Exception {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintWriter pw = new PrintWriter(baos);
- PrettyLoggingOutInterceptor p = new PrettyLoggingOutInterceptor(pw);
- PrettyLoggingOutInterceptor.LoggingCallback l = p.new
LoggingCallback();
+ LoggingOutInterceptor p = new LoggingOutInterceptor(pw);
+ //p.setPrettyLogging(true);
CachedOutputStream cos = new CachedOutputStream();
-
String s = "<today><is><the><twenty> <second> <of> <january> <two>
<thousand> <and> <nine></nine> "
+
"</and></thousand></two></january></of></second></twenty></the></is></today>";
- cos.getOut().write(s.getBytes());
- l.onClose(cos);
+ cos.write(s.getBytes());
+ Message message = new MessageImpl();
+ message.setExchange(new ExchangeImpl());
+ message.put(Message.CONTENT_TYPE, "application/xml");
+ LoggingOutInterceptor.LoggingCallback l = p.new
LoggingCallback(message, cos);
+ l.onClose(cos);
String str = baos.toString();
//format has changed
assertFalse(str.matches(s));
Propchange:
cxf/trunk/rt/core/src/test/java/org/apache/cxf/interceptor/LoggingOutInterceptorTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
cxf/trunk/rt/core/src/test/java/org/apache/cxf/interceptor/LoggingOutInterceptorTest.java
------------------------------------------------------------------------------
svn:keywords = Rev Date