Search in sources :

Example 1 with SerializingStorageEngine

use of voldemort.store.serialized.SerializingStorageEngine in project voldemort by voldemort.

the class AbstractStorageEngineTest method testKeyIterationWithSerialization.

@Test
public void testKeyIterationWithSerialization() {
    StorageEngine<ByteArray, byte[], byte[]> store = getStorageEngine();
    StorageEngine<String, String, String> stringStore = new SerializingStorageEngine<String, String, String>(store, new StringSerializer(), new StringSerializer(), new StringSerializer());
    Map<String, String> vals = ImmutableMap.of("a", "a", "b", "b", "c", "c", "d", "d", "e", "e");
    for (Map.Entry<String, String> entry : vals.entrySet()) stringStore.put(entry.getKey(), new Versioned<String>(entry.getValue()), null);
    ClosableIterator<String> iter = stringStore.keys();
    int count = 0;
    while (iter.hasNext()) {
        String key = iter.next();
        assertTrue(vals.containsKey(key));
        count++;
    }
    assertEquals(count, vals.size());
    iter.close();
}
Also used : SerializingStorageEngine(voldemort.store.serialized.SerializingStorageEngine) Versioned(voldemort.versioning.Versioned) ByteArray(voldemort.utils.ByteArray) StringSerializer(voldemort.serialization.StringSerializer) ImmutableMap(com.google.common.collect.ImmutableMap) Map(java.util.Map) Test(org.junit.Test)

Aggregations

ImmutableMap (com.google.common.collect.ImmutableMap)1 Map (java.util.Map)1 Test (org.junit.Test)1 StringSerializer (voldemort.serialization.StringSerializer)1 SerializingStorageEngine (voldemort.store.serialized.SerializingStorageEngine)1 ByteArray (voldemort.utils.ByteArray)1 Versioned (voldemort.versioning.Versioned)1