Search in sources :

Example 21 with QueueStoreConfig

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);
}
Also used : QueueStoreConfig(com.hazelcast.config.QueueStoreConfig) Test(org.junit.Test)

Example 22 with 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);
}
Also used : QueueStoreConfig(com.hazelcast.config.QueueStoreConfig) Test(org.junit.Test)

Example 23 with 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());
}
Also used : QueueStoreConfig(com.hazelcast.config.QueueStoreConfig) HazelcastInstance(com.hazelcast.core.HazelcastInstance) Config(com.hazelcast.config.Config) QueueStoreConfig(com.hazelcast.config.QueueStoreConfig) VersionedObject(com.hazelcast.collection.impl.queue.model.VersionedObject) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 24 with QueueStoreConfig

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);
}
Also used : VersionedObject(com.hazelcast.collection.impl.queue.model.VersionedObject) QueueStoreConfig(com.hazelcast.config.QueueStoreConfig) HazelcastInstance(com.hazelcast.core.HazelcastInstance) Config(com.hazelcast.config.Config) QueueStoreConfig(com.hazelcast.config.QueueStoreConfig) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Aggregations

QueueStoreConfig (com.hazelcast.config.QueueStoreConfig)24 Test (org.junit.Test)13 Config (com.hazelcast.config.Config)11 QuickTest (com.hazelcast.test.annotation.QuickTest)9 VersionedObject (com.hazelcast.collection.impl.queue.model.VersionedObject)8 HazelcastInstance (com.hazelcast.core.HazelcastInstance)8 ParallelJVMTest (com.hazelcast.test.annotation.ParallelJVMTest)8 MergePolicyConfig (com.hazelcast.config.MergePolicyConfig)7 QueueConfig (com.hazelcast.config.QueueConfig)6 ItemListenerConfig (com.hazelcast.config.ItemListenerConfig)4 AttributeConfig (com.hazelcast.config.AttributeConfig)2 AwsConfig (com.hazelcast.config.AwsConfig)2 CachePartitionLostListenerConfig (com.hazelcast.config.CachePartitionLostListenerConfig)2 CacheSimpleConfig (com.hazelcast.config.CacheSimpleConfig)2 CacheSimpleEntryListenerConfig (com.hazelcast.config.CacheSimpleEntryListenerConfig)2 CardinalityEstimatorConfig (com.hazelcast.config.CardinalityEstimatorConfig)2 DataPersistenceConfig (com.hazelcast.config.DataPersistenceConfig)2 DiscoveryConfig (com.hazelcast.config.DiscoveryConfig)2 DiscoveryStrategyConfig (com.hazelcast.config.DiscoveryStrategyConfig)2 DiskTierConfig (com.hazelcast.config.DiskTierConfig)2