Index: lams_common/src/java/org/lamsfoundation/lams/beanRefContext.xml =================================================================== RCS file: /usr/local/cvsroot/lams_common/src/java/org/lamsfoundation/lams/beanRefContext.xml,v diff -u -r1.1.2.1 -r1.1.2.2 --- lams_common/src/java/org/lamsfoundation/lams/beanRefContext.xml 17 Mar 2009 20:57:44 -0000 1.1.2.1 +++ lams_common/src/java/org/lamsfoundation/lams/beanRefContext.xml 19 Mar 2009 01:56:14 -0000 1.1.2.2 @@ -1,7 +1,7 @@ - @@ -11,14 +11,6 @@ /org/lamsfoundation/lams/lesson/lessonApplicationContext.xml /org/lamsfoundation/lams/learning/learningApplicationContext.xml classpath*:org/lamsfoundation/lams/tool/**/*pplicationContext.xml - - - - - - - /org/lamsfoundation/lams/authoring/authoringApplicationContext.xml /org/lamsfoundation/lams/monitoring/monitoringApplicationContext.xml /org/lamsfoundation/lams/workspace/workspaceApplicationContext.xml @@ -27,8 +19,5 @@ /org/lamsfoundation/lams/usermanagement/ldapContext.xml - - - \ No newline at end of file Index: lams_common/src/java/org/lamsfoundation/lams/commonContext.xml =================================================================== RCS file: /usr/local/cvsroot/lams_common/src/java/org/lamsfoundation/lams/commonContext.xml,v diff -u -r1.73.2.1 -r1.73.2.2 --- lams_common/src/java/org/lamsfoundation/lams/commonContext.xml 17 Mar 2009 20:57:45 -0000 1.73.2.1 +++ lams_common/src/java/org/lamsfoundation/lams/commonContext.xml 19 Mar 2009 01:56:14 -0000 1.73.2.2 @@ -212,7 +212,7 @@ - + @@ -228,11 +228,11 @@ - + - + @@ -264,8 +264,8 @@ - - + + org.springframework.scheduling.quartz.LocalDataSourceJobStore @@ -277,14 +277,14 @@ - - + + - + @@ -302,13 +302,13 @@ - + - + Index: lams_common/src/java/org/lamsfoundation/lams/toolApplicationContext.xml =================================================================== RCS file: /usr/local/cvsroot/lams_common/src/java/org/lamsfoundation/lams/toolApplicationContext.xml,v diff -u -r1.6.2.1 -r1.6.2.2 --- lams_common/src/java/org/lamsfoundation/lams/toolApplicationContext.xml 17 Mar 2009 20:57:44 -0000 1.6.2.1 +++ lams_common/src/java/org/lamsfoundation/lams/toolApplicationContext.xml 19 Mar 2009 01:56:14 -0000 1.6.2.2 @@ -39,9 +39,7 @@ - + Index: lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/monitoringApplicationContext.xml =================================================================== RCS file: /usr/local/cvsroot/lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/monitoringApplicationContext.xml,v diff -u -r1.29.4.1 -r1.29.4.2 --- lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/monitoringApplicationContext.xml 17 Mar 2009 20:57:33 -0000 1.29.4.1 +++ lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/monitoringApplicationContext.xml 19 Mar 2009 01:54:57 -0000 1.29.4.2 @@ -27,10 +27,8 @@ - Lams monitoring primary business object (default implementation), as an inner bean wrapped - by an outer transactional proxy. The two bean definitions could have been separate, - but this is cleaner as there is no need to ever access the unwrapped object. - --> - + --> + @@ -99,16 +97,4 @@ - - - - - org.springframework.scheduling.quartz.LocalDataSourceJobStore - org.quartz.impl.jdbcjobstore.StdJDBCDelegate - lams_qtz_ - - - - - - + \ No newline at end of file Index: lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/quartz/job/MonitoringJob.java =================================================================== RCS file: /usr/local/cvsroot/lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/quartz/job/MonitoringJob.java,v diff -u -r1.4 -r1.4.10.1 --- lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/quartz/job/MonitoringJob.java 17 Sep 2006 06:19:29 -0000 1.4 +++ lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/quartz/job/MonitoringJob.java 19 Mar 2009 01:54:57 -0000 1.4.10.1 @@ -31,25 +31,25 @@ import org.quartz.SchedulerException; import org.springframework.context.ApplicationContext; import org.springframework.scheduling.quartz.QuartzJobBean; + /** - * All Quartz Job Bean super classes in monitoring. It provides a simple helper method to - * get monitoringService. + * All Quartz Job Bean super classes in monitoring. It provides a simple helper method to get monitoringService. * * @author Steve.Ni * * @version $Revision$ */ -public abstract class MonitoringJob extends QuartzJobBean{ - private static final String CONTEXT_NAME = "monitoringApplicationContext"; - private static final String SERVICE_NAME = "monitoringService"; - - protected IMonitoringService getMonitoringService(JobExecutionContext context) throws JobExecutionException{ - try { - SchedulerContext sc = context.getScheduler().getContext(); - ApplicationContext cxt = (ApplicationContext) sc.get(CONTEXT_NAME); - return (IMonitoringService) cxt.getBean(SERVICE_NAME); - } catch (SchedulerException e) { - throw new JobExecutionException("Failed look up the Scheduler" + e.toString()); - } +public abstract class MonitoringJob extends QuartzJobBean { + private static final String CONTEXT_NAME = "context.central"; + private static final String SERVICE_NAME = "monitoringService"; + + protected IMonitoringService getMonitoringService(JobExecutionContext context) throws JobExecutionException { + try { + SchedulerContext sc = context.getScheduler().getContext(); + ApplicationContext cxt = (ApplicationContext) sc.get(MonitoringJob.CONTEXT_NAME); + return (IMonitoringService) cxt.getBean(MonitoringJob.SERVICE_NAME); + } catch (SchedulerException e) { + throw new JobExecutionException("Failed look up the Scheduler" + e.toString()); } + } } Index: lams_monitoring/test/java/org/lamsfoundation/lams/monitoring/service/TestMonitoringService.java =================================================================== RCS file: /usr/local/cvsroot/lams_monitoring/test/java/org/lamsfoundation/lams/monitoring/service/Attic/TestMonitoringService.java,v diff -u -r1.47 -r1.47.4.1 --- lams_monitoring/test/java/org/lamsfoundation/lams/monitoring/service/TestMonitoringService.java 13 Nov 2008 05:18:18 -0000 1.47 +++ lams_monitoring/test/java/org/lamsfoundation/lams/monitoring/service/TestMonitoringService.java 19 Mar 2009 01:54:57 -0000 1.47.4.1 @@ -51,24 +51,22 @@ import org.lamsfoundation.lams.util.ConfigurationKeys; import org.springframework.jdbc.core.JdbcTemplate; - /** * * @author Jacky Fang 9/02/2005 * @author Manpreet Minhas */ -public class TestMonitoringService extends AbstractLamsTestCase -{ - //--------------------------------------------------------------------- +public class TestMonitoringService extends AbstractLamsTestCase { + // --------------------------------------------------------------------- // Dependent services - //--------------------------------------------------------------------- + // --------------------------------------------------------------------- private IMonitoringService monitoringService; private IUserManagementService usermanageService; - private ILessonDAO lessonDao; + private ILessonDAO lessonDao; private IActivityDAO activityDao; - //--------------------------------------------------------------------- + // --------------------------------------------------------------------- // Testing Data - Constants - //--------------------------------------------------------------------- + // --------------------------------------------------------------------- private final Integer TEST_USER_ID = new Integer(1); private final Integer TEST_LEARNER_ID = new Integer(2); private final Integer TEST_STAFF_ID = new Integer(3); @@ -81,15 +79,15 @@ private final long TEST_COPIED_LEARNING_DESIGN_ID = 3; private final Integer TEST_ORGANIZATION_ID = new Integer(1); private final Long TEST_SCHEDULE_GATE_ID = new Long(27); - private final Long TEST_LESSION_ID = new Long(1); // "Test_Lesson" from insert_test_data script - private final Integer MELCOE_WORKSPACE = new Integer(3); // MELCOE workspace from insert_test_data script + private final Long TEST_LESSION_ID = new Long(1); // "Test_Lesson" from insert_test_data script + private final Integer MELCOE_WORKSPACE = new Integer(3); // MELCOE workspace from insert_test_data script - //it might be different because it is automatically generated by database - //TODO create a get lesson by design method in lesson dao. + // it might be different because it is automatically generated by database + // TODO create a get lesson by design method in lesson dao. private static Long TEST_LESSON_ID = null; - //--------------------------------------------------------------------- + // --------------------------------------------------------------------- // Testing Data - Instance Variables - //--------------------------------------------------------------------- + // --------------------------------------------------------------------- private User testUser; private User testStaff; private User testLearner; @@ -100,304 +98,295 @@ /* * @see AbstractLamsCommonTestCase#setUp() */ - protected void setUp() throws Exception - { - super.setUp(); - monitoringService = (IMonitoringService)this.context.getBean("monitoringService"); - usermanageService = (IUserManagementService)this.context.getBean("userManagementService"); - lessonDao = (LessonDAO)this.context.getBean("lessonDAO"); - activityDao = (ActivityDAO)this.context.getBean("activityDAO"); - dataSource = (DataSource) this.context.getBean("dataSource"); - - initializeTestingData(); + @Override + protected void setUp() throws Exception { + super.setUp(); + monitoringService = (IMonitoringService) context.getBean("monitoringService"); + usermanageService = (IUserManagementService) context.getBean("userManagementService"); + lessonDao = (LessonDAO) context.getBean("lessonDAO"); + activityDao = (ActivityDAO) context.getBean("activityDAO"); + dataSource = (DataSource) context.getBean("dataSource"); + + initializeTestingData(); } + /** * @see AbstractLamsCommonTestCase#tearDown() */ - protected void tearDown() throws Exception - { - super.tearDown(); - context = null; // try to trigger some memory to get freed - running out of memory. + @Override + protected void tearDown() throws Exception { + super.tearDown(); + context = null; // try to trigger some memory to get freed - running out of memory. } /** * Constructor for TestMonitoringService. + * * @param name */ - public TestMonitoringService(String name) - { - super(name); + public TestMonitoringService(String name) { + super(name); } - + /** * @see org.lamsfoundation.lams.AbstractLamsTestCase#getContextConfigLocation() */ - protected String[] getContextConfigLocation() - { - return new String[] { - "/org/lamsfoundation/lams/localApplicationContext.xml", - "/org/lamsfoundation/lams/lesson/lessonApplicationContext.xml", - "/org/lamsfoundation/lams/toolApplicationContext.xml", - "/org/lamsfoundation/lams/learning/learningApplicationContext.xml", - "/org/lamsfoundation/lams/authoring/authoringApplicationContext.xml", - "/org/lamsfoundation/lams/monitoring/monitoringApplicationContext.xml", - "/org/lamsfoundation/lams/tool/survey/applicationContext.xml"}; + @Override + protected String[] getContextConfigLocation() { + return new String[] { "/org/lamsfoundation/lams/localApplicationContext.xml", + "/org/lamsfoundation/lams/lesson/lessonApplicationContext.xml", + "/org/lamsfoundation/lams/toolApplicationContext.xml", + "/org/lamsfoundation/lams/learning/learningApplicationContext.xml", + "/org/lamsfoundation/lams/authoring/authoringApplicationContext.xml", + "/org/lamsfoundation/lams/monitoring/monitoringApplicationContext.xml", + "/org/lamsfoundation/lams/tool/survey/applicationContext.xml" }; } + /** * @see org.lamsfoundation.lams.AbstractLamsTestCase#getHibernateSessionFactoryName() */ - protected String getHibernateSessionFactoryName() - { - return "coreSessionFactory"; + @Override + protected String getHibernateSessionFactoryName() { + return "coreSessionFactory"; } - public void testInitializeLesson() - { - - String lamsLearningDesignTableName = "lams_learning_design"; - String idName = "learning_design_id"; - long previousLDId = getMaxId(lamsLearningDesignTableName, idName); - Lesson testLesson = monitoringService.initializeLesson("Test_Lesson", - "Test_Description", - Boolean.TRUE, - TEST_LEARNING_DESIGN_ID, - null, - testUser.getUserId(), - null, - false, - false, - false); - TEST_LESSON_ID=testLesson.getLessonId(); - Lesson createdLesson = lessonDao.getLesson(TEST_LESSON_ID); - assertNotNull(createdLesson); - - // can't reliably predict the id of the copied learning design - depends on what - // has happened before the test and what might be running at the same time. - // so compare it to the last id created in this table. This will usually be the - // right value as it it looked up using getLastInsertId() and that works - // on per connection basis - it is unlikely that this test case will be sharing - // the connection with anything else that will update this table. This may - // change in the future if more test cases are added. - long mostRecentLDId = getMaxId(lamsLearningDesignTableName, idName); - long copiedLDId = testLesson.getLearningDesign().getLearningDesignId().longValue(); - assertTrue("A learning design has been created (previous insert #previousLDId, recent insert #mostRecentLDId", - previousLDId!=mostRecentLDId); - assertTrue("Copied learning design is the new id", copiedLDId == mostRecentLDId); - - assertEquals("verify the user", TEST_USER_ID,createdLesson.getUser().getUserId()); - assertEquals("verify the lesson state",Lesson.CREATED,createdLesson.getLessonStateId()); - } + public void testInitializeLesson() { - public void testCreateLessonClassForLesson() - { - LinkedList learners = new LinkedList(); - learners.add(testLearner); - LinkedList staffs = new LinkedList(); - staffs.add(testStaff); - - Lesson testLesson = monitoringService.createLessonClassForLesson(TEST_LESSON_ID.longValue(), - testOrganisation, - "leaner group", - learners, - "staff group", - staffs, - TEST_STAFF_ID); - Lesson createdLesson = lessonDao.getLesson(TEST_LESSON_ID); - - assertEquals("verify the staff group",staffs.size(),createdLesson.getLessonClass().getStaffGroup().getUsers().size()); - assertNotNull("verify lesson has organisation",createdLesson.getOrganisation()); - assertEquals("verify the organization",TEST_ORGANIZATION_ID,createdLesson.getOrganisation().getOrganisationId()); - assertEquals("verify number of the learners",1,createdLesson.getAllLearners().size()); - assertEquals("verify the lesson class",Grouping.CLASS_GROUPING_TYPE,createdLesson.getLessonClass().getGroupingTypeId()); - assertEquals("verify the learner group",1,createdLesson.getLessonClass().getGroups().size()); + String lamsLearningDesignTableName = "lams_learning_design"; + String idName = "learning_design_id"; + long previousLDId = getMaxId(lamsLearningDesignTableName, idName); - + Lesson testLesson = monitoringService.initializeLesson("Test_Lesson", "Test_Description", Boolean.TRUE, + TEST_LEARNING_DESIGN_ID, null, testUser.getUserId(), null, false, false, false); + TestMonitoringService.TEST_LESSON_ID = testLesson.getLessonId(); + Lesson createdLesson = lessonDao.getLesson(TestMonitoringService.TEST_LESSON_ID); + assertNotNull(createdLesson); + + // can't reliably predict the id of the copied learning design - depends on what + // has happened before the test and what might be running at the same time. + // so compare it to the last id created in this table. This will usually be the + // right value as it it looked up using getLastInsertId() and that works + // on per connection basis - it is unlikely that this test case will be sharing + // the connection with anything else that will update this table. This may + // change in the future if more test cases are added. + long mostRecentLDId = getMaxId(lamsLearningDesignTableName, idName); + long copiedLDId = testLesson.getLearningDesign().getLearningDesignId().longValue(); + assertTrue("A learning design has been created (previous insert #previousLDId, recent insert #mostRecentLDId", + previousLDId != mostRecentLDId); + assertTrue("Copied learning design is the new id", copiedLDId == mostRecentLDId); + + assertEquals("verify the user", TEST_USER_ID, createdLesson.getUser().getUserId()); + assertEquals("verify the lesson state", Lesson.CREATED, createdLesson.getLessonStateId()); } - - public void testStartlesson() throws LamsToolServiceException - { - monitoringService.startLesson(TEST_LESSON_ID.longValue(),TEST_STAFF_ID); - assertTrue(true); - - Lesson startedLesson = lessonDao.getLesson(TEST_LESSON_ID); - - assertNotNull(startedLesson); - assertEquals("verify the lesson status",Lesson.STARTED_STATE,startedLesson.getLessonStateId()); - - + + public void testCreateLessonClassForLesson() { + LinkedList learners = new LinkedList(); + learners.add(testLearner); + LinkedList staffs = new LinkedList(); + staffs.add(testStaff); + + Lesson testLesson = monitoringService.createLessonClassForLesson(TestMonitoringService.TEST_LESSON_ID + .longValue(), testOrganisation, "leaner group", learners, "staff group", staffs, TEST_STAFF_ID); + Lesson createdLesson = lessonDao.getLesson(TestMonitoringService.TEST_LESSON_ID); + + assertEquals("verify the staff group", staffs.size(), createdLesson.getLessonClass().getStaffGroup().getUsers() + .size()); + assertNotNull("verify lesson has organisation", createdLesson.getOrganisation()); + assertEquals("verify the organization", TEST_ORGANIZATION_ID, createdLesson.getOrganisation() + .getOrganisationId()); + assertEquals("verify number of the learners", 1, createdLesson.getAllLearners().size()); + assertEquals("verify the lesson class", Grouping.CLASS_GROUPING_TYPE, createdLesson.getLessonClass() + .getGroupingTypeId()); + assertEquals("verify the learner group", 1, createdLesson.getLessonClass().getGroups().size()); + } - public void testOpenGate() - { - monitoringService.openGate(TEST_SCHEDULE_GATE_ID); - Activity openedScheduleGate = activityDao.getActivityByActivityId(TEST_SCHEDULE_GATE_ID); - assertTrue("the gate should be opened",((GateActivity)openedScheduleGate).getGateOpen().booleanValue()); + public void testStartlesson() throws LamsToolServiceException { + monitoringService.startLesson(TestMonitoringService.TEST_LESSON_ID.longValue(), TEST_STAFF_ID); + assertTrue(true); + + Lesson startedLesson = lessonDao.getLesson(TestMonitoringService.TEST_LESSON_ID); + + assertNotNull(startedLesson); + assertEquals("verify the lesson status", Lesson.STARTED_STATE, startedLesson.getLessonStateId()); + } - public void testCloseGate() - { - monitoringService.closeGate(TEST_SCHEDULE_GATE_ID); - Activity closedScheduleGate = activityDao.getActivityByActivityId(TEST_SCHEDULE_GATE_ID); - assertTrue("the gate should be closed",!((GateActivity)closedScheduleGate).getGateOpen().booleanValue()); + public void testOpenGate() { + monitoringService.openGate(TEST_SCHEDULE_GATE_ID); + Activity openedScheduleGate = activityDao.getActivityByActivityId(TEST_SCHEDULE_GATE_ID); + assertTrue("the gate should be opened", ((GateActivity) openedScheduleGate).getGateOpen().booleanValue()); } - public void testForceCompleteLessonByUser() - { + public void testCloseGate() { + monitoringService.closeGate(TEST_SCHEDULE_GATE_ID); + Activity closedScheduleGate = activityDao.getActivityByActivityId(TEST_SCHEDULE_GATE_ID); + assertTrue("the gate should be closed", !((GateActivity) closedScheduleGate).getGateOpen().booleanValue()); } - - public void testGetLessonDetails() throws IOException{ - String packet = monitoringService.getLessonDetails(TEST_LESSION_ID,TEST_STAFF_ID); - System.out.print(packet); + + public void testForceCompleteLessonByUser() { } - public void testGetLessonLearners() throws IOException{ - String packet = monitoringService.getLessonLearners(TEST_LESSION_ID,TEST_STAFF_ID); - System.out.println(packet); + + public void testGetLessonDetails() throws IOException { + String packet = monitoringService.getLessonDetails(TEST_LESSION_ID, TEST_STAFF_ID); + System.out.print(packet); } - public void testGetLessonDesign()throws IOException{ - String packet = monitoringService.getLearningDesignDetails(TEST_LESSION_ID); - System.out.println(packet); + + public void testGetLessonLearners() throws IOException { + String packet = monitoringService.getLessonLearners(TEST_LESSION_ID, TEST_STAFF_ID); + System.out.println(packet); } - public void testGetAllLearnersProgress() throws IOException{ - String packet = monitoringService.getAllLearnersProgress(TEST_LESSION_ID,TEST_STAFF_ID); - System.out.println(packet); + + public void testGetLessonDesign() throws IOException { + String packet = monitoringService.getLearningDesignDetails(TEST_LESSION_ID); + System.out.println(packet); } - public void testGetLearnerActivityURL() throws Exception{ - String url = monitoringService.getLearnerActivityURL(TEST_LESSION_ID, new Long(29),TEST_LEARNER_ID,TEST_STAFF_ID); - System.out.println(url); + + public void testGetAllLearnersProgress() throws IOException { + String packet = monitoringService.getAllLearnersProgress(TEST_LESSION_ID, TEST_STAFF_ID, false); + System.out.println(packet); } - public void testGellAllContributeActivities()throws IOException, LearningDesignProcessorException{ - String packet = monitoringService.getAllContributeActivities(TEST_LESSION_ID); - System.out.println(packet); + + public void testGetLearnerActivityURL() throws Exception { + String url = monitoringService.getLearnerActivityURL(TEST_LESSION_ID, new Long(29), TEST_LEARNER_ID, + TEST_STAFF_ID); + System.out.println(url); } - - public void testMoveLesson() throws IOException{ - String packet = monitoringService.moveLesson(TEST_LESSION_ID,MELCOE_WORKSPACE,TEST_USER_ID); - System.out.println(packet); + + public void testGellAllContributeActivities() throws IOException, LearningDesignProcessorException { + String packet = monitoringService.getAllContributeActivities(TEST_LESSION_ID); + System.out.println(packet); } - public void testRenameLesson()throws IOException{ - String newName = "New name after renaming"; - String packet = monitoringService.renameLesson(TEST_LESSION_ID,newName,TEST_USER_ID); - Lesson updatedLesson = lessonDao.getLesson(TEST_LESSION_ID); - assertEquals("Name changed correctly", newName, updatedLesson.getLessonName()); - System.out.println(packet); - } + + public void testMoveLesson() throws IOException { + String packet = monitoringService.moveLesson(TEST_LESSION_ID, MELCOE_WORKSPACE, TEST_USER_ID); + System.out.println(packet); + } + + public void testRenameLesson() throws IOException { + String newName = "New name after renaming"; + String packet = monitoringService.renameLesson(TEST_LESSION_ID, newName, TEST_USER_ID); + Lesson updatedLesson = lessonDao.getLesson(TEST_LESSION_ID); + assertEquals("Name changed correctly", newName, updatedLesson.getLessonName()); + System.out.println(packet); + } + /** * Initialize all instance variables for testing */ - private void initializeTestingData() - { - testUser = (User)usermanageService.findById(User.class,TEST_USER_ID); - testStaff = (User)usermanageService.findById(User.class,TEST_STAFF_ID); - testLearner = (User)usermanageService.findById(User.class,TEST_LEARNER_ID); - testOrganisation = (Organisation)usermanageService.findById(Organisation.class,TEST_ORGANIZATION_ID); + private void initializeTestingData() { + testUser = (User) usermanageService.findById(User.class, TEST_USER_ID); + testStaff = (User) usermanageService.findById(User.class, TEST_STAFF_ID); + testLearner = (User) usermanageService.findById(User.class, TEST_LEARNER_ID); + testOrganisation = (Organisation) usermanageService.findById(Organisation.class, TEST_ORGANIZATION_ID); } - - public void testCheckGateStatus() throws IOException - { - Long syncGateID = new Long(33); - Long scheduleGateID = new Long(34); - Long permissionGateID = new Long(35); - Long lessonID = new Long(2); - - - String packet = monitoringService.checkGateStatus(scheduleGateID, lessonID); //schedule gate - System.out.println(packet); - + + public void testCheckGateStatus() throws IOException { + Long syncGateID = new Long(33); + Long scheduleGateID = new Long(34); + Long permissionGateID = new Long(35); + Long lessonID = new Long(2); + + String packet = monitoringService.checkGateStatus(scheduleGateID, lessonID); // schedule gate + System.out.println(packet); + } - - public void testReleaseGate() throws IOException - { - Long syncGateID = new Long(33); - Long scheduleGateID = new Long(34); - Long permissionGateID = new Long(35); - - String packet = monitoringService.releaseGate(syncGateID); //schedule gate - System.out.println(packet); - + + public void testReleaseGate() throws IOException { + Long syncGateID = new Long(33); + Long scheduleGateID = new Long(34); + Long permissionGateID = new Long(35); + + String packet = monitoringService.releaseGate(syncGateID); // schedule gate + System.out.println(packet); + } - /** Get the largest id that was last inserted into a table. This will normally be the last - * id inserted. Why not use LAST_INSERT_ID() - that works per connection and there is - * no guarantee that this test case is running using the same connection as the - * service. + /** + * Get the largest id that was last inserted into a table. This will normally be the last id inserted. Why not use + * LAST_INSERT_ID() - that works per connection and there is no guarantee that this test case is running using the + * same connection as the service. */ - private long getMaxId(String tablename, String idname) - { - JdbcTemplate jt = new JdbcTemplate(dataSource); - return jt.queryForLong("SELECT max("+idname+") FROM "+tablename); + private long getMaxId(String tablename, String idname) { + JdbcTemplate jt = new JdbcTemplate(dataSource); + return jt.queryForLong("SELECT max(" + idname + ") FROM " + tablename); } - /* - * Test method for 'org.lamsfoundation.lams.preview.service.PreviewService.startPreviewLesson(int, long, String, String)' - */ - public void testStartPreviewLesson() { - String testName = "LESSON"; - String testDesc = "DESC"; - Lesson lesson = startLesson(testName, testDesc); - assertEquals("Lesson has correct title",testName, lesson.getLessonName()); - assertEquals("Lesson has correct description",testDesc, lesson.getLessonDescription()); + /* + * Test method for 'org.lamsfoundation.lams.preview.service.PreviewService.startPreviewLesson(int, long, String, + * String)' + */ + public void testStartPreviewLesson() { + String testName = "LESSON"; + String testDesc = "DESC"; + Lesson lesson = startLesson(testName, testDesc); + assertEquals("Lesson has correct title", testName, lesson.getLessonName()); + assertEquals("Lesson has correct description", testDesc, lesson.getLessonDescription()); - Lesson newLesson = lessonDao.getLesson(lesson.getLessonId()); - assertNotNull("Lesson can be found in database",newLesson); - } + Lesson newLesson = lessonDao.getLesson(lesson.getLessonId()); + assertNotNull("Lesson can be found in database", newLesson); + } - private Lesson startLesson(String testName, String testDesc) { - try { - Lesson previewLesson = monitoringService.initializeLessonForPreview(testName,testDesc,TEST_LEARNING_DESIGN_SURVEY_ONLY_ID,TEST_USER_ID, null, false, false, false); - assertNotNull("Lesson created",previewLesson); - assertNotNull("Lesson has been saved - an id exists", previewLesson.getLessonId()); + private Lesson startLesson(String testName, String testDesc) { + try { + Lesson previewLesson = monitoringService.initializeLessonForPreview(testName, testDesc, + TEST_LEARNING_DESIGN_SURVEY_ONLY_ID, TEST_USER_ID, null, false, false, false); + assertNotNull("Lesson created", previewLesson); + assertNotNull("Lesson has been saved - an id exists", previewLesson.getLessonId()); - Lesson newLesson = monitoringService.createPreviewClassForLesson(TEST_USER_ID.intValue(), previewLesson.getLessonId().longValue()); - assertNotNull("Lesson returned from create class",newLesson); - assertSame("Lesson updated from create class", newLesson.getLessonId(),previewLesson.getLessonId()); + Lesson newLesson = monitoringService.createPreviewClassForLesson(TEST_USER_ID.intValue(), previewLesson + .getLessonId().longValue()); + assertNotNull("Lesson returned from create class", newLesson); + assertSame("Lesson updated from create class", newLesson.getLessonId(), previewLesson.getLessonId()); - monitoringService.startLesson(previewLesson.getLessonId().longValue(),TEST_STAFF_ID); + monitoringService.startLesson(previewLesson.getLessonId().longValue(), TEST_STAFF_ID); - return previewLesson; - } catch (UserAccessDeniedException e) { - fail("Unable to start lesson as due to a user exception"); - } - return null; - + return previewLesson; + } catch (UserAccessDeniedException e) { + fail("Unable to start lesson as due to a user exception"); } - - /* - * Test method for 'org.lamsfoundation.lams.preview.service.PreviewService.deletePreviewLesson(long)' - */ - public void testDeletePreviewLesson() { - String testName = "LESSON TO DELETE"; - String testDesc = "TO BE DELETED"; - Lesson lesson = startLesson(testName, testDesc); - Long lessonId = lesson.getLessonId(); - - monitoringService.deletePreviewLesson(lessonId.longValue()); - Lesson deletedLesson = lessonDao.getLesson(lessonId); - assertNull("Deleted lesson cannot be found",deletedLesson); - } + return null; - /* - * Test method for 'org.lamsfoundation.lams.preview.service.PreviewService.deleteAllOldPreviewLessons(int)' - */ - public void testDeleteAllOldPreviewLessons() { - // need to dummy up something to delete. Create a lesson and force it to be over 7 days old. - String testName = "LESSON TO DELETE By BATCH"; - String testDesc = "TO BE DELETED BY THE BATCH CALL"; - Lesson lesson = startLesson(testName, testDesc); - Long lessonId = lesson.getLessonId(); - - int numDays = Configuration.getAsInt(ConfigurationKeys.PREVIEW_CLEANUP_NUM_DAYS); - assertTrue("Number of days till the cleanup should be deleted is greater than zero (value is "+numDays+")", numDays > 0); + } - //Configuration. - Calendar calendar = new GregorianCalendar(); - calendar.setTime(new Date()); - calendar.add(Calendar.DAY_OF_MONTH, -8); - lesson.setStartDateTime(calendar.getTime()); - int lessonsDeleted = monitoringService.deleteAllOldPreviewLessons(); - assertTrue("deleteAllOldPreviewLessons returns at least 1 lesson", lessonsDeleted>=1); - - Lesson deletedLesson = lessonDao.getLesson(lessonId); - assertNull("Batch deleted lesson cannot be found",deletedLesson); - } + /* + * Test method for 'org.lamsfoundation.lams.preview.service.PreviewService.deletePreviewLesson(long)' + */ + public void testDeletePreviewLesson() { + String testName = "LESSON TO DELETE"; + String testDesc = "TO BE DELETED"; + Lesson lesson = startLesson(testName, testDesc); + Long lessonId = lesson.getLessonId(); + monitoringService.deletePreviewLesson(lessonId.longValue()); + Lesson deletedLesson = lessonDao.getLesson(lessonId); + assertNull("Deleted lesson cannot be found", deletedLesson); + } + + /* + * Test method for 'org.lamsfoundation.lams.preview.service.PreviewService.deleteAllOldPreviewLessons(int)' + */ + public void testDeleteAllOldPreviewLessons() { + // need to dummy up something to delete. Create a lesson and force it to be over 7 days old. + String testName = "LESSON TO DELETE By BATCH"; + String testDesc = "TO BE DELETED BY THE BATCH CALL"; + Lesson lesson = startLesson(testName, testDesc); + Long lessonId = lesson.getLessonId(); + + int numDays = Configuration.getAsInt(ConfigurationKeys.PREVIEW_CLEANUP_NUM_DAYS); + assertTrue("Number of days till the cleanup should be deleted is greater than zero (value is " + numDays + ")", + numDays > 0); + + // Configuration. + Calendar calendar = new GregorianCalendar(); + calendar.setTime(new Date()); + calendar.add(Calendar.DAY_OF_MONTH, -8); + lesson.setStartDateTime(calendar.getTime()); + int lessonsDeleted = monitoringService.deleteAllOldPreviewLessons(); + assertTrue("deleteAllOldPreviewLessons returns at least 1 lesson", lessonsDeleted >= 1); + + Lesson deletedLesson = lessonDao.getLesson(lessonId); + assertNull("Batch deleted lesson cannot be found", deletedLesson); + } + } Index: lams_tool_chat/conf/xdoclet/web-settings.xml =================================================================== RCS file: /usr/local/cvsroot/lams_tool_chat/conf/xdoclet/web-settings.xml,v diff -u -r1.7.4.1 -r1.7.4.2 --- lams_tool_chat/conf/xdoclet/web-settings.xml 17 Mar 2009 21:12:35 -0000 1.7.4.1 +++ lams_tool_chat/conf/xdoclet/web-settings.xml 19 Mar 2009 01:55:30 -0000 1.7.4.2 @@ -15,6 +15,6 @@ parentContextKey - context.tool + context.central Index: lams_tool_daco/web/WEB-INF/web.xml =================================================================== RCS file: /usr/local/cvsroot/lams_tool_daco/web/WEB-INF/web.xml,v diff -u -r1.5.2.1 -r1.5.2.2 --- lams_tool_daco/web/WEB-INF/web.xml 17 Mar 2009 21:11:57 -0000 1.5.2.1 +++ lams_tool_daco/web/WEB-INF/web.xml 19 Mar 2009 01:56:37 -0000 1.5.2.2 @@ -19,7 +19,7 @@ parentContextKey - context.tool + context.central Index: lams_tool_dimdim/conf/xdoclet/web-settings.xml =================================================================== RCS file: /usr/local/cvsroot/lams_tool_dimdim/conf/xdoclet/Attic/web-settings.xml,v diff -u -r1.2.4.1 -r1.2.4.2 --- lams_tool_dimdim/conf/xdoclet/web-settings.xml 17 Mar 2009 21:12:10 -0000 1.2.4.1 +++ lams_tool_dimdim/conf/xdoclet/web-settings.xml 19 Mar 2009 01:56:09 -0000 1.2.4.2 @@ -15,6 +15,6 @@ parentContextKey - context.tool + context.central Index: lams_tool_example/conf/xdoclet/web-settings.xml =================================================================== RCS file: /usr/local/cvsroot/lams_tool_example/conf/xdoclet/web-settings.xml,v diff -u -r1.6.2.1 -r1.6.2.2 --- lams_tool_example/conf/xdoclet/web-settings.xml 18 Mar 2009 07:57:14 -0000 1.6.2.1 +++ lams_tool_example/conf/xdoclet/web-settings.xml 19 Mar 2009 01:54:19 -0000 1.6.2.2 @@ -15,5 +15,5 @@ parentContextKey - context.tool + context.central Index: lams_tool_forum/conf/xdoclet/web-settings.xml =================================================================== RCS file: /usr/local/cvsroot/lams_tool_forum/conf/xdoclet/web-settings.xml,v diff -u -r1.11.4.1 -r1.11.4.2 --- lams_tool_forum/conf/xdoclet/web-settings.xml 17 Mar 2009 21:13:38 -0000 1.11.4.1 +++ lams_tool_forum/conf/xdoclet/web-settings.xml 19 Mar 2009 01:55:35 -0000 1.11.4.2 @@ -19,7 +19,7 @@ parentContextKey - context.tool + context.central Index: lams_tool_gmap/conf/xdoclet/web-settings.xml =================================================================== RCS file: /usr/local/cvsroot/lams_tool_gmap/conf/xdoclet/web-settings.xml,v diff -u -r1.2.4.1 -r1.2.4.2 --- lams_tool_gmap/conf/xdoclet/web-settings.xml 17 Mar 2009 21:11:35 -0000 1.2.4.1 +++ lams_tool_gmap/conf/xdoclet/web-settings.xml 19 Mar 2009 01:56:32 -0000 1.2.4.2 @@ -15,6 +15,6 @@ parentContextKey - context.tool + context.central Index: lams_tool_images/web/WEB-INF/web.xml =================================================================== RCS file: /usr/local/cvsroot/lams_tool_images/web/WEB-INF/web.xml,v diff -u -r1.3.2.1 -r1.3.2.2 --- lams_tool_images/web/WEB-INF/web.xml 17 Mar 2009 21:13:05 -0000 1.3.2.1 +++ lams_tool_images/web/WEB-INF/web.xml 19 Mar 2009 01:55:17 -0000 1.3.2.2 @@ -19,7 +19,7 @@ parentContextKey - context.tool + context.central Index: lams_tool_lamc/web/WEB-INF/web.xml =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/web/WEB-INF/web.xml,v diff -u -r1.27.2.1 -r1.27.2.2 --- lams_tool_lamc/web/WEB-INF/web.xml 17 Mar 2009 21:12:43 -0000 1.27.2.1 +++ lams_tool_lamc/web/WEB-INF/web.xml 19 Mar 2009 01:56:01 -0000 1.27.2.2 @@ -16,7 +16,7 @@ parentContextKey - context.tool + context.central Index: lams_tool_laqa/web/WEB-INF/web.xml =================================================================== RCS file: /usr/local/cvsroot/lams_tool_laqa/web/WEB-INF/web.xml,v diff -u -r1.29.2.1 -r1.29.2.2 --- lams_tool_laqa/web/WEB-INF/web.xml 17 Mar 2009 21:12:59 -0000 1.29.2.1 +++ lams_tool_laqa/web/WEB-INF/web.xml 19 Mar 2009 01:55:53 -0000 1.29.2.2 @@ -17,7 +17,7 @@ parentContextKey - context.tool + context.central Index: lams_tool_larsrc/web/WEB-INF/web.xml =================================================================== RCS file: /usr/local/cvsroot/lams_tool_larsrc/web/WEB-INF/web.xml,v diff -u -r1.19.2.1 -r1.19.2.2 --- lams_tool_larsrc/web/WEB-INF/web.xml 17 Mar 2009 21:13:32 -0000 1.19.2.1 +++ lams_tool_larsrc/web/WEB-INF/web.xml 19 Mar 2009 01:56:29 -0000 1.19.2.2 @@ -19,7 +19,7 @@ parentContextKey - context.tool + context.central Index: lams_tool_nb/conf/xdoclet/web-settings.xml =================================================================== RCS file: /usr/local/cvsroot/lams_tool_nb/conf/xdoclet/web-settings.xml,v diff -u -r1.7.4.1 -r1.7.4.2 --- lams_tool_nb/conf/xdoclet/web-settings.xml 17 Mar 2009 21:11:14 -0000 1.7.4.1 +++ lams_tool_nb/conf/xdoclet/web-settings.xml 19 Mar 2009 01:56:17 -0000 1.7.4.2 @@ -12,5 +12,5 @@ parentContextKey - context.tool + context.central Index: lams_tool_notebook/conf/xdoclet/web-settings.xml =================================================================== RCS file: /usr/local/cvsroot/lams_tool_notebook/conf/xdoclet/web-settings.xml,v diff -u -r1.2.4.1 -r1.2.4.2 --- lams_tool_notebook/conf/xdoclet/web-settings.xml 17 Mar 2009 21:13:18 -0000 1.2.4.1 +++ lams_tool_notebook/conf/xdoclet/web-settings.xml 19 Mar 2009 01:56:21 -0000 1.2.4.2 @@ -15,6 +15,6 @@ parentContextKey - context.tool + context.central Index: lams_tool_pixlr/conf/xdoclet/web-settings.xml =================================================================== RCS file: /usr/local/cvsroot/lams_tool_pixlr/conf/xdoclet/web-settings.xml,v diff -u -r1.1.2.1 -r1.1.2.2 --- lams_tool_pixlr/conf/xdoclet/web-settings.xml 17 Mar 2009 21:11:49 -0000 1.1.2.1 +++ lams_tool_pixlr/conf/xdoclet/web-settings.xml 19 Mar 2009 01:55:57 -0000 1.1.2.2 @@ -15,6 +15,6 @@ parentContextKey - context.tool + context.central Index: lams_tool_sbmt/conf/xdoclet/web-settings.xml =================================================================== RCS file: /usr/local/cvsroot/lams_tool_sbmt/conf/xdoclet/web-settings.xml,v diff -u -r1.8.4.1 -r1.8.4.2 --- lams_tool_sbmt/conf/xdoclet/web-settings.xml 17 Mar 2009 21:11:42 -0000 1.8.4.1 +++ lams_tool_sbmt/conf/xdoclet/web-settings.xml 19 Mar 2009 01:56:40 -0000 1.8.4.2 @@ -11,7 +11,7 @@ parentContextKey - context.tool + context.central javax.servlet.jsp.jstl.fmt.localizationContext Index: lams_tool_scribe/conf/xdoclet/web-settings.xml =================================================================== RCS file: /usr/local/cvsroot/lams_tool_scribe/conf/xdoclet/web-settings.xml,v diff -u -r1.2.4.1 -r1.2.4.2 --- lams_tool_scribe/conf/xdoclet/web-settings.xml 17 Mar 2009 21:11:21 -0000 1.2.4.1 +++ lams_tool_scribe/conf/xdoclet/web-settings.xml 19 Mar 2009 01:55:49 -0000 1.2.4.2 @@ -15,6 +15,6 @@ parentContextKey - context.tool + context.central Index: lams_tool_spreadsheet/web/WEB-INF/web.xml =================================================================== RCS file: /usr/local/cvsroot/lams_tool_spreadsheet/web/WEB-INF/web.xml,v diff -u -r1.4.2.1 -r1.4.2.2 --- lams_tool_spreadsheet/web/WEB-INF/web.xml 17 Mar 2009 21:13:11 -0000 1.4.2.1 +++ lams_tool_spreadsheet/web/WEB-INF/web.xml 19 Mar 2009 01:56:25 -0000 1.4.2.2 @@ -19,7 +19,7 @@ parentContextKey - context.tool + context.central Index: lams_tool_survey/web/WEB-INF/web.xml =================================================================== RCS file: /usr/local/cvsroot/lams_tool_survey/web/WEB-INF/web.xml,v diff -u -r1.9.2.1 -r1.9.2.2 --- lams_tool_survey/web/WEB-INF/web.xml 17 Mar 2009 21:11:29 -0000 1.9.2.1 +++ lams_tool_survey/web/WEB-INF/web.xml 19 Mar 2009 01:56:06 -0000 1.9.2.2 @@ -19,7 +19,7 @@ parentContextKey - context.tool + context.central Index: lams_tool_task/web/WEB-INF/web.xml =================================================================== RCS file: /usr/local/cvsroot/lams_tool_task/web/WEB-INF/web.xml,v diff -u -r1.5.2.1 -r1.5.2.2 --- lams_tool_task/web/WEB-INF/web.xml 17 Mar 2009 21:13:25 -0000 1.5.2.1 +++ lams_tool_task/web/WEB-INF/web.xml 19 Mar 2009 01:55:39 -0000 1.5.2.2 @@ -19,7 +19,7 @@ parentContextKey - context.tool + context.central Index: lams_tool_videorecorder/conf/xdoclet/web-settings.xml =================================================================== RCS file: /usr/local/cvsroot/lams_tool_videorecorder/conf/xdoclet/web-settings.xml,v diff -u -r1.1.2.1 -r1.1.2.2 --- lams_tool_videorecorder/conf/xdoclet/web-settings.xml 17 Mar 2009 21:12:50 -0000 1.1.2.1 +++ lams_tool_videorecorder/conf/xdoclet/web-settings.xml 19 Mar 2009 01:55:42 -0000 1.1.2.2 @@ -15,6 +15,6 @@ parentContextKey - context.tool + context.central Index: lams_tool_vote/web/WEB-INF/web.xml =================================================================== RCS file: /usr/local/cvsroot/lams_tool_vote/web/WEB-INF/web.xml,v diff -u -r1.16.2.1 -r1.16.2.2 --- lams_tool_vote/web/WEB-INF/web.xml 17 Mar 2009 21:12:04 -0000 1.16.2.1 +++ lams_tool_vote/web/WEB-INF/web.xml 19 Mar 2009 01:55:25 -0000 1.16.2.2 @@ -36,7 +36,7 @@ parentContextKey - context.tool + context.central Index: lams_tool_wiki/conf/xdoclet/web-settings.xml =================================================================== RCS file: /usr/local/cvsroot/lams_tool_wiki/conf/xdoclet/web-settings.xml,v diff -u -r1.1.4.1 -r1.1.4.2 --- lams_tool_wiki/conf/xdoclet/web-settings.xml 17 Mar 2009 21:12:19 -0000 1.1.4.1 +++ lams_tool_wiki/conf/xdoclet/web-settings.xml 19 Mar 2009 01:55:46 -0000 1.1.4.2 @@ -15,6 +15,6 @@ parentContextKey - context.tool + context.central