File tree Expand file tree Collapse file tree 2 files changed +13
-5
lines changed
hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs
hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs Expand file tree Collapse file tree 2 files changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -201,16 +201,20 @@ public void testTouch() throws Exception {
201201 assertThat (fileStatus .getAccessTime ()).isEqualTo (dateObj .getTime ());
202202 assertThat (fileStatus .getModificationTime ()).isEqualTo (dateObj .getTime ());
203203
204- touchDirTests ();
204+ lfs .delete (newFile , true );
205+ assertThat (lfs .exists (newFile )).isFalse ();
206+
205207 }
206208
207- private void touchDirTests () throws Exception {
209+ @ Test
210+ public void testTouchDir () throws Exception {
208211 String strTime ;
209212 final String newFileName = "dir3/newFile3" ;
210213 Date dateObj ;
211214 final Path newFile = new Path (newFileName );
212215 FileStatus fstatus ;
213216 Path dirPath = new Path ("dir3" );
217+ lfs .delete (dirPath , true );
214218 lfs .mkdirs (dirPath );
215219 lfs .delete (newFile , true );
216220 assertThat (lfs .exists (newFile )).isFalse ();
@@ -266,6 +270,8 @@ private void touchDirTests() throws Exception {
266270
267271 lfs .delete (newFile , true );
268272 lfs .delete (dirPath , true );
273+ assertThat (lfs .exists (newFile )).isFalse ();
274+ assertThat (lfs .exists (dirPath )).isFalse ();
269275 }
270276
271277 private String formatTimestamp (long timeInMillis ) {
Original file line number Diff line number Diff line change 3838
3939import static org .assertj .core .api .Assertions .assertThat ;
4040
41+ /**
42+ * Tests to perform Touch operations on DFS.
43+ */
4144public class TestDFSShellTouch {
4245
4346 private static final Logger LOG = LoggerFactory .getLogger (TestDFSShellTouch .class );
@@ -147,11 +150,10 @@ public void testTouch() throws Exception {
147150 dfs .delete (newFile , true );
148151 assertThat (dfs .exists (newFile )).isFalse ();
149152
150- touchDirTests ();
151-
152153 }
153154
154- private void touchDirTests () throws IOException , ParseException , InterruptedException {
155+ @ Test
156+ public void testTouchDirs () throws IOException , ParseException , InterruptedException {
155157 final String newFileName = "dir2/newFile2" ;
156158 final Path newFile = new Path (newFileName );
157159 FileStatus newStatus ;
You can’t perform that action at this time.
0 commit comments