Search in sources :

Example 1 with ModeManager

use of org.candlepin.controller.ModeManager in project candlepin by candlepin.

the class PinsetterKernelTest method init.

@Before
public void init() throws SchedulerException {
    sched = mock(Scheduler.class);
    jfactory = mock(JobFactory.class);
    jcurator = mock(JobCurator.class);
    jlistener = mock(JobListener.class);
    sfactory = mock(StdSchedulerFactory.class);
    lm = mock(ListenerManager.class);
    modeManager = mock(ModeManager.class);
    triggerListener = mock(PinsetterTriggerListener.class);
    config = new MapConfiguration(new HashMap<String, String>() {

        {
            put("org.quartz.threadPool.class", "org.quartz.simpl.SimpleThreadPool");
            put("org.quartz.threadPool.threadCount", "25");
            put("org.quartz.threadPool.threadPriority", "5");
            put(ConfigProperties.DEFAULT_TASKS, JobCleaner.class.getName());
            put(ConfigProperties.TASKS, ImportRecordJob.class.getName());
        }
    });
    when(sfactory.getScheduler()).thenReturn(sched);
    when(sched.getListenerManager()).thenReturn(lm);
    when(modeManager.getLastCandlepinModeChange()).thenReturn(new CandlepinModeChange(new Date(System.currentTimeMillis()), CandlepinModeChange.Mode.NORMAL, CandlepinModeChange.Reason.STARTUP));
}
Also used : StdSchedulerFactory(org.quartz.impl.StdSchedulerFactory) HashMap(java.util.HashMap) ImportRecordJob(org.candlepin.pinsetter.tasks.ImportRecordJob) Scheduler(org.quartz.Scheduler) MapConfiguration(org.candlepin.common.config.MapConfiguration) JobListener(org.quartz.JobListener) Date(java.util.Date) JobCurator(org.candlepin.model.JobCurator) JobFactory(org.quartz.spi.JobFactory) JobCleaner(org.candlepin.pinsetter.tasks.JobCleaner) CandlepinModeChange(org.candlepin.model.CandlepinModeChange) ListenerManager(org.quartz.ListenerManager) ModeManager(org.candlepin.controller.ModeManager) Before(org.junit.Before)

Aggregations

Date (java.util.Date)1 HashMap (java.util.HashMap)1 MapConfiguration (org.candlepin.common.config.MapConfiguration)1 ModeManager (org.candlepin.controller.ModeManager)1 CandlepinModeChange (org.candlepin.model.CandlepinModeChange)1 JobCurator (org.candlepin.model.JobCurator)1 ImportRecordJob (org.candlepin.pinsetter.tasks.ImportRecordJob)1 JobCleaner (org.candlepin.pinsetter.tasks.JobCleaner)1 Before (org.junit.Before)1 JobListener (org.quartz.JobListener)1 ListenerManager (org.quartz.ListenerManager)1 Scheduler (org.quartz.Scheduler)1 StdSchedulerFactory (org.quartz.impl.StdSchedulerFactory)1 JobFactory (org.quartz.spi.JobFactory)1