Package peer

Source Code of peer.AutonomicStrategyChooserTest

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);
   
   
  }
 
}
TOP

Related Classes of peer.AutonomicStrategyChooserTest

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.