accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From els...@apache.org
Subject git commit: ACCUMULO-2941 Use a DefaultConfiguration instead of (unintentionally) hitting ZK
Date Tue, 24 Jun 2014 02:36:33 GMT
Repository: accumulo
Updated Branches:
  refs/heads/master 6927fb527 -> a57c6bdaf


ACCUMULO-2941 Use a DefaultConfiguration instead of (unintentionally) hitting ZK


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

Branch: refs/heads/master
Commit: a57c6bdaf28c6b9a019254a7feca41f87fa0024f
Parents: 6927fb5
Author: Josh Elser <elserj@apache.org>
Authored: Mon Jun 23 22:35:54 2014 -0400
Committer: Josh Elser <elserj@apache.org>
Committed: Mon Jun 23 22:35:54 2014 -0400

----------------------------------------------------------------------
 .../LargestFirstMemoryManagerTest.java          | 42 +++++++++++++++++++-
 1 file changed, 40 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/a57c6bda/server/tserver/src/test/java/org/apache/accumulo/server/tabletserver/LargestFirstMemoryManagerTest.java
----------------------------------------------------------------------
diff --git a/server/tserver/src/test/java/org/apache/accumulo/server/tabletserver/LargestFirstMemoryManagerTest.java
b/server/tserver/src/test/java/org/apache/accumulo/server/tabletserver/LargestFirstMemoryManagerTest.java
index a9c609b..4126e78 100644
--- a/server/tserver/src/test/java/org/apache/accumulo/server/tabletserver/LargestFirstMemoryManagerTest.java
+++ b/server/tserver/src/test/java/org/apache/accumulo/server/tabletserver/LargestFirstMemoryManagerTest.java
@@ -23,8 +23,12 @@ import java.util.List;
 
 import org.apache.accumulo.core.client.Instance;
 import org.apache.accumulo.core.client.mock.MockInstance;
+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.data.KeyExtent;
 import org.apache.accumulo.server.conf.ServerConfiguration;
+import org.apache.accumulo.server.conf.TableConfiguration;
 import org.apache.hadoop.io.Text;
 import org.junit.Test;
 
@@ -41,7 +45,7 @@ public class LargestFirstMemoryManagerTest {
   public void test() throws Exception {
     LargestFirstMemoryManagerUnderTest mgr = new LargestFirstMemoryManagerUnderTest();
     Instance instance = new MockInstance();
-    ServerConfiguration config = new ServerConfiguration(instance);
+    ServerConfigurationCopy config = new ServerConfigurationCopy(instance);
     mgr.init(config);
     MemoryManagementActions result;
     // nothing to do
@@ -258,5 +262,39 @@ public class LargestFirstMemoryManagerTest {
   private static List<TabletState> tablets(TabletState ... states) {
     return Arrays.asList(states);
   }
-  
+
+  // Spoof out the TableConfiguration to just use a DefaultConfiguration
+  private static class DefaultTableConfiguration extends TableConfiguration {
+    private static final DefaultConfiguration defaultConf = new DefaultConfiguration();
+
+    public DefaultTableConfiguration() {
+      super(null, null, null, null);
+    }
+
+    @Override
+    public String get(Property property) {
+      return defaultConf.get(property);
+    }
+
+    @Override
+    public long getMemoryInBytes(Property property) {
+      return defaultConf.getMemoryInBytes(property);
+    }
+  }
+
+  private static class ServerConfigurationCopy extends ServerConfiguration {
+    public ServerConfigurationCopy(Instance instance) {
+      super(instance);
+    }
+
+    @Override
+    public TableConfiguration getTableConfiguration(String tableId) {
+      return new DefaultTableConfiguration();
+    }
+
+    @Override
+    public AccumuloConfiguration getConfiguration() {
+      return new DefaultTableConfiguration();
+    }
+  }
 }


Mime
View raw message