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);
}
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();
}
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);
}
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);
}
}
Aggregations