BandwidthFilter extends Filter { public void process(ScoreChart scorechart, User user, InetAddress source, char direction, InodeHandleInterface file, RemoteSlave sourceSlave) { for (Iterator<ScoreChart.SlaveScore> iter = scorechart.getSlaveScores().iterator(); iter.hasNext(); ) { ScoreChart.SlaveScore score = iter.next(); SlaveStatus status; try { status = score.getRSlave().getSlaveStatusAvailable(); } catch (SlaveUnavailableException e) { iter.remove(); continue; } score.addScore(-(long) (status.getThroughputDirection(direction) * _multiplier)); } } BandwidthFilter(int i, Properties p); void process(ScoreChart scorechart, User user, InetAddress source,
                        char direction, InodeHandleInterface file, RemoteSlave sourceSlave);  }
@Test public void testBandwidth() throws NoAvailableSlaveException, ObjectNotFoundException { Properties p = new Properties(); p.put("1.multiplier", "3"); Filter f = new BandwidthFilter(1, p); SlaveStatus status = new SlaveStatus(new DiskStatus(0, 0), 0, 0, 100, 0, 100, 0); RemoteSlave[] list = {new RS("slave1", status)}; ScoreChart sc = new ScoreChart(Arrays.asList(list)); f.process(sc, null, null, Transfer.TRANSFER_SENDING_DOWNLOAD, null, null); assertEquals(-300, sc.getScoreForSlave(list[0]).getScore()); }