geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bschucha...@apache.org
Subject [39/50] [abbrv] incubator-geode git commit: GEODE-544: Removes soplog code and tests
Date Tue, 17 Nov 2015 20:54:49 GMT
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/9438c8b1/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/persistence/soplog/nofile/NoFileSortedOplog.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/persistence/soplog/nofile/NoFileSortedOplog.java b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/persistence/soplog/nofile/NoFileSortedOplog.java
deleted file mode 100644
index 8995f66..0000000
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/persistence/soplog/nofile/NoFileSortedOplog.java
+++ /dev/null
@@ -1,244 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gemstone.gemfire.internal.cache.persistence.soplog.nofile;
-
-import java.io.File;
-import java.io.IOException;
-import java.nio.ByteBuffer;
-import java.util.Collections;
-import java.util.EnumMap;
-import java.util.NavigableMap;
-import java.util.concurrent.ConcurrentSkipListMap;
-import java.util.concurrent.atomic.AtomicReference;
-
-import com.gemstone.gemfire.internal.cache.persistence.soplog.AbstractSortedReader;
-import com.gemstone.gemfire.internal.cache.persistence.soplog.SortedBuffer.BufferIterator;
-import com.gemstone.gemfire.internal.cache.persistence.soplog.SortedOplog;
-import com.gemstone.gemfire.internal.cache.persistence.soplog.SortedOplogFactory.SortedOplogConfiguration;
-import com.gemstone.gemfire.internal.cache.persistence.soplog.SortedReader.Metadata;
-import com.gemstone.gemfire.internal.cache.persistence.soplog.SortedReader.SortedStatistics;
-
-public class NoFileSortedOplog implements SortedOplog {
-  private final SortedOplogConfiguration config;
-  
-  private final AtomicReference<NavigableMap<byte[], byte[]>> data;
-  private final EnumMap<Metadata, byte[]> metadata;
-  private final NoFileStatistics stats;
-  
-  public NoFileSortedOplog(SortedOplogConfiguration config) {
-    this.config = config;
-    
-    data = new AtomicReference<NavigableMap<byte[],byte[]>>();
-    metadata = new EnumMap<Metadata, byte[]>(Metadata.class);
-    stats = new NoFileStatistics();
-  }
-  
-  @Override
-  public SortedOplogReader createReader() throws IOException {
-    return new NoFileReader();
-  }
-
-  @Override
-  public SortedOplogWriter createWriter() throws IOException {
-    synchronized (metadata) {
-      metadata.clear();
-    }
-    data.set(new ConcurrentSkipListMap<byte[], byte[]>(config.getComparator()));
-    
-    return new NoFileWriter();
-  }
-  
-  private class NoFileWriter implements SortedOplogWriter {
-    @Override
-    public void append(byte[] key, byte[] value) throws IOException {
-      if (data.get().put(key, value) == null) {
-        stats.add(key.length, value.length);
-      }
-    }
-
-    @Override
-    public void append(ByteBuffer key, ByteBuffer value) throws IOException {
-      byte[] k = new byte[key.remaining()];
-      byte[] v = new byte[value.remaining()];
-      
-      key.get(k);
-      value.get(v);
-      
-      append(k, v);
-    }
-
-    @Override
-    public void close(EnumMap<Metadata, byte[]> meta) throws IOException {
-      if (meta != null) {
-        synchronized (metadata) {
-          metadata.putAll(meta);
-        }
-      }
-    }
-
-    @Override
-    public void closeAndDelete() throws IOException {
-      data.get().clear();
-      data.set(null);
-    }
-  }
-  
-  private class NoFileReader extends AbstractSortedReader implements SortedOplogReader {
-    private final BloomFilter bloom;
-    private volatile boolean closed;
-    
-    public NoFileReader() {
-      closed = false;
-      bloom = new BloomFilter() {
-        @Override
-        public boolean mightContain(byte[] key) {
-          return data.get().containsKey(key);
-        }
-      };
-    }
-    
-    @Override
-    public boolean mightContain(byte[] key) throws IOException {
-      return bloom.mightContain(key);
-    }
-
-    @Override
-    public ByteBuffer read(byte[] key) throws IOException {
-      return ByteBuffer.wrap(data.get().get(key));
-    }
-
-    @Override
-    public SortedIterator<ByteBuffer> scan(
-        byte[] from, boolean fromInclusive, 
-        byte[] to, boolean toInclusive,
-        boolean ascending,
-        MetadataFilter filter) {
-
-      if (filter == null || filter.accept(metadata.get(filter.getName()))) {
-        NavigableMap<byte[],byte[]> subset = ascending ? data.get() : data.get().descendingMap();
-        if (from == null && to == null) {
-          // we're good
-        } else if (from == null) {
-          subset = subset.headMap(to, toInclusive);
-        } else if (to == null) {
-          subset = subset.tailMap(from, fromInclusive);
-        } else {
-          subset = subset.subMap(from, fromInclusive, to, toInclusive);
-        }
-        return new BufferIterator(subset.entrySet().iterator());
-      }
-      return new BufferIterator(Collections.<byte[], byte[]>emptyMap().entrySet().iterator());
-    }
-
-    @Override
-    public SerializedComparator getComparator() {
-      return (SerializedComparator) data.get().comparator();
-    }
-
-    @Override
-    public SortedStatistics getStatistics() {
-      return stats;
-    }
-
-    @Override
-    public boolean isClosed() {
-      return closed;
-    }
-    
-    @Override
-    public void close() throws IOException {
-      closed = true;
-    }
-
-    @Override
-    public BloomFilter getBloomFilter() {
-      return bloom;
-    }
-
-    @Override
-    public byte[] getMetadata(Metadata name) {
-      synchronized (metadata) {
-        return metadata.get(name);
-      }
-    }
-
-    @Override
-    public File getFile() {
-      return new File(".");
-    }
-    
-    @Override
-    public String getFileName() {
-      return "name";
-    }
-   
-    @Override
-    public long getModificationTimeStamp() throws IOException {
-      return 0;
-    }
-    
-    @Override
-    public void rename(String name) throws IOException {
-    }
-    
-    @Override
-    public void delete() throws IOException {
-    }
-  }
-  
-  private class NoFileStatistics implements SortedStatistics {
-    private long keys;
-    private double avgKeySize;
-    private double avgValueSize;
-    
-    private synchronized void add(int keyLength, int valueLength) {
-      avgKeySize = (keyLength + keys * avgKeySize) / (keys + 1);
-      avgValueSize = (keyLength + keys * avgValueSize) / (keys + 1);
-      
-      keys++;
-    }
-    
-    @Override
-    public synchronized long keyCount() {
-      return keys;
-    }
-
-    @Override
-    public byte[] firstKey() {
-      return data.get().firstKey();
-    }
-
-    @Override
-    public byte[] lastKey() {
-      return data.get().lastKey();
-    }
-
-    @Override
-    public synchronized double avgKeySize() {
-      return avgKeySize;
-    }
-    
-    @Override
-    public synchronized double avgValueSize() {
-      return avgValueSize;
-    }
-    
-    @Override
-    public void close() {
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/9438c8b1/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/persistence/soplog/nofile/NoFileSortedOplogFactory.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/persistence/soplog/nofile/NoFileSortedOplogFactory.java b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/persistence/soplog/nofile/NoFileSortedOplogFactory.java
deleted file mode 100644
index 365d796..0000000
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/persistence/soplog/nofile/NoFileSortedOplogFactory.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gemstone.gemfire.internal.cache.persistence.soplog.nofile;
-
-import java.io.File;
-import java.io.IOException;
-
-import com.gemstone.gemfire.internal.cache.persistence.soplog.SortedOplog;
-import com.gemstone.gemfire.internal.cache.persistence.soplog.SortedOplogFactory;
-
-public class NoFileSortedOplogFactory implements SortedOplogFactory {
-  private final SortedOplogConfiguration config;
-  
-  public NoFileSortedOplogFactory(String name) {
-    config = new SortedOplogConfiguration(name);
-  }
-  
-  @Override
-  public SortedOplog createSortedOplog(File name) throws IOException {
-    return new NoFileSortedOplog(config);
-  }
-
-  @Override
-  public SortedOplogConfiguration getConfiguration() {
-    return config;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/9438c8b1/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/persistence/soplog/AppendLog.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/persistence/soplog/AppendLog.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/persistence/soplog/AppendLog.java
deleted file mode 100644
index e0e696a..0000000
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/persistence/soplog/AppendLog.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gemstone.gemfire.internal.cache.persistence.soplog;
-
-import java.io.BufferedOutputStream;
-import java.io.Closeable;
-import java.io.DataOutputStream;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-
-public class AppendLog {
-
-  public static AppendLogReader recover(File f) throws IOException {
-    throw new RuntimeException("Not implemented");
-  }
-  
-  public static AppendLogWriter create(File f) throws IOException {
-    DataOutputStream dos = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(f)));
-    return new AppendLogWriter(f, dos);
-  }
-  
-  public static class AppendLogReader {
-  }
-  
-  public static class AppendLogWriter implements Closeable {
-    private final File file;
-    private final DataOutputStream out;
-    
-    private AppendLogWriter(File f, DataOutputStream out) {
-      this.file = f;
-      this.out = out;
-    }
-    
-    public synchronized void append(byte[] key, byte[] value) throws IOException {
-      out.writeInt(key.length);
-      out.writeInt(value.length);
-      out.write(key);
-      out.write(value);
-    }
-
-    @Override
-    public void close() throws IOException {
-      out.close();
-    }
-    
-    public File getFile() {
-      return file;
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/9438c8b1/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/persistence/soplog/ArraySerializedComparatorJUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/persistence/soplog/ArraySerializedComparatorJUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/persistence/soplog/ArraySerializedComparatorJUnitTest.java
deleted file mode 100644
index 3689255..0000000
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/persistence/soplog/ArraySerializedComparatorJUnitTest.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gemstone.gemfire.internal.cache.persistence.soplog;
-
-import java.io.IOException;
-import java.nio.ByteBuffer;
-
-import org.junit.experimental.categories.Category;
-
-import com.gemstone.gemfire.internal.cache.persistence.soplog.SortedReader.SerializedComparator;
-import com.gemstone.gemfire.test.junit.categories.UnitTest;
-
-@Category(UnitTest.class)
-public class ArraySerializedComparatorJUnitTest extends ComparisonTestCase {
-  protected ArraySerializedComparator comp;
-  
-  public void testSearch() throws IOException {
-    byte[] k1 = comp.createCompositeKey(convert("aaaa"), convert(1), convert(true));
-    byte[] k2 = comp.createCompositeKey(convert("bbbb"), convert(2), convert(false));
-    byte[] k3 = comp.createCompositeKey(convert("bbbb"), convert(3), convert(true));
-    byte[] k4 = comp.createCompositeKey(convert("cccc"), convert(1), convert(false));
-
-    byte[] s1 = comp.createCompositeKey(convert("aaaa"), 
-        new byte[] {SoplogToken.WILDCARD.toByte()}, new byte[] {SoplogToken.WILDCARD.toByte()});
-    
-    
-    byte[] s2 = comp.createCompositeKey(convert("bbbb"), 
-        new byte[] {SoplogToken.WILDCARD.toByte()}, new byte[] {SoplogToken.WILDCARD.toByte()});
-    
-    byte[] s3 = comp.createCompositeKey(new byte[] {SoplogToken.WILDCARD.toByte()}, convert(1), 
-        new byte[] {SoplogToken.WILDCARD.toByte()});
-    
-    compareAsIs(comp, k1, s1, Comparison.EQ);
-    compareAsIs(comp, k2, s1, Comparison.GT);
-    compareAsIs(comp, k1, s2, Comparison.LT);
-    compareAsIs(comp, k2, s2, Comparison.EQ);
-    compareAsIs(comp, k3, s2, Comparison.EQ);
-    compareAsIs(comp, k4, s2, Comparison.GT);
-    compareAsIs(comp, s3, k4, Comparison.EQ);
-  }
-  
-  public void testCompositeKey() throws IOException {
-    byte[] k1 = comp.createCompositeKey(convert("aaaa"), convert(1), convert(true));
-    byte[] k2 = comp.createCompositeKey(convert("bbbb"), convert(2), convert(false));
-    byte[] k3 = comp.createCompositeKey(convert("bbbb"), convert(3), convert(true));
-    byte[] k4 = comp.createCompositeKey(convert("cccc"), convert(1), convert(false));
-    byte[] k5 = comp.createCompositeKey(convert(null),   convert(1), convert(false));
-    byte[] k6 = comp.createCompositeKey(convert(null),   convert(1), convert(true));
-    
-    compareAsIs(comp, k1, k1, Comparison.EQ);
-    compareAsIs(comp, k1, k2, Comparison.LT);
-    compareAsIs(comp, k2, k1, Comparison.GT);
-    compareAsIs(comp, k2, k3, Comparison.LT);
-    compareAsIs(comp, k3, k4, Comparison.LT);
-    
-    compareAsIs(comp, k4, k5, Comparison.LT);
-    compareAsIs(comp, k5, k1, Comparison.GT);
-    compareAsIs(comp, k5, k6, Comparison.LT);
-  }
-  
-  public void testGetKey() throws Exception {
-    Object[] vals = new Object[] { "aaaa", 1, true };
-    
-    byte[][] composite = new byte[][] { convert(vals[0]), convert(vals[1]), convert(vals[2]) };
-    ByteBuffer key = ByteBuffer.wrap(comp.createCompositeKey(composite));
-    
-    for (int i = 0; i < 3; i++) {
-      ByteBuffer subkey = comp.getKey(key, i);
-      assertEquals(vals[i], recover(subkey.array(), subkey.arrayOffset(), subkey.remaining()));
-    }
-  }
-
-  public void setUp() {
-    comp = new ArraySerializedComparator();
-    comp.setComparators(new SerializedComparator[] {
-        new LexicographicalComparator(), // string
-        new LexicographicalComparator(), // int
-        new LexicographicalComparator()  // boolean
-    });
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/9438c8b1/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/persistence/soplog/CompactionSortedOplogSetTestCase.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/persistence/soplog/CompactionSortedOplogSetTestCase.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/persistence/soplog/CompactionSortedOplogSetTestCase.java
deleted file mode 100644
index bca52a9..0000000
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/persistence/soplog/CompactionSortedOplogSetTestCase.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gemstone.gemfire.internal.cache.persistence.soplog;
-
-import java.io.File;
-import java.io.IOException;
-import java.nio.ByteBuffer;
-import java.util.concurrent.Executors;
-
-import com.gemstone.gemfire.internal.cache.persistence.soplog.CompactionTestCase.FileTracker;
-import com.gemstone.gemfire.internal.cache.persistence.soplog.CompactionTestCase.WaitingHandler;
-import com.gemstone.gemfire.internal.cache.persistence.soplog.SortedReader.SortedIterator;
-import com.gemstone.gemfire.internal.cache.persistence.soplog.nofile.NoFileSortedOplogFactory;
-
-public abstract class CompactionSortedOplogSetTestCase extends SortedOplogSetJUnitTest {
-  public void testWithCompaction() throws IOException, InterruptedException {
-    FlushCounter handler = new FlushCounter();
-    SortedOplogSet sos = createSoplogSet("compact");
-    
-    for (int i = 0; i < 1000; i++) {
-      sos.put(wrapInt(i), wrapInt(i));
-      if (i % 100 == 0) {
-        sos.flush(null, handler);
-      }
-    }
-    
-    flushAndWait(handler, sos);
-    
-    compactAndWait(sos, false);
-    validate(sos, 1000);
-    sos.close();
-  }
-  
-  public void testTombstone() throws Exception {
-    FlushCounter handler = new FlushCounter();
-    SortedOplogFactory factory = new NoFileSortedOplogFactory("tombstone");
-    Compactor compactor = new SizeTieredCompactor(factory, 
-        NonCompactor.createFileset("tombstone", new File(".")), 
-        new FileTracker(), 
-        Executors.newSingleThreadExecutor(), 
-        2, 2);
-    
-    SortedOplogSet sos = new SortedOplogSetImpl(factory, Executors.newSingleThreadExecutor(), compactor);
-    
-    for (int i = 0; i < 1000; i++) {
-      sos.put(wrapInt(i), wrapInt(i));
-    }
-    sos.flush(null, handler);
-    
-    for (int i = 900; i < 1000; i++) {
-      sos.put(wrapInt(i), new byte[] {SoplogToken.TOMBSTONE.toByte()});
-    }
-    flushAndWait(handler, sos);
-    compactAndWait(sos, true);
-
-    validate(sos, 900);
-    sos.close();
-    
-  }
-  
-  public void testInUse() throws Exception {
-    FlushCounter handler = new FlushCounter();
-    SortedOplogSet sos = createSoplogSet("inuse");
-    
-    for (int i = 0; i < 1000; i++) {
-      sos.put(wrapInt(i), wrapInt(i));
-    }
-    
-    flushAndWait(handler, sos);
-    
-    // start iterating over soplog
-    SortedIterator<ByteBuffer> range = sos.scan();
-    assertEquals(0, ((SizeTieredCompactor) sos.getCompactor()).countInactiveReaders());
-
-    for (int i = 1000; i < 5000; i++) {
-      sos.put(wrapInt(i), wrapInt(i));
-      if (i % 100 == 0) {
-        sos.flush(null, handler);
-      }
-    }
-
-    flushAndWait(handler, sos);
-    compactAndWait(sos, false);
-    assertEquals(1, ((SizeTieredCompactor) sos.getCompactor()).countInactiveReaders());
-
-    range.close();
-    compactAndWait(sos, false);
-    assertEquals(0, ((SizeTieredCompactor) sos.getCompactor()).countInactiveReaders());
-
-    validate(sos, 5000);
-    sos.close();
-  }
-
-  @Override
-  protected SortedOplogSetImpl createSoplogSet(String name) throws IOException {
-    SortedOplogFactory factory = new NoFileSortedOplogFactory(name);
-    Compactor compactor = createCompactor(factory);
-    
-    return new SortedOplogSetImpl(factory,  Executors.newSingleThreadExecutor(), compactor);
-  }
-  
-  protected abstract AbstractCompactor<?> createCompactor(SortedOplogFactory factory) throws IOException;
-  
-  private void validate(SortedReader<ByteBuffer> range, int count) throws IOException {
-    int i = 0;
-    for (SortedIterator<ByteBuffer> iter = range.scan(); iter.hasNext(); i++) {
-      iter.next();
-      assertEquals(i, iter.key().getInt());
-    }
-    assertEquals(count, i);
-    range.close();
-  }
-
-  private void compactAndWait(SortedOplogSet sos, boolean force) throws InterruptedException {
-    WaitingHandler wh = new WaitingHandler();
-    sos.getCompactor().compact(force, wh);
-    wh.waitForCompletion();
-    assertNull(wh.getError());
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/9438c8b1/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/persistence/soplog/CompactionTestCase.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/persistence/soplog/CompactionTestCase.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/persistence/soplog/CompactionTestCase.java
deleted file mode 100644
index 7577b53..0000000
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/persistence/soplog/CompactionTestCase.java
+++ /dev/null
@@ -1,206 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gemstone.gemfire.internal.cache.persistence.soplog;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.atomic.AtomicReference;
-
-import org.apache.logging.log4j.Logger;
-
-import junit.framework.TestCase;
-
-import com.gemstone.gemfire.internal.cache.persistence.soplog.Compactor.CompactionHandler;
-import com.gemstone.gemfire.internal.cache.persistence.soplog.Compactor.CompactionTracker;
-import com.gemstone.gemfire.internal.cache.persistence.soplog.SortedOplog.SortedOplogWriter;
-import com.gemstone.gemfire.internal.cache.persistence.soplog.nofile.NoFileSortedOplogFactory;
-import com.gemstone.gemfire.internal.logging.LogService;
-
-public abstract class CompactionTestCase<T extends Comparable<T>> extends TestCase {
-  private static final Logger logger = LogService.getLogger();
-  protected SortedOplogFactory factory;
-  protected AbstractCompactor<T> compactor;
-  
-  public void testMaxCompaction() throws Exception {
-    for (int i = 0; i < 100; i += 2) {
-      compactor.add(createSoplog(0, 100, i));
-      compactor.add(createSoplog(100, 100, i+1));
-
-      WaitingHandler wh = new WaitingHandler();
-      compactor.compact(false, wh);
-      wh.waitForCompletion();
-    }
-    
-    WaitingHandler wh = new WaitingHandler();
-    compactor.compact(true, wh);
-    wh.waitForCompletion();
-  }
-  
-  public void testClear() throws IOException {
-    compactor.add(createSoplog(0, 100, 0));
-    compactor.add(createSoplog(100, 100, 1));
-    compactor.clear();
-    
-    assertEquals(0, compactor.getActiveReaders(null, null).size());
-    assertFalse(compactor.getLevel(0).needsCompaction());
-  }
-  
-  public void testInterruptedCompaction() throws IOException {
-    compactor.add(createSoplog(0, 100, 0));
-    compactor.add(createSoplog(100, 100, 1));
-    
-    compactor.testAbortDuringCompaction = true;
-    boolean compacted = compactor.compact();
-    
-    assertFalse(compacted);
-    assertEquals(2, compactor.getActiveReaders(null, null).size());
-    assertTrue(compactor.getLevel(0).needsCompaction());
-  }
-  
-  public void testClearDuringCompaction() throws Exception {
-    compactor.add(createSoplog(0, 100, 0));
-    compactor.add(createSoplog(100, 100, 1));
-    
-    compactor.testDelayDuringCompaction = new CountDownLatch(1);
-    WaitingHandler wh = new WaitingHandler();
-    
-    logger.debug("Invoking compact");
-    compactor.compact(false, wh);
-    
-    logger.debug("Invoking clear");
-    compactor.clear();
-    
-    boolean compacted = wh.waitForCompletion();
-    
-    assertFalse(compacted);
-    assertEquals(0, compactor.getActiveReaders(null, null).size());
-  }
-  
-  public void testClearRepeat() throws Exception {
-    int i = 0;
-    do {
-      testClearDuringCompaction();
-      logger.debug("Test {} is complete", i);
-      tearDown();
-      setUp();
-    } while (i++ < 100);
-  }
-
-  public void testCloseRepeat() throws Exception {
-    int i = 0;
-    do {
-      testCloseDuringCompaction();
-      logger.debug("Test {} is complete", i);
-      tearDown();
-      setUp();
-    } while (i++ < 100);
-  }
-
-  public void testCloseDuringCompaction() throws Exception {
-    compactor.add(createSoplog(0, 100, 0));
-    compactor.add(createSoplog(100, 100, 1));
-    
-    compactor.testDelayDuringCompaction = new CountDownLatch(1);
-    WaitingHandler wh = new WaitingHandler();
-    
-    compactor.compact(false, wh);
-    compactor.close();
-    
-    boolean compacted = wh.waitForCompletion();
-    
-    assertFalse(compacted);
-    assertEquals(0, compactor.getActiveReaders(null, null).size());
-  }
-
-  public void setUp() throws IOException {
-    factory = new NoFileSortedOplogFactory("test");
-    compactor = createCompactor(factory);
-  }
-  
-  public void tearDown() throws Exception {
-    compactor.close();
-    for (File f : SortedReaderTestCase.getSoplogsToDelete()) {
-      f.delete();
-    }
-  }
-  
-  protected SortedOplog createSoplog(int start, int count, int id) throws IOException {
-    SortedOplog soplog = factory.createSortedOplog(new File("test-" + id + ".soplog"));
-    SortedOplogWriter wtr = soplog.createWriter();
-    try {
-      for (int i = start; i < start + count; i++) {
-        wtr.append(SortedReaderTestCase.wrapInt(i), SortedReaderTestCase.wrapInt(i));
-      }
-    } finally {
-      wtr.close(null);
-    }
-    return soplog;
-  }
-
-  protected abstract AbstractCompactor<T> createCompactor(SortedOplogFactory factory) throws IOException;
-  
-  static class WaitingHandler implements CompactionHandler {
-    private final CountDownLatch latch;
-    private final AtomicReference<Throwable> err;
-    private volatile boolean compacted;
-    
-    public WaitingHandler() {
-      latch = new CountDownLatch(1);
-      err = new AtomicReference<Throwable>();
-    }
-    
-    public boolean waitForCompletion() throws InterruptedException {
-      logger.debug("Waiting for compaction to complete");
-      latch.await();
-      logger.debug("Done waiting!");
-      
-      return compacted;
-    }
-    
-    public Throwable getError() {
-      return err.get();
-    }
-    
-    @Override
-    public void complete(boolean compacted) {
-      logger.debug("Compaction completed with {}", compacted);
-      this.compacted = compacted;
-      latch.countDown();
-    }
-
-    @Override
-    public void failed(Throwable ex) {
-      err.set(ex);
-      latch.countDown();
-    }
-  }
-  
-  static class FileTracker implements CompactionTracker<Integer> {
-    @Override
-    public void fileDeleted(File f) {
-    }
-
-    @Override
-    public void fileAdded(File f, Integer attach) {
-    }
-
-    @Override
-    public void fileRemoved(File f, Integer attach) {
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/9438c8b1/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/persistence/soplog/ComparisonTestCase.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/persistence/soplog/ComparisonTestCase.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/persistence/soplog/ComparisonTestCase.java
deleted file mode 100644
index cb9e909..0000000
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/persistence/soplog/ComparisonTestCase.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gemstone.gemfire.internal.cache.persistence.soplog;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.DataInputStream;
-import java.io.DataOutputStream;
-import java.io.IOException;
-
-import junit.framework.TestCase;
-
-import com.gemstone.gemfire.DataSerializer;
-import com.gemstone.gemfire.internal.cache.persistence.soplog.SortedReader.SerializedComparator;
-
-public abstract class ComparisonTestCase extends TestCase {
-  public enum Comparison {
-    EQ(0.0),
-    LT(-1.0),
-    GT(1.0);
-    
-    private final double sgn;
-    
-    private Comparison(double sgn) {
-      this.sgn = sgn;
-    }
-    
-    public double signum() {
-      return sgn;
-    }
-    
-    public Comparison opposite() {
-      switch (this) {
-      case LT: return GT;
-      case GT : return LT;
-      default : return EQ;
-      }
-    }
-  }
-  
-  public void compare(SerializedComparator sc, Object o1, Object o2, Comparison result) throws IOException {
-    double diff = sc.compare(convert(o1), convert(o2));
-    assertEquals(String.format("%s ? %s", o1, o2), result.signum(), Math.signum(diff));
-  }
-  
-  public void compareAsIs(SerializedComparator sc, byte[] b1, byte[] b2, Comparison result) throws IOException {
-    double diff = sc.compare(b1, b2);
-    assertEquals(result.signum(), Math.signum(diff));
-  }
-  
-  public static byte[] convert(Object o) throws IOException {
-    ByteArrayOutputStream b = new ByteArrayOutputStream();
-    DataOutputStream d = new DataOutputStream(b);
-    DataSerializer.writeObject(o, d);
-    
-    return b.toByteArray();
-  }
-  
-  public static Object recover(byte[] obj, int off, int len) throws ClassNotFoundException, IOException {
-    DataInputStream in = new DataInputStream(new ByteArrayInputStream(obj, off, len));
-    return DataSerializer.readObject(in);
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/9438c8b1/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/persistence/soplog/IndexComparatorJUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/persistence/soplog/IndexComparatorJUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/persistence/soplog/IndexComparatorJUnitTest.java
deleted file mode 100644
index 27202ec..0000000
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/persistence/soplog/IndexComparatorJUnitTest.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gemstone.gemfire.internal.cache.persistence.soplog;
-
-import java.io.IOException;
-import java.nio.ByteBuffer;
-
-import org.junit.experimental.categories.Category;
-
-import com.gemstone.gemfire.test.junit.categories.UnitTest;
-
-@Category(UnitTest.class)
-public class IndexComparatorJUnitTest extends ComparisonTestCase {
-  protected IndexSerializedComparator comp;
-  
-  public void testSearch() throws IOException {
-    byte[] k1 = comp.createCompositeKey(convert("aaaa"), convert(1));
-    byte[] k2 = comp.createCompositeKey(convert("bbbb"), convert(2));
-    byte[] k3 = comp.createCompositeKey(convert("bbbb"), convert(3));
-    byte[] k4 = comp.createCompositeKey(convert(null), convert(1));
-
-    byte[] s1 = comp.createCompositeKey(convert("aaaa"), new byte[] {SoplogToken.WILDCARD.toByte()});
-    byte[] s2 = comp.createCompositeKey(convert("bbbb"), new byte[] {SoplogToken.WILDCARD.toByte()});
-    byte[] s3 = comp.createCompositeKey(new byte[] {SoplogToken.WILDCARD.toByte()}, convert(1));
-    
-    compareAsIs(comp, k1, s1, Comparison.EQ);
-    compareAsIs(comp, k2, s1, Comparison.GT);
-    compareAsIs(comp, k1, s2, Comparison.LT);
-    compareAsIs(comp, k2, s2, Comparison.EQ);
-    compareAsIs(comp, k3, s2, Comparison.EQ);
-    compareAsIs(comp, k4, s2, Comparison.GT);
-    compareAsIs(comp, s3, k4, Comparison.EQ);
-  }
-  
-  public void testCompositeKey() throws IOException {
-    byte[] k1 = comp.createCompositeKey(convert("aaaa"), convert(1));
-    byte[] k2 = comp.createCompositeKey(convert("bbbb"), convert(2));
-    byte[] k3 = comp.createCompositeKey(convert("bbbb"), convert(3));
-    byte[] k4 = comp.createCompositeKey(convert("cccc"), convert(1));
-    byte[] k5 = comp.createCompositeKey(convert(null), convert(1));
-    
-    compareAsIs(comp, k1, k1, Comparison.EQ);
-    compareAsIs(comp, k1, k2, Comparison.LT);
-    compareAsIs(comp, k2, k1, Comparison.GT);
-    compareAsIs(comp, k2, k3, Comparison.LT);
-    compareAsIs(comp, k3, k4, Comparison.LT);
-    
-    compareAsIs(comp, k4, k5, Comparison.LT);
-    compareAsIs(comp, k5, k1, Comparison.GT);
-  }
-  
-  public void testGetKey() throws Exception {
-    ByteBuffer key = ByteBuffer.wrap(comp.createCompositeKey(convert("aaaa"), convert(1)));
-    
-    ByteBuffer k1 = comp.getKey(key, 0);
-    assertEquals("aaaa", recover(k1.array(), k1.arrayOffset(), k1.remaining()));
-    
-    ByteBuffer k2 = comp.getKey(key, 1);
-    assertEquals(1, recover(k2.array(), k2.arrayOffset(), k2.remaining()));
-  }
-  
-  public void setUp() {
-    comp = new IndexSerializedComparator();
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/9438c8b1/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/persistence/soplog/LexicographicalComparatorJUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/persistence/soplog/LexicographicalComparatorJUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/persistence/soplog/LexicographicalComparatorJUnitTest.java
deleted file mode 100644
index 0c0e93e..0000000
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/persistence/soplog/LexicographicalComparatorJUnitTest.java
+++ /dev/null
@@ -1,204 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gemstone.gemfire.internal.cache.persistence.soplog;
-
-import java.math.BigInteger;
-import java.nio.ByteBuffer;
-
-import org.apache.hadoop.hbase.util.Bytes;
-import org.junit.experimental.categories.Category;
-
-import com.gemstone.gemfire.internal.DSCODE;
-import com.gemstone.gemfire.test.junit.categories.UnitTest;
-
-@Category(UnitTest.class)
-public class LexicographicalComparatorJUnitTest extends ComparisonTestCase {
-  private LexicographicalComparator lc;
-
-  public void testMixedNumeric() throws Exception {
-    compare(lc, (byte) 1,  (short) 2,    Comparison.LT);
-    compare(lc, (byte) 1,  (int)   2,    Comparison.LT);
-    compare(lc, (byte) 1,  (long)  2,    Comparison.LT);
-    compare(lc, (byte) 1,          2.1f, Comparison.LT);
-    compare(lc, (byte) 1,          2.1d, Comparison.LT);
-    
-    compare(lc, (short) 1, (byte) 2,    Comparison.LT);
-    compare(lc, (short) 1, (int)  2,    Comparison.LT);
-    compare(lc, (short) 1, (long) 2,    Comparison.LT);
-    compare(lc, (short) 1,        2.1f, Comparison.LT);
-    compare(lc, (short) 1,        2.1d, Comparison.LT);
-    
-    compare(lc, (int) 1,  (byte)  2,    Comparison.LT);
-    compare(lc, (int) 1,  (short) 2,    Comparison.LT);
-    compare(lc, (int) 1,  (long)  2,    Comparison.LT);
-    compare(lc, (int) 1,          2.1f, Comparison.LT);
-    compare(lc, (int) 1,          2.1d, Comparison.LT);
-
-    compare(lc, (long) 1,  (byte)  2,    Comparison.LT);
-    compare(lc, (long) 1,  (short) 2,    Comparison.LT);
-    compare(lc, (long) 1,  (int)   2,    Comparison.LT);
-    compare(lc, (long) 1,          2.1f, Comparison.LT);
-    compare(lc, (long) 1,          2.1d, Comparison.LT);
-
-    compare(lc, 1.1f,  (byte)  2,    Comparison.LT);
-    compare(lc, 1.1f,  (short) 2,    Comparison.LT);
-    compare(lc, 1.1f,  (int)   2,    Comparison.LT);
-    compare(lc, 1.1f,  (long)  2,    Comparison.LT);
-    compare(lc, 1.1f,          2.1d, Comparison.LT);
-
-    compare(lc, 1.1d,  (byte)  2,    Comparison.LT);
-    compare(lc, 1.1d,  (short) 2,    Comparison.LT);
-    compare(lc, 1.1d,  (int)   2,    Comparison.LT);
-    compare(lc, 1.1d,  (long)  2,    Comparison.LT);
-    compare(lc, 1.1d,          2.1f, Comparison.LT);
-  }
-  
-  public void testBoolean() throws Exception {
-    compare(lc, Boolean.TRUE,  Boolean.TRUE,  Comparison.EQ);
-    compare(lc, Boolean.FALSE, Boolean.FALSE, Comparison.EQ);
-    compare(lc, Boolean.TRUE,  Boolean.FALSE, Comparison.GT);
-    compare(lc, Boolean.FALSE, Boolean.TRUE,  Comparison.LT);
-  }
-  
-  public void testByte() throws Exception {
-    compare(lc, (byte)  0, (byte)  0, Comparison.EQ);
-    compare(lc, (byte)  0, (byte)  1, Comparison.LT);
-    compare(lc, (byte) -1, (byte)  1, Comparison.LT);
-    compare(lc, (byte)  1, (byte) -1, Comparison.GT);
-    compare(lc, (byte) -2, (byte) -1, Comparison.LT);
-    compare(lc, (byte)  1, (byte)  2, Comparison.LT);
-    compare(lc, (byte)  2, (byte)  1, Comparison.GT);
-  }
-  
-  public void testShort() throws Exception {
-    compare(lc, (short)  0, (short)  0, Comparison.EQ);
-    compare(lc, (short)  0, (short)  1, Comparison.LT);
-    compare(lc, (short) -1, (short)  1, Comparison.LT);
-    compare(lc, (short)  1, (short) -1, Comparison.GT);
-    compare(lc, (short) -2, (short) -1, Comparison.LT);
-    compare(lc, (short)  1, (short)  2, Comparison.LT);
-    compare(lc, (short)  2, (short)  1, Comparison.GT);
-  }
-
-  public void testInt() throws Exception {
-    compare(lc, (int)  0, (int)  0, Comparison.EQ);
-    compare(lc, (int)  0, (int)  1, Comparison.LT);
-    compare(lc, (int) -1, (int)  1, Comparison.LT);
-    compare(lc, (int)  1, (int) -1, Comparison.GT);
-    compare(lc, (int) -2, (int) -1, Comparison.LT);
-    compare(lc, (int)  1, (int)  2, Comparison.LT);
-    compare(lc, (int)  2, (int)  1, Comparison.GT);
-  }
-
-  public void testLong() throws Exception {
-    compare(lc, (long)  0, (long)  0, Comparison.EQ);
-    compare(lc, (long)  0, (long)  1, Comparison.LT);
-    compare(lc, (long) -1, (long)  1, Comparison.LT);
-    compare(lc, (long)  1, (long) -1, Comparison.GT);
-    compare(lc, (long) -2, (long) -1, Comparison.LT);
-    compare(lc, (long)  1, (long)  2, Comparison.LT);
-    compare(lc, (long)  2, (long)  1, Comparison.GT);
-  }
-
-  public void testFloat() throws Exception {
-    compare(lc,  0.0f,  0.0f, Comparison.EQ);
-    compare(lc,  0.0f,  1.0f, Comparison.LT);
-    compare(lc, -1.0f,  1.0f, Comparison.LT);
-    compare(lc,  1.0f, -1.0f, Comparison.GT);
-    compare(lc, -2.0f, -1.0f, Comparison.LT);
-    compare(lc,  1.0f,  2.0f, Comparison.LT);
-    compare(lc,  2.0f,  1.0f, Comparison.GT);
-    compare(lc,  2.1f,  0.9f, Comparison.GT);
-  }
-
-  public void testDouble() throws Exception {
-    compare(lc,  0.0d,  0.0d, Comparison.EQ);
-    compare(lc,  0.0d,  1.0d, Comparison.LT);
-    compare(lc, -1.0d,  1.0d, Comparison.LT);
-    compare(lc,  1.0d, -1.0d, Comparison.GT);
-    compare(lc, -2.0d, -1.0d, Comparison.LT);
-    compare(lc,  1.0d,  2.0d, Comparison.LT);
-    compare(lc,  2.0d,  1.0d, Comparison.GT);
-    compare(lc,  2.1d,  0.9d, Comparison.GT);
-  }
-
-  public void testString() throws Exception {
-    compare(lc, "",        "",         Comparison.EQ);
-    compare(lc, "aa",      "a",        Comparison.GT);
-    compare(lc, "a",       "b",        Comparison.LT);
-    compare(lc, "b",       "a",        Comparison.GT);
-    compare(lc, "baah",    "aardvark", Comparison.GT);
-    compare(lc, "Chloé",   "Réal",     Comparison.LT);
-    compare(lc, "chowder", "Réal",     Comparison.GT);
-    compare(lc, "Réal",    "chowder",  Comparison.LT);
-    compare(lc, "Réal",    "Réa",      Comparison.GT);
-    compare(lc, "Réal",    "Réa",      Comparison.GT);
-    compare(lc, "\u0061\u00a2\u0f00", "\u0061\u00a2\u0f00\u0061", Comparison.LT);
-  }
-  
-  public void testChar() throws Exception {
-    compare(lc, 'a', 'a', Comparison.EQ);
-    compare(lc, 'a', 'b', Comparison.LT);
-    compare(lc, 'b', 'a', Comparison.GT);
-  }
-  
-  public void testNull() throws Exception {
-    compare(lc, null,     null,     Comparison.EQ);
-    compare(lc, null,     "hi mom", Comparison.GT);
-    compare(lc, "hi mom", null,     Comparison.LT);
-  }
-
-  public void testObject() throws Exception {
-    compare(lc, new BigInteger("1"),  new BigInteger("1"), Comparison.EQ);
-    compare(lc, new BigInteger("1"),  new BigInteger("0"), Comparison.GT);
-    compare(lc, new BigInteger("-1"), new BigInteger("0"), Comparison.LT);
-  }
-
-  public void testIntPerformance() throws Exception {
-    ByteBuffer b1 = ByteBuffer.allocate(5).put(0, DSCODE.INTEGER);
-    ByteBuffer b2 = ByteBuffer.allocate(5).put(0, DSCODE.INTEGER);
-    
-    for (int n = 0; n < 5; n++) {
-    long diff = 0;
-      int count = 10000000;
-      long start = System.nanoTime();
-      for (int i = 0; i < count; i++) {
-        b1.putInt(1, i);
-        b2.putInt(1, i + 1);
-        diff += lc.compare(b1.array(), b1.arrayOffset(), b1.capacity(), b2.array(), b2.arrayOffset(), b2.capacity());
-      }
-      long nanos = System.nanoTime() - start;
-      
-      System.out.printf("(%d) %f int comparisons / ms\n", diff, 1000000.0 * count / nanos);
-  
-      diff = 0;
-      start = System.nanoTime();
-      for (int i = 0; i < count; i++) {
-        b1.putInt(1, i);
-        b2.putInt(1, i + 1);
-        diff += Bytes.compareTo(b1.array(), b1.arrayOffset(), b1.capacity(), b2.array(), b2.arrayOffset(), b2.capacity());
-      }
-      nanos = System.nanoTime() - start;
-      
-      System.out.printf("(%d) %f byte comparisons / ms\n\n", diff, 1000000.0 * count / nanos);
-    }
-  }
-
-  protected void setUp() {
-    lc = new LexicographicalComparator();
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/9438c8b1/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/persistence/soplog/RecoverableSortedOplogSet.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/persistence/soplog/RecoverableSortedOplogSet.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/persistence/soplog/RecoverableSortedOplogSet.java
deleted file mode 100644
index 0b3e1f5..0000000
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/persistence/soplog/RecoverableSortedOplogSet.java
+++ /dev/null
@@ -1,221 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gemstone.gemfire.internal.cache.persistence.soplog;
-
-import java.io.File;
-import java.io.IOException;
-import java.lang.management.ManagementFactory;
-import java.nio.ByteBuffer;
-import java.util.EnumMap;
-import java.util.UUID;
-import java.util.concurrent.atomic.AtomicReference;
-import java.util.concurrent.locks.Lock;
-import java.util.concurrent.locks.ReentrantLock;
-
-import org.apache.logging.log4j.Logger;
-
-import com.gemstone.gemfire.internal.cache.persistence.soplog.AppendLog.AppendLogWriter;
-import com.gemstone.gemfire.internal.logging.LogService;
-
-public class RecoverableSortedOplogSet extends AbstractSortedReader implements SortedOplogSet {
-  private static final Logger logger = LogService.getLogger();
-  
-  private final SortedOplogSet sos;
-  private final long bufferSize;
-  
-  private final long maxBufferMemory;
-  
-  private final Lock rollLock;
-  private AtomicReference<AppendLogWriter> writer;
-  
-  private final String logPrefix;
-  
-  public RecoverableSortedOplogSet(SortedOplogSet sos, long bufferSize, double memLimit) throws IOException {
-    this.sos = sos;
-    this.bufferSize = bufferSize;
-    
-    this.logPrefix = "<" + sos.getFactory().getConfiguration().getName() + "> ";
-    
-    rollLock = new ReentrantLock();
-    writer = new AtomicReference<AppendLogWriter>(AppendLog.create(nextLogFile()));
-    
-    maxBufferMemory = Math.round(memLimit * ManagementFactory.getMemoryMXBean().getHeapMemoryUsage().getMax());
-  }
-  
-  @Override
-  public boolean mightContain(byte[] key) throws IOException {
-    return sos.mightContain(key);
-  }
-
-  @Override
-  public ByteBuffer read(byte[] key) throws IOException {
-    return sos.read(key);
-  }
-
-  @Override
-  public SortedIterator<ByteBuffer> scan(byte[] from, boolean fromInclusive, byte[] to, boolean toInclusive) throws IOException {
-    return sos.scan(from, fromInclusive, to, toInclusive);
-  }
-
-  @Override
-  public SortedIterator<ByteBuffer> scan(
-      byte[] from,
-      boolean fromInclusive,
-      byte[] to,
-      boolean toInclusive,
-      boolean ascending,
-      MetadataFilter filter) throws IOException {
-    return sos.scan(from, fromInclusive, to, toInclusive, ascending, filter);
-  }
-
-  @Override
-  public SerializedComparator getComparator() {
-    return sos.getComparator();
-  }
-
-  @Override
-  public SortedOplogFactory getFactory() {
-    return sos.getFactory();
-  }
-  
-  @Override
-  public SortedStatistics getStatistics() throws IOException {
-    return sos.getStatistics();
-  }
-
-  @Override
-  public void close() throws IOException {
-    rollLock.lock();
-    try {
-      writer.get().close();
-      writer.set(null);
-      sos.close();
-    } finally {
-      rollLock.unlock();
-    }
-  }
-
-  @Override
-  public void put(byte[] key, byte[] value) throws IOException {
-    throttle();
-    if (sos.bufferSize() > bufferSize) {
-      roll(false);
-    }
-
-    writer.get().append(key, value);
-    sos.put(key, value);
-  }
-
-  @Override
-  public long bufferSize() {
-    return sos.bufferSize();
-  }
-
-  @Override
-  public long unflushedSize() {
-    return sos.unflushedSize();
-  }
-
-  @Override
-  public void flush(EnumMap<Metadata, byte[]> metadata, FlushHandler handler) throws IOException {
-    roll(true);
-  }
-
-  @Override
-  public void flushAndClose(EnumMap<Metadata, byte[]> metadata) throws IOException {
-    throw new RuntimeException("Not implemented");
-  }
-
-  @Override
-  public Compactor getCompactor() {
-    return sos.getCompactor();
-  }
-
-  @Override
-  public void clear() throws IOException {
-    rollLock.lock();
-    try {
-      roll(true);
-      sos.clear();
-    } finally {
-      rollLock.unlock();
-    }
-  }
-
-  @Override
-  public void destroy() throws IOException {
-    roll(true);
-    sos.destroy();
-  }
-
-  @Override
-  public boolean isClosed() {
-    return sos.isClosed();
-  }
-  
-  private void throttle() {
-    int n = 0;
-    while (sos.bufferSize() + sos.unflushedSize() > maxBufferMemory) {
-      try {
-        Thread.sleep(1 << n++);
-        
-      } catch (InterruptedException e) {
-        Thread.currentThread().interrupt();
-        break;
-      }
-    }
-  }
-
-  private void roll(boolean wait) throws IOException {
-    boolean locked = true;
-    if (wait) {
-      rollLock.lock();
-    } else {
-      locked = rollLock.tryLock();
-    }
-    
-    if (locked) {
-      try {
-        AppendLogWriter next = AppendLog.create(nextLogFile());
-        final AppendLogWriter old = writer.getAndSet(next);
-        old.close();
-
-        if (logger.isDebugEnabled()) {
-          logger.debug("{}Rolling from {} to {}", this.logPrefix, old.getFile(), next.getFile());
-        }
-
-        sos.flush(null, new FlushHandler() {
-          @Override
-          public void complete() {
-            old.getFile().delete();
-          }
-
-          @Override
-          public void error(Throwable t) {
-          }
-        });
-      } finally {
-        rollLock.unlock();
-      }
-    }
-  }
-
-  private File nextLogFile() {
-    return new File(sos.getFactory().getConfiguration().getName() 
-        + "-" + UUID.randomUUID().toString() + ".aolog");
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/9438c8b1/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/persistence/soplog/SizeTieredCompactorJUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/persistence/soplog/SizeTieredCompactorJUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/persistence/soplog/SizeTieredCompactorJUnitTest.java
deleted file mode 100644
index ee76c55..0000000
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/persistence/soplog/SizeTieredCompactorJUnitTest.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gemstone.gemfire.internal.cache.persistence.soplog;
-
-import java.io.File;
-import java.io.IOException;
-import java.nio.ByteBuffer;
-import java.util.concurrent.Executors;
-
-import org.junit.experimental.categories.Category;
-
-import com.gemstone.gemfire.internal.cache.persistence.soplog.SortedOplog.SortedOplogReader;
-import com.gemstone.gemfire.internal.cache.persistence.soplog.SortedReader.SortedIterator;
-import com.gemstone.gemfire.test.junit.categories.UnitTest;
-
-@Category(UnitTest.class)
-public class SizeTieredCompactorJUnitTest extends CompactionTestCase<Integer> {
-  public void testBasic() throws Exception {
-    compactor.add(createSoplog(0, 100, 0));
-    
-    assertEquals(1, compactor.getActiveReaders(null, null).size());
-    assertEquals(1, compactor.getLevel(0).getSnapshot().size());
-    assertFalse(compactor.getLevel(0).needsCompaction());
-    
-    WaitingHandler wh = new WaitingHandler();
-    compactor.compact(false, wh);
-    wh.waitForCompletion();
-
-    assertEquals(1, compactor.getActiveReaders(null, null).size());
-    assertEquals(1, compactor.getLevel(0).getSnapshot().size());
-    assertFalse(compactor.getLevel(0).needsCompaction());
-  }
-
-  public void testCompactionLevel0() throws Exception {
-    compactor.add(createSoplog(0, 100, 0));
-    compactor.add(createSoplog(100, 100, 1));
-    
-    assertEquals(2, compactor.getActiveReaders(null, null).size());
-    assertEquals(2, compactor.getLevel(0).getSnapshot().size());
-    assertTrue(compactor.getLevel(0).needsCompaction());
-
-    WaitingHandler wh = new WaitingHandler();
-    compactor.compact(false, wh);
-    wh.waitForCompletion();
-
-    assertEquals(1, compactor.getActiveReaders(null, null).size());
-    assertEquals(0, compactor.getLevel(0).getSnapshot().size());
-    assertEquals(1, compactor.getLevel(1).getSnapshot().size());
-    assertFalse(compactor.getLevel(0).needsCompaction());
-    assertFalse(compactor.getLevel(1).needsCompaction());
-    
-    validate(compactor.getActiveReaders(null, null).iterator().next().get(), 0, 200);
-  }
-  
-  public void testMultilevelCompaction() throws Exception {
-    for (int i = 0; i < 8; i += 2) {
-      compactor.add(createSoplog(0, 100, i));
-      compactor.add(createSoplog(100, 100, i+1));
-
-      WaitingHandler wh = new WaitingHandler();
-      compactor.compact(false, wh);
-      wh.waitForCompletion();
-    }
-    
-    assertEquals(1, compactor.getActiveReaders(null, null).size());
-    validate(compactor.getActiveReaders(null, null).iterator().next().get(), 0, 200);
-  }
-  
-  public void testForceCompaction() throws Exception {
-    compactor.add(createSoplog(0, 100, 0));
-    compactor.add(createSoplog(100, 100, 1));
-    boolean compacted = compactor.compact();
-    
-    assertTrue(compacted);
-    validate(compactor.getActiveReaders(null, null).iterator().next().get(), 0, 200);
-  }
-
-  @Override
-  protected AbstractCompactor<Integer> createCompactor(SortedOplogFactory factory) throws IOException {
-    return new SizeTieredCompactor(factory, 
-        NonCompactor.createFileset("test", new File(".")), 
-        new FileTracker(), 
-        Executors.newSingleThreadExecutor(),
-        2, 4);
-  }
-
-  private void validate(SortedOplogReader soplog, int start, int count) throws IOException {
-    int i = 0;
-    for (SortedIterator<ByteBuffer> iter = soplog.scan(); iter.hasNext(); i++) {
-      iter.next();
-      assertEquals(i, iter.key().getInt());
-      assertEquals(i, iter.value().getInt());
-    }
-    assertEquals(count, i);
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/9438c8b1/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/persistence/soplog/SizeTieredSortedOplogSetJUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/persistence/soplog/SizeTieredSortedOplogSetJUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/persistence/soplog/SizeTieredSortedOplogSetJUnitTest.java
deleted file mode 100644
index cf1de00..0000000
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/persistence/soplog/SizeTieredSortedOplogSetJUnitTest.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gemstone.gemfire.internal.cache.persistence.soplog;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.concurrent.Executors;
-
-import org.junit.experimental.categories.Category;
-
-import com.gemstone.gemfire.internal.cache.persistence.soplog.CompactionTestCase.FileTracker;
-import com.gemstone.gemfire.test.junit.categories.UnitTest;
-
-@Category(UnitTest.class)
-public class SizeTieredSortedOplogSetJUnitTest extends CompactionSortedOplogSetTestCase {
-  @Override
-  protected AbstractCompactor<?> createCompactor(SortedOplogFactory factory) throws IOException {
-    return new SizeTieredCompactor(factory, 
-        NonCompactor.createFileset("test", new File(".")), 
-        new FileTracker(), 
-        Executors.newSingleThreadExecutor(),
-        2, 4);
-  }
-  @Override
-  public void testStatistics() throws IOException {
-    // remove this noop override when bug 52249 is fixed
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/9438c8b1/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/persistence/soplog/SortedBufferJUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/persistence/soplog/SortedBufferJUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/persistence/soplog/SortedBufferJUnitTest.java
deleted file mode 100644
index 1d79059..0000000
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/persistence/soplog/SortedBufferJUnitTest.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gemstone.gemfire.internal.cache.persistence.soplog;
-
-import java.nio.ByteBuffer;
-import java.util.Map.Entry;
-import java.util.NavigableMap;
-
-import org.junit.experimental.categories.Category;
-
-import com.gemstone.gemfire.internal.cache.persistence.soplog.SortedOplogFactory.SortedOplogConfiguration;
-import com.gemstone.gemfire.test.junit.categories.UnitTest;
-
-@Category(UnitTest.class)
-public class SortedBufferJUnitTest extends SortedReaderTestCase {
-  @Override
-  protected SortedReader<ByteBuffer> createReader(NavigableMap<byte[], byte[]> data) {
-    SortedOplogConfiguration config = new SortedOplogConfiguration("test");
-    SortedBuffer<Integer> sb = new SortedBuffer<Integer>(config, 0);
-    for (Entry<byte[], byte[]> entry : data.entrySet()) {
-      sb.put(entry.getKey(), entry.getValue());
-    }
-    return sb;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/9438c8b1/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/persistence/soplog/SortedOplogSetJUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/persistence/soplog/SortedOplogSetJUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/persistence/soplog/SortedOplogSetJUnitTest.java
deleted file mode 100644
index bb0a198..0000000
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/persistence/soplog/SortedOplogSetJUnitTest.java
+++ /dev/null
@@ -1,273 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gemstone.gemfire.internal.cache.persistence.soplog;
-
-import java.io.File;
-import java.io.IOException;
-import java.nio.ByteBuffer;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map.Entry;
-import java.util.NavigableMap;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.Executors;
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.atomic.AtomicInteger;
-
-import org.apache.logging.log4j.Logger;
-import org.junit.experimental.categories.Category;
-
-import com.gemstone.gemfire.internal.cache.persistence.soplog.SortedOplogSet.FlushHandler;
-import com.gemstone.gemfire.internal.cache.persistence.soplog.SortedReader.SortedIterator;
-import com.gemstone.gemfire.internal.cache.persistence.soplog.nofile.NoFileSortedOplogFactory;
-import com.gemstone.gemfire.internal.logging.LogService;
-import com.gemstone.gemfire.test.junit.categories.UnitTest;
-
-@Category(UnitTest.class)
-public class SortedOplogSetJUnitTest extends SortedReaderTestCase {
-  private static final Logger logger = LogService.getLogger();
-  private SortedOplogSet set;
-  
-  public void testMergedIterator() throws IOException {
-    FlushCounter handler = new FlushCounter();
-    SortedOplogSet sos = createSoplogSet("merge");
-    
-    // #1
-    sos.put(wrapInt(1), wrapInt(1));
-    sos.put(wrapInt(2), wrapInt(1));
-    sos.put(wrapInt(3), wrapInt(1));
-    sos.put(wrapInt(4), wrapInt(1));
-    sos.flush(null, handler);
-    
-    // #2
-    sos.put(wrapInt(2), wrapInt(1));
-    sos.put(wrapInt(4), wrapInt(1));
-    sos.put(wrapInt(6), wrapInt(1));
-    sos.put(wrapInt(8), wrapInt(1));
-    sos.flush(null, handler);
-    
-    // #3
-    sos.put(wrapInt(1), wrapInt(1));
-    sos.put(wrapInt(3), wrapInt(1));
-    sos.put(wrapInt(5), wrapInt(1));
-    sos.put(wrapInt(7), wrapInt(1));
-    sos.put(wrapInt(9), wrapInt(1));
-    sos.flush(null, handler);
-    
-    // #4
-    sos.put(wrapInt(0), wrapInt(1));
-    sos.put(wrapInt(1), wrapInt(1));
-    sos.put(wrapInt(4), wrapInt(1));
-    sos.put(wrapInt(5), wrapInt(1));
-
-    while (!handler.flushes.compareAndSet(3, 0));
-    
-    // the iteration pattern for this test should be 0-9:
-    // 0 1 4 5   sbuffer #4
-    // 1 3 5 7 9 soplog #3
-    // 2 4 6 8   soplog #2
-    // 1 2 3 4   soplog #1
-    List<Integer> result = new ArrayList<Integer>();
-    SortedIterator<ByteBuffer> iter = sos.scan();
-    try {
-      while (iter.hasNext()) {
-        ByteBuffer key = iter.next();
-        ByteBuffer val = iter.value();
-        assertEquals(wrapInt(1), val);
-        
-        result.add(key.getInt());
-      }
-    } finally {
-      iter.close();
-    }
-
-    sos.close();
-    
-    assertEquals(10, result.size());
-    for (int i = 0; i < 10; i++) {
-      assertEquals(i, result.get(i).intValue());
-    }
-  }
-
-  @Override
-  protected SortedReader<ByteBuffer> createReader(NavigableMap<byte[], byte[]> data) 
-      throws IOException {
-    set = createSoplogSet("test");
-    
-    int i = 0;
-    int flushes = 0;
-    FlushCounter fc = new FlushCounter();
-    
-    for (Entry<byte[], byte[]> entry : data.entrySet()) {
-      set.put(entry.getKey(), entry.getValue());
-      if (i++ % 13 == 0) {
-        flushes++;
-        set.flush(null, fc);
-      }
-    }
-    
-    while (!fc.flushes.compareAndSet(flushes, 0));
-    return set;
-  }
-  
-  public void testClear() throws IOException {
-    set.clear();
-    validateEmpty(set);
-  }
-  
-  public void testDestroy() throws IOException {
-    set.destroy();
-    assertTrue(((SortedOplogSetImpl) set).isClosed());
-    try {
-      set.scan();
-      fail();
-    } catch (IllegalStateException e) { }
-  }
-  
-  public void testClearInterruptsFlush() throws Exception {
-    FlushCounter handler = new FlushCounter();
-    SortedOplogSetImpl sos = prepSoplogSet("clearDuringFlush");
-    
-    sos.testDelayDuringFlush = new CountDownLatch(1);
-    sos.flush(null, handler);
-    sos.clear();
-    
-    flushAndWait(handler, sos);
-    validateEmpty(sos);
-    assertEquals(2, handler.flushes.get());
-  }
-  
-  public void testClearRepeat() throws Exception {
-    int i = 0;
-    do {
-      testClearInterruptsFlush();
-      logger.debug("Test {} is complete", i);
-      tearDown();
-      setUp();
-    } while (i++ < 100);
- }
-  
-  public void testCloseInterruptsFlush() throws Exception {
-    FlushCounter handler = new FlushCounter();
-    SortedOplogSetImpl sos = prepSoplogSet("closeDuringFlush");
-    
-    sos.testDelayDuringFlush = new CountDownLatch(1);
-    sos.flush(null, handler);
-    sos.close();
-    
-    assertTrue(sos.isClosed());
-    assertEquals(1, handler.flushes.get());
-  }
-
-  public void testDestroyInterruptsFlush() throws Exception {
-    FlushCounter handler = new FlushCounter();
-    SortedOplogSetImpl sos = prepSoplogSet("destroyDuringFlush");
-    
-    sos.testDelayDuringFlush = new CountDownLatch(1);
-    sos.flush(null, handler);
-    sos.destroy();
-    
-    assertTrue(sos.isClosed());
-    assertEquals(1, handler.flushes.get());
-  }
-
-  public void testScanAfterClear() throws IOException {
-    SortedIterator<ByteBuffer> iter = set.scan();
-    set.clear();
-    assertFalse(iter.hasNext());
-  }
-
-  public void testScanAfterClose() throws IOException {
-    SortedIterator<ByteBuffer> iter = set.scan();
-    set.close();
-    assertFalse(iter.hasNext());
-  }
-  
-  public void testEmptyFlush() throws Exception {
-    FlushCounter handler = new FlushCounter();
-    SortedOplogSet sos = prepSoplogSet("empty");
-    
-    flushAndWait(handler, sos);
-    flushAndWait(handler, sos);
-  }
-  
-  public void testErrorDuringFlush() throws Exception {
-    FlushCounter handler = new FlushCounter();
-    handler.error.set(true);
-    
-    SortedOplogSetImpl sos = prepSoplogSet("err");
-    sos.testErrorDuringFlush = true;
-    
-    flushAndWait(handler, sos);
-  }
-  
-  protected void validateEmpty(SortedOplogSet sos) throws IOException {
-    assertEquals(0, sos.bufferSize());
-    assertEquals(0, sos.unflushedSize());
-    
-    SortedIterator<ByteBuffer> iter = sos.scan();
-    assertFalse(iter.hasNext());
-    iter.close();
-    sos.close();
-  }
-  
-  protected SortedOplogSetImpl prepSoplogSet(String name) throws IOException {
-    SortedOplogSetImpl sos = createSoplogSet(name);
-
-    sos.put(wrapInt(1), wrapInt(1));
-    sos.put(wrapInt(2), wrapInt(1));
-    sos.put(wrapInt(3), wrapInt(1));
-    sos.put(wrapInt(4), wrapInt(1));
-    
-    return sos;
-  }
-  
-  protected SortedOplogSetImpl createSoplogSet(String name) throws IOException {
-    SortedOplogFactory factory = new NoFileSortedOplogFactory(name);
-    Compactor compactor = new NonCompactor(name, new File("."));
-    
-    return new SortedOplogSetImpl(factory, Executors.newSingleThreadExecutor(), compactor);
-  }
-
-  protected void flushAndWait(FlushCounter handler, SortedOplogSet sos)
-      throws InterruptedException, IOException {
-    sos.flush(null, handler);
-    while (sos.unflushedSize() > 0) {
-      Thread.sleep(1000);
-    }
-  }
-
-  protected static class FlushCounter implements FlushHandler {
-    private final AtomicInteger flushes = new AtomicInteger(0);
-    private final AtomicBoolean error = new AtomicBoolean(false);
-    
-    @Override 
-    public void complete() {
-      logger.debug("Flush complete! {}", this);
-      assertFalse(error.get());
-      flushes.incrementAndGet();
-    }
-    
-    @Override 
-    public void error(Throwable t) {
-      if (!error.get()) {
-        t.printStackTrace();
-        fail(t.getMessage());
-      }
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/9438c8b1/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/persistence/soplog/SortedReaderTestCase.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/persistence/soplog/SortedReaderTestCase.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/persistence/soplog/SortedReaderTestCase.java
deleted file mode 100644
index b41e6ba..0000000
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/persistence/soplog/SortedReaderTestCase.java
+++ /dev/null
@@ -1,295 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gemstone.gemfire.internal.cache.persistence.soplog;
-
-import java.io.File;
-import java.io.FilenameFilter;
-import java.io.IOException;
-import java.nio.ByteBuffer;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map.Entry;
-import java.util.NavigableMap;
-import java.util.TreeMap;
-import java.util.concurrent.Callable;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.Future;
-
-import junit.framework.TestCase;
-
-import com.gemstone.gemfire.internal.cache.persistence.soplog.SortedReader.SortedIterator;
-import com.gemstone.gemfire.internal.cache.persistence.soplog.SortedReader.SortedStatistics;
-
-public abstract class SortedReaderTestCase extends TestCase {
-  private NavigableMap<byte[], byte[]> data;
-  protected SortedReader<ByteBuffer> reader;
-
-  public static void assertEquals(byte[] expected, ByteBuffer actual) {
-    assertEquals(expected.length, actual.remaining());
-    for (int i = 0; i < expected.length; i++) {
-      assertEquals(expected[i], actual.get(actual.position() + i));
-    }
-  }
-  
-  public void testComparator() {
-    assertNotNull(reader.getComparator());
-  }
-  
-  public void testStatistics() throws IOException {
-    SortedStatistics stats = reader.getStatistics();
-    try {
-      assertEquals(data.size(), stats.keyCount());
-      assertTrue(Arrays.equals(data.firstKey(), stats.firstKey()));
-      assertTrue(Arrays.equals(data.lastKey(), stats.lastKey()));
-      
-      int keySize = 0;
-      int valSize = 0;
-      for (Entry<byte[], byte[]> entry : data.entrySet()) {
-        keySize += entry.getKey().length;
-        valSize += entry.getValue().length;
-      }
-
-      double avgKey = keySize / data.size();
-      double avgVal = valSize / data.size();
-          
-      assertEquals(avgVal, stats.avgValueSize());
-      assertEquals(avgKey, stats.avgKeySize());
-      
-    } finally {
-      stats.close();
-    }
-  }
-
-  public void testMightContain() throws IOException {
-    for (byte[] key : data.keySet()) {
-      assertTrue(reader.mightContain(key));
-    }
-  }
-
-  public void testRead() throws IOException {
-    for (byte[] key : data.keySet()) {
-      assertEquals(data.get(key), reader.read(key));
-    }
-  }
-
-  public void testScan() throws IOException {
-    SortedIterator<ByteBuffer> scan = reader.scan();
-    try {
-      Iterator<Entry<byte[], byte[]>> iter = data.entrySet().iterator();
-      doIter(scan, iter);
-      
-    } finally {
-      scan.close();
-    }
-  }
-  
-  public void testMultithreadScan() throws Exception {
-    int threads = 10;
-    ExecutorService exec = Executors.newFixedThreadPool(threads);
-    List<Callable<Boolean>> tasks = new ArrayList<Callable<Boolean>>();
-    for (int i = 0; i < threads; i++) {
-      tasks.add(new Callable<Boolean>() {
-        @Override
-        public Boolean call() throws Exception {
-          testScan();
-          return true;
-        }
-      });
-    }
-
-    int i = 0;
-    while (i++ < 1000) {
-      for (Future<Boolean> ft : exec.invokeAll(tasks)) {
-        assertTrue(ft.get());
-      }
-    }
-  }
-  
-  public void testScanReverse() throws IOException {
-    SortedIterator<ByteBuffer> scan = reader.withAscending(false).scan();
-    try {
-      Iterator<Entry<byte[], byte[]>> iter = data.descendingMap().entrySet().iterator();
-      doIter(scan, iter);
-    } finally {
-      scan.close();
-    }
-  }
-  
-  public void testHead() throws IOException {
-    byte[] split = wrapInt(50);
-    SortedIterator<ByteBuffer> scan = reader.head(split, true);
-    try {
-      Iterator<Entry<byte[], byte[]>> iter = data.headMap(split, true).entrySet().iterator();
-      doIter(scan, iter);
-    } finally {
-      scan.close();
-    }
-    
-    scan = reader.head(split, false);
-    try {
-      Iterator<Entry<byte[], byte[]>> iter = data.headMap(split, false).entrySet().iterator();
-      doIter(scan, iter);
-    } finally {
-      scan.close();
-    }
-  }
-  
-  public void testTail() throws IOException {
-    byte[] split = wrapInt(50);
-    SortedIterator<ByteBuffer> scan = reader.tail(split, true);
-    try {
-      Iterator<Entry<byte[], byte[]>> iter = data.tailMap(split, true).entrySet().iterator();
-      doIter(scan, iter);
-    } finally {
-      scan.close();
-    }
-    
-    scan = reader.tail(split, false);
-    try {
-      Iterator<Entry<byte[], byte[]>> iter = data.tailMap(split, false).entrySet().iterator();
-      doIter(scan, iter);
-    } finally {
-      scan.close();
-    }
-  }
-  
-  public void testScanWithBounds() throws IOException {
-    byte[] lhs = wrapInt(10);
-    byte[] rhs = wrapInt(90);
-
-    // [lhs,rhs)
-    SortedIterator<ByteBuffer> scan = reader.scan(lhs, rhs);
-    try {
-      Iterator<Entry<byte[], byte[]>> iter = data.subMap(lhs, rhs).entrySet().iterator();
-      doIter(scan, iter);
-    } finally {
-      scan.close();
-    }
-    
-    // (lhs,rhs)
-    scan = reader.scan(lhs, false, rhs, false);
-    try {
-      Iterator<Entry<byte[], byte[]>> iter = data.subMap(lhs, false, rhs, false).entrySet().iterator();
-      doIter(scan, iter);
-    } finally {
-      scan.close();
-    }
-  
-    // [lhs,rhs]
-    scan = reader.scan(lhs, true, rhs, true);
-    try {
-      Iterator<Entry<byte[], byte[]>> iter = data.subMap(lhs, true, rhs, true).entrySet().iterator();
-      doIter(scan, iter);
-    } finally {
-      scan.close();
-    }
-  }
-  
-  public void testReverseScanWithBounds() throws IOException {
-    data = data.descendingMap();
-    byte[] rhs = wrapInt(10);
-    byte[] lhs = wrapInt(90);
-
-    SortedReader<ByteBuffer> rev = reader.withAscending(false);
-    
-    // [rhs,lhs)
-    SortedIterator<ByteBuffer> scan = rev.scan(lhs, rhs);
-    try {
-      Iterator<Entry<byte[], byte[]>> iter = data.subMap(lhs, rhs).entrySet().iterator();
-      doIter(scan, iter);
-    } finally {
-      scan.close();
-    }
-      
-    // (rhs,lhs)
-    scan = rev.scan(lhs, false, rhs, false);
-    try {
-      Iterator<Entry<byte[], byte[]>> iter = data.subMap(lhs, false, rhs, false).entrySet().iterator();
-      doIter(scan, iter);
-    } finally {
-      scan.close();
-    }
-  
-    // [rhs,lhs]
-    scan = rev.scan(lhs, true, rhs, true);
-    try {
-      Iterator<Entry<byte[], byte[]>> iter = data.subMap(lhs, true, rhs, true).entrySet().iterator();
-      doIter(scan, iter);
-    } finally {
-      scan.close();
-    }
-  }
-  
-  public void testScanEquality() throws IOException {
-    byte[] val = wrapInt(10);
-    
-    // [val,val]
-    SortedIterator<ByteBuffer> scan = reader.scan(val);
-    try {
-      Iterator<Entry<byte[], byte[]>> iter = data.subMap(val, true, val, true).entrySet().iterator();
-      doIter(scan, iter);
-    } finally {
-      scan.close();
-    }
-  }
-  
-  public static byte[] wrapInt(int n) {
-    ByteBuffer buf = (ByteBuffer) ByteBuffer.allocate(4).putInt(n).flip();
-    return buf.array();
-  }
-  
-  public static File[] getSoplogsToDelete() {
-    return new File(".").listFiles(new FilenameFilter() {
-      @Override
-      public boolean accept(File dir, String name) {
-        return name.endsWith("soplog") || name.endsWith("crc");
-      }
-    });
-  }
-
-  private void doIter(SortedIterator<ByteBuffer> scan, Iterator<Entry<byte[], byte[]>> iter) {
-    while (scan.hasNext() || iter.hasNext()) {
-      Entry<byte[], byte[]> expected = iter.next();
-      assertEquals(expected.getKey(), scan.next());
-      assertEquals(expected.getValue(), scan.value());
-    }
-  }
-
-  @Override
-  protected final void setUp() throws IOException {
-    data = new TreeMap<byte[], byte[]>(new ByteComparator());
-    
-    for (int i = 0; i < 100; i++) {
-      data.put(wrapInt(i), wrapInt(i));
-    }
-    reader = createReader(data);
-  }
-  
-  @Override 
-  protected void tearDown() throws IOException {
-    reader.close();
-    for (File f : getSoplogsToDelete()) {
-      f.delete();
-    }
-  }
-  
-  protected abstract SortedReader<ByteBuffer> createReader(NavigableMap<byte[], byte[]> data) 
-      throws IOException;
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/9438c8b1/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/persistence/soplog/nofile/NoFileSortedOplogJUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/persistence/soplog/nofile/NoFileSortedOplogJUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/persistence/soplog/nofile/NoFileSortedOplogJUnitTest.java
deleted file mode 100644
index b6813d7..0000000
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/persistence/soplog/nofile/NoFileSortedOplogJUnitTest.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gemstone.gemfire.internal.cache.persistence.soplog.nofile;
-
-import java.io.IOException;
-import java.nio.ByteBuffer;
-import java.util.Map.Entry;
-import java.util.NavigableMap;
-
-import org.junit.experimental.categories.Category;
-
-import com.gemstone.gemfire.internal.cache.persistence.soplog.SortedOplog.SortedOplogWriter;
-import com.gemstone.gemfire.internal.cache.persistence.soplog.SortedOplogFactory.SortedOplogConfiguration;
-import com.gemstone.gemfire.internal.cache.persistence.soplog.SortedReader;
-import com.gemstone.gemfire.internal.cache.persistence.soplog.SortedReaderTestCase;
-import com.gemstone.gemfire.test.junit.categories.UnitTest;
-
-@Category(UnitTest.class)
-public class NoFileSortedOplogJUnitTest extends SortedReaderTestCase {
-  private NoFileSortedOplog mfile;
-
-  @Override
-  protected SortedReader<ByteBuffer> createReader(NavigableMap<byte[], byte[]> data) throws IOException {
-    mfile = new NoFileSortedOplog(new SortedOplogConfiguration("nofile"));
-
-    SortedOplogWriter wtr = mfile.createWriter();
-    for (Entry<byte[], byte[]> entry : data.entrySet()) {
-      wtr.append(entry.getKey(), entry.getValue());
-    }
-    wtr.close(null);
-
-    return mfile.createReader();
-  }
-}


Mime
View raw message