01: package org.drftpd.tests;
02:
03: import java.util.Date;
04:
05: import org.drftpd.commands.UserManagement;
06: import org.drftpd.usermanager.AbstractUser;
07: import org.drftpd.usermanager.AbstractUserManager;
08: import org.drftpd.usermanager.UserFileException;
09: import org.drftpd.usermanager.UserManager;
10:
11: public class DummyUser extends AbstractUser {
12: private DummyUserManager _userManager;
13:
14: public DummyUser(String name) {
15: super (name);
16: }
17:
18: public DummyUser(String user, DummyUserManager userManager) {
19: super (user);
20: _userManager = userManager;
21: }
22:
23: public DummyUser(String username, long time) {
24: this (username);
25: getKeyedMap().setObject(UserManagement.CREATED, new Date(time));
26: }
27:
28: public boolean checkPassword(String password) {
29: return true;
30: }
31:
32: public void commit() throws UserFileException {
33: }
34:
35: public void purge() {
36: throw new UnsupportedOperationException();
37: }
38:
39: public void rename(String username) {
40: throw new UnsupportedOperationException();
41: }
42:
43: public void setLastReset(long l) {
44: _lastReset = l;
45: }
46:
47: public void setPassword(String password) {
48: }
49:
50: public void setUploadedBytes(long bytes) {
51: _uploadedBytes[P_ALL] = bytes;
52: }
53:
54: public void setUploadedBytesDay(long bytes) {
55: _uploadedBytes[P_DAY] = bytes;
56: }
57:
58: public void setUploadedBytesMonth(long bytes) {
59: _uploadedBytes[P_MONTH] = bytes;
60: }
61:
62: // public void setUploadedBytesForTrialPeriod(int period, long l) {
63: // switch (period) {
64: // case Trial.PERIOD_DAILY:
65: // setUploadedBytesDay(l);
66: //
67: // return;
68: //
69: // case Trial.PERIOD_MONTHLY:
70: // setUploadedBytesMonth(l);
71: //
72: // return;
73: //
74: // case Trial.PERIOD_WEEKLY:
75: // setUploadedBytesWeek(l);
76: //
77: // return;
78: //
79: // default:
80: // throw new RuntimeException();
81: // }
82: // }
83: public void setUploadedBytesWeek(long bytes) {
84: _uploadedBytes[P_WEEK] = bytes;
85: }
86:
87: public UserManager getUserManager() {
88: return _userManager;
89: }
90:
91: public AbstractUserManager getAbstractUserManager() {
92: return _userManager;
93: }
94: }
|