Exemple #1
0
 @Test
 @Ignore
 public void shouldCreateQueueStore() {
   // Given
   String queueName = "jobEventQueue";
   int numberOfEvents = 5;
   QueueStoreConfig jdbcBackedQueueConfig =
       QueueStoreConfigFactory.getJdbcBackedQueueConfig(dataSource(), queueName);
   // When
   QueueStore storeImplementation = jdbcBackedQueueConfig.getStoreImplementation();
   for (long i = 0; i < numberOfEvents; i++) {
     storeImplementation.store(i, String.valueOf(i));
   }
   MatcherAssert.assertThat(
       storeImplementation.loadAllKeys().size(), CoreMatchers.equalTo(numberOfEvents));
   shouldTruncateQueueStoreTable(queueName);
 }
Exemple #2
0
 @Test
 public void shouldCreateQueue() throws InterruptedException {
   // Given
   int numberOfEvents = 5;
   Config config = new Config();
   QueueStoreConfig jdbcBackedQueueConfig =
       QueueStoreConfigFactory.getJdbcBackedQueueConfig(dataSource(), queueName);
   QueueConfig messageQueue = config.getQueueConfig(queueName);
   messageQueue.setQueueStoreConfig(jdbcBackedQueueConfig);
   HazelcastInstance hazelcastInstance = Hazelcast.newHazelcastInstance(config);
   // When
   QueueStore storeImplementation = jdbcBackedQueueConfig.getStoreImplementation();
   for (long i = 0; i < numberOfEvents; i++) {
     storeImplementation.store(i, String.valueOf(i));
   }
   IQueue<String> iQueue = hazelcastInstance.getQueue(queueName);
   MatcherAssert.assertThat(iQueue.size(), CoreMatchers.equalTo(numberOfEvents));
   String actual = iQueue.take();
   MatcherAssert.assertThat(actual, CoreMatchers.equalTo("0"));
   hazelcastInstance.shutdown();
 }