package peer;
import util.Log;
import junit.framework.TestCase;
public class AutonomicStrategyChooserTest extends TestCase {
public void testChooser() throws Exception{
PeerHash peers = new PeerHash();
//No Nodes
assertTrue(AutonomicStrategyChooser.chooseStrategy(peers,new Log()) instanceof RobustStrategy);
//1 Nodes
peers.set(new Peer("peer1",0,0));
assertTrue(AutonomicStrategyChooser.chooseStrategy(peers,new Log()) instanceof RobustStrategy);
// 2 Nodes
peers.set(new Peer("peer2",0,0));
assertTrue(AutonomicStrategyChooser.chooseStrategy(peers,new Log()) instanceof RobustStrategy);
//3 Nodes
peers.set(new Peer("peer3",0,0));
assertTrue(AutonomicStrategyChooser.chooseStrategy(peers,new Log()) instanceof RobustStrategy);
// 4 Nodes
peers.set(new Peer("peer4",0,0));
assertTrue(AutonomicStrategyChooser.chooseStrategy(peers,new Log()) instanceof MinimizeLatencyStrategy);
//5 Nodes
peers.set(new Peer("peer5",0,0));
assertTrue(AutonomicStrategyChooser.chooseStrategy(peers,new Log()) instanceof MinimizeLatencyStrategy);
// 6 Nodes
peers.set(new Peer("peer6",0,0));
assertTrue(AutonomicStrategyChooser.chooseStrategy(peers,new Log()) instanceof MinimizeLatencyStrategy);
//7 Nodes
peers.set(new Peer("peer7",0,0));
assertTrue(AutonomicStrategyChooser.chooseStrategy(peers,new Log()) instanceof MinimizeStorageStrategy);
// 8 Nodes
peers.set(new Peer("peer8",0,0));
assertTrue(AutonomicStrategyChooser.chooseStrategy(peers,new Log()) instanceof MinimizeStorageStrategy);
//9 Nodes
peers.set(new Peer("peer9",0,0));
assertTrue(AutonomicStrategyChooser.chooseStrategy(peers,new Log()) instanceof MinimizeStorageStrategy);
// 10 Nodes
peers.set(new Peer("peer10",0,0));
assertTrue(AutonomicStrategyChooser.chooseStrategy(peers,new Log()) instanceof MinimizeStorageStrategy);
}
}