accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mmil...@apache.org
Subject [1/2] accumulo git commit: ACCUMULO-4522: cleanup of unsed param in FileUtil
Date Thu, 17 Nov 2016 20:06:23 GMT
Repository: accumulo
Updated Branches:
  refs/heads/1.8 cd43958fe -> 43b740bc7


ACCUMULO-4522: cleanup of unsed param in FileUtil


Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/8a35b6dd
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/8a35b6dd
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/8a35b6dd

Branch: refs/heads/1.8
Commit: 8a35b6dd48668449919a172afb96a9851ce211a0
Parents: a361f63
Author: Mike Miller <mmiller@apache.org>
Authored: Thu Nov 17 13:55:03 2016 -0500
Committer: Mike Miller <mmiller@apache.org>
Committed: Thu Nov 17 13:55:03 2016 -0500

----------------------------------------------------------------------
 .../apache/accumulo/server/util/FileUtil.java   |  6 +--
 .../accumulo/server/util/FileUtilTest.java      | 51 ++++----------------
 2 files changed, 12 insertions(+), 45 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/8a35b6dd/server/base/src/main/java/org/apache/accumulo/server/util/FileUtil.java
----------------------------------------------------------------------
diff --git a/server/base/src/main/java/org/apache/accumulo/server/util/FileUtil.java b/server/base/src/main/java/org/apache/accumulo/server/util/FileUtil.java
index 51a0783..ea34dd8 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/util/FileUtil.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/util/FileUtil.java
@@ -254,7 +254,7 @@ public class FileUtil {
       return (numLte + 1) / (double) (numKeys + 2);
 
     } finally {
-      cleanupIndexOp(acuconf, tmpDir, fs, readers);
+      cleanupIndexOp(tmpDir, fs, readers);
     }
   }
 
@@ -362,11 +362,11 @@ public class FileUtil {
 
       return ret;
     } finally {
-      cleanupIndexOp(acuConf, tmpDir, fs, readers);
+      cleanupIndexOp(tmpDir, fs, readers);
     }
   }
 
