From d755882f59202fe62b2ad5a141b3c044c1898aa6 Mon Sep 17 00:00:00 2001
From: boli <boli@localhost>
Date: Thu, 03 May 2007 21:55:23 +0000
Subject: [PATCH] Major changes made to the logging framework. It should resolve the following issues:
---
opends/tests/unit-tests-testng/src/server/org/opends/server/TestTextWriter.java | 62 +++++++++++++++---------------
1 files changed, 31 insertions(+), 31 deletions(-)
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/TestLogPublisher.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/TestTextWriter.java
similarity index 61%
rename from opends/tests/unit-tests-testng/src/server/org/opends/server/TestLogPublisher.java
rename to opends/tests/unit-tests-testng/src/server/org/opends/server/TestTextWriter.java
index aeb3c84..581393a 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/TestLogPublisher.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/TestTextWriter.java
@@ -26,57 +26,53 @@
*/
package org.opends.server;
-import org.opends.server.api.LogPublisher;
-import org.opends.server.loggers.LoggerErrorHandler;
-import org.opends.server.loggers.TextLogFormatter;
-import org.opends.server.loggers.LogRecord;
+import org.opends.server.loggers.TextWriter;
import java.util.LinkedList;
import java.util.List;
import java.util.ArrayList;
-/**
- * This class provides an implementation of an log publisher which will store
- * all messages logged in memory. It provides methods to retrieve and clear the
- * sets of accumulated log messages. It is only intended for use in the context
- * of the unit test framework, where it will provide a means of getting any
- * log messages associated with failed test cases.
- */
-public class TestLogPublisher implements LogPublisher
+public class TestTextWriter implements TextWriter
{
- private TextLogFormatter formatter;
-
// The list that will hold the messages logged.
private final LinkedList<String> messageList;
- public TestLogPublisher(TextLogFormatter formatter)
+ public TestTextWriter()
{
- this.messageList = new LinkedList<String>();
- this.formatter = formatter;
+ messageList = new LinkedList<String>();
}
- public synchronized void publish(LogRecord record,
- LoggerErrorHandler handler)
+ public synchronized void writeRecord(String record)
{
- try
- {
- messageList.add(formatter.format(record));
- }
- catch(Throwable t)
- {
- if(handler != null)
- {
- handler.handleError(record, t);
- }
- }
+ messageList.add(record);
}
- public synchronized void shutdown()
+ /**
+ * {@inheritDoc}
+ */
+ public void flush()
+ {
+ // No implementation is required.
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void shutdown()
{
messageList.clear();
}
/**
+ * {@inheritDoc}
+ */
+ public long getBytesWritten()
+ {
+ // No implemention is required. Just return 0;
+ return 0;
+ }
+
+ /**
* Retrieves a copy of the set of messages logged to this error logger since
* the last time it was cleared. A copy of the list is returned to avoid
* a ConcurrentModificationException.
@@ -89,6 +85,8 @@
return new ArrayList<String>(messageList);
}
+
+
/**
* Clears any messages currently stored by this logger.
*/
@@ -96,4 +94,6 @@
{
messageList.clear();
}
+
+
}
--
Gitblit v1.10.0