Search in sources :

Example 16 with QueueConfig

use of com.hazelcast.config.QueueConfig in project hazelcast by hazelcast.

the class QueueStoreTest method testQueueStoreFactory.

@Test
public void testQueueStoreFactory() {
    String queueName = randomString();
    Config config = new Config();
    QueueConfig queueConfig = config.getQueueConfig(queueName);
    QueueStoreConfig queueStoreConfig = new QueueStoreConfig();
    queueStoreConfig.setEnabled(true);
    QueueStoreFactory queueStoreFactory = new SimpleQueueStoreFactory();
    queueStoreConfig.setFactoryImplementation(queueStoreFactory);
    queueConfig.setQueueStoreConfig(queueStoreConfig);
    HazelcastInstance instance = createHazelcastInstance(config);
    IQueue<Integer> queue = instance.getQueue(queueName);
    queue.add(1);
    QueueStore queueStore = queueStoreFactory.newQueueStore(queueName, null);
    TestQueueStore testQueueStore = (TestQueueStore) queueStore;
    int size = testQueueStore.store.size();
    assertEquals("Queue store size should be 1 but found " + size, 1, size);
}
Also used : AtomicInteger(java.util.concurrent.atomic.AtomicInteger) QueueStoreConfig(com.hazelcast.config.QueueStoreConfig) QueueConfig(com.hazelcast.config.QueueConfig) HazelcastInstance(com.hazelcast.core.HazelcastInstance) QueueStoreFactory(com.hazelcast.core.QueueStoreFactory) QueueStore(com.hazelcast.core.QueueStore) QueueConfig(com.hazelcast.config.QueueConfig) Config(com.hazelcast.config.Config) QueueStoreConfig(com.hazelcast.config.QueueStoreConfig) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 17 with QueueConfig

use of com.hazelcast.config.QueueConfig in project hazelcast by hazelcast.

the class ClientQueueTest method setup.

@Before
public void setup() {
    Config config = new Config();
    QueueConfig queueConfig = config.getQueueConfig(QUEUE_WITH_MAX_SIZE);
    queueConfig.setMaxSize(MAX_SIZE_FOR_QUEUE);
    hazelcastFactory.newHazelcastInstance(config);
    client = hazelcastFactory.newHazelcastClient();
}
Also used : QueueConfig(com.hazelcast.config.QueueConfig) QueueConfig(com.hazelcast.config.QueueConfig) Config(com.hazelcast.config.Config) Before(org.junit.Before)

Example 18 with QueueConfig

use of com.hazelcast.config.QueueConfig in project hazelcast by hazelcast.

the class QueueContainer method setConfig.

public void setConfig(QueueConfig config, NodeEngine nodeEngine, QueueService service) {
    this.nodeEngine = nodeEngine;
    this.service = service;
    this.logger = nodeEngine.getLogger(QueueContainer.class);
    this.config = new QueueConfig(config);
    // init queue store.
    final QueueStoreConfig storeConfig = config.getQueueStoreConfig();
    final SerializationService serializationService = nodeEngine.getSerializationService();
    ClassLoader classLoader = nodeEngine.getConfigClassLoader();
    this.store = QueueStoreWrapper.create(name, storeConfig, serializationService, classLoader);
}
Also used : QueueStoreConfig(com.hazelcast.config.QueueStoreConfig) QueueConfig(com.hazelcast.config.QueueConfig) SerializationService(com.hazelcast.spi.serialization.SerializationService)

Example 19 with QueueConfig

use of com.hazelcast.config.QueueConfig in project spring-boot by spring-projects.

the class HazelcastAutoConfigurationTests method systemProperty.

@Test
public void systemProperty() throws IOException {
    System.setProperty(HazelcastConfigResourceCondition.CONFIG_SYSTEM_PROPERTY, "classpath:org/springframework/boot/autoconfigure/hazelcast/hazelcast-specific.xml");
    try {
        load();
        HazelcastInstance hazelcastInstance = this.context.getBean(HazelcastInstance.class);
        Map<String, QueueConfig> queueConfigs = hazelcastInstance.getConfig().getQueueConfigs();
        assertThat(queueConfigs).hasSize(1).containsKey("foobar");
    } finally {
        System.clearProperty(HazelcastConfigResourceCondition.CONFIG_SYSTEM_PROPERTY);
    }
}
Also used : HazelcastInstance(com.hazelcast.core.HazelcastInstance) QueueConfig(com.hazelcast.config.QueueConfig) Test(org.junit.Test)

Aggregations

QueueConfig (com.hazelcast.config.QueueConfig)19 Config (com.hazelcast.config.Config)14 HazelcastInstance (com.hazelcast.core.HazelcastInstance)11 Test (org.junit.Test)11 QueueStoreConfig (com.hazelcast.config.QueueStoreConfig)10 QuickTest (com.hazelcast.test.annotation.QuickTest)9 TestHazelcastInstanceFactory (com.hazelcast.test.TestHazelcastInstanceFactory)3 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)3 Before (org.junit.Before)3 ItemListenerConfig (com.hazelcast.config.ItemListenerConfig)2 QuorumConfig (com.hazelcast.config.QuorumConfig)2 QueueStore (com.hazelcast.core.QueueStore)2 QueueStoreFactory (com.hazelcast.core.QueueStoreFactory)2 QueueContainer (com.hazelcast.collection.impl.queue.QueueContainer)1 QueueService (com.hazelcast.collection.impl.queue.QueueService)1 CacheSimpleConfig (com.hazelcast.config.CacheSimpleConfig)1 LockConfig (com.hazelcast.config.LockConfig)1 MapConfig (com.hazelcast.config.MapConfig)1 PartitionedCluster (com.hazelcast.quorum.PartitionedCluster)1 NodeEngine (com.hazelcast.spi.NodeEngine)1