Source Code Cross Referenced for UserServiceTest.java in  » ERP-CRM-Financial » Kuali-Financial-System » edu » iu » uis » eden » user » 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 » Kuali Financial System » edu.iu.uis.eden.user 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2005-2007 The Kuali Foundation.
003:         * 
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:         */
017:        package edu.iu.uis.eden.user;
018:
019:        import org.junit.Test;
020:        import org.kuali.workflow.test.WorkflowTestCase;
021:
022:        import edu.iu.uis.eden.KEWServiceLocator;
023:        import edu.iu.uis.eden.clientapp.vo.EmplIdVO;
024:        import edu.iu.uis.eden.clientapp.vo.NetworkIdVO;
025:        import edu.iu.uis.eden.clientapp.vo.UuIdVO;
026:        import edu.iu.uis.eden.clientapp.vo.WorkflowIdVO;
027:        import edu.iu.uis.eden.exception.EdenUserNotFoundException;
028:
029:        public class UserServiceTest extends WorkflowTestCase {
030:
031:            private UserService userService;
032:
033:            protected void loadTestData() throws Exception {
034:                loadXmlFile("UserConfig.xml");
035:            }
036:
037:            protected void setUpTransaction() throws Exception {
038:                userService = KEWServiceLocator.getUserService();
039:            }
040:
041:            /**
042:             * Tests the retrieval of users from the service.  There are quite a few users in the default data set that
043:             * we will query for.
044:             */
045:            @Test
046:            public void testGetWorkflowUser() throws Exception {
047:                // should be 'ewestfal', check all of the values on the user object to assert that the XML import is functioning properly
048:                WorkflowUser user = userService
049:                        .getWorkflowUser(new WorkflowUserId("1"));
050:                assertNotNull(user);
051:                assertEquals("1", user.getWorkflowId());
052:                assertEquals("1", user.getEmplId().getEmplId());
053:                assertEquals("1", user.getUuId().getUuId());
054:                assertEquals("ewestfal", user.getAuthenticationUserId()
055:                        .getAuthenticationId());
056:                assertEquals("ewestfal@indiana.edu", user.getEmailAddress());
057:                assertEquals("Eric Westfall", user.getDisplayName());
058:                assertEquals("Eric", user.getGivenName());
059:                assertEquals("Westfall", user.getLastName());
060:
061:                // get 'ewestfal' by authentication id
062:                user = userService.getWorkflowUser(new AuthenticationUserId(
063:                        "ewestfal"));
064:                assertNotNull(user);
065:                assertEquals("1", user.getWorkflowId());
066:                assertEquals("ewestfal", user.getAuthenticationUserId()
067:                        .getAuthenticationId());
068:
069:                // get 'ewestfal' by empl id
070:                user = userService.getWorkflowUser(new EmplId("1"));
071:                assertNotNull(user);
072:                assertEquals("1", user.getWorkflowId());
073:                assertEquals("ewestfal", user.getAuthenticationUserId()
074:                        .getAuthenticationId());
075:
076:                // get 'ewestfal' by uuid
077:                user = userService.getWorkflowUser(new UuId("1"));
078:                assertNotNull(user);
079:                assertEquals("1", user.getWorkflowId());
080:                assertEquals("ewestfal", user.getAuthenticationUserId()
081:                        .getAuthenticationId());
082:
083:                // check the VO version of the same method
084:
085:                //get 'ewestfal' by workflow id VO
086:                user = userService.getWorkflowUser(new WorkflowIdVO("1"));
087:                assertNotNull(user);
088:                assertEquals("1", user.getWorkflowId());
089:                assertEquals("ewestfal", user.getAuthenticationUserId()
090:                        .getAuthenticationId());
091:
092:                // get 'ewestfal' by authentication id VO
093:                user = userService.getWorkflowUser(new NetworkIdVO("ewestfal"));
094:                assertNotNull(user);
095:                assertEquals("1", user.getWorkflowId());
096:                assertEquals("ewestfal", user.getAuthenticationUserId()
097:                        .getAuthenticationId());
098:
099:                // get 'ewestfal' by empl id VO
100:                user = userService.getWorkflowUser(new EmplIdVO("1"));
101:                assertNotNull(user);
102:                assertEquals("1", user.getWorkflowId());
103:                assertEquals("ewestfal", user.getAuthenticationUserId()
104:                        .getAuthenticationId());
105:
106:                // get 'ewestfal' by uuid VO
107:                user = userService.getWorkflowUser(new UuIdVO("1"));
108:                assertNotNull(user);
109:                assertEquals("1", user.getWorkflowId());
110:                assertEquals("ewestfal", user.getAuthenticationUserId()
111:                        .getAuthenticationId());
112:
113:                // Try fetching a different user, UserServiceTestUser
114:
115:                user = userService.getWorkflowUser(new WorkflowUserId(
116:                        "123456789"));
117:                assertNotNull(user);
118:                assertEquals("123456789", user.getWorkflowId());
119:                assertEquals("UserServiceTestUser", user
120:                        .getAuthenticationUserId().getAuthenticationId());
121:
122:                user = userService.getWorkflowUser(new AuthenticationUserId(
123:                        "UserServiceTestUser"));
124:                assertNotNull(user);
125:                assertEquals("123456789", user.getWorkflowId());
126:                assertEquals("UserServiceTestUser", user
127:                        .getAuthenticationUserId().getAuthenticationId());
128:
129:                user = userService.getWorkflowUser(new EmplId("00abc987123"));
130:                assertNotNull(user);
131:                assertEquals("123456789", user.getWorkflowId());
132:                assertEquals("UserServiceTestUser", user
133:                        .getAuthenticationUserId().getAuthenticationId());
134:
135:                user = userService.getWorkflowUser(new UuId("1029384756"));
136:                assertNotNull(user);
137:                assertEquals("123456789", user.getWorkflowId());
138:                assertEquals("UserServiceTestUser", user
139:                        .getAuthenticationUserId().getAuthenticationId());
140:
141:                // Now try fetching some bad users and watch the EdenUserNotFoundExceptions fly...
142:
143:                try {
144:                    user = userService
145:                            .getWorkflowUser(new AuthenticationUserId(
146:                                    "BadIdWhichWillNeverReturnAUser,NotInAMillionYears"));
147:                    fail("Bad id should have thrown an exception.");
148:                } catch (EdenUserNotFoundException e) {
149:                }
150:
151:                try {
152:                    user = userService
153:                            .getWorkflowUser(new WorkflowUserId("-1"));
154:                    fail("Bad id should have thrown an exception.");
155:                } catch (EdenUserNotFoundException e) {
156:                }
157:
158:                // try fetching with a null id, should throw IllegalArgumentException
159:                try {
160:                    user = userService.getWorkflowUser((UserId) null);
161:                    fail("Passing null should have thrown an exception");
162:                } catch (IllegalArgumentException e) {
163:                }
164:
165:                // try fetching with a null "wrapped" id, should throw EdenUserNotFoundException
166:                try {
167:                    user = userService
168:                            .getWorkflowUser(new AuthenticationUserId(null));
169:                    fail("Null id should have thrown an exception");
170:                } catch (EdenUserNotFoundException e) {
171:                }
172:
173:            }
174:
175:            @Test
176:            public void testGetBlankUser() throws Exception {
177:                // the service implementation used by the tests is the one which comes out of the box, so we should be
178:                // creating instances of SimpleUsers
179:                WorkflowUser blankUser = userService.getBlankUser();
180:                assertNotNull(blankUser);
181:            }
182:
183:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.