Package dovetaildb.dbservice

Source Code of dovetaildb.dbservice.BagIndexBridgeTest

package dovetaildb.dbservice;

import java.io.File;
import java.util.HashMap;

import dovetaildb.bagindex.FsBlueSteelBagIndex;
import dovetaildb.bagindex.MemoryBlueSteelBagIndex;
import dovetaildb.bagindex.TrivialBagIndex;
import dovetaildb.util.Util;

public class BagIndexBridgeTest extends DbServiceTest {

  protected DbService createService() {
    final File tempDir = Util.createTempDirectory("BagIndexBridgeTest");
    try {
      BagIndexBridge b = new BagIndexBridge(tempDir);
      b.setBagIndexFactory(new BagEntryFactory() {
        public BagEntry makeBagEntry(String bagName) {
          //return new BagEntry(new TrivialBagIndex(), new DefaultTermEncoder(), 0);
          FsBlueSteelBagIndex index = new FsBlueSteelBagIndex(false);
          index.setHomedir(new File(tempDir, "bag_"+bagName).getAbsolutePath());
          //MemoryBlueSteelBagIndex index = new MemoryBlueSteelBagIndex();
          index.setTermTableDepth(3);
          return new BagEntry(index);
        }
      });
      ProcessTransactionMapper mapper = new ProcessTransactionMapper();
      mapper.addRevsForTxn(0, new HashMap<String,Long>());
      b.setTxnMapper(mapper);
      return b;
    } finally {
      Util.deleteDirectory(tempDir);
    }
  }
 
}
TOP

Related Classes of dovetaildb.dbservice.BagIndexBridgeTest

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.