Search in sources :

Example 6 with MockTime

use of voldemort.MockTime in project voldemort by voldemort.

the class DataCleanupJobTest method setUp.

@Before
public void setUp() throws Exception {
    time = new MockTime();
    storeDir = TestUtils.createTempDir();
    FileDeleteStrategy.FORCE.delete(storeDir);
    // lets use all the default values.
    Props props = new Props();
    props.put("node.id", 1);
    props.put("voldemort.home", "test/common/voldemort/config");
    VoldemortConfig voldemortConfig = new VoldemortConfig(props);
    voldemortConfig.setBdbCacheSize(1024 * 1024);
    voldemortConfig.setBdbOneEnvPerStore(true);
    voldemortConfig.setBdbDataDirectory(storeDir.toURI().getPath());
    voldemortConfig.setBdbPrefixKeysWithPartitionId(prefixPartitionId);
    bdbStorage = new BdbStorageConfiguration(voldemortConfig);
    StoreDefinition storeDef = getStoreDef(START_RETENTION);
    engine = bdbStorage.getStore(storeDef, TestUtils.makeSingleNodeRoutingStrategy());
    List<Node> nodes = Lists.newArrayList();
    nodes.add(new Node(0, "test-host", 1234, 1235, 1236, Arrays.asList(0)));
    Cluster cluster = new Cluster("cluster", nodes);
    StoreRepository repo = new StoreRepository();
    repo.setSlopStore(new SlopStorageEngine(new InMemoryStorageEngine<ByteArray, byte[], byte[]>("slop"), cluster));
    repo.addNodeStore(0, engine);
    metadataStore = ServerTestUtils.createMetadataStore(cluster, Arrays.asList(storeDef));
}
Also used : InMemoryStorageEngine(voldemort.store.memory.InMemoryStorageEngine) StoreDefinition(voldemort.store.StoreDefinition) Node(voldemort.cluster.Node) Cluster(voldemort.cluster.Cluster) StoreRepository(voldemort.server.StoreRepository) SlopStorageEngine(voldemort.store.slop.SlopStorageEngine) Props(voldemort.utils.Props) BdbStorageConfiguration(voldemort.store.bdb.BdbStorageConfiguration) MockTime(voldemort.MockTime) VoldemortConfig(voldemort.server.VoldemortConfig) Before(org.junit.Before)

Aggregations

MockTime (voldemort.MockTime)6 SchedulerService (voldemort.common.service.SchedulerService)4 Before (org.junit.Before)3 StoreRepository (voldemort.server.StoreRepository)3 File (java.io.File)2 Date (java.util.Date)2 Test (org.junit.Test)2 VoldemortConfig (voldemort.server.VoldemortConfig)2 DataCleanupJob (voldemort.server.scheduler.DataCleanupJob)2 ScanPermitWrapper (voldemort.server.storage.ScanPermitWrapper)2 StringReader (java.io.StringReader)1 Cluster (voldemort.cluster.Cluster)1 Node (voldemort.cluster.Node)1 VoldemortServer (voldemort.server.VoldemortServer)1 StoreDefinition (voldemort.store.StoreDefinition)1 BdbStorageConfiguration (voldemort.store.bdb.BdbStorageConfiguration)1 InMemoryStorageEngine (voldemort.store.memory.InMemoryStorageEngine)1 SlopStorageEngine (voldemort.store.slop.SlopStorageEngine)1 ClientRequestExecutorPool (voldemort.store.socket.clientrequest.ClientRequestExecutorPool)1 Props (voldemort.utils.Props)1