Skip to content

Commit 9400e1f

Browse files
author
fanshilun
committed
MAPREDUCE-7421. Fix CheckStyle & Junit Test.
1 parent bd685ee commit 9400e1f

File tree

13 files changed

+115
-121
lines changed

13 files changed

+115
-121
lines changed

hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapred/TestClientServiceDelegate.java

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public class TestClientServiceDelegate {
7878
public void initTestClientServiceDelegate(boolean pIsAMReachableFromClient) {
7979
this.isAMReachableFromClient = pIsAMReachableFromClient;
8080
}
81-
81+
8282
public static Collection<Object[]> data() {
8383
Object[][] data = new Object[][] { { true }, { false } };
8484
return Arrays.asList(data);
@@ -277,8 +277,8 @@ public void testJobReportFromHistoryServer(
277277

278278
JobStatus jobStatus = clientServiceDelegate.getJobStatus(oldJobId);
279279
assertNotNull(jobStatus);
280-
assertEquals("TestJobFilePath", jobStatus.getJobFile());
281-
assertEquals("http://TestTrackingUrl", jobStatus.getTrackingUrl());
280+
assertEquals("TestJobFilePath", jobStatus.getJobFile());
281+
assertEquals("http://TestTrackingUrl", jobStatus.getTrackingUrl());
282282
assertEquals(1.0f, jobStatus.getMapProgress(), 0.0f);
283283
assertEquals(1.0f, jobStatus.getReduceProgress(), 0.0f);
284284
}
@@ -299,7 +299,8 @@ public void testCountersFromHistoryServer(
299299

300300
Counters counters = TypeConverter.toYarn(clientServiceDelegate.getJobCounters(oldJobId));
301301
assertNotNull(counters);
302-
assertEquals(1001, counters.getCounterGroup("dummyCounters").getCounter("dummyCounter").getValue());
302+
assertEquals(1001,
303+
counters.getCounterGroup("dummyCounters").getCounter("dummyCounter").getValue());
303304
}
304305

305306
@MethodSource("data")
@@ -414,20 +415,20 @@ public void testAMAccessDisabled(
414415
// Should not reach AM even for second and third times too.
415416
jobStatus = clientServiceDelegate.getJobStatus(oldJobId);
416417
assertNotNull(jobStatus);
417-
assertEquals("N/A", jobStatus.getJobName());
418+
assertEquals("N/A", jobStatus.getJobName());
418419
verify(clientServiceDelegate, times(0)).instantiateAMProxy(
419420
any(InetSocketAddress.class));
420421
jobStatus = clientServiceDelegate.getJobStatus(oldJobId);
421422
assertNotNull(jobStatus);
422-
assertEquals("N/A", jobStatus.getJobName());
423+
assertEquals("N/A", jobStatus.getJobName());
423424
verify(clientServiceDelegate, times(0)).instantiateAMProxy(
424425
any(InetSocketAddress.class));
425426

426427
// The third time around, app is completed, so should go to JHS
427428
JobStatus jobStatus1 = clientServiceDelegate.getJobStatus(oldJobId);
428429
assertNotNull(jobStatus1);
429-
assertEquals("TestJobFilePath", jobStatus1.getJobFile());
430-
assertEquals("http://TestTrackingUrl", jobStatus1.getTrackingUrl());
430+
assertEquals("TestJobFilePath", jobStatus1.getJobFile());
431+
assertEquals("http://TestTrackingUrl", jobStatus1.getTrackingUrl());
431432
assertEquals(1.0f, jobStatus1.getMapProgress(), 0.0f);
432433
assertEquals(1.0f, jobStatus1.getReduceProgress(), 0.0f);
433434

hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapred/TestCommandLineJobSubmission.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public void testJobShell() throws Exception {
5959
stream.close();
6060
mr = new MiniMRCluster(2, fs.getUri().toString(), 1);
6161
File thisbuildDir = new File(buildDir, "jobCommand");
62-
assertTrue(thisbuildDir.mkdirs(), "create build dir");
62+
assertTrue(thisbuildDir.mkdirs(), "create build dir");
6363
File f = new File(thisbuildDir, "files_tmp");
6464
FileOutputStream fstream = new FileOutputStream(f);
6565
fstream.write("somestrings".getBytes());

hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapred/TestJobCleanup.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,8 @@ private void testFailedJob(String fileName,
203203

204204
if (fileName != null) {
205205
Path testFile = new Path(outDir, fileName);
206-
assertTrue(
207-
fileSys.exists(testFile), "File " + testFile + " missing for failed job " + id);
206+
assertTrue(fileSys.exists(testFile),
207+
"File " + testFile + " missing for failed job " + id);
208208
}
209209

210210
// check if the files from the missing set exists

hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapred/TestKeyValueTextInputFormat.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,8 @@ public void testFormat() throws Exception {
102102
RecordReader<Text, Text> reader =
103103
format.getRecordReader(splits[j], job, reporter);
104104
Class readerClass = reader.getClass();
105-
assertEquals(KeyValueLineRecordReader.class, readerClass, "reader class is KeyValueLineRecordReader.");
105+
assertEquals(KeyValueLineRecordReader.class, readerClass,
106+
"reader class is KeyValueLineRecordReader.");
106107

107108
Text key = reader.createKey();
108109
Class keyClass = key.getClass();
@@ -145,11 +146,12 @@ public void testUTF8() throws Exception {
145146
in = makeStream("abcd\u20acbdcd\u20ac");
146147
Text line = new Text();
147148
in.readLine(line);
148-
assertEquals("readLine changed utf8 characters",
149-
"abcd\u20acbdcd\u20ac", line.toString());
149+
assertEquals("abcd\u20acbdcd\u20ac", line.toString(),
150+
"readLine changed utf8 characters");
150151
in = makeStream("abc\u200axyz");
151152
in.readLine(line);
152-
assertEquals("split on fake newline", "abc\u200axyz", line.toString());
153+
assertEquals("abc\u200axyz", line.toString(),
154+
"split on fake newline");
153155
} finally {
154156
if (in != null) {
155157
in.close();
@@ -244,16 +246,14 @@ public void testGzip() throws IOException {
244246
}
245247
List<Text> results = readSplit(format, splits[0], job);
246248
assertEquals(6, results.size(), "splits[0] length");
247-
assertEquals("splits[0][5]", " dog", results.get(5).toString());
249+
assertEquals(" dog", results.get(5).toString(), "splits[0][5]");
248250
results = readSplit(format, splits[1], job);
249251
assertEquals(2, results.size(), "splits[1] length");
250-
assertEquals("splits[1][0]", "this is a test",
251-
results.get(0).toString());
252-
assertEquals("splits[1][1]", "of gzip",
253-
results.get(1).toString());
252+
assertEquals("this is a test", results.get(0).toString(), "splits[1][0]");
253+
assertEquals("of gzip", results.get(1).toString(), "splits[1][1]");
254254
}
255255

256-
public static void main(String[] args) throws Exception {
256+
public static void main(String[] args) throws Exception {
257257
new TestKeyValueTextInputFormat().testFormat();
258258
}
259259
}

hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapred/TestMRTimelineEventHandling.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -392,8 +392,8 @@ private void verifyEntity(File entityFile, String eventId,
392392

393393
LOG.info("strLine.trim()= " + strLine.trim());
394394
if (checkIdPrefix) {
395-
assertTrue(
396-
entity.getIdPrefix() > 0, "Entity ID prefix expected to be > 0");
395+
assertTrue(entity.getIdPrefix() > 0,
396+
"Entity ID prefix expected to be > 0");
397397
if (idPrefix == -1) {
398398
idPrefix = entity.getIdPrefix();
399399
} else {

hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapred/TestNetworkedJob.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,8 +261,8 @@ public void testNetworkedJob() throws Exception {
261261
// JobStatus objects correspond to the same Job.
262262
assertEquals(jobId, client.getJob(jobId)
263263
.getJobStatus().getJobID(), "Expected matching JobIDs");
264-
assertEquals(rj.getJobStatus()
265-
.getStartTime(), client.getJob(jobId).getJobStatus().getStartTime(), "Expected matching startTimes");
264+
assertEquals(rj.getJobStatus().getStartTime(),
265+
client.getJob(jobId).getJobStatus().getStartTime(), "Expected matching startTimes");
266266
} finally {
267267
if (fileSys != null) {
268268
fileSys.delete(testDir, true);

hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapred/TestReduceFetch.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ public void testReduceFromDisk() throws Exception {
4545
final long spill = c.findCounter(TaskCounter.SPILLED_RECORDS).getCounter();
4646
final long out = c.findCounter(TaskCounter.MAP_OUTPUT_RECORDS).getCounter();
4747
assertTrue(spill >= 2 * out,
48-
"Expected all records spilled during reduce (" + spill + ")"); // all records spill at map, reduce
48+
"Expected all records spilled during reduce (" +
49+
spill + ")"); // all records spill at map, reduce
4950
assertTrue(spill >= 2 * out + (out / MAP_TASKS),
5051
"Expected intermediate merges (" + spill + ")"); // some records hit twice
5152
}

hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapred/TestReporter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ public void reduce(Text key, Iterator<Text> values,
176176
throws IOException {
177177
float reducePhaseProgress = ((float)++recordCount)/INPUT_LINES;
178178
float weightedReducePhaseProgress =
179-
reducePhaseProgress * REDUCE_PROGRESS_RANGE;
179+
reducePhaseProgress * REDUCE_PROGRESS_RANGE;
180180
assertEquals(SHUFFLE_PROGRESS_RANGE + weightedReducePhaseProgress,
181181
reporter.getProgress(), 0.02f, "Invalid progress in reduce");
182182
this.reporter = reporter;

hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapred/TestResourceMgrDelegate.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public void testGetRootQueues() throws IOException, InterruptedException {
6060
final ApplicationClientProtocol applicationsManager = mock(ApplicationClientProtocol.class);
6161
GetQueueInfoResponse response = mock(GetQueueInfoResponse.class);
6262
org.apache.hadoop.yarn.api.records.QueueInfo queueInfo =
63-
mock(org.apache.hadoop.yarn.api.records.QueueInfo.class);
63+
mock(org.apache.hadoop.yarn.api.records.QueueInfo.class);
6464
when(response.getQueueInfo()).thenReturn(queueInfo);
6565
try {
6666
when(applicationsManager.getQueueInfo(any(

hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapred/TestTextInputFormat.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,9 @@ public void testFormat() throws Exception {
114114
LOG.debug("splitting: got = " + splits.length);
115115

116116
if (length == 0) {
117-
assertEquals(1, splits.length,
118-
"Files of length 0 are not returned from FileInputFormat.getSplits().");
119-
assertEquals(0, splits[0].getLength(), "Empty file length == 0");
117+
assertEquals(1, splits.length,
118+
"Files of length 0 are not returned from FileInputFormat.getSplits().");
119+
assertEquals(0, splits[0].getLength(), "Empty file length == 0");
120120
}
121121

122122
// check each split

0 commit comments

Comments
 (0)