summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJames Moger <james.moger@gitblit.com>2012-03-31 08:48:10 -0400
committerJames Moger <james.moger@gitblit.com>2012-03-31 08:48:10 -0400
commit2f5d1569cb08328c5358c919b53faa0cc8835775 (patch)
tree5f23ab5cdf9c8946b89649596a69479cb7ba178c /tests
parenta612e6af36c9c2bd2ef81d9c1697ce1543a1a9df (diff)
downloadgitblit-2f5d1569cb08328c5358c919b53faa0cc8835775.tar.gz
gitblit-2f5d1569cb08328c5358c919b53faa0cc8835775.zip
Adjustments to ClientLogger
Diffstat (limited to 'tests')
-rw-r--r--tests/com/gitblit/tests/GroovyScriptTest.java21
1 files changed, 18 insertions, 3 deletions
diff --git a/tests/com/gitblit/tests/GroovyScriptTest.java b/tests/com/gitblit/tests/GroovyScriptTest.java
index 8538d645..3d3621df 100644
--- a/tests/com/gitblit/tests/GroovyScriptTest.java
+++ b/tests/com/gitblit/tests/GroovyScriptTest.java
@@ -23,6 +23,8 @@ import groovy.util.GroovyScriptEngine;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
+import java.io.PrintWriter;
+import java.io.StringWriter;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Arrays;
@@ -226,8 +228,7 @@ public class GroovyScriptTest {
BufferedWriter writer = new BufferedWriter(new FileWriter(tempScript));
- writer.write("import com.gitblit.utils.ClientLogger\n");
- writer.write("clientLogger.sendMessage('this is a test message')\n");
+ writer.write("clientLogger.info('this is a test message')\n");
writer.flush();
writer.close();
@@ -308,9 +309,23 @@ public class GroovyScriptTest {
class MockClientLogger {
List<String> messages = new ArrayList<String>();
- public void sendMessage(String message) {
+ public void info(String message) {
+ messages.add(message);
+ }
+
+ public void error(String message) {
messages.add(message);
}
+
+ public void error(String message, Throwable t) {
+ PrintWriter writer = new PrintWriter(new StringWriter());
+ if (!StringUtils.isEmpty(message)) {
+ writer.append(message);
+ writer.append('\n');
+ }
+ t.printStackTrace(writer);
+ messages.add(writer.toString());
+ }
}
class MockMail {