mirror of
https://github.com/RipMeApp/ripme.git
synced 2025-08-15 10:24:04 +02:00
test classes log4j --> log4j2
This commit is contained in:
@@ -6,11 +6,21 @@ import java.util.Arrays;
|
||||
|
||||
import com.rarchives.ripme.utils.Utils;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class UtilsTest {
|
||||
|
||||
private final Logger LOGGER = LogManager.getLogger(UtilsTest.class);
|
||||
|
||||
@Test
|
||||
public void testConfigureLogger() {
|
||||
Utils.configureLogger();
|
||||
LOGGER.warn("this is a warning messaage.");
|
||||
}
|
||||
|
||||
public void testGetEXTFromMagic()
|
||||
{
|
||||
Assertions.assertEquals("jpeg", Utils.getEXTFromMagic(new byte[] { -1, -40, -1, -37, 0, 0, 0, 0 }));
|
||||
|
@@ -6,9 +6,12 @@ import java.util.List;
|
||||
|
||||
import com.rarchives.ripme.ripper.rippers.ChanRipper;
|
||||
|
||||
import org.apache.log4j.ConsoleAppender;
|
||||
import org.apache.log4j.Level;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.logging.log4j.Level;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.logging.log4j.core.LoggerContext;
|
||||
import org.apache.logging.log4j.core.config.Configuration;
|
||||
import org.apache.logging.log4j.core.config.LoggerConfig;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
|
||||
import com.rarchives.ripme.ripper.AbstractRipper;
|
||||
@@ -19,12 +22,16 @@ import com.rarchives.ripme.utils.Utils;
|
||||
*/
|
||||
public class RippersTest {
|
||||
|
||||
private final Logger logger = Logger.getLogger(RippersTest.class);
|
||||
private final Logger logger = LogManager.getLogger(RippersTest.class);
|
||||
|
||||
void testRipper(AbstractRipper ripper) {
|
||||
try {
|
||||
// Turn on Debug logging
|
||||
((ConsoleAppender) Logger.getRootLogger().getAppender("stdout")).setThreshold(Level.DEBUG);
|
||||
LoggerContext ctx = (LoggerContext) LogManager.getContext(false);
|
||||
Configuration config = ctx.getConfiguration();
|
||||
LoggerConfig loggerConfig = config.getLoggerConfig(LogManager.ROOT_LOGGER_NAME);
|
||||
loggerConfig.setLevel(Level.DEBUG);
|
||||
ctx.updateLoggers(); // This causes all Loggers to refetch information from their LoggerConfig.
|
||||
|
||||
// Decrease timeout
|
||||
Utils.setConfigInteger("page.timeout", 20 * 1000);
|
||||
@@ -56,9 +63,6 @@ public class RippersTest {
|
||||
// that we found links to it
|
||||
void testChanRipper(ChanRipper ripper) {
|
||||
try {
|
||||
// Turn on Debug logging
|
||||
((ConsoleAppender) Logger.getRootLogger().getAppender("stdout")).setThreshold(Level.DEBUG);
|
||||
|
||||
// Decrease timeout
|
||||
Utils.setConfigInteger("page.timeout", 20 * 1000);
|
||||
|
||||
|
@@ -10,11 +10,12 @@ import java.util.Set;
|
||||
|
||||
import com.rarchives.ripme.utils.Utils;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class LabelsBundlesTest {
|
||||
private Logger logger = Logger.getLogger(Utils.class);
|
||||
private Logger logger = LogManager.getLogger(Utils.class);
|
||||
private static final String DEFAULT_LANG = "en_US";
|
||||
|
||||
@Test
|
||||
|
Reference in New Issue
Block a user