Skip to content

Commit

Permalink
HADOOP-13686. Adding additional unit test for Trash (I). Contributed …
Browse files Browse the repository at this point in the history
…by Weiwei Yang.
  • Loading branch information
xiaoyuyao committed Oct 14, 2016
1 parent 5a5a724 commit dbe663d
Show file tree
Hide file tree
Showing 2 changed files with 356 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
import org.apache.hadoop.fs.permission.FsPermission;
import org.apache.hadoop.util.Time;

import com.google.common.annotations.VisibleForTesting;

/** Provides a <i>trash</i> feature. Files are moved to a user's trash
* directory, a subdirectory of their home directory named ".Trash". Files are
* initially moved to a <i>current</i> sub-directory of the trash directory.
Expand Down Expand Up @@ -215,15 +217,15 @@ public Runnable getEmptier() throws IOException {
return new Emptier(getConf(), emptierInterval);
}

private class Emptier implements Runnable {
protected class Emptier implements Runnable {

private Configuration conf;
private long emptierInterval;

Emptier(Configuration conf, long emptierInterval) throws IOException {
this.conf = conf;
this.emptierInterval = emptierInterval;
if (emptierInterval > deletionInterval || emptierInterval == 0) {
if (emptierInterval > deletionInterval || emptierInterval <= 0) {
LOG.info("The configured checkpoint interval is " +
(emptierInterval / MSECS_PER_MINUTE) + " minutes." +
" Using an interval of " +
Expand Down Expand Up @@ -287,6 +289,11 @@ private long ceiling(long time, long interval) {
private long floor(long time, long interval) {
return (time / interval) * interval;
}

@VisibleForTesting
protected long getEmptierInterval() {
return this.emptierInterval/MSECS_PER_MINUTE;
}
}

private void createCheckpoint(Path trashRoot, Date date) throws IOException {
Expand Down
Loading

0 comments on commit dbe663d

Please sign in to comment.