1 18 package org.drftpd.slaveselection.filter; 19 20 import java.util.Arrays ; 21 import java.util.Collections ; 22 import java.util.Properties ; 23 24 import junit.framework.TestCase; 25 import junit.framework.TestSuite; 26 import net.sf.drftpd.NoAvailableSlaveException; 27 import net.sf.drftpd.master.RemoteSlave; 28 import net.sf.drftpd.slave.Transfer; 29 30 import org.apache.log4j.BasicConfigurator; 31 32 36 public class SlaveSelectionManagerTest extends TestCase { 37 38 public SlaveSelectionManagerTest(String fName) { 39 super(fName); 40 } 41 42 public static TestSuite suite() { 43 return new TestSuite(SlaveSelectionManagerTest.class); 44 } 45 46 public void testEmptyFail() { 47 Properties p = new Properties (); 48 try { 49 new FilterChain(null, p); 50 fail(); 51 } catch (IllegalArgumentException pass) { 52 } 53 } 54 55 public void testBandwidth() { 56 Properties p = new Properties (); 57 p.put("1.filter", "bandwidth"); 58 p.put("1.multiplier", "1"); 60 FilterChain ssm = new FilterChain(null, p); 61 RemoteSlave rslaves[] = 62 { 63 new RemoteSlave("slave1", Collections.EMPTY_LIST), 64 new RemoteSlave("slave2", Collections.EMPTY_LIST)}; 65 66 try { 67 ssm.getBestSlave( 68 new ScoreChart(Arrays.asList(rslaves)), null, null, 69 Transfer.TRANSFER_SENDING_DOWNLOAD, 70 new MatchdirFilterTest.LinkedRemoteFilePath( 71 "/blabla/file.txt")); 72 fail(); } catch (NoAvailableSlaveException pass) { 74 } 75 } 76 public void setUp() { 77 BasicConfigurator.configure(); 78 } 79 } 80 | Popular Tags |