summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.jgit.test')
-rw-r--r--org.eclipse.jgit.test/build.properties3
-rw-r--r--org.eclipse.jgit.test/tests.bzl3
-rw-r--r--org.eclipse.jgit.test/tst-rsrc/log4j.properties14
-rw-r--r--org.eclipse.jgit.test/tst-rsrc/simplelogger.properties12
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/api/SecurityManagerMissingPermissionsTest.java28
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/WalkEncryptionTest.java2
6 files changed, 21 insertions, 41 deletions
diff --git a/org.eclipse.jgit.test/build.properties b/org.eclipse.jgit.test/build.properties
index b527a74790..212c8bd4d7 100644
--- a/org.eclipse.jgit.test/build.properties
+++ b/org.eclipse.jgit.test/build.properties
@@ -7,5 +7,4 @@ bin.includes = META-INF/,\
plugin.properties,\
bin-tst/,\
bin/
-additional.bundles = org.apache.log4j,\
- org.slf4j.binding.log4j12
+additional.bundles = org.slf4j.binding.simple
diff --git a/org.eclipse.jgit.test/tests.bzl b/org.eclipse.jgit.test/tests.bzl
index 34df07d5e6..e201bdbcb3 100644
--- a/org.eclipse.jgit.test/tests.bzl
+++ b/org.eclipse.jgit.test/tests.bzl
@@ -36,7 +36,7 @@ def tests(tests):
]
if src.endswith("SecurityManagerMissingPermissionsTest.java"):
additional_deps = [
- "//lib:log4j",
+ "//lib:slf4j-simple",
]
if src.endswith("JDKHttpConnectionTest.java"):
additional_deps = [
@@ -68,6 +68,7 @@ def tests(tests):
"//lib:javaewah",
"//lib:junit",
"//lib:slf4j-api",
+ "//lib:slf4j-simple",
"//org.eclipse.jgit:jgit",
"//org.eclipse.jgit.junit:junit",
"//org.eclipse.jgit.lfs:jgit-lfs",
diff --git a/org.eclipse.jgit.test/tst-rsrc/log4j.properties b/org.eclipse.jgit.test/tst-rsrc/log4j.properties
deleted file mode 100644
index 856a731ab9..0000000000
--- a/org.eclipse.jgit.test/tst-rsrc/log4j.properties
+++ /dev/null
@@ -1,14 +0,0 @@
-
-# Root logger option
-log4j.rootLogger=INFO, stdout
-
-# Direct log messages to stdout
-log4j.appender.stdout=org.apache.log4j.ConsoleAppender
-log4j.appender.stdout.Target=System.out
-log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
-log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
-log4j.appender.fileLogger.bufferedIO = true
-log4j.appender.fileLogger.bufferSize = 4096
-
-#log4j.logger.org.eclipse.jgit.util.FS = DEBUG
-#log4j.logger.org.eclipse.jgit.internal.storage.file.FileSnapshot = DEBUG
diff --git a/org.eclipse.jgit.test/tst-rsrc/simplelogger.properties b/org.eclipse.jgit.test/tst-rsrc/simplelogger.properties
index 011b2f8bb0..235fea21ac 100644
--- a/org.eclipse.jgit.test/tst-rsrc/simplelogger.properties
+++ b/org.eclipse.jgit.test/tst-rsrc/simplelogger.properties
@@ -1,9 +1,9 @@
-org.slf4j.simpleLogger.logFile = System.err
-org.slf4j.simpleLogger.cacheOutputStream = true
-org.slf4j.simpleLogger.defaultLogLevel = info
-org.slf4j.simpleLogger.showDateTime = true
-org.slf4j.simpleLogger.dateTimeFormat = HH:mm:ss.SSSXXX
-org.slf4j.simpleLogger.showThreadName = true
+org.slf4j.simpleLogger.defaultLogLevel=info
+org.slf4j.simpleLogger.logFile=System.err
+org.slf4j.simpleLogger.showDateTime=true
+org.slf4j.simpleLogger.dateTimeFormat=yyyy-MM-dd HH:mm:ss
+org.slf4j.simpleLogger.showThreadName=true
+org.slf4j.simpleLogger.showLogName=true
#org.slf4j.simpleLogger.log.org.eclipse.jgit.util.FS = debug
#org.slf4j.simpleLogger.log.org.eclipse.jgit.internal.storage.file.FileSnapshot = debug
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/SecurityManagerMissingPermissionsTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/SecurityManagerMissingPermissionsTest.java
index a07f37009e..d0fbdbd090 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/SecurityManagerMissingPermissionsTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/SecurityManagerMissingPermissionsTest.java
@@ -13,17 +13,15 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
+import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
-import java.io.StringWriter;
+import java.io.PrintStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.security.Policy;
import java.util.Collections;
-import org.apache.log4j.Logger;
-import org.apache.log4j.PatternLayout;
-import org.apache.log4j.WriterAppender;
import org.eclipse.jgit.junit.RepositoryTestCase;
import org.eclipse.jgit.util.FileUtils;
import org.junit.After;
@@ -38,25 +36,21 @@ public class SecurityManagerMissingPermissionsTest extends RepositoryTestCase {
/**
* Collects all logging sent to the logging system.
*/
- private final StringWriter errorOutputWriter = new StringWriter();
-
- /**
- * Appender to intercept all logging sent to the logging system.
- */
- private WriterAppender appender;
+ private final ByteArrayOutputStream errorOutput = new ByteArrayOutputStream();
private SecurityManager originalSecurityManager;
+ private PrintStream defaultErrorOutput;
+
@Override
@Before
public void setUp() throws Exception {
originalSecurityManager = System.getSecurityManager();
- appender = new WriterAppender(
- new PatternLayout(PatternLayout.TTCC_CONVERSION_PATTERN),
- errorOutputWriter);
-
- Logger.getRootLogger().addAppender(appender);
+ // slf4j-simple logs to System.err, redirect it to enable asserting
+ // logged errors
+ defaultErrorOutput = System.err;
+ System.setErr(new PrintStream(errorOutput));
refreshPolicyAllPermission(Policy.getPolicy());
System.setSecurityManager(new SecurityManager());
@@ -85,14 +79,14 @@ public class SecurityManagerMissingPermissionsTest extends RepositoryTestCase {
addRepoToClose(git.getRepository());
- assertEquals("", errorOutputWriter.toString());
+ assertEquals("", errorOutput.toString());
}
@Override
@After
public void tearDown() throws Exception {
System.setSecurityManager(originalSecurityManager);
- Logger.getRootLogger().removeAppender(appender);
+ System.setErr(defaultErrorOutput);
super.tearDown();
}
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/WalkEncryptionTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/WalkEncryptionTest.java
index f289a922bb..5adf7faf20 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/WalkEncryptionTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/WalkEncryptionTest.java
@@ -99,7 +99,7 @@ import org.slf4j.LoggerFactory;
public class WalkEncryptionTest {
/**
- * Logger setup: ${project_loc}/tst-rsrc/log4j.properties
+ * Logger setup: ${project_loc}/tst-rsrc/simplelogger.properties
*/
static final Logger logger = LoggerFactory.getLogger(WalkEncryptionTest.class);