Search in sources :

Example 1 with CachedBTreePartition

use of org.apache.cassandra.db.partitions.CachedBTreePartition in project cassandra by apache.

the class CacheProviderTest method assertDigests.

private void assertDigests(IRowCacheEntry one, CachedBTreePartition two) {
    assertTrue(one instanceof CachedBTreePartition);
    try {
        MessageDigest d1 = MessageDigest.getInstance("MD5");
        MessageDigest d2 = MessageDigest.getInstance("MD5");
        UnfilteredRowIterators.digest(((CachedBTreePartition) one).unfilteredIterator(), d1, MessagingService.current_version);
        UnfilteredRowIterators.digest(((CachedBTreePartition) two).unfilteredIterator(), d2, MessagingService.current_version);
        assertTrue(MessageDigest.isEqual(d1.digest(), d2.digest()));
    } catch (NoSuchAlgorithmException e) {
        throw new RuntimeException(e);
    }
}
Also used : CachedBTreePartition(org.apache.cassandra.db.partitions.CachedBTreePartition) NoSuchAlgorithmException(java.security.NoSuchAlgorithmException) MessageDigest(java.security.MessageDigest)

Example 2 with CachedBTreePartition

use of org.apache.cassandra.db.partitions.CachedBTreePartition in project cassandra by apache.

the class CacheProviderTest method testSerializingCache.

@Test
public void testSerializingCache() throws InterruptedException {
    ICache<MeasureableString, IRowCacheEntry> cache = SerializingCache.create(CAPACITY, Weigher.singletonWeigher(), new SerializingCacheProvider.RowCacheSerializer());
    CachedBTreePartition partition = createPartition();
    simpleCase(partition, cache);
    concurrentCase(partition, cache);
}
Also used : CachedBTreePartition(org.apache.cassandra.db.partitions.CachedBTreePartition) Test(org.junit.Test)

Aggregations

CachedBTreePartition (org.apache.cassandra.db.partitions.CachedBTreePartition)2 MessageDigest (java.security.MessageDigest)1 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)1 Test (org.junit.Test)1