Search in sources :

Example 6 with CandlepinModeChange

use of org.candlepin.model.CandlepinModeChange 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

CandlepinModeChange (org.candlepin.model.CandlepinModeChange)6 Date (java.util.Date)4 Before (org.junit.Before)3 ApiOperation (io.swagger.annotations.ApiOperation)1 HashMap (java.util.HashMap)1 GET (javax.ws.rs.GET)1 Produces (javax.ws.rs.Produces)1 QpidStatus (org.candlepin.audit.QpidQmf.QpidStatus)1 StatusCache (org.candlepin.cache.StatusCache)1 SecurityHole (org.candlepin.common.auth.SecurityHole)1 MapConfiguration (org.candlepin.common.config.MapConfiguration)1 CandlepinCommonTestConfig (org.candlepin.config.CandlepinCommonTestConfig)1 ModeManager (org.candlepin.controller.ModeManager)1 Mode (org.candlepin.model.CandlepinModeChange.Mode)1 CandlepinQuery (org.candlepin.model.CandlepinQuery)1 JobCurator (org.candlepin.model.JobCurator)1 Rules (org.candlepin.model.Rules)1 Status (org.candlepin.model.Status)1 ImportRecordJob (org.candlepin.pinsetter.tasks.ImportRecordJob)1 JobCleaner (org.candlepin.pinsetter.tasks.JobCleaner)1