summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--org.eclipse.jgit.junit.http/META-INF/MANIFEST.MF3
-rw-r--r--org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/RecordingLogger.java198
2 files changed, 97 insertions, 104 deletions
diff --git a/org.eclipse.jgit.junit.http/META-INF/MANIFEST.MF b/org.eclipse.jgit.junit.http/META-INF/MANIFEST.MF
index 6be5cdd09e..4e4a549579 100644
--- a/org.eclipse.jgit.junit.http/META-INF/MANIFEST.MF
+++ b/org.eclipse.jgit.junit.http/META-INF/MANIFEST.MF
@@ -29,7 +29,8 @@ Import-Package: javax.servlet;version="[2.5.0,5.0.0)",
org.eclipse.jgit.revwalk;version="[6.0.0,6.1.0)",
org.eclipse.jgit.transport;version="[6.0.0,6.1.0)",
org.eclipse.jgit.transport.resolver;version="[6.0.0,6.1.0)",
- org.junit;version="[4.13,5.0.0)"
+ org.junit;version="[4.13,5.0.0)",
+ org.slf4j.helpers;version="[1.7.0,2.0.0)"
Export-Package: org.eclipse.jgit.junit.http;version="6.0.0";
uses:="org.eclipse.jgit.transport,
org.eclipse.jgit.junit,
diff --git a/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/RecordingLogger.java b/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/RecordingLogger.java
index d2ef733d74..9c3c980ad8 100644
--- a/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/RecordingLogger.java
+++ b/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/RecordingLogger.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010, Google Inc. and others
+ * Copyright (C) 2010, 2021 Google Inc. and others
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Distribution License v. 1.0 which is available at
@@ -7,7 +7,6 @@
*
* SPDX-License-Identifier: BSD-3-Clause
*/
-
package org.eclipse.jgit.junit.http;
import java.text.MessageFormat;
@@ -15,12 +14,12 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
-import org.eclipse.jetty.util.log.Logger;
+import org.slf4j.helpers.MarkerIgnoringBase;
+
+public class RecordingLogger extends MarkerIgnoringBase {
+
+ private static final long serialVersionUID = 1L;
-/**
- * Log warnings into an array for later inspection.
- */
-public class RecordingLogger implements Logger {
private static List<Warning> warnings = new ArrayList<>();
/**
@@ -60,8 +59,6 @@ public class RecordingLogger implements Logger {
}
}
- private final String name;
-
/**
* Constructor for <code>RecordingLogger</code>.
*/
@@ -78,171 +75,166 @@ public class RecordingLogger implements Logger {
this.name = name;
}
- /** {@inheritDoc} */
@Override
- public Logger getLogger(@SuppressWarnings("hiding") String name) {
- return new RecordingLogger(name);
+ public boolean isTraceEnabled() {
+ // Ignore (not relevant to test failures)
+ return false;
}
- /** {@inheritDoc} */
@Override
- public String getName() {
- return name;
+ public void trace(String msg) {
+ // Ignore (not relevant to test failures)
}
- /**
- * Warning
- *
- * @param msg
- * @param arg0
- * @param arg1
- */
- public void warn(String msg, Object arg0, Object arg1) {
- synchronized (warnings) {
- warnings.add(new Warning(MessageFormat.format(msg, arg0, arg1)));
- }
+ @Override
+ public void trace(String format, Object arg) {
+ // Ignore (not relevant to test failures)
}
- /** {@inheritDoc} */
@Override
- public void warn(String msg, Throwable th) {
- synchronized (warnings) {
- warnings.add(new Warning(msg, th));
- }
+ public void trace(String format, Object arg1, Object arg2) {
+ // Ignore (not relevant to test failures)
}
- /**
- * Warning
- *
- * @param msg
- * warning message
- */
- public void warn(String msg) {
- synchronized (warnings) {
- warnings.add(new Warning(msg));
- }
+ @Override
+ public void trace(String format, Object... arguments) {
+ // Ignore (not relevant to test failures)
}
- /**
- * Debug log
- *
- * @param msg
- * @param arg0
- * @param arg1
- */
- public void debug(String msg, Object arg0, Object arg1) {
+ @Override
+ public void trace(String msg, Throwable t) {
// Ignore (not relevant to test failures)
}
- /** {@inheritDoc} */
@Override
- public void debug(String msg, Throwable th) {
- // Ignore (not relevant to test failures)
+ public boolean isDebugEnabled() {
+ return false;
}
- /**
- * Debug log
- *
- * @param msg
- * debug message
- */
+ @Override
public void debug(String msg) {
// Ignore (not relevant to test failures)
}
- /**
- * Info
- *
- * @param msg
- * @param arg0
- * @param arg1
- */
- public void info(String msg, Object arg0, Object arg1) {
+ @Override
+ public void debug(String format, Object arg) {
// Ignore (not relevant to test failures)
}
- /**
- * Info
- *
- * @param msg
- */
- public void info(String msg) {
+ @Override
+ public void debug(String format, Object arg1, Object arg2) {
// Ignore (not relevant to test failures)
}
- /** {@inheritDoc} */
@Override
- public boolean isDebugEnabled() {
+ public void debug(String format, Object... arguments) {
+ // Ignore (not relevant to test failures)
+ }
+
+ @Override
+ public void debug(String msg, Throwable t) {
+ // Ignore (not relevant to test failures)
+ }
+
+ @Override
+ public boolean isInfoEnabled() {
return false;
}
- /** {@inheritDoc} */
@Override
- public void setDebugEnabled(boolean enabled) {
+ public void info(String msg) {
+ // Ignore (not relevant to test failures)
+ }
+
+ @Override
+ public void info(String format, Object arg) {
+ // Ignore (not relevant to test failures)
+ }
+
+ @Override
+ public void info(String format, Object arg1, Object arg2) {
+ // Ignore (not relevant to test failures)
+ }
+
+ @Override
+ public void info(String format, Object... arguments) {
+ // Ignore (not relevant to test failures)
+ }
+
+ @Override
+ public void info(String msg, Throwable t) {
// Ignore (not relevant to test failures)
}
- /** {@inheritDoc} */
@Override
- public void warn(String msg, Object... args) {
+ public boolean isWarnEnabled() {
+ return true;
+ }
+
+ @Override
+ public void warn(String msg) {
+ synchronized (warnings) {
+ warnings.add(new Warning(msg));
+ }
+ }
+
+ @Override
+ public void warn(String format, Object arg) {
+ warn(format, Collections.singleton(arg));
+ }
+
+ @Override
+ public void warn(String format, Object... arguments) {
synchronized (warnings) {
int i = 0;
- int index = msg.indexOf("{}");
+ int index = format.indexOf("{}");
while (index >= 0) {
- msg = msg.replaceFirst("\\{\\}", "{" + i++ + "}");
- index = msg.indexOf("{}");
+ format = format.replaceFirst("\\{\\}", "{" + i++ + "}");
+ index = format.indexOf("{}");
}
- warnings.add(new Warning(MessageFormat.format(msg, args)));
+ warnings.add(new Warning(MessageFormat.format(format, arguments)));
}
}
- /** {@inheritDoc} */
@Override
- public void warn(Throwable thrown) {
- synchronized (warnings) {
- warnings.add(new Warning(thrown));
- }
+ public void warn(String format, Object arg1, Object arg2) {
+ warn(format, new Object[] { arg1, arg2 });
}
- /** {@inheritDoc} */
@Override
- public void info(String msg, Object... args) {
- // Ignore (not relevant to test failures)
+ public void warn(String msg, Throwable t) {
+ synchronized (warnings) {
+ warnings.add(new Warning(msg, t));
+ }
}
- /** {@inheritDoc} */
@Override
- public void info(Throwable thrown) {
- // Ignore (not relevant to test failures)
+ public boolean isErrorEnabled() {
+ return false;
}
- /** {@inheritDoc} */
@Override
- public void info(String msg, Throwable thrown) {
+ public void error(String msg) {
// Ignore (not relevant to test failures)
}
- /** {@inheritDoc} */
@Override
- public void debug(String msg, Object... args) {
+ public void error(String format, Object arg) {
// Ignore (not relevant to test failures)
}
- /** {@inheritDoc} */
@Override
- public void debug(Throwable thrown) {
+ public void error(String format, Object arg1, Object arg2) {
// Ignore (not relevant to test failures)
}
- /** {@inheritDoc} */
@Override
- public void ignore(Throwable arg0) {
+ public void error(String format, Object... arguments) {
// Ignore (not relevant to test failures)
}
- /** {@inheritDoc} */
@Override
- public void debug(String msg, long value) {
+ public void error(String msg, Throwable t) {
// Ignore (not relevant to test failures)
}
}