mirror of
https://github.com/RipMeApp/ripme.git
synced 2025-08-16 02:44:10 +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 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.Assertions;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
public class UtilsTest {
|
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()
|
public void testGetEXTFromMagic()
|
||||||
{
|
{
|
||||||
Assertions.assertEquals("jpeg", Utils.getEXTFromMagic(new byte[] { -1, -40, -1, -37, 0, 0, 0, 0 }));
|
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 com.rarchives.ripme.ripper.rippers.ChanRipper;
|
||||||
|
|
||||||
import org.apache.log4j.ConsoleAppender;
|
import org.apache.logging.log4j.Level;
|
||||||
import org.apache.log4j.Level;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.log4j.Logger;
|
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 org.junit.jupiter.api.Assertions;
|
||||||
|
|
||||||
import com.rarchives.ripme.ripper.AbstractRipper;
|
import com.rarchives.ripme.ripper.AbstractRipper;
|
||||||
@@ -19,12 +22,16 @@ import com.rarchives.ripme.utils.Utils;
|
|||||||
*/
|
*/
|
||||||
public class RippersTest {
|
public class RippersTest {
|
||||||
|
|
||||||
private final Logger logger = Logger.getLogger(RippersTest.class);
|
private final Logger logger = LogManager.getLogger(RippersTest.class);
|
||||||
|
|
||||||
void testRipper(AbstractRipper ripper) {
|
void testRipper(AbstractRipper ripper) {
|
||||||
try {
|
try {
|
||||||
// Turn on Debug logging
|
// 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
|
// Decrease timeout
|
||||||
Utils.setConfigInteger("page.timeout", 20 * 1000);
|
Utils.setConfigInteger("page.timeout", 20 * 1000);
|
||||||
@@ -56,9 +63,6 @@ public class RippersTest {
|
|||||||
// that we found links to it
|
// that we found links to it
|
||||||
void testChanRipper(ChanRipper ripper) {
|
void testChanRipper(ChanRipper ripper) {
|
||||||
try {
|
try {
|
||||||
// Turn on Debug logging
|
|
||||||
((ConsoleAppender) Logger.getRootLogger().getAppender("stdout")).setThreshold(Level.DEBUG);
|
|
||||||
|
|
||||||
// Decrease timeout
|
// Decrease timeout
|
||||||
Utils.setConfigInteger("page.timeout", 20 * 1000);
|
Utils.setConfigInteger("page.timeout", 20 * 1000);
|
||||||
|
|
||||||
|
@@ -10,11 +10,12 @@ import java.util.Set;
|
|||||||
|
|
||||||
import com.rarchives.ripme.utils.Utils;
|
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;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
public class LabelsBundlesTest {
|
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";
|
private static final String DEFAULT_LANG = "en_US";
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
Reference in New Issue
Block a user