19
19
20
20
import org .apache .hadoop .fs .*;
21
21
import org .apache .hadoop .fs .compat .common .*;
22
- import org .junit .Assert ;
23
22
24
23
import java .io .IOException ;
25
24
import java .util .ArrayList ;
26
25
import java .util .List ;
27
26
27
+ import static org .junit .jupiter .api .Assertions .assertEquals ;
28
+ import static org .junit .jupiter .api .Assertions .assertFalse ;
29
+ import static org .junit .jupiter .api .Assertions .assertTrue ;
30
+ import static org .junit .jupiter .api .Assertions .assertNotNull ;
31
+
28
32
@ HdfsCompatCaseGroup (name = "Directory" )
29
33
public class HdfsCompatDirectory extends AbstractHdfsCompatCase {
30
34
private static final int FILE_LEN = 128 ;
@@ -45,101 +49,101 @@ public void cleanup() throws IOException {
45
49
46
50
@ HdfsCompatCase
47
51
public void isDirectory () throws IOException {
48
- Assert . assertTrue (fs ().isDirectory (dir ));
52
+ assertTrue (fs ().isDirectory (dir ));
49
53
}
50
54
51
55
@ HdfsCompatCase
52
56
public void listStatus () throws IOException {
53
57
FileStatus [] files = fs ().listStatus (dir );
54
- Assert . assertNotNull (files );
55
- Assert . assertEquals (1 , files .length );
56
- Assert . assertEquals (file .getName (), files [0 ].getPath ().getName ());
58
+ assertNotNull (files );
59
+ assertEquals (1 , files .length );
60
+ assertEquals (file .getName (), files [0 ].getPath ().getName ());
57
61
}
58
62
59
63
@ HdfsCompatCase
60
64
public void globStatus () throws IOException {
61
65
FileStatus [] files = fs ().globStatus (new Path (dir , "*ile" ));
62
- Assert . assertNotNull (files );
63
- Assert . assertEquals (1 , files .length );
64
- Assert . assertEquals (file .getName (), files [0 ].getPath ().getName ());
66
+ assertNotNull (files );
67
+ assertEquals (1 , files .length );
68
+ assertEquals (file .getName (), files [0 ].getPath ().getName ());
65
69
}
66
70
67
71
@ HdfsCompatCase
68
72
public void listLocatedStatus () throws IOException {
69
73
RemoteIterator <LocatedFileStatus > locatedFileStatuses =
70
74
fs ().listLocatedStatus (dir );
71
- Assert . assertNotNull (locatedFileStatuses );
75
+ assertNotNull (locatedFileStatuses );
72
76
List <LocatedFileStatus > files = new ArrayList <>();
73
77
while (locatedFileStatuses .hasNext ()) {
74
78
files .add (locatedFileStatuses .next ());
75
79
}
76
- Assert . assertEquals (1 , files .size ());
80
+ assertEquals (1 , files .size ());
77
81
LocatedFileStatus fileStatus = files .get (0 );
78
- Assert . assertEquals (file .getName (), fileStatus .getPath ().getName ());
82
+ assertEquals (file .getName (), fileStatus .getPath ().getName ());
79
83
}
80
84
81
85
@ HdfsCompatCase
82
86
public void listStatusIterator () throws IOException {
83
87
RemoteIterator <FileStatus > fileStatuses = fs ().listStatusIterator (dir );
84
- Assert . assertNotNull (fileStatuses );
88
+ assertNotNull (fileStatuses );
85
89
List <FileStatus > files = new ArrayList <>();
86
90
while (fileStatuses .hasNext ()) {
87
91
files .add (fileStatuses .next ());
88
92
}
89
- Assert . assertEquals (1 , files .size ());
93
+ assertEquals (1 , files .size ());
90
94
FileStatus fileStatus = files .get (0 );
91
- Assert . assertEquals (file .getName (), fileStatus .getPath ().getName ());
95
+ assertEquals (file .getName (), fileStatus .getPath ().getName ());
92
96
}
93
97
94
98
@ HdfsCompatCase
95
99
public void listFiles () throws IOException {
96
100
RemoteIterator <LocatedFileStatus > iter = fs ().listFiles (dir , true );
97
- Assert . assertNotNull (iter );
101
+ assertNotNull (iter );
98
102
List <LocatedFileStatus > files = new ArrayList <>();
99
103
while (iter .hasNext ()) {
100
104
files .add (iter .next ());
101
105
}
102
- Assert . assertEquals (1 , files .size ());
106
+ assertEquals (1 , files .size ());
103
107
}
104
108
105
109
@ HdfsCompatCase
106
110
public void listCorruptFileBlocks () throws IOException {
107
111
RemoteIterator <Path > iter = fs ().listCorruptFileBlocks (dir );
108
- Assert . assertNotNull (iter );
109
- Assert . assertFalse (iter .hasNext ()); // No corrupted file
112
+ assertNotNull (iter );
113
+ assertFalse (iter .hasNext ()); // No corrupted file
110
114
}
111
115
112
116
@ HdfsCompatCase
113
117
public void getContentSummary () throws IOException {
114
118
ContentSummary summary = fs ().getContentSummary (dir );
115
- Assert . assertEquals (1 , summary .getFileCount ());
116
- Assert . assertEquals (1 , summary .getDirectoryCount ());
117
- Assert . assertEquals (FILE_LEN , summary .getLength ());
119
+ assertEquals (1 , summary .getFileCount ());
120
+ assertEquals (1 , summary .getDirectoryCount ());
121
+ assertEquals (FILE_LEN , summary .getLength ());
118
122
}
119
123
120
124
@ HdfsCompatCase
121
125
public void getUsed () throws IOException {
122
126
long used = fs ().getUsed (dir );
123
- Assert . assertTrue (used >= FILE_LEN );
127
+ assertTrue (used >= FILE_LEN );
124
128
}
125
129
126
130
@ HdfsCompatCase
127
131
public void getQuotaUsage () throws IOException {
128
132
QuotaUsage usage = fs ().getQuotaUsage (dir );
129
- Assert . assertEquals (2 , usage .getFileAndDirectoryCount ());
133
+ assertEquals (2 , usage .getFileAndDirectoryCount ());
130
134
}
131
135
132
136
@ HdfsCompatCase
133
137
public void setQuota () throws IOException {
134
138
fs ().setQuota (dir , 1048576L , 1073741824L );
135
139
QuotaUsage usage = fs ().getQuotaUsage (dir );
136
- Assert . assertEquals (1048576L , usage .getQuota ());
140
+ assertEquals (1048576L , usage .getQuota ());
137
141
}
138
142
139
143
@ HdfsCompatCase
140
144
public void setQuotaByStorageType () throws IOException {
141
145
fs ().setQuotaByStorageType (dir , StorageType .DISK , 1048576L );
142
146
QuotaUsage usage = fs ().getQuotaUsage (dir );
143
- Assert . assertEquals (1048576L , usage .getTypeQuota (StorageType .DISK ));
147
+ assertEquals (1048576L , usage .getTypeQuota (StorageType .DISK ));
144
148
}
145
149
}
0 commit comments