Package org.apache.activemq.store.kahadb.scheduler

Examples of org.apache.activemq.store.kahadb.scheduler.JobSchedulerStoreImpl$MetaDataMarshaller


    }

    @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();
View Full Code Here


        final int NUMBER = 10;
        ActiveMQConnectionFactory cf = new ActiveMQConnectionFactory("vm://localhost");

        for (int i = 0; i < 3; ++i) {
            JobSchedulerStoreImpl scheduler = new JobSchedulerStoreImpl();
            scheduler.setDirectory(testDir);
            scheduler.setJournalMaxFileLength(1024 * 1024);
            BrokerService broker = createBroker(scheduler);
            broker.start();
            broker.waitUntilStarted();

            final AtomicInteger count = new AtomicInteger();
View Full Code Here

    private static final Logger LOG = LoggerFactory.getLogger(JobSchedulerStoreTest.class);

    @Test(timeout = 120 * 1000)
    public void testRestart() throws Exception {
        JobSchedulerStore store = new JobSchedulerStoreImpl();
        File directory = new File("target/test/ScheduledDB");
        IOHelper.mkdirs(directory);
        IOHelper.deleteChildren(directory);
        store.setDirectory(directory);
        final int NUMBER = 1000;
        store.start();
        List<ByteSequence> list = new ArrayList<ByteSequence>();
        for (int i = 0; i < NUMBER; i++) {
            ByteSequence buff = new ByteSequence(new String("testjob" + i).getBytes());
            list.add(buff);
        }

        JobScheduler js = store.getJobScheduler("test");
        js.startDispatching();
        int count = 0;
        long startTime = 10 * 60 * 1000;
        long period = startTime;
        for (ByteSequence job : list) {
            js.schedule("id:" + (count++), job, "", startTime, period, -1);
        }

        List<Job> test = js.getAllJobs();
        LOG.debug("Found {} jobs in the store before restart", test.size());
        assertEquals(list.size(), test.size());
        store.stop();

        store.start();
        js = store.getJobScheduler("test");
        test = js.getAllJobs();
        LOG.debug("Found {} jobs in the store after restart", test.size());
        assertEquals(list.size(), test.size());

        for (int i = 0; i < list.size(); i++) {
View Full Code Here

    @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());
    }
View Full Code Here

    @Test
    public void testIndexRebuildsAfterSomeJobsExpire() 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);
            scheduleOneShot(connection);
        }
        connection.close();

        JobScheduler scheduler = schedulerStore.getJobScheduler("JMS");
        assertNotNull(scheduler);
        assertEquals(NUM_JOBS * 2, scheduler.getAllJobs().size());

        final JobScheduler awaitingOneShotTimeout = scheduler;
        assertTrue("One shot jobs should time out", Wait.waitFor(new Wait.Condition() {

            @Override
            public boolean isSatisified() throws Exception {
                return awaitingOneShotTimeout.getAllJobs().size() == NUM_JOBS;
            }
        }, TimeUnit.MINUTES.toMillis(2)));

        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());
    }
View Full Code Here

        producer.send(message);
        producer.close();
    }

    protected JobSchedulerStoreImpl createScheduler() {
        JobSchedulerStoreImpl scheduler = new JobSchedulerStoreImpl();
        scheduler.setDirectory(schedulerStoreDir);
        scheduler.setJournalMaxFileLength(10 * 1024);
        return scheduler;
    }
View Full Code Here

        return locker;
    }

    @Override
    public JobSchedulerStore createJobSchedulerStore() throws IOException, UnsupportedOperationException {
        return new JobSchedulerStoreImpl();
    }
View Full Code Here

        }
    }

    @Override
    public JobSchedulerStore createJobSchedulerStore() throws IOException, UnsupportedOperationException {
        return new JobSchedulerStoreImpl();
    }
View Full Code Here

TOP

Related Classes of org.apache.activemq.store.kahadb.scheduler.JobSchedulerStoreImpl$MetaDataMarshaller

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.