From 28d06dff93eb11da8e79af8253ff7fa0fde53b55 Mon Sep 17 00:00:00 2001 From: "Brian S. O'Neill" Date: Wed, 19 Nov 2008 00:27:14 +0000 Subject: Fix resync when query is known to return one entry. --- .../carbonado/repo/replicated/TestRepair.java | 23 +++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) (limited to 'src/test/java') diff --git a/src/test/java/com/amazon/carbonado/repo/replicated/TestRepair.java b/src/test/java/com/amazon/carbonado/repo/replicated/TestRepair.java index 4f71e76..7905e8b 100644 --- a/src/test/java/com/amazon/carbonado/repo/replicated/TestRepair.java +++ b/src/test/java/com/amazon/carbonado/repo/replicated/TestRepair.java @@ -367,14 +367,20 @@ public class TestRepair extends TestCase { } public void testCorruptEntry() throws Exception { - testCorruptEntry(false); + testCorruptEntry(false, false); } public void testCorruptEntryPreventDelete() throws Exception { - testCorruptEntry(true); + testCorruptEntry(false, true); } - private void testCorruptEntry(boolean preventDelete) throws Exception { + public void testIndividualCorruptEntry() throws Exception { + testCorruptEntry(true, false); + } + + private void testCorruptEntry(boolean individualRepair, boolean preventDelete) + throws Exception + { // Close and open repository again, this time on disk. We need to close // and re-open the repository as part of the test. String[] locations = reOpenPersistent(null); @@ -494,7 +500,7 @@ public class TestRepair extends TestCase { // Resync to repair. class Prevent extends Trigger { - boolean didRun; + volatile boolean didRun; @Override public Object beforeDelete(Object s) throws PersistException { @@ -514,7 +520,14 @@ public class TestRepair extends TestCase { } ResyncCapability cap = mReplicated.getCapability(ResyncCapability.class); - cap.resync(type0, 1.0, null); + + if (individualRepair) { + for (int i=0; i