use of org.apache.samza.storage.StorageEngine in project samza by apache.
the class TestBaseKeyValueStorageEngineFactory method testDropLargeMessagesWithCache.
@Test
public void testDropLargeMessagesWithCache() {
Config config = new MapConfig(BASE_CONFIG, DROP_LARGE_MESSAGES);
StorageEngine storageEngine = callGetStorageEngine(config, null);
KeyValueStorageEngine<?, ?> keyValueStorageEngine = baseStorageEngineValidation(storageEngine);
assertStoreProperties(keyValueStorageEngine.getStoreProperties(), true, false, false);
NullSafeKeyValueStore<?, ?> nullSafeKeyValueStore = assertAndCast(keyValueStorageEngine.getWrapperStore(), NullSafeKeyValueStore.class);
CachedStore<?, ?> cachedStore = assertAndCast(nullSafeKeyValueStore.getStore(), CachedStore.class);
SerializedKeyValueStore<?, ?> serializedKeyValueStore = assertAndCast(cachedStore.getStore(), SerializedKeyValueStore.class);
LargeMessageSafeStore largeMessageSafeStore = assertAndCast(serializedKeyValueStore.getStore(), LargeMessageSafeStore.class);
assertEquals(this.rawKeyValueStore, largeMessageSafeStore.getStore());
}
use of org.apache.samza.storage.StorageEngine in project samza by apache.
the class TestBaseKeyValueStorageEngineFactory method testDurableKeyValueStore.
@Test
public void testDurableKeyValueStore() {
Config config = new MapConfig(BASE_CONFIG, DISABLE_CACHE, ImmutableMap.of(String.format(StorageConfig.STORE_BACKUP_FACTORIES, STORE_NAME), "backendFactory,backendFactory2"));
StorageEngine storageEngine = callGetStorageEngine(config, null);
KeyValueStorageEngine<?, ?> keyValueStorageEngine = baseStorageEngineValidation(storageEngine);
assertStoreProperties(keyValueStorageEngine.getStoreProperties(), true, false, true);
NullSafeKeyValueStore<?, ?> nullSafeKeyValueStore = assertAndCast(keyValueStorageEngine.getWrapperStore(), NullSafeKeyValueStore.class);
SerializedKeyValueStore<?, ?> serializedKeyValueStore = assertAndCast(nullSafeKeyValueStore.getStore(), SerializedKeyValueStore.class);
// config has the in-memory key-value factory, but still calling the test factory, so store will be the test store
assertEquals(this.rawKeyValueStore, serializedKeyValueStore.getStore());
}
Aggregations