Source Code Cross Referenced for CourseManagementAdministrationDataLoader.java in  » ERP-CRM-Financial » sakai » org » sakaiproject » coursemanagement » test » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » ERP CRM Financial » sakai » org.sakaiproject.coursemanagement.test 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**********************************************************************************
002:         * $URL: https://source.sakaiproject.org/svn/course-management/tags/sakai_2-4-1/cm-impl/hibernate-impl/impl/src/test/org/sakaiproject/coursemanagement/test/CourseManagementAdministrationDataLoader.java $
003:         * $Id: CourseManagementAdministrationDataLoader.java 18126 2006-11-13 22:43:13Z jholtzman@berkeley.edu $
004:         ***********************************************************************************
005:         *
006:         * Copyright (c) 2006 The Sakai Foundation.
007:         * 
008:         * Licensed under the Educational Community License, Version 1.0 (the "License"); 
009:         * you may not use this file except in compliance with the License. 
010:         * You may obtain a copy of the License at
011:         * 
012:         *      http://www.opensource.org/licenses/ecl1.php
013:         * 
014:         * Unless required by applicable law or agreed to in writing, software 
015:         * distributed under the License is distributed on an "AS IS" BASIS, 
016:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
017:         * See the License for the specific language governing permissions and 
018:         * limitations under the License.
019:         *
020:         **********************************************************************************/package org.sakaiproject.coursemanagement.test;
021:
022:        import java.util.Calendar;
023:        import java.util.HashSet;
024:        import java.util.Set;
025:
026:        import org.sakaiproject.coursemanagement.api.CourseManagementAdministration;
027:        import org.sakaiproject.coursemanagement.api.Section;
028:        import org.sakaiproject.coursemanagement.api.SectionCategory;
029:        import org.springframework.context.support.ClassPathXmlApplicationContext;
030:        import org.sakaiproject.coursemanagement.impl.DataLoader;
031:
032:        import junit.framework.TestCase;
033:
034:        /**
035:         * Loads data into persistence.  This is not a junit test per se.  It extends TestCase
036:         * so it's easy to execute via maven.
037:         * 
038:         * If you want to load data into a database, just modify this class, set your db connection
039:         * information in hibernate.dataload.properties, and run 'maven load-data'.
040:         * 
041:         * @author <a href="mailto:jholtzman@berkeley.edu">Josh Holtzman</a>
042:         */
043:        public class CourseManagementAdministrationDataLoader extends TestCase
044:                implements  DataLoader {
045:            private CourseManagementAdministration cmAdmin;
046:
047:            public void testLoadData() throws Exception {
048:                ClassPathXmlApplicationContext ac = new ClassPathXmlApplicationContext(
049:                        new String[] { "spring-test.xml",
050:                                "spring-config-dataload.xml" });
051:                cmAdmin = (CourseManagementAdministration) ac
052:                        .getBean(CourseManagementAdministration.class.getName());
053:                load();
054:            }
055:
056:            public void load() throws Exception {
057:                // Academic Sessions
058:                Calendar startCal = Calendar.getInstance();
059:                Calendar endCal = Calendar.getInstance();
060:
061:                startCal.set(2006, 8, 1);
062:                endCal.set(2006, 12, 1);
063:                cmAdmin.createAcademicSession("f2006", "Fall 2006",
064:                        "The fall term, 2006", startCal.getTime(), endCal
065:                                .getTime());
066:
067:                startCal.set(2007, 3, 1);
068:                endCal.set(2007, 6, 1);
069:                cmAdmin.createAcademicSession("sp2007", "Spring 2007",
070:                        "The spring term, 2007", startCal.getTime(), endCal
071:                                .getTime());
072:
073:                cmAdmin.createAcademicSession("IND", "Ongoing Courses",
074:                        "Ongoing session for independent study", null, null);
075:
076:                // Section Categories
077:                SectionCategory lectureCategory = cmAdmin.addSectionCategory(
078:                        "lct", "Lecture");
079:                SectionCategory labCategory = cmAdmin.addSectionCategory("lab",
080:                        "Lab");
081:                SectionCategory discussionCategory = cmAdmin
082:                        .addSectionCategory("dsc", "Discussion");
083:                SectionCategory recitationCategory = cmAdmin
084:                        .addSectionCategory("rec", "Recitation");
085:                SectionCategory studioCategory = cmAdmin.addSectionCategory(
086:                        "sto", "Studio");
087:
088:                // Course Sets
089:                cmAdmin.createCourseSet("bio", "Biology Department",
090:                        "We study wet things in the Bio Dept", "DEPT", null);
091:                cmAdmin.addOrUpdateCourseSetMembership("da1", "DeptAdmin",
092:                        "bio", "active");
093:
094:                // Canonical Courses
095:                cmAdmin.createCanonicalCourse("bio101", "Intro to Biology",
096:                        "An introduction to biology");
097:                cmAdmin
098:                        .createCanonicalCourse(
099:                                "indep_study_bio",
100:                                "Independent Study in Biology",
101:                                "A self paced independent study in biology.  Must be "
102:                                        + "approved and sponsored by biology department faculty.");
103:
104:                // Course Offerings
105:                startCal.set(2006, 8, 1);
106:                endCal.set(2006, 12, 1);
107:                cmAdmin.createCourseOffering("bio101_f2006",
108:                        "Bio 101, Fall 2006", "Intro to Biology, Fall 06",
109:                        "open", "f2006", "bio101", startCal.getTime(), endCal
110:                                .getTime());
111:                cmAdmin.addCourseOfferingToCourseSet("bio", "bio101_f2006");
112:
113:                startCal.set(2007, 3, 1);
114:                endCal.set(2007, 6, 1);
115:                cmAdmin.createCourseOffering("bio101_sp2007",
116:                        "Bio 101, Spring 2007", "Intro to Biology, Spring 07",
117:                        "open", "sp2007", "bio101", startCal.getTime(), endCal
118:                                .getTime());
119:
120:                cmAdmin.createCourseOffering(
121:                        "indep_study_bio_molecular_research",
122:                        "Independent study in molecular research",
123:                        "Details to be determined by student and sponsor",
124:                        "open", "IND", "indep_study_bio", null, null);
125:
126:                // Enrollment sets
127:                Set instructors = new HashSet();
128:                instructors.add("admin");
129:                cmAdmin.createEnrollmentSet("bio101_f2006_lec1",
130:                        "Bio 101 Lecture", "Bio 101 Lecture.  Required.",
131:                        "lecture", "3", "bio101_f2006", instructors);
132:
133:                instructors.clear();
134:                instructors.add("ta1");
135:                cmAdmin.createEnrollmentSet("bio101_f2006_lab1", "Lab 1",
136:                        "Lab 1", "lab", "1", "bio101_f2006", instructors);
137:
138:                instructors.clear();
139:                instructors.add("ta2");
140:                cmAdmin.createEnrollmentSet("bio101_f2006_lab2", "Lab 2",
141:                        "Lab 2", "lab", "1", "bio101_f2006", instructors);
142:
143:                // Enrollments
144:                cmAdmin.addOrUpdateEnrollment("student1", "bio101_f2006_lec1",
145:                        "enrolled", "3", "standard");
146:                cmAdmin.addOrUpdateEnrollment("student2", "bio101_f2006_lec1",
147:                        "enrolled", "3", "pass/fail");
148:                cmAdmin.addOrUpdateEnrollment("student3", "bio101_f2006_lec1",
149:                        "waitlisted", "3", "standard");
150:
151:                cmAdmin.addOrUpdateEnrollment("student1", "bio101_f2006_lab1",
152:                        "enrolled", "1", "standard");
153:                cmAdmin.addOrUpdateEnrollment("student2", "bio101_f2006_lab1",
154:                        "enrolled", "1", "pass/fail");
155:
156:                cmAdmin.addOrUpdateEnrollment("student3", "bio101_f2006_lab2",
157:                        "waitlisted", "1", "standard");
158:
159:                // Sections
160:                Section lec1 = cmAdmin.createSection("bio101_f2006_lec1",
161:                        "Bio 101, Lecture",
162:                        "Intro to Biology, Fall 06, Lecture", lectureCategory
163:                                .getCategoryCode(), null, "bio101_f2006",
164:                        "bio101_f2006_lec1");
165:                cmAdmin.createSection("bio101_f2006_lab1", "Lab 1",
166:                        "Intro to Biology, Fall 06, Lab 1", labCategory
167:                                .getCategoryCode(), null, "bio101_f2006",
168:                        "bio101_f2006_lab1");
169:                cmAdmin.createSection("bio101_f2006_lab2", "Lab 2",
170:                        "Intro to Biology, Fall 06, Lab 2", labCategory
171:                                .getCategoryCode(), null, "bio101_f2006",
172:                        "bio101_f2006_lab2");
173:
174:                // Meetings
175:                Set lecMeetings = new HashSet();
176:                lecMeetings.add(cmAdmin.newSectionMeeting("bio101_f2006_lec1",
177:                        "a location", null, null, "somenotes"));
178:                lecMeetings.add(cmAdmin.newSectionMeeting("bio101_f2006_lec1",
179:                        "another location", null, null, "some other notes"));
180:                lec1.setMeetings(lecMeetings);
181:                cmAdmin.updateSection(lec1);
182:
183:            }
184:
185:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.