48
48
import org .apache .hadoop .tools .util .DistCpUtils ;
49
49
import org .apache .hadoop .tools .util .TestDistCpUtils ;
50
50
import org .apache .hadoop .security .Credentials ;
51
- import org .junit .*;
51
+ import org .junit .jupiter .api .AfterAll ;
52
+ import org .junit .jupiter .api .AfterEach ;
53
+ import org .junit .jupiter .api .BeforeAll ;
54
+ import org .junit .jupiter .api .BeforeEach ;
55
+ import org .junit .jupiter .api .Test ;
52
56
53
57
import java .io .IOException ;
54
58
import java .util .*;
@@ -82,7 +86,7 @@ private static Job getJobForClient() throws IOException {
82
86
return job ;
83
87
}
84
88
85
- @ BeforeClass
89
+ @ BeforeAll
86
90
public static void create () throws IOException {
87
91
clusterConfig = getJobForClient ().getConfiguration ();
88
92
clusterConfig .setLong (
@@ -97,27 +101,27 @@ public static void create() throws IOException {
97
101
.build ();
98
102
}
99
103
100
- @ AfterClass
104
+ @ AfterAll
101
105
public static void destroy () {
102
106
if (cluster != null ) {
103
107
cluster .shutdown ();
104
108
}
105
109
}
106
110
107
- @ Before
111
+ @ BeforeEach
108
112
public void createMetaFolder () throws IOException {
109
113
config = new Configuration (clusterConfig );
110
114
config .set (DistCpConstants .CONF_LABEL_META_FOLDER , "/meta" );
111
115
Path meta = new Path ("/meta" );
112
116
cluster .getFileSystem ().mkdirs (meta );
113
117
}
114
118
115
- @ After
119
+ @ AfterEach
116
120
public void cleanupMetaFolder () throws IOException {
117
121
Path meta = new Path ("/meta" );
118
122
if (cluster .getFileSystem ().exists (meta )) {
119
123
cluster .getFileSystem ().delete (meta , true );
120
- Assert . fail ("Expected meta folder to be deleted" );
124
+ fail ("Expected meta folder to be deleted" );
121
125
}
122
126
}
123
127
@@ -129,11 +133,11 @@ public void testNoCommitAction() throws IOException {
129
133
taskAttemptContext .getTaskAttemptID ().getJobID ());
130
134
OutputCommitter committer = new CopyCommitter (null , taskAttemptContext );
131
135
committer .commitJob (jobContext );
132
- Assert . assertEquals ("Commit Successful" , taskAttemptContext .getStatus ());
136
+ assertEquals ("Commit Successful" , taskAttemptContext .getStatus ());
133
137
134
138
//Test for idempotent commit
135
139
committer .commitJob (jobContext );
136
- Assert . assertEquals ("Commit Successful" , taskAttemptContext .getStatus ());
140
+ assertEquals ("Commit Successful" , taskAttemptContext .getStatus ());
137
141
}
138
142
139
143
@ Test
@@ -412,12 +416,12 @@ public void testDeleteMissingFlatInterleavedFiles() throws IOException {
412
416
413
417
committer .commitJob (jobContext );
414
418
verifyFoldersAreInSync (fs , targetBase , sourceBase );
415
- Assert . assertEquals (4 , fs .listStatus (new Path (targetBase )).length );
419
+ assertEquals (4 , fs .listStatus (new Path (targetBase )).length );
416
420
417
421
//Test for idempotent commit
418
422
committer .commitJob (jobContext );
419
423
verifyFoldersAreInSync (fs , targetBase , sourceBase );
420
- Assert . assertEquals (4 , fs .listStatus (new Path (targetBase )).length );
424
+ assertEquals (4 , fs .listStatus (new Path (targetBase )).length );
421
425
} finally {
422
426
TestDistCpUtils .delete (fs , "/tmp1" );
423
427
conf .set (DistCpConstants .CONF_LABEL_DELETE_MISSING , "false" );
@@ -486,7 +490,7 @@ public void testAtomicCommitExistingFinal() throws IOException {
486
490
assertPathExists (fs , "Final path" , new Path (finalPath ));
487
491
try {
488
492
committer .commitJob (jobContext );
489
- Assert . fail ("Should not be able to atomic-commit to pre-existing path." );
493
+ fail ("Should not be able to atomic-commit to pre-existing path." );
490
494
} catch (Exception exception ) {
491
495
assertPathExists (fs , "Work path" , new Path (workPath ));
492
496
assertPathExists (fs , "Final path" , new Path (finalPath ));
@@ -558,17 +562,17 @@ private void testCommitWithChecksumMismatch(boolean skipCrc)
558
562
try {
559
563
committer .commitJob (jobContext );
560
564
if (!skipCrc ) {
561
- Assert . fail ("Expected commit to fail" );
565
+ fail ("Expected commit to fail" );
562
566
}
563
567
Path sourcePath = new Path (sourceBase + srcFilename );
564
568
CopyListingFileStatus sourceCurrStatus =
565
- new CopyListingFileStatus (fs .getFileStatus (sourcePath ));
566
- Assert .assertEquals ("Checksum should not be equal" ,
567
- CopyMapper .ChecksumComparison .FALSE ,
569
+ new CopyListingFileStatus (fs .getFileStatus (sourcePath ));
570
+ assertEquals (CopyMapper .ChecksumComparison .FALSE ,
568
571
DistCpUtils .checksumsAreEqual (
569
572
fs , new Path (sourceBase + srcFilename ), null ,
570
573
fs , new Path (targetBase + srcFilename ),
571
- sourceCurrStatus .getLen ()));
574
+ sourceCurrStatus .getLen ()),
575
+ "Checksum should not be equal" );
572
576
} catch (IOException exception ) {
573
577
if (skipCrc ) {
574
578
LOG .error ("Unexpected exception is found" , exception );
@@ -729,7 +733,7 @@ private void checkDirectoryPermissions(FileSystem fs, String targetBase,
729
733
for (FileStatus status : fStatus ) {
730
734
if (status .isDirectory ()) {
731
735
stack .push (status .getPath ());
732
- Assert . assertEquals (sourcePerm , status .getPermission ());
736
+ assertEquals (sourcePerm , status .getPermission ());
733
737
}
734
738
}
735
739
}
@@ -746,10 +750,10 @@ private void checkDirectoryTimes(
746
750
while (sourceReader .next (srcRelPath , srcFileStatus )) {
747
751
Path targetFile = new Path (targetRoot .toString () + "/" + srcRelPath );
748
752
FileStatus targetStatus = fs .getFileStatus (targetFile );
749
- Assert . assertEquals (srcFileStatus .getModificationTime (),
750
- targetStatus .getModificationTime ());
751
- Assert . assertEquals (srcFileStatus .getAccessTime (),
752
- targetStatus .getAccessTime ());
753
+ assertEquals (srcFileStatus .getModificationTime (),
754
+ targetStatus .getModificationTime ());
755
+ assertEquals (srcFileStatus .getAccessTime (),
756
+ targetStatus .getAccessTime ());
753
757
}
754
758
} finally {
755
759
IOUtils .closeStream (sourceReader );
0 commit comments