use of com.hazelcast.config.RingbufferStoreConfig in project hazelcast by hazelcast.
the class RingbufferStoreTest method testRingbufferStoreFactory.
@Test
public void testRingbufferStoreFactory() {
final String ringbufferName = randomString();
final SimpleRingbufferStoreFactory rbStoreFactory = new SimpleRingbufferStoreFactory();
final RingbufferStoreConfig rbStoreConfig = new RingbufferStoreConfig().setEnabled(true).setFactoryImplementation(rbStoreFactory);
final Config config = getConfig(ringbufferName, DEFAULT_CAPACITY, OBJECT, rbStoreConfig);
final HazelcastInstance instance = createHazelcastInstance(config);
final Ringbuffer<Object> ringbuffer = instance.getRingbuffer(ringbufferName);
ringbuffer.add(1);
assertEquals(1, rbStoreFactory.stores.size());
final TestRingbufferStore ringbufferStore = (TestRingbufferStore) rbStoreFactory.stores.get(ringbufferName);
int size = ringbufferStore.store.size();
assertEquals("Ring buffer store size should be 1 but found " + size, 1, size);
}
use of com.hazelcast.config.RingbufferStoreConfig in project hazelcast by hazelcast.
the class RingbufferStoreTest method testRingbufferStore_addThrowsException.
@Test(expected = HazelcastException.class)
public void testRingbufferStore_addThrowsException() {
final String ringbufferName = randomString();
final RingbufferStoreConfig rbStoreConfig = new RingbufferStoreConfig().setStoreImplementation(new ExceptionThrowingRingbufferStore()).setEnabled(true);
final Config config = getConfig(ringbufferName, DEFAULT_CAPACITY, OBJECT, rbStoreConfig);
final HazelcastInstance node = createHazelcastInstance(config);
final Ringbuffer<Object> ringbuffer = node.getRingbuffer(ringbufferName);
ringbuffer.add(1);
}
use of com.hazelcast.config.RingbufferStoreConfig in project hazelcast by hazelcast.
the class RingbufferSplitBrainTest method config.
@Override
protected Config config() {
MergePolicyConfig mergePolicyConfig = new MergePolicyConfig().setPolicy(mergePolicyClass.getName()).setBatchSize(10);
Config config = super.config();
config.getRingbufferConfig(ringbufferNameA).setInMemoryFormat(inMemoryFormat).setMergePolicyConfig(mergePolicyConfig).setRingbufferStoreConfig(new RingbufferStoreConfig().setStoreImplementation(ringbufferStoreA)).setBackupCount(1).setAsyncBackupCount(0).setTimeToLiveSeconds(0);
config.getRingbufferConfig(ringbufferNameB).setInMemoryFormat(inMemoryFormat).setMergePolicyConfig(mergePolicyConfig).setRingbufferStoreConfig(new RingbufferStoreConfig().setStoreImplementation(ringbufferStoreB)).setBackupCount(1).setAsyncBackupCount(0).setTimeToLiveSeconds(0);
return config;
}
Aggregations