01: /*
02: * This file is part of DrFTPD, Distributed FTP Daemon.
03: *
04: * DrFTPD is free software; you can redistribute it and/or modify it under the
05: * terms of the GNU General Public License as published by the Free Software
06: * Foundation; either version 2 of the License, or (at your option) any later
07: * version.
08: *
09: * DrFTPD is distributed in the hope that it will be useful, but WITHOUT ANY
10: * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
11: * A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12: *
13: * You should have received a copy of the GNU General Public License along with
14: * DrFTPD; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
15: * Suite 330, Boston, MA 02111-1307 USA
16: */
17: package org.drftpd.tests;
18:
19: import org.drftpd.master.ConnectionManager;
20: import org.drftpd.usermanager.AbstractUserManager;
21: import org.drftpd.usermanager.NoSuchUserException;
22: import org.drftpd.usermanager.User;
23: import org.drftpd.usermanager.UserFileException;
24:
25: import java.io.File;
26: import java.util.Collection;
27: import java.util.Collections;
28:
29: /**
30: * @author mog
31: * @version $Id: DummyUserManager.java 838 2004-12-01 02:35:02Z mog $
32: */
33: public class DummyUserManager extends AbstractUserManager {
34: private User _user;
35:
36: public DummyUserManager() {
37: super ();
38: }
39:
40: public User createUser(String username) {
41: throw new UnsupportedOperationException();
42: }
43:
44: public User create(String username) throws UserFileException {
45: DummyUser u = new DummyUser(username, this );
46: add(u);
47:
48: return u;
49: }
50:
51: public Collection getAllGroups() throws UserFileException {
52: throw new UnsupportedOperationException();
53: }
54:
55: public void add(User user) {
56: _users.put(user.getName(), user);
57: }
58:
59: public User getUserByNameUnchecked(String username)
60: throws NoSuchUserException, UserFileException {
61: return _user;
62: }
63:
64: public User getUserByName(String username) {
65: return _user;
66: }
67:
68: public void init(ConnectionManager mgr) {
69: throw new UnsupportedOperationException();
70: }
71:
72: public void saveAll() throws UserFileException {
73: throw new UnsupportedOperationException();
74: }
75:
76: public void setUser(User user) {
77: _user = user;
78: }
79:
80: public Collection getAllUsers() throws UserFileException {
81: return Collections.unmodifiableCollection(_users.values());
82: }
83:
84: protected File getUserpathFile() {
85: throw new UnsupportedOperationException();
86: }
87:
88: protected File getUserFile(String username) {
89: throw new UnsupportedOperationException();
90: }
91: }
|