@Test public void testScheduledAnnotation() throws Exception { ScriptManager sm = new ScriptManager(); sm.setGlobalClassListener(new ScheduledTaskClassListenerTestAdapter(cronService)); sm.loadDirectory(new File(FILE_TEST_DATA_DIR)); assertEquals(cronService.getRunnables().size(), 1); sm.shutdown(); assertEquals(cronService.getRunnables().size(), 0); }
@Test public void testOnClassLoadAndUnload() throws Exception { ScriptManager sm = new ScriptManager(); sm.setGlobalClassListener(new OnClassLoadUnloadListener()); sm.loadDirectory(new File(FILE_TEST_DATA_DIR)); assertEquals(System.getProperties().containsKey(SYSTEM_PROPERTY_KEY_CLASS_LOADED), true); sm.shutdown(); assertEquals(System.getProperties().containsKey(SYSTEM_PROPERTY_KEY_CLASS_UNLOADED), true); }