-  protected static void cleanupIndexOp(AccumuloConfiguration acuConf, Path tmpDir, VolumeManager
fs, ArrayList<FileSKVIterator> readers) throws IOException {
+  protected static void cleanupIndexOp(Path tmpDir, VolumeManager fs, ArrayList<FileSKVIterator>
readers) throws IOException {
     // close all of the index sequence files
     for (FileSKVIterator r : readers) {
       try {

http://git-wip-us.apache.org/repos/asf/accumulo/blob/8a35b6dd/server/base/src/test/java/org/apache/accumulo/server/util/FileUtilTest.java
----------------------------------------------------------------------
diff --git a/server/base/src/test/java/org/apache/accumulo/server/util/FileUtilTest.java b/server/base/src/test/java/org/apache/accumulo/server/util/FileUtilTest.java
index a826acf..9cb882c 100644
--- a/server/base/src/test/java/org/apache/accumulo/server/util/FileUtilTest.java
+++ b/server/base/src/test/java/org/apache/accumulo/server/util/FileUtilTest.java
@@ -27,10 +27,7 @@ import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.Iterator;
-import java.util.Map;
 
-import org.apache.accumulo.core.conf.AccumuloConfiguration;
-import org.apache.accumulo.core.conf.DefaultConfiguration;
 import org.apache.accumulo.core.conf.Property;
 import org.apache.accumulo.core.file.FileSKVIterator;
 import org.apache.accumulo.server.fs.FileRef;
@@ -44,8 +41,6 @@ import org.junit.Test;
 import org.junit.rules.TemporaryFolder;
 import org.junit.rules.TestName;
 
-import com.google.common.base.Predicate;
-
 /**
  *
  */
@@ -94,10 +89,9 @@ public class FileUtilTest {
     HashMap<Property,String> testProps = new HashMap<>();
     testProps.put(Property.INSTANCE_DFS_DIR, accumuloDir.getAbsolutePath());
 
-    AccumuloConfiguration testConf = new FileUtilTestConfiguration(testProps);
     VolumeManager fs = VolumeManagerImpl.getLocal(accumuloDir.getAbsolutePath());
 
-    FileUtil.cleanupIndexOp(testConf, tmpPath1, fs, new ArrayList<FileSKVIterator>());
+    FileUtil.cleanupIndexOp(tmpPath1, fs, new ArrayList<FileSKVIterator>());
 
     Assert.assertFalse("Expected " + tmp1 + " to be cleaned up but it wasn't", tmp1.exists());
   }
@@ -121,14 +115,13 @@ public class FileUtilTest {
     HashMap<Property,String> testProps = new HashMap<>();
     testProps.put(Property.INSTANCE_VOLUMES, v1.toURI().toString() + "," + v2.toURI().toString());
 
-    AccumuloConfiguration testConf = new FileUtilTestConfiguration(testProps);
     VolumeManager fs = VolumeManagerImpl.getLocal(accumuloDir.getAbsolutePath());
 
-    FileUtil.cleanupIndexOp(testConf, tmpPath1, fs, new ArrayList<FileSKVIterator>());
+    FileUtil.cleanupIndexOp(tmpPath1, fs, new ArrayList<FileSKVIterator>());
 
     Assert.assertFalse("Expected " + tmp1 + " to be cleaned up but it wasn't", tmp1.exists());
 
-    FileUtil.cleanupIndexOp(testConf, tmpPath2, fs, new ArrayList<FileSKVIterator>());
+    FileUtil.cleanupIndexOp(tmpPath2, fs, new ArrayList<FileSKVIterator>());
 
     Assert.assertFalse("Expected " + tmp2 + " to be cleaned up but it wasn't", tmp2.exists());
   }
@@ -153,14 +146,13 @@ public class FileUtilTest {
     HashMap<Property,String> testProps = new HashMap<>();
     testProps.put(Property.INSTANCE_VOLUMES, v1.toURI().toString() + "," + v2.toURI().toString());
 
-    AccumuloConfiguration testConf = new FileUtilTestConfiguration(testProps);
     VolumeManager fs = VolumeManagerImpl.getLocal(accumuloDir.getAbsolutePath());
 
-    FileUtil.cleanupIndexOp(testConf, tmpPath1, fs, new ArrayList<FileSKVIterator>());
+    FileUtil.cleanupIndexOp(tmpPath1, fs, new ArrayList<FileSKVIterator>());
 
     Assert.assertFalse("Expected " + tmp1 + " to be cleaned up but it wasn't", tmp1.exists());
 
-    FileUtil.cleanupIndexOp(testConf, tmpPath2, fs, new ArrayList<FileSKVIterator>());
+    FileUtil.cleanupIndexOp(tmpPath2, fs, new ArrayList<FileSKVIterator>());
 
     Assert.assertFalse("Expected " + tmp2 + " to be cleaned up but it wasn't", tmp2.exists());
   }
@@ -181,14 +173,13 @@ public class FileUtilTest {
     HashMap<Property,String> testProps = new HashMap<>();
     testProps.put(Property.INSTANCE_VOLUMES, v1.toURI().toString() + "," + v2.toURI().toString());
 
-    AccumuloConfiguration testConf = new FileUtilTestConfiguration(testProps);
     VolumeManager fs = VolumeManagerImpl.getLocal(accumuloDir.getAbsolutePath());
 
-    FileUtil.cleanupIndexOp(testConf, tmpPath1, fs, new ArrayList<FileSKVIterator>());
+    FileUtil.cleanupIndexOp(tmpPath1, fs, new ArrayList<FileSKVIterator>());
 
     Assert.assertFalse("Expected " + tmp1 + " to be cleaned up but it wasn't", tmp1.exists());
 
-    FileUtil.cleanupIndexOp(testConf, tmpPath2, fs, new ArrayList<FileSKVIterator>());
+    FileUtil.cleanupIndexOp(tmpPath2, fs, new ArrayList<FileSKVIterator>());
 
     Assert.assertFalse("Expected " + tmp2 + " to be cleaned up but it wasn't", tmp2.exists());
   }
@@ -210,38 +201,14 @@ public class FileUtilTest {
     HashMap<Property,String> testProps = new HashMap<>();
     testProps.put(Property.INSTANCE_VOLUMES, v1.toURI().toString() + "," + v2.toURI().toString());
 
-    AccumuloConfiguration testConf = new FileUtilTestConfiguration(testProps);
     VolumeManager fs = VolumeManagerImpl.getLocal(accumuloDir.getAbsolutePath());
 
-    FileUtil.cleanupIndexOp(testConf, tmpPath1, fs, new ArrayList<FileSKVIterator>());
+    FileUtil.cleanupIndexOp(tmpPath1, fs, new ArrayList<FileSKVIterator>());
 
     Assert.assertFalse("Expected " + tmp1 + " to be cleaned up but it wasn't", tmp1.exists());
 
-    FileUtil.cleanupIndexOp(testConf, tmpPath2, fs, new ArrayList<FileSKVIterator>());
+    FileUtil.cleanupIndexOp(tmpPath2, fs, new ArrayList<FileSKVIterator>());
 
     Assert.assertFalse("Expected " + tmp2 + " to be cleaned up but it wasn't", tmp2.exists());
   }
-
-  private static class FileUtilTestConfiguration extends AccumuloConfiguration {
-    private DefaultConfiguration defaultConf = new DefaultConfiguration();
-    private Map<Property,String> properties;
-
-    public FileUtilTestConfiguration(Map<Property,String> properties) {
-      this.properties = properties;
-    }
-
-    @Override
-    public String get(Property property) {
-      String value = properties.get(property);
-      if (null != value) {
-        return value;
-      }
-      return defaultConf.get(property);
-    }
-
-    @Override
-    public void getProperties(Map<String,String> props, Predicate<String> filter)
{
-      throw new UnsupportedOperationException();
-    }
-  }
 }


Mime
View raw message