01: /**********************************************************************************
02: * $URL: https://source.sakaiproject.org/svn/providers/tags/sakai_2-4-1/imsent/src/java/org/sakaiproject/component/imsent/user/IMSEntProviderUnitTest.java $
03: * $Id: IMSEntProviderUnitTest.java 9187 2006-05-09 19:48:15Z ggolden@umich.edu $
04: ***********************************************************************************
05: *
06: * Copyright (c) 2003, 2004, 2005, 2006 The Sakai Foundation.
07: *
08: * Licensed under the Educational Community License, Version 1.0 (the "License");
09: * you may not use this file except in compliance with the License.
10: * You may obtain a copy of the License at
11: *
12: * http://www.opensource.org/licenses/ecl1.php
13: *
14: * Unless required by applicable law or agreed to in writing, software
15: * distributed under the License is distributed on an "AS IS" BASIS,
16: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17: * See the License for the specific language governing permissions and
18: * limitations under the License.
19: *
20: **********************************************************************************/package org.sakaiproject.component.imsent.user;
21:
22: import org.sakaiproject.authz.api.GroupProvider;
23: import org.sakaiproject.user.api.UserDirectoryProvider;
24:
25: public class IMSEntProviderUnitTest {
26:
27: /**********************************************************************************************************************************************************************************************************************************************************
28: * In-House Unit Check
29: *********************************************************************************************************************************************************************************************************************************************************/
30:
31: // TODO: Make these real unit tests
32: private static boolean m_passUnitTest = true;
33:
34: private static void passFail(boolean testVal, String message) {
35: if (testVal) {
36: System.out.println("Passed unit Test" + message);
37: } else {
38: System.out.println("Failed Unit Test:" + message);
39: m_passUnitTest = false;
40: }
41: }
42:
43: public static boolean localUnitTests(UserDirectoryProvider udp,
44: GroupProvider rp) {
45: m_passUnitTest = true; // Assume we pass
46: if (udp != null) {
47: passFail(!udp.userExists("user1"),
48: "Checking existing user retrieval (user1)");
49: passFail(udp.userExists("user7"),
50: "Non existent user test (user7)");
51: }
52: if (rp != null) {
53: System.out.println("Testing RP");
54: }
55:
56: return m_passUnitTest;
57: }
58: }
|