You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by el...@apache.org on 2014/08/10 21:27:51 UTC

[2/3] git commit: ACCUMULO-2560 Fix broken unit test

ACCUMULO-2560 Fix broken unit test


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

Branch: refs/heads/master
Commit: 07bacc346b798b1607ec4c83f9dc37a8c55e6e3e
Parents: 0277521
Author: Josh Elser <el...@apache.org>
Authored: Sun Aug 10 15:25:14 2014 -0400
Committer: Josh Elser <el...@apache.org>
Committed: Sun Aug 10 15:25:14 2014 -0400

----------------------------------------------------------------------
 .../accumulo/gc/SimpleGarbageCollectorTest.java     | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/07bacc34/server/gc/src/test/java/org/apache/accumulo/gc/SimpleGarbageCollectorTest.java
----------------------------------------------------------------------
diff --git a/server/gc/src/test/java/org/apache/accumulo/gc/SimpleGarbageCollectorTest.java b/server/gc/src/test/java/org/apache/accumulo/gc/SimpleGarbageCollectorTest.java
index baa98b7..d4319b8 100644
--- a/server/gc/src/test/java/org/apache/accumulo/gc/SimpleGarbageCollectorTest.java
+++ b/server/gc/src/test/java/org/apache/accumulo/gc/SimpleGarbageCollectorTest.java
@@ -17,18 +17,23 @@
 package org.apache.accumulo.gc;
 
 import java.io.FileNotFoundException;
+
 import org.apache.accumulo.core.client.Instance;
 import org.apache.accumulo.core.conf.AccumuloConfiguration;
 import org.apache.accumulo.core.conf.Property;
 import org.apache.accumulo.core.security.Credentials;
 import org.apache.accumulo.core.security.thrift.TCredentials;
 import org.apache.accumulo.gc.SimpleGarbageCollector.Opts;
+
 import static org.apache.accumulo.gc.SimpleGarbageCollector.CANDIDATE_MEMORY_PERCENTAGE;
+
 import org.apache.accumulo.server.fs.VolumeManager;
 import org.apache.accumulo.trace.thrift.TInfo;
 import org.apache.hadoop.fs.Path;
+import org.easymock.EasyMock;
 import org.junit.Before;
 import org.junit.Test;
+
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
@@ -69,15 +74,20 @@ public class SimpleGarbageCollectorTest {
     AccumuloConfiguration systemConfig = createMock(AccumuloConfiguration.class);
     expect(systemConfig.getTimeInMillis(Property.GC_CYCLE_START)).andReturn(1000L);
     expect(systemConfig.getTimeInMillis(Property.GC_CYCLE_DELAY)).andReturn(20000L);
-    expect(systemConfig.getCount(Property.GC_DELETE_THREADS)).andReturn(2);
-    expect(systemConfig.getCount(Property.GC_DELETE_THREADS)).andReturn(2);
+    expect(systemConfig.getCount(Property.GC_DELETE_THREADS)).andReturn(2).times(2);
     expect(systemConfig.getBoolean(Property.GC_TRASH_IGNORE)).andReturn(false);
     replay(systemConfig);
     return systemConfig;
   }
 
-  //@Test
+  @Test
   public void testInit() throws Exception {
+    EasyMock.reset(systemConfig);
+    expect(systemConfig.getTimeInMillis(Property.GC_CYCLE_START)).andReturn(1000L).times(2);
+    expect(systemConfig.getTimeInMillis(Property.GC_CYCLE_DELAY)).andReturn(20000L);
+    expect(systemConfig.getCount(Property.GC_DELETE_THREADS)).andReturn(2).times(2);
+    expect(systemConfig.getBoolean(Property.GC_TRASH_IGNORE)).andReturn(false);
+    replay(systemConfig);
     gc.init(volMgr, instance, credentials, systemConfig);
     assertSame(volMgr, gc.getVolumeManager());
     assertSame(instance, gc.getInstance());