Source Code Cross Referenced for SpreadsheetTest.java in  » ERP-CRM-Financial » sakai » org » sakaiproject » tool » gradebook » 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.tool.gradebook.test 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:
002:        /*******************************************************************************
003:         * Copyright (c) 2006 The Regents of the University of California
004:         *
005:         *  Licensed under the Educational Community License, Version 1.0 (the "License");
006:         *  you may not use this file except in compliance with the License.
007:         *  You may obtain a copy of the License at
008:         *
009:         *       http://www.opensource.org/licenses/ecl1.php
010:         *
011:         *  Unless required by applicable law or agreed to in writing, software
012:         *  distributed under the License is distributed on an "AS IS" BASIS,
013:         *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014:         *  See the License for the specific language governing permissions and
015:         *  limitations under the License.
016:         ******************************************************************************/package org.sakaiproject.tool.gradebook.test;
017:
018:        import java.util.Date;
019:        import java.util.List;
020:
021:        import junit.framework.Assert;
022:
023:        import org.sakaiproject.service.gradebook.shared.ConflictingSpreadsheetNameException;
024:        import org.sakaiproject.tool.gradebook.Gradebook;
025:        import org.sakaiproject.tool.gradebook.Spreadsheet;
026:
027:        /**
028:         * User: louis
029:         * Date: Jun 13, 2006
030:         * Time: 12:16:35 PM
031:         */
032:        public class SpreadsheetTest extends GradebookTestBase {
033:
034:            protected Gradebook gradebook;
035:            protected static final String SPT_NAME = "SP1 #1";
036:            protected static final String SPT_NAME2 = "SP2 #1";
037:            protected static final String SPT_NAME3 = "SP3 #1";
038:            protected static final String CONTENT = "one,two,three,four,five,six,seven,eight \n";
039:
040:            protected void onSetUpInTransaction() throws Exception {
041:                super .onSetUpInTransaction();
042:                // Create a gradebook to work with
043:                String className = this .getClass().getName();
044:                String gradebookName = className + (new Date()).getTime();
045:                gradebookFrameworkService.addGradebook(gradebookName,
046:                        gradebookName);
047:
048:                // Set up a holder for enrollments, teaching assignments, and sections.
049:                integrationSupport.createCourse(gradebookName, gradebookName,
050:                        false, false, false);
051:
052:                // Grab the gradebook for use in the tests
053:                gradebook = gradebookManager.getGradebook(gradebookName);
054:            }
055:
056:            /**
057:             *
058:             * @throws Exception
059:             */
060:            public void testCreateAndUpdateSpreadsheet() throws Exception {
061:
062:                Long sptId = gradebookManager.createSpreadsheet(gradebook
063:                        .getId(), SPT_NAME, "test_uid", new Date(), CONTENT);
064:
065:                // Fetch the updated spreadsheet
066:                Spreadsheet persistentSpreadsheet = gradebookManager
067:                        .getSpreadsheet(sptId);
068:                // Ensure the DB update was successful
069:                Assert.assertEquals(persistentSpreadsheet.getCreator(),
070:                        "test_uid");
071:
072:                // Try to save a new assignment with the same name
073:                boolean errorThrown = false;
074:                try {
075:                    gradebookManager.createSpreadsheet(gradebook.getId(),
076:                            SPT_NAME, "test_uid", new Date(), CONTENT);
077:                } catch (ConflictingSpreadsheetNameException e) {
078:                    errorThrown = true;
079:                }
080:                Assert.assertTrue(errorThrown);
081:
082:            }
083:
084:            /**
085:             *
086:             * @throws Exception
087:             */
088:            public void testRemoveSpreadsheet() throws Exception {
089:
090:                Long id1 = gradebookManager.createSpreadsheet(
091:                        gradebook.getId(), SPT_NAME, "test_uid", new Date(),
092:                        CONTENT);
093:                Long id2 = gradebookManager.createSpreadsheet(
094:                        gradebook.getId(), SPT_NAME2, "test_uid", new Date(),
095:                        CONTENT);
096:                Long id3 = gradebookManager.createSpreadsheet(
097:                        gradebook.getId(), SPT_NAME3, "test_uid", new Date(),
098:                        CONTENT);
099:
100:                List spreadsheets = gradebookManager.getSpreadsheets(gradebook
101:                        .getId());
102:                Spreadsheet spt = gradebookManager.getSpreadsheet(id1);
103:
104:                // Remove the spreadsheets.
105:                // (We remove all of them to make sure that the calculated course grade can be emptied.)
106:                gradebookManager.removeSpreadsheet(id2);
107:                gradebookManager.removeSpreadsheet(id3);
108:                gradebookManager.removeSpreadsheet(id1);
109:
110:                // Get the list of spreadsheets again, and make sure it's missing the removed spreadsheets
111:                spreadsheets = gradebookManager.getSpreadsheets(gradebook
112:                        .getId());
113:                Assert.assertTrue(!spreadsheets.contains(spt));
114:
115:                // Make sure we can add a new Spreadsheet with the same name as the removed one.
116:                // This will throw an exception if it doesn't like the assignment name.
117:                gradebookManager.createSpreadsheet(gradebook.getId(), SPT_NAME,
118:                        "test_uid", new Date(), CONTENT);
119:
120:            }
121:
122:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.