1 package org.drftpd.tests; 2 3 import net.sf.drftpd.event.listeners.Trial; 4 import net.sf.drftpd.master.usermanager.AbstractUser; 5 import net.sf.drftpd.master.usermanager.UserFileException; 6 7 public class DummyUser extends AbstractUser { 8 public DummyUser(String name) { 9 super(name); 10 } 11 12 public DummyUser(String username, long time) { 13 this(username); 14 setCreated(time); 15 } 16 17 public boolean checkPassword(String password) { 18 return true; 19 } 20 21 public void commit() throws UserFileException { 22 } 23 24 public void purge() { 25 throw new UnsupportedOperationException (); 26 } 27 28 public void rename(String username) { 29 throw new UnsupportedOperationException (); 30 } 31 public void setCreated(long l) { 32 created = l; 33 } 34 35 public void setPassword(String password) { 36 throw new UnsupportedOperationException (); 37 } 38 39 public void setUploadedBytes(long bytes) { 40 uploadedBytes = bytes; 41 } 42 public void setUploadedBytesDay(long bytes) { 43 uploadedBytesDay = bytes; 44 } 45 public void setUploadedBytesMonth(long bytes) { 46 uploadedBytesMonth = bytes; 47 } 48 public void setUploadedBytesWeek(long bytes) { 49 uploadedBytesWeek = bytes; 50 } 51 52 public void setLastReset(long l) { 53 lastReset = l; 54 } 55 56 public void setUploadedBytesPeriod(int period, long l) { 57 switch (period) { 58 case Trial.PERIOD_DAILY : 59 setUploadedBytesDay(l); 60 return; 61 case Trial.PERIOD_MONTHLY : 62 setUploadedBytesMonth(l); 63 return; 64 case Trial.PERIOD_WEEKLY : 65 setUploadedBytesWeek(l); 66 return; 67 default : 68 throw new RuntimeException (); 69 } 70 } 71 72 } 73 | Popular Tags |