use of com.hazelcast.config.QueueStoreConfig in project hazelcast by hazelcast.
the class AbstractDynamicConfigGeneratorTest method testQueueWithStoreFactoryImplementation.
@Test
public void testQueueWithStoreFactoryImplementation() {
QueueStoreConfig queueStoreConfig = new QueueStoreConfig().setFactoryImplementation(new TestQueueStoreFactory()).setEnabled(true).setProperty("key", "value");
testQueue(queueStoreConfig);
}
use of com.hazelcast.config.QueueStoreConfig in project hazelcast by hazelcast.
the class AbstractDynamicConfigGeneratorTest method testQueueWithStoreImplementation.
@Test
public void testQueueWithStoreImplementation() {
QueueStoreConfig queueStoreConfig = new QueueStoreConfig().setStoreImplementation(new TestQueueStore()).setEnabled(true).setProperty("key", "value");
testQueue(queueStoreConfig);
}
use of com.hazelcast.config.QueueStoreConfig in project hazelcast by hazelcast.
the class QueueStoreTest method testQueueStoreLoadMoreThanMaxSize.
@Test
public void testQueueStoreLoadMoreThanMaxSize() {
Config config = getConfig();
int maxSize = 2000;
TestQueueStore queueStore = new TestQueueStore();
QueueStoreConfig queueStoreConfig = new QueueStoreConfig().setStoreImplementation(queueStore);
config.getQueueConfig("testQueueStore").setMaxSize(maxSize).setQueueStoreConfig(queueStoreConfig);
HazelcastInstance instance = createHazelcastInstance(config);
for (int i = 0; i < maxSize * 2; i++) {
queueStore.store.put((long) i, new VersionedObject<>(i, i));
}
IQueue<Object> queue = instance.getQueue("testQueueStore");
assertEquals("Queue Size should be equal to max size", maxSize, queue.size());
}
use of com.hazelcast.config.QueueStoreConfig in project hazelcast by hazelcast.
the class QueueStoreTest method testQueueStoreFactory.
@Test
public void testQueueStoreFactory() {
String queueName = randomString();
Config config = getConfig();
QueueStoreFactory<VersionedObject<Integer>> queueStoreFactory = new SimpleQueueStoreFactory();
QueueStoreConfig queueStoreConfig = new QueueStoreConfig().setEnabled(true).setFactoryImplementation(queueStoreFactory);
config.getQueueConfig(queueName).setQueueStoreConfig(queueStoreConfig);
HazelcastInstance instance = createHazelcastInstance(config);
IQueue<VersionedObject<Integer>> queue = instance.getQueue(queueName);
queue.add(new VersionedObject<>(1));
TestQueueStore testQueueStore = (TestQueueStore) queueStoreFactory.newQueueStore(queueName, null);
int size = testQueueStore.store.size();
assertEquals("Queue store size should be 1 but found " + size, 1, size);
}
Aggregations