HDFS-8948. Use GenericTestUtils to set log levels in TestPread and TestReplaceDatanodeOnFailure. Contributed by Mingliang Liu.

This commit is contained in:
Haohui Mai 2015-08-24 16:16:10 -07:00
parent eefc1c174b
commit ef8437a382
3 changed files with 7 additions and 4 deletions

View File

@ -864,6 +864,9 @@ Release 2.8.0 - UNRELEASED
HDFS-8930. Block report lease may leak if the 2nd full block report comes HDFS-8930. Block report lease may leak if the 2nd full block report comes
when NN is still in safemode (Colin P. McCabe via Jing Zhao) when NN is still in safemode (Colin P. McCabe via Jing Zhao)
HDFS-8948. Use GenericTestUtils to set log levels in TestPread and
TestReplaceDatanodeOnFailure. (Mingliang Liu via wheat9)
Release 2.7.2 - UNRELEASED Release 2.7.2 - UNRELEASED
INCOMPATIBLE CHANGES INCOMPATIBLE CHANGES

View File

@ -30,7 +30,6 @@ import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
import java.util.concurrent.Future; import java.util.concurrent.Future;
import org.apache.commons.logging.impl.Log4JLogger;
import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.ChecksumException; import org.apache.hadoop.fs.ChecksumException;
import org.apache.hadoop.fs.FSDataInputStream; import org.apache.hadoop.fs.FSDataInputStream;
@ -42,6 +41,7 @@ import org.apache.hadoop.hdfs.protocol.LocatedBlocks;
import org.apache.hadoop.hdfs.protocol.datatransfer.DataTransferProtocol; import org.apache.hadoop.hdfs.protocol.datatransfer.DataTransferProtocol;
import org.apache.hadoop.hdfs.server.datanode.SimulatedFSDataset; import org.apache.hadoop.hdfs.server.datanode.SimulatedFSDataset;
import org.apache.hadoop.io.IOUtils; import org.apache.hadoop.io.IOUtils;
import org.apache.hadoop.test.GenericTestUtils;
import org.apache.log4j.Level; import org.apache.log4j.Level;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
@ -264,7 +264,7 @@ public class TestPread {
@Test @Test
public void testPreadDFSNoChecksum() throws IOException { public void testPreadDFSNoChecksum() throws IOException {
Configuration conf = new Configuration(); Configuration conf = new Configuration();
((Log4JLogger)DataTransferProtocol.LOG).getLogger().setLevel(Level.ALL); GenericTestUtils.setLogLevel(DataTransferProtocol.LOG, Level.ALL);
dfsPreadTest(conf, false, false); dfsPreadTest(conf, false, false);
dfsPreadTest(conf, true, false); dfsPreadTest(conf, true, false);
} }

View File

@ -21,7 +21,6 @@ import java.io.IOException;
import java.util.Arrays; import java.util.Arrays;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.impl.Log4JLogger;
import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FSDataInputStream; import org.apache.hadoop.fs.FSDataInputStream;
import org.apache.hadoop.fs.FSDataOutputStream; import org.apache.hadoop.fs.FSDataOutputStream;
@ -33,6 +32,7 @@ import org.apache.hadoop.hdfs.protocol.datatransfer.DataTransferProtocol;
import org.apache.hadoop.hdfs.protocol.datatransfer.ReplaceDatanodeOnFailure; import org.apache.hadoop.hdfs.protocol.datatransfer.ReplaceDatanodeOnFailure;
import org.apache.hadoop.hdfs.protocol.datatransfer.ReplaceDatanodeOnFailure.Policy; import org.apache.hadoop.hdfs.protocol.datatransfer.ReplaceDatanodeOnFailure.Policy;
import org.apache.hadoop.io.IOUtils; import org.apache.hadoop.io.IOUtils;
import org.apache.hadoop.test.GenericTestUtils;
import org.apache.log4j.Level; import org.apache.log4j.Level;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
@ -50,7 +50,7 @@ public class TestReplaceDatanodeOnFailure {
final private static String RACK1 = "/rack1"; final private static String RACK1 = "/rack1";
{ {
((Log4JLogger)DataTransferProtocol.LOG).getLogger().setLevel(Level.ALL); GenericTestUtils.setLogLevel(DataTransferProtocol.LOG, Level.ALL);
} }
/** Test DEFAULT ReplaceDatanodeOnFailure policy. */ /** Test DEFAULT ReplaceDatanodeOnFailure policy. */