Search in sources :

Example 6 with JobSchedulerStoreImpl

use of org.apache.activemq.store.kahadb.scheduler.JobSchedulerStoreImpl in project activemq-artemis by apache.

the class KahaDBSchedulerIndexRebuildTest method createScheduler.

protected JobSchedulerStoreImpl createScheduler() {
    JobSchedulerStoreImpl scheduler = new JobSchedulerStoreImpl();
    scheduler.setDirectory(schedulerStoreDir);
    scheduler.setJournalMaxFileLength(10 * 1024);
    return scheduler;
}
Also used : JobSchedulerStoreImpl(org.apache.activemq.store.kahadb.scheduler.JobSchedulerStoreImpl)

Example 7 with JobSchedulerStoreImpl

use of org.apache.activemq.store.kahadb.scheduler.JobSchedulerStoreImpl in project activemq-artemis by apache.

the class KahaDBSchedulerIndexRebuildTest method testIndexRebuilds.

@Test
public void testIndexRebuilds() throws Exception {
    IOHelper.deleteFile(schedulerStoreDir);
    JobSchedulerStoreImpl schedulerStore = createScheduler();
    broker = createBroker(schedulerStore);
    broker.start();
    ActiveMQConnectionFactory cf = new ActiveMQConnectionFactory("vm://localhost");
    Connection connection = cf.createConnection();
    connection.start();
    for (int i = 0; i < NUM_JOBS; ++i) {
        scheduleRepeating(connection);
    }
    connection.close();
    JobScheduler scheduler = schedulerStore.getJobScheduler("JMS");
    assertNotNull(scheduler);
    assertEquals(NUM_JOBS, scheduler.getAllJobs().size());
    broker.stop();
    IOHelper.delete(new File(schedulerStoreDir, "scheduleDB.data"));
    schedulerStore = createScheduler();
    broker = createBroker(schedulerStore);
    broker.start();
    scheduler = schedulerStore.getJobScheduler("JMS");
    assertNotNull(scheduler);
    assertEquals(NUM_JOBS, scheduler.getAllJobs().size());
}
Also used : ActiveMQConnectionFactory(org.apache.activemq.ActiveMQConnectionFactory) Connection(javax.jms.Connection) JobSchedulerStoreImpl(org.apache.activemq.store.kahadb.scheduler.JobSchedulerStoreImpl) File(java.io.File) Test(org.junit.Test)

Example 8 with JobSchedulerStoreImpl

use of org.apache.activemq.store.kahadb.scheduler.JobSchedulerStoreImpl in project activemq-artemis by apache.

the class SchedulerDBVersionTest method testCreateStore.

@Ignore("Used only when a new version of the store needs to archive it's test data.")
@Test
public void testCreateStore() throws Exception {
    JobSchedulerStoreImpl scheduler = new JobSchedulerStoreImpl();
    File dir = new File("src/test/resources/org/apache/activemq/store/schedulerDB/legacy");
    IOHelper.deleteFile(dir);
    scheduler.setDirectory(dir);
    scheduler.setJournalMaxFileLength(1024 * 1024);
    broker = createBroker(scheduler);
    broker.start();
    ActiveMQConnectionFactory cf = new ActiveMQConnectionFactory("vm://localhost");
    Connection connection = cf.createConnection();
    connection.start();
    scheduleRepeating(connection);
    connection.close();
    broker.stop();
}
Also used : ActiveMQConnectionFactory(org.apache.activemq.ActiveMQConnectionFactory) Connection(javax.jms.Connection) JobSchedulerStoreImpl(org.apache.activemq.store.kahadb.scheduler.JobSchedulerStoreImpl) File(java.io.File) Ignore(org.junit.Ignore) Test(org.junit.Test)

Aggregations

JobSchedulerStoreImpl (org.apache.activemq.store.kahadb.scheduler.JobSchedulerStoreImpl)8 File (java.io.File)5 Connection (javax.jms.Connection)4 ActiveMQConnectionFactory (org.apache.activemq.ActiveMQConnectionFactory)4 Test (org.junit.Test)4 ArrayList (java.util.ArrayList)1 CountDownLatch (java.util.concurrent.CountDownLatch)1 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1 Message (javax.jms.Message)1 MessageConsumer (javax.jms.MessageConsumer)1 MessageListener (javax.jms.MessageListener)1 Queue (javax.jms.Queue)1 Session (javax.jms.Session)1 TextMessage (javax.jms.TextMessage)1 ScheduledMessage (org.apache.activemq.ScheduledMessage)1 BrokerService (org.apache.activemq.broker.BrokerService)1 ByteSequence (org.apache.activemq.util.ByteSequence)1 Ignore (org.junit.Ignore)1