Skip to content

Commit

Permalink
fixed checkstyle issues
Browse files Browse the repository at this point in the history
  • Loading branch information
kaiyaok2 committed May 15, 2024
1 parent 4e98ad7 commit e4e557d
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,21 +48,21 @@
import static org.mockito.Mockito.mock;

public class TestMapTask {
private static File TEST_ROOT_DIR = new File(
private static File testRootDir = new File(
System.getProperty("test.build.data",
System.getProperty("java.io.tmpdir", "/tmp")),
TestMapTask.class.getName());

@Before
public void setup() throws Exception {
if(!TEST_ROOT_DIR.exists()) {
TEST_ROOT_DIR.mkdirs();
if(!testRootDir.exists()) {
testRootDir.mkdirs();
}
}

@After
public void cleanup() throws Exception {
FileUtil.fullyDelete(TEST_ROOT_DIR);
FileUtil.fullyDelete(testRootDir);
}

@Rule
Expand All @@ -74,7 +74,7 @@ public void cleanup() throws Exception {
public void testShufflePermissions() throws Exception {
JobConf conf = new JobConf();
conf.set(CommonConfigurationKeys.FS_PERMISSIONS_UMASK_KEY, "077");
conf.set(MRConfig.LOCAL_DIR, TEST_ROOT_DIR.getAbsolutePath());
conf.set(MRConfig.LOCAL_DIR, testRootDir.getAbsolutePath());
MapOutputFile mof = new MROutputFiles();
mof.setConf(conf);
TaskAttemptID attemptId = new TaskAttemptID("12345", 1, TaskType.MAP, 1, 1);
Expand Down Expand Up @@ -106,7 +106,7 @@ public void testShufflePermissions() throws Exception {
public void testSpillFilesCountLimitInvalidValue() throws Exception {
JobConf conf = new JobConf();
conf.set(CommonConfigurationKeys.FS_PERMISSIONS_UMASK_KEY, "077");
conf.set(MRConfig.LOCAL_DIR, TEST_ROOT_DIR.getAbsolutePath());
conf.set(MRConfig.LOCAL_DIR, testRootDir.getAbsolutePath());
conf.setInt(MRJobConfig.SPILL_FILES_COUNT_LIMIT, -2);
MapOutputFile mof = new MROutputFiles();
mof.setConf(conf);
Expand All @@ -132,7 +132,7 @@ public void testSpillFilesCountLimitInvalidValue() throws Exception {
public void testSpillFilesCountBreach() throws Exception {
JobConf conf = new JobConf();
conf.set(CommonConfigurationKeys.FS_PERMISSIONS_UMASK_KEY, "077");
conf.set(MRConfig.LOCAL_DIR, TEST_ROOT_DIR.getAbsolutePath());
conf.set(MRConfig.LOCAL_DIR, testRootDir.getAbsolutePath());
conf.setInt(MRJobConfig.SPILL_FILES_COUNT_LIMIT, 2);
MapOutputFile mof = new MROutputFiles();
mof.setConf(conf);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
import java.util.Set;

public class TestOldCombinerGrouping {
private static File TEST_ROOT_DIR = GenericTestUtils.getRandomizedTestDir();
private static File testRootDir = GenericTestUtils.getRandomizedTestDir();

public static class Map implements
Mapper<LongWritable, Text, Text, LongWritable> {
Expand Down Expand Up @@ -121,19 +121,19 @@ public int compare(Text o1, Text o2) {

@After
public void cleanup() {
FileUtil.fullyDelete(TEST_ROOT_DIR);
FileUtil.fullyDelete(testRootDir);
}

@Test
public void testCombiner() throws Exception {
if (!TEST_ROOT_DIR.mkdirs()) {
throw new RuntimeException("Could not create test dir: " + TEST_ROOT_DIR);
if (!testRootDir.mkdirs()) {
throw new RuntimeException("Could not create test dir: " + testRootDir);
}
File in = new File(TEST_ROOT_DIR, "input");
File in = new File(testRootDir, "input");
if (!in.mkdirs()) {
throw new RuntimeException("Could not create test dir: " + in);
}
File out = new File(TEST_ROOT_DIR, "output");
File out = new File(testRootDir, "output");
PrintWriter pw = new PrintWriter(new FileWriter(new File(in, "data.txt")));
pw.println("A|a,1");
pw.println("A|b,2");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
import java.util.Set;

public class TestNewCombinerGrouping {
private static File TEST_ROOT_DIR = GenericTestUtils.getRandomizedTestDir();
private static File testRootDir = GenericTestUtils.getRandomizedTestDir();

public static class Map extends
Mapper<LongWritable, Text, Text, LongWritable> {
Expand Down Expand Up @@ -107,19 +107,19 @@ public int compare(Text o1, Text o2) {

@After
public void cleanup() {
FileUtil.fullyDelete(TEST_ROOT_DIR);
FileUtil.fullyDelete(testRootDir);
}

@Test
public void testCombiner() throws Exception {
if (!TEST_ROOT_DIR.mkdirs()) {
throw new RuntimeException("Could not create test dir: " + TEST_ROOT_DIR);
if (!testRootDir.mkdirs()) {
throw new RuntimeException("Could not create test dir: " + testRootDir);
}
File in = new File(TEST_ROOT_DIR, "input");
File in = new File(testRootDir, "input");
if (!in.mkdirs()) {
throw new RuntimeException("Could not create test dir: " + in);
}
File out = new File(TEST_ROOT_DIR, "output");
File out = new File(testRootDir, "output");
PrintWriter pw = new PrintWriter(new FileWriter(new File(in, "data.txt")));
pw.println("A|a,1");
pw.println("A|b,2");
Expand Down

0 comments on commit e4e557d

Please sign in to comment.