/** * SPR-6038: detect HSQL and stop illegal locks being taken. * TODO: Against Quartz 2.2, this test's job doesn't actually execute anymore... */ @Test public void schedulerWithHsqlDataSource() throws Exception { // Assume.group(TestGroup.PERFORMANCE); DummyJob.param = 0; DummyJob.count = 0; ClassPathXmlApplicationContext ctx = context("databasePersistence.xml"); JdbcTemplate jdbcTemplate = new JdbcTemplate(ctx.getBean(DataSource.class)); assertFalse("No triggers were persisted", jdbcTemplate.queryForList("SELECT * FROM qrtz_triggers").isEmpty()); /* Thread.sleep(3000); try { assertTrue("DummyJob should have been executed at least once.", DummyJob.count > 0); } finally { ctx.close(); } */ }
@Test public void schedulerRepositoryExposure() throws Exception { ClassPathXmlApplicationContext ctx = context("schedulerRepositoryExposure.xml"); assertSame(SchedulerRepository.getInstance().lookup("myScheduler"), ctx.getBean("scheduler")); ctx.close(); }
@Test // SPR-16884 public void multipleSchedulersWithQuartzProperties() throws Exception { ClassPathXmlApplicationContext ctx = context("multipleSchedulersWithQuartzProperties.xml"); try { Scheduler scheduler1 = (Scheduler) ctx.getBean("scheduler1"); Scheduler scheduler2 = (Scheduler) ctx.getBean("scheduler2"); assertNotSame(scheduler1, scheduler2); assertEquals("quartz1", scheduler1.getSchedulerName()); assertEquals("quartz2", scheduler2.getSchedulerName()); } finally { ctx.close(); } }
@Test // SPR-772 public void multipleSchedulers() throws Exception { ClassPathXmlApplicationContext ctx = context("multipleSchedulers.xml"); try { Scheduler scheduler1 = (Scheduler) ctx.getBean("scheduler1"); Scheduler scheduler2 = (Scheduler) ctx.getBean("scheduler2"); assertNotSame(scheduler1, scheduler2); assertEquals("quartz1", scheduler1.getSchedulerName()); assertEquals("quartz2", scheduler2.getSchedulerName()); } finally { ctx.close(); } }
@Test public void twoAnonymousMethodInvokingJobDetailFactoryBeans() throws Exception { Assume.group(TestGroup.PERFORMANCE); ClassPathXmlApplicationContext ctx = context("multipleAnonymousMethodInvokingJobDetailFB.xml"); Thread.sleep(3000); try { QuartzTestBean exportService = (QuartzTestBean) ctx.getBean("exportService"); QuartzTestBean importService = (QuartzTestBean) ctx.getBean("importService"); assertEquals("doImport called exportService", 0, exportService.getImportCount()); assertEquals("doExport not called on exportService", 2, exportService.getExportCount()); assertEquals("doImport not called on importService", 2, importService.getImportCount()); assertEquals("doExport called on importService", 0, importService.getExportCount()); } finally { ctx.close(); } }
@Test public void schedulerAccessorBean() throws Exception { Assume.group(TestGroup.PERFORMANCE); ClassPathXmlApplicationContext ctx = context("schedulerAccessorBean.xml"); Thread.sleep(3000); try { QuartzTestBean exportService = (QuartzTestBean) ctx.getBean("exportService"); QuartzTestBean importService = (QuartzTestBean) ctx.getBean("importService"); assertEquals("doImport called exportService", 0, exportService.getImportCount()); assertEquals("doExport not called on exportService", 2, exportService.getExportCount()); assertEquals("doImport not called on importService", 2, importService.getImportCount()); assertEquals("doExport called on importService", 0, importService.getExportCount()); } finally { ctx.close(); } }