use of com.hazelcast.config.QueueStoreConfig in project hazelcast by hazelcast.
the class AbstractDynamicConfigGeneratorTest method testQueueWithStoreFactory.
@Test
public void testQueueWithStoreFactory() {
QueueStoreConfig queueStoreConfig = new QueueStoreConfig().setFactoryClassName("factoryClassName").setEnabled(true).setProperty("key", "value");
testQueue(queueStoreConfig);
}
use of com.hazelcast.config.QueueStoreConfig in project hazelcast by hazelcast.
the class AbstractDynamicConfigGeneratorTest method testQueueWithStoreClass.
// QUEUE
@Test
public void testQueueWithStoreClass() {
QueueStoreConfig queueStoreConfig = new QueueStoreConfig().setClassName("className").setEnabled(true).setProperty("key", "value");
testQueue(queueStoreConfig);
}
use of com.hazelcast.config.QueueStoreConfig in project hazelcast by hazelcast.
the class AbstractDynamicConfigGeneratorTest method testQueue.
private void testQueue(QueueStoreConfig queueStoreConfig) {
MergePolicyConfig mergePolicyConfig = new MergePolicyConfig().setPolicy(DiscardMergePolicy.class.getSimpleName()).setBatchSize(1234);
QueueConfig expectedConfig = new QueueConfig().setName("testQueue").setPriorityComparatorClassName("com.hazelcast.collection.impl.queue.model.PriorityElementComparator").setMaxSize(10).setStatisticsEnabled(true).setBackupCount(2).setAsyncBackupCount(3).setEmptyQueueTtl(1000).setMergePolicyConfig(mergePolicyConfig).setQueueStoreConfig(queueStoreConfig).setItemListenerConfigs(singletonList(new ItemListenerConfig("java.Listener", true)));
Config config = new Config().addQueueConfig(expectedConfig);
Config decConfig = getNewConfigViaGenerator(config);
QueueConfig actualConfig = decConfig.getQueueConfig("testQueue");
assertEquals("testQueue", actualConfig.getName());
MergePolicyConfig decMergePolicyConfig = actualConfig.getMergePolicyConfig();
assertEquals(DiscardMergePolicy.class.getSimpleName(), decMergePolicyConfig.getPolicy());
assertEquals(1234, decMergePolicyConfig.getBatchSize());
ConfigCompatibilityChecker.checkQueueConfig(expectedConfig, actualConfig);
}
use of com.hazelcast.config.QueueStoreConfig in project hazelcast by hazelcast.
the class QueueStoreTest method getBinaryQueueStoreConfig.
private QueueStoreConfig getBinaryQueueStoreConfig() {
QueueStoreConfig queueStoreConfig = new QueueStoreConfig();
QueueStore<Data> binaryQueueStore = new BasicQueueStore<Data>();
queueStoreConfig.setStoreImplementation(binaryQueueStore);
queueStoreConfig.setEnabled(true);
queueStoreConfig.setProperty("binary", "true");
queueStoreConfig.setProperty("memory-limit", "0");
queueStoreConfig.setProperty("bulk-load", "100");
return queueStoreConfig;
}
use of com.hazelcast.config.QueueStoreConfig in project hazelcast by hazelcast.
the class QueueStoreConfigHolder method asQueueStoreConfig.
public QueueStoreConfig asQueueStoreConfig(SerializationService serializationService) {
QueueStoreConfig config = new QueueStoreConfig();
if (!StringUtil.isNullOrEmptyAfterTrim(className)) {
config.setClassName(className);
}
config.setEnabled(enabled);
if (!StringUtil.isNullOrEmptyAfterTrim(factoryClassName)) {
config.setFactoryClassName(factoryClassName);
}
config.setProperties(PropertiesUtil.fromMap(properties));
QueueStore storeImplementation = serializationService.toObject(implementation);
if (storeImplementation != null) {
config.setStoreImplementation(storeImplementation);
}
QueueStoreFactory storeFactoryImplementation = serializationService.toObject(factoryImplementation);
if (storeFactoryImplementation != null) {
config.setFactoryImplementation(storeFactoryImplementation);
}
return config;
}
Aggregations